vendor: 4,409 bytes, lines 1-181
1/*! 2 * jQuery JavaScript Library v1.12.4 3 * http://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * http://sizzlejs.com/ 7 * 8 * Copyright jQuery Foundation and other contributors 9 * Released under the MIT license 10 * http://jquery.org/license 11 * 12 * Date: 2016-05-20T17:17Z 13 */ 14 15 16(function( global, factory ) { 17 18 if ( typeof module === "object" && typeof module.exports === "object" ) { 19 // For CommonJS and CommonJS-like environments where a proper `window` 20 // is present, execute the factory and get jQuery. 21 // For environments that do not have a `window` with a `document` 22 // (such as Node.js), expose a factory as module.exports. 23 // This accentuates the need for the creation of a real `window`. 24 // e.g. var jQuery = require("jquery")(window); 25 // See ticket #14549 for more info. 26 module.exports = global.document ? 27 factory( global, true ) : 28 function( w ) { 29 if ( !w.document ) { 30 throw new Error( "jQuery requires a window with a document" ); 31 } 32 return factory( w ); 33 }; 34 } else { 35 factory( global ); 36 } 37 38// Pass this if window is not defined yet 39}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 40 41// Support: Firefox 18+ 42// Can't be in strict mode, several libs including ASP.NET trace 43// the stack via arguments.caller.callee and Firefox dies if 44// you try to trace through "use strict" call chains. (#13335) 45//"use strict"; 46var deletedIds = []; 47 48var document = window.document; 49 50var slice = deletedIds.slice; 51 52var concat = deletedIds.concat; 53 54var push = deletedIds.push; 55 56var indexOf = deletedIds.indexOf; 57 58var class2type = {}; 59 60var toString = class2type.toString; 61 62var hasOwn = class2type.hasOwnProperty; 63 64var support = {}; 65 66 67 68var 69 version = "1.12.4", 70 71 // Define a local copy of jQuery 72 jQuery = function( selector, context ) { 73 74 // The jQuery object is actually just the init constructor 'enhanced' 75 // Need init if jQuery is called (just allow error to be thrown if not included) 76 return new jQuery.fn.init( selector, context ); 77 }, 78 79 // Support: Android<4.1, IE<9 80 // Make sure we trim BOM and NBSP 81 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 82 83 // Matches dashed string for camelizing 84 rmsPrefix = /^-ms-/, 85 rdashAlpha = /-([\da-z])/gi, 86 87 // Used by jQuery.camelCase as callback to replace() 88 fcamelCase = function( all, letter ) { 89 return letter.toUpperCase(); 90 }; 91 92jQuery.fn = jQuery.prototype = { 93 94 // The current version of jQuery being used 95 jquery: version, 96 97 constructor: jQuery, 98 99 // Start with an empty selector 100 selector: "", 101 102 // The default length of a jQuery object is 0 103 length: 0, 104 105 toArray: function() { 106 return slice.call( this ); 107 }, 108 109 // Get the Nth element in the matched element set OR 110 // Get the whole matched element set as a clean array 111 get: function( num ) { 112 return num != null ? 113 114 // Return just the one element from the set 115 ( num < 0 ? this[ num + this.length ] : this[ num ] ) : 116 117 // Return all the elements in a clean array 118 slice.call( this ); 119 }, 120 121 // Take an array of elements and push it onto the stack 122 // (returning the new matched element set) 123 pushStack: function( elems ) { 124 125 // Build a new jQuery matched element set 126 var ret = jQuery.merge( this.constructor(), elems ); 127 128 // Add the old object onto the stack (as a reference) 129 ret.prevObject = this; 130 ret.context = this.context; 131 132 // Return the newly-formed element set 133 return ret; 134 }, 135 136 // Execute a callback for every element in the matched set. 137 each: function( callback ) { 138 return jQuery.each( this, callback ); 139 }, 140 141 map: function( callback ) { 142 return this.pushStack( jQuery.map( this, function( elem, i ) { 143 return callback.call( elem, i, elem ); 144 } ) ); 145 }, 146 147 slice: function() { 148 return this.pushStack( slice.apply( this, arguments ) ); 149 }, 150 151 first: function() { 152 return this.eq( 0 ); 153 }, 154 155 last: function() { 156 return this.eq( -1 ); 157 }, 158 159 eq: function( i ) { 160 var len = this.length, 161 j = +i + ( i < 0 ? len : 0 ); 162 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 163 }, 164 165 end: function() { 166 return this.prevObject || this.constructor(); 167 }, 168 169 // For internal use only. 170 // Behaves like an Array's method, not like a jQuery method. 171 push: push, 172 sort: deletedIds.sort, 173 splice: deletedIds.splice 174}; 175 176jQuery.extend = jQuery.fn.extend = function() { 177 var src, copyIsArray, copy, name, options, clone, 178 target = arguments[ 0 ] || {}, 179 i = 1, 180 length = arguments.length, 181 deep = false;
182 183 // Handle a deep copy situation 184 if ( typeof target === "boolean" ) { 185 deep = target; 186 187 // skip the boolean and the target 188 target = arguments[ i ] || {}; 189 i++; 190 } 191 192 // Handle case when target is a string or something (possible in deep copy) 193 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { 194 target = {}; 195 } 196 197 // extend jQuery itself if only one argument is passed 198 if ( i === length ) { 199 target = this; 200 i--; 201 } 202 203 for ( ; i < length; i++ ) { 204 205 // Only deal with non-null/undefined values 206 if ( ( options = arguments[ i ] ) != null ) { 207 208 // Extend the base object 209 for ( name in options ) { 210 src = target[ name ]; 211 copy = options[ name ]; 212 213 // Prevent never-ending loop 214 if ( target === copy ) { 215 continue; 216 } 217 218 // Recurse if we're merging plain objects or arrays 219 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 220 ( copyIsArray = jQuery.isArray( copy ) ) ) ) { 221 222 if ( copyIsArray ) { 223 copyIsArray = false; 224 clone = src && jQuery.isArray( src ) ? src : []; 225 226 } else { 227 clone = src && jQuery.isPlainObject( src ) ? src : {}; 228 } 229 230 // Never move original objects, clone them 231 target[ name ] = jQuery.extend( deep, clone, copy ); 232 233 // Don't bring in undefined values 234 } else if ( copy !== undefined ) { 235 target[ name ] = copy; 236 } 237 } 238 } 239 } 240 241 // Return the modified object 242 return target; 243}; 244 245jQuery.extend( { 246 247 // Unique for each copy of jQuery on the page 248 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 249 250 // Assume jQuery is ready without the ready module 251 isReady: true, 252 253 error: function( msg ) { 254 throw new Error( msg ); 255 }, 256 257 noop: function() {}, 258 259 // See test/unit/core.js for details concerning isFunction. 260 // Since version 1.3, DOM methods and functions like alert 261 // aren't supported. They return false on IE (#2968). 262 isFunction: function( obj ) { 263 return jQuery.type( obj ) === "function"; 264 }, 265 266 isArray: Array.isArray || function( obj ) { 267 return jQuery.type( obj ) === "array"; 268 }, 269 270 isWindow: function( obj ) { 271 /* jshint eqeqeq: false */ 272 return obj != null && obj == obj.window; 273 }, 274 275 isNumeric: function( obj ) { 276 277 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 278 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 279 // subtraction forces infinities to NaN 280 // adding 1 corrects loss of precision from parseFloat (#15100) 281 var realStringObj = obj && obj.toString(); 282 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; 283 }, 284 285 isEmptyObject: function( obj ) { 286 var name; 287 for ( name in obj ) { 288 return false; 289 } 290 return true; 291 }, 292 293 isPlainObject: function( obj ) { 294 var key; 295 296 // Must be an Object. 297 // Because of IE, we also have to check the presence of the constructor property. 298 // Make sure that DOM nodes and window objects don't pass through, as well 299 if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 300 return false; 301 } 302 303 try { 304 305 // Not own constructor property must be Object 306 if ( obj.constructor && 307 !hasOwn.call( obj, "constructor" ) && 308 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { 309 return false; 310 } 311 } catch ( e ) { 312 313 // IE8,9 Will throw exceptions on certain host objects #9897 314 return false; 315 } 316 317 // Support: IE<9 318 // Handle iteration over inherited properties before own properties. 319 if ( !support.ownFirst ) { 320 for ( key in obj ) { 321 return hasOwn.call( obj, key ); 322 } 323 } 324 325 // Own properties are enumerated firstly, so to speed up, 326 // if last one is own, then all properties are own. 327 for ( key in obj ) {} 328 329 return key === undefined || hasOwn.call( obj, key ); 330 }, 331 332 type: function( obj ) { 333 if ( obj == null ) { 334 return obj + ""; 335 } 336 return typeof obj === "object" || typeof obj === "function" ? 337 class2type[ toString.call( obj ) ] || "object" : 338 typeof obj; 339 }, 340 341 // Workarounds based on findings by Jim Driscoll 342 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 343 globalEval: function( data ) { 344 if ( data && jQuery.trim( data ) ) { 345 346 // We use execScript on Internet Explorer 347 // We use an anonymous function so that context is window 348 // rather than jQuery in Firefox 349 ( window.execScript || function( data ) { 350 window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation 351 } )( data ); 352 } 353 }, 354 355 // Convert dashed to camelCase; used by the css and data modules 356 // Microsoft forgot to hump their vendor prefix (#9572) 357 camelCase: function( string ) { 358 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 359 }, 360
361 nodeName: function( elem, name ) { 362 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 363 }, 364 365 each: function( obj, callback ) { 366 var length, i = 0; 367 368 if ( isArrayLike( obj ) ) { 369 length = obj.length; 370 for ( ; i < length; i++ ) { 371 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 372 break; 373 } 374 } 375 } else { 376 for ( i in obj ) { 377 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 378 break; 379 } 380 } 381 } 382 383 return obj; 384 }, 385 386 // Support: Android<4.1, IE<9 387 trim: function( text ) { 388 return text == null ? 389 "" : 390 ( text + "" ).replace( rtrim, "" ); 391 }, 392 393 // results is for internal usage only 394 makeArray: function( arr, results ) { 395 var ret = results || []; 396 397 if ( arr != null ) { 398 if ( isArrayLike( Object( arr ) ) ) { 399 jQuery.merge( ret, 400 typeof arr === "string" ? 401 [ arr ] : arr 402 ); 403 } else { 404 push.call( ret, arr ); 405 } 406 } 407 408 return ret; 409 }, 410 411 inArray: function( elem, arr, i ) { 412 var len; 413 414 if ( arr ) { 415 if ( indexOf ) { 416 return indexOf.call( arr, elem, i ); 417 } 418 419 len = arr.length; 420 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 421 422 for ( ; i < len; i++ ) { 423 424 // Skip accessing in sparse arrays 425 if ( i in arr && arr[ i ] === elem ) { 426 return i; 427 } 428 } 429 } 430 431 return -1; 432 }, 433 434 merge: function( first, second ) { 435 var len = +second.length, 436 j = 0, 437 i = first.length; 438 439 while ( j < len ) { 440 first[ i++ ] = second[ j++ ]; 441 } 442 443 // Support: IE<9 444 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) 445 if ( len !== len ) { 446 while ( second[ j ] !== undefined ) { 447 first[ i++ ] = second[ j++ ]; 448 } 449 } 450 451 first.length = i; 452 453 return first; 454 }, 455 456 grep: function( elems, callback, invert ) { 457 var callbackInverse, 458 matches = [], 459 i = 0, 460 length = elems.length, 461 callbackExpect = !invert; 462 463 // Go through the array, only saving the items 464 // that pass the validator function 465 for ( ; i < length; i++ ) { 466 callbackInverse = !callback( elems[ i ], i ); 467 if ( callbackInverse !== callbackExpect ) { 468 matches.push( elems[ i ] ); 469 } 470 } 471 472 return matches; 473 }, 474 475 // arg is for internal usage only 476 map: function( elems, callback, arg ) { 477 var length, value, 478 i = 0, 479 ret = []; 480 481 // Go through the array, translating each of the items to their new values 482 if ( isArrayLike( elems ) ) { 483 length = elems.length; 484 for ( ; i < length; i++ ) { 485 value = callback( elems[ i ], i, arg ); 486 487 if ( value != null ) { 488 ret.push( value ); 489 } 490 } 491 492 // Go through every key on the object, 493 } else { 494 for ( i in elems ) { 495 value = callback( elems[ i ], i, arg ); 496 497 if ( value != null ) { 498 ret.push( value ); 499 } 500 } 501 } 502 503 // Flatten any nested arrays 504 return concat.apply( [], ret ); 505 }, 506 507 // A global GUID counter for objects 508 guid: 1, 509 510 // Bind a function to a context, optionally partially applying any 511 // arguments. 512 proxy: function( fn, context ) { 513 var args, proxy, tmp; 514 515 if ( typeof context === "string" ) { 516 tmp = fn[ context ]; 517 context = fn; 518 fn = tmp; 519 } 520 521 // Quick check to determine if target is callable, in the spec 522 // this throws a TypeError, but we will just return undefined. 523 if ( !jQuery.isFunction( fn ) ) { 524 return undefined; 525 } 526 527 // Simulated bind 528 args = slice.call( arguments, 2 ); 529 proxy = function() { 530 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 531 }; 532 533 // Set the guid of unique handler to the same of original handler, so it can be removed 534 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 535 536 return proxy; 537 }, 538 539 now: function() { 540 return +( new Date() ); 541 }, 542 543 // jQuery.support is not used in Core but other projects attach their 544 // properties to it so it needs to exist. 545 support: support 546} ); 547 548// JSHint would error on this code due to the Symbol not being defined in ES5. 549// Defining this global in .jshintrc would create a danger of using the global 550// unguarded in another place, it seems safer to just disable JSHint for these 551// three lines. 552/* jshint ignore: start */ 553if ( typeof Symbol === "function" ) { 554 jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ]; 555} 556/* jshint ignore: end */ 557 558// Populate the class2type map 559jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 560function( i, name ) { 561 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 562} ); 563 564function isArrayLike( obj ) { 565 566 // Support: iOS 8.2 (not reproducible in simulator) 567 // `in` check used to prevent JIT error (gh-2145) 568 // hasOwn isn't used here due to false negatives 569 // regarding Nodelist length in IE 570 var length = !!obj && "length" in obj && obj.length, 571 type = jQuery.type( obj ); 572 573 if ( type === "function" || jQuery.isWindow( obj ) ) { 574 return false;
vendor: 26,428 bytes, lines 575-1499
575 } 576 577 return type === "array" || length === 0 || 578 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 579} 580var Sizzle = 581/*! 582 * Sizzle CSS Selector Engine v2.2.1 583 * http://sizzlejs.com/ 584 * 585 * Copyright jQuery Foundation and other contributors 586 * Released under the MIT license 587 * http://jquery.org/license 588 * 589 * Date: 2015-10-17 590 */ 591(function( window ) { 592 593var i, 594 support, 595 Expr, 596 getText, 597 isXML, 598 tokenize, 599 compile, 600 select, 601 outermostContext, 602 sortInput, 603 hasDuplicate, 604 605 // Local document vars 606 setDocument, 607 document, 608 docElem, 609 documentIsHTML, 610 rbuggyQSA, 611 rbuggyMatches, 612 matches, 613 contains, 614 615 // Instance-specific data 616 expando = "sizzle" + 1 * new Date(), 617 preferredDoc = window.document, 618 dirruns = 0, 619 done = 0, 620 classCache = createCache(), 621 tokenCache = createCache(), 622 compilerCache = createCache(), 623 sortOrder = function( a, b ) { 624 if ( a === b ) { 625 hasDuplicate = true; 626 } 627 return 0; 628 }, 629 630 // General-purpose constants 631 MAX_NEGATIVE = 1 << 31, 632 633 // Instance methods 634 hasOwn = ({}).hasOwnProperty, 635 arr = [], 636 pop = arr.pop, 637 push_native = arr.push, 638 push = arr.push, 639 slice = arr.slice, 640 // Use a stripped-down indexOf as it's faster than native 641 // http://jsperf.com/thor-indexof-vs-for/5 642 indexOf = function( list, elem ) { 643 var i = 0, 644 len = list.length; 645 for ( ; i < len; i++ ) { 646 if ( list[i] === elem ) { 647 return i; 648 } 649 } 650 return -1; 651 }, 652 653 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 654 655 // Regular expressions 656 657 // http://www.w3.org/TR/css3-selectors/#whitespace 658 whitespace = "[\\x20\\t\\r\\n\\f]", 659 660 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 661 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 662 663 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 664 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 665 // Operator (capture 2) 666 "*([*^$|!~]?=)" + whitespace + 667 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 668 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 669 "*\\]", 670 671 pseudos = ":(" + identifier + ")(?:\\((" + 672 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 673 // 1. quoted (capture 3; capture 4 or capture 5) 674 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 675 // 2. simple (capture 6) 676 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 677 // 3. anything else (capture 2) 678 ".*" + 679 ")\\)|)", 680 681 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 682 rwhitespace = new RegExp( whitespace + "+", "g" ), 683 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 684 685 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 686 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 687 688 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 689 690 rpseudo = new RegExp( pseudos ), 691 ridentifier = new RegExp( "^" + identifier + "$" ), 692 693 matchExpr = { 694 "ID": new RegExp( "^#(" + identifier + ")" ), 695 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 696 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 697 "ATTR": new RegExp( "^" + attributes ), 698 "PSEUDO": new RegExp( "^" + pseudos ), 699 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 700 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 701 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 702 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 703 // For use in libraries implementing .is() 704 // We use this for POS matching in `select` 705 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 706 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 707 }, 708 709 rinputs = /^(?:input|select|textarea|button)$/i, 710 rheader = /^h\d$/i, 711 712 rnative = /^[^{]+\{\s*\[native \w/, 713 714 // Easily-parseable/retrievable ID or TAG or CLASS selectors 715 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 716 717 rsibling = /[+~]/, 718 rescape = /'|\\/g, 719 720 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 721 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 722 funescape = function( _, escaped, escapedWhitespace ) { 723 var high = "0x" + escaped - 0x10000; 724 // NaN means non-codepoint 725 // Support: Firefox<24 726 // Workaround erroneous numeric interpretation of +"0x" 727 return high !== high || escapedWhitespace ? 728 escaped : 729 high < 0 ? 730 // BMP codepoint 731 String.fromCharCode( high + 0x10000 ) : 732 // Supplemental Plane codepoint (surrogate pair) 733 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 734 }, 735 736 // Used for iframes 737 // See setDocument() 738 // Removing the function wrapper causes a "Permission Denied" 739 // error in IE 740 unloadHandler = function() { 741 setDocument(); 742 }; 743 744// Optimize for push.apply( _, NodeList ) 745try { 746 push.apply( 747 (arr = slice.call( preferredDoc.childNodes )), 748 preferredDoc.childNodes 749 ); 750 // Support: Android<4.0 751 // Detect silently failing push.apply 752 arr[ preferredDoc.childNodes.length ].nodeType; 753} catch ( e ) { 754 push = { apply: arr.length ? 755 756 // Leverage slice if possible 757 function( target, els ) { 758 push_native.apply( target, slice.call(els) ); 759 } : 760 761 // Support: IE<9 762 // Otherwise append directly 763 function( target, els ) { 764 var j = target.length, 765 i = 0; 766 // Can't trust NodeList.length 767 while ( (target[j++] = els[i++]) ) {} 768 target.length = j - 1; 769 } 770 }; 771} 772 773function Sizzle( selector, context, results, seed ) { 774 var m, i, elem, nid, nidselect, match, groups, newSelector, 775 newContext = context && context.ownerDocument, 776 777 // nodeType defaults to 9, since context defaults to document 778 nodeType = context ? context.nodeType : 9; 779 780 results = results || []; 781 782 // Return early from calls with invalid selector or context 783 if ( typeof selector !== "string" || !selector || 784 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 785 786 return results; 787 } 788 789 // Try to shortcut find operations (as opposed to filters) in HTML documents 790 if ( !seed ) { 791 792 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 793 setDocument( context ); 794 } 795 context = context || document; 796 797 if ( documentIsHTML ) { 798 799 // If the selector is sufficiently simple, try using a "get*By*" DOM method 800 // (excepting DocumentFragment context, where the methods don't exist) 801 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 802 803 // ID selector 804 if ( (m = match[1]) ) { 805 806 // Document context 807 if ( nodeType === 9 ) { 808 if ( (elem = context.getElementById( m )) ) { 809 810 // Support: IE, Opera, Webkit 811 // TODO: identify versions 812 // getElementById can match elements by name instead of ID 813 if ( elem.id === m ) { 814 results.push( elem ); 815 return results; 816 } 817 } else { 818 return results; 819 } 820 821 // Element context 822 } else { 823 824 // Support: IE, Opera, Webkit 825 // TODO: identify versions 826 // getElementById can match elements by name instead of ID 827 if ( newContext && (elem = newContext.getElementById( m )) && 828 contains( context, elem ) && 829 elem.id === m ) { 830 831 results.push( elem ); 832 return results; 833 } 834 } 835 836 // Type selector 837 } else if ( match[2] ) { 838 push.apply( results, context.getElementsByTagName( selector ) ); 839 return results; 840 841 // Class selector 842 } else if ( (m = match[3]) && support.getElementsByClassName && 843 context.getElementsByClassName ) { 844 845 push.apply( results, context.getElementsByClassName( m ) ); 846 return results; 847 } 848 } 849 850 // Take advantage of querySelectorAll 851 if ( support.qsa && 852 !compilerCache[ selector + " " ] && 853 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 854 855 if ( nodeType !== 1 ) { 856 newContext = context; 857 newSelector = selector; 858 859 // qSA looks outside Element context, which is not what we want 860 // Thanks to Andrew Dupont for this workaround technique 861 // Support: IE <=8 862 // Exclude object elements 863 } else if ( context.nodeName.toLowerCase() !== "object" ) { 864 865 // Capture the context ID, setting it first if necessary 866 if ( (nid = context.getAttribute( "id" )) ) { 867 nid = nid.replace( rescape, "\\$&" ); 868 } else { 869 context.setAttribute( "id", (nid = expando) ); 870 } 871 872 // Prefix every selector in the list 873 groups = tokenize( selector ); 874 i = groups.length; 875 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; 876 while ( i-- ) { 877 groups[i] = nidselect + " " + toSelector( groups[i] ); 878 } 879 newSelector = groups.join( "," ); 880 881 // Expand context for sibling selectors 882 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 883 context; 884 } 885 886 if ( newSelector ) { 887 try { 888 push.apply( results, 889 newContext.querySelectorAll( newSelector ) 890 ); 891 return results; 892 } catch ( qsaError ) { 893 } finally { 894 if ( nid === expando ) { 895 context.removeAttribute( "id" ); 896 } 897 } 898 } 899 } 900 } 901 } 902 903 // All others 904 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 905} 906 907/** 908 * Create key-value caches of limited size 909 * @returns {function(string, object)} Returns the Object data after storing it on itself with 910 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 911 * deleting the oldest entry 912 */ 913function createCache() { 914 var keys = []; 915 916 function cache( key, value ) { 917 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 918 if ( keys.push( key + " " ) > Expr.cacheLength ) { 919 // Only keep the most recent entries 920 delete cache[ keys.shift() ]; 921 } 922 return (cache[ key + " " ] = value); 923 } 924 return cache; 925} 926 927/** 928 * Mark a function for special use by Sizzle 929 * @param {Function} fn The function to mark 930 */ 931function markFunction( fn ) { 932 fn[ expando ] = true; 933 return fn; 934} 935 936/** 937 * Support testing using an element 938 * @param {Function} fn Passed the created div and expects a boolean result 939 */ 940function assert( fn ) { 941 var div = document.createElement("div"); 942 943 try { 944 return !!fn( div ); 945 } catch (e) { 946 return false; 947 } finally { 948 // Remove from its parent by default 949 if ( div.parentNode ) { 950 div.parentNode.removeChild( div ); 951 } 952 // release memory in IE 953 div = null; 954 } 955} 956 957/** 958 * Adds the same handler for all of the specified attrs 959 * @param {String} attrs Pipe-separated list of attributes 960 * @param {Function} handler The method that will be applied 961 */ 962function addHandle( attrs, handler ) { 963 var arr = attrs.split("|"), 964 i = arr.length; 965 966 while ( i-- ) { 967 Expr.attrHandle[ arr[i] ] = handler; 968 } 969} 970 971/** 972 * Checks document order of two siblings 973 * @param {Element} a 974 * @param {Element} b 975 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 976 */ 977function siblingCheck( a, b ) { 978 var cur = b && a, 979 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 980 ( ~b.sourceIndex || MAX_NEGATIVE ) - 981 ( ~a.sourceIndex || MAX_NEGATIVE ); 982 983 // Use IE sourceIndex if available on both nodes 984 if ( diff ) { 985 return diff; 986 } 987 988 // Check if b follows a 989 if ( cur ) { 990 while ( (cur = cur.nextSibling) ) { 991 if ( cur === b ) { 992 return -1; 993 } 994 } 995 } 996 997 return a ? 1 : -1; 998} 999 1000/** 1001 * Returns a function to use in pseudos for input types 1002 * @param {String} type 1003 */ 1004function createInputPseudo( type ) { 1005 return function( elem ) { 1006 var name = elem.nodeName.toLowerCase(); 1007 return name === "input" && elem.type === type; 1008 }; 1009} 1010 1011/** 1012 * Returns a function to use in pseudos for buttons 1013 * @param {String} type 1014 */ 1015function createButtonPseudo( type ) { 1016 return function( elem ) { 1017 var name = elem.nodeName.toLowerCase(); 1018 return (name === "input" || name === "button") && elem.type === type; 1019 }; 1020} 1021 1022/** 1023 * Returns a function to use in pseudos for positionals 1024 * @param {Function} fn 1025 */ 1026function createPositionalPseudo( fn ) { 1027 return markFunction(function( argument ) { 1028 argument = +argument; 1029 return markFunction(function( seed, matches ) { 1030 var j, 1031 matchIndexes = fn( [], seed.length, argument ), 1032 i = matchIndexes.length; 1033 1034 // Match elements found at the specified indexes 1035 while ( i-- ) { 1036 if ( seed[ (j = matchIndexes[i]) ] ) { 1037 seed[j] = !(matches[j] = seed[j]); 1038 } 1039 } 1040 }); 1041 }); 1042} 1043 1044/** 1045 * Checks a node for validity as a Sizzle context 1046 * @param {Element|Object=} context 1047 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1048 */ 1049function testContext( context ) { 1050 return context && typeof context.getElementsByTagName !== "undefined" && context; 1051} 1052 1053// Expose support vars for convenience 1054support = Sizzle.support = {}; 1055 1056/** 1057 * Detects XML nodes 1058 * @param {Element|Object} elem An element or a document 1059 * @returns {Boolean} True iff elem is a non-HTML XML node 1060 */ 1061isXML = Sizzle.isXML = function( elem ) { 1062 // documentElement is verified for cases where it doesn't yet exist 1063 // (such as loading iframes in IE - #4833) 1064 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1065 return documentElement ? documentElement.nodeName !== "HTML" : false; 1066}; 1067 1068/** 1069 * Sets document-related variables once based on the current document 1070 * @param {Element|Object} [doc] An element or document object to use to set the document 1071 * @returns {Object} Returns the current document 1072 */ 1073setDocument = Sizzle.setDocument = function( node ) { 1074 var hasCompare, parent, 1075 doc = node ? node.ownerDocument || node : preferredDoc; 1076 1077 // Return early if doc is invalid or already selected 1078 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1079 return document; 1080 } 1081 1082 // Update global variables 1083 document = doc; 1084 docElem = document.documentElement; 1085 documentIsHTML = !isXML( document ); 1086 1087 // Support: IE 9-11, Edge 1088 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1089 if ( (parent = document.defaultView) && parent.top !== parent ) { 1090 // Support: IE 11 1091 if ( parent.addEventListener ) { 1092 parent.addEventListener( "unload", unloadHandler, false ); 1093 1094 // Support: IE 9 - 10 only 1095 } else if ( parent.attachEvent ) { 1096 parent.attachEvent( "onunload", unloadHandler ); 1097 } 1098 } 1099 1100 /* Attributes 1101 ---------------------------------------------------------------------- */ 1102 1103 // Support: IE<8 1104 // Verify that getAttribute really returns attributes and not properties 1105 // (excepting IE8 booleans) 1106 support.attributes = assert(function( div ) { 1107 div.className = "i"; 1108 return !div.getAttribute("className"); 1109 }); 1110 1111 /* getElement(s)By* 1112 ---------------------------------------------------------------------- */ 1113 1114 // Check if getElementsByTagName("*") returns only elements 1115 support.getElementsByTagName = assert(function( div ) { 1116 div.appendChild( document.createComment("") ); 1117 return !div.getElementsByTagName("*").length; 1118 }); 1119 1120 // Support: IE<9 1121 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1122 1123 // Support: IE<10 1124 // Check if getElementById returns elements by name 1125 // The broken getElementById methods don't pick up programatically-set names, 1126 // so use a roundabout getElementsByName test 1127 support.getById = assert(function( div ) { 1128 docElem.appendChild( div ).id = expando; 1129 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1130 }); 1131 1132 // ID find and filter 1133 if ( support.getById ) { 1134 Expr.find["ID"] = function( id, context ) { 1135 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1136 var m = context.getElementById( id ); 1137 return m ? [ m ] : []; 1138 } 1139 }; 1140 Expr.filter["ID"] = function( id ) { 1141 var attrId = id.replace( runescape, funescape ); 1142 return function( elem ) { 1143 return elem.getAttribute("id") === attrId; 1144 }; 1145 }; 1146 } else { 1147 // Support: IE6/7 1148 // getElementById is not reliable as a find shortcut 1149 delete Expr.find["ID"]; 1150 1151 Expr.filter["ID"] = function( id ) { 1152 var attrId = id.replace( runescape, funescape ); 1153 return function( elem ) { 1154 var node = typeof elem.getAttributeNode !== "undefined" && 1155 elem.getAttributeNode("id"); 1156 return node && node.value === attrId; 1157 }; 1158 }; 1159 } 1160 1161 // Tag 1162 Expr.find["TAG"] = support.getElementsByTagName ? 1163 function( tag, context ) { 1164 if ( typeof context.getElementsByTagName !== "undefined" ) { 1165 return context.getElementsByTagName( tag ); 1166 1167 // DocumentFragment nodes don't have gEBTN 1168 } else if ( support.qsa ) { 1169 return context.querySelectorAll( tag ); 1170 } 1171 } : 1172 1173 function( tag, context ) { 1174 var elem, 1175 tmp = [], 1176 i = 0, 1177 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1178 results = context.getElementsByTagName( tag ); 1179 1180 // Filter out possible comments 1181 if ( tag === "*" ) { 1182 while ( (elem = results[i++]) ) { 1183 if ( elem.nodeType === 1 ) { 1184 tmp.push( elem ); 1185 } 1186 } 1187 1188 return tmp; 1189 } 1190 return results; 1191 }; 1192 1193 // Class 1194 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1195 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1196 return context.getElementsByClassName( className ); 1197 } 1198 }; 1199 1200 /* QSA/matchesSelector 1201 ---------------------------------------------------------------------- */ 1202 1203 // QSA and matchesSelector support 1204 1205 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1206 rbuggyMatches = []; 1207 1208 // qSa(:focus) reports false when true (Chrome 21) 1209 // We allow this because of a bug in IE8/9 that throws an error 1210 // whenever `document.activeElement` is accessed on an iframe 1211 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1212 // See http://bugs.jquery.com/ticket/13378 1213 rbuggyQSA = []; 1214 1215 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 1216 // Build QSA regex 1217 // Regex strategy adopted from Diego Perini 1218 assert(function( div ) { 1219 // Select is set to empty string on purpose 1220 // This is to test IE's treatment of not explicitly 1221 // setting a boolean content attribute, 1222 // since its presence should be enough 1223 // http://bugs.jquery.com/ticket/12359 1224 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + 1225 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1226 "<option selected=''></option></select>"; 1227 1228 // Support: IE8, Opera 11-12.16 1229 // Nothing should be selected when empty strings follow ^= or $= or *= 1230 // The test attribute must be unknown in Opera but "safe" for WinRT 1231 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1232 if ( div.querySelectorAll("[msallowcapture^='']").length ) { 1233 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1234 } 1235 1236 // Support: IE8 1237 // Boolean attributes and "value" are not treated correctly 1238 if ( !div.querySelectorAll("[selected]").length ) { 1239 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1240 } 1241 1242 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1243 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1244 rbuggyQSA.push("~="); 1245 } 1246 1247 // Webkit/Opera - :checked should return selected option elements 1248 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1249 // IE8 throws error here and will not see later tests 1250 if ( !div.querySelectorAll(":checked").length ) { 1251 rbuggyQSA.push(":checked"); 1252 } 1253 1254 // Support: Safari 8+, iOS 8+ 1255 // https://bugs.webkit.org/show_bug.cgi?id=136851 1256 // In-page `selector#id sibing-combinator selector` fails 1257 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { 1258 rbuggyQSA.push(".#.+[+~]"); 1259 } 1260 }); 1261 1262 assert(function( div ) { 1263 // Support: Windows 8 Native Apps 1264 // The type and name attributes are restricted during .innerHTML assignment 1265 var input = document.createElement("input"); 1266 input.setAttribute( "type", "hidden" ); 1267 div.appendChild( input ).setAttribute( "name", "D" ); 1268 1269 // Support: IE8 1270 // Enforce case-sensitivity of name attribute 1271 if ( div.querySelectorAll("[name=d]").length ) { 1272 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1273 } 1274 1275 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1276 // IE8 throws error here and will not see later tests 1277 if ( !div.querySelectorAll(":enabled").length ) { 1278 rbuggyQSA.push( ":enabled", ":disabled" ); 1279 } 1280 1281 // Opera 10-11 does not throw on post-comma invalid pseudos 1282 div.querySelectorAll("*,:x"); 1283 rbuggyQSA.push(",.*:"); 1284 }); 1285 } 1286 1287 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1288 docElem.webkitMatchesSelector || 1289 docElem.mozMatchesSelector || 1290 docElem.oMatchesSelector || 1291 docElem.msMatchesSelector) )) ) { 1292 1293 assert(function( div ) { 1294 // Check to see if it's possible to do matchesSelector 1295 // on a disconnected node (IE 9) 1296 support.disconnectedMatch = matches.call( div, "div" ); 1297 1298 // This should fail with an exception 1299 // Gecko does not error, returns false instead 1300 matches.call( div, "[s!='']:x" ); 1301 rbuggyMatches.push( "!=", pseudos ); 1302 }); 1303 } 1304 1305 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1306 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1307 1308 /* Contains 1309 ---------------------------------------------------------------------- */ 1310 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1311 1312 // Element contains another 1313 // Purposefully self-exclusive 1314 // As in, an element does not contain itself 1315 contains = hasCompare || rnative.test( docElem.contains ) ? 1316 function( a, b ) { 1317 var adown = a.nodeType === 9 ? a.documentElement : a, 1318 bup = b && b.parentNode; 1319 return a === bup || !!( bup && bup.nodeType === 1 && ( 1320 adown.contains ? 1321 adown.contains( bup ) : 1322 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1323 )); 1324 } : 1325 function( a, b ) { 1326 if ( b ) { 1327 while ( (b = b.parentNode) ) { 1328 if ( b === a ) { 1329 return true; 1330 } 1331 } 1332 } 1333 return false; 1334 }; 1335 1336 /* Sorting 1337 ---------------------------------------------------------------------- */ 1338 1339 // Document order sorting 1340 sortOrder = hasCompare ? 1341 function( a, b ) { 1342 1343 // Flag for duplicate removal 1344 if ( a === b ) { 1345 hasDuplicate = true; 1346 return 0; 1347 } 1348 1349 // Sort on method existence if only one input has compareDocumentPosition 1350 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1351 if ( compare ) { 1352 return compare; 1353 } 1354 1355 // Calculate position if both inputs belong to the same document 1356 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1357 a.compareDocumentPosition( b ) : 1358 1359 // Otherwise we know they are disconnected 1360 1; 1361 1362 // Disconnected nodes 1363 if ( compare & 1 || 1364 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1365 1366 // Choose the first element that is related to our preferred document 1367 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1368 return -1; 1369 } 1370 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1371 return 1; 1372 } 1373 1374 // Maintain original order 1375 return sortInput ? 1376 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1377 0; 1378 } 1379 1380 return compare & 4 ? -1 : 1; 1381 } : 1382 function( a, b ) { 1383 // Exit early if the nodes are identical 1384 if ( a === b ) { 1385 hasDuplicate = true; 1386 return 0; 1387 } 1388 1389 var cur, 1390 i = 0, 1391 aup = a.parentNode, 1392 bup = b.parentNode, 1393 ap = [ a ], 1394 bp = [ b ]; 1395 1396 // Parentless nodes are either documents or disconnected 1397 if ( !aup || !bup ) { 1398 return a === document ? -1 : 1399 b === document ? 1 : 1400 aup ? -1 : 1401 bup ? 1 : 1402 sortInput ? 1403 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1404 0; 1405 1406 // If the nodes are siblings, we can do a quick check 1407 } else if ( aup === bup ) { 1408 return siblingCheck( a, b ); 1409 } 1410 1411 // Otherwise we need full lists of their ancestors for comparison 1412 cur = a; 1413 while ( (cur = cur.parentNode) ) { 1414 ap.unshift( cur ); 1415 } 1416 cur = b; 1417 while ( (cur = cur.parentNode) ) { 1418 bp.unshift( cur ); 1419 } 1420 1421 // Walk down the tree looking for a discrepancy 1422 while ( ap[i] === bp[i] ) { 1423 i++; 1424 } 1425 1426 return i ? 1427 // Do a sibling check if the nodes have a common ancestor 1428 siblingCheck( ap[i], bp[i] ) : 1429 1430 // Otherwise nodes in our document sort first 1431 ap[i] === preferredDoc ? -1 : 1432 bp[i] === preferredDoc ? 1 : 1433 0; 1434 }; 1435 1436 return document; 1437}; 1438 1439Sizzle.matches = function( expr, elements ) { 1440 return Sizzle( expr, null, null, elements ); 1441}; 1442 1443Sizzle.matchesSelector = function( elem, expr ) { 1444 // Set document vars if needed 1445 if ( ( elem.ownerDocument || elem ) !== document ) { 1446 setDocument( elem ); 1447 } 1448 1449 // Make sure that attribute selectors are quoted 1450 expr = expr.replace( rattributeQuotes, "='$1']" ); 1451 1452 if ( support.matchesSelector && documentIsHTML && 1453 !compilerCache[ expr + " " ] && 1454 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1455 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1456 1457 try { 1458 var ret = matches.call( elem, expr ); 1459 1460 // IE 9's matchesSelector returns false on disconnected nodes 1461 if ( ret || support.disconnectedMatch || 1462 // As well, disconnected nodes are said to be in a document 1463 // fragment in IE 9 1464 elem.document && elem.document.nodeType !== 11 ) { 1465 return ret; 1466 } 1467 } catch (e) {} 1468 } 1469 1470 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1471}; 1472 1473Sizzle.contains = function( context, elem ) { 1474 // Set document vars if needed 1475 if ( ( context.ownerDocument || context ) !== document ) { 1476 setDocument( context ); 1477 } 1478 return contains( context, elem ); 1479}; 1480 1481Sizzle.attr = function( elem, name ) { 1482 // Set document vars if needed 1483 if ( ( elem.ownerDocument || elem ) !== document ) { 1484 setDocument( elem ); 1485 } 1486 1487 var fn = Expr.attrHandle[ name.toLowerCase() ], 1488 // Don't get fooled by Object.prototype properties (jQuery #13807) 1489 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1490 fn( elem, name, !documentIsHTML ) : 1491 undefined; 1492 1493 return val !== undefined ? 1494 val : 1495 support.attributes || !documentIsHTML ? 1496 elem.getAttribute( name ) : 1497 (val = elem.getAttributeNode(name)) && val.specified ? 1498 val.value : 1499 null
vendor: 13,569 bytes, lines 1499-1969
1499; 1500}; 1501 1502Sizzle.error = function( msg ) { 1503 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1504}; 1505 1506/** 1507 * Document sorting and removing duplicates 1508 * @param {ArrayLike} results 1509 */ 1510Sizzle.uniqueSort = function( results ) { 1511 var elem, 1512 duplicates = [], 1513 j = 0, 1514 i = 0; 1515 1516 // Unless we *know* we can detect duplicates, assume their presence 1517 hasDuplicate = !support.detectDuplicates; 1518 sortInput = !support.sortStable && results.slice( 0 ); 1519 results.sort( sortOrder ); 1520 1521 if ( hasDuplicate ) { 1522 while ( (elem = results[i++]) ) { 1523 if ( elem === results[ i ] ) { 1524 j = duplicates.push( i ); 1525 } 1526 } 1527 while ( j-- ) { 1528 results.splice( duplicates[ j ], 1 ); 1529 } 1530 } 1531 1532 // Clear input after sorting to release objects 1533 // See https://github.com/jquery/sizzle/pull/225 1534 sortInput = null; 1535 1536 return results; 1537}; 1538 1539/** 1540 * Utility function for retrieving the text value of an array of DOM nodes 1541 * @param {Array|Element} elem 1542 */ 1543getText = Sizzle.getText = function( elem ) { 1544 var node, 1545 ret = "", 1546 i = 0, 1547 nodeType = elem.nodeType; 1548 1549 if ( !nodeType ) { 1550 // If no nodeType, this is expected to be an array 1551 while ( (node = elem[i++]) ) { 1552 // Do not traverse comment nodes 1553 ret += getText( node ); 1554 } 1555 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1556 // Use textContent for elements 1557 // innerText usage removed for consistency of new lines (jQuery #11153) 1558 if ( typeof elem.textContent === "string" ) { 1559 return elem.textContent; 1560 } else { 1561 // Traverse its children 1562 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1563 ret += getText( elem ); 1564 } 1565 } 1566 } else if ( nodeType === 3 || nodeType === 4 ) { 1567 return elem.nodeValue; 1568 } 1569 // Do not include comment or processing instruction nodes 1570 1571 return ret; 1572}; 1573 1574Expr = Sizzle.selectors = { 1575 1576 // Can be adjusted by the user 1577 cacheLength: 50, 1578 1579 createPseudo: markFunction, 1580 1581 match: matchExpr, 1582 1583 attrHandle: {}, 1584 1585 find: {}, 1586 1587 relative: { 1588 ">": { dir: "parentNode", first: true }, 1589 " ": { dir: "parentNode" }, 1590 "+": { dir: "previousSibling", first: true }, 1591 "~": { dir: "previousSibling" } 1592 }, 1593 1594 preFilter: { 1595 "ATTR": function( match ) { 1596 match[1] = match[1].replace( runescape, funescape ); 1597 1598 // Move the given value to match[3] whether quoted or unquoted 1599 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1600 1601 if ( match[2] === "~=" ) { 1602 match[3] = " " + match[3] + " "; 1603 } 1604 1605 return match.slice( 0, 4 ); 1606 }, 1607 1608 "CHILD": function( match ) { 1609 /* matches from matchExpr["CHILD"] 1610 1 type (only|nth|...) 1611 2 what (child|of-type) 1612 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1613 4 xn-component of xn+y argument ([+-]?\d*n|) 1614 5 sign of xn-component 1615 6 x of xn-component 1616 7 sign of y-component 1617 8 y of y-component 1618 */ 1619 match[1] = match[1].toLowerCase(); 1620 1621 if ( match[1].slice( 0, 3 ) === "nth" ) { 1622 // nth-* requires argument 1623 if ( !match[3] ) { 1624 Sizzle.error( match[0] ); 1625 } 1626 1627 // numeric x and y parameters for Expr.filter.CHILD 1628 // remember that false/true cast respectively to 0/1 1629 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1630 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1631 1632 // other types prohibit arguments 1633 } else if ( match[3] ) { 1634 Sizzle.error( match[0] ); 1635 } 1636 1637 return match; 1638 }, 1639 1640 "PSEUDO": function( match ) { 1641 var excess, 1642 unquoted = !match[6] && match[2]; 1643 1644 if ( matchExpr["CHILD"].test( match[0] ) ) { 1645 return null; 1646 } 1647 1648 // Accept quoted arguments as-is 1649 if ( match[3] ) { 1650 match[2] = match[4] || match[5] || ""; 1651 1652 // Strip excess characters from unquoted arguments 1653 } else if ( unquoted && rpseudo.test( unquoted ) && 1654 // Get excess from tokenize (recursively) 1655 (excess = tokenize( unquoted, true )) && 1656 // advance to the next closing parenthesis 1657 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1658 1659 // excess is a negative index 1660 match[0] = match[0].slice( 0, excess ); 1661 match[2] = unquoted.slice( 0, excess ); 1662 } 1663 1664 // Return only captures needed by the pseudo filter method (type and argument) 1665 return match.slice( 0, 3 ); 1666 } 1667 }, 1668 1669 filter: { 1670 1671 "TAG": function( nodeNameSelector ) { 1672 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1673 return nodeNameSelector === "*" ? 1674 function() { return true; } : 1675 function( elem ) { 1676 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1677 }; 1678 }, 1679 1680 "CLASS": function( className ) { 1681 var pattern = classCache[ className + " " ]; 1682 1683 return pattern || 1684 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1685 classCache( className, function( elem ) { 1686 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 1687 }); 1688 }, 1689 1690 "ATTR": function( name, operator, check ) { 1691 return function( elem ) { 1692 var result = Sizzle.attr( elem, name ); 1693 1694 if ( result == null ) { 1695 return operator === "!="; 1696 } 1697 if ( !operator ) { 1698 return true; 1699 } 1700 1701 result += ""; 1702 1703 return operator === "=" ? result === check : 1704 operator === "!=" ? result !== check : 1705 operator === "^=" ? check && result.indexOf( check ) === 0 : 1706 operator === "*=" ? check && result.indexOf( check ) > -1 : 1707 operator === "$=" ? check && result.slice( -check.length ) === check : 1708 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1709 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1710 false; 1711 }; 1712 }, 1713 1714 "CHILD": function( type, what, argument, first, last ) { 1715 var simple = type.slice( 0, 3 ) !== "nth", 1716 forward = type.slice( -4 ) !== "last", 1717 ofType = what === "of-type"; 1718 1719 return first === 1 && last === 0 ? 1720 1721 // Shortcut for :nth-*(n) 1722 function( elem ) { 1723 return !!elem.parentNode; 1724 } : 1725 1726 function( elem, context, xml ) { 1727 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1728 dir = simple !== forward ? "nextSibling" : "previousSibling", 1729 parent = elem.parentNode, 1730 name = ofType && elem.nodeName.toLowerCase(), 1731 useCache = !xml && !ofType, 1732 diff = false; 1733 1734 if ( parent ) { 1735 1736 // :(first|last|only)-(child|of-type) 1737 if ( simple ) { 1738 while ( dir ) { 1739 node = elem; 1740 while ( (node = node[ dir ]) ) { 1741 if ( ofType ? 1742 node.nodeName.toLowerCase() === name : 1743 node.nodeType === 1 ) { 1744 1745 return false; 1746 } 1747 } 1748 // Reverse direction for :only-* (if we haven't yet done so) 1749 start = dir = type === "only" && !start && "nextSibling"; 1750 } 1751 return true; 1752 } 1753 1754 start = [ forward ? parent.firstChild : parent.lastChild ]; 1755 1756 // non-xml :nth-child(...) stores cache data on `parent` 1757 if ( forward && useCache ) { 1758 1759 // Seek `elem` from a previously-cached index 1760 1761 // ...in a gzip-friendly way 1762 node = parent; 1763 outerCache = node[ expando ] || (node[ expando ] = {}); 1764 1765 // Support: IE <9 only 1766 // Defend against cloned attroperties (jQuery gh-1709) 1767 uniqueCache = outerCache[ node.uniqueID ] || 1768 (outerCache[ node.uniqueID ] = {}); 1769 1770 cache = uniqueCache[ type ] || []; 1771 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1772 diff = nodeIndex && cache[ 2 ]; 1773 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1774 1775 while ( (node = ++nodeIndex && node && node[ dir ] || 1776 1777 // Fallback to seeking `elem` from the start 1778 (diff = nodeIndex = 0) || start.pop()) ) { 1779 1780 // When found, cache indexes on `parent` and break 1781 if ( node.nodeType === 1 && ++diff && node === elem ) { 1782 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1783 break; 1784 } 1785 } 1786 1787 } else { 1788 // Use previously-cached element index if available 1789 if ( useCache ) { 1790 // ...in a gzip-friendly way 1791 node = elem; 1792 outerCache = node[ expando ] || (node[ expando ] = {}); 1793 1794 // Support: IE <9 only 1795 // Defend against cloned attroperties (jQuery gh-1709) 1796 uniqueCache = outerCache[ node.uniqueID ] || 1797 (outerCache[ node.uniqueID ] = {}); 1798 1799 cache = uniqueCache[ type ] || []; 1800 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1801 diff = nodeIndex; 1802 } 1803 1804 // xml :nth-child(...) 1805 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1806 if ( diff === false ) { 1807 // Use the same loop as above to seek `elem` from the start 1808 while ( (node = ++nodeIndex && node && node[ dir ] || 1809 (diff = nodeIndex = 0) || start.pop()) ) { 1810 1811 if ( ( ofType ? 1812 node.nodeName.toLowerCase() === name : 1813 node.nodeType === 1 ) && 1814 ++diff ) { 1815 1816 // Cache the index of each encountered element 1817 if ( useCache ) { 1818 outerCache = node[ expando ] || (node[ expando ] = {}); 1819 1820 // Support: IE <9 only 1821 // Defend against cloned attroperties (jQuery gh-1709) 1822 uniqueCache = outerCache[ node.uniqueID ] || 1823 (outerCache[ node.uniqueID ] = {}); 1824 1825 uniqueCache[ type ] = [ dirruns, diff ]; 1826 } 1827 1828 if ( node === elem ) { 1829 break; 1830 } 1831 } 1832 } 1833 } 1834 } 1835 1836 // Incorporate the offset, then check against cycle size 1837 diff -= last; 1838 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1839 } 1840 }; 1841 }, 1842 1843 "PSEUDO": function( pseudo, argument ) { 1844 // pseudo-class names are case-insensitive 1845 // http://www.w3.org/TR/selectors/#pseudo-classes 1846 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1847 // Remember that setFilters inherits from pseudos 1848 var args, 1849 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1850 Sizzle.error( "unsupported pseudo: " + pseudo ); 1851 1852 // The user may use createPseudo to indicate that 1853 // arguments are needed to create the filter function 1854 // just as Sizzle does 1855 if ( fn[ expando ] ) { 1856 return fn( argument ); 1857 } 1858 1859 // But maintain support for old signatures 1860 if ( fn.length > 1 ) { 1861 args = [ pseudo, pseudo, "", argument ]; 1862 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1863 markFunction(function( seed, matches ) { 1864 var idx, 1865 matched = fn( seed, argument ), 1866 i = matched.length; 1867 while ( i-- ) { 1868 idx = indexOf( seed, matched[i] ); 1869 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1870 } 1871 }) : 1872 function( elem ) { 1873 return fn( elem, 0, args ); 1874 }; 1875 } 1876 1877 return fn; 1878 } 1879 }, 1880 1881 pseudos: { 1882 // Potentially complex pseudos 1883 "not": markFunction(function( selector ) { 1884 // Trim the selector passed to compile 1885 // to avoid treating leading and trailing 1886 // spaces as combinators 1887 var input = [], 1888 results = [], 1889 matcher = compile( selector.replace( rtrim, "$1" ) ); 1890 1891 return matcher[ expando ] ? 1892 markFunction(function( seed, matches, context, xml ) { 1893 var elem, 1894 unmatched = matcher( seed, null, xml, [] ), 1895 i = seed.length; 1896 1897 // Match elements unmatched by `matcher` 1898 while ( i-- ) { 1899 if ( (elem = unmatched[i]) ) { 1900 seed[i] = !(matches[i] = elem); 1901 } 1902 } 1903 }) : 1904 function( elem, context, xml ) { 1905 input[0] = elem; 1906 matcher( input, null, xml, results ); 1907 // Don't keep the element (issue #299) 1908 input[0] = null; 1909 return !results.pop(); 1910 }; 1911 }), 1912 1913 "has": markFunction(function( selector ) { 1914 return function( elem ) { 1915 return Sizzle( selector, elem ).length > 0; 1916 }; 1917 }), 1918 1919 "contains": markFunction(function( text ) { 1920 text = text.replace( runescape, funescape ); 1921 return function( elem ) { 1922 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 1923 }; 1924 }), 1925 1926 // "Whether an element is represented by a :lang() selector 1927 // is based solely on the element's language value 1928 // being equal to the identifier C, 1929 // or beginning with the identifier C immediately followed by "-". 1930 // The matching of C against the element's language value is performed case-insensitively. 1931 // The identifier C does not have to be a valid language name." 1932 // http://www.w3.org/TR/selectors/#lang-pseudo 1933 "lang": markFunction( function( lang ) { 1934 // lang value must be a valid identifier 1935 if ( !ridentifier.test(lang || "") ) { 1936 Sizzle.error( "unsupported lang: " + lang ); 1937 } 1938 lang = lang.replace( runescape, funescape ).toLowerCase(); 1939 return function( elem ) { 1940 var elemLang; 1941 do { 1942 if ( (elemLang = documentIsHTML ? 1943 elem.lang : 1944 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 1945 1946 elemLang = elemLang.toLowerCase(); 1947 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1948 } 1949 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 1950 return false; 1951 }; 1952 }), 1953 1954 // Miscellaneous 1955 "target": function( elem ) { 1956 var hash = window.location && window.location.hash; 1957 return hash && hash.slice( 1 ) === elem.id; 1958 }, 1959 1960 "root": function( elem ) { 1961 return elem === docElem; 1962 }, 1963 1964 "focus": function( elem ) { 1965 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 1966 }, 1967 1968 // Boolean properties 1969 "enabled":
vendor: 6,738 bytes, lines 1969-2220
1969function( elem ) { 1970 return elem.disabled === false; 1971 }, 1972 1973 "disabled": function( elem ) { 1974 return elem.disabled === true; 1975 }, 1976 1977 "checked": function( elem ) { 1978 // In CSS3, :checked should return both checked and selected elements 1979 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1980 var nodeName = elem.nodeName.toLowerCase(); 1981 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 1982 }, 1983 1984 "selected": function( elem ) { 1985 // Accessing this property makes selected-by-default 1986 // options in Safari work properly 1987 if ( elem.parentNode ) { 1988 elem.parentNode.selectedIndex; 1989 } 1990 1991 return elem.selected === true; 1992 }, 1993 1994 // Contents 1995 "empty": function( elem ) { 1996 // http://www.w3.org/TR/selectors/#empty-pseudo 1997 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 1998 // but not by others (comment: 8; processing instruction: 7; etc.) 1999 // nodeType < 6 works because attributes (2) do not appear as children 2000 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2001 if ( elem.nodeType < 6 ) { 2002 return false; 2003 } 2004 } 2005 return true; 2006 }, 2007 2008 "parent": function( elem ) { 2009 return !Expr.pseudos["empty"]( elem ); 2010 }, 2011 2012 // Element/input types 2013 "header": function( elem ) { 2014 return rheader.test( elem.nodeName ); 2015 }, 2016 2017 "input": function( elem ) { 2018 return rinputs.test( elem.nodeName ); 2019 }, 2020 2021 "button": function( elem ) { 2022 var name = elem.nodeName.toLowerCase(); 2023 return name === "input" && elem.type === "button" || name === "button"; 2024 }, 2025 2026 "text": function( elem ) { 2027 var attr; 2028 return elem.nodeName.toLowerCase() === "input" && 2029 elem.type === "text" && 2030 2031 // Support: IE<8 2032 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2033 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2034 }, 2035 2036 // Position-in-collection 2037 "first": createPositionalPseudo(function() { 2038 return [ 0 ]; 2039 }), 2040 2041 "last": createPositionalPseudo(function( matchIndexes, length ) { 2042 return [ length - 1 ]; 2043 }), 2044 2045 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2046 return [ argument < 0 ? argument + length : argument ]; 2047 }), 2048 2049 "even": createPositionalPseudo(function( matchIndexes, length ) { 2050 var i = 0; 2051 for ( ; i < length; i += 2 ) { 2052 matchIndexes.push( i ); 2053 } 2054 return matchIndexes; 2055 }), 2056 2057 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2058 var i = 1; 2059 for ( ; i < length; i += 2 ) { 2060 matchIndexes.push( i ); 2061 } 2062 return matchIndexes; 2063 }), 2064 2065 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2066 var i = argument < 0 ? argument + length : argument; 2067 for ( ; --i >= 0; ) { 2068 matchIndexes.push( i ); 2069 } 2070 return matchIndexes; 2071 }), 2072 2073 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2074 var i = argument < 0 ? argument + length : argument; 2075 for ( ; ++i < length; ) { 2076 matchIndexes.push( i ); 2077 } 2078 return matchIndexes; 2079 }) 2080 } 2081}; 2082 2083Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2084 2085// Add button/input type pseudos 2086for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2087 Expr.pseudos[ i ] = createInputPseudo( i ); 2088} 2089for ( i in { submit: true, reset: true } ) { 2090 Expr.pseudos[ i ] = createButtonPseudo( i ); 2091} 2092 2093// Easy API for creating new setFilters 2094function setFilters() {} 2095setFilters.prototype = Expr.filters = Expr.pseudos; 2096Expr.setFilters = new setFilters(); 2097 2098tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2099 var matched, match, tokens, type, 2100 soFar, groups, preFilters, 2101 cached = tokenCache[ selector + " " ]; 2102 2103 if ( cached ) { 2104 return parseOnly ? 0 : cached.slice( 0 ); 2105 } 2106 2107 soFar = selector; 2108 groups = []; 2109 preFilters = Expr.preFilter; 2110 2111 while ( soFar ) { 2112 2113 // Comma and first run 2114 if ( !matched || (match = rcomma.exec( soFar )) ) { 2115 if ( match ) { 2116 // Don't consume trailing commas as valid 2117 soFar = soFar.slice( match[0].length ) || soFar; 2118 } 2119 groups.push( (tokens = []) ); 2120 } 2121 2122 matched = false; 2123 2124 // Combinators 2125 if ( (match = rcombinators.exec( soFar )) ) { 2126 matched = match.shift(); 2127 tokens.push({ 2128 value: matched, 2129 // Cast descendant combinators to space 2130 type: match[0].replace( rtrim, " " ) 2131 }); 2132 soFar = soFar.slice( matched.length ); 2133 } 2134 2135 // Filters 2136 for ( type in Expr.filter ) { 2137 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2138 (match = preFilters[ type ]( match ))) ) { 2139 matched = match.shift(); 2140 tokens.push({ 2141 value: matched, 2142 type: type, 2143 matches: match 2144 }); 2145 soFar = soFar.slice( matched.length ); 2146 } 2147 } 2148 2149 if ( !matched ) { 2150 break; 2151 } 2152 } 2153 2154 // Return the length of the invalid excess 2155 // if we're just parsing 2156 // Otherwise, throw an error or return tokens 2157 return parseOnly ? 2158 soFar.length : 2159 soFar ? 2160 Sizzle.error( selector ) : 2161 // Cache the tokens 2162 tokenCache( selector, groups ).slice( 0 ); 2163}; 2164 2165function toSelector( tokens ) { 2166 var i = 0, 2167 len = tokens.length, 2168 selector = ""; 2169 for ( ; i < len; i++ ) { 2170 selector += tokens[i].value; 2171 } 2172 return selector; 2173} 2174 2175function addCombinator( matcher, combinator, base ) { 2176 var dir = combinator.dir, 2177 checkNonElements = base && dir === "parentNode", 2178 doneName = done++; 2179 2180 return combinator.first ? 2181 // Check against closest ancestor/preceding element 2182 function( elem, context, xml ) { 2183 while ( (elem = elem[ dir ]) ) { 2184 if ( elem.nodeType === 1 || checkNonElements ) { 2185 return matcher( elem, context, xml ); 2186 } 2187 } 2188 } : 2189 2190 // Check against all ancestor/preceding elements 2191 function( elem, context, xml ) { 2192 var oldCache, uniqueCache, outerCache, 2193 newCache = [ dirruns, doneName ]; 2194 2195 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2196 if ( xml ) { 2197 while ( (elem = elem[ dir ]) ) { 2198 if ( elem.nodeType === 1 || checkNonElements ) { 2199 if ( matcher( elem, context, xml ) ) { 2200 return true; 2201 } 2202 } 2203 } 2204 } else { 2205 while ( (elem = elem[ dir ]) ) { 2206 if ( elem.nodeType === 1 || checkNonElements ) { 2207 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2208 2209 // Support: IE <9 only 2210 // Defend against cloned attroperties (jQuery gh-1709) 2211 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 2212 2213 if ( (oldCache = uniqueCache[ dir ]) && 2214 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2215 2216 // Assign to newCache so results back-propagate to previous elements 2217 return (newCache[ 2 ] = oldCache[ 2 ]); 2218 } else { 2219 // Reuse newcache so results back-propagate to previous elements 2220 uniqueCache[ dir
vendor: 12,959 bytes, lines 2220-2663
2220 ] = newCache; 2221 2222 // A match means we're done; a fail means we have to keep checking 2223 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2224 return true; 2225 } 2226 } 2227 } 2228 } 2229 } 2230 }; 2231} 2232 2233function elementMatcher( matchers ) { 2234 return matchers.length > 1 ? 2235 function( elem, context, xml ) { 2236 var i = matchers.length; 2237 while ( i-- ) { 2238 if ( !matchers[i]( elem, context, xml ) ) { 2239 return false; 2240 } 2241 } 2242 return true; 2243 } : 2244 matchers[0]; 2245} 2246 2247function multipleContexts( selector, contexts, results ) { 2248 var i = 0, 2249 len = contexts.length; 2250 for ( ; i < len; i++ ) { 2251 Sizzle( selector, contexts[i], results ); 2252 } 2253 return results; 2254} 2255 2256function condense( unmatched, map, filter, context, xml ) { 2257 var elem, 2258 newUnmatched = [], 2259 i = 0, 2260 len = unmatched.length, 2261 mapped = map != null; 2262 2263 for ( ; i < len; i++ ) { 2264 if ( (elem = unmatched[i]) ) { 2265 if ( !filter || filter( elem, context, xml ) ) { 2266 newUnmatched.push( elem ); 2267 if ( mapped ) { 2268 map.push( i ); 2269 } 2270 } 2271 } 2272 } 2273 2274 return newUnmatched; 2275} 2276 2277function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2278 if ( postFilter && !postFilter[ expando ] ) { 2279 postFilter = setMatcher( postFilter ); 2280 } 2281 if ( postFinder && !postFinder[ expando ] ) { 2282 postFinder = setMatcher( postFinder, postSelector ); 2283 } 2284 return markFunction(function( seed, results, context, xml ) { 2285 var temp, i, elem, 2286 preMap = [], 2287 postMap = [], 2288 preexisting = results.length, 2289 2290 // Get initial elements from seed or context 2291 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2292 2293 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2294 matcherIn = preFilter && ( seed || !selector ) ? 2295 condense( elems, preMap, preFilter, context, xml ) : 2296 elems, 2297 2298 matcherOut = matcher ? 2299 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2300 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2301 2302 // ...intermediate processing is necessary 2303 [] : 2304 2305 // ...otherwise use results directly 2306 results : 2307 matcherIn; 2308 2309 // Find primary matches 2310 if ( matcher ) { 2311 matcher( matcherIn, matcherOut, context, xml ); 2312 } 2313 2314 // Apply postFilter 2315 if ( postFilter ) { 2316 temp = condense( matcherOut, postMap ); 2317 postFilter( temp, [], context, xml ); 2318 2319 // Un-match failing elements by moving them back to matcherIn 2320 i = temp.length; 2321 while ( i-- ) { 2322 if ( (elem = temp[i]) ) { 2323 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2324 } 2325 } 2326 } 2327 2328 if ( seed ) { 2329 if ( postFinder || preFilter ) { 2330 if ( postFinder ) { 2331 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2332 temp = []; 2333 i = matcherOut.length; 2334 while ( i-- ) { 2335 if ( (elem = matcherOut[i]) ) { 2336 // Restore matcherIn since elem is not yet a final match 2337 temp.push( (matcherIn[i] = elem) ); 2338 } 2339 } 2340 postFinder( null, (matcherOut = []), temp, xml ); 2341 } 2342 2343 // Move matched elements from seed to results to keep them synchronized 2344 i = matcherOut.length; 2345 while ( i-- ) { 2346 if ( (elem = matcherOut[i]) && 2347 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 2348 2349 seed[temp] = !(results[temp] = elem); 2350 } 2351 } 2352 } 2353 2354 // Add elements to results, through postFinder if defined 2355 } else { 2356 matcherOut = condense( 2357 matcherOut === results ? 2358 matcherOut.splice( preexisting, matcherOut.length ) : 2359 matcherOut 2360 ); 2361 if ( postFinder ) { 2362 postFinder( null, results, matcherOut, xml ); 2363 } else { 2364 push.apply( results, matcherOut ); 2365 } 2366 } 2367 }); 2368} 2369 2370function matcherFromTokens( tokens ) { 2371 var checkContext, matcher, j, 2372 len = tokens.length, 2373 leadingRelative = Expr.relative[ tokens[0].type ], 2374 implicitRelative = leadingRelative || Expr.relative[" "], 2375 i = leadingRelative ? 1 : 0, 2376 2377 // The foundational matcher ensures that elements are reachable from top-level context(s) 2378 matchContext = addCombinator( function( elem ) { 2379 return elem === checkContext; 2380 }, implicitRelative, true ), 2381 matchAnyContext = addCombinator( function( elem ) { 2382 return indexOf( checkContext, elem ) > -1; 2383 }, implicitRelative, true ), 2384 matchers = [ function( elem, context, xml ) { 2385 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2386 (checkContext = context).nodeType ? 2387 matchContext( elem, context, xml ) : 2388 matchAnyContext( elem, context, xml ) ); 2389 // Avoid hanging onto element (issue #299) 2390 checkContext = null; 2391 return ret; 2392 } ]; 2393 2394 for ( ; i < len; i++ ) { 2395 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2396 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2397 } else { 2398 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2399 2400 // Return special upon seeing a positional matcher 2401 if ( matcher[ expando ] ) { 2402 // Find the next relative operator (if any) for proper handling 2403 j = ++i; 2404 for ( ; j < len; j++ ) { 2405 if ( Expr.relative[ tokens[j].type ] ) { 2406 break; 2407 } 2408 } 2409 return setMatcher( 2410 i > 1 && elementMatcher( matchers ), 2411 i > 1 && toSelector( 2412 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2413 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2414 ).replace( rtrim, "$1" ), 2415 matcher, 2416 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2417 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2418 j < len && toSelector( tokens ) 2419 ); 2420 } 2421 matchers.push( matcher ); 2422 } 2423 } 2424 2425 return elementMatcher( matchers ); 2426} 2427 2428function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2429 var bySet = setMatchers.length > 0, 2430 byElement = elementMatchers.length > 0, 2431 superMatcher = function( seed, context, xml, results, outermost ) { 2432 var elem, j, matcher, 2433 matchedCount = 0, 2434 i = "0", 2435 unmatched = seed && [], 2436 setMatched = [], 2437 contextBackup = outermostContext, 2438 // We must always have either seed elements or outermost context 2439 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2440 // Use integer dirruns iff this is the outermost matcher 2441 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2442 len = elems.length; 2443 2444 if ( outermost ) { 2445 outermostContext = context === document || context || outermost; 2446 } 2447 2448 // Add elements passing elementMatchers directly to results 2449 // Support: IE<9, Safari 2450 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2451 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2452 if ( byElement && elem ) { 2453 j = 0; 2454 if ( !context && elem.ownerDocument !== document ) { 2455 setDocument( elem ); 2456 xml = !documentIsHTML; 2457 } 2458 while ( (matcher = elementMatchers[j++]) ) { 2459 if ( matcher( elem, context || document, xml) ) { 2460 results.push( elem ); 2461 break; 2462 } 2463 } 2464 if ( outermost ) { 2465 dirruns = dirrunsUnique; 2466 } 2467 } 2468 2469 // Track unmatched elements for set filters 2470 if ( bySet ) { 2471 // They will have gone through all possible matchers 2472 if ( (elem = !matcher && elem) ) { 2473 matchedCount--; 2474 } 2475 2476 // Lengthen the array for every element, matched or not 2477 if ( seed ) { 2478 unmatched.push( elem ); 2479 } 2480 } 2481 } 2482 2483 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2484 // makes the latter nonnegative. 2485 matchedCount += i; 2486 2487 // Apply set filters to unmatched elements 2488 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2489 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2490 // no element matchers and no seed. 2491 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2492 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2493 // numerically zero. 2494 if ( bySet && i !== matchedCount ) { 2495 j = 0; 2496 while ( (matcher = setMatchers[j++]) ) { 2497 matcher( unmatched, setMatched, context, xml ); 2498 } 2499 2500 if ( seed ) { 2501 // Reintegrate element matches to eliminate the need for sorting 2502 if ( matchedCount > 0 ) { 2503 while ( i-- ) { 2504 if ( !(unmatched[i] || setMatched[i]) ) { 2505 setMatched[i] = pop.call( results ); 2506 } 2507 } 2508 } 2509 2510 // Discard index placeholder values to get only actual matches 2511 setMatched = condense( setMatched ); 2512 } 2513 2514 // Add matches to results 2515 push.apply( results, setMatched ); 2516 2517 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2518 if ( outermost && !seed && setMatched.length > 0 && 2519 ( matchedCount + setMatchers.length ) > 1 ) { 2520 2521 Sizzle.uniqueSort( results ); 2522 } 2523 } 2524 2525 // Override manipulation of globals by nested matchers 2526 if ( outermost ) { 2527 dirruns = dirrunsUnique; 2528 outermostContext = contextBackup; 2529 } 2530 2531 return unmatched; 2532 }; 2533 2534 return bySet ? 2535 markFunction( superMatcher ) : 2536 superMatcher; 2537} 2538 2539compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2540 var i, 2541 setMatchers = [], 2542 elementMatchers = [], 2543 cached = compilerCache[ selector + " " ]; 2544 2545 if ( !cached ) { 2546 // Generate a function of recursive functions that can be used to check each element 2547 if ( !match ) { 2548 match = tokenize( selector ); 2549 } 2550 i = match.length; 2551 while ( i-- ) { 2552 cached = matcherFromTokens( match[i] ); 2553 if ( cached[ expando ] ) { 2554 setMatchers.push( cached ); 2555 } else { 2556 elementMatchers.push( cached ); 2557 } 2558 } 2559 2560 // Cache the compiled function 2561 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2562 2563 // Save selector and tokenization 2564 cached.selector = selector; 2565 } 2566 return cached; 2567}; 2568 2569/** 2570 * A low-level selection function that works with Sizzle's compiled 2571 * selector functions 2572 * @param {String|Function} selector A selector or a pre-compiled 2573 * selector function built with Sizzle.compile 2574 * @param {Element} context 2575 * @param {Array} [results] 2576 * @param {Array} [seed] A set of elements to match against 2577 */ 2578select = Sizzle.select = function( selector, context, results, seed ) { 2579 var i, tokens, token, type, find, 2580 compiled = typeof selector === "function" && selector, 2581 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2582 2583 results = results || []; 2584 2585 // Try to minimize operations if there is only one selector in the list and no seed 2586 // (the latter of which guarantees us context) 2587 if ( match.length === 1 ) { 2588 2589 // Reduce context if the leading compound selector is an ID 2590 tokens = match[0] = match[0].slice( 0 ); 2591 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2592 support.getById && context.nodeType === 9 && documentIsHTML && 2593 Expr.relative[ tokens[1].type ] ) { 2594 2595 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2596 if ( !context ) { 2597 return results; 2598 2599 // Precompiled matchers will still verify ancestry, so step up a level 2600 } else if ( compiled ) { 2601 context = context.parentNode; 2602 } 2603 2604 selector = selector.slice( tokens.shift().value.length ); 2605 } 2606 2607 // Fetch a seed set for right-to-left matching 2608 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2609 while ( i-- ) { 2610 token = tokens[i]; 2611 2612 // Abort if we hit a combinator 2613 if ( Expr.relative[ (type = token.type) ] ) { 2614 break; 2615 } 2616 if ( (find = Expr.find[ type ]) ) { 2617 // Search, expanding context for leading sibling combinators 2618 if ( (seed = find( 2619 token.matches[0].replace( runescape, funescape ), 2620 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2621 )) ) { 2622 2623 // If seed is empty or no tokens remain, we can return early 2624 tokens.splice( i, 1 ); 2625 selector = seed.length && toSelector( tokens ); 2626 if ( !selector ) { 2627 push.apply( results, seed ); 2628 return results; 2629 } 2630 2631 break; 2632 } 2633 } 2634 } 2635 } 2636 2637 // Compile and execute a filtering function if one is not provided 2638 // Provide `match` to avoid retokenization if we modified the selector above 2639 ( compiled || compile( selector, match ) )( 2640 seed, 2641 context, 2642 !documentIsHTML, 2643 results, 2644 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2645 ); 2646 return results; 2647}; 2648 2649// One-time assignments 2650 2651// Sort stability 2652support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2653 2654// Support: Chrome 14-35+ 2655// Always assume duplicates if they aren't passed to the comparison function 2656support.detectDuplicates = !!hasDuplicate; 2657 2658// Initialize against the default document 2659setDocument(); 2660 2661// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2662// Detached nodes confoundingly follow *each other* 2663support.sortDetached = assert(function(
vendor: 3,546 bytes, lines 2663-2816
2663div1 ) { 2664 // Should return 1, but returns 4 (following) 2665 return div1.compareDocumentPosition( document.createElement("div") ) & 1; 2666}); 2667 2668// Support: IE<8 2669// Prevent attribute/property "interpolation" 2670// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2671if ( !assert(function( div ) { 2672 div.innerHTML = "<a href='#'></a>"; 2673 return div.firstChild.getAttribute("href") === "#" ; 2674}) ) { 2675 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2676 if ( !isXML ) { 2677 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2678 } 2679 }); 2680} 2681 2682// Support: IE<9 2683// Use defaultValue in place of getAttribute("value") 2684if ( !support.attributes || !assert(function( div ) { 2685 div.innerHTML = "<input/>"; 2686 div.firstChild.setAttribute( "value", "" ); 2687 return div.firstChild.getAttribute( "value" ) === ""; 2688}) ) { 2689 addHandle( "value", function( elem, name, isXML ) { 2690 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2691 return elem.defaultValue; 2692 } 2693 }); 2694} 2695 2696// Support: IE<9 2697// Use getAttributeNode to fetch booleans when getAttribute lies 2698if ( !assert(function( div ) { 2699 return div.getAttribute("disabled") == null; 2700}) ) { 2701 addHandle( booleans, function( elem, name, isXML ) { 2702 var val; 2703 if ( !isXML ) { 2704 return elem[ name ] === true ? name.toLowerCase() : 2705 (val = elem.getAttributeNode( name )) && val.specified ? 2706 val.value : 2707 null; 2708 } 2709 }); 2710} 2711 2712return Sizzle; 2713 2714})( window ); 2715 2716 2717 2718jQuery.find = Sizzle; 2719jQuery.expr = Sizzle.selectors; 2720jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2721jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2722jQuery.text = Sizzle.getText; 2723jQuery.isXMLDoc = Sizzle.isXML; 2724jQuery.contains = Sizzle.contains; 2725 2726 2727 2728var dir = function( elem, dir, until ) { 2729 var matched = [], 2730 truncate = until !== undefined; 2731 2732 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2733 if ( elem.nodeType === 1 ) { 2734 if ( truncate && jQuery( elem ).is( until ) ) { 2735 break; 2736 } 2737 matched.push( elem ); 2738 } 2739 } 2740 return matched; 2741}; 2742 2743 2744var siblings = function( n, elem ) { 2745 var matched = []; 2746 2747 for ( ; n; n = n.nextSibling ) { 2748 if ( n.nodeType === 1 && n !== elem ) { 2749 matched.push( n ); 2750 } 2751 } 2752 2753 return matched; 2754}; 2755 2756 2757var rneedsContext = jQuery.expr.match.needsContext; 2758 2759var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); 2760 2761 2762 2763var risSimple = /^.[^:#\[\.,]*$/; 2764 2765// Implement the identical functionality for filter and not 2766function winnow( elements, qualifier, not ) { 2767 if ( jQuery.isFunction( qualifier ) ) { 2768 return jQuery.grep( elements, function( elem, i ) { 2769 /* jshint -W018 */ 2770 return !!qualifier.call( elem, i, elem ) !== not; 2771 } ); 2772 2773 } 2774 2775 if ( qualifier.nodeType ) { 2776 return jQuery.grep( elements, function( elem ) { 2777 return ( elem === qualifier ) !== not; 2778 } ); 2779 2780 } 2781 2782 if ( typeof qualifier === "string" ) { 2783 if ( risSimple.test( qualifier ) ) { 2784 return jQuery.filter( qualifier, elements, not ); 2785 } 2786 2787 qualifier = jQuery.filter( qualifier, elements ); 2788 } 2789 2790 return jQuery.grep( elements, function( elem ) { 2791 return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not; 2792 } ); 2793} 2794 2795jQuery.filter = function( expr, elems, not ) { 2796 var elem = elems[ 0 ]; 2797 2798 if ( not ) { 2799 expr = ":not(" + expr + ")"; 2800 } 2801 2802 return elems.length === 1 && elem.nodeType === 1 ? 2803 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 2804 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2805 return elem.nodeType === 1; 2806 } ) ); 2807}; 2808 2809jQuery.fn.extend( { 2810 find: function( selector ) { 2811 var i, 2812 ret = [], 2813 self = this, 2814 len = self.length; 2815 2816 if ( typeof selector !== "string" ) {
2817 return this.pushStack( jQuery( selector ).filter( function() { 2818 for ( i = 0; i < len; i++ ) { 2819 if ( jQuery.contains( self[ i ], this ) ) { 2820 return true; 2821 } 2822 } 2823 } ) ); 2824 } 2825 2826 for ( i = 0; i < len; i++ ) { 2827 jQuery.find( selector, self[ i ], ret ); 2828 } 2829 2830 // Needed because $( selector, context ) becomes $( context ).find( selector ) 2831 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); 2832 ret.selector = this.selector ? this.selector + " " + selector : selector; 2833 return ret; 2834 }, 2835 filter: function( selector ) { 2836 return this.pushStack( winnow( this, selector || [], false ) ); 2837 }, 2838 not: function( selector ) { 2839 return this.pushStack( winnow( this, selector || [], true ) ); 2840 }, 2841 is: function( selector ) { 2842 return !!winnow( 2843 this, 2844 2845 // If this is a positional/relative selector, check membership in the returned set 2846 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2847 typeof selector === "string" && rneedsContext.test( selector ) ? 2848 jQuery( selector ) : 2849 selector || [], 2850 false 2851 ).length; 2852 } 2853} ); 2854 2855 2856// Initialize a jQuery object 2857 2858 2859// A central reference to the root jQuery(document) 2860var rootjQuery, 2861 2862 // A simple way to check for HTML strings 2863 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2864 // Strict HTML recognition (#11290: must start with <) 2865 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 2866 2867 init = jQuery.fn.init = function( selector, context, root ) { 2868 var match, elem; 2869 2870 // HANDLE: $(""), $(null), $(undefined), $(false) 2871 if ( !selector ) { 2872 return this; 2873 } 2874 2875 // init accepts an alternate rootjQuery 2876 // so migrate can support jQuery.sub (gh-2101) 2877 root = root || rootjQuery; 2878 2879 // Handle HTML strings 2880 if ( typeof selector === "string" ) { 2881 if ( selector.charAt( 0 ) === "<" && 2882 selector.charAt( selector.length - 1 ) === ">" && 2883 selector.length >= 3 ) { 2884 2885 // Assume that strings that start and end with <> are HTML and skip the regex check 2886 match = [ null, selector, null ]; 2887 2888 } else { 2889 match = rquickExpr.exec( selector ); 2890 } 2891 2892 // Match html or make sure no context is specified for #id 2893 if ( match && ( match[ 1 ] || !context ) ) { 2894 2895 // HANDLE: $(html) -> $(array) 2896 if ( match[ 1 ] ) { 2897 context = context instanceof jQuery ? context[ 0 ] : context; 2898 2899 // scripts is true for back-compat 2900 // Intentionally let the error be thrown if parseHTML is not present 2901 jQuery.merge( this, jQuery.parseHTML( 2902 match[ 1 ], 2903 context && context.nodeType ? context.ownerDocument || context : document, 2904 true 2905 ) ); 2906 2907 // HANDLE: $(html, props) 2908 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2909 for ( match in context ) { 2910 2911 // Properties of context are called as methods if possible 2912 if ( jQuery.isFunction( this[ match ] ) ) { 2913 this[ match ]( context[ match ] ); 2914 2915 // ...and otherwise set as attributes 2916 } else { 2917 this.attr( match, context[ match ] ); 2918 } 2919 } 2920 } 2921 2922 return this; 2923 2924 // HANDLE: $(#id) 2925 } else { 2926 elem = document.getElementById( match[ 2 ] ); 2927 2928 // Check parentNode to catch when Blackberry 4.6 returns 2929 // nodes that are no longer in the document #6963 2930 if ( elem && elem.parentNode ) { 2931 2932 // Handle the case where IE and Opera return items 2933 // by name instead of ID 2934 if ( elem.id !== match[ 2 ] ) { 2935 return rootjQuery.find( selector ); 2936 } 2937 2938 // Otherwise, we inject the element directly into the jQuery object 2939 this.length = 1; 2940 this[ 0 ] = elem; 2941 } 2942 2943 this.context = document; 2944 this.selector = selector; 2945 return this; 2946 } 2947 2948 // HANDLE: $(expr, $(...)) 2949 } else if ( !context || context.jquery ) { 2950 return ( context || root ).find( selector ); 2951 2952 // HANDLE: $(expr, context) 2953 // (which is just equivalent to: $(context).find(expr) 2954 } else { 2955 return this.constructor( context ).find( selector ); 2956 } 2957 2958 // HANDLE: $(DOMElement) 2959 } else if ( selector.nodeType ) { 2960 this.context = this[ 0 ] = selector; 2961 this.length = 1; 2962 return this; 2963 2964 // HANDLE: $(function) 2965 // Shortcut for document ready 2966 } else if ( jQuery.isFunction( selector ) ) { 2967 return typeof root.ready !== "undefined" ? 2968 root.ready( selector ) : 2969 2970 // Execute immediately if ready is not present 2971 selector( jQuery ); 2972 } 2973 2974 if ( selector.selector !== undefined ) { 2975 this.selector = selector.selector; 2976 this.context = selector.context; 2977 } 2978 2979 return jQuery.makeArray( selector, this ); 2980 }; 2981 2982// Give the init function the jQuery prototype for later instantiation 2983init.prototype = jQuery.fn; 2984 2985// Initialize central reference 2986rootjQuery = jQuery( document ); 2987 2988 2989var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2990 2991 // methods guaranteed to produce a unique set when starting from a unique set 2992 guaranteedUnique = { 2993 children: true, 2994 contents: true, 2995 next: true, 2996 prev: true 2997 }; 2998 2999jQuery.fn.extend( { 3000 has: function( target ) { 3001 var i, 3002 targets = jQuery( target, this ), 3003 len = targets.length; 3004 3005 return this.filter( function() { 3006 for ( i = 0; i < len; i++ ) { 3007 if ( jQuery.contains( this, targets[ i ] ) ) { 3008 return true; 3009 } 3010 } 3011 } ); 3012 }, 3013 3014 closest: function( selectors, context ) { 3015 var cur, 3016 i = 0, 3017 l = this.length, 3018 matched = [], 3019 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
vendor: 5,562 bytes, lines 3020-3238
3020 jQuery( selectors, context || this.context ) : 3021 0; 3022 3023 for ( ; i < l; i++ ) { 3024 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3025 3026 // Always skip document fragments 3027 if ( cur.nodeType < 11 && ( pos ? 3028 pos.index( cur ) > -1 : 3029 3030 // Don't pass non-elements to Sizzle 3031 cur.nodeType === 1 && 3032 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3033 3034 matched.push( cur ); 3035 break; 3036 } 3037 } 3038 } 3039 3040 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3041 }, 3042 3043 // Determine the position of an element within 3044 // the matched set of elements 3045 index: function( elem ) { 3046 3047 // No argument, return index in parent 3048 if ( !elem ) { 3049 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3050 } 3051 3052 // index in selector 3053 if ( typeof elem === "string" ) { 3054 return jQuery.inArray( this[ 0 ], jQuery( elem ) ); 3055 } 3056 3057 // Locate the position of the desired element 3058 return jQuery.inArray( 3059 3060 // If it receives a jQuery object, the first element is used 3061 elem.jquery ? elem[ 0 ] : elem, this ); 3062 }, 3063 3064 add: function( selector, context ) { 3065 return this.pushStack( 3066 jQuery.uniqueSort( 3067 jQuery.merge( this.get(), jQuery( selector, context ) ) 3068 ) 3069 ); 3070 }, 3071 3072 addBack: function( selector ) { 3073 return this.add( selector == null ? 3074 this.prevObject : this.prevObject.filter( selector ) 3075 ); 3076 } 3077} ); 3078 3079function sibling( cur, dir ) { 3080 do { 3081 cur = cur[ dir ]; 3082 } while ( cur && cur.nodeType !== 1 ); 3083 3084 return cur; 3085} 3086 3087jQuery.each( { 3088 parent: function( elem ) { 3089 var parent = elem.parentNode; 3090 return parent && parent.nodeType !== 11 ? parent : null; 3091 }, 3092 parents: function( elem ) { 3093 return dir( elem, "parentNode" ); 3094 }, 3095 parentsUntil: function( elem, i, until ) { 3096 return dir( elem, "parentNode", until ); 3097 }, 3098 next: function( elem ) { 3099 return sibling( elem, "nextSibling" ); 3100 }, 3101 prev: function( elem ) { 3102 return sibling( elem, "previousSibling" ); 3103 }, 3104 nextAll: function( elem ) { 3105 return dir( elem, "nextSibling" ); 3106 }, 3107 prevAll: function( elem ) { 3108 return dir( elem, "previousSibling" ); 3109 }, 3110 nextUntil: function( elem, i, until ) { 3111 return dir( elem, "nextSibling", until ); 3112 }, 3113 prevUntil: function( elem, i, until ) { 3114 return dir( elem, "previousSibling", until ); 3115 }, 3116 siblings: function( elem ) { 3117 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3118 }, 3119 children: function( elem ) { 3120 return siblings( elem.firstChild ); 3121 }, 3122 contents: function( elem ) { 3123 return jQuery.nodeName( elem, "iframe" ) ? 3124 elem.contentDocument || elem.contentWindow.document : 3125 jQuery.merge( [], elem.childNodes ); 3126 } 3127}, function( name, fn ) { 3128 jQuery.fn[ name ] = function( until, selector ) { 3129 var ret = jQuery.map( this, fn, until ); 3130 3131 if ( name.slice( -5 ) !== "Until" ) { 3132 selector = until; 3133 } 3134 3135 if ( selector && typeof selector === "string" ) { 3136 ret = jQuery.filter( selector, ret ); 3137 } 3138 3139 if ( this.length > 1 ) { 3140 3141 // Remove duplicates 3142 if ( !guaranteedUnique[ name ] ) { 3143 ret = jQuery.uniqueSort( ret ); 3144 } 3145 3146 // Reverse order for parents* and prev-derivatives 3147 if ( rparentsprev.test( name ) ) { 3148 ret = ret.reverse(); 3149 } 3150 } 3151 3152 return this.pushStack( ret ); 3153 }; 3154} ); 3155var rnotwhite = ( /\S+/g ); 3156 3157 3158 3159// Convert String-formatted options into Object-formatted ones 3160function createOptions( options ) { 3161 var object = {}; 3162 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { 3163 object[ flag ] = true; 3164 } ); 3165 return object; 3166} 3167 3168/* 3169 * Create a callback list using the following parameters: 3170 * 3171 * options: an optional list of space-separated options that will change how 3172 * the callback list behaves or a more traditional option object 3173 * 3174 * By default a callback list will act like an event callback list and can be 3175 * "fired" multiple times. 3176 * 3177 * Possible options: 3178 * 3179 * once: will ensure the callback list can only be fired once (like a Deferred) 3180 * 3181 * memory: will keep track of previous values and will call any callback added 3182 * after the list has been fired right away with the latest "memorized" 3183 * values (like a Deferred) 3184 * 3185 * unique: will ensure a callback can only be added once (no duplicate in the list) 3186 * 3187 * stopOnFalse: interrupt callings when a callback returns false 3188 * 3189 */ 3190jQuery.Callbacks = function( options ) { 3191 3192 // Convert options from String-formatted to Object-formatted if needed 3193 // (we check in cache first) 3194 options = typeof options === "string" ? 3195 createOptions( options ) : 3196 jQuery.extend( {}, options ); 3197 3198 var // Flag to know if list is currently firing 3199 firing, 3200 3201 // Last fire value for non-forgettable lists 3202 memory, 3203 3204 // Flag to know if list was already fired 3205 fired, 3206 3207 // Flag to prevent firing 3208 locked, 3209 3210 // Actual callback list 3211 list = [], 3212 3213 // Queue of execution data for repeatable lists 3214 queue = [], 3215 3216 // Index of currently firing callback (modified by add/remove as needed) 3217 firingIndex = -1, 3218 3219 // Fire callbacks 3220 fire = function() { 3221 3222 // Enforce single-firing 3223 locked = options.once; 3224 3225 // Execute callbacks for all pending executions, 3226 // respecting firingIndex overrides and runtime changes 3227 fired = firing = true; 3228 for ( ; queue.length; firingIndex = -1 ) { 3229 memory = queue.shift(); 3230 while ( ++firingIndex < list.length ) { 3231 3232 // Run callback and check for early termination 3233 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3234 options.stopOnFalse ) { 3235 3236 // Jump to end and forget the data so .add doesn't re-fire 3237 firingIndex = list.length; 3238 memory = false;
3239 } 3240 } 3241 } 3242 3243 // Forget the data if we're done with it 3244 if ( !options.memory ) { 3245 memory = false; 3246 } 3247 3248 firing = false; 3249 3250 // Clean up if we're done firing for good 3251 if ( locked ) { 3252 3253 // Keep an empty list if we have data for future add calls 3254 if ( memory ) { 3255 list = []; 3256 3257 // Otherwise, this object is spent 3258 } else { 3259 list = ""; 3260 } 3261 } 3262 }, 3263 3264 // Actual Callbacks object 3265 self = { 3266 3267 // Add a callback or a collection of callbacks to the list 3268 add: function() { 3269 if ( list ) { 3270 3271 // If we have memory from a past run, we should fire after adding 3272 if ( memory && !firing ) { 3273 firingIndex = list.length - 1; 3274 queue.push( memory ); 3275 } 3276 3277 ( function add( args ) { 3278 jQuery.each( args, function( _, arg ) { 3279 if ( jQuery.isFunction( arg ) ) { 3280 if ( !options.unique || !self.has( arg ) ) { 3281 list.push( arg ); 3282 } 3283 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { 3284 3285 // Inspect recursively 3286 add( arg ); 3287 } 3288 } ); 3289 } )( arguments ); 3290 3291 if ( memory && !firing ) { 3292 fire(); 3293 } 3294 } 3295 return this; 3296 }, 3297 3298 // Remove a callback from the list 3299 remove: function() { 3300 jQuery.each( arguments, function( _, arg ) { 3301 var index; 3302 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3303 list.splice( index, 1 ); 3304 3305 // Handle firing indexes 3306 if ( index <= firingIndex ) { 3307 firingIndex--; 3308 } 3309 } 3310 } ); 3311 return this; 3312 }, 3313 3314 // Check if a given callback is in the list. 3315 // If no argument is given, return whether or not list has callbacks attached. 3316 has: function( fn ) { 3317 return fn ? 3318 jQuery.inArray( fn, list ) > -1 : 3319 list.length > 0; 3320 }, 3321 3322 // Remove all callbacks from the list 3323 empty: function() { 3324 if ( list ) { 3325 list = []; 3326 } 3327 return this; 3328 }, 3329 3330 // Disable .fire and .add 3331 // Abort any current/pending executions 3332 // Clear all callbacks and values 3333 disable: function() { 3334 locked = queue = []; 3335 list = memory = ""; 3336 return this; 3337 }, 3338 disabled: function() { 3339 return !list; 3340 }, 3341 3342 // Disable .fire 3343 // Also disable .add unless we have memory (since it would have no effect) 3344 // Abort any pending executions 3345 lock: function() { 3346 locked = true; 3347 if ( !memory ) { 3348 self.disable(); 3349 } 3350 return this; 3351 }, 3352 locked: function() { 3353 return !!locked; 3354 }, 3355 3356 // Call all callbacks with the given context and arguments 3357 fireWith: function( context, args ) { 3358 if ( !locked ) { 3359 args = args || []; 3360 args = [ context, args.slice ? args.slice() : args ]; 3361 queue.push( args ); 3362 if ( !firing ) { 3363 fire(); 3364 } 3365 } 3366 return this; 3367 }, 3368 3369 // Call all the callbacks with the given arguments 3370 fire: function() { 3371 self.fireWith( this, arguments ); 3372 return this; 3373 }, 3374 3375 // To know if the callbacks have already been called at least once 3376 fired: function() { 3377 return !!fired; 3378 } 3379 }; 3380 3381 return self; 3382}; 3383 3384 3385jQuery.extend( { 3386 3387 Deferred: function( func ) { 3388 var tuples = [ 3389 3390 // action, add listener, listener list, final state 3391 [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], 3392 [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], 3393 [ "notify", "progress", jQuery.Callbacks( "memory" ) ] 3394 ], 3395 state = "pending", 3396 promise = { 3397 state: function() { 3398 return state; 3399 }, 3400 always: function() { 3401 deferred.done( arguments ).fail( arguments ); 3402 return this; 3403 }, 3404 then: function( /* fnDone, fnFail, fnProgress */ ) { 3405 var fns = arguments; 3406 return jQuery.Deferred( function( newDefer ) { 3407 jQuery.each( tuples, function( i, tuple ) { 3408 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 3409 3410 // deferred[ done | fail | progress ] for forwarding actions to newDefer 3411 deferred[ tuple[ 1 ] ]( function() { 3412 var returned = fn && fn.apply( this, arguments ); 3413 if ( returned && jQuery.isFunction( returned.promise ) ) { 3414 returned.promise() 3415 .progress( newDefer.notify ) 3416 .done( newDefer.resolve ) 3417 .fail( newDefer.reject ); 3418 } else { 3419 newDefer[ tuple[ 0 ] + "With" ]( 3420 this === promise ? newDefer.promise() : this, 3421 fn ? [ returned ] : arguments 3422 ); 3423 } 3424 } ); 3425 } ); 3426 fns = null; 3427 } ).promise(); 3428 }, 3429 3430 // Get a promise for this deferred 3431 // If obj is provided, the promise aspect is added to the object 3432 promise: function( obj ) { 3433 return obj != null ? jQuery.extend( obj, promise ) : promise; 3434 } 3435 }, 3436 deferred = {}; 3437 3438 // Keep pipe for back-compat 3439 promise.pipe = promise.then; 3440 3441 // Add list-specific methods 3442 jQuery.each( tuples, function( i, tuple ) { 3443 var list = tuple[ 2 ], 3444 stateString = tuple[ 3 ]; 3445 3446 // promise[ done | fail | progress ] = list.add 3447 promise[ tuple[ 1 ] ] = list.add; 3448 3449 // Handle state 3450 if ( stateString ) { 3451 list.add( function() { 3452 3453 // state = [ resolved | rejected ] 3454 state = stateString; 3455 3456 // [ reject_list | resolve_list ].disable; progress_list.lock 3457 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 3458 } 3459 3460 // deferred[ resolve | reject | notify ] 3461 deferred[ tuple[ 0 ] ] = function() { 3462 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); 3463 return this; 3464 }; 3465 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3466 } ); 3467 3468 // Make the deferred a promise 3469 promise.promise( deferred ); 3470 3471 // Call given func if any 3472 if ( func ) { 3473 func.call( deferred, deferred ); 3474 } 3475 3476 // All done! 3477 return deferred; 3478 }, 3479 3480 // Deferred helper 3481 when: function( subordinate /* , ..., subordinateN */ ) { 3482 var i = 0, 3483 resolveValues = slice.call( arguments ), 3484 length = resolveValues.length, 3485 3486 // the count of uncompleted subordinates 3487 remaining = length !== 1 || 3488 ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 3489 3490 // the master Deferred. 3491 // If resolveValues consist of only a single Deferred, just use that. 3492 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 3493 3494 // Update function for both resolve and progress values 3495 updateFunc = function( i, contexts, values ) { 3496 return function( value ) { 3497 contexts[ i ] = this; 3498 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3499 if ( values === progressValues ) { 3500 deferred.notifyWith( contexts, values ); 3501 3502 } else if ( !( --remaining ) ) { 3503 deferred.resolveWith( contexts, values ); 3504 } 3505 }; 3506 }, 3507 3508 progressValues, progressContexts, resolveContexts; 3509 3510 // add listeners to Deferred subordinates; treat others as resolved 3511 if ( length > 1 ) { 3512 progressValues = new Array( length ); 3513 progressContexts = new Array( length ); 3514 resolveContexts = new Array( length ); 3515 for ( ; i < length; i++ ) { 3516 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 3517 resolveValues[ i ].promise() 3518 .progress( updateFunc( i, progressContexts, progressValues ) ) 3519 .done( updateFunc( i, resolveContexts, resolveValues ) ) 3520 .fail( deferred.reject ); 3521 } else { 3522 --remaining; 3523 } 3524 } 3525 } 3526 3527 // if we're not waiting on anything, resolve the master 3528 if ( !remaining ) {
3529 deferred.resolveWith( resolveContexts, resolveValues ); 3530 } 3531 3532 return deferred.promise(); 3533 } 3534} ); 3535 3536 3537// The deferred used on DOM ready 3538var readyList; 3539 3540jQuery.fn.ready = function( fn ) { 3541 3542 // Add the callback 3543 jQuery.ready.promise().done( fn ); 3544 3545 return this; 3546}; 3547 3548jQuery.extend( { 3549 3550 // Is the DOM ready to be used? Set to true once it occurs. 3551 isReady: false, 3552 3553 // A counter to track how many items to wait for before 3554 // the ready event fires. See #6781 3555 readyWait: 1, 3556 3557 // Hold (or release) the ready event 3558 holdReady: function( hold ) { 3559 if ( hold ) { 3560 jQuery.readyWait++; 3561 } else { 3562 jQuery.ready( true ); 3563 } 3564 }, 3565 3566 // Handle when the DOM is ready 3567 ready: function( wait ) { 3568 3569 // Abort if there are pending holds or we're already ready 3570 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3571 return; 3572 } 3573 3574 // Remember that the DOM is ready 3575 jQuery.isReady = true; 3576 3577 // If a normal DOM Ready event fired, decrement, and wait if need be 3578 if ( wait !== true && --jQuery.readyWait > 0 ) { 3579 return; 3580 } 3581 3582 // If there are functions bound, to execute 3583 readyList.resolveWith( document, [ jQuery ] ); 3584 3585 // Trigger any bound ready events 3586 if ( jQuery.fn.triggerHandler ) { 3587 jQuery( document ).triggerHandler( "ready" ); 3588 jQuery( document ).off( "ready" ); 3589 } 3590 } 3591} ); 3592 3593/** 3594 * Clean-up method for dom ready events 3595 */ 3596function detach() { 3597 if ( document.addEventListener ) { 3598 document.removeEventListener( "DOMContentLoaded", completed ); 3599 window.removeEventListener( "load", completed ); 3600 3601 } else { 3602 document.detachEvent( "onreadystatechange", completed ); 3603 window.detachEvent( "onload", completed ); 3604 } 3605} 3606 3607/** 3608 * The ready event handler and self cleanup method 3609 */ 3610function completed() { 3611 3612 // readyState === "complete" is good enough for us to call the dom ready in oldIE 3613 if ( document.addEventListener || 3614 window.event.type === "load" || 3615 document.readyState === "complete" ) { 3616 3617 detach(); 3618 jQuery.ready(); 3619 } 3620} 3621 3622jQuery.ready.promise = function( obj ) { 3623 if ( !readyList ) { 3624 3625 readyList = jQuery.Deferred(); 3626 3627 // Catch cases where $(document).ready() is called 3628 // after the browser event has already occurred.
3629 // Support: IE6-10 3630 // Older IE sometimes signals "interactive" too soon 3631 if ( document.readyState === "complete" || 3632 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3633 3634 // Handle it asynchronously to allow scripts the opportunity to delay ready 3635 window.setTimeout( jQuery.ready ); 3636 3637 // Standards-based browsers support DOMContentLoaded 3638 } else if ( document.addEventListener ) { 3639 3640 // Use the handy event callback 3641 document.addEventListener( "DOMContentLoaded", completed ); 3642 3643 // A fallback to window.onload, that will always work 3644 window.addEventListener( "load", completed ); 3645 3646 // If IE event model is used 3647 } else { 3648 3649 // Ensure firing before onload, maybe late but safe also for iframes 3650 document.attachEvent( "onreadystatechange", completed ); 3651 3652 // A fallback to window.onload, that will always work 3653 window.attachEvent( "onload", completed ); 3654 3655 // If IE and not a frame 3656 // continually check to see if the document is ready 3657 var top = false; 3658 3659 try { 3660 top = window.frameElement == null && document.documentElement; 3661 } catch ( e ) {} 3662 3663 if ( top && top.doScroll ) { 3664 ( function doScrollCheck() { 3665 if ( !jQuery.isReady ) { 3666 3667 try { 3668 3669 // Use the trick by Diego Perini 3670 // http://javascript.nwbox.com/IEContentLoaded/ 3671 top.doScroll( "left" ); 3672 } catch ( e ) { 3673 return window.setTimeout( doScrollCheck, 50 ); 3674 } 3675 3676 // detach all dom ready events 3677 detach(); 3678 3679 // and execute any waiting functions 3680 jQuery.ready(); 3681 } 3682 } )(); 3683 } 3684 } 3685 } 3686 return readyList.promise( obj ); 3687}; 3688 3689// Kick off the DOM ready check even if the user does not 3690jQuery.ready.promise(); 3691 3692 3693 3694 3695// Support: IE<9 3696// Iteration over object's inherited properties before its own 3697var i; 3698for ( i in jQuery( support ) ) { 3699 break; 3700} 3701support.ownFirst = i === "0"; 3702 3703// Note: most support tests are defined in their respective modules. 3704// false until the test is run 3705support.inlineBlockNeedsLayout = false; 3706 3707// Execute ASAP in case we need to set body.style.zoom 3708jQuery( function() { 3709 3710 // Minified: var a,b,c,d 3711 var val, div, body, container; 3712 3713 body = document.getElementsByTagName( "body" )[ 0 ]; 3714 if ( !body || !body.style ) { 3715 3716 // Return for frameset docs that don't have a body 3717 return; 3718 } 3719 3720 // Setup 3721 div = document.createElement( "div" ); 3722 container = document.createElement( "div" ); 3723 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 3724 body.appendChild( container ).appendChild( div ); 3725 3726 if ( typeof div.style.zoom !== "undefined" ) { 3727 3728 // Support: IE<8 3729 // Check if natively block-level elements act like inline-block 3730 // elements when setting their display to 'inline' and giving 3731 // them layout 3732 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; 3733 3734 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; 3735 if ( val ) { 3736 3737 // Prevent IE 6 from affecting layout for positioned elements #11048 3738 // Prevent IE from shrinking the body in IE 7 mode #12869 3739 // Support: IE<8 3740 body.style.zoom = 1; 3741 } 3742 } 3743 3744 body.removeChild( container ); 3745} ); 3746 3747 3748( function() { 3749 var div = document.createElement( "div" ); 3750 3751 // Support: IE<9 3752 support.deleteExpando = true; 3753 try { 3754 delete div.test; 3755 } catch ( e ) { 3756 support.deleteExpando = false; 3757 } 3758 3759 // Null elements to avoid leaks in IE. 3760 div = null; 3761} )(); 3762var acceptData = function( elem ) { 3763 var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ], 3764 nodeType = +elem.nodeType || 1; 3765 3766 // Do not set data on non-element DOM nodes because it will not be cleared (#8335). 3767 return nodeType !== 1 && nodeType !== 9 ? 3768 false : 3769 3770 // Nodes accept data unless otherwise specified; rejection can be conditional 3771 !noData || noData !== true && elem.getAttribute( "classid" ) === noData; 3772}; 3773 3774 3775 3776 3777var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 3778 rmultiDash = /([A-Z])/g; 3779 3780function dataAttr( elem, key, data ) { 3781 3782 // If nothing was found internally, try to fetch any 3783 // data from the HTML5 data-* attribute 3784 if ( data === undefined && elem.nodeType === 1 ) { 3785 3786 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 3787 3788 data = elem.getAttribute( name ); 3789 3790 if ( typeof data === "string" ) { 3791 try { 3792 data = data === "true" ? true :
3793 data === "false" ? false : 3794 data === "null" ? null : 3795 3796 // Only convert to a number if it doesn't change the string 3797 +data + "" === data ? +data : 3798 rbrace.test( data ) ? jQuery.parseJSON( data ) : 3799 data; 3800 } catch ( e ) {} 3801 3802 // Make sure we set the data so it isn't changed later 3803 jQuery.data( elem, key, data ); 3804 3805 } else { 3806 data = undefined; 3807 } 3808 } 3809 3810 return data; 3811} 3812 3813// checks a cache object for emptiness 3814function isEmptyDataObject( obj ) { 3815 var name; 3816 for ( name in obj ) { 3817 3818 // if the public data object is empty, the private is still empty 3819 if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) { 3820 continue; 3821 } 3822 if ( name !== "toJSON" ) { 3823 return false; 3824 } 3825 } 3826 3827 return true; 3828} 3829 3830function internalData( elem, name, data, pvt /* Internal Use Only */ ) { 3831 if ( !acceptData( elem ) ) { 3832 return; 3833 } 3834 3835 var ret, thisCache, 3836 internalKey = jQuery.expando, 3837 3838 // We have to handle DOM nodes and JS objects differently because IE6-7 3839 // can't GC object references properly across the DOM-JS boundary 3840 isNode = elem.nodeType, 3841 3842 // Only DOM nodes need the global jQuery cache; JS object data is 3843 // attached directly to the object so GC can occur automatically 3844 cache = isNode ? jQuery.cache : elem, 3845 3846 // Only defining an ID for JS objects if its cache already exists allows 3847 // the code to shortcut on the same path as a DOM node with no cache 3848 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; 3849 3850 // Avoid doing any more work than we need to when trying to get data on an 3851 // object that has no data at all 3852 if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) && 3853 data === undefined && typeof name === "string" ) { 3854 return; 3855 } 3856 3857 if ( !id ) { 3858 3859 // Only DOM nodes need a new unique ID for each element since their data 3860 // ends up in the global cache 3861 if ( isNode ) { 3862 id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; 3863 } else { 3864 id = internalKey; 3865 } 3866 } 3867 3868 if ( !cache[ id ] ) { 3869 3870 // Avoid exposing jQuery metadata on plain JS objects when the object 3871 // is serialized using JSON.stringify 3872 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; 3873 } 3874 3875 // An object can be passed to jQuery.data instead of a key/value pair; this gets 3876 // shallow copied over onto the existing cache 3877 if ( typeof name === "object" || typeof name === "function" ) { 3878 if ( pvt ) { 3879 cache[ id ] = jQuery.extend( cache[ id ], name ); 3880 } else { 3881 cache[ id ].data = jQuery.extend( cache[ id ].data, name ); 3882 } 3883 } 3884 3885 thisCache = cache[ id ]; 3886 3887 // jQuery data() is stored in a separate object inside the object's internal data 3888 // cache in order to avoid key collisions between internal data and user-defined 3889 // data. 3890 if ( !pvt ) { 3891 if ( !thisCache.data ) { 3892 thisCache.data = {}; 3893 } 3894 3895 thisCache = thisCache.data; 3896 } 3897 3898 if ( data !== undefined ) { 3899 thisCache[ jQuery.camelCase( name ) ] = data; 3900 } 3901 3902 // Check for both converted-to-camel and non-converted data property names 3903 // If a data property was specified 3904 if ( typeof name === "string" ) { 3905 3906 // First Try to find as-is property data 3907 ret = thisCache[ name ]; 3908 3909 // Test for null|undefined property data 3910 if ( ret == null ) { 3911 3912 // Try to find the camelCased property 3913 ret = thisCache[ jQuery.camelCase( name ) ]; 3914 } 3915 } else { 3916 ret = thisCache; 3917 } 3918 3919 return ret; 3920} 3921 3922function internalRemoveData( elem, name, pvt ) { 3923 if ( !acceptData( elem ) ) { 3924 return; 3925 } 3926 3927 var thisCache, i, 3928 isNode = elem.nodeType, 3929 3930 // See jQuery.data for more information 3931 cache = isNode ? jQuery.cache : elem, 3932 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 3933 3934 // If there is already no cache entry for this object, there is no 3935 // purpose in continuing 3936 if ( !cache[ id ] ) { 3937 return; 3938 } 3939 3940 if ( name ) { 3941 3942 thisCache = pvt ? cache[ id ] : cache[ id ].data; 3943 3944 if ( thisCache ) { 3945 3946 // Support array or space separated string names for data keys 3947 if ( !jQuery.isArray( name ) ) { 3948 3949 // try the string as a key before any manipulation 3950 if ( name in thisCache ) { 3951 name = [ name ]; 3952 } else { 3953 3954 // split the camel cased version by spaces unless a key with the spaces exists 3955 name = jQuery.camelCase( name );
3956 if ( name in thisCache ) { 3957 name = [ name ]; 3958 } else { 3959 name = name.split( " " ); 3960 } 3961 } 3962 } else { 3963 3964 // If "name" is an array of keys... 3965 // When data is initially created, via ("key", "val") signature, 3966 // keys will be converted to camelCase. 3967 // Since there is no way to tell _how_ a key was added, remove 3968 // both plain key and camelCase key. #12786 3969 // This will only penalize the array argument path. 3970 name = name.concat( jQuery.map( name, jQuery.camelCase ) ); 3971 } 3972 3973 i = name.length; 3974 while ( i-- ) { 3975 delete thisCache[ name[ i ] ]; 3976 } 3977 3978 // If there is no data left in the cache, we want to continue 3979 // and let the cache object itself get destroyed 3980 if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) { 3981 return; 3982 } 3983 } 3984 } 3985 3986 // See jQuery.data for more information 3987 if ( !pvt ) { 3988 delete cache[ id ].data; 3989 3990 // Don't destroy the parent cache unless the internal data object 3991 // had been the only thing left in it 3992 if ( !isEmptyDataObject( cache[ id ] ) ) { 3993 return; 3994 } 3995 } 3996 3997 // Destroy the cache 3998 if ( isNode ) { 3999 jQuery.cleanData( [ elem ], true ); 4000 4001 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 4002 /* jshint eqeqeq: false */ 4003 } else if ( support.deleteExpando || cache != cache.window ) { 4004 /* jshint eqeqeq: true */ 4005 delete cache[ id ]; 4006 4007 // When all else fails, undefined 4008 } else { 4009 cache[ id ] = undefined; 4010 } 4011} 4012 4013jQuery.extend( { 4014 cache: {}, 4015 4016 // The following elements (space-suffixed to avoid Object.prototype collisions) 4017 // throw uncatchable exceptions if you attempt to set expando properties 4018 noData: { 4019 "applet ": true, 4020 "embed ": true, 4021 4022 // ...but Flash objects (which have this classid) *can* handle expandos 4023 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 4024 }, 4025 4026 hasData: function( elem ) { 4027 elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ]; 4028 return !!elem && !isEmptyDataObject( elem ); 4029 }, 4030 4031 data: function( elem, name, data ) { 4032 return internalData( elem, name, data ); 4033 }, 4034 4035 removeData: function( elem, name ) { 4036 return internalRemoveData( elem, name ); 4037 }, 4038 4039 // For internal use only. 4040 _data: function( elem, name, data ) { 4041 return internalData( elem, name, data, true ); 4042 }, 4043 4044 _removeData: function( elem, name ) { 4045 return internalRemoveData( elem, name, true ); 4046 } 4047} ); 4048 4049jQuery.fn.extend( { 4050 data: function( key, value ) { 4051 var i, name, data, 4052 elem = this[ 0 ], 4053 attrs = elem && elem.attributes; 4054 4055 // Special expections of .data basically thwart jQuery.access, 4056 // so implement the relevant behavior ourselves 4057 4058 // Gets all values 4059 if ( key === undefined ) { 4060 if ( this.length ) { 4061 data = jQuery.data( elem ); 4062 4063 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { 4064 i = attrs.length; 4065 while ( i-- ) { 4066 4067 // Support: IE11+ 4068 // The attrs elements can be null (#14894) 4069 if ( attrs[ i ] ) { 4070 name = attrs[ i ].name; 4071 if ( name.indexOf( "data-" ) === 0 ) { 4072 name = jQuery.camelCase( name.slice( 5 ) ); 4073 dataAttr( elem, name, data[ name ] ); 4074 } 4075 } 4076 } 4077 jQuery._data( elem, "parsedAttrs", true ); 4078 } 4079 } 4080 4081 return data; 4082 } 4083 4084 // Sets multiple values 4085 if ( typeof key === "object" ) { 4086 return this.each( function() { 4087 jQuery.data( this, key ); 4088 } ); 4089 } 4090 4091 return arguments.length > 1 ? 4092 4093 // Sets one value 4094 this.each( function() { 4095 jQuery.data( this, key, value ); 4096 } ) : 4097 4098 // Gets one value 4099 // Try to fetch any internally stored data first 4100 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; 4101 }, 4102 4103 removeData: function( key ) { 4104 return this.each( function() { 4105 jQuery.removeData( this, key ); 4106 } ); 4107 } 4108} ); 4109 4110 4111jQuery.extend( { 4112 queue: function( elem, type, data ) { 4113 var queue; 4114 4115 if ( elem ) { 4116 type = ( type || "fx" ) + "queue"; 4117 queue = jQuery._data( elem, type ); 4118 4119 // Speed up dequeue by getting out quickly if this is just a lookup 4120 if ( data ) { 4121 if ( !queue || jQuery.isArray( data ) ) { 4122 queue = jQuery._data( elem, type, jQuery.makeArray( data ) ); 4123 } else { 4124 queue.push( data ); 4125 } 4126 } 4127 return queue || []; 4128 } 4129 }, 4130 4131 dequeue: function( elem, type ) {
vendor: 2,750 bytes, lines 4132-4257
4132 type = type || "fx"; 4133 4134 var queue = jQuery.queue( elem, type ), 4135 startLength = queue.length, 4136 fn = queue.shift(), 4137 hooks = jQuery._queueHooks( elem, type ), 4138 next = function() { 4139 jQuery.dequeue( elem, type ); 4140 }; 4141 4142 // If the fx queue is dequeued, always remove the progress sentinel 4143 if ( fn === "inprogress" ) { 4144 fn = queue.shift(); 4145 startLength--; 4146 } 4147 4148 if ( fn ) { 4149 4150 // Add a progress sentinel to prevent the fx queue from being 4151 // automatically dequeued 4152 if ( type === "fx" ) { 4153 queue.unshift( "inprogress" ); 4154 } 4155 4156 // clear up the last queue stop function 4157 delete hooks.stop; 4158 fn.call( elem, next, hooks ); 4159 } 4160 4161 if ( !startLength && hooks ) { 4162 hooks.empty.fire(); 4163 } 4164 }, 4165 4166 // not intended for public consumption - generates a queueHooks object, 4167 // or returns the current one 4168 _queueHooks: function( elem, type ) { 4169 var key = type + "queueHooks"; 4170 return jQuery._data( elem, key ) || jQuery._data( elem, key, { 4171 empty: jQuery.Callbacks( "once memory" ).add( function() { 4172 jQuery._removeData( elem, type + "queue" ); 4173 jQuery._removeData( elem, key ); 4174 } ) 4175 } ); 4176 } 4177} ); 4178 4179jQuery.fn.extend( { 4180 queue: function( type, data ) { 4181 var setter = 2; 4182 4183 if ( typeof type !== "string" ) { 4184 data = type; 4185 type = "fx"; 4186 setter--; 4187 } 4188 4189 if ( arguments.length < setter ) { 4190 return jQuery.queue( this[ 0 ], type ); 4191 } 4192 4193 return data === undefined ? 4194 this : 4195 this.each( function() { 4196 var queue = jQuery.queue( this, type, data ); 4197 4198 // ensure a hooks for this queue 4199 jQuery._queueHooks( this, type ); 4200 4201 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4202 jQuery.dequeue( this, type ); 4203 } 4204 } ); 4205 }, 4206 dequeue: function( type ) { 4207 return this.each( function() { 4208 jQuery.dequeue( this, type ); 4209 } ); 4210 }, 4211 clearQueue: function( type ) { 4212 return this.queue( type || "fx", [] ); 4213 }, 4214 4215 // Get a promise resolved when queues of a certain type 4216 // are emptied (fx is the type by default) 4217 promise: function( type, obj ) { 4218 var tmp, 4219 count = 1, 4220 defer = jQuery.Deferred(), 4221 elements = this, 4222 i = this.length, 4223 resolve = function() { 4224 if ( !( --count ) ) { 4225 defer.resolveWith( elements, [ elements ] ); 4226 } 4227 }; 4228 4229 if ( typeof type !== "string" ) { 4230 obj = type; 4231 type = undefined; 4232 } 4233 type = type || "fx"; 4234 4235 while ( i-- ) { 4236 tmp = jQuery._data( elements[ i ], type + "queueHooks" ); 4237 if ( tmp && tmp.empty ) { 4238 count++; 4239 tmp.empty.add( resolve ); 4240 } 4241 } 4242 resolve(); 4243 return defer.promise( obj ); 4244 } 4245} ); 4246 4247 4248( function() { 4249 var shrinkWrapBlocksVal; 4250 4251 support.shrinkWrapBlocks = function() { 4252 if ( shrinkWrapBlocksVal != null ) { 4253 return shrinkWrapBlocksVal; 4254 } 4255 4256 // Will be changed later if needed. 4257 shrinkWrapBlocksVal = false;
4258 4259 // Minified: var b,c,d 4260 var div, body, container; 4261 4262 body = document.getElementsByTagName( "body" )[ 0 ]; 4263 if ( !body || !body.style ) { 4264 4265 // Test fired too early or in an unsupported environment, exit. 4266 return; 4267 } 4268 4269 // Setup 4270 div = document.createElement( "div" ); 4271 container = document.createElement( "div" ); 4272 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 4273 body.appendChild( container ).appendChild( div ); 4274 4275 // Support: IE6 4276 // Check if elements with layout shrink-wrap their children 4277 if ( typeof div.style.zoom !== "undefined" ) { 4278 4279 // Reset CSS: box-sizing; display; margin; border 4280 div.style.cssText = 4281 4282 // Support: Firefox<29, Android 2.3 4283 // Vendor-prefix box-sizing 4284 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 4285 "box-sizing:content-box;display:block;margin:0;border:0;" + 4286 "padding:1px;width:1px;zoom:1"; 4287 div.appendChild( document.createElement( "div" ) ).style.width = "5px"; 4288 shrinkWrapBlocksVal = div.offsetWidth !== 3; 4289 } 4290 4291 body.removeChild( container ); 4292 4293 return shrinkWrapBlocksVal; 4294 }; 4295 4296} )(); 4297var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4298 4299var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4300 4301 4302var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4303 4304var isHidden = function( elem, el ) { 4305 4306 // isHidden might be called from jQuery#filter function; 4307 // in that case, element will be second argument 4308 elem = el || elem; 4309 return jQuery.css( elem, "display" ) === "none" || 4310 !jQuery.contains( elem.ownerDocument, elem ); 4311 }; 4312 4313 4314 4315function adjustCSS( elem, prop, valueParts, tween ) { 4316 var adjusted, 4317 scale = 1, 4318 maxIterations = 20, 4319 currentValue = tween ? 4320 function() { return tween.cur(); } : 4321 function() { return jQuery.css( elem, prop, "" ); }, 4322 initial = currentValue(), 4323 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4324 4325 // Starting value computation is required for potential unit mismatches 4326 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4327 rcssNum.exec( jQuery.css( elem, prop ) ); 4328 4329 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4330 4331 // Trust units reported by jQuery.css 4332 unit = unit || initialInUnit[ 3 ]; 4333 4334 // Make sure we update the tween properties later on 4335 valueParts = valueParts || []; 4336 4337 // Iteratively approximate from a nonzero starting point 4338 initialInUnit = +initial || 1; 4339 4340 do { 4341 4342 // If previous iteration zeroed out, double until we get *something*. 4343 // Use string for doubling so we don't accidentally see scale as unchanged below 4344 scale = scale || ".5"; 4345 4346 // Adjust and apply 4347 initialInUnit = initialInUnit / scale; 4348 jQuery.style( elem, prop, initialInUnit + unit ); 4349 4350 // Update scale, tolerating zero or NaN from tween.cur() 4351 // Break the loop if scale is unchanged or perfect, or if we've just had enough. 4352 } while ( 4353 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations 4354 ); 4355 } 4356 4357 if ( valueParts ) { 4358 initialInUnit = +initialInUnit || +initial || 0; 4359 4360 // Apply relative offset (+=/-=) if specified 4361 adjusted = valueParts[ 1 ] ? 4362 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4363 +valueParts[ 2 ]; 4364 if ( tween ) { 4365 tween.unit = unit; 4366 tween.start = initialInUnit; 4367 tween.end = adjusted; 4368 } 4369 } 4370 return adjusted; 4371} 4372 4373 4374// Multifunctional method to get and set values of a collection 4375// The value/s can optionally be executed if it's a function 4376var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4377 var i = 0, 4378 length = elems.length, 4379 bulk = key == null; 4380 4381 // Sets many values 4382 if ( jQuery.type( key ) === "object" ) { 4383 chainable = true; 4384 for ( i in key ) { 4385 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4386 } 4387 4388 // Sets one value 4389 } else if ( value !== undefined ) { 4390 chainable = true; 4391 4392 if ( !jQuery.isFunction( value ) ) { 4393 raw = true; 4394 } 4395 4396 if ( bulk ) { 4397 4398 // Bulk operations run against the entire set 4399 if ( raw ) { 4400 fn.call( elems, value ); 4401 fn = null; 4402 4403 // ...except when executing function values 4404 } else { 4405 bulk = fn; 4406 fn = function( elem, key, value ) {
4407 return bulk.call( jQuery( elem ), value ); 4408 }; 4409 } 4410 } 4411 4412 if ( fn ) { 4413 for ( ; i < length; i++ ) { 4414 fn( 4415 elems[ i ], 4416 key, 4417 raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4418 ); 4419 } 4420 } 4421 } 4422 4423 return chainable ? 4424 elems : 4425 4426 // Gets 4427 bulk ? 4428 fn.call( elems ) : 4429 length ? fn( elems[ 0 ], key ) : emptyGet; 4430}; 4431var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4432 4433var rtagName = ( /<([\w:-]+)/ ); 4434 4435var rscriptType = ( /^$|\/(?:java|ecma)script/i ); 4436 4437var rleadingWhitespace = ( /^\s+/ ); 4438 4439var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + 4440 "details|dialog|figcaption|figure|footer|header|hgroup|main|" + 4441 "mark|meter|nav|output|picture|progress|section|summary|template|time|video"; 4442 4443 4444 4445function createSafeFragment( document ) { 4446 var list = nodeNames.split( "|" ), 4447 safeFrag = document.createDocumentFragment(); 4448 4449 if ( safeFrag.createElement ) { 4450 while ( list.length ) { 4451 safeFrag.createElement( 4452 list.pop() 4453 ); 4454 } 4455 } 4456 return safeFrag; 4457} 4458 4459 4460( function() { 4461 var div = document.createElement( "div" ), 4462 fragment = document.createDocumentFragment(), 4463 input = document.createElement( "input" ); 4464 4465 // Setup 4466 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 4467 4468 // IE strips leading whitespace when .innerHTML is used 4469 support.leadingWhitespace = div.firstChild.nodeType === 3; 4470 4471 // Make sure that tbody elements aren't automatically inserted 4472 // IE will insert them into empty tables 4473 support.tbody = !div.getElementsByTagName( "tbody" ).length; 4474 4475 // Make sure that link elements get serialized correctly by innerHTML 4476 // This requires a wrapper element in IE 4477 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; 4478 4479 // Makes sure cloning an html5 element does not cause problems 4480 // Where outerHTML is undefined, this still works 4481 support.html5Clone = 4482 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; 4483 4484 // Check if a disconnected checkbox will retain its checked 4485 // value of true after appended to the DOM (IE6/7) 4486 input.type = "checkbox"; 4487 input.checked = true; 4488 fragment.appendChild( input ); 4489 support.appendChecked = input.checked; 4490 4491 // Make sure textarea (and checkbox) defaultValue is properly cloned 4492 // Support: IE6-IE11+ 4493 div.innerHTML = "<textarea>x</textarea>"; 4494 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4495 4496 // #11217 - WebKit loses check when the name is after the checked attribute 4497 fragment.appendChild( div ); 4498 4499 // Support: Windows Web Apps (WWA) 4500 // `name` and `type` must use .setAttribute for WWA (#14901) 4501 input = document.createElement( "input" ); 4502 input.setAttribute( "type", "radio" ); 4503 input.setAttribute( "checked", "checked" ); 4504 input.setAttribute( "name", "t" ); 4505 4506 div.appendChild( input ); 4507 4508 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 4509 // old WebKit doesn't clone checked state correctly in fragments 4510 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4511 4512 // Support: IE<9 4513 // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ 4514 support.noCloneEvent = !!div.addEventListener; 4515 4516 // Support: IE<9 4517 // Since attributes and properties are the same in IE, 4518 // cleanData must set properties to undefined rather than use removeAttribute 4519 div[ jQuery.expando ] = 1; 4520 support.attributes = !div.getAttribute( jQuery.expando ); 4521} )(); 4522 4523 4524// We have to close these tags to support XHTML (#13200) 4525var wrapMap = { 4526 option: [ 1, "<select multiple='multiple'>", "</select>" ], 4527 legend: [ 1, "<fieldset>", "</fieldset>" ], 4528 area: [ 1, "<map>", "</map>" ], 4529 4530 // Support: IE8 4531 param: [ 1, "<object>", "</object>" ], 4532 thead: [ 1, "<table>", "</table>" ], 4533 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4534 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 4535 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4536 4537 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, 4538 // unless wrapped in a div with non-breaking characters in front of it. 4539 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] 4540}; 4541 4542// Support: IE8-IE9 4543wrapMap.optgroup = wrapMap.option; 4544 4545wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4546wrapMap.th = wrapMap.td; 4547 4548 4549function getAll( context, tag ) { 4550 var elems, elem, 4551 i = 0, 4552 found = typeof context.getElementsByTagName !== "undefined" ? 4553 context.getElementsByTagName( tag || "*" ) : 4554 typeof context.querySelectorAll !== "undefined" ? 4555 context.querySelectorAll( tag || "*" ) : 4556 undefined; 4557 4558 if ( !found ) { 4559 for ( found = [], elems = context.childNodes || context; 4560 ( elem = elems[ i ] ) != null; 4561 i++ 4562 ) { 4563 if ( !tag || jQuery.nodeName( elem, tag ) ) { 4564 found.push( elem ); 4565 } else { 4566 jQuery.merge( found, getAll( elem, tag ) ); 4567 } 4568 } 4569 } 4570 4571 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 4572 jQuery.merge( [ context ], found ) : 4573 found; 4574} 4575 4576 4577// Mark scripts as having already been evaluated 4578function setGlobalEval( elems, refElements ) { 4579 var elem, 4580 i = 0; 4581 for ( ; ( elem = elems[ i ] ) != null; i++ ) { 4582 jQuery._data( 4583 elem, 4584 "globalEval", 4585 !refElements || jQuery._data( refElements[ i ], "globalEval" ) 4586 ); 4587 } 4588} 4589 4590
4591var rhtml = /<|&#?\w+;/, 4592 rtbody = /<tbody/i; 4593 4594function fixDefaultChecked( elem ) { 4595 if ( rcheckableType.test( elem.type ) ) { 4596 elem.defaultChecked = elem.checked; 4597 } 4598} 4599 4600function buildFragment( elems, context, scripts, selection, ignored ) { 4601 var j, elem, contains, 4602 tmp, tag, tbody, wrap, 4603 l = elems.length, 4604 4605 // Ensure a safe fragment 4606 safe = createSafeFragment( context ), 4607 4608 nodes = [], 4609 i = 0; 4610 4611 for ( ; i < l; i++ ) { 4612 elem = elems[ i ]; 4613 4614 if ( elem || elem === 0 ) { 4615 4616 // Add nodes directly 4617 if ( jQuery.type( elem ) === "object" ) { 4618 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4619 4620 // Convert non-html into a text node 4621 } else if ( !rhtml.test( elem ) ) { 4622 nodes.push( context.createTextNode( elem ) ); 4623 4624 // Convert html into DOM nodes 4625 } else { 4626 tmp = tmp || safe.appendChild( context.createElement( "div" ) ); 4627 4628 // Deserialize a standard representation 4629 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4630 wrap = wrapMap[ tag ] || wrapMap._default; 4631 4632 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4633 4634 // Descend through wrappers to the right content 4635 j = wrap[ 0 ]; 4636 while ( j-- ) { 4637 tmp = tmp.lastChild; 4638 } 4639 4640 // Manually add leading whitespace removed by IE 4641 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 4642 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) ); 4643 } 4644 4645 // Remove IE's autoinserted <tbody> from table fragments 4646 if ( !support.tbody ) { 4647 4648 // String was a <table>, *may* have spurious <tbody> 4649 elem = tag === "table" && !rtbody.test( elem ) ? 4650 tmp.firstChild : 4651 4652 // String was a bare <thead> or <tfoot> 4653 wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ? 4654 tmp : 4655 0; 4656 4657 j = elem && elem.childNodes.length; 4658 while ( j-- ) { 4659 if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) && 4660 !tbody.childNodes.length ) { 4661 4662 elem.removeChild( tbody ); 4663 } 4664 } 4665 } 4666 4667 jQuery.merge( nodes, tmp.childNodes ); 4668 4669 // Fix #12392 for WebKit and IE > 9 4670 tmp.textContent = ""; 4671 4672 // Fix #12392 for oldIE 4673 while ( tmp.firstChild ) { 4674 tmp.removeChild( tmp.firstChild ); 4675 } 4676 4677 // Remember the top-level container for proper cleanup 4678 tmp = safe.lastChild; 4679 } 4680 } 4681 } 4682 4683 // Fix #11356: Clear elements from fragment 4684 if ( tmp ) { 4685 safe.removeChild( tmp ); 4686 } 4687 4688 // Reset defaultChecked for any radios and checkboxes 4689 // about to be appended to the DOM in IE 6/7 (#8060) 4690 if ( !support.appendChecked ) { 4691 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); 4692 } 4693 4694 i = 0; 4695 while ( ( elem = nodes[ i++ ] ) ) { 4696 4697 // Skip elements already in the context collection (trac-4087) 4698 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4699 if ( ignored ) { 4700 ignored.push( elem ); 4701 } 4702 4703 continue; 4704 } 4705 4706 contains = jQuery.contains( elem.ownerDocument, elem ); 4707 4708 // Append to fragment 4709 tmp = getAll( safe.appendChild( elem ), "script" ); 4710 4711 // Preserve script evaluation history 4712 if ( contains ) { 4713 setGlobalEval( tmp ); 4714 } 4715 4716 // Capture executables 4717 if ( scripts ) { 4718 j = 0; 4719 while ( ( elem = tmp[ j++ ] ) ) { 4720 if ( rscriptType.test( elem.type || "" ) ) { 4721 scripts.push( elem ); 4722 } 4723 } 4724 } 4725 } 4726 4727 tmp = null; 4728 4729 return safe; 4730} 4731 4732 4733( function() { 4734 var i, eventName, 4735 div = document.createElement( "div" ); 4736 4737 // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events) 4738 for ( i in { submit: true, change: true, focusin: true } ) { 4739 eventName = "on" + i; 4740
vendor: 13,833 bytes, lines 4741-5220
4741 if ( !( support[ i ] = eventName in window ) ) { 4742 4743 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) 4744 div.setAttribute( eventName, "t" ); 4745 support[ i ] = div.attributes[ eventName ].expando === false; 4746 } 4747 } 4748 4749 // Null elements to avoid leaks in IE. 4750 div = null; 4751} )(); 4752 4753 4754var rformElems = /^(?:input|select|textarea)$/i, 4755 rkeyEvent = /^key/, 4756 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 4757 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 4758 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4759 4760function returnTrue() { 4761 return true; 4762} 4763 4764function returnFalse() { 4765 return false; 4766} 4767 4768// Support: IE9 4769// See #13393 for more info 4770function safeActiveElement() { 4771 try { 4772 return document.activeElement; 4773 } catch ( err ) { } 4774} 4775 4776function on( elem, types, selector, data, fn, one ) { 4777 var origFn, type; 4778 4779 // Types can be a map of types/handlers 4780 if ( typeof types === "object" ) { 4781 4782 // ( types-Object, selector, data ) 4783 if ( typeof selector !== "string" ) { 4784 4785 // ( types-Object, data ) 4786 data = data || selector; 4787 selector = undefined; 4788 } 4789 for ( type in types ) { 4790 on( elem, type, selector, data, types[ type ], one ); 4791 } 4792 return elem; 4793 } 4794 4795 if ( data == null && fn == null ) { 4796 4797 // ( types, fn ) 4798 fn = selector; 4799 data = selector = undefined; 4800 } else if ( fn == null ) { 4801 if ( typeof selector === "string" ) { 4802 4803 // ( types, selector, fn ) 4804 fn = data; 4805 data = undefined; 4806 } else { 4807 4808 // ( types, data, fn ) 4809 fn = data; 4810 data = selector; 4811 selector = undefined; 4812 } 4813 } 4814 if ( fn === false ) { 4815 fn = returnFalse; 4816 } else if ( !fn ) { 4817 return elem; 4818 } 4819 4820 if ( one === 1 ) { 4821 origFn = fn; 4822 fn = function( event ) { 4823 4824 // Can use an empty set, since event contains the info 4825 jQuery().off( event ); 4826 return origFn.apply( this, arguments ); 4827 }; 4828 4829 // Use same guid so caller can remove using origFn 4830 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4831 } 4832 return elem.each( function() { 4833 jQuery.event.add( this, types, fn, data, selector ); 4834 } ); 4835} 4836 4837/* 4838 * Helper functions for managing events -- not part of the public interface. 4839 * Props to Dean Edwards' addEvent library for many of the ideas. 4840 */ 4841jQuery.event = { 4842 4843 global: {}, 4844 4845 add: function( elem, types, handler, data, selector ) { 4846 var tmp, events, t, handleObjIn, 4847 special, eventHandle, handleObj, 4848 handlers, type, namespaces, origType, 4849 elemData = jQuery._data( elem ); 4850 4851 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4852 if ( !elemData ) { 4853 return; 4854 } 4855 4856 // Caller can pass in an object of custom data in lieu of the handler 4857 if ( handler.handler ) { 4858 handleObjIn = handler; 4859 handler = handleObjIn.handler; 4860 selector = handleObjIn.selector; 4861 } 4862 4863 // Make sure that the handler has a unique ID, used to find/remove it later 4864 if ( !handler.guid ) { 4865 handler.guid = jQuery.guid++; 4866 } 4867 4868 // Init the element's event structure and main handler, if this is the first 4869 if ( !( events = elemData.events ) ) { 4870 events = elemData.events = {}; 4871 } 4872 if ( !( eventHandle = elemData.handle ) ) { 4873 eventHandle = elemData.handle = function( e ) { 4874 4875 // Discard the second event of a jQuery.event.trigger() and 4876 // when an event is called after a page has unloaded 4877 return typeof jQuery !== "undefined" && 4878 ( !e || jQuery.event.triggered !== e.type ) ? 4879 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : 4880 undefined; 4881 }; 4882 4883 // Add elem as a property of the handle fn to prevent a memory leak 4884 // with IE non-native events 4885 eventHandle.elem = elem; 4886 } 4887 4888 // Handle multiple events separated by a space 4889 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4890 t = types.length; 4891 while ( t-- ) { 4892 tmp = rtypenamespace.exec( types[ t ] ) || []; 4893 type = origType = tmp[ 1 ]; 4894 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4895 4896 // There *must* be a type, no attaching namespace-only handlers 4897 if ( !type ) { 4898 continue; 4899 } 4900 4901 // If event changes its type, use the special event handlers for the changed type 4902 special = jQuery.event.special[ type ] || {}; 4903 4904 // If selector defined, determine special event api type, otherwise given type 4905 type = ( selector ? special.delegateType : special.bindType ) || type; 4906 4907 // Update special based on newly reset type 4908 special = jQuery.event.special[ type ] || {}; 4909 4910 // handleObj is passed to all event handlers 4911 handleObj = jQuery.extend( { 4912 type: type, 4913 origType: origType, 4914 data: data, 4915 handler: handler, 4916 guid: handler.guid, 4917 selector: selector, 4918 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 4919 namespace: namespaces.join( "." ) 4920 }, handleObjIn ); 4921 4922 // Init the event handler queue if we're the first 4923 if ( !( handlers = events[ type ] ) ) { 4924 handlers = events[ type ] = []; 4925 handlers.delegateCount = 0; 4926 4927 // Only use addEventListener/attachEvent if the special events handler returns false 4928 if ( !special.setup || 4929 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 4930 4931 // Bind the global event handler to the element 4932 if ( elem.addEventListener ) { 4933 elem.addEventListener( type, eventHandle, false ); 4934 4935 } else if ( elem.attachEvent ) { 4936 elem.attachEvent( "on" + type, eventHandle ); 4937 } 4938 } 4939 } 4940 4941 if ( special.add ) { 4942 special.add.call( elem, handleObj ); 4943 4944 if ( !handleObj.handler.guid ) { 4945 handleObj.handler.guid = handler.guid; 4946 } 4947 } 4948 4949 // Add to the element's handler list, delegates in front 4950 if ( selector ) { 4951 handlers.splice( handlers.delegateCount++, 0, handleObj ); 4952 } else { 4953 handlers.push( handleObj ); 4954 } 4955 4956 // Keep track of which events have ever been used, for event optimization 4957 jQuery.event.global[ type ] = true; 4958 } 4959 4960 // Nullify elem to prevent memory leaks in IE 4961 elem = null; 4962 }, 4963 4964 // Detach an event or set of events from an element 4965 remove: function( elem, types, handler, selector, mappedTypes ) { 4966 var j, handleObj, tmp, 4967 origCount, t, events, 4968 special, handlers, type, 4969 namespaces, origType, 4970 elemData = jQuery.hasData( elem ) && jQuery._data( elem ); 4971 4972 if ( !elemData || !( events = elemData.events ) ) { 4973 return; 4974 } 4975 4976 // Once for each type.namespace in types; type may be omitted 4977 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4978 t = types.length; 4979 while ( t-- ) { 4980 tmp = rtypenamespace.exec( types[ t ] ) || []; 4981 type = origType = tmp[ 1 ]; 4982 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4983 4984 // Unbind all events (on this namespace, if provided) for the element 4985 if ( !type ) { 4986 for ( type in events ) { 4987 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 4988 } 4989 continue; 4990 } 4991 4992 special = jQuery.event.special[ type ] || {}; 4993 type = ( selector ? special.delegateType : special.bindType ) || type; 4994 handlers = events[ type ] || []; 4995 tmp = tmp[ 2 ] && 4996 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 4997 4998 // Remove matching events 4999 origCount = j = handlers.length; 5000 while ( j-- ) { 5001 handleObj = handlers[ j ]; 5002 5003 if ( ( mappedTypes || origType === handleObj.origType ) && 5004 ( !handler || handler.guid === handleObj.guid ) && 5005 ( !tmp || tmp.test( handleObj.namespace ) ) && 5006 ( !selector || selector === handleObj.selector || 5007 selector === "**" && handleObj.selector ) ) { 5008 handlers.splice( j, 1 ); 5009 5010 if ( handleObj.selector ) { 5011 handlers.delegateCount--; 5012 } 5013 if ( special.remove ) { 5014 special.remove.call( elem, handleObj ); 5015 } 5016 } 5017 } 5018 5019 // Remove generic event handler if we removed something and no more handlers exist 5020 // (avoids potential for endless recursion during removal of special event handlers) 5021 if ( origCount && !handlers.length ) { 5022 if ( !special.teardown || 5023 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5024 5025 jQuery.removeEvent( elem, type, elemData.handle ); 5026 } 5027 5028 delete events[ type ]; 5029 } 5030 } 5031 5032 // Remove the expando if it's no longer used 5033 if ( jQuery.isEmptyObject( events ) ) { 5034 delete elemData.handle; 5035 5036 // removeData also checks for emptiness and clears the expando if empty 5037 // so use it instead of delete 5038 jQuery._removeData( elem, "events" ); 5039 } 5040 }, 5041 5042 trigger: function( event, data, elem, onlyHandlers ) { 5043 var handle, ontype, cur, 5044 bubbleType, special, tmp, i, 5045 eventPath = [ elem || document ], 5046 type = hasOwn.call( event, "type" ) ? event.type : event, 5047 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 5048 5049 cur = tmp = elem = elem || document; 5050 5051 // Don't do events on text and comment nodes 5052 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 5053 return; 5054 } 5055 5056 // focus/blur morphs to focusin/out; ensure we're not firing them right now 5057 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 5058 return; 5059 } 5060 5061 if ( type.indexOf( "." ) > -1 ) { 5062 5063 // Namespaced trigger; create a regexp to match event type in handle() 5064 namespaces = type.split( "." ); 5065 type = namespaces.shift(); 5066 namespaces.sort(); 5067 } 5068 ontype = type.indexOf( ":" ) < 0 && "on" + type; 5069 5070 // Caller can pass in a jQuery.Event object, Object, or just an event type string 5071 event = event[ jQuery.expando ] ? 5072 event : 5073 new jQuery.Event( type, typeof event === "object" && event ); 5074 5075 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 5076 event.isTrigger = onlyHandlers ? 2 : 3; 5077 event.namespace = namespaces.join( "." ); 5078 event.rnamespace = event.namespace ? 5079 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 5080 null; 5081 5082 // Clean up the event in case it is being reused 5083 event.result = undefined; 5084 if ( !event.target ) { 5085 event.target = elem; 5086 } 5087 5088 // Clone any incoming data and prepend the event, creating the handler arg list 5089 data = data == null ? 5090 [ event ] : 5091 jQuery.makeArray( data, [ event ] ); 5092 5093 // Allow special events to draw outside the lines 5094 special = jQuery.event.special[ type ] || {}; 5095 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 5096 return; 5097 } 5098 5099 // Determine event propagation path in advance, per W3C events spec (#9951) 5100 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 5101 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 5102 5103 bubbleType = special.delegateType || type; 5104 if ( !rfocusMorph.test( bubbleType + type ) ) { 5105 cur = cur.parentNode; 5106 } 5107 for ( ; cur; cur = cur.parentNode ) { 5108 eventPath.push( cur ); 5109 tmp = cur; 5110 } 5111 5112 // Only add window if we got to document (e.g., not plain obj or detached DOM) 5113 if ( tmp === ( elem.ownerDocument || document ) ) { 5114 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 5115 } 5116 } 5117 5118 // Fire handlers on the event path 5119 i = 0; 5120 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 5121 5122 event.type = i > 1 ? 5123 bubbleType : 5124 special.bindType || type; 5125 5126 // jQuery handler 5127 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && 5128 jQuery._data( cur, "handle" ); 5129 5130 if ( handle ) { 5131 handle.apply( cur, data ); 5132 } 5133 5134 // Native handler 5135 handle = ontype && cur[ ontype ]; 5136 if ( handle && handle.apply && acceptData( cur ) ) { 5137 event.result = handle.apply( cur, data ); 5138 if ( event.result === false ) { 5139 event.preventDefault(); 5140 } 5141 } 5142 } 5143 event.type = type; 5144 5145 // If nobody prevented the default action, do it now 5146 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 5147 5148 if ( 5149 ( !special._default || 5150 special._default.apply( eventPath.pop(), data ) === false 5151 ) && acceptData( elem ) 5152 ) { 5153 5154 // Call a native DOM method on the target with the same name name as the event. 5155 // Can't use an .isFunction() check here because IE6/7 fails that test. 5156 // Don't do default actions on window, that's where global variables be (#6170) 5157 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { 5158 5159 // Don't re-trigger an onFOO event when we call its FOO() method 5160 tmp = elem[ ontype ]; 5161 5162 if ( tmp ) { 5163 elem[ ontype ] = null; 5164 } 5165 5166 // Prevent re-triggering of the same event, since we already bubbled it above 5167 jQuery.event.triggered = type; 5168 try { 5169 elem[ type ](); 5170 } catch ( e ) { 5171 5172 // IE<9 dies on focus/blur to hidden element (#1486,#12518) 5173 // only reproducible on winXP IE8 native, not IE9 in IE8 mode 5174 } 5175 jQuery.event.triggered = undefined; 5176 5177 if ( tmp ) { 5178 elem[ ontype ] = tmp; 5179 } 5180 } 5181 } 5182 } 5183 5184 return event.result; 5185 }, 5186 5187 dispatch: function( event ) { 5188 5189 // Make a writable jQuery.Event from the native event object 5190 event = jQuery.event.fix( event ); 5191 5192 var i, j, ret, matched, handleObj, 5193 handlerQueue = [], 5194 args = slice.call( arguments ), 5195 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], 5196 special = jQuery.event.special[ event.type ] || {}; 5197 5198 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5199 args[ 0 ] = event; 5200 event.delegateTarget = this; 5201 5202 // Call the preDispatch hook for the mapped type, and let it bail if desired 5203 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5204 return; 5205 } 5206 5207 // Determine handlers 5208 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5209 5210 // Run delegates first; they may want to stop propagation beneath us 5211 i = 0; 5212 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5213 event.currentTarget = matched.elem; 5214 5215 j = 0; 5216 while ( ( handleObj = matched.handlers[ j++ ] ) && 5217 !event.isImmediatePropagationStopped() ) { 5218 5219 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 5220 // a subset or equal to those in the bound event (both can have no namespace).
5221 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 5222 5223 event.handleObj = handleObj; 5224 event.data = handleObj.data; 5225 5226 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5227 handleObj.handler ).apply( matched.elem, args ); 5228 5229 if ( ret !== undefined ) { 5230 if ( ( event.result = ret ) === false ) { 5231 event.preventDefault(); 5232 event.stopPropagation(); 5233 } 5234 } 5235 } 5236 } 5237 } 5238 5239 // Call the postDispatch hook for the mapped type 5240 if ( special.postDispatch ) { 5241 special.postDispatch.call( this, event ); 5242 } 5243 5244 return event.result; 5245 }, 5246 5247 handlers: function( event, handlers ) { 5248 var i, matches, sel, handleObj, 5249 handlerQueue = [], 5250 delegateCount = handlers.delegateCount, 5251 cur = event.target; 5252 5253 // Support (at least): Chrome, IE9 5254 // Find delegate handlers 5255 // Black-hole SVG <use> instance trees (#13180) 5256 // 5257 // Support: Firefox<=42+ 5258 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) 5259 if ( delegateCount && cur.nodeType && 5260 ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { 5261 5262 /* jshint eqeqeq: false */ 5263 for ( ; cur != this; cur = cur.parentNode || this ) { 5264 /* jshint eqeqeq: true */ 5265 5266 // Don't check non-elements (#13208) 5267 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5268 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { 5269 matches = []; 5270 for ( i = 0; i < delegateCount; i++ ) { 5271 handleObj = handlers[ i ]; 5272 5273 // Don't conflict with Object.prototype properties (#13203) 5274 sel = handleObj.selector + " "; 5275 5276 if ( matches[ sel ] === undefined ) { 5277 matches[ sel ] = handleObj.needsContext ? 5278 jQuery( sel, this ).index( cur ) > -1 : 5279 jQuery.find( sel, this, null, [ cur ] ).length; 5280 } 5281 if ( matches[ sel ] ) { 5282 matches.push( handleObj ); 5283 } 5284 } 5285 if ( matches.length ) { 5286 handlerQueue.push( { elem: cur, handlers: matches } ); 5287 } 5288 } 5289 } 5290 } 5291 5292 // Add the remaining (directly-bound) handlers 5293 if ( delegateCount < handlers.length ) { 5294 handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); 5295 } 5296 5297 return handlerQueue; 5298 }, 5299 5300 fix: function( event ) { 5301 if ( event[ jQuery.expando ] ) { 5302 return event; 5303 } 5304 5305 // Create a writable copy of the event object and normalize some properties 5306 var i, prop, copy, 5307 type = event.type, 5308 originalEvent = event, 5309 fixHook = this.fixHooks[ type ]; 5310 5311 if ( !fixHook ) { 5312 this.fixHooks[ type ] = fixHook = 5313 rmouseEvent.test( type ) ? this.mouseHooks : 5314 rkeyEvent.test( type ) ? this.keyHooks : 5315 {}; 5316 } 5317 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 5318 5319 event = new jQuery.Event( originalEvent ); 5320 5321 i = copy.length; 5322 while ( i-- ) { 5323 prop = copy[ i ]; 5324 event[ prop ] = originalEvent[ prop ]; 5325 } 5326 5327 // Support: IE<9 5328 // Fix target property (#1925) 5329 if ( !event.target ) { 5330 event.target = originalEvent.srcElement || document; 5331 } 5332 5333 // Support: Safari 6-8+ 5334 // Target should not be a text node (#504, #13143) 5335 if ( event.target.nodeType === 3 ) { 5336 event.target = event.target.parentNode; 5337 } 5338 5339 // Support: IE<9 5340 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) 5341 event.metaKey = !!event.metaKey; 5342 5343 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 5344 }, 5345 5346 // Includes some event props shared by KeyEvent and MouseEvent 5347 props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + 5348 "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), 5349 5350 fixHooks: {}, 5351 5352 keyHooks: { 5353 props: "char charCode key keyCode".split( " " ), 5354 filter: function( event, original ) { 5355 5356 // Add which for key events 5357 if ( event.which == null ) { 5358 event.which = original.charCode != null ? original.charCode : original.keyCode; 5359 } 5360 5361 return event; 5362 } 5363 }, 5364 5365 mouseHooks: { 5366 props: ( "button buttons clientX clientY fromElement offsetX offsetY " + 5367 "pageX pageY screenX screenY toElement" ).split( " " ), 5368 filter: function( event, original ) { 5369 var body, eventDoc, doc, 5370 button = original.button, 5371 fromElement = original.fromElement; 5372 5373 // Calculate pageX/Y if missing and clientX/Y available 5374 if ( event.pageX == null && original.clientX != null ) { 5375 eventDoc = event.target.ownerDocument || document; 5376 doc = eventDoc.documentElement; 5377 body = eventDoc.body; 5378 5379 event.pageX = original.clientX + 5380 ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - 5381 ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 5382 event.pageY = original.clientY + 5383 ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - 5384 ( doc && doc.clientTop || body && body.clientTop || 0 ); 5385 } 5386 5387 // Add relatedTarget, if necessary 5388 if ( !event.relatedTarget && fromElement ) { 5389 event.relatedTarget = fromElement === event.target ? 5390 original.toElement : 5391 fromElement; 5392 } 5393 5394 // Add which for click: 1 === left; 2 === middle; 3 === right 5395 // Note: button is not normalized, so don't use it 5396 if ( !event.which && button !== undefined ) { 5397 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 5398 } 5399 5400 return event; 5401 } 5402 }, 5403 5404 special: { 5405 load: { 5406 5407 // Prevent triggered image.load events from bubbling to window.load 5408 noBubble: true 5409 }, 5410 focus: { 5411 5412 // Fire native event if possible so blur/focus sequence is correct 5413 trigger: function() { 5414 if ( this !== safeActiveElement() && this.focus ) { 5415 try { 5416 this.focus(); 5417 return false;
5418 } catch ( e ) { 5419 5420 // Support: IE<9 5421 // If we error on focus to hidden element (#1486, #12518), 5422 // let .trigger() run the handlers 5423 } 5424 } 5425 }, 5426 delegateType: "focusin" 5427 }, 5428 blur: { 5429 trigger: function() { 5430 if ( this === safeActiveElement() && this.blur ) { 5431 this.blur(); 5432 return false; 5433 } 5434 }, 5435 delegateType: "focusout" 5436 }, 5437 click: { 5438 5439 // For checkbox, fire native event so checked state will be right 5440 trigger: function() { 5441 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { 5442 this.click(); 5443 return false; 5444 } 5445 }, 5446 5447 // For cross-browser consistency, don't fire native .click() on links 5448 _default: function( event ) { 5449 return jQuery.nodeName( event.target, "a" ); 5450 } 5451 }, 5452 5453 beforeunload: { 5454 postDispatch: function( event ) { 5455 5456 // Support: Firefox 20+ 5457 // Firefox doesn't alert if the returnValue field is not set. 5458 if ( event.result !== undefined && event.originalEvent ) { 5459 event.originalEvent.returnValue = event.result; 5460 } 5461 } 5462 } 5463 }, 5464 5465 // Piggyback on a donor event to simulate a different one 5466 simulate: function( type, elem, event ) { 5467 var e = jQuery.extend( 5468 new jQuery.Event(), 5469 event, 5470 { 5471 type: type, 5472 isSimulated: true 5473 5474 // Previously, `originalEvent: {}` was set here, so stopPropagation call 5475 // would not be triggered on donor event, since in our own 5476 // jQuery.event.stopPropagation function we had a check for existence of 5477 // originalEvent.stopPropagation method, so, consequently it would be a noop. 5478 // 5479 // Guard for simulated events was moved to jQuery.event.stopPropagation function 5480 // since `originalEvent` should point to the original event for the 5481 // constancy with other events and for more focused logic 5482 } 5483 ); 5484 5485 jQuery.event.trigger( e, null, elem ); 5486 5487 if ( e.isDefaultPrevented() ) { 5488 event.preventDefault(); 5489 } 5490 } 5491}; 5492 5493jQuery.removeEvent = document.removeEventListener ? 5494 function( elem, type, handle ) { 5495 5496 // This "if" is needed for plain objects 5497 if ( elem.removeEventListener ) { 5498 elem.removeEventListener( type, handle ); 5499 } 5500 } : 5501 function( elem, type, handle ) { 5502 var name = "on" + type; 5503 5504 if ( elem.detachEvent ) { 5505 5506 // #8545, #7054, preventing memory leaks for custom events in IE6-8 5507 // detachEvent needed property on element, by name of that event, 5508 // to properly expose it to GC 5509 if ( typeof elem[ name ] === "undefined" ) { 5510 elem[ name ] = null; 5511 } 5512 5513 elem.detachEvent( name, handle ); 5514 } 5515 }; 5516 5517jQuery.Event = function( src, props ) { 5518 5519 // Allow instantiation without the 'new' keyword 5520 if ( !( this instanceof jQuery.Event ) ) { 5521 return new jQuery.Event( src, props ); 5522 } 5523 5524 // Event object 5525 if ( src && src.type ) { 5526 this.originalEvent = src; 5527 this.type = src.type; 5528 5529 // Events bubbling up the document may have been marked as prevented 5530 // by a handler lower down the tree; reflect the correct value. 5531 this.isDefaultPrevented = src.defaultPrevented || 5532 src.defaultPrevented === undefined && 5533 5534 // Support: IE < 9, Android < 4.0 5535 src.returnValue === false ? 5536 returnTrue : 5537 returnFalse; 5538 5539 // Event type 5540 } else { 5541 this.type = src; 5542 } 5543 5544 // Put explicitly provided properties onto the event object 5545 if ( props ) { 5546 jQuery.extend( this, props ); 5547 } 5548 5549 // Create a timestamp if incoming event doesn't have one 5550 this.timeStamp = src && src.timeStamp || jQuery.now(); 5551 5552 // Mark it as fixed 5553 this[ jQuery.expando ] = true; 5554}; 5555 5556// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5557// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5558jQuery.Event.prototype = { 5559 constructor: jQuery.Event, 5560 isDefaultPrevented: returnFalse, 5561 isPropagationStopped: returnFalse, 5562 isImmediatePropagationStopped: returnFalse, 5563 5564 preventDefault: function() { 5565 var e = this.originalEvent; 5566 5567 this.isDefaultPrevented = returnTrue; 5568 if ( !e ) { 5569 return; 5570 } 5571 5572 // If preventDefault exists, run it on the original event 5573 if ( e.preventDefault ) { 5574 e.preventDefault(); 5575 5576 // Support: IE 5577 // Otherwise set the returnValue property of the original event to false 5578 } else { 5579 e.returnValue = false;
5580 } 5581 }, 5582 stopPropagation: function() { 5583 var e = this.originalEvent; 5584 5585 this.isPropagationStopped = returnTrue; 5586 5587 if ( !e || this.isSimulated ) { 5588 return; 5589 } 5590 5591 // If stopPropagation exists, run it on the original event 5592 if ( e.stopPropagation ) { 5593 e.stopPropagation(); 5594 } 5595 5596 // Support: IE 5597 // Set the cancelBubble property of the original event to true 5598 e.cancelBubble = true; 5599 }, 5600 stopImmediatePropagation: function() { 5601 var e = this.originalEvent; 5602 5603 this.isImmediatePropagationStopped = returnTrue; 5604 5605 if ( e && e.stopImmediatePropagation ) { 5606 e.stopImmediatePropagation(); 5607 } 5608 5609 this.stopPropagation(); 5610 } 5611}; 5612 5613// Create mouseenter/leave events using mouseover/out and event-time checks 5614// so that event delegation works in jQuery. 5615// Do the same for pointerenter/pointerleave and pointerover/pointerout 5616// 5617// Support: Safari 7 only 5618// Safari sends mouseenter too often; see: 5619// https://code.google.com/p/chromium/issues/detail?id=470258 5620// for the description of the bug (it existed in older Chrome versions as well). 5621jQuery.each( { 5622 mouseenter: "mouseover", 5623 mouseleave: "mouseout", 5624 pointerenter: "pointerover", 5625 pointerleave: "pointerout" 5626}, function( orig, fix ) { 5627 jQuery.event.special[ orig ] = { 5628 delegateType: fix, 5629 bindType: fix, 5630 5631 handle: function( event ) { 5632 var ret, 5633 target = this, 5634 related = event.relatedTarget, 5635 handleObj = event.handleObj; 5636 5637 // For mouseenter/leave call the handler if related is outside the target. 5638 // NB: No relatedTarget if the mouse left/entered the browser window 5639 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5640 event.type = handleObj.origType; 5641 ret = handleObj.handler.apply( this, arguments ); 5642 event.type = fix; 5643 } 5644 return ret; 5645 } 5646 }; 5647} ); 5648 5649// IE submit delegation 5650if ( !support.submit ) { 5651 5652 jQuery.event.special.submit = { 5653 setup: function() { 5654 5655 // Only need this for delegated form submit events 5656 if ( jQuery.nodeName( this, "form" ) ) { 5657 return false; 5658 } 5659 5660 // Lazy-add a submit handler when a descendant form may potentially be submitted 5661 jQuery.event.add( this, "click._submit keypress._submit", function( e ) { 5662 5663 // Node name check avoids a VML-related crash in IE (#9807) 5664 var elem = e.target, 5665 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? 5666 5667 // Support: IE <=8 5668 // We use jQuery.prop instead of elem.form 5669 // to allow fixing the IE8 delegated submit issue (gh-2332) 5670 // by 3rd party polyfills/workarounds. 5671 jQuery.prop( elem, "form" ) : 5672 undefined; 5673 5674 if ( form && !jQuery._data( form, "submit" ) ) { 5675 jQuery.event.add( form, "submit._submit", function( event ) { 5676 event._submitBubble = true; 5677 } ); 5678 jQuery._data( form, "submit", true ); 5679 } 5680 } ); 5681 5682 // return undefined since we don't need an event listener 5683 }, 5684 5685 postDispatch: function( event ) { 5686 5687 // If form was submitted by the user, bubble the event up the tree 5688 if ( event._submitBubble ) { 5689 delete event._submitBubble; 5690 if ( this.parentNode && !event.isTrigger ) { 5691 jQuery.event.simulate( "submit", this.parentNode, event ); 5692 } 5693 } 5694 }, 5695 5696 teardown: function() { 5697 5698 // Only need this for delegated form submit events 5699 if ( jQuery.nodeName( this, "form" ) ) { 5700 return false; 5701 } 5702 5703 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 5704 jQuery.event.remove( this, "._submit" ); 5705 } 5706 }; 5707} 5708 5709// IE change delegation and checkbox/radio fix 5710if ( !support.change ) { 5711 5712 jQuery.event.special.change = { 5713 5714 setup: function() { 5715 5716 if ( rformElems.test( this.nodeName ) ) { 5717 5718 // IE doesn't fire change on a check/radio until blur; trigger it on click 5719 // after a propertychange. Eat the blur-change in special.change.handle. 5720 // This still fires onchange a second time for check/radio after blur. 5721 if ( this.type === "checkbox" || this.type === "radio" ) { 5722 jQuery.event.add( this, "propertychange._change", function( event ) { 5723 if ( event.originalEvent.propertyName === "checked" ) { 5724 this._justChanged = true; 5725 } 5726 } ); 5727 jQuery.event.add( this, "click._change", function( event ) { 5728 if ( this._justChanged && !event.isTrigger ) { 5729 this._justChanged = false;
5730 } 5731 5732 // Allow triggered, simulated change events (#11500) 5733 jQuery.event.simulate( "change", this, event ); 5734 } ); 5735 } 5736 return false; 5737 } 5738 5739 // Delegated event; lazy-add a change handler on descendant inputs 5740 jQuery.event.add( this, "beforeactivate._change", function( e ) { 5741 var elem = e.target; 5742 5743 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) { 5744 jQuery.event.add( elem, "change._change", function( event ) { 5745 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { 5746 jQuery.event.simulate( "change", this.parentNode, event ); 5747 } 5748 } ); 5749 jQuery._data( elem, "change", true ); 5750 } 5751 } ); 5752 }, 5753 5754 handle: function( event ) { 5755 var elem = event.target; 5756 5757 // Swallow native change events from checkbox/radio, we already triggered them above 5758 if ( this !== elem || event.isSimulated || event.isTrigger || 5759 ( elem.type !== "radio" && elem.type !== "checkbox" ) ) { 5760 5761 return event.handleObj.handler.apply( this, arguments ); 5762 } 5763 }, 5764 5765 teardown: function() { 5766 jQuery.event.remove( this, "._change" ); 5767 5768 return !rformElems.test( this.nodeName ); 5769 } 5770 }; 5771} 5772 5773// Support: Firefox 5774// Firefox doesn't have focus(in | out) events 5775// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5776// 5777// Support: Chrome, Safari 5778// focus(in | out) events fire after focus & blur events, 5779// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5780// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 5781if ( !support.focusin ) { 5782 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 5783 5784 // Attach a single capturing handler on the document while someone wants focusin/focusout 5785 var handler = function( event ) { 5786 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 5787 }; 5788 5789 jQuery.event.special[ fix ] = { 5790 setup: function() { 5791 var doc = this.ownerDocument || this, 5792 attaches = jQuery._data( doc, fix ); 5793 5794 if ( !attaches ) { 5795 doc.addEventListener( orig, handler, true ); 5796 } 5797 jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); 5798 }, 5799 teardown: function() { 5800 var doc = this.ownerDocument || this, 5801 attaches = jQuery._data( doc, fix ) - 1; 5802 5803 if ( !attaches ) { 5804 doc.removeEventListener( orig, handler, true ); 5805 jQuery._removeData( doc, fix ); 5806 } else { 5807 jQuery._data( doc, fix, attaches ); 5808 } 5809 } 5810 }; 5811 } ); 5812} 5813 5814jQuery.fn.extend( { 5815 5816 on: function( types, selector, data, fn ) { 5817 return on( this, types, selector, data, fn ); 5818 }, 5819 one: function( types, selector, data, fn ) { 5820 return on( this, types, selector, data, fn, 1 ); 5821 }, 5822 off: function( types, selector, fn ) { 5823 var handleObj, type; 5824 if ( types && types.preventDefault && types.handleObj ) { 5825 5826 // ( event ) dispatched jQuery.Event 5827 handleObj = types.handleObj; 5828 jQuery( types.delegateTarget ).off( 5829 handleObj.namespace ? 5830 handleObj.origType + "." + handleObj.namespace : 5831 handleObj.origType, 5832 handleObj.selector, 5833 handleObj.handler 5834 ); 5835 return this; 5836 } 5837 if ( typeof types === "object" ) { 5838 5839 // ( types-object [, selector] ) 5840 for ( type in types ) { 5841 this.off( type, selector, types[ type ] ); 5842 } 5843 return this; 5844 } 5845 if ( selector === false || typeof selector === "function" ) { 5846 5847 // ( types [, fn] ) 5848 fn = selector; 5849 selector = undefined; 5850 } 5851 if ( fn === false ) { 5852 fn = returnFalse; 5853 } 5854 return this.each( function() { 5855 jQuery.event.remove( this, types, fn, selector ); 5856 } ); 5857 }, 5858 5859 trigger: function( type, data ) { 5860 return this.each( function() { 5861 jQuery.event.trigger( type, data, this ); 5862 } ); 5863 }, 5864 triggerHandler: function( type, data ) { 5865 var elem = this[ 0 ]; 5866 if ( elem ) { 5867 return jQuery.event.trigger( type, data, elem, true ); 5868 } 5869 } 5870} ); 5871 5872 5873var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, 5874 rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ), 5875 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, 5876 5877 // Support: IE 10-11, Edge 10240+ 5878 // In IE/Edge using regex groups here causes severe slowdowns. 5879 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5880 rnoInnerhtml = /<script|<style|<link/i, 5881 5882 // checked="checked" or checked 5883 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5884 rscriptTypeMasked = /^true\/(.*)/, 5885 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, 5886 safeFragment = createSafeFragment( document ), 5887 fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) ); 5888 5889// Support: IE<8 5890// Manipulating tables requires a tbody 5891function manipulationTarget( elem, content ) { 5892 return jQuery.nodeName( elem, "table" ) && 5893 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 5894 5895 elem.getElementsByTagName( "tbody" )[ 0 ] || 5896 elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : 5897 elem; 5898} 5899 5900// Replace/restore the type attribute of script elements for safe DOM manipulation 5901function disableScript( elem ) { 5902 elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type; 5903 return elem; 5904} 5905function restoreScript( elem ) { 5906 var match = rscriptTypeMasked.exec( elem.type ); 5907 if ( match ) { 5908 elem.type = match[ 1 ]; 5909 } else { 5910 elem.removeAttribute( "type" ); 5911 } 5912 return elem; 5913} 5914 5915function cloneCopyEvent( src, dest ) {
5916 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 5917 return; 5918 } 5919 5920 var type, i, l, 5921 oldData = jQuery._data( src ), 5922 curData = jQuery._data( dest, oldData ), 5923 events = oldData.events; 5924 5925 if ( events ) { 5926 delete curData.handle; 5927 curData.events = {}; 5928 5929 for ( type in events ) { 5930 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5931 jQuery.event.add( dest, type, events[ type ][ i ] ); 5932 } 5933 } 5934 } 5935 5936 // make the cloned public data object a copy from the original 5937 if ( curData.data ) { 5938 curData.data = jQuery.extend( {}, curData.data ); 5939 } 5940} 5941 5942function fixCloneNodeIssues( src, dest ) { 5943 var nodeName, e, data; 5944 5945 // We do not need to do anything for non-Elements 5946 if ( dest.nodeType !== 1 ) { 5947 return; 5948 } 5949 5950 nodeName = dest.nodeName.toLowerCase(); 5951 5952 // IE6-8 copies events bound via attachEvent when using cloneNode. 5953 if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { 5954 data = jQuery._data( dest ); 5955 5956 for ( e in data.events ) { 5957 jQuery.removeEvent( dest, e, data.handle ); 5958 } 5959 5960 // Event data gets referenced instead of copied if the expando gets copied too 5961 dest.removeAttribute( jQuery.expando ); 5962 } 5963 5964 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text 5965 if ( nodeName === "script" && dest.text !== src.text ) { 5966 disableScript( dest ).text = src.text; 5967 restoreScript( dest ); 5968 5969 // IE6-10 improperly clones children of object elements using classid. 5970 // IE10 throws NoModificationAllowedError if parent is null, #12132. 5971 } else if ( nodeName === "object" ) { 5972 if ( dest.parentNode ) { 5973 dest.outerHTML = src.outerHTML; 5974 } 5975 5976 // This path appears unavoidable for IE9. When cloning an object 5977 // element in IE9, the outerHTML strategy above is not sufficient. 5978 // If the src has innerHTML and the destination does not, 5979 // copy the src.innerHTML into the dest.innerHTML. #10324 5980 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) { 5981 dest.innerHTML = src.innerHTML; 5982 } 5983 5984 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5985 5986 // IE6-8 fails to persist the checked state of a cloned checkbox 5987 // or radio button. Worse, IE6-7 fail to give the cloned element 5988 // a checked appearance if the defaultChecked value isn't also set 5989 5990 dest.defaultChecked = dest.checked = src.checked; 5991 5992 // IE6-7 get confused and end up setting the value of a cloned 5993 // checkbox/radio button to an empty string instead of "on" 5994 if ( dest.value !== src.value ) { 5995 dest.value = src.value; 5996 } 5997 5998 // IE6-8 fails to return the selected option to the default selected 5999 // state when cloning options 6000 } else if ( nodeName === "option" ) { 6001 dest.defaultSelected = dest.selected = src.defaultSelected; 6002 6003 // IE6-8 fails to set the defaultValue to the correct value when 6004 // cloning other types of input fields 6005 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6006 dest.defaultValue = src.defaultValue; 6007 } 6008} 6009 6010function domManip( collection, args, callback, ignored ) { 6011 6012 // Flatten any nested arrays 6013 args = concat.apply( [], args ); 6014 6015 var first, node, hasScripts, 6016 scripts, doc, fragment, 6017 i = 0, 6018 l = collection.length, 6019 iNoClone = l - 1, 6020 value = args[ 0 ], 6021 isFunction = jQuery.isFunction( value ); 6022 6023 // We can't cloneNode fragments that contain checked, in WebKit 6024 if ( isFunction || 6025 ( l > 1 && typeof value === "string" && 6026 !support.checkClone && rchecked.test( value ) ) ) { 6027 return collection.each( function( index ) { 6028 var self = collection.eq( index ); 6029 if ( isFunction ) { 6030 args[ 0 ] = value.call( this, index, self.html() ); 6031 } 6032 domManip( self, args, callback, ignored ); 6033 } ); 6034 } 6035 6036 if ( l ) { 6037 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6038 first = fragment.firstChild; 6039 6040 if ( fragment.childNodes.length === 1 ) { 6041 fragment = first; 6042 } 6043 6044 // Require either new content or an interest in ignored elements to invoke the callback 6045 if ( first || ignored ) { 6046 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6047 hasScripts = scripts.length; 6048 6049 // Use the original fragment for the last item 6050 // instead of the first because it can end up 6051 // being emptied incorrectly in certain situations (#8070). 6052 for ( ; i < l; i++ ) { 6053 node = fragment; 6054 6055 if ( i !== iNoClone ) { 6056 node = jQuery.clone( node, true, true ); 6057 6058 // Keep references to cloned scripts for later restoration 6059 if ( hasScripts ) { 6060
6061 // Support: Android<4.1, PhantomJS<2 6062 // push.apply(_, arraylike) throws on ancient WebKit 6063 jQuery.merge( scripts, getAll( node, "script" ) ); 6064 } 6065 } 6066 6067 callback.call( collection[ i ], node, i ); 6068 } 6069 6070 if ( hasScripts ) { 6071 doc = scripts[ scripts.length - 1 ].ownerDocument; 6072 6073 // Reenable scripts 6074 jQuery.map( scripts, restoreScript ); 6075 6076 // Evaluate executable scripts on first document insertion 6077 for ( i = 0; i < hasScripts; i++ ) { 6078 node = scripts[ i ]; 6079 if ( rscriptType.test( node.type || "" ) && 6080 !jQuery._data( node, "globalEval" ) && 6081 jQuery.contains( doc, node ) ) { 6082 6083 if ( node.src ) { 6084 6085 // Optional AJAX dependency, but won't run scripts if not present 6086 if ( jQuery._evalUrl ) { 6087 jQuery._evalUrl( node.src ); 6088 } 6089 } else { 6090 jQuery.globalEval( 6091 ( node.text || node.textContent || node.innerHTML || "" ) 6092 .replace( rcleanScript, "" ) 6093 ); 6094 } 6095 } 6096 } 6097 } 6098 6099 // Fix #11809: Avoid leaking memory 6100 fragment = first = null; 6101 } 6102 } 6103 6104 return collection; 6105} 6106 6107function remove( elem, selector, keepData ) { 6108 var node, 6109 elems = selector ? jQuery.filter( selector, elem ) : elem, 6110 i = 0; 6111 6112 for ( ; ( node = elems[ i ] ) != null; i++ ) { 6113 6114 if ( !keepData && node.nodeType === 1 ) { 6115 jQuery.cleanData( getAll( node ) ); 6116 } 6117 6118 if ( node.parentNode ) { 6119 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 6120 setGlobalEval( getAll( node, "script" ) ); 6121 } 6122 node.parentNode.removeChild( node ); 6123 } 6124 } 6125 6126 return elem; 6127} 6128 6129jQuery.extend( { 6130 htmlPrefilter: function( html ) { 6131 return html.replace( rxhtmlTag, "<$1></$2>" ); 6132 }, 6133 6134 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6135 var destElements, node, clone, i, srcElements, 6136 inPage = jQuery.contains( elem.ownerDocument, elem ); 6137 6138 if ( support.html5Clone || jQuery.isXMLDoc( elem ) || 6139 !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { 6140 6141 clone = elem.cloneNode( true ); 6142 6143 // IE<=8 does not properly clone detached, unknown element nodes 6144 } else { 6145 fragmentDiv.innerHTML = elem.outerHTML; 6146 fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); 6147 } 6148 6149 if ( ( !support.noCloneEvent || !support.noCloneChecked ) && 6150 ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { 6151 6152 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 6153 destElements = getAll( clone ); 6154 srcElements = getAll( elem ); 6155 6156 // Fix all IE cloning issues 6157 for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) { 6158 6159 // Ensure that the destination node is not null; Fixes #9587 6160 if ( destElements[ i ] ) { 6161 fixCloneNodeIssues( node, destElements[ i ] ); 6162 } 6163 } 6164 } 6165 6166 // Copy the events from the original to the clone 6167 if ( dataAndEvents ) { 6168 if ( deepDataAndEvents ) { 6169 srcElements = srcElements || getAll( elem ); 6170 destElements = destElements || getAll( clone ); 6171 6172 for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) { 6173 cloneCopyEvent( node, destElements[ i ] ); 6174 } 6175 } else { 6176 cloneCopyEvent( elem, clone ); 6177 } 6178 } 6179 6180 // Preserve script evaluation history 6181 destElements = getAll( clone, "script" ); 6182 if ( destElements.length > 0 ) { 6183 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6184 } 6185 6186 destElements = srcElements = node = null; 6187 6188 // Return the cloned set 6189 return clone; 6190 }, 6191 6192 cleanData: function( elems, /* internal */ forceAcceptData ) { 6193 var elem, type, id, data, 6194 i = 0, 6195 internalKey = jQuery.expando, 6196 cache = jQuery.cache, 6197 attributes = support.attributes, 6198 special = jQuery.event.special; 6199 6200 for ( ; ( elem = elems[ i ] ) != null; i++ ) { 6201 if ( forceAcceptData || acceptData( elem ) ) { 6202 6203 id = elem[ internalKey ]; 6204 data = id && cache[ id ]; 6205 6206 if ( data ) { 6207 if ( data.events ) { 6208 for ( type in data.events ) { 6209 if ( special[ type ] ) { 6210 jQuery.event.remove( elem, type ); 6211 6212 // This is a shortcut to avoid jQuery.event.remove's overhead 6213 } else { 6214 jQuery.removeEvent( elem, type, data.handle ); 6215 } 6216 } 6217 } 6218 6219 // Remove cache only if it was not already removed by jQuery.event.remove 6220 if ( cache[ id ] ) { 6221 6222 delete cache[ id ]; 6223
6224 // Support: IE<9 6225 // IE does not allow us to delete expando properties from nodes 6226 // IE creates expando attributes along with the property 6227 // IE does not have a removeAttribute function on Document nodes 6228 if ( !attributes && typeof elem.removeAttribute !== "undefined" ) { 6229 elem.removeAttribute( internalKey ); 6230 6231 // Webkit & Blink performance suffers when deleting properties 6232 // from DOM nodes, so set to undefined instead 6233 // https://code.google.com/p/chromium/issues/detail?id=378607 6234 } else { 6235 elem[ internalKey ] = undefined; 6236 } 6237 6238 deletedIds.push( id ); 6239 } 6240 } 6241 } 6242 } 6243 } 6244} ); 6245 6246jQuery.fn.extend( { 6247 6248 // Keep domManip exposed until 3.0 (gh-2225) 6249 domManip: domManip, 6250 6251 detach: function( selector ) { 6252 return remove( this, selector, true ); 6253 }, 6254 6255 remove: function( selector ) { 6256 return remove( this, selector ); 6257 }, 6258 6259 text: function( value ) { 6260 return access( this, function( value ) { 6261 return value === undefined ? 6262 jQuery.text( this ) : 6263 this.empty().append( 6264 ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) 6265 ); 6266 }, null, value, arguments.length ); 6267 }, 6268 6269 append: function() { 6270 return domManip( this, arguments, function( elem ) { 6271 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6272 var target = manipulationTarget( this, elem ); 6273 target.appendChild( elem ); 6274 } 6275 } ); 6276 }, 6277
6278 prepend: function() { 6279 return domManip( this, arguments, function( elem ) { 6280 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6281 var target = manipulationTarget( this, elem ); 6282 target.insertBefore( elem, target.firstChild ); 6283 } 6284 } ); 6285 }, 6286 6287 before: function() { 6288 return domManip( this, arguments, function( elem ) { 6289 if ( this.parentNode ) { 6290 this.parentNode.insertBefore( elem, this ); 6291 } 6292 } ); 6293 }, 6294 6295 after: function() { 6296 return domManip( this, arguments, function( elem ) { 6297 if ( this.parentNode ) { 6298 this.parentNode.insertBefore( elem, this.nextSibling ); 6299 } 6300 } ); 6301 }, 6302 6303 empty: function() { 6304 var elem, 6305 i = 0; 6306 6307 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6308 6309 // Remove element nodes and prevent memory leaks 6310 if ( elem.nodeType === 1 ) { 6311 jQuery.cleanData( getAll( elem, false ) ); 6312 } 6313 6314 // Remove any remaining nodes 6315 while ( elem.firstChild ) { 6316 elem.removeChild( elem.firstChild ); 6317 } 6318 6319 // If this is a select, ensure that it displays empty (#12336) 6320 // Support: IE<9 6321 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { 6322 elem.options.length = 0; 6323 } 6324 } 6325 6326 return this; 6327 }, 6328 6329 clone: function( dataAndEvents, deepDataAndEvents ) { 6330 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6331 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6332 6333 return this.map( function() { 6334 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6335 } ); 6336 }, 6337 6338 html: function( value ) { 6339 return access( this, function( value ) { 6340 var elem = this[ 0 ] || {}, 6341 i = 0, 6342 l = this.length; 6343 6344 if ( value === undefined ) { 6345 return elem.nodeType === 1 ? 6346 elem.innerHTML.replace( rinlinejQuery, "" ) : 6347 undefined; 6348 } 6349 6350 // See if we can take a shortcut and just use innerHTML 6351 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6352 ( support.htmlSerialize || !rnoshimcache.test( value ) ) && 6353 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && 6354 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6355 6356 value = jQuery.htmlPrefilter( value ); 6357 6358 try { 6359 for ( ; i < l; i++ ) { 6360 6361 // Remove element nodes and prevent memory leaks 6362 elem = this[ i ] || {}; 6363 if ( elem.nodeType === 1 ) { 6364 jQuery.cleanData( getAll( elem, false ) ); 6365 elem.innerHTML = value; 6366 } 6367 } 6368 6369 elem = 0; 6370 6371 // If using innerHTML throws an exception, use the fallback method 6372 } catch ( e ) {} 6373 } 6374 6375 if ( elem ) { 6376 this.empty().append( value ); 6377 } 6378 }, null, value, arguments.length ); 6379 }, 6380 6381 replaceWith: function() { 6382 var ignored = []; 6383 6384 // Make the changes, replacing each non-ignored context element with the new content 6385 return domManip( this, arguments, function( elem ) { 6386 var parent = this.parentNode; 6387 6388 if ( jQuery.inArray( this, ignored ) < 0 ) { 6389 jQuery.cleanData( getAll( this ) ); 6390 if ( parent ) { 6391 parent.replaceChild( elem, this ); 6392 } 6393 } 6394 6395 // Force callback invocation 6396 }, ignored ); 6397 } 6398} ); 6399 6400jQuery.each( { 6401 appendTo: "append", 6402 prependTo: "prepend", 6403 insertBefore: "before", 6404 insertAfter: "after", 6405 replaceAll: "replaceWith" 6406}, function( name, original ) { 6407 jQuery.fn[ name ] = function( selector ) { 6408 var elems, 6409 i = 0, 6410 ret = [], 6411 insert = jQuery( selector ), 6412 last = insert.length - 1; 6413 6414 for ( ; i <= last; i++ ) { 6415 elems = i === last ? this : this.clone( true ); 6416 jQuery( insert[ i ] )[ original ]( elems ); 6417 6418 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() 6419 push.apply( ret, elems.get() ); 6420 } 6421 6422 return this.pushStack( ret ); 6423 }; 6424} ); 6425 6426 6427var iframe, 6428 elemdisplay = { 6429 6430 // Support: Firefox 6431 // We have to pre-define these values for FF (#10227) 6432 HTML: "block", 6433 BODY: "block" 6434 }; 6435 6436/** 6437 * Retrieve the actual display of a element 6438 * @param {String} name nodeName of the element 6439 * @param {Object} doc Document object 6440 */ 6441 6442// Called only from within defaultDisplay 6443function actualDisplay( name, doc ) { 6444 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 6445 6446 display = jQuery.css( elem[ 0 ], "display" ); 6447 6448 // We don't have any data stored on the element, 6449 // so use "detach" method as fast way to get rid of the element 6450 elem.detach(); 6451
6452 return display; 6453} 6454 6455/** 6456 * Try to determine the default display value of an element 6457 * @param {String} nodeName 6458 */ 6459function defaultDisplay( nodeName ) { 6460 var doc = document, 6461 display = elemdisplay[ nodeName ]; 6462 6463 if ( !display ) { 6464 display = actualDisplay( nodeName, doc ); 6465 6466 // If the simple way fails, read from inside an iframe 6467 if ( display === "none" || !display ) { 6468 6469 // Use the already-created iframe if possible 6470 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) ) 6471 .appendTo( doc.documentElement ); 6472 6473 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 6474 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; 6475 6476 // Support: IE 6477 doc.write(); 6478 doc.close(); 6479 6480 display = actualDisplay( nodeName, doc ); 6481 iframe.detach(); 6482 } 6483 6484 // Store the correct default display 6485 elemdisplay[ nodeName ] = display; 6486 } 6487 6488 return display; 6489} 6490var rmargin = ( /^margin/ ); 6491 6492var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6493 6494var swap = function( elem, options, callback, args ) { 6495 var ret, name, 6496 old = {}; 6497 6498 // Remember the old values, and insert the new ones 6499 for ( name in options ) { 6500 old[ name ] = elem.style[ name ]; 6501 elem.style[ name ] = options[ name ]; 6502 } 6503 6504 ret = callback.apply( elem, args || [] ); 6505 6506 // Revert the old values 6507 for ( name in options ) { 6508 elem.style[ name ] = old[ name ]; 6509 } 6510 6511 return ret; 6512}; 6513 6514 6515var documentElement = document.documentElement; 6516 6517 6518 6519( function() { 6520 var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal, 6521 reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal, 6522 container = document.createElement( "div" ), 6523 div = document.createElement( "div" ); 6524 6525 // Finish early in limited (non-browser) environments 6526 if ( !div.style ) { 6527 return; 6528 } 6529 6530 div.style.cssText = "float:left;opacity:.5"; 6531 6532 // Support: IE<9 6533 // Make sure that element opacity exists (as opposed to filter) 6534 support.opacity = div.style.opacity === "0.5"; 6535 6536 // Verify style float existence 6537 // (IE uses styleFloat instead of cssFloat) 6538 support.cssFloat = !!div.style.cssFloat; 6539 6540 div.style.backgroundClip = "content-box"; 6541 div.cloneNode( true ).style.backgroundClip = ""; 6542 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6543 6544 container = document.createElement( "div" ); 6545 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + 6546 "padding:0;margin-top:1px;position:absolute"; 6547 div.innerHTML = ""; 6548 container.appendChild( div ); 6549 6550 // Support: Firefox<29, Android 2.3 6551 // Vendor-prefix box-sizing 6552 support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" || 6553 div.style.WebkitBoxSizing === ""; 6554 6555 jQuery.extend( support, { 6556 reliableHiddenOffsets: function() { 6557 if ( pixelPositionVal == null ) { 6558 computeStyleTests(); 6559 } 6560 return reliableHiddenOffsetsVal; 6561 }, 6562 6563 boxSizingReliable: function() { 6564 6565 // We're checking for pixelPositionVal here instead of boxSizingReliableVal 6566 // since that compresses better and they're computed together anyway. 6567 if ( pixelPositionVal == null ) { 6568 computeStyleTests(); 6569 } 6570 return boxSizingReliableVal; 6571 }, 6572 6573 pixelMarginRight: function() { 6574 6575 // Support: Android 4.0-4.3 6576 if ( pixelPositionVal == null ) { 6577 computeStyleTests(); 6578 } 6579 return pixelMarginRightVal; 6580 }, 6581 6582 pixelPosition: function() { 6583 if ( pixelPositionVal == null ) { 6584 computeStyleTests(); 6585 } 6586 return pixelPositionVal; 6587 }, 6588 6589 reliableMarginRight: function() { 6590 6591 // Support: Android 2.3 6592 if ( pixelPositionVal == null ) { 6593 computeStyleTests(); 6594 } 6595 return reliableMarginRightVal; 6596 }, 6597 6598 reliableMarginLeft: function() { 6599 6600 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37 6601 if ( pixelPositionVal == null ) { 6602 computeStyleTests(); 6603 } 6604 return reliableMarginLeftVal; 6605 } 6606 } ); 6607 6608 function computeStyleTests() { 6609 var contents, divStyle, 6610 documentElement = document.documentElement; 6611 6612 // Setup 6613 documentElement.appendChild( container ); 6614 6615 div.style.cssText = 6616 6617 // Support: Android 2.3 6618 // Vendor-prefix box-sizing 6619 "-webkit-box-sizing:border-box;box-sizing:border-box;" + 6620 "position:relative;display:block;" + 6621 "margin:auto;border:1px;padding:1px;" + 6622 "top:1%;width:50%"; 6623
6624 // Support: IE<9 6625 // Assume reasonable values in the absence of getComputedStyle 6626 pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false; 6627 pixelMarginRightVal = reliableMarginRightVal = true; 6628 6629 // Check for getComputedStyle so that this code is not run in IE<9. 6630 if ( window.getComputedStyle ) { 6631 divStyle = window.getComputedStyle( div ); 6632 pixelPositionVal = ( divStyle || {} ).top !== "1%"; 6633 reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px"; 6634 boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px"; 6635 6636 // Support: Android 4.0 - 4.3 only 6637 // Some styles come back with percentage values, even though they shouldn't 6638 div.style.marginRight = "50%"; 6639 pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px"; 6640 6641 // Support: Android 2.3 only 6642 // Div with explicit width and no margin-right incorrectly 6643 // gets computed margin-right based on width of container (#3333) 6644 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6645 contents = div.appendChild( document.createElement( "div" ) ); 6646 6647 // Reset CSS: box-sizing; display; margin; border; padding 6648 contents.style.cssText = div.style.cssText = 6649 6650 // Support: Android 2.3 6651 // Vendor-prefix box-sizing 6652 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 6653 "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; 6654 contents.style.marginRight = contents.style.width = "0"; 6655 div.style.width = "1px"; 6656 6657 reliableMarginRightVal = 6658 !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight ); 6659 6660 div.removeChild( contents ); 6661 } 6662 6663 // Support: IE6-8 6664 // First check that getClientRects works as expected 6665 // Check if table cells still have offsetWidth/Height when they are set 6666 // to display:none and there are still other visible table cells in a 6667 // table row; if so, offsetWidth/Height are not reliable for use when 6668 // determining if an element has been hidden directly using 6669 // display:none (it is still safe to use offsets if a parent element is 6670 // hidden; don safety goggles and see bug #4512 for more information). 6671 div.style.display = "none"; 6672 reliableHiddenOffsetsVal = div.getClientRects().length === 0; 6673 if ( reliableHiddenOffsetsVal ) { 6674 div.style.display = ""; 6675 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 6676 div.childNodes[ 0 ].style.borderCollapse = "separate"; 6677 contents = div.getElementsByTagName( "td" ); 6678 contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; 6679 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6680 if ( reliableHiddenOffsetsVal ) { 6681 contents[ 0 ].style.display = ""; 6682 contents[ 1 ].style.display = "none"; 6683 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6684 } 6685 } 6686 6687 // Teardown 6688 documentElement.removeChild( container ); 6689 } 6690 6691} )(); 6692 6693 6694var getStyles, curCSS, 6695 rposition = /^(top|right|bottom|left)$/; 6696 6697if ( window.getComputedStyle ) { 6698 getStyles = function( elem ) { 6699 6700 // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 6701 // IE throws on elements created in popups 6702 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6703 var view = elem.ownerDocument.defaultView; 6704 6705 if ( !view || !view.opener ) { 6706 view = window; 6707 } 6708 6709 return view.getComputedStyle( elem ); 6710 }; 6711 6712 curCSS = function( elem, name, computed ) { 6713 var width, minWidth, maxWidth, ret, 6714 style = elem.style; 6715 6716 computed = computed || getStyles( elem ); 6717 6718 // getPropertyValue is only needed for .css('filter') in IE9, see #12537 6719 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; 6720 6721 // Support: Opera 12.1x only 6722 // Fall back to style even without computed 6723 // computed is undefined for elems on document fragments 6724 if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) { 6725 ret = jQuery.style( elem, name ); 6726 } 6727 6728 if ( computed ) { 6729 6730 // A tribute to the "awesome hack by Dean Edwards" 6731 // Chrome < 17 and Safari 5.0 uses "computed value" 6732 // instead of "used value" for margin-right 6733 // Safari 5.1.7 (at least) returns percentage for a larger set of values, 6734 // but width seems to be reliably pixels 6735 // this is against the CSSOM draft spec: 6736 // http://dev.w3.org/csswg/cssom/#resolved-values 6737 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { 6738 6739 // Remember the original values 6740 width = style.width; 6741 minWidth = style.minWidth; 6742 maxWidth = style.maxWidth; 6743 6744 // Put in the new values to get a computed value out 6745 style.minWidth = style.maxWidth = style.width = ret; 6746 ret = computed.width; 6747 6748 // Revert the changed values 6749 style.width = width; 6750 style.minWidth = minWidth; 6751 style.maxWidth = maxWidth; 6752 } 6753 } 6754
6755 // Support: IE 6756 // IE returns zIndex value as an integer. 6757 return ret === undefined ? 6758 ret : 6759 ret + ""; 6760 }; 6761} else if ( documentElement.currentStyle ) { 6762 getStyles = function( elem ) { 6763 return elem.currentStyle; 6764 }; 6765 6766 curCSS = function( elem, name, computed ) { 6767 var left, rs, rsLeft, ret, 6768 style = elem.style; 6769 6770 computed = computed || getStyles( elem ); 6771 ret = computed ? computed[ name ] : undefined; 6772 6773 // Avoid setting ret to empty string here 6774 // so we don't default to auto 6775 if ( ret == null && style && style[ name ] ) { 6776 ret = style[ name ]; 6777 } 6778 6779 // From the awesome hack by Dean Edwards 6780 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6781 6782 // If we're not dealing with a regular pixel number 6783 // but a number that has a weird ending, we need to convert it to pixels 6784 // but not position css attributes, as those are 6785 // proportional to the parent element instead 6786 // and we can't measure the parent instead because it 6787 // might trigger a "stacking dolls" problem 6788 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { 6789 6790 // Remember the original values 6791 left = style.left; 6792 rs = elem.runtimeStyle; 6793 rsLeft = rs && rs.left; 6794 6795 // Put in the new values to get a computed value out 6796 if ( rsLeft ) { 6797 rs.left = elem.currentStyle.left; 6798 } 6799 style.left = name === "fontSize" ? "1em" : ret; 6800 ret = style.pixelLeft + "px"; 6801 6802 // Revert the changed values 6803 style.left = left; 6804 if ( rsLeft ) { 6805 rs.left = rsLeft; 6806 } 6807 } 6808 6809 // Support: IE 6810 // IE returns zIndex value as an integer. 6811 return ret === undefined ? 6812 ret : 6813 ret + "" || "auto"; 6814 }; 6815} 6816 6817 6818 6819 6820function addGetHookIf( conditionFn, hookFn ) { 6821 6822 // Define the hook, we'll check on the first run if it's really needed. 6823 return { 6824 get: function() { 6825 if ( conditionFn() ) { 6826 6827 // Hook not needed (or it's not possible to use it due 6828 // to missing dependency), remove it. 6829 delete this.get; 6830 return; 6831 } 6832 6833 // Hook needed; redefine it so that the support test is not executed again. 6834 return ( this.get = hookFn ).apply( this, arguments ); 6835 } 6836 }; 6837} 6838 6839 6840var 6841 6842 ralpha = /alpha\([^)]*\)/i, 6843 ropacity = /opacity\s*=\s*([^)]*)/i, 6844 6845 // swappable if display is none or starts with table except 6846 // "table", "table-cell", or "table-caption" 6847 // see here for display values: 6848 // https://developer.mozilla.org/en-US/docs/CSS/display 6849 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6850 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), 6851 6852 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6853 cssNormalTransform = { 6854 letterSpacing: "0", 6855 fontWeight: "400" 6856 }, 6857 6858 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], 6859 emptyStyle = document.createElement( "div" ).style; 6860 6861 6862// return a css property mapped to a potentially vendor prefixed property 6863function vendorPropName( name ) { 6864 6865 // shortcut for names that are not vendor prefixed 6866 if ( name in emptyStyle ) { 6867 return name; 6868 } 6869 6870 // check for vendor prefixed names 6871 var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ), 6872 i = cssPrefixes.length; 6873 6874 while ( i-- ) { 6875 name = cssPrefixes[ i ] + capName; 6876 if ( name in emptyStyle ) { 6877 return name; 6878 } 6879 } 6880} 6881 6882function showHide( elements, show ) { 6883 var display, elem, hidden, 6884 values = [], 6885 index = 0, 6886 length = elements.length; 6887 6888 for ( ; index < length; index++ ) { 6889 elem = elements[ index ]; 6890 if ( !elem.style ) { 6891 continue; 6892 } 6893 6894 values[ index ] = jQuery._data( elem, "olddisplay" ); 6895 display = elem.style.display; 6896 if ( show ) { 6897 6898 // Reset the inline display of this element to learn if it is 6899 // being hidden by cascaded rules or not 6900 if ( !values[ index ] && display === "none" ) { 6901 elem.style.display = ""; 6902 } 6903 6904 // Set elements which have been overridden with display: none 6905 // in a stylesheet to whatever the default browser style is 6906 // for such an element 6907 if ( elem.style.display === "" && isHidden( elem ) ) { 6908 values[ index ] = 6909 jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) ); 6910 } 6911 } else { 6912 hidden = isHidden( elem ); 6913 6914 if ( display && display !== "none" || !hidden ) { 6915 jQuery._data( 6916 elem, 6917 "olddisplay",
vendor: 6,043 bytes, lines 6918-7129
6918 hidden ? display : jQuery.css( elem, "display" ) 6919 ); 6920 } 6921 } 6922 } 6923 6924 // Set the display of most of the elements in a second loop 6925 // to avoid the constant reflow 6926 for ( index = 0; index < length; index++ ) { 6927 elem = elements[ index ]; 6928 if ( !elem.style ) { 6929 continue; 6930 } 6931 if ( !show || elem.style.display === "none" || elem.style.display === "" ) { 6932 elem.style.display = show ? values[ index ] || "" : "none"; 6933 } 6934 } 6935 6936 return elements; 6937} 6938 6939function setPositiveNumber( elem, value, subtract ) { 6940 var matches = rnumsplit.exec( value ); 6941 return matches ? 6942 6943 // Guard against undefined "subtract", e.g., when used as in cssHooks 6944 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : 6945 value; 6946} 6947 6948function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 6949 var i = extra === ( isBorderBox ? "border" : "content" ) ? 6950 6951 // If we already have the right measurement, avoid augmentation 6952 4 : 6953 6954 // Otherwise initialize for horizontal or vertical properties 6955 name === "width" ? 1 : 0, 6956 6957 val = 0; 6958 6959 for ( ; i < 4; i += 2 ) { 6960 6961 // both box models exclude margin, so add it if we want it 6962 if ( extra === "margin" ) { 6963 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 6964 } 6965 6966 if ( isBorderBox ) { 6967 6968 // border-box includes padding, so remove it if we want content 6969 if ( extra === "content" ) { 6970 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6971 } 6972 6973 // at this point, extra isn't border nor margin, so remove border 6974 if ( extra !== "margin" ) { 6975 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6976 } 6977 } else { 6978 6979 // at this point, extra isn't content, so add padding 6980 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6981 6982 // at this point, extra isn't content nor padding, so add border 6983 if ( extra !== "padding" ) { 6984 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6985 } 6986 } 6987 } 6988 6989 return val; 6990} 6991 6992function getWidthOrHeight( elem, name, extra ) { 6993 6994 // Start with offset property, which is equivalent to the border-box value 6995 var valueIsBorderBox = true, 6996 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 6997 styles = getStyles( elem ), 6998 isBorderBox = support.boxSizing && 6999 jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 7000 7001 // some non-html elements return undefined for offsetWidth, so check for null/undefined 7002 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 7003 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 7004 if ( val <= 0 || val == null ) { 7005 7006 // Fall back to computed then uncomputed css if necessary 7007 val = curCSS( elem, name, styles ); 7008 if ( val < 0 || val == null ) { 7009 val = elem.style[ name ]; 7010 } 7011 7012 // Computed unit is not pixels. Stop here and return. 7013 if ( rnumnonpx.test( val ) ) { 7014 return val; 7015 } 7016 7017 // we need the check for style in case a browser which returns unreliable values 7018 // for getComputedStyle silently falls back to the reliable elem.style 7019 valueIsBorderBox = isBorderBox && 7020 ( support.boxSizingReliable() || val === elem.style[ name ] ); 7021 7022 // Normalize "", auto, and prepare for extra 7023 val = parseFloat( val ) || 0; 7024 } 7025 7026 // use the active box-sizing model to add/subtract irrelevant styles 7027 return ( val + 7028 augmentWidthOrHeight( 7029 elem, 7030 name, 7031 extra || ( isBorderBox ? "border" : "content" ), 7032 valueIsBorderBox, 7033 styles 7034 ) 7035 ) + "px"; 7036} 7037 7038jQuery.extend( { 7039 7040 // Add in style property hooks for overriding the default 7041 // behavior of getting and setting a style property 7042 cssHooks: { 7043 opacity: { 7044 get: function( elem, computed ) { 7045 if ( computed ) { 7046 7047 // We should always get a number back from opacity 7048 var ret = curCSS( elem, "opacity" ); 7049 return ret === "" ? "1" : ret; 7050 } 7051 } 7052 } 7053 }, 7054 7055 // Don't automatically add "px" to these possibly-unitless properties 7056 cssNumber: { 7057 "animationIterationCount": true, 7058 "columnCount": true, 7059 "fillOpacity": true, 7060 "flexGrow": true, 7061 "flexShrink": true, 7062 "fontWeight": true, 7063 "lineHeight": true, 7064 "opacity": true, 7065 "order": true, 7066 "orphans": true, 7067 "widows": true, 7068 "zIndex": true, 7069 "zoom": true 7070 }, 7071 7072 // Add in properties whose names you wish to fix before 7073 // setting or getting the value 7074 cssProps: { 7075 7076 // normalize float css property 7077 "float": support.cssFloat ? "cssFloat" : "styleFloat" 7078 }, 7079 7080 // Get and set the style property on a DOM Node 7081 style: function( elem, name, value, extra ) { 7082 7083 // Don't set styles on text and comment nodes 7084 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 7085 return; 7086 } 7087 7088 // Make sure that we're working with the right name 7089 var ret, type, hooks, 7090 origName = jQuery.camelCase( name ), 7091 style = elem.style; 7092 7093 name = jQuery.cssProps[ origName ] || 7094 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 7095 7096 // gets hook for the prefixed version 7097 // followed by the unprefixed version 7098 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7099 7100 // Check if we're setting a value 7101 if ( value !== undefined ) { 7102 type = typeof value; 7103 7104 // Convert "+=" or "-=" to relative numbers (#7345) 7105 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 7106 value = adjustCSS( elem, name, ret ); 7107 7108 // Fixes bug #9237 7109 type = "number"; 7110 } 7111 7112 // Make sure that null and NaN values aren't set. See: #7116 7113 if ( value == null || value !== value ) { 7114 return; 7115 } 7116 7117 // If a number was passed in, add the unit (except for certain CSS properties) 7118 if ( type === "number" ) { 7119 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 7120 } 7121 7122 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, 7123 // but it would mean to define eight 7124 // (for every problematic property) identical functions 7125 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 7126 style[ name ] = "inherit"; 7127 } 7128 7129 // If a hook was provided, use that value, otherwise just set the specified value
7130 if ( !hooks || !( "set" in hooks ) || 7131 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 7132 7133 // Support: IE 7134 // Swallow errors from 'invalid' CSS values (#5509) 7135 try { 7136 style[ name ] = value; 7137 } catch ( e ) {} 7138 } 7139 7140 } else { 7141 7142 // If a hook was provided get the non-computed value from there 7143 if ( hooks && "get" in hooks && 7144 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 7145 7146 return ret; 7147 } 7148 7149 // Otherwise just get the value from the style object 7150 return style[ name ]; 7151 } 7152 }, 7153 7154 css: function( elem, name, extra, styles ) { 7155 var num, val, hooks, 7156 origName = jQuery.camelCase( name ); 7157 7158 // Make sure that we're working with the right name 7159 name = jQuery.cssProps[ origName ] || 7160 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 7161 7162 // gets hook for the prefixed version 7163 // followed by the unprefixed version 7164 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7165 7166 // If a hook was provided get the computed value from there 7167 if ( hooks && "get" in hooks ) { 7168 val = hooks.get( elem, true, extra ); 7169 } 7170 7171 // Otherwise, if a way to get the computed value exists, use that 7172 if ( val === undefined ) { 7173 val = curCSS( elem, name, styles ); 7174 } 7175 7176 //convert "normal" to computed value 7177 if ( val === "normal" && name in cssNormalTransform ) { 7178 val = cssNormalTransform[ name ]; 7179 } 7180 7181 // Return, converting to number if forced or a qualifier was provided and val looks numeric 7182 if ( extra === "" || extra ) { 7183 num = parseFloat( val ); 7184 return extra === true || isFinite( num ) ? num || 0 : val; 7185 } 7186 return val; 7187 } 7188} ); 7189 7190jQuery.each( [ "height", "width" ], function( i, name ) { 7191 jQuery.cssHooks[ name ] = { 7192 get: function( elem, computed, extra ) { 7193 if ( computed ) { 7194 7195 // certain elements can have dimension info if we invisibly show them 7196 // however, it must have a current display style that would benefit from this 7197 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7198 elem.offsetWidth === 0 ? 7199 swap( elem, cssShow, function() { 7200 return getWidthOrHeight( elem, name, extra ); 7201 } ) : 7202 getWidthOrHeight( elem, name, extra ); 7203 } 7204 }, 7205 7206 set: function( elem, value, extra ) { 7207 var styles = extra && getStyles( elem ); 7208 return setPositiveNumber( elem, value, extra ? 7209 augmentWidthOrHeight( 7210 elem, 7211 name, 7212 extra, 7213 support.boxSizing && 7214 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7215 styles 7216 ) : 0 7217 ); 7218 } 7219 }; 7220} ); 7221 7222if ( !support.opacity ) { 7223 jQuery.cssHooks.opacity = { 7224 get: function( elem, computed ) { 7225 7226 // IE uses filters for opacity 7227 return ropacity.test( ( computed && elem.currentStyle ? 7228 elem.currentStyle.filter : 7229 elem.style.filter ) || "" ) ? 7230 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : 7231 computed ? "1" : ""; 7232 }, 7233 7234 set: function( elem, value ) { 7235 var style = elem.style, 7236 currentStyle = elem.currentStyle, 7237 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", 7238 filter = currentStyle && currentStyle.filter || style.filter || ""; 7239 7240 // IE has trouble with opacity if it does not have layout 7241 // Force it by setting the zoom level 7242 style.zoom = 1; 7243 7244 // if setting opacity to 1, and no other filters exist - 7245 // attempt to remove filter attribute #6652 7246 // if value === "", then remove inline opacity #12685 7247 if ( ( value >= 1 || value === "" ) && 7248 jQuery.trim( filter.replace( ralpha, "" ) ) === "" && 7249 style.removeAttribute ) { 7250 7251 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 7252 // if "filter:" is present at all, clearType is disabled, we want to avoid this 7253 // style.removeAttribute is IE Only, but so apparently is this code path... 7254 style.removeAttribute( "filter" ); 7255 7256 // if there is no filter style applied in a css rule 7257 // or unset inline opacity, we are done 7258 if ( value === "" || currentStyle && !currentStyle.filter ) { 7259 return; 7260 } 7261 } 7262 7263 // otherwise, set new filter values 7264 style.filter = ralpha.test( filter ) ? 7265 filter.replace( ralpha, opacity ) : 7266 filter + " " + opacity; 7267 } 7268 }; 7269} 7270 7271jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 7272 function( elem, computed ) { 7273 if ( computed ) { 7274 return swap( elem, { "display": "inline-block" }, 7275 curCSS, [ elem, "marginRight" ] ); 7276 } 7277 } 7278); 7279 7280jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7281 function( elem, computed ) { 7282 if ( computed ) { 7283 return ( 7284 parseFloat( curCSS( elem, "marginLeft" ) ) || 7285
vendor: 4,625 bytes, lines 7286-7464
7286 // Support: IE<=11+ 7287 // Running getBoundingClientRect on a disconnected node in IE throws an error 7288 // Support: IE8 only 7289 // getClientRects() errors on disconnected elems 7290 ( jQuery.contains( elem.ownerDocument, elem ) ? 7291 elem.getBoundingClientRect().left - 7292 swap( elem, { marginLeft: 0 }, function() { 7293 return elem.getBoundingClientRect().left; 7294 } ) : 7295 0 7296 ) 7297 ) + "px"; 7298 } 7299 } 7300); 7301 7302// These hooks are used by animate to expand properties 7303jQuery.each( { 7304 margin: "", 7305 padding: "", 7306 border: "Width" 7307}, function( prefix, suffix ) { 7308 jQuery.cssHooks[ prefix + suffix ] = { 7309 expand: function( value ) { 7310 var i = 0, 7311 expanded = {}, 7312 7313 // assumes a single number if not a string 7314 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7315 7316 for ( ; i < 4; i++ ) { 7317 expanded[ prefix + cssExpand[ i ] + suffix ] = 7318 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7319 } 7320 7321 return expanded; 7322 } 7323 }; 7324 7325 if ( !rmargin.test( prefix ) ) { 7326 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7327 } 7328} ); 7329 7330jQuery.fn.extend( { 7331 css: function( name, value ) { 7332 return access( this, function( elem, name, value ) { 7333 var styles, len, 7334 map = {}, 7335 i = 0; 7336 7337 if ( jQuery.isArray( name ) ) { 7338 styles = getStyles( elem ); 7339 len = name.length; 7340 7341 for ( ; i < len; i++ ) { 7342 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7343 } 7344 7345 return map; 7346 } 7347 7348 return value !== undefined ? 7349 jQuery.style( elem, name, value ) : 7350 jQuery.css( elem, name ); 7351 }, name, value, arguments.length > 1 ); 7352 }, 7353 show: function() { 7354 return showHide( this, true ); 7355 }, 7356 hide: function() { 7357 return showHide( this ); 7358 }, 7359 toggle: function( state ) { 7360 if ( typeof state === "boolean" ) { 7361 return state ? this.show() : this.hide(); 7362 } 7363 7364 return this.each( function() { 7365 if ( isHidden( this ) ) { 7366 jQuery( this ).show(); 7367 } else { 7368 jQuery( this ).hide(); 7369 } 7370 } ); 7371 } 7372} ); 7373 7374 7375function Tween( elem, options, prop, end, easing ) { 7376 return new Tween.prototype.init( elem, options, prop, end, easing ); 7377} 7378jQuery.Tween = Tween; 7379 7380Tween.prototype = { 7381 constructor: Tween, 7382 init: function( elem, options, prop, end, easing, unit ) { 7383 this.elem = elem; 7384 this.prop = prop; 7385 this.easing = easing || jQuery.easing._default; 7386 this.options = options; 7387 this.start = this.now = this.cur(); 7388 this.end = end; 7389 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7390 }, 7391 cur: function() { 7392 var hooks = Tween.propHooks[ this.prop ]; 7393 7394 return hooks && hooks.get ? 7395 hooks.get( this ) : 7396 Tween.propHooks._default.get( this ); 7397 }, 7398 run: function( percent ) { 7399 var eased, 7400 hooks = Tween.propHooks[ this.prop ]; 7401 7402 if ( this.options.duration ) { 7403 this.pos = eased = jQuery.easing[ this.easing ]( 7404 percent, this.options.duration * percent, 0, 1, this.options.duration 7405 ); 7406 } else { 7407 this.pos = eased = percent; 7408 } 7409 this.now = ( this.end - this.start ) * eased + this.start; 7410 7411 if ( this.options.step ) { 7412 this.options.step.call( this.elem, this.now, this ); 7413 } 7414 7415 if ( hooks && hooks.set ) { 7416 hooks.set( this ); 7417 } else { 7418 Tween.propHooks._default.set( this ); 7419 } 7420 return this; 7421 } 7422}; 7423 7424Tween.prototype.init.prototype = Tween.prototype; 7425 7426Tween.propHooks = { 7427 _default: { 7428 get: function( tween ) { 7429 var result; 7430 7431 // Use a property on the element directly when it is not a DOM element, 7432 // or when there is no matching style property that exists. 7433 if ( tween.elem.nodeType !== 1 || 7434 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7435 return tween.elem[ tween.prop ]; 7436 } 7437 7438 // passing an empty string as a 3rd parameter to .css will automatically 7439 // attempt a parseFloat and fallback to a string if the parse fails 7440 // so, simple values such as "10px" are parsed to Float. 7441 // complex values such as "rotate(1rad)" are returned as is. 7442 result = jQuery.css( tween.elem, tween.prop, "" ); 7443 7444 // Empty strings, null, undefined and "auto" are converted to 0. 7445 return !result || result === "auto" ? 0 : result; 7446 }, 7447 set: function( tween ) { 7448 7449 // use step hook for back compat - use cssHook if its there - use .style if its 7450 // available and use plain properties where available 7451 if ( jQuery.fx.step[ tween.prop ] ) { 7452 jQuery.fx.step[ tween.prop ]( tween ); 7453 } else if ( tween.elem.nodeType === 1 && 7454 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 7455 jQuery.cssHooks[ tween.prop ] ) ) { 7456 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7457 } else { 7458 tween.elem[ tween.prop ] = tween.now; 7459 } 7460 } 7461 } 7462}; 7463 7464// Support: IE <=9
7465// Panic based approach to setting things on disconnected nodes 7466 7467Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7468 set: function( tween ) { 7469 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7470 tween.elem[ tween.prop ] = tween.now; 7471 } 7472 } 7473}; 7474 7475jQuery.easing = { 7476 linear: function( p ) { 7477 return p; 7478 }, 7479 swing: function( p ) { 7480 return 0.5 - Math.cos( p * Math.PI ) / 2; 7481 }, 7482 _default: "swing" 7483}; 7484 7485jQuery.fx = Tween.prototype.init; 7486 7487// Back Compat <1.8 extension point 7488jQuery.fx.step = {}; 7489 7490 7491 7492 7493var 7494 fxNow, timerId, 7495 rfxtypes = /^(?:toggle|show|hide)$/, 7496 rrun = /queueHooks$/; 7497 7498// Animations created synchronously will run synchronously 7499function createFxNow() { 7500 window.setTimeout( function() { 7501 fxNow = undefined; 7502 } ); 7503 return ( fxNow = jQuery.now() ); 7504} 7505 7506// Generate parameters to create a standard animation 7507function genFx( type, includeWidth ) { 7508 var which, 7509 attrs = { height: type }, 7510 i = 0; 7511 7512 // if we include width, step value is 1 to do all cssExpand values, 7513 // if we don't include width, step value is 2 to skip over Left and Right 7514 includeWidth = includeWidth ? 1 : 0; 7515 for ( ; i < 4 ; i += 2 - includeWidth ) { 7516 which = cssExpand[ i ]; 7517 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7518 } 7519 7520 if ( includeWidth ) { 7521 attrs.opacity = attrs.width = type; 7522 } 7523 7524 return attrs; 7525} 7526 7527function createTween( value, prop, animation ) { 7528 var tween, 7529 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7530 index = 0, 7531 length = collection.length; 7532 for ( ; index < length; index++ ) { 7533 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7534 7535 // we're done with this property 7536 return tween; 7537 } 7538 } 7539} 7540 7541function defaultPrefilter( elem, props, opts ) { 7542 /* jshint validthis: true */ 7543 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 7544 anim = this, 7545 orig = {}, 7546 style = elem.style, 7547 hidden = elem.nodeType && isHidden( elem ), 7548 dataShow = jQuery._data( elem, "fxshow" ); 7549 7550 // handle queue: false promises 7551 if ( !opts.queue ) { 7552 hooks = jQuery._queueHooks( elem, "fx" ); 7553 if ( hooks.unqueued == null ) { 7554 hooks.unqueued = 0; 7555 oldfire = hooks.empty.fire; 7556 hooks.empty.fire = function() { 7557 if ( !hooks.unqueued ) { 7558 oldfire(); 7559 } 7560 }; 7561 } 7562 hooks.unqueued++; 7563 7564 anim.always( function() { 7565 7566 // doing this makes sure that the complete handler will be called 7567 // before this completes 7568 anim.always( function() { 7569 hooks.unqueued--; 7570 if ( !jQuery.queue( elem, "fx" ).length ) { 7571 hooks.empty.fire(); 7572 } 7573 } ); 7574 } ); 7575 } 7576 7577 // height/width overflow pass 7578 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { 7579 7580 // Make sure that nothing sneaks out 7581 // Record all 3 overflow attributes because IE does not 7582 // change the overflow attribute when overflowX and 7583 // overflowY are set to the same value 7584 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7585 7586 // Set display property to inline-block for height/width 7587 // animations on inline elements that are having width/height animated 7588 display = jQuery.css( elem, "display" ); 7589 7590 // Test default display if display is currently "none" 7591 checkDisplay = display === "none" ? 7592 jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 7593 7594 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 7595 7596 // inline-level elements accept inline-block; 7597 // block-level elements need to be inline with layout 7598 if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { 7599 style.display = "inline-block"; 7600 } else { 7601 style.zoom = 1; 7602 } 7603 } 7604 } 7605 7606 if ( opts.overflow ) { 7607 style.overflow = "hidden"; 7608 if ( !support.shrinkWrapBlocks() ) { 7609 anim.always( function() { 7610 style.overflow = opts.overflow[ 0 ]; 7611 style.overflowX = opts.overflow[ 1 ]; 7612 style.overflowY = opts.overflow[ 2 ]; 7613 } ); 7614 } 7615 } 7616 7617 // show/hide pass 7618 for ( prop in props ) { 7619 value = props[ prop ]; 7620 if ( rfxtypes.exec( value ) ) { 7621 delete props[ prop ]; 7622 toggle = toggle || value === "toggle"; 7623 if ( value === ( hidden ? "hide" : "show" ) ) { 7624 7625 // If there is dataShow left over from a stopped hide or show 7626 // and we are going to proceed with show, we should pretend to be hidden 7627 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7628 hidden = true; 7629 } else { 7630 continue; 7631 } 7632 } 7633 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7634 7635 // Any non-fx value stops us from restoring the original display value 7636 } else { 7637 display = undefined; 7638 } 7639 } 7640 7641 if ( !jQuery.isEmptyObject( orig ) ) { 7642 if ( dataShow ) { 7643 if ( "hidden" in dataShow ) { 7644 hidden = dataShow.hidden; 7645 } 7646 } else { 7647 dataShow = jQuery._data( elem, "fxshow", {} ); 7648 } 7649 7650 // store state if its toggle - enables .stop().toggle() to "reverse" 7651 if ( toggle ) { 7652 dataShow.hidden = !hidden; 7653 } 7654 if ( hidden ) { 7655 jQuery( elem ).show(); 7656 } else { 7657 anim.done( function() { 7658 jQuery( elem ).hide(); 7659 } ); 7660 } 7661 anim.done( function() { 7662 var prop; 7663 jQuery._removeData( elem, "fxshow" ); 7664 for ( prop in orig ) { 7665 jQuery.style( elem, prop, orig[ prop ] ); 7666 } 7667 } ); 7668 for ( prop in orig ) { 7669 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7670 7671 if ( !( prop in dataShow ) ) { 7672 dataShow[ prop ] = tween.start; 7673 if ( hidden ) { 7674 tween.end = tween.start; 7675 tween.start = prop === "width" || prop === "height" ? 1 : 0; 7676 } 7677 } 7678 } 7679 7680 // If this is a noop like .hide().hide(), restore an overwritten display value 7681 } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : dis
vendor: 10,851 bytes, lines 7681-8113
7681play ) === "inline" ) { 7682 style.display = display; 7683 } 7684} 7685 7686function propFilter( props, specialEasing ) { 7687 var index, name, easing, value, hooks; 7688 7689 // camelCase, specialEasing and expand cssHook pass 7690 for ( index in props ) { 7691 name = jQuery.camelCase( index ); 7692 easing = specialEasing[ name ]; 7693 value = props[ index ]; 7694 if ( jQuery.isArray( value ) ) { 7695 easing = value[ 1 ]; 7696 value = props[ index ] = value[ 0 ]; 7697 } 7698 7699 if ( index !== name ) { 7700 props[ name ] = value; 7701 delete props[ index ]; 7702 } 7703 7704 hooks = jQuery.cssHooks[ name ]; 7705 if ( hooks && "expand" in hooks ) { 7706 value = hooks.expand( value ); 7707 delete props[ name ]; 7708 7709 // not quite $.extend, this wont overwrite keys already present. 7710 // also - reusing 'index' from above because we have the correct "name" 7711 for ( index in value ) { 7712 if ( !( index in props ) ) { 7713 props[ index ] = value[ index ]; 7714 specialEasing[ index ] = easing; 7715 } 7716 } 7717 } else { 7718 specialEasing[ name ] = easing; 7719 } 7720 } 7721} 7722 7723function Animation( elem, properties, options ) { 7724 var result, 7725 stopped, 7726 index = 0, 7727 length = Animation.prefilters.length, 7728 deferred = jQuery.Deferred().always( function() { 7729 7730 // don't match elem in the :animated selector 7731 delete tick.elem; 7732 } ), 7733 tick = function() { 7734 if ( stopped ) { 7735 return false; 7736 } 7737 var currentTime = fxNow || createFxNow(), 7738 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7739 7740 // Support: Android 2.3 7741 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7742 temp = remaining / animation.duration || 0, 7743 percent = 1 - temp, 7744 index = 0, 7745 length = animation.tweens.length; 7746 7747 for ( ; index < length ; index++ ) { 7748 animation.tweens[ index ].run( percent ); 7749 } 7750 7751 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7752 7753 if ( percent < 1 && length ) { 7754 return remaining; 7755 } else { 7756 deferred.resolveWith( elem, [ animation ] ); 7757 return false; 7758 } 7759 }, 7760 animation = deferred.promise( { 7761 elem: elem, 7762 props: jQuery.extend( {}, properties ), 7763 opts: jQuery.extend( true, { 7764 specialEasing: {}, 7765 easing: jQuery.easing._default 7766 }, options ), 7767 originalProperties: properties, 7768 originalOptions: options, 7769 startTime: fxNow || createFxNow(), 7770 duration: options.duration, 7771 tweens: [], 7772 createTween: function( prop, end ) { 7773 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7774 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7775 animation.tweens.push( tween ); 7776 return tween; 7777 }, 7778 stop: function( gotoEnd ) { 7779 var index = 0, 7780 7781 // if we are going to the end, we want to run all the tweens 7782 // otherwise we skip this part 7783 length = gotoEnd ? animation.tweens.length : 0; 7784 if ( stopped ) { 7785 return this; 7786 } 7787 stopped = true; 7788 for ( ; index < length ; index++ ) { 7789 animation.tweens[ index ].run( 1 ); 7790 } 7791 7792 // resolve when we played the last frame 7793 // otherwise, reject 7794 if ( gotoEnd ) { 7795 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7796 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7797 } else { 7798 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7799 } 7800 return this; 7801 } 7802 } ), 7803 props = animation.props; 7804 7805 propFilter( props, animation.opts.specialEasing ); 7806 7807 for ( ; index < length ; index++ ) { 7808 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7809 if ( result ) { 7810 if ( jQuery.isFunction( result.stop ) ) { 7811 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7812 jQuery.proxy( result.stop, result ); 7813 } 7814 return result; 7815 } 7816 } 7817 7818 jQuery.map( props, createTween, animation ); 7819 7820 if ( jQuery.isFunction( animation.opts.start ) ) { 7821 animation.opts.start.call( elem, animation ); 7822 } 7823 7824 jQuery.fx.timer( 7825 jQuery.extend( tick, { 7826 elem: elem, 7827 anim: animation, 7828 queue: animation.opts.queue 7829 } ) 7830 ); 7831 7832 // attach callbacks from options 7833 return animation.progress( animation.opts.progress ) 7834 .done( animation.opts.done, animation.opts.complete ) 7835 .fail( animation.opts.fail ) 7836 .always( animation.opts.always ); 7837} 7838 7839jQuery.Animation = jQuery.extend( Animation, { 7840 7841 tweeners: { 7842 "*": [ function( prop, value ) { 7843 var tween = this.createTween( prop, value ); 7844 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7845 return tween; 7846 } ] 7847 }, 7848 7849 tweener: function( props, callback ) { 7850 if ( jQuery.isFunction( props ) ) { 7851 callback = props; 7852 props = [ "*" ]; 7853 } else { 7854 props = props.match( rnotwhite ); 7855 } 7856 7857 var prop, 7858 index = 0, 7859 length = props.length; 7860 7861 for ( ; index < length ; index++ ) { 7862 prop = props[ index ]; 7863 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7864 Animation.tweeners[ prop ].unshift( callback ); 7865 } 7866 }, 7867 7868 prefilters: [ defaultPrefilter ], 7869 7870 prefilter: function( callback, prepend ) { 7871 if ( prepend ) { 7872 Animation.prefilters.unshift( callback ); 7873 } else { 7874 Animation.prefilters.push( callback ); 7875 } 7876 } 7877} ); 7878 7879jQuery.speed = function( speed, easing, fn ) { 7880 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7881 complete: fn || !fn && easing || 7882 jQuery.isFunction( speed ) && speed, 7883 duration: speed, 7884 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 7885 }; 7886 7887 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 7888 opt.duration in jQuery.fx.speeds ? 7889 jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 7890 7891 // normalize opt.queue - true/undefined/null -> "fx" 7892 if ( opt.queue == null || opt.queue === true ) { 7893 opt.queue = "fx"; 7894 } 7895 7896 // Queueing 7897 opt.old = opt.complete; 7898 7899 opt.complete = function() { 7900 if ( jQuery.isFunction( opt.old ) ) { 7901 opt.old.call( this ); 7902 } 7903 7904 if ( opt.queue ) { 7905 jQuery.dequeue( this, opt.queue ); 7906 } 7907 }; 7908 7909 return opt; 7910}; 7911 7912jQuery.fn.extend( { 7913 fadeTo: function( speed, to, easing, callback ) { 7914 7915 // show any hidden elements after setting opacity to 0 7916 return this.filter( isHidden ).css( "opacity", 0 ).show() 7917 7918 // animate to the value specified 7919 .end().animate( { opacity: to }, speed, easing, callback ); 7920 }, 7921 animate: function( prop, speed, easing, callback ) { 7922 var empty = jQuery.isEmptyObject( prop ), 7923 optall = jQuery.speed( speed, easing, callback ), 7924 doAnimation = function() { 7925 7926 // Operate on a copy of prop so per-property easing won't be lost 7927 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7928 7929 // Empty animations, or finishing resolves immediately 7930 if ( empty || jQuery._data( this, "finish" ) ) { 7931 anim.stop( true ); 7932 } 7933 }; 7934 doAnimation.finish = doAnimation; 7935 7936 return empty || optall.queue === false ? 7937 this.each( doAnimation ) : 7938 this.queue( optall.queue, doAnimation ); 7939 }, 7940 stop: function( type, clearQueue, gotoEnd ) { 7941 var stopQueue = function( hooks ) { 7942 var stop = hooks.stop; 7943 delete hooks.stop; 7944 stop( gotoEnd ); 7945 }; 7946 7947 if ( typeof type !== "string" ) { 7948 gotoEnd = clearQueue; 7949 clearQueue = type; 7950 type = undefined; 7951 } 7952 if ( clearQueue && type !== false ) { 7953 this.queue( type || "fx", [] ); 7954 } 7955 7956 return this.each( function() { 7957 var dequeue = true, 7958 index = type != null && type + "queueHooks", 7959 timers = jQuery.timers, 7960 data = jQuery._data( this ); 7961 7962 if ( index ) { 7963 if ( data[ index ] && data[ index ].stop ) { 7964 stopQueue( data[ index ] ); 7965 } 7966 } else { 7967 for ( index in data ) { 7968 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7969 stopQueue( data[ index ] ); 7970 } 7971 } 7972 } 7973 7974 for ( index = timers.length; index--; ) { 7975 if ( timers[ index ].elem === this && 7976 ( type == null || timers[ index ].queue === type ) ) { 7977 7978 timers[ index ].anim.stop( gotoEnd ); 7979 dequeue = false; 7980 timers.splice( index, 1 ); 7981 } 7982 } 7983 7984 // start the next in the queue if the last step wasn't forced 7985 // timers currently will call their complete callbacks, which will dequeue 7986 // but only if they were gotoEnd 7987 if ( dequeue || !gotoEnd ) { 7988 jQuery.dequeue( this, type ); 7989 } 7990 } ); 7991 }, 7992 finish: function( type ) { 7993 if ( type !== false ) { 7994 type = type || "fx"; 7995 } 7996 return this.each( function() { 7997 var index, 7998 data = jQuery._data( this ), 7999 queue = data[ type + "queue" ], 8000 hooks = data[ type + "queueHooks" ], 8001 timers = jQuery.timers, 8002 length = queue ? queue.length : 0; 8003 8004 // enable finishing flag on private data 8005 data.finish = true; 8006 8007 // empty the queue first 8008 jQuery.queue( this, type, [] ); 8009 8010 if ( hooks && hooks.stop ) { 8011 hooks.stop.call( this, true ); 8012 } 8013 8014 // look for any active animations, and finish them 8015 for ( index = timers.length; index--; ) { 8016 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 8017 timers[ index ].anim.stop( true ); 8018 timers.splice( index, 1 ); 8019 } 8020 } 8021 8022 // look for any animations in the old queue and finish them 8023 for ( index = 0; index < length; index++ ) { 8024 if ( queue[ index ] && queue[ index ].finish ) { 8025 queue[ index ].finish.call( this ); 8026 } 8027 } 8028 8029 // turn off finishing flag 8030 delete data.finish; 8031 } ); 8032 } 8033} ); 8034 8035jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 8036 var cssFn = jQuery.fn[ name ]; 8037 jQuery.fn[ name ] = function( speed, easing, callback ) { 8038 return speed == null || typeof speed === "boolean" ? 8039 cssFn.apply( this, arguments ) : 8040 this.animate( genFx( name, true ), speed, easing, callback ); 8041 }; 8042} ); 8043 8044// Generate shortcuts for custom animations 8045jQuery.each( { 8046 slideDown: genFx( "show" ), 8047 slideUp: genFx( "hide" ), 8048 slideToggle: genFx( "toggle" ), 8049 fadeIn: { opacity: "show" }, 8050 fadeOut: { opacity: "hide" }, 8051 fadeToggle: { opacity: "toggle" } 8052}, function( name, props ) { 8053 jQuery.fn[ name ] = function( speed, easing, callback ) { 8054 return this.animate( props, speed, easing, callback ); 8055 }; 8056} ); 8057 8058jQuery.timers = []; 8059jQuery.fx.tick = function() { 8060 var timer, 8061 timers = jQuery.timers, 8062 i = 0; 8063 8064 fxNow = jQuery.now(); 8065 8066 for ( ; i < timers.length; i++ ) { 8067 timer = timers[ i ]; 8068 8069 // Checks the timer has not already been removed 8070 if ( !timer() && timers[ i ] === timer ) { 8071 timers.splice( i--, 1 ); 8072 } 8073 } 8074 8075 if ( !timers.length ) { 8076 jQuery.fx.stop(); 8077 } 8078 fxNow = undefined; 8079}; 8080 8081jQuery.fx.timer = function( timer ) { 8082 jQuery.timers.push( timer ); 8083 if ( timer() ) { 8084 jQuery.fx.start(); 8085 } else { 8086 jQuery.timers.pop(); 8087 } 8088}; 8089 8090jQuery.fx.interval = 13; 8091 8092jQuery.fx.start = function() { 8093 if ( !timerId ) { 8094 timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); 8095 } 8096}; 8097 8098jQuery.fx.stop = function() { 8099 window.clearInterval( timerId ); 8100 timerId = null; 8101}; 8102 8103jQuery.fx.speeds = { 8104 slow: 600, 8105 fast: 200, 8106 8107 // Default speed 8108 _default: 400 8109}; 8110 8111 8112// Based off of the plugin by Clint Helfers, with permission. 8113// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
8114jQuery.fn.delay = function( time, type ) { 8115 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 8116 type = type || "fx"; 8117 8118 return this.queue( type, function( next, hooks ) { 8119 var timeout = window.setTimeout( next, time ); 8120 hooks.stop = function() { 8121 window.clearTimeout( timeout ); 8122 }; 8123 } ); 8124}; 8125 8126 8127( function() { 8128 var a, 8129 input = document.createElement( "input" ), 8130 div = document.createElement( "div" ), 8131 select = document.createElement( "select" ), 8132 opt = select.appendChild( document.createElement( "option" ) ); 8133 8134 // Setup 8135 div = document.createElement( "div" ); 8136 div.setAttribute( "className", "t" ); 8137 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 8138 a = div.getElementsByTagName( "a" )[ 0 ]; 8139 8140 // Support: Windows Web Apps (WWA) 8141 // `type` must use .setAttribute for WWA (#14901) 8142 input.setAttribute( "type", "checkbox" ); 8143 div.appendChild( input ); 8144 8145 a = div.getElementsByTagName( "a" )[ 0 ]; 8146 8147 // First batch of tests. 8148 a.style.cssText = "top:1px"; 8149 8150 // Test setAttribute on camelCase class. 8151 // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
8152 support.getSetAttribute = div.className !== "t"; 8153 8154 // Get the style information from getAttribute 8155 // (IE uses .cssText instead) 8156 support.style = /top/.test( a.getAttribute( "style" ) ); 8157 8158 // Make sure that URLs aren't manipulated 8159 // (IE normalizes it by default) 8160 support.hrefNormalized = a.getAttribute( "href" ) === "/a"; 8161 8162 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) 8163 support.checkOn = !!input.value; 8164 8165 // Make sure that a selected-by-default option has a working selected property. 8166 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 8167 support.optSelected = opt.selected; 8168 8169 // Tests for enctype support on a form (#6743) 8170 support.enctype = !!document.createElement( "form" ).enctype; 8171 8172 // Make sure that the options inside disabled selects aren't marked as disabled 8173 // (WebKit marks them as disabled) 8174 select.disabled = true; 8175 support.optDisabled = !opt.disabled; 8176 8177 // Support: IE8 only 8178 // Check if we can trust getAttribute("value") 8179 input = document.createElement( "input" ); 8180 input.setAttribute( "value", "" ); 8181 support.input = input.getAttribute( "value" ) === ""; 8182 8183 // Check if an input maintains its value after becoming a radio 8184 input.value = "t"; 8185 input.setAttribute( "type", "radio" ); 8186 support.radioValue = input.value === "t"; 8187} )(); 8188 8189 8190var rreturn = /\r/g, 8191 rspaces = /[\x20\t\r\n\f]+/g; 8192 8193jQuery.fn.extend( { 8194 val: function( value ) { 8195 var hooks, ret, isFunction, 8196 elem = this[ 0 ]; 8197 8198 if ( !arguments.length ) { 8199 if ( elem ) { 8200 hooks = jQuery.valHooks[ elem.type ] || 8201 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8202 8203 if ( 8204 hooks && 8205 "get" in hooks && 8206 ( ret = hooks.get( elem, "value" ) ) !== undefined 8207 ) { 8208 return ret; 8209 } 8210 8211 ret = elem.value; 8212 8213 return typeof ret === "string" ? 8214 8215 // handle most common string cases 8216 ret.replace( rreturn, "" ) : 8217 8218 // handle cases where value is null/undef or number 8219 ret == null ? "" : ret; 8220 } 8221 8222 return; 8223 } 8224 8225 isFunction = jQuery.isFunction( value ); 8226 8227 return this.each( function( i ) { 8228 var val; 8229 8230 if ( this.nodeType !== 1 ) { 8231 return; 8232 } 8233 8234 if ( isFunction ) { 8235 val = value.call( this, i, jQuery( this ).val() ); 8236 } else { 8237 val = value; 8238 } 8239 8240 // Treat null/undefined as ""; convert numbers to string 8241 if ( val == null ) { 8242 val = ""; 8243 } else if ( typeof val === "number" ) { 8244 val += ""; 8245 } else if ( jQuery.isArray( val ) ) { 8246 val = jQuery.map( val, function( value ) { 8247 return value == null ? "" : value + ""; 8248 } ); 8249 } 8250 8251 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8252 8253 // If set returns undefined, fall back to normal setting
8254 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8255 this.value = val; 8256 } 8257 } ); 8258 } 8259} ); 8260 8261jQuery.extend( { 8262 valHooks: { 8263 option: { 8264 get: function( elem ) { 8265 var val = jQuery.find.attr( elem, "value" ); 8266 return val != null ? 8267 val : 8268 8269 // Support: IE10-11+ 8270 // option.text throws exceptions (#14686, #14858) 8271 // Strip and collapse whitespace 8272 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8273 jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); 8274 } 8275 }, 8276 select: { 8277 get: function( elem ) { 8278 var value, option, 8279 options = elem.options, 8280 index = elem.selectedIndex, 8281 one = elem.type === "select-one" || index < 0, 8282 values = one ? null : [], 8283 max = one ? index + 1 : options.length, 8284 i = index < 0 ? 8285 max : 8286 one ? index : 0; 8287 8288 // Loop through all the selected options 8289 for ( ; i < max; i++ ) { 8290 option = options[ i ]; 8291 8292 // oldIE doesn't update selected after form reset (#2551) 8293 if ( ( option.selected || i === index ) && 8294 8295 // Don't return options that are disabled or in a disabled optgroup 8296 ( support.optDisabled ? 8297 !option.disabled : 8298 option.getAttribute( "disabled" ) === null ) && 8299 ( !option.parentNode.disabled || 8300 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { 8301 8302 // Get the specific value for the option 8303 value = jQuery( option ).val(); 8304 8305 // We don't need an array for one selects 8306 if ( one ) { 8307 return value; 8308 } 8309 8310 // Multi-Selects return an array 8311 values.push( value ); 8312 } 8313 } 8314 8315 return values; 8316 }, 8317 8318 set: function( elem, value ) { 8319 var optionSet, option, 8320 options = elem.options, 8321 values = jQuery.makeArray( value ), 8322 i = options.length; 8323 8324 while ( i-- ) { 8325 option = options[ i ]; 8326 8327 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { 8328 8329 // Support: IE6 8330 // When new option element is added to select box we need to 8331 // force reflow of newly added node in order to workaround delay 8332 // of initialization properties 8333 try { 8334 option.selected = optionSet = true; 8335 8336 } catch ( _ ) { 8337 8338 // Will be executed only in IE6 8339 option.scrollHeight; 8340 } 8341 8342 } else { 8343 option.selected = false; 8344 } 8345 } 8346 8347 // Force browsers to behave consistently when non-matching value is set 8348 if ( !optionSet ) { 8349 elem.selectedIndex = -1; 8350 } 8351 8352 return options; 8353 } 8354 } 8355 } 8356} ); 8357 8358// Radios and checkboxes getter/setter 8359jQuery.each( [ "radio", "checkbox" ], function() { 8360 jQuery.valHooks[ this ] = { 8361 set: function( elem, value ) { 8362 if ( jQuery.isArray( value ) ) { 8363 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8364 } 8365 } 8366 }; 8367 if ( !support.checkOn ) { 8368 jQuery.valHooks[ this ].get = function( elem ) { 8369 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8370 }; 8371 } 8372} ); 8373 8374 8375 8376 8377var nodeHook, boolHook, 8378 attrHandle = jQuery.expr.attrHandle, 8379 ruseDefault = /^(?:checked|selected)$/i, 8380 getSetAttribute = support.getSetAttribute, 8381 getSetInput = support.input; 8382 8383jQuery.fn.extend( { 8384 attr: function( name, value ) { 8385 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 8386 }, 8387 8388 removeAttr: function( name ) { 8389 return this.each( function() { 8390 jQuery.removeAttr( this, name ); 8391 } ); 8392 } 8393} ); 8394 8395jQuery.extend( { 8396 attr: function( elem, name, value ) { 8397 var ret, hooks, 8398 nType = elem.nodeType; 8399 8400 // Don't get/set attributes on text, comment and attribute nodes 8401 if ( nType === 3 || nType === 8 || nType === 2 ) { 8402 return; 8403 } 8404 8405 // Fallback to prop when attributes are not supported 8406 if ( typeof elem.getAttribute === "undefined" ) { 8407 return jQuery.prop( elem, name, value ); 8408 } 8409 8410 // All attributes are lowercase 8411 // Grab necessary hook if one is defined 8412 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8413 name = name.toLowerCase(); 8414 hooks = jQuery.attrHooks[ name ] || 8415 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); 8416 } 8417 8418 if ( value !== undefined ) { 8419 if ( value === null ) { 8420 jQuery.removeAttr( elem, name ); 8421 return; 8422 } 8423 8424 if ( hooks && "set" in hooks && 8425 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8426 return ret; 8427 } 8428 8429 elem.setAttribute( name, value + "" ); 8430 return value; 8431 } 8432 8433 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8434 return ret; 8435 } 8436 8437 ret = jQuery.find.attr( elem, name ); 8438 8439 // Non-existent attributes return null, we normalize to undefined 8440 return ret == null ? undefined : ret; 8441 }, 8442 8443 attrHooks: { 8444 type: {
8445 set: function( elem, value ) { 8446 if ( !support.radioValue && value === "radio" && 8447 jQuery.nodeName( elem, "input" ) ) { 8448 8449 // Setting the type on a radio button after the value resets the value in IE8-9 8450 // Reset value to default in case type is set after value during creation 8451 var val = elem.value; 8452 elem.setAttribute( "type", value ); 8453 if ( val ) { 8454 elem.value = val; 8455 } 8456 return value; 8457 } 8458 } 8459 } 8460 }, 8461 8462 removeAttr: function( elem, value ) { 8463 var name, propName, 8464 i = 0, 8465 attrNames = value && value.match( rnotwhite ); 8466 8467 if ( attrNames && elem.nodeType === 1 ) { 8468 while ( ( name = attrNames[ i++ ] ) ) { 8469 propName = jQuery.propFix[ name ] || name; 8470 8471 // Boolean attributes get special treatment (#10870) 8472 if ( jQuery.expr.match.bool.test( name ) ) { 8473 8474 // Set corresponding property to false 8475 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8476 elem[ propName ] = false; 8477 8478 // Support: IE<9 8479 // Also clear defaultChecked/defaultSelected (if appropriate) 8480 } else { 8481 elem[ jQuery.camelCase( "default-" + name ) ] = 8482 elem[ propName ] = false; 8483 } 8484 8485 // See #9699 for explanation of this approach (setting first, then removal) 8486 } else { 8487 jQuery.attr( elem, name, "" ); 8488 } 8489 8490 elem.removeAttribute( getSetAttribute ? name : propName ); 8491 } 8492 } 8493 } 8494} ); 8495 8496// Hooks for boolean attributes 8497boolHook = { 8498 set: function( elem, value, name ) { 8499 if ( value === false ) { 8500 8501 // Remove boolean attributes when set to false 8502 jQuery.removeAttr( elem, name ); 8503 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8504 8505 // IE<8 needs the *property* name 8506 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); 8507 8508 } else { 8509 8510 // Support: IE<9 8511 // Use defaultChecked and defaultSelected for oldIE 8512 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; 8513 } 8514 return name; 8515 } 8516}; 8517 8518jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 8519 var getter = attrHandle[ name ] || jQuery.find.attr; 8520 8521 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8522 attrHandle[ name ] = function( elem, name, isXML ) { 8523 var ret, handle; 8524 if ( !isXML ) { 8525 8526 // Avoid an infinite loop by temporarily removing this function from the getter 8527 handle = attrHandle[ name ]; 8528 attrHandle[ name ] = ret; 8529 ret = getter( elem, name, isXML ) != null ? 8530 name.toLowerCase() : 8531 null; 8532 attrHandle[ name ] = handle; 8533 } 8534 return ret; 8535 }; 8536 } else { 8537 attrHandle[ name ] = function( elem, name, isXML ) { 8538 if ( !isXML ) { 8539 return elem[ jQuery.camelCase( "default-" + name ) ] ? 8540 name.toLowerCase() : 8541 null; 8542 } 8543 }; 8544 } 8545} ); 8546 8547// fix oldIE attroperties 8548if ( !getSetInput || !getSetAttribute ) { 8549 jQuery.attrHooks.value = { 8550 set: function( elem, value, name ) { 8551 if ( jQuery.nodeName( elem, "input" ) ) { 8552 8553 // Does not return so that setAttribute is also used 8554 elem.defaultValue = value; 8555 } else { 8556 8557 // Use nodeHook if defined (#1954); otherwise setAttribute is fine 8558 return nodeHook && nodeHook.set( elem, value, name ); 8559 } 8560 } 8561 }; 8562} 8563 8564// IE6/7 do not support getting/setting some attributes with get/setAttribute 8565if ( !getSetAttribute ) { 8566 8567 // Use this for any attribute in IE6/7 8568 // This fixes almost every IE6/7 issue 8569 nodeHook = { 8570 set: function( elem, value, name ) { 8571 8572 // Set the existing or create a new attribute node 8573 var ret = elem.getAttributeNode( name ); 8574 if ( !ret ) { 8575 elem.setAttributeNode( 8576 ( ret = elem.ownerDocument.createAttribute( name ) ) 8577 ); 8578 } 8579 8580 ret.value = value += ""; 8581 8582 // Break association with cloned elements by also using setAttribute (#9646) 8583 if ( name === "value" || value === elem.getAttribute( name ) ) { 8584 return value; 8585 } 8586 } 8587 }; 8588 8589 // Some attributes are constructed with empty-string values when not defined 8590 attrHandle.id = attrHandle.name = attrHandle.coords = 8591 function( elem, name, isXML ) { 8592 var ret; 8593 if ( !isXML ) { 8594 return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ? 8595 ret.value : 8596 null; 8597 } 8598 }; 8599 8600 // Fixing value retrieval on a button requires this module 8601 jQuery.valHooks.button = { 8602 get: function( elem, name ) { 8603 var ret = elem.getAttributeNode( name ); 8604 if ( ret && ret.specified ) { 8605 return ret.value; 8606 } 8607 }, 8608 set: nodeHook.set 8609 }; 8610 8611 // Set contenteditable to false on removals(#10429)
8612 // Setting to empty string throws an error as an invalid value 8613 jQuery.attrHooks.contenteditable = { 8614 set: function( elem, value, name ) { 8615 nodeHook.set( elem, value === "" ? false : value, name ); 8616 } 8617 }; 8618 8619 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 8620 // This is for removals 8621 jQuery.each( [ "width", "height" ], function( i, name ) { 8622 jQuery.attrHooks[ name ] = { 8623 set: function( elem, value ) { 8624 if ( value === "" ) { 8625 elem.setAttribute( name, "auto" ); 8626 return value; 8627 } 8628 } 8629 }; 8630 } ); 8631} 8632 8633if ( !support.style ) { 8634 jQuery.attrHooks.style = { 8635 get: function( elem ) { 8636 8637 // Return undefined in the case of empty string 8638 // Note: IE uppercases css property names, but if we were to .toLowerCase() 8639 // .cssText, that would destroy case sensitivity in URL's, like in "background" 8640 return elem.style.cssText || undefined; 8641 }, 8642 set: function( elem, value ) { 8643 return ( elem.style.cssText = value + "" ); 8644 } 8645 }; 8646} 8647 8648 8649 8650 8651var rfocusable = /^(?:input|select|textarea|button|object)$/i, 8652 rclickable = /^(?:a|area)$/i; 8653 8654jQuery.fn.extend( { 8655 prop: function( name, value ) { 8656 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8657 }, 8658 8659 removeProp: function( name ) { 8660 name = jQuery.propFix[ name ] || name; 8661 return this.each( function() { 8662 8663 // try/catch handles cases where IE balks (such as removing a property on window) 8664 try { 8665 this[ name ] = undefined; 8666 delete this[ name ]; 8667 } catch ( e ) {} 8668 } ); 8669 } 8670} ); 8671 8672jQuery.extend( { 8673 prop: function( elem, name, value ) { 8674 var ret, hooks, 8675 nType = elem.nodeType; 8676 8677 // Don't get/set properties on text, comment and attribute nodes 8678 if ( nType === 3 || nType === 8 || nType === 2 ) { 8679 return; 8680 } 8681 8682 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8683 8684 // Fix name and attach hooks 8685 name = jQuery.propFix[ name ] || name; 8686 hooks = jQuery.propHooks[ name ]; 8687 } 8688 8689 if ( value !== undefined ) { 8690 if ( hooks && "set" in hooks && 8691 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8692 return ret; 8693 } 8694 8695 return ( elem[ name ] = value ); 8696 } 8697 8698 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8699 return ret; 8700 } 8701 8702 return elem[ name ]; 8703 }, 8704 8705 propHooks: { 8706 tabIndex: { 8707 get: function( elem ) { 8708 8709 // elem.tabIndex doesn't always return the 8710 // correct value when it hasn't been explicitly set 8711 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8712 // Use proper attribute retrieval(#12072) 8713 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8714 8715 return tabindex ? 8716 parseInt( tabindex, 10 ) : 8717 rfocusable.test( elem.nodeName ) || 8718 rclickable.test( elem.nodeName ) && elem.href ? 8719 0 : 8720 -1; 8721 } 8722 } 8723 }, 8724 8725 propFix: { 8726 "for": "htmlFor", 8727 "class": "className" 8728 } 8729} ); 8730 8731// Some attributes require a special call on IE 8732// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 8733if ( !support.hrefNormalized ) { 8734 8735 // href/src property should get the full normalized URL (#10299/#12915) 8736 jQuery.each( [ "href", "src" ], function( i, name ) { 8737 jQuery.propHooks[ name ] = { 8738 get: function( elem ) { 8739 return elem.getAttribute( name, 4 ); 8740 } 8741 }; 8742 } ); 8743} 8744 8745// Support: Safari, IE9+ 8746// Accessing the selectedIndex property 8747// forces the browser to respect setting selected 8748// on the option 8749// The getter ensures a default option is selected 8750// when in an optgroup 8751if ( !support.optSelected ) { 8752 jQuery.propHooks.selected = { 8753 get: function( elem ) { 8754 var parent = elem.parentNode; 8755 8756 if ( parent ) { 8757 parent.selectedIndex; 8758 8759 // Make sure that it also works with optgroups, see #5701 8760 if ( parent.parentNode ) { 8761 parent.parentNode.selectedIndex; 8762 } 8763 } 8764 return null; 8765 }, 8766 set: function( elem ) { 8767 var parent = elem.parentNode; 8768 if ( parent ) { 8769 parent.selectedIndex; 8770 8771 if ( parent.parentNode ) { 8772 parent.parentNode.selectedIndex; 8773 } 8774 } 8775 } 8776 }; 8777} 8778 8779jQuery.each( [ 8780 "tabIndex", 8781 "readOnly", 8782 "maxLength", 8783 "cellSpacing", 8784 "cellPadding", 8785 "rowSpan", 8786 "colSpan", 8787 "useMap", 8788 "frameBorder", 8789 "contentEditable" 8790], function() { 8791 jQuery.propFix[ this.toLowerCase() ] = this; 8792} ); 8793 8794// IE6/7 call enctype encoding 8795if ( !support.enctype ) { 8796 jQuery.propFix.enctype = "encoding"; 8797} 8798 8799 8800 8801 8802var rclass = /[\t\r\n\f]/g; 8803 8804function getClass( elem ) { 8805 return jQuery.attr( elem, "class" ) || ""; 8806} 8807 8808jQuery.fn.extend( { 8809 addClass: function( value ) { 8810 var classes, elem, cur, curValue, clazz, j, finalValue, 8811 i = 0; 8812 8813 if ( jQuery.isFunction( value ) ) { 8814 return this.each( function( j ) { 8815 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8816 } ); 8817 } 8818 8819 if ( typeof value === "string" && value ) { 8820 classes = value.match( rnotwhite ) || []; 8821 8822 while ( ( elem = this[ i++ ] ) ) { 8823 curValue = getClass( elem ); 8824 cur = elem.nodeType === 1 && 8825 ( " " + curValue + " " ).replace( rclass, " " ); 8826 8827 if ( cur ) { 8828 j = 0; 8829 while ( ( clazz = classes[ j++ ] ) ) { 8830 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8831 cur += clazz + " "; 8832 } 8833 } 8834 8835 // only assign if different to avoid unneeded rendering. 8836 finalValue = jQuery.trim( cur ); 8837 if ( curValue !== finalValue ) { 8838 jQuery.attr( elem, "class", finalValue ); 8839 } 8840 } 8841 } 8842 } 8843 8844 return this; 8845 }, 8846 8847 removeClass: function( value ) { 8848 var classes, elem, cur, curValue, clazz, j, finalValue, 8849 i = 0; 8850 8851 if ( jQuery.isFunction( value ) ) { 8852 return this.each( function( j ) { 8853 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8854 } ); 8855 } 8856 8857 if ( !arguments.length ) { 8858 return this.attr( "class", "" ); 8859 } 8860 8861 if ( typeof value === "string" && value ) { 8862 classes = value.match( rnotwhite ) || []; 8863 8864 while ( ( elem = this[ i++ ] ) ) { 8865 curValue = getClass( elem ); 8866 8867 // This expression is here for better compressibility (see addClass) 8868 cur = elem.nodeType === 1 && 8869 ( " " + curValue + " " ).replace( rclass, " " ); 8870 8871 if ( cur ) { 8872 j = 0; 8873 while ( ( clazz = classes[ j++ ] ) ) { 8874
8875 // Remove *all* instances 8876 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8877 cur = cur.replace( " " + clazz + " ", " " ); 8878 } 8879 } 8880 8881 // Only assign if different to avoid unneeded rendering. 8882 finalValue = jQuery.trim( cur ); 8883 if ( curValue !== finalValue ) { 8884 jQuery.attr( elem, "class", finalValue ); 8885 } 8886 } 8887 } 8888 } 8889 8890 return this; 8891 }, 8892 8893 toggleClass: function( value, stateVal ) { 8894 var type = typeof value; 8895 8896 if ( typeof stateVal === "boolean" && type === "string" ) { 8897 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8898 } 8899 8900 if ( jQuery.isFunction( value ) ) { 8901 return this.each( function( i ) { 8902 jQuery( this ).toggleClass( 8903 value.call( this, i, getClass( this ), stateVal ), 8904 stateVal 8905 ); 8906 } ); 8907 } 8908 8909 return this.each( function() { 8910 var className, i, self, classNames; 8911 8912 if ( type === "string" ) { 8913 8914 // Toggle individual class names 8915 i = 0; 8916 self = jQuery( this ); 8917 classNames = value.match( rnotwhite ) || []; 8918 8919 while ( ( className = classNames[ i++ ] ) ) { 8920 8921 // Check each className given, space separated list 8922 if ( self.hasClass( className ) ) { 8923 self.removeClass( className ); 8924 } else { 8925 self.addClass( className ); 8926 } 8927 } 8928 8929 // Toggle whole class name 8930 } else if ( value === undefined || type === "boolean" ) { 8931 className = getClass( this ); 8932 if ( className ) { 8933 8934 // store className if set 8935 jQuery._data( this, "__className__", className ); 8936 } 8937 8938 // If the element has a class name or if we're passed "false", 8939 // then remove the whole classname (if there was one, the above saved it). 8940 // Otherwise bring back whatever was previously saved (if anything), 8941 // falling back to the empty string if nothing was stored. 8942 jQuery.attr( this, "class", 8943 className || value === false ? 8944 "" : 8945 jQuery._data( this, "__className__" ) || "" 8946 ); 8947 } 8948 } ); 8949 }, 8950 8951 hasClass: function( selector ) { 8952 var className, elem, 8953 i = 0; 8954 8955 className = " " + selector + " "; 8956 while ( ( elem = this[ i++ ] ) ) { 8957 if ( elem.nodeType === 1 && 8958 ( " " + getClass( elem ) + " " ).replace( rclass, " " ) 8959 .indexOf( className ) > -1 8960 ) { 8961 return true; 8962 } 8963 } 8964 8965 return false; 8966 } 8967} ); 8968 8969 8970 8971 8972// Return jQuery for attributes-only inclusion 8973 8974 8975jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + 8976 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 8977 "change select submit keydown keypress keyup error contextmenu" ).split( " " ), 8978 function( i, name ) { 8979 8980 // Handle event binding 8981 jQuery.fn[ name ] = function( data, fn ) { 8982 return arguments.length > 0 ? 8983 this.on( name, null, data, fn ) : 8984 this.trigger( name ); 8985 }; 8986} ); 8987 8988jQuery.fn.extend( { 8989 hover: function( fnOver, fnOut ) { 8990 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 8991 } 8992} ); 8993 8994 8995var location = window.location; 8996 8997var nonce = jQuery.now(); 8998 8999var rquery = ( /\?/ ); 9000 9001 9002 9003var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; 9004 9005jQuery.parseJSON = function( data ) { 9006 9007 // Attempt to parse using the native JSON parser first 9008 if ( window.JSON && window.JSON.parse ) { 9009 9010 // Support: Android 2.3 9011 // Workaround failure to string-cast null input 9012 return window.JSON.parse( data + "" ); 9013 } 9014 9015 var requireNonComma, 9016 depth = null, 9017 str = jQuery.trim( data + "" ); 9018 9019 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains 9020 // after removing valid tokens 9021 return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { 9022 9023 // Force termination if we see a misplaced comma 9024 if ( requireNonComma && comma ) { 9025 depth = 0; 9026 } 9027 9028 // Perform no more replacements after returning to outermost depth 9029 if ( depth === 0 ) { 9030 return token; 9031 } 9032 9033 // Commas must not follow "[", "{", or "," 9034 requireNonComma = open || comma; 9035 9036 // Determine new depth 9037 // array/object open ("[" or "{"): depth += true - false (increment) 9038 // array/object close ("]" or "}"): depth += false - true (decrement) 9039 // other cases ("," or primitive): depth += true - true (numeric cast) 9040 depth += !close - !open; 9041 9042 // Remove this token 9043 return ""; 9044 } ) ) ? 9045 ( Function( "return " + str ) )() : 9046 jQuery.error( "Invalid JSON: " + data ); 9047}; 9048 9049 9050// Cross-browser xml parsing
9051jQuery.parseXML = function( data ) { 9052 var xml, tmp; 9053 if ( !data || typeof data !== "string" ) { 9054 return null; 9055 } 9056 try { 9057 if ( window.DOMParser ) { // Standard 9058 tmp = new window.DOMParser(); 9059 xml = tmp.parseFromString( data, "text/xml" ); 9060 } else { // IE 9061 xml = new window.ActiveXObject( "Microsoft.XMLDOM" ); 9062 xml.async = "false"; 9063 xml.loadXML( data ); 9064 } 9065 } catch ( e ) { 9066 xml = undefined; 9067 } 9068 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { 9069 jQuery.error( "Invalid XML: " + data ); 9070 } 9071 return xml; 9072}; 9073 9074 9075var 9076 rhash = /#.*$/, 9077 rts = /([?&])_=[^&]*/, 9078 9079 // IE leaves an \r character at EOL 9080 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, 9081 9082 // #7653, #8125, #8152: local protocol detection 9083 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9084 rnoContent = /^(?:GET|HEAD)$/, 9085 rprotocol = /^\/\//, 9086 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, 9087 9088 /* Prefilters 9089 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9090 * 2) These are called: 9091 * - BEFORE asking for a transport 9092 * - AFTER param serialization (s.data is a string if s.processData is true) 9093 * 3) key is the dataType 9094 * 4) the catchall symbol "*" can be used 9095 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9096 */ 9097 prefilters = {}, 9098 9099 /* Transports bindings 9100 * 1) key is the dataType 9101 * 2) the catchall symbol "*" can be used 9102 * 3) selection will start with transport dataType and THEN go to "*" if needed 9103 */ 9104 transports = {}, 9105 9106 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9107 allTypes = "*/".concat( "*" ), 9108 9109 // Document location 9110 ajaxLocation = location.href, 9111 9112 // Segment location into parts 9113 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 9114 9115// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9116function addToPrefiltersOrTransports( structure ) { 9117 9118 // dataTypeExpression is optional and defaults to "*" 9119 return function( dataTypeExpression, func ) { 9120 9121 if ( typeof dataTypeExpression !== "string" ) { 9122 func = dataTypeExpression; 9123 dataTypeExpression = "*"; 9124 } 9125 9126 var dataType, 9127 i = 0, 9128 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; 9129 9130 if ( jQuery.isFunction( func ) ) { 9131 9132 // For each dataType in the dataTypeExpression 9133 while ( ( dataType = dataTypes[ i++ ] ) ) { 9134 9135 // Prepend if requested 9136 if ( dataType.charAt( 0 ) === "+" ) { 9137 dataType = dataType.slice( 1 ) || "*"; 9138 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9139 9140 // Otherwise append 9141 } else { 9142 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9143 } 9144 } 9145 } 9146 }; 9147} 9148 9149// Base inspection function for prefilters and transports 9150function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9151 9152 var inspected = {}, 9153 seekingTransport = ( structure === transports ); 9154 9155 function inspect( dataType ) { 9156 var selected; 9157 inspected[ dataType ] = true; 9158 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9159 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9160 if ( typeof dataTypeOrTransport === "string" && 9161 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9162 9163 options.dataTypes.unshift( dataTypeOrTransport ); 9164 inspect( dataTypeOrTransport ); 9165 return false; 9166 } else if ( seekingTransport ) { 9167 return !( selected = dataTypeOrTransport ); 9168 } 9169 } ); 9170 return selected; 9171 } 9172 9173 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9174} 9175 9176// A special extend for ajax options 9177// that takes "flat" options (not to be deep extended) 9178// Fixes #9887 9179function ajaxExtend( target, src ) { 9180 var deep, key, 9181 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9182 9183 for ( key in src ) { 9184 if ( src[ key ] !== undefined ) { 9185 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9186 } 9187 } 9188 if ( deep ) { 9189 jQuery.extend( true, target, deep ); 9190 } 9191 9192 return target; 9193} 9194 9195/* Handles responses to an ajax request: 9196 * - finds the right dataType (mediates between content-type and expected dataType) 9197 * - returns the corresponding response 9198 */ 9199function ajaxHandleResponses( s, jqXHR, responses ) { 9200 var firstDataType, ct, finalDataType, type, 9201 contents = s.contents, 9202 dataTypes = s.dataTypes; 9203 9204 // Remove auto dataType and get content-type in the process 9205 while ( dataTypes[ 0 ] === "*" ) { 9206 dataTypes.shift(); 9207 if ( ct === undefined ) { 9208 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9209 } 9210 } 9211 9212 // Check if we're dealing with a known content-type 9213 if ( ct ) { 9214 for ( type in contents ) { 9215 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9216 dataTypes.unshift( type ); 9217 break; 9218 } 9219 } 9220 } 9221 9222 // Check to see if we have a response for the expected dataType 9223 if ( dataTypes[ 0 ] in responses ) { 9224 finalDataType = dataTypes[ 0 ]; 9225 } else { 9226
vendor: 5,407 bytes, lines 9227-9456
9227 // Try convertible dataTypes 9228 for ( type in responses ) { 9229 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9230 finalDataType = type; 9231 break; 9232 } 9233 if ( !firstDataType ) { 9234 firstDataType = type; 9235 } 9236 } 9237 9238 // Or just use first one 9239 finalDataType = finalDataType || firstDataType; 9240 } 9241 9242 // If we found a dataType 9243 // We add the dataType to the list if needed 9244 // and return the corresponding response 9245 if ( finalDataType ) { 9246 if ( finalDataType !== dataTypes[ 0 ] ) { 9247 dataTypes.unshift( finalDataType ); 9248 } 9249 return responses[ finalDataType ]; 9250 } 9251} 9252 9253/* Chain conversions given the request and the original response 9254 * Also sets the responseXXX fields on the jqXHR instance 9255 */ 9256function ajaxConvert( s, response, jqXHR, isSuccess ) { 9257 var conv2, current, conv, tmp, prev, 9258 converters = {}, 9259 9260 // Work with a copy of dataTypes in case we need to modify it for conversion 9261 dataTypes = s.dataTypes.slice(); 9262 9263 // Create converters map with lowercased keys 9264 if ( dataTypes[ 1 ] ) { 9265 for ( conv in s.converters ) { 9266 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9267 } 9268 } 9269 9270 current = dataTypes.shift(); 9271 9272 // Convert to each sequential dataType 9273 while ( current ) { 9274 9275 if ( s.responseFields[ current ] ) { 9276 jqXHR[ s.responseFields[ current ] ] = response; 9277 } 9278 9279 // Apply the dataFilter if provided 9280 if ( !prev && isSuccess && s.dataFilter ) { 9281 response = s.dataFilter( response, s.dataType ); 9282 } 9283 9284 prev = current; 9285 current = dataTypes.shift(); 9286 9287 if ( current ) { 9288 9289 // There's only work to do if current dataType is non-auto 9290 if ( current === "*" ) { 9291 9292 current = prev; 9293 9294 // Convert response if prev dataType is non-auto and differs from current 9295 } else if ( prev !== "*" && prev !== current ) { 9296 9297 // Seek a direct converter 9298 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9299 9300 // If none found, seek a pair 9301 if ( !conv ) { 9302 for ( conv2 in converters ) { 9303 9304 // If conv2 outputs current 9305 tmp = conv2.split( " " ); 9306 if ( tmp[ 1 ] === current ) { 9307 9308 // If prev can be converted to accepted input 9309 conv = converters[ prev + " " + tmp[ 0 ] ] || 9310 converters[ "* " + tmp[ 0 ] ]; 9311 if ( conv ) { 9312 9313 // Condense equivalence converters 9314 if ( conv === true ) { 9315 conv = converters[ conv2 ]; 9316 9317 // Otherwise, insert the intermediate dataType 9318 } else if ( converters[ conv2 ] !== true ) { 9319 current = tmp[ 0 ]; 9320 dataTypes.unshift( tmp[ 1 ] ); 9321 } 9322 break; 9323 } 9324 } 9325 } 9326 } 9327 9328 // Apply converter (if not an equivalence) 9329 if ( conv !== true ) { 9330 9331 // Unless errors are allowed to bubble, catch and return them 9332 if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation 9333 response = conv( response ); 9334 } else { 9335 try { 9336 response = conv( response ); 9337 } catch ( e ) { 9338 return { 9339 state: "parsererror", 9340 error: conv ? e : "No conversion from " + prev + " to " + current 9341 }; 9342 } 9343 } 9344 } 9345 } 9346 } 9347 } 9348 9349 return { state: "success", data: response }; 9350} 9351 9352jQuery.extend( { 9353 9354 // Counter for holding the number of active queries 9355 active: 0, 9356 9357 // Last-Modified header cache for next request 9358 lastModified: {}, 9359 etag: {}, 9360 9361 ajaxSettings: { 9362 url: ajaxLocation, 9363 type: "GET", 9364 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 9365 global: true, 9366 processData: true, 9367 async: true, 9368 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9369 /* 9370 timeout: 0, 9371 data: null, 9372 dataType: null, 9373 username: null, 9374 password: null, 9375 cache: null, 9376 throws: false, 9377 traditional: false, 9378 headers: {}, 9379 */ 9380 9381 accepts: { 9382 "*": allTypes, 9383 text: "text/plain", 9384 html: "text/html", 9385 xml: "application/xml, text/xml", 9386 json: "application/json, text/javascript" 9387 }, 9388 9389 contents: { 9390 xml: /\bxml\b/, 9391 html: /\bhtml/, 9392 json: /\bjson\b/ 9393 }, 9394 9395 responseFields: { 9396 xml: "responseXML", 9397 text: "responseText", 9398 json: "responseJSON" 9399 }, 9400 9401 // Data converters 9402 // Keys separate source (or catchall "*") and destination types with a single space 9403 converters: { 9404 9405 // Convert anything to text 9406 "* text": String, 9407 9408 // Text to html (true = no transformation) 9409 "text html": true, 9410 9411 // Evaluate text as a json expression 9412 "text json": jQuery.parseJSON, 9413 9414 // Parse text as xml 9415 "text xml": jQuery.parseXML 9416 }, 9417 9418 // For options that shouldn't be deep extended: 9419 // you can add your own custom options here if 9420 // and when you create one that shouldn't be 9421 // deep extended (see ajaxExtend) 9422 flatOptions: { 9423 url: true, 9424 context: true 9425 } 9426 }, 9427 9428 // Creates a full fledged settings object into target 9429 // with both ajaxSettings and settings fields. 9430 // If target is omitted, writes into ajaxSettings. 9431 ajaxSetup: function( target, settings ) { 9432 return settings ? 9433 9434 // Building a settings object 9435 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9436 9437 // Extending ajaxSettings 9438 ajaxExtend( jQuery.ajaxSettings, target ); 9439 }, 9440 9441 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9442 ajaxTransport: addToPrefiltersOrTransports( transports ), 9443 9444 // Main method 9445 ajax: function( url, options ) { 9446 9447 // If url is an object, simulate pre-1.5 signature 9448 if ( typeof url === "object" ) { 9449 options = url; 9450 url = undefined; 9451 } 9452 9453 // Force options to be an object 9454 options = options || {}; 9455 9456 var
9457 9458 // Cross-domain detection vars 9459 parts, 9460 9461 // Loop variable 9462 i, 9463 9464 // URL without anti-cache param 9465 cacheURL, 9466 9467 // Response headers as string 9468 responseHeadersString, 9469 9470 // timeout handle 9471 timeoutTimer, 9472 9473 // To know if global events are to be dispatched 9474 fireGlobals, 9475 9476 transport, 9477 9478 // Response headers 9479 responseHeaders, 9480 9481 // Create the final options object 9482 s = jQuery.ajaxSetup( {}, options ), 9483 9484 // Callbacks context 9485 callbackContext = s.context || s, 9486 9487 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9488 globalEventContext = s.context && 9489 ( callbackContext.nodeType || callbackContext.jquery ) ? 9490 jQuery( callbackContext ) : 9491 jQuery.event, 9492 9493 // Deferreds 9494 deferred = jQuery.Deferred(), 9495 completeDeferred = jQuery.Callbacks( "once memory" ), 9496 9497 // Status-dependent callbacks 9498 statusCode = s.statusCode || {}, 9499 9500 // Headers (they are sent all at once) 9501 requestHeaders = {}, 9502 requestHeadersNames = {}, 9503 9504 // The jqXHR state 9505 state = 0, 9506 9507 // Default abort message 9508 strAbort = "canceled", 9509 9510 // Fake xhr 9511 jqXHR = { 9512 readyState: 0, 9513 9514 // Builds headers hashtable if needed 9515 getResponseHeader: function( key ) { 9516 var match; 9517 if ( state === 2 ) { 9518 if ( !responseHeaders ) { 9519 responseHeaders = {}; 9520 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9521 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 9522 } 9523 } 9524 match = responseHeaders[ key.toLowerCase() ]; 9525 } 9526 return match == null ? null : match; 9527 }, 9528 9529 // Raw string 9530 getAllResponseHeaders: function() { 9531 return state === 2 ? responseHeadersString : null; 9532 }, 9533 9534 // Caches the header 9535 setRequestHeader: function( name, value ) { 9536 var lname = name.toLowerCase(); 9537 if ( !state ) { 9538 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 9539 requestHeaders[ name ] = value; 9540 } 9541 return this; 9542 }, 9543 9544 // Overrides response content-type header 9545 overrideMimeType: function( type ) { 9546 if ( !state ) { 9547 s.mimeType = type; 9548 } 9549 return this; 9550 }, 9551 9552 // Status-dependent callbacks 9553 statusCode: function( map ) { 9554 var code; 9555 if ( map ) { 9556 if ( state < 2 ) { 9557 for ( code in map ) { 9558 9559 // Lazy-add the new callback in a way that preserves old ones 9560 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9561 } 9562 } else { 9563 9564 // Execute the appropriate callbacks 9565 jqXHR.always( map[ jqXHR.status ] ); 9566 } 9567 } 9568 return this; 9569 }, 9570 9571 // Cancel the request 9572 abort: function( statusText ) { 9573 var finalText = statusText || strAbort; 9574 if ( transport ) { 9575 transport.abort( finalText ); 9576 } 9577 done( 0, finalText ); 9578 return this; 9579 } 9580 }; 9581 9582 // Attach deferreds 9583 deferred.promise( jqXHR ).complete = completeDeferred.add; 9584 jqXHR.success = jqXHR.done; 9585 jqXHR.error = jqXHR.fail; 9586 9587 // Remove hash character (#7531: and string promotion) 9588 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 9589 // Handle falsy url in the settings object (#10093: consistency with old signature) 9590 // We also use the url parameter if available 9591 s.url = ( ( url || s.url || ajaxLocation ) + "" ) 9592 .replace( rhash, "" ) 9593 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 9594 9595 // Alias method option to type as per ticket #12004 9596 s.type = options.method || options.type || s.method || s.type; 9597 9598 // Extract dataTypes list 9599 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; 9600 9601 // A cross-domain request is in order when we have a protocol:host:port mismatch 9602 if ( s.crossDomain == null ) { 9603 parts = rurl.exec( s.url.toLowerCase() ); 9604 s.crossDomain = !!( parts && 9605 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || 9606 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== 9607 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) 9608 ); 9609 } 9610 9611 // Convert data if not already a string 9612 if ( s.data && s.processData && typeof s.data !== "string" ) { 9613 s.data = jQuery.param( s.data, s.traditional ); 9614 } 9615 9616 // Apply prefilters 9617 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9618 9619 // If request was aborted inside a prefilter, stop there 9620 if ( state === 2 ) { 9621 return jqXHR; 9622 } 9623 9624 // We can fire global events as of now if asked to 9625 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9626 fireGlobals = jQuery.event && s.global; 9627 9628 // Watch for a new set of requests 9629 if ( fireGlobals && jQuery.active++ === 0 ) { 9630 jQuery.event.trigger( "ajaxStart" ); 9631 } 9632 9633 // Uppercase the type 9634 s.type = s.type.toUpperCase(); 9635 9636 // Determine if request has content 9637 s.hasContent = !rnoContent.test( s.type ); 9638 9639 // Save the URL in case we're toying with the If-Modified-Since 9640 // and/or If-None-Match header later on 9641 cacheURL = s.url; 9642 9643 // More options handling for requests with no content 9644 if ( !s.hasContent ) { 9645 9646 // If data is available, append data to url 9647 if ( s.data ) {
9648 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); 9649 9650 // #9682: remove data so that it's not used in an eventual retry 9651 delete s.data; 9652 } 9653 9654 // Add anti-cache in url if needed 9655 if ( s.cache === false ) { 9656 s.url = rts.test( cacheURL ) ? 9657 9658 // If there is already a '_' parameter, set its value 9659 cacheURL.replace( rts, "$1_=" + nonce++ ) : 9660 9661 // Otherwise add one to the end 9662 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; 9663 } 9664 } 9665 9666 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9667 if ( s.ifModified ) { 9668 if ( jQuery.lastModified[ cacheURL ] ) { 9669 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9670 } 9671 if ( jQuery.etag[ cacheURL ] ) { 9672 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9673 } 9674 } 9675 9676 // Set the correct header, if data is being sent 9677 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9678 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9679 } 9680 9681 // Set the Accepts header for the server, depending on the dataType 9682 jqXHR.setRequestHeader( 9683 "Accept", 9684 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9685 s.accepts[ s.dataTypes[ 0 ] ] + 9686 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9687 s.accepts[ "*" ] 9688 ); 9689 9690 // Check for headers option 9691 for ( i in s.headers ) { 9692 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9693 } 9694 9695 // Allow custom headers/mimetypes and early abort 9696 if ( s.beforeSend && 9697 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 9698 9699 // Abort if not done already and return 9700 return jqXHR.abort(); 9701 } 9702 9703 // aborting is no longer a cancellation 9704 strAbort = "abort"; 9705 9706 // Install callbacks on deferreds 9707 for ( i in { success: 1, error: 1, complete: 1 } ) { 9708 jqXHR[ i ]( s[ i ] ); 9709 } 9710 9711 // Get transport 9712 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9713 9714 // If no transport, we auto-abort 9715 if ( !transport ) { 9716 done( -1, "No Transport" ); 9717 } else { 9718 jqXHR.readyState = 1; 9719 9720 // Send global event 9721 if ( fireGlobals ) { 9722 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9723 } 9724 9725 // If request was aborted inside ajaxSend, stop there 9726 if ( state === 2 ) { 9727 return jqXHR; 9728 } 9729 9730 // Timeout 9731 if ( s.async && s.timeout > 0 ) { 9732 timeoutTimer = window.setTimeout( function() { 9733 jqXHR.abort( "timeout" ); 9734 }, s.timeout ); 9735 } 9736 9737 try { 9738 state = 1; 9739 transport.send( requestHeaders, done ); 9740 } catch ( e ) { 9741 9742 // Propagate exception as error if not done 9743 if ( state < 2 ) { 9744 done( -1, e ); 9745 9746 // Simply rethrow otherwise 9747 } else { 9748 throw e; 9749 } 9750 } 9751 } 9752 9753 // Callback for when everything is done 9754 function done( status, nativeStatusText, responses, headers ) { 9755 var isSuccess, success, error, response, modified, 9756 statusText = nativeStatusText; 9757 9758 // Called once 9759 if ( state === 2 ) { 9760 return; 9761 } 9762 9763 // State is "done" now 9764 state = 2; 9765 9766 // Clear timeout if it exists 9767 if ( timeoutTimer ) { 9768 window.clearTimeout( timeoutTimer ); 9769 } 9770 9771 // Dereference transport for early garbage collection 9772 // (no matter how long the jqXHR object will be used) 9773 transport = undefined; 9774 9775 // Cache response headers 9776 responseHeadersString = headers || ""; 9777 9778 // Set readyState 9779 jqXHR.readyState = status > 0 ? 4 : 0; 9780 9781 // Determine if successful 9782 isSuccess = status >= 200 && status < 300 || status === 304; 9783 9784 // Get response data 9785 if ( responses ) { 9786 response = ajaxHandleResponses( s, jqXHR, responses ); 9787 } 9788 9789 // Convert no matter what (that way responseXXX fields are always set) 9790 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9791 9792 // If successful, handle type chaining 9793 if ( isSuccess ) { 9794 9795 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9796 if ( s.ifModified ) { 9797 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9798 if ( modified ) { 9799 jQuery.lastModified[ cacheURL ] = modified; 9800 } 9801 modified = jqXHR.getResponseHeader( "etag" ); 9802 if ( modified ) { 9803 jQuery.etag[ cacheURL ] = modified; 9804 } 9805 } 9806 9807 // if no content 9808 if ( status === 204 || s.type === "HEAD" ) { 9809 statusText = "nocontent"; 9810 9811 // if not modified 9812 } else if ( status === 304 ) { 9813 statusText = "notmodified"; 9814 9815 // If we have data, let's convert it 9816 } else { 9817 statusText = response.state; 9818 success = response.data; 9819 error = response.error; 9820 isSuccess = !error; 9821 } 9822 } else { 9823 9824 // We extract error from statusText 9825 // then normalize statusText and status for non-aborts 9826 error = statusText; 9827 if ( status || !statusText ) { 9828 statusText = "error"; 9829 if ( status < 0 ) { 9830 status = 0; 9831 } 9832 } 9833 } 9834 9835 // Set data for the fake xhr object 9836 jqXHR.status = status; 9837 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9838 9839 // Success/Error 9840 if ( isSuccess ) { 9841 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9842 } else { 9843 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9844 } 9845 9846 // Status-dependent callbacks 9847 jqXHR.statusCode( statusCode ); 9848 statusCode = undefined; 9849 9850 if ( fireGlobals ) { 9851 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9852 [ jqXHR, s, isSuccess ? success : error ] ); 9853 } 9854 9855 // Complete 9856 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9857 9858 if ( fireGlobals ) { 9859 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9860 9861 // Handle the global AJAX counter 9862 if ( !( --jQuery.active ) ) { 9863 jQuery.event.trigger( "ajaxStop" ); 9864 } 9865 } 9866 } 9867 9868 return jqXHR; 9869 }, 9870 9871 getJSON: function( url, data, callback ) { 9872 return jQuery.get( url, data, callback, "json" ); 9873 }, 9874 9875 getScript: function( url, callback ) { 9876 return jQuery.get( url, undefined, callback, "script" ); 9877 } 9878} ); 9879 9880jQuery.each( [ "get", "post" ], function( i, method ) { 9881 jQuery[ method ] = function( url, data, callback, type ) { 9882 9883 // shift arguments if data argument was omitted 9884 if ( jQuery.isFunction( data ) ) { 9885 type = type || callback; 9886 callback = data; 9887 data = undefined; 9888 } 9889 9890 // The url can be an options object (which then must have .url) 9891 return jQuery.ajax( jQuery.extend( { 9892 url: url, 9893 type: method, 9894 dataType: type, 9895 data: data, 9896 success: callback 9897 }, jQuery.isPlainObject( url ) && url ) ); 9898 }; 9899} ); 9900 9901 9902jQuery._evalUrl = function( url ) { 9903 return jQuery.ajax( { 9904 url: url, 9905 9906 // Make this explicit, since user can override this through ajaxSetup (#11264) 9907 type: "GET", 9908 dataType: "script", 9909 cache: true, 9910 async: false, 9911 global: false, 9912 "throws": true 9913 } ); 9914}; 9915 9916 9917jQuery.fn.extend( { 9918 wrapAll: function( html ) { 9919 if ( jQuery.isFunction( html ) ) { 9920 return this.each( function( i ) { 9921 jQuery( this ).wrapAll( html.call( this, i ) ); 9922 } ); 9923 } 9924 9925 if ( this[ 0 ] ) { 9926 9927 // The elements to wrap the target around 9928 var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9929 9930 if ( this[ 0 ].parentNode ) { 9931 wrap.insertBefore( this[ 0 ] ); 9932 } 9933 9934 wrap.map( function() { 9935 var elem = this; 9936 9937 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 9938 elem = elem.firstChild; 9939 } 9940 9941 return elem; 9942 } ).append( this ); 9943 } 9944 9945 return this; 9946 }, 9947 9948 wrapInner: function( html ) { 9949 if ( jQuery.isFunction( html ) ) { 9950 return this.each( function( i ) { 9951 jQuery( this ).wrapInner( html.call( this, i ) ); 9952 } ); 9953 } 9954 9955 return this.each( function() { 9956 var self = jQuery( this ), 9957 contents = self.contents(); 9958 9959 if ( contents.length ) { 9960 contents.wrapAll( html ); 9961 9962 } else { 9963 self.append( html ); 9964 } 9965 } ); 9966 }, 9967 9968 wrap: function( html ) { 9969 var isFunction = jQuery.isFunction( html ); 9970 9971 return this.each( function( i ) { 9972 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); 9973 } ); 9974 }, 9975 9976 unwrap: function() { 9977 return this.parent().each( function() { 9978 if ( !jQuery.nodeName( this, "body" ) ) { 9979 jQuery( this ).replaceWith( this.childNodes ); 9980 } 9981 } ).end(); 9982 } 9983} ); 9984 9985 9986function getDisplay( elem ) { 9987 return elem.style && elem.style.display || jQuery.css( elem, "dis
9987play" ); 9988} 9989 9990function filterHidden( elem ) { 9991 9992 // Disconnected elements are considered hidden 9993 if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) { 9994 return true; 9995 } 9996 while ( elem && elem.nodeType === 1 ) { 9997 if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) { 9998 return true; 9999 } 10000 elem = elem.parentNode; 10001 } 10002 return false; 10003} 10004 10005jQuery.expr.filters.hidden = function( elem ) { 10006 10007 // Support: Opera <= 12.12 10008 // Opera reports offsetWidths and offsetHeights less than zero on some elements 10009 return support.reliableHiddenOffsets() ? 10010 ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 && 10011 !elem.getClientRects().length ) : 10012 filterHidden( elem ); 10013}; 10014 10015jQuery.expr.filters.visible = function( elem ) { 10016 return !jQuery.expr.filters.hidden( elem ); 10017}; 10018 10019 10020 10021 10022var r20 = /%20/g, 10023 rbracket = /\[\]$/, 10024 rCRLF = /\r?\n/g, 10025 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 10026 rsubmittable = /^(?:input|select|textarea|keygen)/i; 10027 10028function buildParams( prefix, obj, traditional, add ) { 10029 var name; 10030 10031 if ( jQuery.isArray( obj ) ) { 10032 10033 // Serialize array item. 10034 jQuery.each( obj, function( i, v ) { 10035 if ( traditional || rbracket.test( prefix ) ) { 10036 10037 // Treat each array item as a scalar. 10038 add( prefix, v ); 10039 10040 } else { 10041 10042 // Item is non-scalar (array or object), encode its numeric index. 10043 buildParams( 10044 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 10045 v, 10046 traditional, 10047 add 10048 ); 10049 } 10050 } ); 10051 10052 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 10053 10054 // Serialize object item. 10055 for ( name in obj ) { 10056 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 10057 } 10058 10059 } else { 10060 10061 // Serialize scalar item. 10062 add( prefix, obj ); 10063 } 10064} 10065 10066// Serialize an array of form elements or a set of 10067// key/values into a query string 10068jQuery.param = function( a, traditional ) { 10069 var prefix, 10070 s = [], 10071 add = function( key, value ) { 10072 10073 // If value is a function, invoke it and return its value 10074 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); 10075 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 10076 }; 10077 10078 // Set traditional to true for jQuery <= 1.3.2 behavior. 10079 if ( traditional === undefined ) { 10080 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 10081 } 10082 10083 // If an array was passed in, assume that it is an array of form elements. 10084 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 10085 10086 // Serialize the form elements 10087 jQuery.each( a, function() { 10088 add( this.name, this.value ); 10089 } ); 10090 10091 } else { 10092 10093 // If traditional, encode the "old" way (the way 1.3.2 or older 10094 // did it), otherwise encode params recursively. 10095 for ( prefix in a ) { 10096 buildParams( prefix, a[ prefix ], traditional, add ); 10097 } 10098 } 10099 10100 // Return the resulting serialization 10101 return s.join( "&" ).replace( r20, "+" ); 10102}; 10103 10104jQuery.fn.extend( { 10105 serialize: function() { 10106 return jQuery.param( this.serializeArray() ); 10107 }, 10108 serializeArray: function() { 10109 return this.map( function() { 10110 10111 // Can add propHook for "elements" to filter or add form elements 10112 var elements = jQuery.prop( this, "elements" ); 10113 return elements ? jQuery.makeArray( elements ) : this; 10114 } ) 10115 .filter( function() { 10116 var type = this.type; 10117 10118 // Use .is(":disabled") so that fieldset[disabled] works 10119 return this.name && !jQuery( this ).is( ":disabled" ) && 10120 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 10121 ( this.checked || !rcheckableType.test( type ) ); 10122 } ) 10123 .map( function( i, elem ) { 10124 var val = jQuery( this ).val(); 10125 10126 return val == null ? 10127 null : 10128 jQuery.isArray( val ) ? 10129 jQuery.map( val, function( val ) { 10130 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10131 } ) : 10132 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10133 } ).get(); 10134 } 10135} ); 10136 10137 10138// Create the request object 10139// (This is still attached to ajaxSettings for backward compatibility) 10140jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? 10141 10142 // Support: IE6-IE8 10143 function() { 10144 10145 // XHR cannot access local files, always use ActiveX for that case 10146 if ( this.isLocal ) { 10147 return createActiveXHR(); 10148 } 10149
10150 // Support: IE 9-11 10151 // IE seems to error on cross-domain PATCH requests when ActiveX XHR 10152 // is used. In IE 9+ always use the native XHR. 10153 // Note: this condition won't catch Edge as it doesn't define 10154 // document.documentMode but it also doesn't support ActiveX so it won't 10155 // reach this code. 10156 if ( document.documentMode > 8 ) { 10157 return createStandardXHR(); 10158 } 10159 10160 // Support: IE<9 10161 // oldIE XHR does not support non-RFC2616 methods (#13240) 10162 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx 10163 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 10164 // Although this check for six methods instead of eight 10165 // since IE also does not support "trace" and "connect" 10166 return /^(get|post|head|put|delete|options)$/i.test( this.type ) && 10167 createStandardXHR() || createActiveXHR(); 10168 } : 10169 10170 // For all other browsers, use the standard XMLHttpRequest object 10171 createStandardXHR; 10172 10173var xhrId = 0, 10174 xhrCallbacks = {}, 10175 xhrSupported = jQuery.ajaxSettings.xhr(); 10176 10177// Support: IE<10 10178// Open requests must be manually aborted on unload (#5280) 10179// See https://support.microsoft.com/kb/2856746 for more info 10180if ( window.attachEvent ) { 10181 window.attachEvent( "onunload", function() { 10182 for ( var key in xhrCallbacks ) { 10183 xhrCallbacks[ key ]( undefined, true ); 10184 } 10185 } ); 10186} 10187 10188// Determine support properties 10189support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10190xhrSupported = support.ajax = !!xhrSupported; 10191 10192// Create transport if the browser can provide an xhr 10193if ( xhrSupported ) { 10194 10195 jQuery.ajaxTransport( function( options ) { 10196 10197 // Cross domain only allowed if supported through XMLHttpRequest 10198 if ( !options.crossDomain || support.cors ) { 10199 10200 var callback; 10201 10202 return { 10203 send: function( headers, complete ) { 10204 var i, 10205 xhr = options.xhr(), 10206 id = ++xhrId; 10207 10208 // Open the socket 10209 xhr.open( 10210 options.type, 10211 options.url, 10212 options.async, 10213 options.username, 10214 options.password 10215 ); 10216 10217 // Apply custom fields if provided 10218 if ( options.xhrFields ) { 10219 for ( i in options.xhrFields ) { 10220 xhr[ i ] = options.xhrFields[ i ]; 10221 } 10222 } 10223 10224 // Override mime type if needed 10225 if ( options.mimeType && xhr.overrideMimeType ) { 10226 xhr.overrideMimeType( options.mimeType ); 10227 } 10228 10229 // X-Requested-With header 10230 // For cross-domain requests, seeing as conditions for a preflight are 10231 // akin to a jigsaw puzzle, we simply never set it to be sure. 10232 // (it can always be set on a per-request basis or even using ajaxSetup)
10233 // For same-domain requests, won't change header if already provided. 10234 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10235 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10236 } 10237 10238 // Set headers 10239 for ( i in headers ) { 10240 10241 // Support: IE<9 10242 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting 10243 // request header to a null-value. 10244 // 10245 // To keep consistent with other XHR implementations, cast the value 10246 // to string and ignore `undefined`. 10247 if ( headers[ i ] !== undefined ) { 10248 xhr.setRequestHeader( i, headers[ i ] + "" ); 10249 } 10250 } 10251 10252 // Do send the request 10253 // This may raise an exception which is actually 10254 // handled in jQuery.ajax (so no try/catch here) 10255 xhr.send( ( options.hasContent && options.data ) || null ); 10256 10257 // Listener 10258 callback = function( _, isAbort ) { 10259 var status, statusText, responses; 10260 10261 // Was never called and is aborted or complete 10262 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 10263 10264 // Clean up 10265 delete xhrCallbacks[ id ]; 10266 callback = undefined; 10267 xhr.onreadystatechange = jQuery.noop; 10268 10269 // Abort manually if needed 10270 if ( isAbort ) { 10271 if ( xhr.readyState !== 4 ) { 10272 xhr.abort(); 10273 } 10274 } else { 10275 responses = {}; 10276 status = xhr.status; 10277 10278 // Support: IE<10 10279 // Accessing binary-data responseText throws an exception 10280 // (#11426) 10281 if ( typeof xhr.responseText === "string" ) { 10282 responses.text = xhr.responseText; 10283 } 10284 10285 // Firefox throws an exception when accessing 10286 // statusText for faulty cross-domain requests 10287 try { 10288 statusText = xhr.statusText; 10289 } catch ( e ) { 10290 10291 // We normalize with Webkit giving an empty statusText 10292 statusText = ""; 10293 } 10294 10295 // Filter status for non standard behaviors 10296 10297 // If the request is local and we have data: assume a success 10298 // (success with no data won't get notified, that's the best we 10299 // can do given current implementations) 10300 if ( !status && options.isLocal && !options.crossDomain ) { 10301 status = responses.text ? 200 : 404; 10302 10303 // IE - #1450: sometimes returns 1223 when it should be 204 10304 } else if ( status === 1223 ) { 10305 status = 204; 10306 } 10307 } 10308 } 10309 10310 // Call complete if needed 10311 if ( responses ) { 10312 complete( status, statusText, responses, xhr.getAllResponseHeaders() ); 10313 } 10314 }; 10315 10316 // Do send the request 10317 // `xhr.send` may raise an exception, but it will be 10318 // handled in jQuery.ajax (so no try/catch here) 10319 if ( !options.async ) { 10320 10321 // If we're in sync mode we fire the callback 10322 callback(); 10323 } else if ( xhr.readyState === 4 ) { 10324 10325 // (IE6 & IE7) if it's in cache and has been 10326 // retrieved directly we need to fire the callback 10327 window.setTimeout( callback ); 10328 } else { 10329 10330 // Register the callback, but delay it in case `xhr.send` throws 10331 // Add to the list of active xhr callbacks 10332 xhr.onreadystatechange = xhrCallbacks[ id ] = callback; 10333 } 10334 }, 10335 10336 abort: function() { 10337 if ( callback ) { 10338 callback( undefined, true ); 10339 } 10340 } 10341 }; 10342 } 10343 } ); 10344} 10345 10346// Functions to create xhrs 10347function createStandardXHR() { 10348 try { 10349 return new window.XMLHttpRequest(); 10350 } catch ( e ) {} 10351} 10352 10353function createActiveXHR() { 10354 try { 10355 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 10356 } catch ( e ) {} 10357} 10358 10359 10360 10361 10362// Install script dataType 10363jQuery.ajaxSetup( { 10364 accepts: { 10365 script: "text/javascript, application/javascript, " + 10366 "application/ecmascript, application/x-ecmascript" 10367 }, 10368 contents: { 10369 script: /\b(?:java|ecma)script\b/ 10370 }, 10371 converters: { 10372 "text script": function( text ) { 10373 jQuery.globalEval( text ); 10374 return text; 10375 } 10376 } 10377} ); 10378 10379// Handle cache's special case and global 10380jQuery.ajaxPrefilter( "script", function( s ) { 10381 if ( s.cache === undefined ) { 10382 s.cache = false; 10383 } 10384 if ( s.crossDomain ) { 10385 s.type = "GET"; 10386 s.global = false;
10387 } 10388} ); 10389 10390// Bind script tag hack transport 10391jQuery.ajaxTransport( "script", function( s ) { 10392 10393 // This transport only deals with cross domain requests 10394 if ( s.crossDomain ) { 10395 10396 var script, 10397 head = document.head || jQuery( "head" )[ 0 ] || document.documentElement; 10398 10399 return { 10400 10401 send: function( _, callback ) { 10402 10403 script = document.createElement( "script" ); 10404 10405 script.async = true; 10406 10407 if ( s.scriptCharset ) { 10408 script.charset = s.scriptCharset; 10409 } 10410 10411 script.src = s.url; 10412 10413 // Attach handlers for all browsers 10414 script.onload = script.onreadystatechange = function( _, isAbort ) { 10415 10416 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { 10417 10418 // Handle memory leak in IE 10419 script.onload = script.onreadystatechange = null; 10420 10421 // Remove the script 10422 if ( script.parentNode ) { 10423 script.parentNode.removeChild( script ); 10424 } 10425 10426 // Dereference the script 10427 script = null; 10428 10429 // Callback if not abort 10430 if ( !isAbort ) { 10431 callback( 200, "success" ); 10432 } 10433 } 10434 }; 10435 10436 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending 10437 // Use native DOM manipulation to avoid our domManip AJAX trickery 10438 head.insertBefore( script, head.firstChild ); 10439 }, 10440 10441 abort: function() { 10442 if ( script ) { 10443 script.onload( undefined, true ); 10444 } 10445 } 10446 }; 10447 } 10448} ); 10449 10450 10451 10452 10453var oldCallbacks = [], 10454 rjsonp = /(=)\?(?=&|$)|\?\?/; 10455 10456// Default jsonp settings 10457jQuery.ajaxSetup( { 10458 jsonp: "callback", 10459 jsonpCallback: function() { 10460 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 10461 this[ callback ] = true; 10462 return callback; 10463 } 10464} ); 10465 10466// Detect, normalize options and install callbacks for jsonp requests 10467jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10468 10469 var callbackName, overwritten, responseContainer, 10470 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10471 "url" : 10472 typeof s.data === "string" && 10473 ( s.contentType || "" ) 10474 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10475 rjsonp.test( s.data ) && "data" 10476 ); 10477 10478 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10479 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10480 10481 // Get callback name, remembering preexisting value associated with it 10482 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 10483 s.jsonpCallback() : 10484 s.jsonpCallback; 10485 10486 // Insert callback into url or form data 10487 if ( jsonProp ) { 10488 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10489 } else if ( s.jsonp !== false ) { 10490 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10491 } 10492 10493 // Use data converter to retrieve json after script execution 10494 s.converters[ "script json" ] = function() { 10495 if ( !responseContainer ) { 10496 jQuery.error( callbackName + " was not called" ); 10497 } 10498 return responseContainer[ 0 ]; 10499 }; 10500 10501 // force json dataType 10502 s.dataTypes[ 0 ] = "json"; 10503 10504 // Install callback 10505 overwritten = window[ callbackName ]; 10506 window[ callbackName ] = function() { 10507 responseContainer = arguments; 10508 }; 10509 10510 // Clean-up function (fires after converters) 10511 jqXHR.always( function() { 10512 10513 // If previous value didn't exist - remove it 10514 if ( overwritten === undefined ) { 10515 jQuery( window ).removeProp( callbackName ); 10516 10517 // Otherwise restore preexisting value 10518 } else { 10519 window[ callbackName ] = overwritten; 10520 } 10521 10522 // Save back as free 10523 if ( s[ callbackName ] ) { 10524 10525 // make sure that re-using the options doesn't screw things around 10526 s.jsonpCallback = originalSettings.jsonpCallback; 10527 10528 // save the callback name for future use 10529 oldCallbacks.push( callbackName ); 10530 } 10531 10532 // Call if it was a function and we have a response 10533 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 10534 overwritten( responseContainer[ 0 ] ); 10535 } 10536 10537 responseContainer = overwritten = undefined; 10538 } ); 10539 10540 // Delegate to script 10541 return "script"; 10542 } 10543} ); 10544 10545 10546 10547 10548// data: string of html 10549// context (optional): If specified, the fragment will be created in this context, 10550// defaults to document 10551// keepScripts (optional): If true, will include scripts passed in the html string 10552jQuery.parseHTML = function( data, context, keepScripts ) { 10553 if ( !data || typeof data !== "string" ) { 10554 return null; 10555 } 10556 if ( typeof context === "boolean" ) { 10557 keepScripts = context; 10558 context = false;
10559 } 10560 context = context || document; 10561 10562 var parsed = rsingleTag.exec( data ), 10563 scripts = !keepScripts && []; 10564 10565 // Single tag 10566 if ( parsed ) { 10567 return [ context.createElement( parsed[ 1 ] ) ]; 10568 } 10569 10570 parsed = buildFragment( [ data ], context, scripts ); 10571 10572 if ( scripts && scripts.length ) { 10573 jQuery( scripts ).remove(); 10574 } 10575 10576 return jQuery.merge( [], parsed.childNodes ); 10577}; 10578 10579 10580// Keep a copy of the old load method 10581var _load = jQuery.fn.load; 10582 10583/** 10584 * Load a url into a page 10585 */ 10586jQuery.fn.load = function( url, params, callback ) { 10587 if ( typeof url !== "string" && _load ) { 10588 return _load.apply( this, arguments ); 10589 } 10590 10591 var selector, type, response, 10592 self = this, 10593 off = url.indexOf( " " ); 10594 10595 if ( off > -1 ) { 10596 selector = jQuery.trim( url.slice( off, url.length ) ); 10597 url = url.slice( 0, off ); 10598 } 10599 10600 // If it's a function 10601 if ( jQuery.isFunction( params ) ) { 10602 10603 // We assume that it's the callback 10604 callback = params; 10605 params = undefined; 10606 10607 // Otherwise, build a param string 10608 } else if ( params && typeof params === "object" ) { 10609 type = "POST"; 10610 } 10611 10612 // If we have elements to modify, make the request 10613 if ( self.length > 0 ) { 10614 jQuery.ajax( { 10615 url: url, 10616 10617 // If "type" variable is undefined, then "GET" method will be used. 10618 // Make value of this field explicit since 10619 // user can override it through ajaxSetup method 10620 type: type || "GET", 10621 dataType: "html", 10622 data: params 10623 } ).done( function( responseText ) { 10624 10625 // Save response for use in complete callback 10626 response = arguments; 10627 10628 self.html( selector ? 10629 10630 // If a selector was specified, locate the right elements in a dummy div 10631 // Exclude scripts to avoid IE 'Permission Denied' errors 10632 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10633 10634 // Otherwise use the full result 10635 responseText ); 10636 10637 // If the request succeeds, this function gets "data", "status", "jqXHR" 10638 // but they are ignored because response was set above. 10639 // If it fails, this function gets "jqXHR", "status", "error" 10640 } ).always( callback && function( jqXHR, status ) { 10641 self.each( function() { 10642 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10643 } ); 10644 } ); 10645 } 10646 10647 return this; 10648}; 10649 10650 10651 10652 10653// Attach a bunch of functions for handling common AJAX events 10654jQuery.each( [ 10655 "ajaxStart", 10656 "ajaxStop", 10657 "ajaxComplete", 10658 "ajaxError", 10659 "ajaxSuccess", 10660 "ajaxSend" 10661], function( i, type ) { 10662 jQuery.fn[ type ] = function( fn ) { 10663 return this.on( type, fn ); 10664 }; 10665} ); 10666 10667 10668 10669 10670jQuery.expr.filters.animated = function( elem ) { 10671 return jQuery.grep( jQuery.timers, function( fn ) { 10672 return elem === fn.elem; 10673 } ).length; 10674}; 10675 10676 10677 10678 10679 10680/** 10681 * Gets a window from an element 10682 */ 10683function getWindow( elem ) { 10684 return jQuery.isWindow( elem ) ? 10685 elem : 10686 elem.nodeType === 9 ? 10687 elem.defaultView || elem.parentWindow : 10688 false; 10689} 10690 10691jQuery.offset = { 10692 setOffset: function( elem, options, i ) { 10693 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10694 position = jQuery.css( elem, "position" ), 10695 curElem = jQuery( elem ), 10696 props = {}; 10697 10698 // set position first, in-case top/left are set even on static elem 10699 if ( position === "static" ) { 10700 elem.style.position = "relative"; 10701 } 10702 10703 curOffset = curElem.offset(); 10704 curCSSTop = jQuery.css( elem, "top" ); 10705 curCSSLeft = jQuery.css( elem, "left" ); 10706 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10707 jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1; 10708 10709 // need to be able to calculate position if either top or left 10710 // is auto and position is either absolute or fixed 10711 if ( calculatePosition ) { 10712 curPosition = curElem.position(); 10713 curTop = curPosition.top; 10714 curLeft = curPosition.left; 10715 } else { 10716 curTop = parseFloat( curCSSTop ) || 0; 10717 curLeft = parseFloat( curCSSLeft ) || 0; 10718 } 10719 10720 if ( jQuery.isFunction( options ) ) { 10721 10722 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10723 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10724 } 10725 10726 if ( options.top != null ) { 10727 props.top = ( options.top - curOffset.top ) + curTop; 10728 } 10729 if ( options.left != null ) { 10730 props.left = ( options.left - curOffset.left ) + curLeft; 10731 } 10732 10733 if ( "using" in options ) { 10734 options.using.call( elem, props ); 10735 } else { 10736 curElem.css( props ); 10737 } 10738 } 10739}; 10740 10741jQuery.fn.extend( { 10742 offset: function( options ) { 10743 if ( arguments.length ) { 10744 return options === undefined ? 10745 this : 10746 this.each( function( i ) { 10747 jQuery.offset.setOffset( this, options, i ); 10748 } ); 10749 } 10750 10751 var docElem, win, 10752 box = { top: 0, left: 0 }, 10753 elem = this[ 0 ], 10754 doc = elem && elem.ownerDocument; 10755 10756 if ( !doc ) { 10757 return; 10758 } 10759 10760 docElem = doc.documentElement; 10761 10762 // Make sure it's not a disconnected DOM node 10763 if ( !jQuery.contains( docElem, elem ) ) { 10764 return box; 10765 } 10766 10767 // If we don't have gBCR, just use 0,0 rather than error 10768 // BlackBerry 5, iOS 3 (original iPhone) 10769 if ( typeof elem.getBoundingClientRect !== "undefined" ) { 10770 box = elem.getBoundingClientRect(); 10771 } 10772 win = getWindow( doc ); 10773 return { 10774 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), 10775 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) 10776 }; 10777 }, 10778 10779 position: function() { 10780 if ( !this[ 0 ] ) { 10781 return; 10782 } 10783 10784 var offsetParent, offset, 10785 parentOffset = { top: 0, left: 0 }, 10786 elem = this[ 0 ]; 10787 10788 // Fixed elements are offset from window (parentOffset = {top:0, left
10788: 0}, 10789 // because it is its only offset parent 10790 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10791 10792 // we assume that getBoundingClientRect is available when computed position is fixed 10793 offset = elem.getBoundingClientRect(); 10794 } else { 10795 10796 // Get *real* offsetParent 10797 offsetParent = this.offsetParent(); 10798 10799 // Get correct offsets 10800 offset = this.offset(); 10801 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { 10802 parentOffset = offsetParent.offset(); 10803 } 10804 10805 // Add offsetParent borders 10806 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); 10807 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); 10808 } 10809 10810 // Subtract parent offsets and element margins 10811 // note: when an element has margin: auto the offsetLeft and marginLeft 10812 // are the same in Safari causing offset.left to incorrectly be 0 10813 return { 10814 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10815 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10816 }; 10817 }, 10818 10819 offsetParent: function() { 10820 return this.map( function() { 10821 var offsetParent = this.offsetParent; 10822 10823 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && 10824 jQuery.css( offsetParent, "position" ) === "static" ) ) { 10825 offsetParent = offsetParent.offsetParent; 10826 } 10827 return offsetParent || documentElement; 10828 } ); 10829 } 10830} ); 10831 10832// Create scrollLeft and scrollTop methods 10833jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10834 var top = /Y/.test( prop ); 10835 10836 jQuery.fn[ method ] = function( val ) { 10837 return access( this, function( elem, method, val ) { 10838 var win = getWindow( elem ); 10839 10840 if ( val === undefined ) { 10841 return win ? ( prop in win ) ? win[ prop ] : 10842 win.document.documentElement[ method ] : 10843 elem[ method ]; 10844 } 10845 10846 if ( win ) { 10847 win.scrollTo( 10848 !top ? val : jQuery( win ).scrollLeft(), 10849 top ? val : jQuery( win ).scrollTop() 10850 ); 10851 10852 } else { 10853 elem[ method ] = val; 10854 } 10855 }, method, val, arguments.length, null ); 10856 }; 10857} ); 10858 10859// Support: Safari<7-8+, Chrome<37-44+ 10860// Add the top/left cssHooks using jQuery.fn.position 10861// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10862// getComputedStyle returns percent when specified for top/left/bottom/right 10863// rather than make the css module depend on the offset module, we just check for it here 10864jQuery.each( [ "top", "left" ], function( i, prop ) { 10865 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10866 function( elem, computed ) { 10867 if ( computed ) { 10868 computed = curCSS( elem, prop ); 10869 10870 // if curCSS returns percentage, fallback to offset 10871 return rnumnonpx.test( computed ) ? 10872 jQuery( elem ).position()[ prop ] + "px" : 10873 computed; 10874 } 10875 } 10876 ); 10877} ); 10878 10879 10880// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10881jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10882 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10883 function( defaultExtra, funcName ) { 10884 10885 // margin is only for outerHeight, outerWidth 10886 jQuery.fn[ funcName ] = function( margin, value ) { 10887 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10888 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10889 10890 return access( this, function( elem, type, value ) { 10891 var doc; 10892 10893 if ( jQuery.isWindow( elem ) ) { 10894 10895 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 10896 // isn't a whole lot we can do. See pull request at this URL for discussion: 10897 // https://github.com/jquery/jquery/pull/764 10898 return elem.document.documentElement[ "client" + name ]; 10899 } 10900 10901 // Get document width or height 10902 if ( elem.nodeType === 9 ) { 10903 doc = elem.documentElement; 10904 10905 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10906 // whichever is greatest 10907 // unfortunately, this causes bug #3838 in IE6/8 only, 10908 // but there is currently no good, small way to fix it. 10909 return Math.max( 10910 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10911 elem.body[ "offset" + name ], doc[ "offset" + name ], 10912 doc[ "client" + name ] 10913 ); 10914 } 10915 10916 return value === undefined ? 10917 10918 // Get width or height on the element, requesting but not forcing parseFloat 10919 jQuery.css( elem, type, extra ) : 10920 10921 // Set width or height on the element 10922 jQuery.style( elem, type, value, extra ); 10923 }, type, chainable ? margin : undefined, chainable, null ); 10924 }; 10925 } ); 10926} ); 10927 10928 10929jQuery.fn.extend( { 10930 10931 bind: function( types, data, fn ) { 10932 return this.on( types, null, data, fn ); 10933 }, 10934 unbind: function( types, fn ) { 10935 return this.off( types, null, fn ); 10936 }, 10937 10938 delegate: function( selector, types, data, fn ) { 10939 return this.on( types, selector, data, fn ); 10940 }, 10941 undelegate: function( selector, types, fn ) { 10942 10943 // ( namespace ) or ( selector, types [, fn] ) 10944 return arguments.length === 1 ? 10945 this.off( selector, "**" ) : 10946 this.off( types, selector || "**", fn ); 10947 } 10948} ); 10949 10950// The number of elements contained in the matched element set 10951jQuery.fn.size = function() { 10952 return this.length; 10953}; 10954 10955jQuery.fn.andSelf = jQuery.fn.addBack; 10956 10957 10958 10959 10960// Register as a named AMD module, since jQuery can be concatenated with other 10961// files that may use define, but not via a proper concatenation script that 10962// understands anonymous AMD modules. A named AMD is safest and most robust 10963// way to register. Lowercase jquery is used because AMD module names are 10964// derived from file names, and jQuery is normally delivered in a lowercase 10965// file name. Do this after creating the global so that if an AMD module wants 10966// to call noConflict to hide this version of jQuery, it will work. 10967 10968// Note that for maximum portability, libraries that are not jQuery should 10969// declare themselves as anonymous modules, and avoid setting a global if an 10970// AMD loader is present. jQuery is a special case. For more information, see
10971// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10972 10973if ( typeof define === "function" && define.amd ) { 10974 define( "jquery", [], function() { 10975 return jQuery; 10976 } ); 10977} 10978 10979 10980 10981var 10982 10983 // Map over jQuery in case of overwrite 10984 _jQuery = window.jQuery, 10985 10986 // Map over the $ in case of overwrite 10987 _$ = window.$; 10988 10989jQuery.noConflict = function( deep ) { 10990 if ( window.$ === jQuery ) { 10991 window.$ = _$; 10992 } 10993 10994 if ( deep && window.jQuery === jQuery ) { 10995 window.jQuery = _jQuery; 10996 } 10997 10998 return jQuery; 10999}; 11000 11001// Expose jQuery and $ identifiers, even in 11002// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 11003// and CommonJS for browser emulators (#13566) 11004if ( !noGlobal ) { 11005 window.jQuery = window.$ = jQuery; 11006} 11007 11008return jQuery; 11009})); 11010/* jshint node: true */ 11011 11012/** 11013 * Unobtrusive scripting adapter for jQuery 11014 * https://github.com/rails/jquery-ujs 11015 * 11016 * Requires jQuery 1.8.0 or later. 11017 * 11018 * Released under the MIT license 11019 * 11020 */ 11021 11022 11023(function() { 11024 'use strict'; 11025 11026 var jqueryUjsInit = function($, undefined) { 11027 11028 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 11029 // by detecting and raising an error when it happens. 11030 if ( $.rails !== undefined ) { 11031 $.error('jquery-ujs has already been loaded!'); 11032 } 11033 11034 // Shorthand to make it a little easier to call public rails functions from within rails.js 11035 var rails; 11036 var $document = $(document); 11037 11038 $.rails = rails = { 11039 // Link elements bound by jquery-ujs 11040 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', 11041 11042 // Button elements bound by jquery-ujs 11043 buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)', 11044 11045 // Select elements bound by jquery-ujs 11046 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 11047 11048 // Form elements bound by jquery-ujs 11049 formSubmitSelector: 'form:not([data-turbo=true])', 11050 11051 // Form input elements bound by jquery-ujs 11052 formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', 11053 11054 // Form input elements disabled during form submission 11055 disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', 11056 11057 // Form input elements re-enabled after form submission 11058 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', 11059 11060 // Form required input elements 11061 requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])', 11062 11063 // Form file input elements 11064 fileInputSelector: 'input[name][type=file]:not([disabled])', 11065 11066 // Link onClick disable selector with possible reenable after remote submission 11067 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 11068 11069 // Button onClick disable selector with possible reenable after remote submission 11070 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 11071 11072 // Up-to-date Cross-Site Request Forgery token 11073 csrfToken: function() { 11074 return $('meta[name=csrf-token]').attr('content'); 11075 }, 11076 11077 // URL param that must contain the CSRF token 11078 csrfParam: function() { 11079 return $('meta[name=csrf-param]').attr('content'); 11080 }, 11081 11082 // Make sure that every Ajax request sends the CSRF token 11083 CSRFProtection: function(xhr) { 11084 var token = rails.csrfToken(); 11085 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 11086 }, 11087 11088 // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) 11089 refreshCSRFTokens: function(){ 11090 $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); 11091 }, 11092 11093 // Triggers an event on an element and returns false if the event result is false 11094 fire: function(obj, name, data) { 11095 var event = $.Event(name); 11096 obj.trigger(event, data); 11097 return event.result !== false; 11098 }, 11099 11100 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 11101 confirm: function(message) { 11102 return confirm(message); 11103 }, 11104 11105 // Default ajax function, may be overridden with custom function in $.rails.ajax 11106 ajax: function(options) { 11107 return $.ajax(options); 11108 }, 11109 11110 // Default way to get an element's href. May be overridden at $.rails.href. 11111 href: function(element) { 11112 return element[0].href; 11113 }, 11114 11115 // Checks "data-remote" if true to handle the request through a XHR request. 11116 isRemote: function(element) { 11117 return element.data('remote') !== undefined && element.data('remote') !== false; 11118 }, 11119 11120 // Submits "remote" forms and links with ajax 11121 handleRemote: function(element) { 11122 var method, url, data, withCredentials, dataType, options; 11123 11124 if (rails.fire(element, 'ajax:before')) { 11125 withCredentials = element.data('with-credentials') || null; 11126 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 11127 11128 if (element.is('form')) { 11129 method = element.data('ujs:submit-button-formmethod') || element.attr('method'); 11130 url = element.data('ujs:submit-button-formaction') || element.attr('action'); 11131 data = $(element[0]).serializeArray(); 11132 // memoized value from clicked submit button 11133 var button = element.data('ujs:submit-button'); 11134 if (button) { 11135 data.push(button); 11136 element.data('ujs:submit-button', null); 11137 } 11138 element.data('ujs:submit-button-formmethod', null); 11139 element.data('ujs:submit-button-formaction', null); 11140 } else if (element.is(rails.inputChangeSelector)) { 11141 method = element.data('method'); 11142 url = element.data('url'); 11143 data = element.serialize(); 11144 if (element.data('params')) data = data + '&' + element.data('params'); 11145 } else if (element.is(rails.buttonClickSelector)) { 11146 method = element.data('method') || 'get'; 11147 url = element.data('url'); 11148 data = element.serialize(); 11149 if (element.data('params')) data = data + '&' + element.data('params'); 11150 } else { 11151 method = element.data('method'); 11152 url = rails.href(element); 11153 data = element.data('params') || null; 11154 } 11155 11156 options = { 11157 type: method || 'GET', data: data, dataType: dataType, 11158 // stopping the "ajax:beforeSend" event will cancel the ajax request 11159 beforeSend: function(xhr, settings) { 11160 if (settings.dataType === undefined) { 11161 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 11162 } 11163 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
11164 element.trigger('ajax:send', xhr); 11165 } else { 11166 return false; 11167 } 11168 }, 11169 success: function(data, status, xhr) { 11170 element.trigger('ajax:success', [data, status, xhr]); 11171 }, 11172 complete: function(xhr, status) { 11173 element.trigger('ajax:complete', [xhr, status]); 11174 }, 11175 error: function(xhr, status, error) { 11176 element.trigger('ajax:error', [xhr, status, error]); 11177 }, 11178 crossDomain: rails.isCrossDomain(url) 11179 }; 11180 11181 // There is no withCredentials for IE6-8 when 11182 // "Enable native XMLHTTP support" is disabled 11183 if (withCredentials) { 11184 options.xhrFields = { 11185 withCredentials: withCredentials 11186 }; 11187 } 11188 11189 // Only pass url to `ajax` options if not blank 11190 if (url) { options.url = url; } 11191 11192 return rails.ajax(options); 11193 } else { 11194 return false; 11195 } 11196 }, 11197 11198 // Determines if the request is a cross domain request. 11199 isCrossDomain: function(url) { 11200 var originAnchor = document.createElement('a'); 11201 originAnchor.href = location.href; 11202 var urlAnchor = document.createElement('a'); 11203 11204 try { 11205 urlAnchor.href = url; 11206 // This is a workaround to a IE bug. 11207 urlAnchor.href = urlAnchor.href; 11208 11209 // If URL protocol is false or is a string containing a single colon 11210 // *and* host are false, assume it is not a cross-domain request 11211 // (should only be the case for IE7 and IE compatibility mode). 11212 // Otherwise, evaluate protocol and host of the URL against the origin 11213 // protocol and host. 11214 return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || 11215 (originAnchor.protocol + '//' + originAnchor.host === 11216 urlAnchor.protocol + '//' + urlAnchor.host)); 11217 } catch (e) { 11218 // If there is an error parsing the URL, assume it is crossDomain. 11219 return true; 11220 } 11221 }, 11222 11223 // Handles "data-method" on links such as: 11224 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 11225 handleMethod: function(link) { 11226 var href = rails.href(link), 11227 method = link.data('method'), 11228 target = link.attr('target'), 11229 csrfToken = rails.csrfToken(), 11230 csrfParam = rails.csrfParam(), 11231 form = $('<form method="post" action="' + href + '"></form>'), 11232 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 11233 11234 if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) { 11235 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 11236 } 11237 11238 if (target) { form.attr('target', target); } 11239 11240 form.hide().append(metadataInput).appendTo('body'); 11241 form.submit(); 11242 }, 11243 11244 // Helper function that returns form elements that match the specified CSS selector 11245 // If form is actually a "form" element this will return associated elements outside the from that have 11246 // the html form attribute set 11247 formElements: function(form, selector) { 11248 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 11249 }, 11250 11251 /* Disables form elements: 11252 - Caches element value in 'ujs:enable-with' data store 11253 - Replaces element text with value of 'data-disable-with' attribute 11254 - Sets disabled property to true 11255 */ 11256 disableFormElements: function(form) { 11257 rails.formElements(form, rails.disableSelector).each(function() { 11258 rails.disableFormElement($(this)); 11259 }); 11260 }, 11261 11262 disableFormElement: function(element) { 11263 var method, replacement; 11264 11265 method = element.is('button') ? 'html' : 'val'; 11266 replacement = element.data('disable-with'); 11267 11268 if (replacement !== undefined) { 11269 element.data('ujs:enable-with', element[method]()); 11270 element[method](replacement); 11271 } 11272 11273 element.prop('disabled', true); 11274 element.data('ujs:disabled', true); 11275 }, 11276 11277 /* Re-enables disabled form elements: 11278 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 11279 - Sets disabled property to false 11280 */ 11281 enableFormElements: function(form) { 11282 rails.formElements(form, rails.enableSelector).each(function() { 11283 rails.enableFormElement($(this)); 11284 }); 11285 }, 11286 11287 enableFormElement: function(element) { 11288 var method = element.is('button') ? 'html' : 'val'; 11289 if (element.data('ujs:enable-with') !== undefined) { 11290 element[method](element.data('ujs:enable-with')); 11291 element.removeData('ujs:enable-with'); // clean up cache 11292 } 11293 element.prop('disabled', false); 11294 element.removeData('ujs:disabled'); 11295 }, 11296 11297 /* For 'data-confirm' attribute: 11298 - Fires `confirm` event 11299 - Shows the confirmation dialog 11300 - Fires the `confirm:complete` event 11301 11302 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 11303 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 11304 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
11305 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 11306 */ 11307 allowAction: function(element) { 11308 var message = element.data('confirm'), 11309 answer = false, callback; 11310 if (!message) { return true; } 11311 11312 if (rails.fire(element, 'confirm')) { 11313 try { 11314 answer = rails.confirm(message); 11315 } catch (e) { 11316 (console.error || console.log).call(console, e.stack || e); 11317 } 11318 callback = rails.fire(element, 'confirm:complete', [answer]); 11319 } 11320 return answer && callback; 11321 }, 11322 11323 // Helper function which checks for blank inputs in a form that match the specified CSS selector 11324 blankInputs: function(form, specifiedSelector, nonBlank) { 11325 var foundInputs = $(), 11326 input, 11327 valueToCheck, 11328 radiosForNameWithNoneSelected, 11329 radioName, 11330 selector = specifiedSelector || 'input,textarea', 11331 requiredInputs = form.find(selector), 11332 checkedRadioButtonNames = {}; 11333 11334 requiredInputs.each(function() { 11335 input = $(this); 11336 if (input.is('input[type=radio]')) { 11337 11338 // Don't count unchecked required radio as blank if other radio with same name is checked, 11339 // regardless of whether same-name radio input has required attribute or not. The spec 11340 // states https://www.w3.org/TR/html5/forms.html#the-required-attribute 11341 radioName = input.attr('name'); 11342 11343 // Skip if we've already seen the radio with this name. 11344 if (!checkedRadioButtonNames[radioName]) { 11345 11346 // If none checked 11347 if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) { 11348 radiosForNameWithNoneSelected = form.find( 11349 'input[type=radio][name="' + radioName + '"]'); 11350 foundInputs = foundInputs.add(radiosForNameWithNoneSelected); 11351 } 11352 11353 // We only need to check each name once. 11354 checkedRadioButtonNames[radioName] = radioName; 11355 } 11356 } else { 11357 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val(); 11358 if (valueToCheck === nonBlank) { 11359 foundInputs = foundInputs.add(input); 11360 } 11361 } 11362 }); 11363 return foundInputs.length ? foundInputs : false; 11364 }, 11365 11366 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 11367 nonBlankInputs: function(form, specifiedSelector) { 11368 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 11369 }, 11370 11371 // Helper function, needed to provide consistent behavior in IE 11372 stopEverything: function(e) { 11373 $(e.target).trigger('ujs:everythingStopped'); 11374 e.stopImmediatePropagation(); 11375 return false; 11376 }, 11377 11378 // Replace element's html with the 'data-disable-with' after storing original html 11379 // and prevent clicking on it 11380 disableElement: function(element) { 11381 var replacement = element.data('disable-with'); 11382 11383 if (replacement !== undefined) { 11384 element.data('ujs:enable-with', element.html()); // store enabled state 11385 element.html(replacement); 11386 } 11387 11388 element.on('click.railsDisable', function(e) { // prevent further clicking 11389 return rails.stopEverything(e); 11390 }); 11391 element.data('ujs:disabled', true); 11392 }, 11393 11394 // Restore element to its original state which was disabled by 'disableElement' above 11395 enableElement: function(element) { 11396 if (element.data('ujs:enable-with') !== undefined) { 11397 element.html(element.data('ujs:enable-with')); // set to old enabled state 11398 element.removeData('ujs:enable-with'); // clean up cache 11399 } 11400 element.off('click.railsDisable'); // enable element 11401 element.removeData('ujs:disabled'); 11402 } 11403 }; 11404 11405 if (rails.fire($document, 'rails:attachBindings')) { 11406 11407 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 11408 11409 // This event works the same as the load event, except that it fires every 11410 // time the page is loaded. 11411 // 11412 // See https://github.com/rails/jquery-ujs/issues/357 11413 // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching 11414 $(window).on('pageshow.rails', function () { 11415 $($.rails.enableSelector).each(function () { 11416 var element = $(this); 11417 11418 if (element.data('ujs:disabled')) { 11419 $.rails.enableFormElement(element); 11420 } 11421 }); 11422 11423 $($.rails.linkDisableSelector).each(function () { 11424 var element = $(this); 11425 11426 if (element.data('ujs:disabled')) { 11427 $.rails.enableElement(element); 11428 } 11429 }); 11430 }); 11431 11432 $document.on('ajax:complete', rails.linkDisableSelector, function() { 11433 rails.enableElement($(this)); 11434 }); 11435 11436 $document.on('ajax:complete', rails.buttonDisableSelector, function() { 11437 rails.enableFormElement($(this)); 11438 }); 11439 11440 $document.on('click.rails', rails.linkClickSelector, function(e) { 11441 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 11442 if (!rails.allowAction(link)) return rails.stopEverything(e); 11443 11444 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 11445 11446 if (rails.isRemote(link)) { 11447 if (metaClick && (!method || method === 'GET') && !data) { return true; } 11448 11449 var handleRemote = rails.handleRemote(link); 11450 // Response from rails.handleRemote() will either be false or a deferred object promise. 11451 if (handleRemote === false) { 11452 rails.enableElement(link); 11453 } else { 11454 handleRemote.fail( function() { rails.enableElement(link); } ); 11455 } 11456 return false;
11457 11458 } else if (method) { 11459 rails.handleMethod(link); 11460 return false; 11461 } 11462 }); 11463 11464 $document.on('click.rails', rails.buttonClickSelector, function(e) { 11465 var button = $(this); 11466 11467 if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); 11468 11469 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 11470 11471 var handleRemote = rails.handleRemote(button); 11472 // Response from rails.handleRemote() will either be false or a deferred object promise. 11473 if (handleRemote === false) { 11474 rails.enableFormElement(button); 11475 } else { 11476 handleRemote.fail( function() { rails.enableFormElement(button); } ); 11477 } 11478 return false; 11479 }); 11480 11481 $document.on('change.rails', rails.inputChangeSelector, function(e) { 11482 var link = $(this); 11483 if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); 11484 11485 rails.handleRemote(link); 11486 return false; 11487 }); 11488 11489 $document.on('submit.rails', rails.formSubmitSelector, function(e) { 11490 var form = $(this), 11491 remote = rails.isRemote(form), 11492 blankRequiredInputs, 11493 nonBlankFileInputs; 11494 11495 if (!rails.allowAction(form)) return rails.stopEverything(e); 11496 11497 // Skip other logic when required values are missing or file upload is present 11498 if (form.attr('novalidate') === undefined) { 11499 if (form.data('ujs:formnovalidate-button') === undefined) { 11500 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); 11501 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 11502 return rails.stopEverything(e); 11503 } 11504 } else { 11505 // Clear the formnovalidate in case the next button click is not on a formnovalidate button 11506 // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain 11507 form.data('ujs:formnovalidate-button', undefined); 11508 } 11509 } 11510 11511 if (remote) { 11512 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 11513 if (nonBlankFileInputs) { 11514 // Slight timeout so that the submit button gets properly serialized 11515 // (make it easy for event handler to serialize form without disabled values) 11516 setTimeout(function(){ rails.disableFormElements(form); }, 13); 11517 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 11518 11519 // Re-enable form elements if event bindings return false (canceling normal form submission) 11520 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 11521 11522 return aborted; 11523 } 11524 11525 rails.handleRemote(form); 11526 return false; 11527 11528 } else { 11529 // Slight timeout so that the submit button gets properly serialized 11530 setTimeout(function(){ rails.disableFormElements(form); }, 13); 11531 } 11532 }); 11533 11534 $document.on('click.rails', rails.formInputClickSelector, function(event) { 11535 var button = $(this); 11536 11537 if (!rails.allowAction(button)) return rails.stopEverything(event); 11538 11539 // Register the pressed submit button 11540 var name = button.attr('name'), 11541 data = name ? {name:name, value:button.val()} : null; 11542 11543 var form = button.closest('form'); 11544 if (form.length === 0) { 11545 form = $('#' + button.attr('form')); 11546 } 11547 form.data('ujs:submit-button', data); 11548 11549 // Save attributes from button 11550 form.data('ujs:formnovalidate-button', button.attr('formnovalidate')); 11551 form.data('ujs:submit-button-formaction', button.attr('formaction')); 11552 form.data('ujs:submit-button-formmethod', button.attr('formmethod')); 11553 }); 11554 11555 $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { 11556 if (this === event.target) rails.disableFormElements($(this)); 11557 }); 11558 11559 $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { 11560 if (this === event.target) rails.enableFormElements($(this)); 11561 }); 11562 11563 $(function(){ 11564 rails.refreshCSRFTokens(); 11565 }); 11566 } 11567 11568 }; 11569 11570 if (window.jQuery) { 11571 jqueryUjsInit(jQuery); 11572 } else if (typeof exports === 'object' && typeof module === 'object') { 11573 module.exports = jqueryUjsInit; 11574 } 11575})(); 11576/*! jQuery UI - v1.11.4+CommonJS - 2015-08-28 11577* http://jqueryui.com 11578* Includes: widget.js 11579* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ 11580 11581 11582(function( factory ) { 11583 if ( typeof define === "function" && define.amd ) { 11584 11585 // AMD. Register as an anonymous module. 11586 define([ "jquery" ], factory ); 11587 11588 } else if ( typeof exports === "object" ) { 11589 11590 // Node/CommonJS 11591 factory( require( "jquery" ) ); 11592 11593 } else { 11594 11595 // Browser globals 11596 factory( jQuery ); 11597 } 11598}(function( $ ) {
vendor: 15,589 bytes, lines 11598-12146
11598 11599/*! 11600 * jQuery UI Widget 1.11.4 11601 * http://jqueryui.com 11602 * 11603 * Copyright jQuery Foundation and other contributors 11604 * Released under the MIT license. 11605 * http://jquery.org/license 11606 * 11607 * http://api.jqueryui.com/jQuery.widget/ 11608 */ 11609 11610 11611var widget_uuid = 0, 11612 widget_slice = Array.prototype.slice; 11613 11614$.cleanData = (function( orig ) { 11615 return function( elems ) { 11616 var events, elem, i; 11617 for ( i = 0; (elem = elems[i]) != null; i++ ) { 11618 try { 11619 11620 // Only trigger remove when necessary to save time 11621 events = $._data( elem, "events" ); 11622 if ( events && events.remove ) { 11623 $( elem ).triggerHandler( "remove" ); 11624 } 11625 11626 // http://bugs.jquery.com/ticket/8235 11627 } catch ( e ) {} 11628 } 11629 orig( elems ); 11630 }; 11631})( $.cleanData ); 11632 11633$.widget = function( name, base, prototype ) { 11634 var fullName, existingConstructor, constructor, basePrototype, 11635 // proxiedPrototype allows the provided prototype to remain unmodified 11636 // so that it can be used as a mixin for multiple widgets (#8876) 11637 proxiedPrototype = {}, 11638 namespace = name.split( "." )[ 0 ]; 11639 11640 name = name.split( "." )[ 1 ]; 11641 fullName = namespace + "-" + name; 11642 11643 if ( !prototype ) { 11644 prototype = base; 11645 base = $.Widget; 11646 } 11647 11648 // create selector for plugin 11649 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 11650 return !!$.data( elem, fullName ); 11651 }; 11652 11653 $[ namespace ] = $[ namespace ] || {}; 11654 existingConstructor = $[ namespace ][ name ]; 11655 constructor = $[ namespace ][ name ] = function( options, element ) { 11656 // allow instantiation without "new" keyword 11657 if ( !this._createWidget ) { 11658 return new constructor( options, element ); 11659 } 11660 11661 // allow instantiation without initializing for simple inheritance 11662 // must use "new" keyword (the code above always passes args) 11663 if ( arguments.length ) { 11664 this._createWidget( options, element ); 11665 } 11666 }; 11667 // extend with the existing constructor to carry over any static properties 11668 $.extend( constructor, existingConstructor, { 11669 version: prototype.version, 11670 // copy the object used to create the prototype in case we need to 11671 // redefine the widget later 11672 _proto: $.extend( {}, prototype ), 11673 // track widgets that inherit from this widget in case this widget is 11674 // redefined after a widget inherits from it 11675 _childConstructors: [] 11676 }); 11677 11678 basePrototype = new base(); 11679 // we need to make the options hash a property directly on the new instance 11680 // otherwise we'll modify the options hash on the prototype that we're 11681 // inheriting from 11682 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 11683 $.each( prototype, function( prop, value ) { 11684 if ( !$.isFunction( value ) ) { 11685 proxiedPrototype[ prop ] = value; 11686 return; 11687 } 11688 proxiedPrototype[ prop ] = (function() { 11689 var _super = function() { 11690 return base.prototype[ prop ].apply( this, arguments ); 11691 }, 11692 _superApply = function( args ) { 11693 return base.prototype[ prop ].apply( this, args ); 11694 }; 11695 return function() { 11696 var __super = this._super, 11697 __superApply = this._superApply, 11698 returnValue; 11699 11700 this._super = _super; 11701 this._superApply = _superApply; 11702 11703 returnValue = value.apply( this, arguments ); 11704 11705 this._super = __super; 11706 this._superApply = __superApply; 11707 11708 return returnValue; 11709 }; 11710 })(); 11711 }); 11712 constructor.prototype = $.widget.extend( basePrototype, { 11713 // TODO: remove support for widgetEventPrefix 11714 // always use the name + a colon as the prefix, e.g., draggable:start 11715 // don't prefix for widgets that aren't DOM-based 11716 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 11717 }, proxiedPrototype, { 11718 constructor: constructor, 11719 namespace: namespace, 11720 widgetName: name, 11721 widgetFullName: fullName 11722 }); 11723 11724 // If this widget is being redefined then we need to find all widgets that 11725 // are inheriting from it and redefine all of them so that they inherit from 11726 // the new version of this widget. We're essentially trying to replace one 11727 // level in the prototype chain. 11728 if ( existingConstructor ) { 11729 $.each( existingConstructor._childConstructors, function( i, child ) { 11730 var childPrototype = child.prototype; 11731 11732 // redefine the child widget using the same prototype that was 11733 // originally used, but inherit from the new version of the base 11734 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); 11735 }); 11736 // remove the list of existing child constructors from the old constructor 11737 // so the old child constructors can be garbage collected 11738 delete existingConstructor._childConstructors; 11739 } else { 11740 base._childConstructors.push( constructor ); 11741 } 11742 11743 $.widget.bridge( name, constructor ); 11744 11745 return constructor; 11746}; 11747 11748$.widget.extend = function( target ) { 11749 var input = widget_slice.call( arguments, 1 ), 11750 inputIndex = 0, 11751 inputLength = input.length, 11752 key, 11753 value; 11754 for ( ; inputIndex < inputLength; inputIndex++ ) { 11755 for ( key in input[ inputIndex ] ) { 11756 value = input[ inputIndex ][ key ]; 11757 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 11758 // Clone objects 11759 if ( $.isPlainObject( value ) ) { 11760 target[ key ] = $.isPlainObject( target[ key ] ) ? 11761 $.widget.extend( {}, target[ key ], value ) : 11762 // Don't extend strings, arrays, etc. with objects 11763 $.widget.extend( {}, value ); 11764 // Copy everything else by reference 11765 } else { 11766 target[ key ] = value; 11767 } 11768 } 11769 } 11770 } 11771 return target; 11772}; 11773 11774$.widget.bridge = function( name, object ) { 11775 var fullName = object.prototype.widgetFullName || name; 11776 $.fn[ name ] = function( options ) { 11777 var isMethodCall = typeof options === "string", 11778 args = widget_slice.call( arguments, 1 ), 11779 returnValue = this; 11780 11781 if ( isMethodCall ) { 11782 this.each(function() { 11783 var methodValue, 11784 instance = $.data( this, fullName ); 11785 if ( options === "instance" ) { 11786 returnValue = instance; 11787 return false; 11788 } 11789 if ( !instance ) { 11790 return $.error( "cannot call methods on " + name + " prior to initialization; " + 11791 "attempted to call method '" + options + "'" ); 11792 } 11793 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { 11794 return $.error( "no such method '" + options + "' for " + name + " widget instance" ); 11795 } 11796 methodValue = instance[ options ].apply( instance, args ); 11797 if ( methodValue !== instance && methodValue !== undefined ) { 11798 returnValue = methodValue && methodValue.jquery ? 11799 returnValue.pushStack( methodValue.get() ) : 11800 methodValue; 11801 return false; 11802 } 11803 }); 11804 } else { 11805 11806 // Allow multiple hashes to be passed on init 11807 if ( args.length ) { 11808 options = $.widget.extend.apply( null, [ options ].concat(args) ); 11809 } 11810 11811 this.each(function() { 11812 var instance = $.data( this, fullName ); 11813 if ( instance ) { 11814 instance.option( options || {} ); 11815 if ( instance._init ) { 11816 instance._init(); 11817 } 11818 } else { 11819 $.data( this, fullName, new object( options, this ) ); 11820 } 11821 }); 11822 } 11823 11824 return returnValue; 11825 }; 11826}; 11827 11828$.Widget = function( /* options, element */ ) {}; 11829$.Widget._childConstructors = []; 11830 11831$.Widget.prototype = { 11832 widgetName: "widget", 11833 widgetEventPrefix: "", 11834 defaultElement: "<div>", 11835 options: { 11836 disabled: false, 11837 11838 // callbacks 11839 create: null 11840 }, 11841 _createWidget: function( options, element ) { 11842 element = $( element || this.defaultElement || this )[ 0 ]; 11843 this.element = $( element ); 11844 this.uuid = widget_uuid++; 11845 this.eventNamespace = "." + this.widgetName + this.uuid; 11846 11847 this.bindings = $(); 11848 this.hoverable = $(); 11849 this.focusable = $(); 11850 11851 if ( element !== this ) { 11852 $.data( element, this.widgetFullName, this ); 11853 this._on( true, this.element, { 11854 remove: function( event ) { 11855 if ( event.target === element ) { 11856 this.destroy(); 11857 } 11858 } 11859 }); 11860 this.document = $( element.style ? 11861 // element within the document 11862 element.ownerDocument : 11863 // element is window or document 11864 element.document || element ); 11865 this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); 11866 } 11867 11868 this.options = $.widget.extend( {}, 11869 this.options, 11870 this._getCreateOptions(), 11871 options ); 11872 11873 this._create(); 11874 this._trigger( "create", null, this._getCreateEventData() ); 11875 this._init(); 11876 }, 11877 _getCreateOptions: $.noop, 11878 _getCreateEventData: $.noop, 11879 _create: $.noop, 11880 _init: $.noop, 11881 11882 destroy: function() { 11883 this._destroy(); 11884 // we can probably remove the unbind calls in 2.0 11885 // all event bindings should go through this._on() 11886 this.element 11887 .unbind( this.eventNamespace ) 11888 .removeData( this.widgetFullName ) 11889 // support: jquery <1.6.3 11890 // http://bugs.jquery.com/ticket/9413 11891 .removeData( $.camelCase( this.widgetFullName ) ); 11892 this.widget() 11893 .unbind( this.eventNamespace ) 11894 .removeAttr( "aria-disabled" ) 11895 .removeClass( 11896 this.widgetFullName + "-disabled " + 11897 "ui-state-disabled" ); 11898 11899 // clean up events and states 11900 this.bindings.unbind( this.eventNamespace ); 11901 this.hoverable.removeClass( "ui-state-hover" ); 11902 this.focusable.removeClass( "ui-state-focus" ); 11903 }, 11904 _destroy: $.noop, 11905 11906 widget: function() { 11907 return this.element; 11908 }, 11909 11910 option: function( key, value ) { 11911 var options = key, 11912 parts, 11913 curOption, 11914 i; 11915 11916 if ( arguments.length === 0 ) { 11917 // don't return a reference to the internal hash 11918 return $.widget.extend( {}, this.options ); 11919 } 11920 11921 if ( typeof key === "string" ) { 11922 // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 11923 options = {}; 11924 parts = key.split( "." ); 11925 key = parts.shift(); 11926 if ( parts.length ) { 11927 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 11928 for ( i = 0; i < parts.length - 1; i++ ) { 11929 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 11930 curOption = curOption[ parts[ i ] ]; 11931 } 11932 key = parts.pop(); 11933 if ( arguments.length === 1 ) { 11934 return curOption[ key ] === undefined ? null : curOption[ key ]; 11935 } 11936 curOption[ key ] = value; 11937 } else { 11938 if ( arguments.length === 1 ) { 11939 return this.options[ key ] === undefined ? null : this.options[ key ]; 11940 } 11941 options[ key ] = value; 11942 } 11943 } 11944 11945 this._setOptions( options ); 11946 11947 return this; 11948 }, 11949 _setOptions: function( options ) { 11950 var key; 11951 11952 for ( key in options ) { 11953 this._setOption( key, options[ key ] ); 11954 } 11955 11956 return this; 11957 }, 11958 _setOption: function( key, value ) { 11959 this.options[ key ] = value; 11960 11961 if ( key === "disabled" ) { 11962 this.widget() 11963 .toggleClass( this.widgetFullName + "-disabled", !!value ); 11964 11965 // If the widget is becoming disabled, then nothing is interactive 11966 if ( value ) { 11967 this.hoverable.removeClass( "ui-state-hover" ); 11968 this.focusable.removeClass( "ui-state-focus" ); 11969 } 11970 } 11971 11972 return this; 11973 }, 11974 11975 enable: function() { 11976 return this._setOptions({ disabled: false }); 11977 }, 11978 disable: function() { 11979 return this._setOptions({ disabled: true }); 11980 }, 11981 11982 _on: function( suppressDisabledCheck, element, handlers ) { 11983 var delegateElement, 11984 instance = this; 11985 11986 // no suppressDisabledCheck flag, shuffle arguments 11987 if ( typeof suppressDisabledCheck !== "boolean" ) { 11988 handlers = element; 11989 element = suppressDisabledCheck; 11990 suppressDisabledCheck = false; 11991 } 11992 11993 // no element argument, shuffle and use this.element 11994 if ( !handlers ) { 11995 handlers = element; 11996 element = this.element; 11997 delegateElement = this.widget(); 11998 } else { 11999 element = delegateElement = $( element ); 12000 this.bindings = this.bindings.add( element ); 12001 } 12002 12003 $.each( handlers, function( event, handler ) { 12004 function handlerProxy() { 12005 // allow widgets to customize the disabled handling 12006 // - disabled as an array instead of boolean 12007 // - disabled class as method for disabling individual parts 12008 if ( !suppressDisabledCheck && 12009 ( instance.options.disabled === true || 12010 $( this ).hasClass( "ui-state-disabled" ) ) ) { 12011 return; 12012 } 12013 return ( typeof handler === "string" ? instance[ handler ] : handler ) 12014 .apply( instance, arguments ); 12015 } 12016 12017 // copy the guid so direct unbinding works 12018 if ( typeof handler !== "string" ) { 12019 handlerProxy.guid = handler.guid = 12020 handler.guid || handlerProxy.guid || $.guid++; 12021 } 12022 12023 var match = event.match( /^([\w:-]*)\s*(.*)$/ ), 12024 eventName = match[1] + instance.eventNamespace, 12025 selector = match[2]; 12026 if ( selector ) { 12027 delegateElement.delegate( selector, eventName, handlerProxy ); 12028 } else { 12029 element.bind( eventName, handlerProxy ); 12030 } 12031 }); 12032 }, 12033 12034 _off: function( element, eventName ) { 12035 eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + 12036 this.eventNamespace; 12037 element.unbind( eventName ).undelegate( eventName ); 12038 12039 // Clear the stack to avoid memory leaks (#10056) 12040 this.bindings = $( this.bindings.not( element ).get() ); 12041 this.focusable = $( this.focusable.not( element ).get() ); 12042 this.hoverable = $( this.hoverable.not( element ).get() ); 12043 }, 12044 12045 _delay: function( handler, delay ) { 12046 function handlerProxy() { 12047 return ( typeof handler === "string" ? instance[ handler ] : handler ) 12048 .apply( instance, arguments ); 12049 } 12050 var instance = this; 12051 return setTimeout( handlerProxy, delay || 0 ); 12052 }, 12053 12054 _hoverable: function( element ) { 12055 this.hoverable = this.hoverable.add( element ); 12056 this._on( element, { 12057 mouseenter: function( event ) { 12058 $( event.currentTarget ).addClass( "ui-state-hover" ); 12059 }, 12060 mouseleave: function( event ) { 12061 $( event.currentTarget ).removeClass( "ui-state-hover" ); 12062 } 12063 }); 12064 }, 12065 12066 _focusable: function( element ) { 12067 this.focusable = this.focusable.add( element ); 12068 this._on( element, { 12069 focusin: function( event ) { 12070 $( event.currentTarget ).addClass( "ui-state-focus" ); 12071 }, 12072 focusout: function( event ) { 12073 $( event.currentTarget ).removeClass( "ui-state-focus" ); 12074 } 12075 }); 12076 }, 12077 12078 _trigger: function( type, event, data ) { 12079 var prop, orig, 12080 callback = this.options[ type ]; 12081 12082 data = data || {}; 12083 event = $.Event( event ); 12084 event.type = ( type === this.widgetEventPrefix ? 12085 type : 12086 this.widgetEventPrefix + type ).toLowerCase(); 12087 // the original event may come from any element 12088 // so we need to reset the target on the new event 12089 event.target = this.element[ 0 ]; 12090 12091 // copy original event properties over to the new event 12092 orig = event.originalEvent; 12093 if ( orig ) { 12094 for ( prop in orig ) { 12095 if ( !( prop in event ) ) { 12096 event[ prop ] = orig[ prop ]; 12097 } 12098 } 12099 } 12100 12101 this.element.trigger( event, data ); 12102 return !( $.isFunction( callback ) && 12103 callback.apply( this.element[0], [ event ].concat( data ) ) === false || 12104 event.isDefaultPrevented() ); 12105 } 12106}; 12107 12108$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 12109 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 12110 if ( typeof options === "string" ) { 12111 options = { effect: options }; 12112 } 12113 var hasOptions, 12114 effectName = !options ? 12115 method : 12116 options === true || typeof options === "number" ? 12117 defaultEffect : 12118 options.effect || defaultEffect; 12119 options = options || {}; 12120 if ( typeof options === "number" ) { 12121 options = { duration: options }; 12122 } 12123 hasOptions = !$.isEmptyObject( options ); 12124 options.complete = callback; 12125 if ( options.delay ) { 12126 element.delay( options.delay ); 12127 } 12128 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 12129 element[ method ]( options ); 12130 } else if ( effectName !== method && element[ effectName ] ) { 12131 element[ effectName ]( options.duration, options.easing, callback ); 12132 } else { 12133 element.queue(function( next ) { 12134 $( this )[ method ](); 12135 if ( callback ) { 12136 callback.call( element[ 0 ] ); 12137 } 12138 next(); 12139 }); 12140 } 12141 }; 12142}); 12143 12144var widget = $.widget; 12145 12146
12147 12148})); 12149/* 12150 * jQuery Iframe Transport Plugin 12151 * https://github.com/blueimp/jQuery-File-Upload 12152 * 12153 * Copyright 2011, Sebastian Tschan 12154 * https://blueimp.net 12155 * 12156 * Licensed under the MIT license: 12157 * http://www.opensource.org/licenses/MIT 12158 */ 12159 12160/* global define, require, window, document */ 12161 12162 12163;(function (factory) { 12164 'use strict'; 12165 if (typeof define === 'function' && define.amd) { 12166 // Register as an anonymous AMD module: 12167 define(['jquery'], factory); 12168 } else if (typeof exports === 'object') { 12169 // Node/CommonJS: 12170 factory(require('jquery')); 12171 } else { 12172 // Browser globals: 12173 factory(window.jQuery); 12174 } 12175}(function ($) { 12176 'use strict'; 12177 12178 // Helper variable to create unique names for the transport iframes: 12179 var counter = 0; 12180 12181 // The iframe transport accepts four additional options: 12182 // options.fileInput: a jQuery collection of file input fields 12183 // options.paramName: the parameter name for the file form data, 12184 // overrides the name property of the file input field(s), 12185 // can be a string or an array of strings. 12186 // options.formData: an array of objects with name and value properties, 12187 // equivalent to the return data of .serializeArray(), e.g.: 12188 // [{name: 'a', value: 1}, {name: 'b', value: 2}] 12189 // options.initialIframeSrc: the URL of the initial iframe src, 12190 // by default set to "javascript:false;" 12191 $.ajaxTransport('iframe', function (options) { 12192 if (options.async) { 12193 // javascript:false as initial iframe src 12194 // prevents warning popups on HTTPS in IE6: 12195 /*jshint scripturl: true */ 12196 var initialIframeSrc = options.initialIframeSrc || 'javascript:false;', 12197 /*jshint scripturl: false */ 12198 form, 12199 iframe, 12200 addParamChar; 12201 return { 12202 send: function (_, completeCallback) { 12203 form = $('<form style="display:none;"></form>'); 12204 form.attr('accept-charset', options.formAcceptCharset); 12205 addParamChar = /\?/.test(options.url) ? '&' : '?'; 12206 // XDomainRequest only supports GET and POST: 12207 if (options.type === 'DELETE') { 12208 options.url = options.url + addParamChar + '_method=DELETE'; 12209 options.type = 'POST'; 12210 } else if (options.type === 'PUT') { 12211 options.url = options.url + addParamChar + '_method=PUT'; 12212 options.type = 'POST'; 12213 } else if (options.type === 'PATCH') { 12214 options.url = options.url + addParamChar + '_method=PATCH'; 12215 options.type = 'POST'; 12216 } 12217 // IE versions below IE8 cannot set the name property of 12218 // elements that have already been added to the DOM, 12219 // so we set the name along with the iframe HTML markup: 12220 counter += 1; 12221 iframe = $( 12222 '<iframe src="' + initialIframeSrc + 12223 '" name="iframe-transport-' + counter + '"></iframe>' 12224 ).bind('load', function () { 12225 var fileInputClones, 12226 paramNames = $.isArray(options.paramName) ? 12227 options.paramName : [options.paramName]; 12228 iframe 12229 .unbind('load') 12230 .bind('load', function () { 12231 var response; 12232 // Wrap in a try/catch block to catch exceptions thrown 12233 // when trying to access cross-domain iframe contents: 12234 try { 12235 response = iframe.contents(); 12236 // Google Chrome and Firefox do not throw an 12237 // exception when calling iframe.contents() on 12238 // cross-domain requests, so we unify the response: 12239 if (!response.length || !response[0].firstChild) { 12240 throw new Error(); 12241 } 12242 } catch (e) { 12243 response = undefined; 12244 } 12245 // The complete callback returns the 12246 // iframe content document as response object: 12247 completeCallback( 12248 200, 12249 'success', 12250 {'iframe': response} 12251 ); 12252 // Fix for IE endless progress bar activity bug 12253 // (happens on form submits to iframe targets): 12254 $('<iframe src="' + initialIframeSrc + '"></iframe>') 12255 .appendTo(form); 12256 window.setTimeout(function () { 12257 // Removing the form in a setTimeout call 12258 // allows Chrome's developer tools to display 12259 // the response result 12260 form.remove(); 12261 }, 0); 12262 }); 12263 form 12264 .prop('target', iframe.prop('name')) 12265 .prop('action', options.url) 12266 .prop('method', options.type); 12267 if (options.formData) { 12268 $.each(options.formData, function (index, field) { 12269 $('<input type="hidden"/>') 12270 .prop('name', field.name) 12271 .val(field.value) 12272 .appendTo(form); 12273 }); 12274 } 12275 if (options.fileInput && options.fileInput.length && 12276 options.type === 'POST') { 12277 fileInputClones = options.fileInput.clone(); 12278 // Insert a clone for each file input field: 12279 options.fileInput.after(function (index) { 12280 return fileInputClones[index]; 12281 }); 12282 if (options.paramName) { 12283 options.fileInput.each(function (index) { 12284 $(this).prop( 12285 'name', 12286 paramNames[index] || options.paramName 12287 ); 12288 }); 12289 } 12290 // Appending the file input fields to the hidden form 12291 // removes them from their original location: 12292 form 12293 .append(options.fileInput) 12294 .prop('enctype', 'multipart/form-data') 12295 // enctype must be set as encoding for IE: 12296 .prop('encoding', 'multipart/form-data'); 12297 // Remove the HTML5 form attribute from the input(s): 12298 options.fileInput.removeAttr('form'); 12299 } 12300 form.submit(); 12301 // Insert the file input fields at their original location 12302 // by replacing the clones with the originals: 12303 if (fileInputClones && fileInputClones.length) { 12304 options.fileInput.each(function (index, input) { 12305 var clone = $(fileInputClones[index]); 12306 // Restore the original name and form properties: 12307 $(input) 12308 .prop('name', clone.prop('name')) 12309 .attr('form', clone.attr('form')); 12310 clone.replaceWith(input); 12311 }); 12312 } 12313 }); 12314 form.append(iframe).appendTo(document.body); 12315 }, 12316 abort: function () { 12317 if (iframe) { 12318 // javascript:false as iframe src aborts the request 12319 // and prevents warning popups on HTTPS in IE6. 12320 // concat is used to avoid the "Script URL" JSLint error: 12321 iframe 12322 .unbind('load') 12323 .prop('src', initialIframeSrc); 12324 } 12325 if (form) { 12326 form.remove(); 12327 } 12328 } 12329 }; 12330 } 12331 }); 12332 12333 // The iframe transport returns the iframe content document as response. 12334 // The following adds converters from iframe to text, json, html, xml 12335 // and script. 12336 // Please note that the Content-Type for JSON responses has to be text/plain 12337 // or text/html, if the browser doesn't include application/json in the 12338 // Accept header, else IE will show a download dialog. 12339 // The Content-Type for XML responses on the other hand has to be al
12339ways 12340 // application/xml or text/xml, so IE properly parses the XML response. 12341 // See also 12342 // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation 12343 $.ajaxSetup({ 12344 converters: { 12345 'iframe text': function (iframe) { 12346 return iframe && $(iframe[0].body).text(); 12347 }, 12348 'iframe json': function (iframe) { 12349 return iframe && $.parseJSON($(iframe[0].body).text()); 12350 }, 12351 'iframe html': function (iframe) { 12352 return iframe && $(iframe[0].body).html(); 12353 }, 12354 'iframe xml': function (iframe) { 12355 var xmlDoc = iframe && iframe[0]; 12356 return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : 12357 $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || 12358 $(xmlDoc.body).html()); 12359 }, 12360 'iframe script': function (iframe) { 12361 return iframe && $.globalEval($(iframe[0].body).text()); 12362 } 12363 } 12364 }); 12365 12366})); 12367/* 12368 * jQuery File Upload Plugin 12369 * https://github.com/blueimp/jQuery-File-Upload 12370 * 12371 * Copyright 2010, Sebastian Tschan 12372 * https://blueimp.net 12373 * 12374 * Licensed under the MIT license: 12375 * http://www.opensource.org/licenses/MIT 12376 */ 12377 12378/* jshint nomen:false */ 12379/* global define, require, window, document, location, Blob, FormData */ 12380 12381 12382;(function (factory) { 12383 'use strict'; 12384 if (typeof define === 'function' && define.amd) { 12385 // Register as an anonymous AMD module: 12386 define([ 12387 'jquery', 12388 'jquery.ui.widget' 12389 ], factory); 12390 } else if (typeof exports === 'object') { 12391 // Node/CommonJS: 12392 factory( 12393 require('jquery'), 12394 require('./vendor/jquery.ui.widget') 12395 ); 12396 } else { 12397 // Browser globals: 12398 factory(window.jQuery); 12399 } 12400}(function ($) { 12401 'use strict'; 12402 12403 // Detect file input support, based on 12404 // http://viljamis.com/blog/2012/file-upload-support-on-mobile/ 12405 $.support.fileInput = !(new RegExp( 12406 // Handle devices which give false positives for the feature detection: 12407 '(Android (1\\.[0156]|2\\.[01]))' + 12408 '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + 12409 '|(w(eb)?OSBrowser)|(webOS)' + 12410 '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' 12411 ).test(window.navigator.userAgent) || 12412 // Feature detection for all other devices: 12413 $('<input type="file">').prop('disabled')); 12414 12415 // The FileReader API is not actually used, but works as feature detection, 12416 // as some Safari versions (5?) support XHR file uploads via the FormData API, 12417 // but not non-multipart XHR file uploads. 12418 // window.XMLHttpRequestUpload is not available on IE10, so we check for 12419 // window.ProgressEvent instead to detect XHR2 file upload capability: 12420 $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader); 12421 $.support.xhrFormDataFileUpload = !!window.FormData; 12422 12423 // Detect support for Blob slicing (required for chunked uploads): 12424 $.support.blobSlice = window.Blob && (Blob.prototype.slice || 12425 Blob.prototype.webkitSlice || Blob.prototype.mozSlice); 12426 12427 // Helper function to create drag handlers for dragover/dragenter/dragleave: 12428 function getDragHandler(type) { 12429 var isDragOver = type === 'dragover'; 12430 return function (e) { 12431 e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; 12432 var dataTransfer = e.dataTransfer; 12433 if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && 12434 this._trigger( 12435 type, 12436 $.Event(type, {delegatedEvent: e}) 12437 ) !== false) { 12438 e.preventDefault(); 12439 if (isDragOver) { 12440 dataTransfer.dropEffect = 'copy'; 12441 } 12442 } 12443 }; 12444 } 12445 12446 // The fileupload widget listens for change events on file input fields defined 12447 // via fileInput setting and paste or drop events of the given dropZone. 12448 // In addition to the default jQuery Widget methods, the fileupload widget 12449 // exposes the "add" and "send" methods, to add or directly send files using 12450 // the fileupload API. 12451 // By default, files added via file input selection, paste, drag & drop or 12452 // "add" method are uploaded immediately, but it is possible to override 12453 // the "add" callback option to queue file uploads. 12454 $.widget('blueimp.fileupload', { 12455 12456 options: {
12457 // The drop target element(s), by the default the complete document. 12458 // Set to null to disable drag & drop support: 12459 dropZone: $(document), 12460 // The paste target element(s), by the default undefined. 12461 // Set to a DOM node or jQuery object to enable file pasting: 12462 pasteZone: undefined, 12463 // The file input field(s), that are listened to for change events. 12464 // If undefined, it is set to the file input fields inside 12465 // of the widget element on plugin initialization. 12466 // Set to null to disable the change listener. 12467 fileInput: undefined, 12468 // By default, the file input field is replaced with a clone after 12469 // each input field change event. This is required for iframe transport 12470 // queues and allows change events to be fired for the same file 12471 // selection, but can be disabled by setting the following option to false: 12472 replaceFileInput: true, 12473 // The parameter name for the file form data (the request argument name). 12474 // If undefined or empty, the name property of the file input field is 12475 // used, or "files[]" if the file input name property is also empty, 12476 // can be a string or an array of strings: 12477 paramName: undefined, 12478 // By default, each file of a selection is uploaded using an individual 12479 // request for XHR type uploads. Set to false to upload file 12480 // selections in one request each: 12481 singleFileUploads: true, 12482 // To limit the number of files uploaded with one XHR request, 12483 // set the following option to an integer greater than 0: 12484 limitMultiFileUploads: undefined, 12485 // The following option limits the number of files uploaded with one 12486 // XHR request to keep the request size under or equal to the defined 12487 // limit in bytes: 12488 limitMultiFileUploadSize: undefined, 12489 // Multipart file uploads add a number of bytes to each uploaded file, 12490 // therefore the following option adds an overhead for each file used 12491 // in the limitMultiFileUploadSize configuration: 12492 limitMultiFileUploadSizeOverhead: 512, 12493 // Set the following option to true to issue all file upload requests 12494 // in a sequential order: 12495 sequentialUploads: false, 12496 // To limit the number of concurrent uploads, 12497 // set the following option to an integer greater than 0: 12498 limitConcurrentUploads: undefined, 12499 // Set the following option to true to force iframe transport uploads: 12500 forceIframeTransport: false, 12501 // Set the following option to the location of a redirect url on the 12502 // origin server, for cross-domain iframe transport uploads: 12503 redirect: undefined, 12504 // The parameter name for the redirect url, sent as part of the form 12505 // data and set to 'redirect' if this option is empty: 12506 redirectParamName: undefined, 12507 // Set the following option to the location of a postMessage window, 12508 // to enable postMessage transport uploads: 12509 postMessage: undefined, 12510 // By default, XHR file uploads are sent as multipart/form-data. 12511 // The iframe transport is always using multipart/form-data. 12512 // Set to false to enable non-multipart XHR uploads: 12513 multipart: true, 12514 // To upload large files in smaller chunks, set the following option 12515 // to a preferred maximum chunk size. If set to 0, null or undefined, 12516 // or the browser does not support the required Blob API, files will 12517 // be uploaded as a whole. 12518 maxChunkSize: undefined, 12519 // When a non-multipart upload or a chunked multipart upload has been 12520 // aborted, this option can be used to resume the upload by setting 12521 // it to the size of the already uploaded bytes. This option is most 12522 // useful when modifying the options object inside of the "add" or 12523 // "send" callbacks, as the options are cloned for each file upload. 12524 uploadedBytes: undefined, 12525 // By default, failed (abort or error) file uploads are removed from the 12526 // global progress calculation. Set the following option to fal
12526se to 12527 // prevent recalculating the global progress data: 12528 recalculateProgress: true, 12529 // Interval in milliseconds to calculate and trigger progress events: 12530 progressInterval: 100, 12531 // Interval in milliseconds to calculate progress bitrate: 12532 bitrateInterval: 500, 12533 // By default, uploads are started automatically when adding files: 12534 autoUpload: true, 12535 12536 // Error and info messages: 12537 messages: { 12538 uploadedBytes: 'Uploaded bytes exceed file size' 12539 }, 12540 12541 // Translation function, gets the message key to be translated 12542 // and an object with context specific data as arguments: 12543 i18n: function (message, context) { 12544 message = this.messages[message] || message.toString(); 12545 if (context) { 12546 $.each(context, function (key, value) { 12547 message = message.replace('{' + key + '}', value); 12548 }); 12549 } 12550 return message; 12551 }, 12552 12553 // Additional form data to be sent along with the file uploads can be set 12554 // using this option, which accepts an array of objects with name and 12555 // value properties, a function returning such an array, a FormData 12556 // object (for XHR file uploads), or a simple object. 12557 // The form of the first fileInput is given as parameter to the function: 12558 formData: function (form) { 12559 return form.serializeArray(); 12560 }, 12561 12562 // The add callback is invoked as soon as files are added to the fileupload 12563 // widget (via file input selection, drag & drop, paste or add API call). 12564 // If the singleFileUploads option is enabled, this callback will be 12565 // called once for each file in the selection for XHR file uploads, else 12566 // once for each file selection. 12567 // 12568 // The upload starts when the submit method is invoked on the data parameter. 12569 // The data object contains a files property holding the added files 12570 // and allows you to override plugin options as well as define ajax settings. 12571 // 12572 // Listeners for this callback can also be bound the following way: 12573 // .bind('fileuploadadd', func); 12574 // 12575 // data.submit() returns a Promise object and allows to attach additional 12576 // handlers using jQuery's Deferred callbacks: 12577 // data.submit().done(func).fail(func).always(func); 12578 add: function (e, data) { 12579 if (e.isDefaultPrevented()) { 12580 return false; 12581 } 12582 if (data.autoUpload || (data.autoUpload !== false && 12583 $(this).fileupload('option', 'autoUpload'))) { 12584 data.process().done(function () { 12585 data.submit(); 12586 }); 12587 } 12588 }, 12589 12590 // Other callbacks: 12591 12592 // Callback for the submit event of each file upload: 12593 // submit: function (e, data) {}, // .bind('fileuploadsubmit', func); 12594 12595 // Callback for the start of each file upload request: 12596 // send: function (e, data) {}, // .bind('fileuploadsend', func); 12597 12598 // Callback for successful uploads: 12599 // done: function (e, data) {}, // .bind('fileuploaddone', func); 12600 12601 // Callback for failed (abort or error) uploads: 12602 // fail: function (e, data) {}, // .bind('fileuploadfail', func); 12603 12604 // Callback for completed (success, abort or error) requests: 12605 // always: function (e, data) {}, // .bind('fileuploadalways', func); 12606 12607 // Callback for upload progress events: 12608 // progress: function (e, data) {}, // .bind('fileuploadprogress', func); 12609 12610 // Callback for global upload progress events: 12611 // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func); 12612 12613 // Callback for uploads start, equivalent to the global ajaxStart event: 12614 // start: function (e) {}, // .bind('fileuploadstart', func); 12615 12616 // Callback for uploads stop, equivalent to the global ajaxStop event: 12617 // stop: function (e) {}, // .bind('fileuploadstop', func); 12618 12619 // Callback for change events of the fileInput(s): 12620 // change: function (e, data) {}, // .bind('fileuploadchange', func); 12621 12622 // Callback for paste events to the pasteZone(s): 12623 // paste: function (e, data) {}, // .bind('fileuploadpaste', func); 12624 12625 // Callback for drop events of the dropZone(s): 12626 // drop: function (e, data) {}, // .bind('fileuploaddrop', func); 12627 12628 // Callback for dragover events of the dropZone(s): 12629 // dragover: function (e) {}, // .bind('fileuploaddragover', func); 12630 12631 // Callback for the start of each chunk upload request: 12632 // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func); 12633 12634 // Callback for successful chunk uploads: 12635 // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func); 12636 12637 // Callback for failed (abort or error) chunk uploads: 12638 // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func); 12639 12640 // Callback for completed (success, abort or error) chunk upload requests: 12641 // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func); 12642 12643 // The plugin options are used as settings object for the ajax calls. 12644 // The following are jQuery ajax settings required for the file uploads: 12645 processData: false, 12646 contentType: false, 12647 cache: false, 12648 timeout: 0 12649 }, 12650 12651 // A list of options that require reinitializing event listeners and/or 12652 // special initialization code: 12653 _specialOptions: [ 12654 'fileInput', 12655 'dropZone', 12656 'pasteZone', 12657 'multipart', 12658 'forceIframeTransport' 12659 ], 12660 12661 _blobSlice: $.support.blobSlice && function () { 12662 var slice = this.slice || this.webkitSlice || this.mozSlice; 12663 return slice.apply(this, arguments); 12664 }, 12665 12666 _BitrateTimer: function () { 12667 this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime()); 12668 this.loaded = 0; 12669 this.bitrate = 0; 12670 this.getBitrate = function (now, loaded, interval) { 12671 var timeDiff = now - this.timestamp; 12672 if (!this.bitrate || !interval || timeDiff > interval) { 12673 this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8; 12674 this.loaded = loaded; 12675 this.timestamp = now; 12676 } 12677 return this.bitrate; 12678 }; 12679 }, 12680 12681 _isXHRUpload: function (options) { 12682 return !options.forceIframeTransport && 12683 ((!options.multipart && $.support.xhrFileUpload) || 12684 $.support.xhrFormDataFileUpload); 12685 }, 12686 12687 _getFormData: function (options) { 12688 var formData; 12689 if ($.type(options.formData) === 'function') { 12690 return options.formData(options.form); 12691 } 12692 if ($.isArray(options.formData)) { 12693 return options.formData; 12694 } 12695 if ($.type(options.formData) === 'object') { 12696 formData = []; 12697 $.each(options.formData, function (name, value) { 12698 formData.push({name: name, value: value}); 12699 }); 12700 return formData; 12701 } 12702 return []; 12703 }, 12704 12705 _getTotal: function (files) { 12706 var total = 0; 12707 $.each(files, function (index, file) { 12708 total += file.size || 1; 12709 }); 12710 return total; 12711 }, 12712 12713 _initProgressObject: function (obj) { 12714 var progress = { 12715 loaded: 0, 12716 total: 0, 12717 bitrate: 0 12718 }; 12719 if (obj._progress) { 12720 $.extend(obj._progress, progress); 12721 } else { 12722 obj._progress = progress; 12723 } 12724 }, 12725 12726 _initResponseObject: function (obj) { 12727 var prop; 12728 if (obj._response) { 12729 for (prop in obj._response) { 12730 if (obj._response.hasOwnProperty(prop)) { 12731 delete obj._response[prop]; 12732 } 12733 } 12734 } else { 12735 obj._response = {}; 12736 } 12737 }, 12738 12739 _onProgress: function (e, data) { 12740 if (e.lengthComputable) { 12741 var now = ((Date.now) ? Date.now() : (new Date()).getTime()), 12742 loaded; 12743 if (data._time && data.progressInterval && 12744 (now - data._time < data.progressInterval) && 12745 e.loaded !== e.total) { 12746 return; 12747 } 12748 data._time = now; 12749 loaded = Math.floor( 12750 e.loaded / e.total * (data.chunkSize || data._progress.total) 12751 ) + (data.uploadedBytes || 0); 12752 // Add the difference from the previously loaded state 12753 // to the global loaded counter: 12754 this._progress.loaded += (loaded - data._progress.loaded); 12755 this._progress.bitrate = this._bitrateTimer.getBitrate( 12756 now, 12757 this._progress.loaded, 12758 data.bitrateInterval 12759 ); 12760 data._progress.loaded = data.loaded = loaded; 12761 data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate( 12762 now, 12763 loaded, 12764 data.bitrateInterval 12765 ); 12766 // Trigger a custom progress event with a total data property set 12767 // to the file size(s) of the current upload and a loaded data 12768 // property calculated accordingly: 12769 this._trigger( 12770 'progress', 12771 $.Event('progress', {delegatedEvent: e}), 12772 data 12773 ); 12774 // Trigger a global progress event for all current file uploads, 12775 // including ajax calls queued for sequential file uploads: 12776 this._trigger( 12777 'progressall', 12778 $.Event('progressall', {delegatedEvent: e}), 12779 this._progress 12780 ); 12781 } 12782 }, 12783 12784 _initProgressListener: function (options) { 12785 var that = this, 12786 xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); 12787 // Accesss to the native XHR object is required to add event listeners 12788 // for the upload progress event: 12789 if (xhr.upload) { 12790 $(xhr.upload).bind('progress', function (e) { 12791 var oe = e.originalEvent; 12792 // Make sure the progress event properties get copied over: 12793 e.lengthComputable = oe.lengthComputable; 12794 e.loaded = oe.loaded; 12795 e.total = oe.total; 12796 that._onProgress(e, options); 12797 }); 12798 options.xhr = function () { 12799 return xhr; 12800 }; 12801 } 12802 }, 12803 12804 _isInstanceOf: function (type, obj) { 12805 // Cross-frame instanceof check 12806 return Object.prototype.toString.call(obj) === '[object ' + type + ']'; 12807 }, 12808 12809 _initXHRData: function (options) { 12810 var that = this, 12811 formData, 12812 file = options.files[0], 12813 // Ignore non-multipart setting if not supported:
12814 multipart = options.multipart || !$.support.xhrFileUpload, 12815 paramName = $.type(options.paramName) === 'array' ? 12816 options.paramName[0] : options.paramName; 12817 options.headers = $.extend({}, options.headers); 12818 if (options.contentRange) { 12819 options.headers['Content-Range'] = options.contentRange; 12820 } 12821 if (!multipart || options.blob || !this._isInstanceOf('File', file)) { 12822 options.headers['Content-Disposition'] = 'attachment; filename="' + 12823 encodeURI(file.name) + '"'; 12824 } 12825 if (!multipart) { 12826 options.contentType = file.type || 'application/octet-stream'; 12827 options.data = options.blob || file; 12828 } else if ($.support.xhrFormDataFileUpload) { 12829 if (options.postMessage) { 12830 // window.postMessage does not allow sending FormData 12831 // objects, so we just add the File/Blob objects to 12832 // the formData array and let the postMessage window 12833 // create the FormData object out of this array: 12834 formData = this._getFormData(options); 12835 if (options.blob) { 12836 formData.push({ 12837 name: paramName, 12838 value: options.blob 12839 }); 12840 } else { 12841 $.each(options.files, function (index, file) { 12842 formData.push({ 12843 name: ($.type(options.paramName) === 'array' && 12844 options.paramName[index]) || paramName, 12845 value: file 12846 }); 12847 }); 12848 } 12849 } else { 12850 if (that._isInstanceOf('FormData', options.formData)) { 12851 formData = options.formData; 12852 } else { 12853 formData = new FormData(); 12854 $.each(this._getFormData(options), function (index, field) { 12855 formData.append(field.name, field.value); 12856 }); 12857 } 12858 if (options.blob) { 12859 formData.append(paramName, options.blob, file.name); 12860 } else { 12861 $.each(options.files, function (index, file) { 12862 // This check allows the tests to run with 12863 // dummy objects: 12864 if (that._isInstanceOf('File', file) || 12865 that._isInstanceOf('Blob', file)) { 12866 formData.append( 12867 ($.type(options.paramName) === 'array' && 12868 options.paramName[index]) || paramName, 12869 file, 12870 file.uploadName || file.name 12871 ); 12872 } 12873 }); 12874 } 12875 } 12876 options.data = formData; 12877 } 12878 // Blob reference is not needed anymore, free memory: 12879 options.blob = null; 12880 }, 12881 12882 _initIframeSettings: function (options) { 12883 var targetHost = $('<a></a>').prop('href', options.url).prop('host'); 12884 // Setting the dataType to iframe enables the iframe transport: 12885 options.dataType = 'iframe ' + (options.dataType || ''); 12886 // The iframe transport accepts a serialized array as form data: 12887 options.formData = this._getFormData(options); 12888 // Add redirect url to form data on cross-domain uploads: 12889 if (options.redirect && targetHost && targetHost !== location.host) { 12890 options.formData.push({ 12891 name: options.redirectParamName || 'redirect', 12892 value: options.redirect 12893 }); 12894 } 12895 }, 12896 12897 _initDataSettings: function (options) { 12898 if (this._isXHRUpload(options)) { 12899 if (!this._chunkedUpload(options, true)) { 12900 if (!options.data) { 12901 this._initXHRData(options); 12902 } 12903 this._initProgressListener(options); 12904 } 12905 if (options.postMessage) { 12906 // Setting the dataType to postmessage enables the 12907 // postMessage transport: 12908 options.dataType = 'postmessage ' + (options.dataType || ''); 12909 } 12910 } else { 12911 this._initIframeSettings(options); 12912 } 12913 }, 12914 12915 _getParamName: function (options) { 12916 var fileInput = $(options.fileInput), 12917 paramName = options.paramName; 12918 if (!paramName) { 12919 paramName = []; 12920 fileInput.each(function () { 12921 var input = $(this), 12922 name = input.prop('name') || 'files[]', 12923 i = (input.prop('files') || [1]).length; 12924 while (i) { 12925 paramName.push(name); 12926 i -= 1; 12927 } 12928 }); 12929 if (!paramName.length) { 12930 paramName = [fileInput.prop('name') || 'files[]']; 12931 } 12932 } else if (!$.isArray(paramName)) { 12933 paramName = [paramName]; 12934 } 12935 return paramName; 12936 }, 12937 12938 _initFormSettings: function (options) { 12939 // Retrieve missing options from the input field and the 12940 // associated form, if available: 12941 if (!options.form || !options.form.length) { 12942 options.form = $(options.fileInput.prop('form')); 12943 // If the given file input doesn't have an associated form, 12944 // use the default widget file input's form: 12945 if (!options.form.length) { 12946 options.form = $(this.options.fileInput.prop('form')); 12947 } 12948 } 12949 options.paramName = this._getParamName(options); 12950 if (!options.url) { 12951 options.url = options.form.prop('action') || location.href; 12952 } 12953 // The HTTP request method must be "POST" or "PUT": 12954 options.type = (options.type || 12955 ($.type(options.form.prop('method')) === 'string' && 12956 options.form.prop('method')) || '' 12957 ).toUpperCase(); 12958 if (options.type !== 'POST' && options.type !== 'PUT' && 12959 options.type !== 'PATCH') { 12960 options.type = 'POST'; 12961 } 12962 if (!options.formAcceptCharset) { 12963 options.formAcceptCharset = options.form.attr('accept-charset'); 12964 } 12965 }, 12966 12967 _getAJAXSettings: function (data) { 12968 var options = $.extend({}, this.options, data); 12969 this._initFormSettings(options); 12970 this._initDataSettings(options); 12971 return options; 12972 }, 12973 12974 // jQuery 1.6 doesn't provide .state(), 12975 // while jQuery 1.8+ removed .isRejected() and .isResolved(): 12976 _getDeferredState: function (deferred) { 12977 if (deferred.state) { 12978 return deferred.state(); 12979 } 12980 if (deferred.isResolved()) { 12981 return 'resolved'; 12982 } 12983 if (deferred.isRejected()) { 12984 return 'rejected'; 12985 } 12986 return 'pending'; 12987 }, 12988 12989 // Maps jqXHR callbacks to the equivalent 12990 // methods of the given Promise object: 12991 _enhancePromise: function (promise) { 12992 promise.success = promise.done; 12993 promise.error = promise.fail; 12994 promise.complete = promise.always; 12995 return promise; 12996 }, 12997 12998 // Creates and returns a Promise object enhanced with 12999 // the jqXHR methods abort, success, error and complete: 13000 _getXHRPromise: function (resolveOrReject, context, args
13000) { 13001 var dfd = $.Deferred(), 13002 promise = dfd.promise(); 13003 context = context || this.options.context || promise; 13004 if (resolveOrReject === true) { 13005 dfd.resolveWith(context, args); 13006 } else if (resolveOrReject === false) { 13007 dfd.rejectWith(context, args); 13008 } 13009 promise.abort = dfd.promise; 13010 return this._enhancePromise(promise); 13011 }, 13012 13013 // Adds convenience methods to the data callback argument: 13014 _addConvenienceMethods: function (e, data) { 13015 var that = this, 13016 getPromise = function (args) { 13017 return $.Deferred().resolveWith(that, args).promise(); 13018 }; 13019 data.process = function (resolveFunc, rejectFunc) { 13020 if (resolveFunc || rejectFunc) { 13021 data._processQueue = this._processQueue = 13022 (this._processQueue || getPromise([this])).then( 13023 function () { 13024 if (data.errorThrown) { 13025 return $.Deferred() 13026 .rejectWith(that, [data]).promise(); 13027 } 13028 return getPromise(arguments); 13029 } 13030 ).then(resolveFunc, rejectFunc); 13031 } 13032 return this._processQueue || getPromise([this]); 13033 }; 13034 data.submit = function () { 13035 if (this.state() !== 'pending') { 13036 data.jqXHR = this.jqXHR = 13037 (that._trigger( 13038 'submit', 13039 $.Event('submit', {delegatedEvent: e}), 13040 this 13041 ) !== false) && that._onSend(e, this); 13042 } 13043 return this.jqXHR || that._getXHRPromise(); 13044 }; 13045 data.abort = function () { 13046 if (this.jqXHR) { 13047 return this.jqXHR.abort(); 13048 } 13049 this.errorThrown = 'abort'; 13050 that._trigger('fail', null, this); 13051 return that._getXHRPromise(false); 13052 }; 13053 data.state = function () { 13054 if (this.jqXHR) { 13055 return that._getDeferredState(this.jqXHR); 13056 } 13057 if (this._processQueue) { 13058 return that._getDeferredState(this._processQueue); 13059 } 13060 }; 13061 data.processing = function () { 13062 return !this.jqXHR && this._processQueue && that 13063 ._getDeferredState(this._processQueue) === 'pending'; 13064 }; 13065 data.progress = function () { 13066 return this._progress; 13067 }; 13068 data.response = function () { 13069 return this._response; 13070 }; 13071 }, 13072 13073 // Parses the Range header from the server response 13074 // and returns the uploaded bytes: 13075 _getUploadedBytes: function (jqXHR) { 13076 var range = jqXHR.getResponseHeader('Range'), 13077 parts = range && range.split('-'), 13078 upperBytesPos = parts && parts.length > 1 && 13079 parseInt(parts[1], 10); 13080 return upperBytesPos && upperBytesPos + 1; 13081 }, 13082 13083 // Uploads a file in multiple, sequential requests 13084 // by splitting the file up in multiple blob chunks. 13085 // If the second parameter is true, only tests if the file 13086 // should be uploaded in chunks, but does not invoke any 13087 // upload requests: 13088 _chunkedUpload: function (options, testOnly) { 13089 options.uploadedBytes = options.uploadedBytes || 0; 13090 var that = this, 13091 file = options.files[0], 13092 fs = file.size, 13093 ub = options.uploadedBytes, 13094 mcs = options.maxChunkSize || fs, 13095 slice = this._blobSlice, 13096 dfd = $.Deferred(), 13097 promise = dfd.promise(), 13098 jqXHR, 13099 upload; 13100 if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) || 13101 options.data) { 13102 return false;
13103 } 13104 if (testOnly) { 13105 return true; 13106 } 13107 if (ub >= fs) { 13108 file.error = options.i18n('uploadedBytes'); 13109 return this._getXHRPromise( 13110 false, 13111 options.context, 13112 [null, 'error', file.error] 13113 ); 13114 } 13115 // The chunk upload method: 13116 upload = function () { 13117 // Clone the options object for each chunk upload: 13118 var o = $.extend({}, options), 13119 currentLoaded = o._progress.loaded; 13120 o.blob = slice.call( 13121 file, 13122 ub, 13123 ub + mcs, 13124 file.type 13125 ); 13126 // Store the current chunk size, as the blob itself 13127 // will be dereferenced after data processing: 13128 o.chunkSize = o.blob.size; 13129 // Expose the chunk bytes position range: 13130 o.contentRange = 'bytes ' + ub + '-' + 13131 (ub + o.chunkSize - 1) + '/' + fs; 13132 // Process the upload data (the blob and potential form data): 13133 that._initXHRData(o); 13134 // Add progress listeners for this chunk upload: 13135 that._initProgressListener(o); 13136 jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) || 13137 that._getXHRPromise(false, o.context)) 13138 .done(function (result, textStatus, jqXHR) { 13139 ub = that._getUploadedBytes(jqXHR) || 13140 (ub + o.chunkSize); 13141 // Create a progress event if no final progress event 13142 // with loaded equaling total has been triggered 13143 // for this chunk: 13144 if (currentLoaded + o.chunkSize - o._progress.loaded) { 13145 that._onProgress($.Event('progress', { 13146 lengthComputable: true, 13147 loaded: ub - o.uploadedBytes, 13148 total: ub - o.uploadedBytes 13149 }), o); 13150 } 13151 options.uploadedBytes = o.uploadedBytes = ub; 13152 o.result = result; 13153 o.textStatus = textStatus; 13154 o.jqXHR = jqXHR; 13155 that._trigger('chunkdone', null, o); 13156 that._trigger('chunkalways', null, o); 13157 if (ub < fs) { 13158 // File upload not yet complete, 13159 // continue with the next chunk: 13160 upload(); 13161 } else { 13162 dfd.resolveWith( 13163 o.context, 13164 [result, textStatus, jqXHR] 13165 ); 13166 } 13167 }) 13168 .fail(function (jqXHR, textStatus, errorThrown) { 13169 o.jqXHR = jqXHR; 13170 o.textStatus = textStatus; 13171 o.errorThrown = errorThrown; 13172 that._trigger('chunkfail', null, o); 13173 that._trigger('chunkalways', null, o); 13174 dfd.rejectWith( 13175 o.context, 13176 [jqXHR, textStatus, errorThrown] 13177 ); 13178 }); 13179 }; 13180 this._enhancePromise(promise); 13181 promise.abort = function () { 13182 return jqXHR.abort(); 13183 }; 13184 upload(); 13185 return promise; 13186 }, 13187 13188 _beforeSend: function (e, data) { 13189 if (this._active === 0) { 13190 // the start callback is triggered when an upload starts 13191 // and no other uploads are currently running, 13192 // equivalent to the global ajaxStart event: 13193 this._trigger('start'); 13194 // Set timer for global bitrate progress calculation: 13195 this._bitrateTimer = new this._BitrateTimer(); 13196 // Reset the global progress values: 13197 this._progress.loaded = this._progress.total = 0; 13198 this._progress.bitrate = 0; 13199 } 13200 // Make sure the container objects for the .response() and 13201 // .progress() methods on the data object are available 13202 // and reset to their initial state: 13203 this._initResponseObject(data); 13204 this._initProgressObject(data); 13205 data._progress.loaded = data.loaded = data.uploadedBytes || 0; 13206 data._progress.total = data.total = this._getTotal(data.files) || 1; 13207 data._progress.bitrate = data.bitrate = 0; 13208 this._active += 1; 13209 // Initialize the global progress values: 13210 this._progress.loaded += data.loaded; 13211 this._progress.total += data.total; 13212 }, 13213 13214 _onDone: function (result, textStatus, jqXHR, options) { 13215 var total = options._progress.total, 13216 response = options._response; 13217 if (options._progress.loaded < total) { 13218 // Create a progress event if no final progress event 13219 // with loaded equaling total has been triggered: 13220 this._onProgress($.Event('progress', { 13221 lengthComputable: true, 13222 loaded: total, 13223 total: total 13224 }), options); 13225 } 13226 response.result = options.result = result; 13227 response.textStatus = options.textStatus = textStatus; 13228 response.jqXHR = options.jqXHR = jqXHR; 13229 this._trigger('done', null, options); 13230 }, 13231 13232 _onFail: function (jqXHR, textStatus, errorThrown, options) { 13233 var response = options._response; 13234 if (options.recalculateProgress) { 13235 // Remove the failed (error or abort) file upload from 13236 // the global progress calculation: 13237 this._progress.loaded -= options._progress.loaded;
13238 this._progress.total -= options._progress.total; 13239 } 13240 response.jqXHR = options.jqXHR = jqXHR; 13241 response.textStatus = options.textStatus = textStatus; 13242 response.errorThrown = options.errorThrown = errorThrown; 13243 this._trigger('fail', null, options); 13244 }, 13245 13246 _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) { 13247 // jqXHRorResult, textStatus and jqXHRorError are added to the 13248 // options object via done and fail callbacks 13249 this._trigger('always', null, options); 13250 }, 13251 13252 _onSend: function (e, data) { 13253 if (!data.submit) { 13254 this._addConvenienceMethods(e, data); 13255 } 13256 var that = this, 13257 jqXHR, 13258 aborted, 13259 slot, 13260 pipe, 13261 options = that._getAJAXSettings(data), 13262 send = function () { 13263 that._sending += 1; 13264 // Set timer for bitrate progress calculation: 13265 options._bitrateTimer = new that._BitrateTimer(); 13266 jqXHR = jqXHR || ( 13267 ((aborted || that._trigger( 13268 'send', 13269 $.Event('send', {delegatedEvent: e}), 13270 options 13271 ) === false) && 13272 that._getXHRPromise(false, options.context, aborted)) || 13273 that._chunkedUpload(options) || $.ajax(options) 13274 ).done(function (result, textStatus, jqXHR) { 13275 that._onDone(result, textStatus, jqXHR, options); 13276 }).fail(function (jqXHR, textStatus, errorThrown) { 13277 that._onFail(jqXHR, textStatus, errorThrown, options); 13278 }).always(function (jqXHRorResult, textStatus, jqXHRorError) { 13279 that._onAlways( 13280 jqXHRorResult, 13281 textStatus, 13282 jqXHRorError, 13283 options 13284 ); 13285 that._sending -= 1; 13286 that._active -= 1; 13287 if (options.limitConcurrentUploads && 13288 options.limitConcurrentUploads > that._sending) { 13289 // Start the next queued upload, 13290 // that has not been aborted: 13291 var nextSlot = that._slots.shift(); 13292 while (nextSlot) { 13293 if (that._getDeferredState(nextSlot) === 'pending') { 13294 nextSlot.resolve(); 13295 break; 13296 } 13297 nextSlot = that._slots.shift(); 13298 } 13299 } 13300 if (that._active === 0) { 13301 // The stop callback is triggered when all uploads have 13302 // been completed, equivalent to the global ajaxStop event: 13303 that._trigger('stop'); 13304 } 13305 }); 13306 return jqXHR; 13307 }; 13308 this._beforeSend(e, options); 13309 if (this.options.sequentialUploads || 13310 (this.options.limitConcurrentUploads && 13311 this.options.limitConcurrentUploads <= this._sending)) { 13312 if (this.options.limitConcurrentUploads > 1) { 13313 slot = $.Deferred(); 13314 this._slots.push(slot); 13315 pipe = slot.then(send); 13316 } else { 13317 this._sequence = this._sequence.then(send, send); 13318 pipe = this._sequence; 13319 } 13320 // Return the piped Promise object, enhanced with an abort method, 13321 // which is delegated to the jqXHR object of the current upload, 13322 // and jqXHR callbacks mapped to the equivalent Promise methods: 13323 pipe.abort = function () { 13324 aborted = [undefined, 'abort', 'abort']; 13325 if (!jqXHR) { 13326 if (slot) { 13327 slot.rejectWith(options.context, aborted); 13328 } 13329 return send(); 13330 } 13331 return jqXHR.abort(); 13332 }; 13333 return this._enhancePromise(pipe); 13334 } 13335 return send(); 13336 }, 13337 13338 _onAdd: function (e, data) { 13339 var that = this, 13340 result = true, 13341 options = $.extend({}, this.options, data), 13342 files = data.files, 13343 filesLength = files.length, 13344 limit = options.limitMultiFileUploads, 13345 limitSize = options.limitMultiFileUploadSize, 13346 overhead = options.limitMultiFileUploadSizeOverhead, 13347 batchSize = 0, 13348 paramName = this._getParamName(options), 13349 paramNameSet, 13350 paramNameSlice, 13351 fileSet, 13352 i, 13353 j = 0; 13354 if (!filesLength) { 13355 return false;
13356 } 13357 if (limitSize && files[0].size === undefined) { 13358 limitSize = undefined; 13359 } 13360 if (!(options.singleFileUploads || limit || limitSize) || 13361 !this._isXHRUpload(options)) { 13362 fileSet = [files]; 13363 paramNameSet = [paramName]; 13364 } else if (!(options.singleFileUploads || limitSize) && limit) { 13365 fileSet = []; 13366 paramNameSet = []; 13367 for (i = 0; i < filesLength; i += limit) { 13368 fileSet.push(files.slice(i, i + limit)); 13369 paramNameSlice = paramName.slice(i, i + limit); 13370 if (!paramNameSlice.length) { 13371 paramNameSlice = paramName; 13372 } 13373 paramNameSet.push(paramNameSlice); 13374 } 13375 } else if (!options.singleFileUploads && limitSize) { 13376 fileSet = []; 13377 paramNameSet = []; 13378 for (i = 0; i < filesLength; i = i + 1) { 13379 batchSize += files[i].size + overhead; 13380 if (i + 1 === filesLength || 13381 ((batchSize + files[i + 1].size + overhead) > limitSize) || 13382 (limit && i + 1 - j >= limit)) { 13383 fileSet.push(files.slice(j, i + 1)); 13384 paramNameSlice = paramName.slice(j, i + 1); 13385 if (!paramNameSlice.length) { 13386 paramNameSlice = paramName; 13387 } 13388 paramNameSet.push(paramNameSlice); 13389 j = i + 1; 13390 batchSize = 0; 13391 } 13392 } 13393 } else { 13394 paramNameSet = paramName; 13395 } 13396 data.originalFiles = files; 13397 $.each(fileSet || files, function (index, element) { 13398 var newData = $.extend({}, data); 13399 newData.files = fileSet ? element : [element]; 13400 newData.paramName = paramNameSet[index]; 13401 that._initResponseObject(newData); 13402 that._initProgressObject(newData); 13403 that._addConvenienceMethods(e, newData); 13404 result = that._trigger( 13405 'add', 13406 $.Event('add', {delegatedEvent: e}), 13407 newData 13408 ); 13409 return result; 13410 }); 13411 return result; 13412 }, 13413 13414 _replaceFileInput: function (data) { 13415 var input = data.fileInput, 13416 inputClone = input.clone(true), 13417 restoreFocus = input.is(document.activeElement); 13418 // Add a reference for the new cloned file input to the data argument: 13419 data.fileInputClone = inputClone; 13420 $('<form></form>').append(inputClone)[0].reset(); 13421 // Detaching allows to insert the fileInput on another form 13422 // without loosing the file input value: 13423 input.after(inputClone).detach(); 13424 // If the fileInput had focus before it was detached, 13425 // restore focus to the inputClone. 13426 if (restoreFocus) { 13427 inputClone.focus(); 13428 } 13429 // Avoid memory leaks with the detached file input: 13430 $.cleanData(input.unbind('remove')); 13431 // Replace the original file input element in the fileInput 13432 // elements set with the clone, which has been copied including 13433 // event handlers: 13434 this.options.fileInput = this.options.fileInput.map(function (i, el) { 13435 if (el === input[0]) { 13436 return inputClone[0]; 13437 } 13438 return el; 13439 }); 13440 // If the widget has been initialized on the file input itself, 13441 // override this.element with the file input clone: 13442 if (input[0] === this.element[0]) { 13443 this.element = inputClone; 13444 } 13445 }, 13446 13447 _handleFileTreeEntry: function (entry, path) { 13448 var that = this, 13449 dfd = $.Deferred(), 13450 errorHandler = function (e) { 13451 if (e && !e.entry) { 13452 e.entry = entry; 13453 } 13454 // Since $.when returns immediately if one 13455 // Deferred is rejected, we use resolve instead. 13456 // This allows valid files and invalid items 13457 // to be returned together in one set: 13458 dfd.resolve([e]); 13459 }, 13460 successHandler = function (entries) { 13461 that._handleFileTreeEntries(
13462 entries, 13463 path + entry.name + '/' 13464 ).done(function (files) { 13465 dfd.resolve(files); 13466 }).fail(errorHandler); 13467 }, 13468 readEntries = function () { 13469 dirReader.readEntries(function (results) { 13470 if (!results.length) { 13471 successHandler(entries); 13472 } else { 13473 entries = entries.concat(results); 13474 readEntries(); 13475 } 13476 }, errorHandler); 13477 }, 13478 dirReader, entries = []; 13479 path = path || ''; 13480 if (entry.isFile) { 13481 if (entry._file) { 13482 // Workaround for Chrome bug #149735 13483 entry._file.relativePath = path; 13484 dfd.resolve(entry._file); 13485 } else { 13486 entry.file(function (file) { 13487 file.relativePath = path; 13488 dfd.resolve(file); 13489 }, errorHandler); 13490 } 13491 } else if (entry.isDirectory) { 13492 dirReader = entry.createReader(); 13493 readEntries(); 13494 } else { 13495 // Return an empy list for file system items 13496 // other than files or directories: 13497 dfd.resolve([]); 13498 } 13499 return dfd.promise(); 13500 }, 13501 13502 _handleFileTreeEntries: function (entries, path) { 13503 var that = this; 13504 return $.when.apply( 13505 $, 13506 $.map(entries, function (entry) { 13507 return that._handleFileTreeEntry(entry, path); 13508 }) 13509 ).then(function () { 13510 return Array.prototype.concat.apply( 13511 [], 13512 arguments 13513 ); 13514 }); 13515 }, 13516 13517 _getDroppedFiles: function (dataTransfer) { 13518 dataTransfer = dataTransfer || {}; 13519 var items = dataTransfer.items; 13520 if (items && items.length && (items[0].webkitGetAsEntry || 13521 items[0].getAsEntry)) { 13522 return this._handleFileTreeEntries( 13523 $.map(items, function (item) { 13524 var entry; 13525 if (item.webkitGetAsEntry) { 13526 entry = item.webkitGetAsEntry(); 13527 if (entry) { 13528 // Workaround for Chrome bug #149735: 13529 entry._file = item.getAsFile(); 13530 } 13531 return entry; 13532 } 13533 return item.getAsEntry(); 13534 }) 13535 ); 13536 } 13537 return $.Deferred().resolve( 13538 $.makeArray(dataTransfer.files) 13539 ).promise(); 13540 }, 13541 13542 _getSingleFileInputFiles: function (fileInput) { 13543 fileInput = $(fileInput); 13544 var entries = fileInput.prop('webkitEntries') || 13545 fileInput.prop('entries'), 13546 files, 13547 value; 13548 if (entries && entries.length) { 13549 return this._handleFileTreeEntries(entries); 13550 } 13551 files = $.makeArray(fileInput.prop('files')); 13552 if (!files.length) { 13553 value = fileInput.prop('value'); 13554 if (!value) { 13555 return $.Deferred().resolve([]).promise(); 13556 } 13557 // If the files property is not available, the browser does not 13558 // support the File API and we add a pseudo File object with 13559 // the input value as name with path information removed: 13560 files = [{name: value.replace(/^.*\\/, '')}]; 13561 } else if (files[0].name === undefined && files[0].fileName) { 13562 // File normalization for Safari 4 and Firefox 3: 13563 $.each(files, function (index, file) { 13564 file.name = file.fileName; 13565 file.size = file.fileSize; 13566 }); 13567 } 13568 return $.Deferred().resolve(files).promise(); 13569 }, 13570 13571 _getFileInputFiles: function (fileInput) { 13572 if (!(fileInput instanceof $) || fileInput.length === 1) { 13573 return this._getSingleFileInputFiles(fileInput); 13574 } 13575 return $.when.apply( 13576 $, 13577 $.map(fileInput, this._getSingleFileInputFiles) 13578 ).then(function () { 13579 return Array.prototype.concat.apply( 13580 [], 13581 arguments 13582 ); 13583 }); 13584 }, 13585 13586 _onChange: function (e) { 13587 var that = this, 13588 data = { 13589 fileInput: $(e.target), 13590 form: $(e.target.form) 13591 }; 13592 this._getFileInputFiles(data.fileInput).always(function (files) { 13593 data.files = files; 13594 if (that.options.replaceFileInput) { 13595 that._replaceFileInput(data); 13596 } 13597 if (that._trigger( 13598 'change', 13599 $.Event('change', {delegatedEvent: e}), 13600 data 13601 ) !== false) { 13602 that._onAdd(e, data); 13603 } 13604 }); 13605 }, 13606 13607 _onPaste: function (e) { 13608 var items = e.originalEvent && e.originalEvent.clipboardData && 13609 e.originalEvent.clipboardData.items, 13610 data = {files: []}; 13611 if (items && items.length) { 13612 $.each(items, function (index, item) { 13613 var file = item.getAsFile && item.getAsFile(); 13614 if (file) { 13615 data.files.push(file); 13616 } 13617 }); 13618 if (this._trigger( 13619 'paste', 13620 $.Event('paste', {delegatedEvent: e}), 13621 data 13622 ) !== false) { 13623 this._onAdd(e, data); 13624 } 13625 } 13626 }, 13627 13628 _onDrop: function (e) { 13629 e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; 13630 var that = this, 13631 dataTransfer = e.dataTransfer, 13632 data = {}; 13633 if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { 13634 e.preventDefault(); 13635 this._getDroppedFiles(dataTransfer).always(function (files) { 13636 data.files = files; 13637 if (that._trigger( 13638 'drop', 13639 $.Event('drop', {delegatedEvent: e}), 13640 data 13641 ) !== false) { 13642 that._onAdd(e, data); 13643 } 13644 }); 13645 } 13646 }, 13647 13648 _onDragOver: getDragHandler('dragover'), 13649 13650 _onDragEnter: getDragHandler('dragenter'), 13651 13652 _onDragLeave: getDragHandler('dragleave'), 13653 13654 _initEventHandlers: function () { 13655 if (this._isXHRUpload(this.options)) { 13656 this._on(this.options.dropZone, { 13657 dragover: this._onDragOver, 13658 drop: this._onDrop, 13659 // event.preventDefault() on dragenter is required for IE10+: 13660 dragenter: this._onDragEnter, 13661 // dragleave is not required, but added for c
13661ompleteness: 13662 dragleave: this._onDragLeave 13663 }); 13664 this._on(this.options.pasteZone, { 13665 paste: this._onPaste 13666 }); 13667 } 13668 if ($.support.fileInput) { 13669 this._on(this.options.fileInput, { 13670 change: this._onChange 13671 }); 13672 } 13673 }, 13674 13675 _destroyEventHandlers: function () { 13676 this._off(this.options.dropZone, 'dragenter dragleave dragover drop'); 13677 this._off(this.options.pasteZone, 'paste'); 13678 this._off(this.options.fileInput, 'change'); 13679 }, 13680 13681 _setOption: function (key, value) { 13682 var reinit = $.inArray(key, this._specialOptions) !== -1; 13683 if (reinit) { 13684 this._destroyEventHandlers(); 13685 } 13686 this._super(key, value); 13687 if (reinit) { 13688 this._initSpecialOptions(); 13689 this._initEventHandlers(); 13690 } 13691 }, 13692 13693 _initSpecialOptions: function () { 13694 var options = this.options; 13695 if (options.fileInput === undefined) { 13696 options.fileInput = this.element.is('input[type="file"]') ? 13697 this.element : this.element.find('input[type="file"]'); 13698 } else if (!(options.fileInput instanceof $)) { 13699 options.fileInput = $(options.fileInput); 13700 } 13701 if (!(options.dropZone instanceof $)) { 13702 options.dropZone = $(options.dropZone); 13703 } 13704 if (!(options.pasteZone instanceof $)) { 13705 options.pasteZone = $(options.pasteZone); 13706 } 13707 }, 13708 13709 _getRegExp: function (str) { 13710 var parts = str.split('/'), 13711 modifiers = parts.pop(); 13712 parts.shift(); 13713 return new RegExp(parts.join('/'), modifiers); 13714 }, 13715 13716 _isRegExpOption: function (key, value) { 13717 return key !== 'url' && $.type(value) === 'string' && 13718 /^\/.*\/[igm]{0,3}$/.test(value); 13719 }, 13720 13721 _initDataAttributes: function () { 13722 var that = this, 13723 options = this.options, 13724 data = this.element.data(); 13725 // Initialize options set via HTML5 data-attributes: 13726 $.each( 13727 this.element[0].attributes, 13728 function (index, attr) { 13729 var key = attr.name.toLowerCase(), 13730 value; 13731 if (/^data-/.test(key)) { 13732 // Convert hyphen-ated key to camelCase: 13733 key = key.slice(5).replace(/-[a-z]/g, function (str) { 13734 return str.charAt(1).toUpperCase(); 13735 }); 13736 value = data[key]; 13737 if (that._isRegExpOption(key, value)) { 13738 value = that._getRegExp(value); 13739 } 13740 options[key] = value; 13741 } 13742 } 13743 ); 13744 }, 13745 13746 _create: function () { 13747 this._initDataAttributes(); 13748 this._initSpecialOptions(); 13749 this._slots = []; 13750 this._sequence = this._getXHRPromise(true); 13751 this._sending = this._active = 0; 13752 this._initProgressObject(this); 13753 this._initEventHandlers(); 13754 }, 13755 13756 // This method is exposed to the widget API and allows to query 13757 // the number of active uploads: 13758 active: function () { 13759 return this._active; 13760 }, 13761 13762 // This method is exposed to the widget API and allows to query 13763 // the widget upload progress. 13764 // It returns an object with loaded, total and bitrate properties 13765 // for the running uploads: 13766 progress: function () { 13767 return this._progress; 13768 }, 13769 13770 // This method is exposed to the widget API and allows adding files 13771 // using the fileupload API. The data parameter accepts an object which 13772 // must have a files property and can contain additional options: 13773 // .fileupload('add', {files: filesList}); 13774 add: function (data) { 13775 var that = this; 13776 if (!data || this.options.disabled) { 13777 return; 13778 } 13779 if (data.fileInput && !data.files) { 13780 this._getFileInputFiles(data.fileInput).always(function (files) { 13781 data.files = files; 13782 that._onAdd(null, data); 13783 }); 13784 } else { 13785 data.files = $.makeArray(data.files); 13786 this._onAdd(null, data); 13787 } 13788 }, 13789 13790 // This method is exposed to the widget API and allows sending files 13791 // using the fileupload API. The data parameter accepts an object which 13792 // must have a files or fileInput property and can contain additional options: 13793 // .fileupload('send', {files: filesList}); 13794 // The method returns a Promise object for the file upload call. 13795 send: function (data) { 13796 if (data && !this.options.disabled) { 13797 if (data.fileInput && !data.files) { 13798 var that = this, 13799 dfd = $.Deferred(), 13800 promise = dfd.promise(), 13801 jqXHR, 13802 aborted; 13803 promise.abort = function () { 13804 aborted = true; 13805 if (jqXHR) { 13806 return jqXHR.abort(); 13807 } 13808 dfd.reject(null, 'abort', 'abort'); 13809 return promise; 13810 }; 13811 this._getFileInputFiles(data.fileInput).always( 13812 function (files) { 13813 if (aborted) { 13814 return; 13815 } 13816 if (!files.length) { 13817 dfd.reject(); 13818 return; 13819 } 13820 data.files = files; 13821 jqXHR = that._onSend(null, data); 13822 jqXHR.then( 13823 function (result, textStatus, jqXHR) { 13824 dfd.resolve(result, textStatus, jqXHR); 13825 }, 13826 function (jqXHR, textStatus, errorThrown) { 13827 dfd.reject(jqXHR, textStatus, errorThrown); 13828 } 13829 ); 13830 } 13831 ); 13832 return this._enhancePromise(promise); 13833 } 13834 data.files = $.makeArray(data.files); 13835 if (data.files.length) { 13836 return this._onSend(null, data); 13837 } 13838 } 13839 return this._getXHRPromise(false, data && data.context); 13840 } 13841 13842 }); 13843 13844})); 13845 13846 13847 13848// Underscore.js 1.4.4 13849// http://underscorejs.org
13850// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. 13851// Underscore may be freely distributed under the MIT license. 13852 13853(function() { 13854 13855 // Baseline setup 13856 // -------------- 13857 13858 // Establish the root object, `window` in the browser, or `global` on the server. 13859 var root = this; 13860 13861 // Save the previous value of the `_` variable. 13862 var previousUnderscore = root._; 13863 13864 // Establish the object that gets returned to break out of a loop iteration. 13865 var breaker = {}; 13866 13867 // Save bytes in the minified (but not gzipped) version: 13868 var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; 13869 13870 // Create quick reference variables for speed access to core prototypes. 13871 var push = ArrayProto.push, 13872 slice = ArrayProto.slice, 13873 concat = ArrayProto.concat, 13874 toString = ObjProto.toString, 13875 hasOwnProperty = ObjProto.hasOwnProperty; 13876 13877 // All **ECMAScript 5** native function implementations that we hope to use 13878 // are declared here. 13879 var 13880 nativeForEach = ArrayProto.forEach, 13881 nativeMap = ArrayProto.map, 13882 nativeReduce = ArrayProto.reduce, 13883 nativeReduceRight = ArrayProto.reduceRight, 13884 nativeFilter = ArrayProto.filter, 13885 nativeEvery = ArrayProto.every, 13886 nativeSome = ArrayProto.some, 13887 nativeIndexOf = ArrayProto.indexOf, 13888 nativeLastIndexOf = ArrayProto.lastIndexOf, 13889 nativeIsArray = Array.isArray, 13890 nativeKeys = Object.keys, 13891 nativeBind = FuncProto.bind; 13892 13893 // Create a safe reference to the Underscore object for use below. 13894 var _ = function(obj) { 13895 if (obj instanceof _) return obj; 13896 if (!(this instanceof _)) return new _(obj); 13897 this._wrapped = obj; 13898 }; 13899 13900 // Export the Underscore object for **Node.js**, with 13901 // backwards-compatibility for the old `require()` API. If we're in 13902 // the browser, add `_` as a global object via a string identifier, 13903 // for Closure Compiler "advanced" mode. 13904 if (typeof exports !== 'undefined') { 13905 if (typeof module !== 'undefined' && module.exports) { 13906 exports = module.exports = _; 13907 } 13908 exports._ = _; 13909 } else { 13910 root._ = _; 13911 } 13912 13913 // Current version. 13914 _.VERSION = '1.4.4'; 13915 13916 // Collection Functions 13917 // -------------------- 13918 13919 // The cornerstone, an `each` implementation, aka `forEach`. 13920 // Handles objects with the built-in `forEach`, arrays, and raw objects. 13921 // Delegates to **ECMAScript 5**'s native `forEach` if available. 13922 var each = _.each = _.forEach = function(obj, iterator, context) { 13923 if (obj == null) return; 13924 if (nativeForEach && obj.forEach === nativeForEach) { 13925 obj.forEach(iterator, context); 13926 } else if (obj.length === +obj.length) { 13927 for (var i = 0, l = obj.length; i < l; i++) { 13928 if (iterator.call(context, obj[i], i, obj) === breaker) return; 13929 } 13930 } else { 13931 for (var key in obj) { 13932 if (_.has(obj, key)) { 13933 if (iterator.call(context, obj[key], key, obj) === breaker) return; 13934 } 13935 } 13936 } 13937 }; 13938 13939 // Return the results of applying the iterator to each element. 13940 // Delegates to **ECMAScript 5**'s native `map` if available. 13941 _.map = _.collect = function(obj, iterator, context) { 13942 var results = []; 13943 if (obj == null) return results; 13944 if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); 13945 each(obj, function(value, index, list) { 13946 results[results.length] = iterator.call(context, value, index, list); 13947 }); 13948 return results; 13949 }; 13950 13951 var reduceError = 'Reduce of empty array with no initial value'; 13952 13953 // **Reduce** builds up a single result from a list of values, aka `inject`, 13954 // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. 13955 _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { 13956 var initial = arguments.length > 2; 13957 if (obj == null) obj = []; 13958 if (nativeReduce && obj.reduce === nativeReduce) { 13959 if (context) iterator = _.bind(iterator, context); 13960 return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); 13961 } 13962 each(obj, function(value, index, list) { 13963 if (!initial) { 13964 memo = value; 13965 initial = true; 13966 } else { 13967 memo = iterator.call(context, memo, value, index, list); 13968 } 13969 }); 13970 if (!initial) throw new TypeError(reduceError); 13971 return memo; 13972 }; 13973 13974 // The right-associative version of reduce, also known as `foldr`. 13975 // Delegates to **ECMAScript 5**'s native `reduceRight` if available. 13976 _.reduceRight = _.foldr = function(obj, iterator, memo, context) { 13977 var initial = arguments.length > 2; 13978 if (obj == null) obj = []; 13979 if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { 13980 if (context) iterator = _.bind(iterator, context); 13981 return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); 13982 } 13983 var length = obj.length; 13984 if (length !== +length) { 13985 var keys = _.keys(obj); 13986 length = keys.length; 13987 } 13988 each(obj, function(value, index, list) { 13989 index = keys ? keys[--length] : --length; 13990 if (!initial) { 13991 memo = obj[index]; 13992 initial = true; 13993 } else { 13994 memo = iterator.call(context, memo, obj[index], index, list); 13995 } 13996 }); 13997 if (!initial) throw new TypeError(reduceError); 13998 return memo; 13999 }; 14000 14001 // Return the first value which passes a truth test. Aliased as `detect`. 14002 _.find = _.detect = function(obj, iterator, context) { 14003 var result; 14004 any(obj, function(value, index, list) { 14005 if (iterator.call(context, value, index, list)) { 14006 result = value; 14007 return true; 14008 } 14009 }); 14010 return result; 14011 }; 14012 14013 // Return all the elements that pass a truth test. 14014 // Delegates to **ECMAScript 5**'s native `filter` if available. 14015 // Aliased as `select`. 14016 _.filter = _.select = function(obj, iterator, context) { 14017 var results = []; 14018 if (obj == null) return results; 14019 if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); 14020 each(obj, function(value, index, list) { 14021 if (iterator.call(context, value, index, list)) results[results.length] = value; 14022 }); 14023 return results; 14024 }; 14025 14026 // Return all the elements for which a truth test fails. 14027 _.reject = function(obj, iterator, context) { 14028 return _.filter(obj, function(value, index, list) { 14029 return !iterator.call(context, value, index, list); 14030 }, context); 14031 }; 14032 14033 // Determine whether all of the elements match a truth test. 14034 // Delegates to **ECMAScript 5**'s native `every` if available. 14035 // Aliased as `all`. 14036 _.every = _.all = function(obj, iterator, context) { 14037 iterator || (iterator = _.identity); 14038 var result = true; 14039 if (obj == null) return result; 14040 if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); 14041 each(obj, function(value, index, list) { 14042 if (!(result = result && iterator.call(context, value, index, list))) return breaker; 14043 }); 14044 return !!result; 14045 }; 14046 14047 // Determine if at least one element in the object matches a truth test. 14048 // Delegates to **ECMAScript 5**'s native `some` if available. 14049 // Aliased as `any`. 14050 var any = _.some = _.any = function(obj, iterator, context) { 14051 iterator || (iterator = _.identity); 14052 var result = false;
14053 if (obj == null) return result; 14054 if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); 14055 each(obj, function(value, index, list) { 14056 if (result || (result = iterator.call(context, value, index, list))) return breaker; 14057 }); 14058 return !!result; 14059 }; 14060 14061 // Determine if the array or object contains a given value (using `===`). 14062 // Aliased as `include`. 14063 _.contains = _.include = function(obj, target) { 14064 if (obj == null) return false; 14065 if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; 14066 return any(obj, function(value) { 14067 return value === target; 14068 }); 14069 }; 14070 14071 // Invoke a method (with arguments) on every item in a collection. 14072 _.invoke = function(obj, method) { 14073 var args = slice.call(arguments, 2); 14074 var isFunc = _.isFunction(method); 14075 return _.map(obj, function(value) { 14076 return (isFunc ? method : value[method]).apply(value, args); 14077 }); 14078 }; 14079 14080 // Convenience version of a common use case of `map`: fetching a property. 14081 _.pluck = function(obj, key) { 14082 return _.map(obj, function(value){ return value[key]; }); 14083 }; 14084 14085 // Convenience version of a common use case of `filter`: selecting only objects 14086 // containing specific `key:value` pairs. 14087 _.where = function(obj, attrs, first) { 14088 if (_.isEmpty(attrs)) return first ? null : []; 14089 return _[first ? 'find' : 'filter'](obj, function(value) { 14090 for (var key in attrs) { 14091 if (attrs[key] !== value[key]) return false; 14092 } 14093 return true; 14094 }); 14095 }; 14096 14097 // Convenience version of a common use case of `find`: getting the first object 14098 // containing specific `key:value` pairs. 14099 _.findWhere = function(obj, attrs) { 14100 return _.where(obj, attrs, true); 14101 }; 14102 14103 // Return the maximum element or (element-based computation). 14104 // Can't optimize arrays of integers longer than 65,535 elements. 14105 // See: https://bugs.webkit.org/show_bug.cgi?id=80797 14106 _.max = function(obj, iterator, context) { 14107 if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { 14108 return Math.max.apply(Math, obj); 14109 } 14110 if (!iterator && _.isEmpty(obj)) return -Infinity; 14111 var result = {computed : -Infinity, value: -Infinity}; 14112 each(obj, function(value, index, list) { 14113 var computed = iterator ? iterator.call(context, value, index, list) : value; 14114 computed >= result.computed && (result = {value : value, computed : computed}); 14115 }); 14116 return result.value; 14117 }; 14118 14119 // Return the minimum element (or element-based computation). 14120 _.min = function(obj, iterator, context) { 14121 if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { 14122 return Math.min.apply(Math, obj); 14123 } 14124 if (!iterator && _.isEmpty(obj)) return Infinity; 14125 var result = {computed : Infinity, value: Infinity}; 14126 each(obj, function(value, index, list) { 14127 var computed = iterator ? iterator.call(context, value, index, list) : value; 14128 computed < result.computed && (result = {value : value, computed : computed}); 14129 }); 14130 return result.value; 14131 }; 14132 14133 // Shuffle an array. 14134 _.shuffle = function(obj) { 14135 var rand; 14136 var index = 0; 14137 var shuffled = []; 14138 each(obj, function(value) { 14139 rand = _.random(index++); 14140 shuffled[index - 1] = shuffled[rand]; 14141 shuffled[rand] = value; 14142 }); 14143 return shuffled; 14144 }; 14145 14146 // An internal function to generate lookup iterators. 14147 var lookupIterator = function(value) { 14148 return _.isFunction(value) ? value : function(obj){ return obj[value]; }; 14149 }; 14150 14151 // Sort the object's values by a criterion produced by an iterator. 14152 _.sortBy = function(obj, value, context) { 14153 var iterator = lookupIterator(value); 14154 return _.pluck(_.map(obj, function(value, index, list) { 14155 return { 14156 value : value, 14157 index : index, 14158 criteria : iterator.call(context, value, index, list) 14159 }; 14160 }).sort(function(left, right) { 14161 var a = left.criteria; 14162 var b = right.criteria; 14163 if (a !== b) { 14164 if (a > b || a === void 0) return 1; 14165 if (a < b || b === void 0) return -1; 14166 } 14167 return left.index < right.index ? -1 : 1; 14168 }), 'value'); 14169 }; 14170 14171 // An internal function used for aggregate "group by" operations. 14172 var group = function(obj, value, context, behavior) { 14173 var result = {}; 14174 var iterator = lookupIterator(value || _.identity); 14175 each(obj, function(value, index) { 14176 var key = iterator.call(context, value, index, obj); 14177 behavior(result, key, value); 14178 }); 14179 return result; 14180 }; 14181 14182 // Groups the object's values by a criterion. Pass either a string attribute 14183 // to group by, or a function that returns the criterion. 14184 _.groupBy = function(obj, value, context) { 14185 return group(obj, value, context, function(result, key, value) { 14186 (_.has(result, key) ? result[key] : (result[key] = [])).push(value); 14187 }); 14188 }; 14189 14190 // Counts instances of an object that group by a certain criterion. Pass 14191 // either a string attribute to count by, or a function that returns the 14192 // criterion. 14193 _.countBy = function(obj, value, context) { 14194 return group(obj, value, context, function(result, key) { 14195 if (!_.has(result, key)) result[key] = 0; 14196 result[key]++; 14197 }); 14198 }; 14199 14200 // Use a comparator function to figure out the smallest index at which 14201 // an object should be inserted so as to maintain order. Uses binary search. 14202 _.sortedIndex = function(array, obj, iterator, context) { 14203 iterator = iterator == null ? _.identity : lookupIterator(iterator); 14204 var value = iterator.call(context, obj); 14205 var low = 0, high = array.length; 14206 while (low < high) { 14207 var mid = (low + high) >>> 1; 14208 iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid; 14209 } 14210 return low; 14211 }; 14212 14213 // Safely convert anything iterable into a real, live array. 14214 _.toArray = function(obj) { 14215 if (!obj) return []; 14216 if (_.isArray(obj)) return slice.call(obj); 14217 if (obj.length === +obj.length) return _.map(obj, _.identity); 14218 return _.values(obj); 14219 }; 14220 14221 // Return the number of elements in an object. 14222 _.size = function(obj) { 14223 if (obj == null) return 0; 14224 return (obj.length === +obj.length) ? obj.length : _.keys(obj).length; 14225 }; 14226 14227 // Array Functions 14228 // --------------- 14229 14230 // Get the first element of an array. Passing **n** will return the first N 14231 // values in the array. Aliased as `head` and `take`. The **guard** check 14232 // allows it to work with `_.map`. 14233 _.first = _.head = _.take = function(array, n, guard) { 14234 if (array == null) return void 0; 14235 return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; 14236 }; 14237 14238 // Returns everything but the last entry of the array. Especially useful on 14239 // the arguments object. Passing **n** will return all the values in 14240 // the array, excluding the last N. The **guard** check allows it to work with 14241 // `_.map`. 14242 _.initial = function(array, n, guard) { 14243 return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); 14244 }; 14245 14246 // Get the last element of an array. Passing **n** will return the last N 14247 // values in the array. The **guard** check allows it to work with `_.map`. 14248 _.last = function(array, n, guard) { 14249 if (array == null) return void 0; 14250 if ((n != null) && !guard) { 14251 return slice.call(array, Math.max(array.length - n, 0)); 14252 } else { 14253 return array[array.length - 1]; 14254 } 14255 }; 14256 14257 // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. 14258 // Especially useful on the arguments object. Passing an **n** will return 14259 // the rest N values in the array. The **guard** 14260 // check allows it to work with `_.map`. 14261 _.rest = _.tail = _.drop = function(array, n, guard) { 14262 return slice.call(array, (n == null) || guard ? 1 : n); 14263 }; 14264 14265 // Trim out all falsy values from an array.
14266 _.compact = function(array) { 14267 return _.filter(array, _.identity); 14268 }; 14269 14270 // Internal implementation of a recursive `flatten` function. 14271 var flatten = function(input, shallow, output) { 14272 each(input, function(value) { 14273 if (_.isArray(value)) { 14274 shallow ? push.apply(output, value) : flatten(value, shallow, output); 14275 } else { 14276 output.push(value); 14277 } 14278 }); 14279 return output; 14280 }; 14281 14282 // Return a completely flattened version of an array. 14283 _.flatten = function(array, shallow) { 14284 return flatten(array, shallow, []); 14285 }; 14286 14287 // Return a version of the array that does not contain the specified value(s). 14288 _.without = function(array) { 14289 return _.difference(array, slice.call(arguments, 1)); 14290 }; 14291 14292 // Produce a duplicate-free version of the array. If the array has already 14293 // been sorted, you have the option of using a faster algorithm. 14294 // Aliased as `unique`. 14295 _.uniq = _.unique = function(array, isSorted, iterator, context) { 14296 if (_.isFunction(isSorted)) { 14297 context = iterator; 14298 iterator = isSorted; 14299 isSorted = false; 14300 } 14301 var initial = iterator ? _.map(array, iterator, context) : array; 14302 var results = []; 14303 var seen = []; 14304 each(initial, function(value, index) { 14305 if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) { 14306 seen.push(value); 14307 results.push(array[index]); 14308 } 14309 }); 14310 return results; 14311 }; 14312 14313 // Produce an array that contains the union: each distinct element from all of 14314 // the passed-in arrays. 14315 _.union = function() { 14316 return _.uniq(concat.apply(ArrayProto, arguments)); 14317 }; 14318 14319 // Produce an array that contains every item shared between all the 14320 // passed-in arrays. 14321 _.intersection = function(array) { 14322 var rest = slice.call(arguments, 1); 14323 return _.filter(_.uniq(array), function(item) { 14324 return _.every(rest, function(other) { 14325 return _.indexOf(other, item) >= 0; 14326 }); 14327 }); 14328 }; 14329 14330 // Take the difference between one array and a number of other arrays. 14331 // Only the elements present in just the first array will remain. 14332 _.difference = function(array) { 14333 var rest = concat.apply(ArrayProto, slice.call(arguments, 1)); 14334 return _.filter(array, function(value){ return !_.contains(rest, value); }); 14335 }; 14336 14337 // Zip together multiple lists into a single array -- elements that share 14338 // an index go together. 14339 _.zip = function() { 14340 var args = slice.call(arguments); 14341 var length = _.max(_.pluck(args, 'length')); 14342 var results = new Array(length); 14343 for (var i = 0; i < length; i++) { 14344 results[i] = _.pluck(args, "" + i); 14345 } 14346 return results; 14347 }; 14348 14349 // Converts lists into objects. Pass either a single array of `[key, value]` 14350 // pairs, or two parallel arrays of the same length -- one of keys, and one of 14351 // the corresponding values. 14352 _.object = function(list, values) { 14353 if (list == null) return {}; 14354 var result = {}; 14355 for (var i = 0, l = list.length; i < l; i++) { 14356 if (values) { 14357 result[list[i]] = values[i]; 14358 } else { 14359 result[list[i][0]] = list[i][1]; 14360 } 14361 } 14362 return result; 14363 }; 14364 14365 // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), 14366 // we need this function. Return the position of the first occurrence of an 14367 // item in an array, or -1 if the item is not included in the array. 14368 // Delegates to **ECMAScript 5**'s native `indexOf` if available. 14369 // If the array is large and already in sort order, pass `true` 14370 // for **isSorted** to use binary search. 14371 _.indexOf = function(array, item, isSorted) { 14372 if (array == null) return -1; 14373 var i = 0, l = array.length; 14374 if (isSorted) { 14375 if (typeof isSorted == 'number') { 14376 i = (isSorted < 0 ? Math.max(0, l + isSorted) : isSorted); 14377 } else { 14378 i = _.sortedIndex(array, item); 14379 return array[i] === item ? i : -1; 14380 } 14381 } 14382 if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted); 14383 for (; i < l; i++) if (array[i] === item) return i; 14384 return -1; 14385 }; 14386 14387 // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. 14388 _.lastIndexOf = function(array, item, from) { 14389 if (array == null) return -1; 14390 var hasIndex = from != null; 14391 if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) { 14392 return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item); 14393 } 14394 var i = (hasIndex ? from : array.length); 14395 while (i--) if (array[i] === item) return i; 14396 return -1; 14397 }; 14398 14399 // Generate an integer Array containing an arithmetic progression. A port of 14400 // the native Python `range()` function. See 14401 // [the Python documentation](http://docs.python.org/library/functions.html#range). 14402 _.range = function(start, stop, step) { 14403 if (arguments.length <= 1) { 14404 stop = start || 0; 14405 start = 0; 14406 } 14407 step = arguments[2] || 1; 14408 14409 var len = Math.max(Math.ceil((stop - start) / step), 0); 14410 var idx = 0; 14411 var range = new Array(len); 14412 14413 while(idx < len) { 14414 range[idx++] = start; 14415 start += step; 14416 } 14417 14418 return range; 14419 }; 14420 14421 // Function (ahem) Functions 14422 // ------------------ 14423 14424 // Create a function bound to a given object (assigning `this`, and arguments, 14425 // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if 14426 // available. 14427 _.bind = function(func, context) { 14428 if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); 14429 var args = slice.call(arguments, 2); 14430 return function() { 14431 return func.apply(context, args.concat(slice.call(arguments))); 14432 }; 14433 }; 14434 14435 // Partially apply a function by creating a version that has had some of its 14436 // arguments pre-filled, without changing its dynamic `this` context. 14437 _.partial = function(func) { 14438 var args = slice.call(arguments, 1); 14439 return function() { 14440 return func.apply(this, args.concat(slice.call(arguments))); 14441 }; 14442 }; 14443 14444 // Bind all of an object's methods to that object. Useful for ensuring that 14445 // all callbacks defined on an object belong to it. 14446 _.bindAll = function(obj) { 14447 var funcs = slice.call(arguments, 1);
14448 if (funcs.length === 0) funcs = _.functions(obj); 14449 each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); 14450 return obj; 14451 }; 14452 14453 // Memoize an expensive function by storing its results. 14454 _.memoize = function(func, hasher) { 14455 var memo = {}; 14456 hasher || (hasher = _.identity); 14457 return function() { 14458 var key = hasher.apply(this, arguments); 14459 return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); 14460 }; 14461 }; 14462 14463 // Delays a function for the given number of milliseconds, and then calls 14464 // it with the arguments supplied. 14465 _.delay = function(func, wait) { 14466 var args = slice.call(arguments, 2); 14467 return setTimeout(function(){ return func.apply(null, args); }, wait); 14468 }; 14469 14470 // Defers a function, scheduling it to run after the current call stack has 14471 // cleared. 14472 _.defer = function(func) { 14473 return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); 14474 }; 14475 14476 // Returns a function, that, when invoked, will only be triggered at most once 14477 // during a given window of time. 14478 _.throttle = function(func, wait) { 14479 var context, args, timeout, result; 14480 var previous = 0; 14481 var later = function() { 14482 previous = new Date; 14483 timeout = null; 14484 result = func.apply(context, args); 14485 }; 14486 return function() { 14487 var now = new Date; 14488 var remaining = wait - (now - previous); 14489 context = this; 14490 args = arguments; 14491 if (remaining <= 0) { 14492 clearTimeout(timeout); 14493 timeout = null; 14494 previous = now; 14495 result = func.apply(context, args); 14496 } else if (!timeout) { 14497 timeout = setTimeout(later, remaining); 14498 } 14499 return result; 14500 }; 14501 }; 14502 14503 // Returns a function, that, as long as it continues to be invoked, will not 14504 // be triggered. The function will be called after it stops being called for 14505 // N milliseconds. If `immediate` is passed, trigger the function on the 14506 // leading edge, instead of the trailing. 14507 _.debounce = function(func, wait, immediate) { 14508 var timeout, result; 14509 return function() { 14510 var context = this, args = arguments; 14511 var later = function() { 14512 timeout = null; 14513 if (!immediate) result = func.apply(context, args); 14514 }; 14515 var callNow = immediate && !timeout; 14516 clearTimeout(timeout); 14517 timeout = setTimeout(later, wait); 14518 if (callNow) result = func.apply(context, args); 14519 return result; 14520 }; 14521 }; 14522 14523 // Returns a function that will be executed at most one time, no matter how 14524 // often you call it. Useful for lazy initialization. 14525 _.once = function(func) { 14526 var ran = false, memo; 14527 return function() { 14528 if (ran) return memo; 14529 ran = true; 14530 memo = func.apply(this, arguments); 14531 func = null; 14532 return memo; 14533 }; 14534 }; 14535 14536 // Returns the first function passed as an argument to the second, 14537 // allowing you to adjust arguments, run code before and after, and 14538 // conditionally execute the original function. 14539 _.wrap = function(func, wrapper) { 14540 return function() { 14541 var args = [func]; 14542 push.apply(args, arguments); 14543 return wrapper.apply(this, args); 14544 }; 14545 }; 14546 14547 // Returns a function that is the composition of a list of functions, each 14548 // consuming the return value of the function that follows. 14549 _.compose = function() { 14550 var funcs = arguments; 14551 return function() { 14552 var args = arguments; 14553 for (var i = funcs.length - 1; i >= 0; i--) { 14554 args = [funcs[i].apply(this, args)]; 14555 } 14556 return args[0]; 14557 }; 14558 }; 14559 14560 // Returns a function that will only be executed after being called N times. 14561 _.after = function(times, func) { 14562 if (times <= 0) return func(); 14563 return function() { 14564 if (--times < 1) { 14565 return func.apply(this, arguments); 14566 } 14567 }; 14568 }; 14569 14570 // Object Functions 14571 // ---------------- 14572 14573 // Retrieve the names of an object's properties. 14574 // Delegates to **ECMAScript 5**'s native `Object.keys` 14575 _.keys = nativeKeys || function(obj) { 14576 if (obj !== Object(obj)) throw new TypeError('Invalid object'); 14577 var keys = []; 14578 for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; 14579 return keys; 14580 }; 14581 14582 // Retrieve the values of an object's properties. 14583 _.values = function(obj) { 14584 var values = []; 14585 for (var key in obj) if (_.has(obj, key)) values.push(obj[key]); 14586 return values; 14587 }; 14588 14589 // Convert an object into a list of `[key, value]` pairs. 14590 _.pairs = function(obj) { 14591 var pairs = []; 14592 for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]); 14593 return pairs; 14594 }; 14595 14596 // Invert the keys and values of an object. The values must be serializable. 14597 _.invert = function(obj) { 14598 var result = {}; 14599 for (var key in obj) if (_.has(obj, key)) result[obj[key]] = key; 14600 return result; 14601 }; 14602 14603 // Return a sorted list of the function names available on the object. 14604 // Aliased as `methods` 14605 _.functions = _.methods = function(obj) { 14606 var names = []; 14607 for (var key in obj) { 14608 if (_.isFunction(obj[key])) names.push(key); 14609 } 14610 return names.sort(); 14611 }; 14612 14613 // Extend a given object with all the properties in passed-in object(s). 14614 _.extend = function(obj) { 14615 each(slice.call(arguments, 1), function(source) { 14616 if (source) { 14617 for (var prop in source) { 14618 obj[prop] = source[prop]; 14619 } 14620 } 14621 }); 14622 return obj; 14623 }; 14624 14625 // Return a copy of the object only containing the whitelisted properties. 14626 _.pick = function(obj) { 14627 var copy = {}; 14628 var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); 14629 each(keys, function(key) { 14630 if (key in obj) copy[key] = obj[key]; 14631 }); 14632 return copy; 14633 }; 14634
14635 // Return a copy of the object without the blacklisted properties. 14636 _.omit = function(obj) { 14637 var copy = {}; 14638 var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); 14639 for (var key in obj) { 14640 if (!_.contains(keys, key)) copy[key] = obj[key]; 14641 } 14642 return copy; 14643 }; 14644 14645 // Fill in a given object with default properties. 14646 _.defaults = function(obj) { 14647 each(slice.call(arguments, 1), function(source) { 14648 if (source) { 14649 for (var prop in source) { 14650 if (obj[prop] == null) obj[prop] = source[prop]; 14651 } 14652 } 14653 }); 14654 return obj; 14655 }; 14656 14657 // Create a (shallow-cloned) duplicate of an object. 14658 _.clone = function(obj) { 14659 if (!_.isObject(obj)) return obj; 14660 return _.isArray(obj) ? obj.slice() : _.extend({}, obj); 14661 }; 14662 14663 // Invokes interceptor with the obj, and then returns obj. 14664 // The primary purpose of this method is to "tap into" a method chain, in 14665 // order to perform operations on intermediate results within the chain. 14666 _.tap = function(obj, interceptor) { 14667 interceptor(obj); 14668 return obj; 14669 }; 14670 14671 // Internal recursive comparison function for `isEqual`. 14672 var eq = function(a, b, aStack, bStack) { 14673 // Identical objects are equal. `0 === -0`, but they aren't identical. 14674 // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. 14675 if (a === b) return a !== 0 || 1 / a == 1 / b; 14676 // A strict comparison is necessary because `null == undefined`. 14677 if (a == null || b == null) return a === b; 14678 // Unwrap any wrapped objects. 14679 if (a instanceof _) a = a._wrapped; 14680 if (b instanceof _) b = b._wrapped; 14681 // Compare `[[Class]]` names. 14682 var className = toString.call(a); 14683 if (className != toString.call(b)) return false; 14684 switch (className) { 14685 // Strings, numbers, dates, and booleans are compared by value. 14686 case '[object String]': 14687 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is 14688 // equivalent to `new String("5")`. 14689 return a == String(b); 14690 case '[object Number]': 14691 // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for 14692 // other numeric values. 14693 return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); 14694 case '[object Date]': 14695 case '[object Boolean]': 14696 // Coerce dates and booleans to numeric primitive values. Dates are compared by their 14697 // millisecond representations. Note that invalid dates with millisecond representations 14698 // of `NaN` are not equivalent. 14699 return +a == +b; 14700 // RegExps are compared by their source patterns and flags. 14701 case '[object RegExp]': 14702 return a.source == b.source && 14703 a.global == b.global && 14704 a.multiline == b.multiline && 14705 a.ignoreCase == b.ignoreCase; 14706 } 14707 if (typeof a != 'object' || typeof b != 'object') return false; 14708 // Assume equality for cyclic structures. The algorithm for detecting cyclic 14709 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. 14710 var length = aStack.length; 14711 while (length--) { 14712 // Linear search. Performance is inversely proportional to the number of 14713 // unique nested structures. 14714 if (aStack[length] == a) return bStack[length] == b; 14715 } 14716 // Add the first object to the stack of traversed objects. 14717 aStack.push(a); 14718 bStack.push(b); 14719 var size = 0, result = true; 14720 // Recursively compare objects and arrays. 14721 if (className == '[object Array]') { 14722 // Compare array lengths to determine if a deep comparison is necessary. 14723 size = a.length; 14724 result = size == b.length; 14725 if (result) { 14726 // Deep compare the contents, ignoring non-numeric properties. 14727 while (size--) { 14728 if (!(result = eq(a[size], b[size], aStack, bStack))) break; 14729 } 14730 } 14731 } else { 14732 // Objects with different constructors are not equivalent, but `Object`s 14733 // from different frames are. 14734 var aCtor = a.constructor, bCtor = b.constructor; 14735 if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) && 14736 _.isFunction(bCtor) && (bCtor instanceof bCtor))) { 14737 return false;
14738 } 14739 // Deep compare objects. 14740 for (var key in a) { 14741 if (_.has(a, key)) { 14742 // Count the expected number of properties. 14743 size++; 14744 // Deep compare each member. 14745 if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break; 14746 } 14747 } 14748 // Ensure that both objects contain the same number of properties. 14749 if (result) { 14750 for (key in b) { 14751 if (_.has(b, key) && !(size--)) break; 14752 } 14753 result = !size; 14754 } 14755 } 14756 // Remove the first object from the stack of traversed objects. 14757 aStack.pop(); 14758 bStack.pop(); 14759 return result; 14760 }; 14761 14762 // Perform a deep comparison to check if two objects are equal. 14763 _.isEqual = function(a, b) { 14764 return eq(a, b, [], []); 14765 }; 14766 14767 // Is a given array, string, or object empty? 14768 // An "empty" object has no enumerable own-properties. 14769 _.isEmpty = function(obj) { 14770 if (obj == null) return true; 14771 if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; 14772 for (var key in obj) if (_.has(obj, key)) return false; 14773 return true; 14774 }; 14775 14776 // Is a given value a DOM element? 14777 _.isElement = function(obj) { 14778 return !!(obj && obj.nodeType === 1); 14779 }; 14780 14781 // Is a given value an array? 14782 // Delegates to ECMA5's native Array.isArray 14783 _.isArray = nativeIsArray || function(obj) { 14784 return toString.call(obj) == '[object Array]'; 14785 }; 14786 14787 // Is a given variable an object? 14788 _.isObject = function(obj) { 14789 return obj === Object(obj); 14790 }; 14791 14792 // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. 14793 each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { 14794 _['is' + name] = function(obj) { 14795 return toString.call(obj) == '[object ' + name + ']'; 14796 }; 14797 }); 14798 14799 // Define a fallback version of the method in browsers (ahem, IE), where 14800 // there isn't any inspectable "Arguments" type. 14801 if (!_.isArguments(arguments)) { 14802 _.isArguments = function(obj) { 14803 return !!(obj && _.has(obj, 'callee')); 14804 }; 14805 } 14806 14807 // Optimize `isFunction` if appropriate. 14808 if (typeof (/./) !== 'function') { 14809 _.isFunction = function(obj) { 14810 return typeof obj === 'function'; 14811 }; 14812 } 14813 14814 // Is a given object a finite number? 14815 _.isFinite = function(obj) { 14816 return isFinite(obj) && !isNaN(parseFloat(obj)); 14817 }; 14818 14819 // Is the given value `NaN`? (NaN is the only number which does not equal itself). 14820 _.isNaN = function(obj) { 14821 return _.isNumber(obj) && obj != +obj; 14822 }; 14823 14824 // Is a given value a boolean? 14825 _.isBoolean = function(obj) { 14826 return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; 14827 }; 14828 14829 // Is a given value equal to null? 14830 _.isNull = function(obj) { 14831 return obj === null; 14832 }; 14833 14834 // Is a given variable undefined? 14835 _.isUndefined = function(obj) { 14836 return obj === void 0; 14837 }; 14838 14839 // Shortcut function for checking if an object has a given property directly 14840 // on itself (in other words, not on a prototype). 14841 _.has = function(obj, key) { 14842 return hasOwnProperty.call(obj, key); 14843 }; 14844 14845 // Utility Functions 14846 // ----------------- 14847 14848 // Run Underscore.js in *noConflict* mode, returning the `_` variable to its 14849 // previous owner. Returns a reference to the Underscore object. 14850 _.noConflict = function() { 14851 root._ = previousUnderscore; 14852 return this; 14853 }; 14854 14855 // Keep the identity function around for default iterators. 14856 _.identity = function(value) { 14857 return value; 14858 }; 14859 14860 // Run a function **n** times. 14861 _.times = function(n, iterator, context) { 14862 var accum = Array(n); 14863 for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i); 14864 return accum; 14865 }; 14866 14867 // Return a random integer between min and max (inclusive). 14868 _.random = function(min, max) { 14869 if (max == null) { 14870 max = min; 14871 min = 0; 14872 } 14873 return min + Math.floor(Math.random() * (max - min + 1)); 14874 }; 14875 14876 // List of HTML entities for escaping. 14877 var entityMap = { 14878 escape: { 14879 '&': '&', 14880 '<': '<', 14881 '>': '>', 14882 '"': '"', 14883 "'": ''', 14884 '/': '/' 14885 } 14886 }; 14887 entityMap.unescape = _.invert(entityMap.escape); 14888 14889 // Regexes containing the keys and values listed immediately above. 14890 var entityRegexes = { 14891 escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'), 14892 unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g') 14893 }; 14894 14895 // Functions for escaping and unescaping strings to/from HTML interpolation. 14896 _.each(['escape', 'unescape'], function(method) { 14897 _[method] = function(string) { 14898 if (string == null) return ''; 14899 return ('' + string).replace(entityRegexes[method], function(match) { 14900 return entityMap[method][match]; 14901 }); 14902 }; 14903 }); 14904 14905 // If the value of the named property is a function then invoke it; 14906 // otherwise, return it. 14907 _.result = function(object, property) { 14908 if (object == null) return null; 14909 var value = object[property]; 14910 return _.isFunction(value) ? value.call(object) : value; 14911 }; 14912 14913 // Add your own custom functions to the Underscore object. 14914 _.mixin = function(obj) { 14915 each(_.functions(obj), function(name){ 14916 var func = _[name] = obj[name]; 14917 _.prototype[name] = function() { 14918 var args = [this._wrapped]; 14919 push.apply(args, arguments); 14920 return result.call(this, func.apply(_, args)); 14921 }; 14922 }); 14923 }; 14924 14925 // Generate a unique integer id (unique within the entire client session). 14926 // Useful for temporary DOM ids. 14927 var idCounter = 0; 14928 _.uniqueId = function(prefix) { 14929 var id = ++idCounter + ''; 14930 return prefix ? prefix + id : id; 14931 }; 14932 14933 // By default, Underscore uses ERB-style template delimiters, change the 14934 // following template settings to use alternative delimiters. 14935 _.templateSettings = { 14936 evaluate : /<%([\s\S]+?)%>/g, 14937 interpolate : /<%=([\s\S]+?)%>/g, 14938 escape : /<%-([\s\S]+?)%>/g 14939 }; 14940 14941 // When customizing `templateSettings`, if you don't want to define an 14942 // interpolation, evaluation or escaping regex, we need one that is 14943 // guaranteed not to match. 14944 var noMatch = /(.)^/; 14945 14946 // Certain characters need to be escaped so that they can be put into a 14947 // string literal. 14948 var escapes = { 14949 "'": "'", 14950 '\\': '\\', 14951 '\r': 'r', 14952 '\n': 'n', 14953 '\t': 't', 14954 '\u2028': 'u2028', 14955 '\u2029': 'u2029' 14956 }; 14957 14958 var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; 14959 14960 // JavaScript micro-templating, similar to John Resig's implementation. 14961 // Underscore templating handles arbitrary delimiters, preserves whitespace, 14962 // and correctly escapes quotes within interpolated code. 14963 _.template = function(text, data, settings) { 14964 var render; 14965 settings = _.defaults({}, settings, _.templateSettings); 14966 14967 // Combine delimiters into one regular expression via alternation. 14968 var matcher = new RegExp([
14969 (settings.escape || noMatch).source, 14970 (settings.interpolate || noMatch).source, 14971 (settings.evaluate || noMatch).source 14972 ].join('|') + '|$', 'g'); 14973 14974 // Compile the template source, escaping string literals appropriately. 14975 var index = 0; 14976 var source = "__p+='"; 14977 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { 14978 source += text.slice(index, offset) 14979 .replace(escaper, function(match) { return '\\' + escapes[match]; }); 14980 14981 if (escape) { 14982 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; 14983 } 14984 if (interpolate) { 14985 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; 14986 } 14987 if (evaluate) { 14988 source += "';\n" + evaluate + "\n__p+='"; 14989 } 14990 index = offset + match.length; 14991 return match; 14992 }); 14993 source += "';\n"; 14994 14995 // If a variable is not specified, place data values in local scope. 14996 if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; 14997 14998 source = "var __t,__p='',__j=Array.prototype.join," + 14999 "print=function(){__p+=__j.call(arguments,'');};\n" + 15000 source + "return __p;\n"; 15001 15002 try { 15003 render = new Function(settings.variable || 'obj', '_', source); 15004 } catch (e) { 15005 e.source = source; 15006 throw e; 15007 } 15008 15009 if (data) return render(data, _); 15010 var template = function(data) { 15011 return render.call(this, data, _); 15012 }; 15013 15014 // Provide the compiled function source as a convenience for precompilation. 15015 template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; 15016 15017 return template; 15018 }; 15019 15020 // Add a "chain" function, which will delegate to the wrapper. 15021 _.chain = function(obj) { 15022 return _(obj).chain(); 15023 }; 15024 15025 // OOP 15026 // --------------- 15027 // If Underscore is called as a function, it returns a wrapped object that 15028 // can be used OO-style. This wrapper holds altered versions of all the 15029 // underscore functions. Wrapped objects may be chained. 15030 15031 // Helper function to continue chaining intermediate results. 15032 var result = function(obj) { 15033 return this._chain ? _(obj).chain() : obj; 15034 }; 15035 15036 // Add all of the Underscore functions to the wrapper object. 15037 _.mixin(_); 15038 15039 // Add all mutator Array functions to the wrapper. 15040 each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { 15041 var method = ArrayProto[name]; 15042 _.prototype[name] = function() { 15043 var obj = this._wrapped; 15044 method.apply(obj, arguments); 15045 if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; 15046 return result.call(this, obj); 15047 }; 15048 }); 15049 15050 // Add all accessor Array functions to the wrapper. 15051 each(['concat', 'join', 'slice'], function(name) { 15052 var method = ArrayProto[name]; 15053 _.prototype[name] = function() { 15054 return result.call(this, method.apply(this._wrapped, arguments)); 15055 }; 15056 }); 15057 15058 _.extend(_.prototype, { 15059 15060 // Start chaining a wrapped Underscore object. 15061 chain: function() { 15062 this._chain = true; 15063 return this; 15064 }, 15065 15066 // Extracts the result from a wrapped and chained object. 15067 value: function() { 15068 return this._wrapped; 15069 } 15070 15071 }); 15072 15073}).call(this); 15074/* 15075 json2.js 15076 2012-10-08 15077 15078 Public Domain. 15079 15080 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. 15081 15082 See http://www.JSON.org/js.html 15083 15084 15085 This code should be minified before deployment. 15086 See http://javascript.crockford.com/jsmin.html 15087 15088 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO 15089 NOT CONTROL. 15090 15091 15092 This file creates a global JSON object containing two methods: stringify 15093 and parse. 15094 15095 JSON.stringify(value, replacer, space) 15096 value any JavaScript value, usually an object or array. 15097 15098 replacer an optional parameter that determines how object 15099 values are stringified for objects. It can be a 15100 function or an array of strings. 15101 15102 space an optional parameter that specifies the indentation 15103 of nested structures. If it is omitted, the text will 15104 be packed without extra whitespace. If it is a number,
15105 it will specify the number of spaces to indent at each 15106 level. If it is a string (such as '\t' or ' '), 15107 it contains the characters used to indent at each level. 15108 15109 This method produces a JSON text from a JavaScript value. 15110 15111 When an object value is found, if the object contains a toJSON 15112 method, its toJSON method will be called and the result will be 15113 stringified. A toJSON method does not serialize: it returns the 15114 value represented by the name/value pair that should be serialized, 15115 or undefined if nothing should be serialized. The toJSON method 15116 will be passed the key associated with the value, and this will be 15117 bound to the value 15118 15119 For example, this would serialize Dates as ISO strings. 15120 15121 Date.prototype.toJSON = function (key) { 15122 function f(n) { 15123 // Format integers to have at least two digits. 15124 return n < 10 ? '0' + n : n; 15125 } 15126 15127 return this.getUTCFullYear() + '-' + 15128 f(this.getUTCMonth() + 1) + '-' + 15129 f(this.getUTCDate()) + 'T' + 15130 f(this.getUTCHours()) + ':' + 15131 f(this.getUTCMinutes()) + ':' + 15132 f(this.getUTCSeconds()) + 'Z'; 15133 }; 15134 15135 You can provide an optional replacer method. It will be passed the 15136 key and value of each member, with this bound to the containing 15137 object. The value that is returned from your method will be 15138 serialized. If your method returns undefined, then the member will 15139 be excluded from the serialization. 15140 15141 If the replacer parameter is an array of strings, then it will be 15142 used to select the members to be serialized. It filters the results 15143 such that only members with keys listed in the replacer array are 15144 stringified. 15145 15146 Values that do not have JSON representations, such as undefined or 15147 functions, will not be serialized. Such values in objects will be 15148 dropped; in arrays they will be replaced with null. You can use 15149 a replacer function to replace those with JSON values. 15150 JSON.stringify(undefined) returns undefined. 15151 15152 The optional space parameter produces a stringification of the 15153 value that is filled with line breaks and indentation to make it 15154 easier to read. 15155 15156 If the space parameter is a non-empty string, then that string will 15157 be used for indentation. If the space parameter is a number, then 15158 the indentation will be that many spaces. 15159 15160 Example: 15161 15162 text = JSON.stringify(['e', {pluribus: 'unum'}]); 15163 // text is '["e",{"pluribus":"unum"}]' 15164 15165 15166 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); 15167 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' 15168 15169 text = JSON.stringify([new Date()], function (key, value) { 15170 return this[key] instanceof Date ? 15171 'Date(' + this[key] + ')' : value; 15172 }); 15173 // text is '["Date(---current time---)"]' 15174 15175 15176 JSON.parse(text, reviver) 15177 This method parses a JSON text to produce an object or array. 15178 It can throw a SyntaxError exception. 15179 15180 The optional reviver parameter is a function that can filter and 15181 transform the results. It receives each of the keys and values, 15182 and its return value is used instead of the original value. 15183 If it returns what it received, then the structure is not modified. 15184 If it returns undefined then the member is deleted. 15185 15186 Example: 15187 15188 // Parse the text. Values that look like ISO date strings will 15189 // be converted to Date objects. 15190 15191 myData = JSON.parse(text, function (key, value) { 15192 var a; 15193 if (typeof value === 'string') { 15194 a = 15195/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); 15196 if (a) { 15197 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], 15198 +a[5], +a[6])); 15199 } 15200 } 15201 return value; 15202 }); 15203 15204 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { 15205 var d; 15206 if (typeof value === 'string' && 15207 value.slice(0, 5) === 'Date(' && 15208 value.slice(-1) === ')') { 15209 d = new Date(value.slice(5, -1)); 15210 if (d) { 15211 return d; 15212 } 15213 } 15214 return value; 15215 }); 15216 15217 15218 This is a reference implementation. You are free to copy, modify, or 15219 redistribute. 15220*/ 15221 15222/*jslint evil: true, regexp: true */ 15223 15224/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, 15225 call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, 15226 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, 15227 lastIndex, length, parse, prototype, push, replace, slice, stringify, 15228 test, toJSON, toString, valueOf 15229*/ 15230 15231 15232// Create a JSON object only if one does not already exist. We create the 15233// methods in a closure to avoid creating global variables. 15234 15235if (typeof JSON !== 'object') { 15236 JSON = {}; 15237} 15238 15239(function () { 15240 'use strict'; 15241 15242 function f(n) { 15243 // Format integers to have at least two digits. 15244 return n < 10 ? '0' + n : n; 15245 } 15246 15247 if (typeof Date.prototype.toJSON !== 'function') { 15248 15249 Date.prototype.toJSON = function (key) { 15250 15251 return isFinite(this.valueOf()) 15252 ? this.getUTCFullYear() + '-' + 15253 f(this.getUTCMonth() + 1) + '-' + 15254 f(this.getUTCDate()) + 'T' + 15255 f(this.getUTCHours()) + ':' + 15256 f(this.getUTCMinutes()) + ':' + 15257 f(this.getUTCSeconds()) + 'Z' 15258 : null; 15259 }; 15260 15261 String.prototype.toJSON = 15262 Number.prototype.toJSON = 15263 Boolean.prototype.toJSON = function (key
vendor: 10,100 bytes, lines 15263-15559
15263) { 15264 return this.valueOf(); 15265 }; 15266 } 15267 15268 var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 15269 escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 15270 gap, 15271 indent, 15272 meta = { // table of character substitutions 15273 '\b': '\\b', 15274 '\t': '\\t', 15275 '\n': '\\n', 15276 '\f': '\\f', 15277 '\r': '\\r', 15278 '"' : '\\"', 15279 '\\': '\\\\' 15280 }, 15281 rep; 15282 15283 15284 function quote(string) { 15285 15286// If the string contains no control characters, no quote characters, and no 15287// backslash characters, then we can safely slap some quotes around it. 15288// Otherwise we must also replace the offending characters with safe escape 15289// sequences. 15290 15291 escapable.lastIndex = 0; 15292 return escapable.test(string) ? '"' + string.replace(escapable, function (a) { 15293 var c = meta[a]; 15294 return typeof c === 'string' 15295 ? c 15296 : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 15297 }) + '"' : '"' + string + '"'; 15298 } 15299 15300 15301 function str(key, holder) { 15302 15303// Produce a string from holder[key]. 15304 15305 var i, // The loop counter. 15306 k, // The member key. 15307 v, // The member value. 15308 length, 15309 mind = gap, 15310 partial, 15311 value = holder[key]; 15312 15313// If the value has a toJSON method, call it to obtain a replacement value. 15314 15315 if (value && typeof value === 'object' && 15316 typeof value.toJSON === 'function') { 15317 value = value.toJSON(key); 15318 } 15319 15320// If we were called with a replacer function, then call the replacer to 15321// obtain a replacement value. 15322 15323 if (typeof rep === 'function') { 15324 value = rep.call(holder, key, value); 15325 } 15326 15327// What happens next depends on the value's type. 15328 15329 switch (typeof value) { 15330 case 'string': 15331 return quote(value); 15332 15333 case 'number': 15334 15335// JSON numbers must be finite. Encode non-finite numbers as null. 15336 15337 return isFinite(value) ? String(value) : 'null'; 15338 15339 case 'boolean': 15340 case 'null': 15341 15342// If the value is a boolean or null, convert it to a string. Note: 15343// typeof null does not produce 'null'. The case is included here in 15344// the remote chance that this gets fixed someday. 15345 15346 return String(value); 15347 15348// If the type is 'object', we might be dealing with an object or an array or 15349// null. 15350 15351 case 'object': 15352 15353// Due to a specification blunder in ECMAScript, typeof null is 'object', 15354// so watch out for that case. 15355 15356 if (!value) { 15357 return 'null'; 15358 } 15359 15360// Make an array to hold the partial results of stringifying this object value. 15361 15362 gap += indent; 15363 partial = []; 15364 15365// Is the value an array? 15366 15367 if (Object.prototype.toString.apply(value) === '[object Array]') { 15368 15369// The value is an array. Stringify every element. Use null as a placeholder 15370// for non-JSON values. 15371 15372 length = value.length; 15373 for (i = 0; i < length; i += 1) { 15374 partial[i] = str(i, value) || 'null'; 15375 } 15376 15377// Join all of the elements together, separated with commas, and wrap them in 15378// brackets. 15379 15380 v = partial.length === 0 15381 ? '[]' 15382 : gap 15383 ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' 15384 : '[' + partial.join(',') + ']'; 15385 gap = mind; 15386 return v; 15387 } 15388 15389// If the replacer is an array, use it to select the members to be stringified. 15390 15391 if (rep && typeof rep === 'object') { 15392 length = rep.length; 15393 for (i = 0; i < length; i += 1) { 15394 if (typeof rep[i] === 'string') { 15395 k = rep[i]; 15396 v = str(k, value); 15397 if (v) { 15398 partial.push(quote(k) + (gap ? ': ' : ':') + v); 15399 } 15400 } 15401 } 15402 } else { 15403 15404// Otherwise, iterate through all of the keys in the object. 15405 15406 for (k in value) { 15407 if (Object.prototype.hasOwnProperty.call(value, k)) { 15408 v = str(k, value); 15409 if (v) { 15410 partial.push(quote(k) + (gap ? ': ' : ':') + v); 15411 } 15412 } 15413 } 15414 } 15415 15416// Join all of the member texts together, separated with commas, 15417// and wrap them in braces. 15418 15419 v = partial.length === 0 15420 ? '{}' 15421 : gap 15422 ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' 15423 : '{' + partial.join(',') + '}'; 15424 gap = mind; 15425 return v; 15426 } 15427 } 15428 15429// If the JSON object does not yet have a stringify method, give it one. 15430 15431 if (typeof JSON.stringify !== 'function') { 15432 JSON.stringify = function (value, replacer, space) { 15433 15434// The stringify method takes a value and an optional replacer, and an optional 15435// space parameter, and returns a JSON text. The replacer can be a function 15436// that can replace values, or an array of strings that will select the keys. 15437// A default replacer method can be provided. Use of the space parameter can 15438// produce text that is more easily readable. 15439 15440 var i; 15441 gap = ''; 15442 indent = ''; 15443 15444// If the space parameter is a number, make an indent string containing that 15445// many spaces. 15446 15447 if (typeof space === 'number') { 15448 for (i = 0; i < space; i += 1) { 15449 indent += ' '; 15450 } 15451 15452// If the space parameter is a string, it will be used as the indent string. 15453 15454 } else if (typeof space === 'string') { 15455 indent = space; 15456 } 15457 15458// If there is a replacer, it must be a function or an array. 15459// Otherwise, throw an error. 15460 15461 rep = replacer; 15462 if (replacer && typeof replacer !== 'function' && 15463 (typeof replacer !== 'object' || 15464 typeof replacer.length !== 'number')) { 15465 throw new Error('JSON.stringify'); 15466 } 15467 15468// Make a fake root object containing our value under the key of ''. 15469// Return the result of stringifying the value. 15470 15471 return str('', {'': value}); 15472 }; 15473 } 15474 15475 15476// If the JSON object does not yet have a parse method, give it one. 15477 15478 if (typeof JSON.parse !== 'function') { 15479 JSON.parse = function (text, reviver) { 15480 15481// The parse method takes a text and an optional reviver function, and returns 15482// a JavaScript value if the text is a valid JSON text. 15483 15484 var j; 15485 15486 function walk(holder, key) { 15487 15488// The walk method is used to recursively walk the resulting structure so 15489// that modifications can be made. 15490 15491 var k, v, value = holder[key]; 15492 if (value && typeof value === 'object') { 15493 for (k in value) { 15494 if (Object.prototype.hasOwnProperty.call(value, k)) { 15495 v = walk(value, k); 15496 if (v !== undefined) { 15497 value[k] = v; 15498 } else { 15499 delete value[k]; 15500 } 15501 } 15502 } 15503 } 15504 return reviver.call(holder, key, value); 15505 } 15506 15507 15508// Parsing happens in four stages. In the first stage, we replace certain 15509// Unicode characters with escape sequences. JavaScript handles many characters 15510// incorrectly, either silently deleting them, or treating them as line endings. 15511 15512 text = String(text); 15513 cx.lastIndex = 0; 15514 if (cx.test(text)) { 15515 text = text.replace(cx, function (a) { 15516 return '\\u' + 15517 ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 15518 }); 15519 } 15520 15521// In the second stage, we run the text against regular expressions that look 15522// for non-JSON patterns. We are especially concerned with '()' and 'new' 15523// because they can cause invocation, and '=' because it can cause mutation. 15524// But just to be safe, we want to reject all unexpected forms. 15525 15526// We split the second stage into 4 regexp operations in order to work around 15527// crippling inefficiencies in IE's and Safari's regexp engines. First we 15528// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we 15529// replace all simple value tokens with ']' characters. Third, we delete all 15530// open brackets that follow a colon or comma or that begin the text. Finally, 15531// we look to see that the remaining characters are only whitespace or ']' or 15532// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. 15533 15534 if (/^[\],:{}\s]*$/ 15535 .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') 15536 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') 15537 .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { 15538 15539// In the third stage we use the eval function to compile the text into a 15540// JavaScript structure. The '{' operator is subject to a syntactic ambiguity 15541// in JavaScript: it can begin a block or an object literal. We wrap the text 15542// in parens to eliminate the ambiguity. 15543 15544 j = eval('(' + text + ')'); 15545 15546// In the optional fourth stage, we recursively walk the new structure, passing 15547// each name/value pair to a reviver function for possible transformation. 15548 15549 return typeof reviver === 'function' 15550 ? walk({'': j}, '') 15551 : j; 15552 } 15553 15554// If the text is not JSON parseable, then a SyntaxError is thrown. 15555 15556 throw new SyntaxError('JSON.parse'); 15557 }; 15558 } 15559}());
15560// Judge 2.1.0 15561// (c) 2011-2013 Joe Corcoran 15562// http://raw.github.com/joecorcoran/judge/master/LICENSE.txt 15563 15564// This is judge.js: the JavaScript part of Judge. Judge is a client-side 15565// validation gem for Rails 3. You can find the Judge gem API documentation at 15566// <http://judge.joecorcoran.co.uk>. 15567 15568(function() { 15569 15570 var root = this; 15571 15572 // The judge namespace. 15573 var judge = root.judge = {}, 15574 _ = root._; 15575 15576 judge.VERSION = '2.1.0'; 15577 15578 // Trying to be a bit more descriptive than the basic error types allow. 15579 var DependencyError = function(message) { 15580 this.name = 'DependencyError'; 15581 this.message = message; 15582 }; 15583 DependencyError.prototype = new Error(); 15584 DependencyError.prototype.constructor = DependencyError; 15585 15586 // Throw dependency errors if necessary. 15587 if (typeof _ === 'undefined') { 15588 throw new DependencyError('Ensure underscore.js is loaded'); 15589 } 15590 if (_.isUndefined(root.JSON)) { 15591 throw new DependencyError( 15592 'Judge depends on the global JSON object (load json2.js in old browsers)' 15593 ); 15594 } 15595 15596 // Returns the object type as represented in `Object.prototype.toString`. 15597 var objectString = function(object) { 15598 var string = Object.prototype.toString.call(object); 15599 return string.replace(/\[|\]/g, '').split(' ')[1]; 15600 }; 15601 15602 // A way of checking isArray, but including weird object types that are 15603 // returned from collection queries. 15604 var isCollection = function(object) { 15605 var type = objectString(object), 15606 types = [ 15607 'Array', 15608 'NodeList', 15609 'StaticNodeList', 15610 'HTMLCollection', 15611 'HTMLFormElement', 15612 'HTMLAllCollection' 15613 ]; 15614 return _(types).include(type); 15615 }; 15616 15617 // eval is used here for stuff like `(3, '<', 4) => '3 < 4' => true`. 15618 var operate = function(input, operator, validInput) { 15619 return eval(input+' '+operator+' '+validInput); 15620 }; 15621 15622 // Some nifty numerical helpers. 15623 var 15624 isInt = function(value) { return Math.round(value) == value; }, 15625 isEven = function(value) { return (value % 2 === 0) ? true : false; }, 15626 isOdd = function(value) { return !isEven(value); }; 15627 15628 // Converts a Ruby regular expression, given as a string, into JavaScript. 15629 // This is rudimentary at best, as there are many, many differences between 15630 // Ruby and JavaScript when it comes to regexp-fu. The plan is to replace this 15631 // with an XRegExp plugin which will port some Ruby regexp features to 15632 // JavaScript. 15633 var convertFlags = function(string) { 15634 var on = string.split('-')[0]; 15635 return (/m/.test(on)) ? 'm' : ''; 15636 }; 15637 var convertRegExp = function(string) { 15638 var parts = string.slice(1, -1).split(':'), 15639 flags = parts.shift().replace('?', ''), 15640 source = parts.join(':').replace(/\\\\/g, '\\').replace('\\A', '^').replace('\\z', '$'); 15641 return new RegExp(source, convertFlags(flags)); 15642 }; 15643 15644 // Returns a browser-specific XHR object, or null if one cannot be constructed. 15645 var reqObj = function() { 15646 return ( 15647 (root.ActiveXObject && new root.ActiveXObject('Microsoft.XMLHTTP')) || 15648 (root.XMLHttpRequest && new root.XMLHttpRequest()) || 15649 null 15650 ); 15651 }; 15652 15653 // Performs a GET request using the browser's XHR object. This provides very 15654 // basic ajax capability and was written specifically for use in the provided 15655 // uniqueness validator without requiring jQuery. 15656 var get = judge.get = function(url, callbacks) { 15657 var req = reqObj(); 15658 if (!!req) { 15659 req.onreadystatechange = function() { 15660 if (req.readyState === 4) { 15661 req.onreadystatechange = function() {}; 15662 var callback = /^20\d$/.test(req.status) ? callbacks.success : callbacks['error']; 15663 callback(req.status, req.responseHeaders, req.responseText); 15664 } 15665 }; 15666 req.open('GET', url, true); 15667 req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 15668 req.setRequestHeader('Accept', 'application/json'); 15669 req.send(); 15670 } 15671 return req; 15672 }; 15673 15674 // Some helper methods for working with Rails-style input attributes. 15675 var 15676 attrFromName = function(name) { 15677 var matches, attr = '';
15678 if (matches = name.match(/\[(\w+)\]$/)) { 15679 attr = matches[1]; 15680 } 15681 return attr; 15682 }; 15683 originalValue = function(el) { 15684 var validations = JSON.parse(el.getAttribute('data-validate')); 15685 var validation = _.filter(validations, function (validation) { return validation.kind === "uniqueness"})[0]; 15686 return validation.original_value; 15687 }; 15688 15689 // Build the URL necessary to send a GET request to the mounted validations 15690 // controller to check the validity of the given form element. 15691 var urlFor = judge.urlFor = function(el, kind) { 15692 var path = judge.enginePath, 15693 params = { 15694 'klass' : el.getAttribute('data-klass'), 15695 'attribute': attrFromName(el.name), 15696 'value' : el.value, 15697 'kind' : kind 15698 }; 15699 if (kind === 'uniqueness') { 15700 params['original_value'] = originalValue(el); 15701 } 15702 return path + queryString(params); 15703 }; 15704 15705 // Convert an object literal into an encoded query string. 15706 var queryString = function(obj) { 15707 var e = encodeURIComponent, 15708 qs = _.reduce(obj, function(memo, value, key) { 15709 return memo + e(key) + '=' + e(value) + '&'; 15710 }, '?'); 15711 return qs.replace(/&$/, '').replace(/%20/g, '+'); 15712 }; 15713 15714 // Default path to mounted engine. Override this if you decide to mount 15715 // Judge::Engine at a different location. 15716 judge.enginePath = '/judge'; 15717 15718 // Provides event dispatch behaviour when mixed into an object. Concept 15719 // taken from Backbone.js, stripped down and altered. 15720 // Backbone.js (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. 15721 // http://backbonejs.org 15722 var Dispatcher = judge.Dispatcher = { 15723 on: function(eventName, callback, scope) { 15724 if (!_.isFunction(callback)) return this; 15725 this._events || (this._events = {}); 15726 var events = this._events[eventName] || (this._events[eventName] = []); 15727 events.push({ callback: callback, scope: scope || this }); 15728 if (eventName !== 'bind') { 15729 this.trigger('bind', eventName); 15730 } 15731 return this; 15732 }, 15733 trigger: function(eventName) { 15734 if (!this._events) return this; 15735 var args = _.rest(arguments), 15736 events = this._events[eventName] || (this._events[eventName] = []); 15737 _.each(events, function(eventObj) { 15738 eventObj.callback.apply(eventObj.scope, args); 15739 }); 15740 return this; 15741 } 15742 }; 15743 15744 // A queue of closed or pending Validation objects. 15745 var ValidationQueue = judge.ValidationQueue = function(element) { 15746 this.element = element; 15747 this.validations = []; 15748 this.attrValidators = root.JSON.parse(this.element.getAttribute('data-validate')); 15749 15750 _.each(this.attrValidators, function(av) { 15751 if (this.element.value.length || av.options.allow_blank !== true) { 15752 var method = _.bind(judge.eachValidators[av.kind], this.element), 15753 validation = method(av.options, av.messages); 15754 validation.on('close', this.tryClose, this); 15755 this.validations.push(validation); 15756 } 15757 }, this); 15758 15759 this.on('bind', this.tryClose, this); 15760 }; 15761 15762 _.extend(ValidationQueue.prototype, Dispatcher, { 15763 tryClose: function(eventName) { 15764 var report = _.reduce(this.validations, function(obj, validation) { 15765 obj.statuses = _.union(obj.statuses, [validation.status()]); 15766 obj.messages = _.union(obj.messages, _.compact(validation.messages)); 15767 return obj; 15768 }, { statuses: [], messages: [] }, this); 15769 15770 if (!_.contains(report.statuses, 'pending')) { 15771 var status = _.contains(report.statuses, 'invalid') ? 'invalid' : 'valid'; 15772 15773 // handle single callback 15774 this.trigger('close', this.element, status, report.messages); 15775 15776 // handle named callbacks 15777 this.trigger(status, this.element, report.messages); 15778 } 15779 } 15780 }); 15781 15782 // Event-capable object returned by validator methods. 15783 var Validation = judge.Validation = function(messages) { 15784 this.messages = null; 15785 if (_.isArray(messages)) this.close(messages); 15786 return this; 15787 }; 15788 _.extend(Validation.prototype, Dispatcher, { 15789 close: function(messages) { 15790 if (this.closed()) return null; 15791 this.messages = _.isString(messages) ? root.JSON.parse(messages) : messages; 15792 this.trigger('close', this.status(), this.messages); 15793 return this; 15794 }, 15795 closed: function() { 15796 return _.isArray(this.messages); 15797 }, 15798 status: function() { 15799 if (!this.closed()) return 'pending'; 15800 return this.messages.length > 0 ? 'invalid' : 'valid'; 15801 } 15802 }); 15803 15804 // Convenience methods for creating Validation objects in different states.
15805 var pending = judge.pending = function() { 15806 return new Validation(); 15807 }; 15808 var closed = judge.closed = function(messages) { 15809 return new Validation(messages); 15810 }; 15811 15812 // Ported ActiveModel validators. 15813 // See <http://api.rubyonrails.org/classes/ActiveModel/Validations.html> for 15814 // the originals. 15815 judge.eachValidators = { 15816 // ActiveModel::Validations::PresenceValidator 15817 presence: function(options, messages) { 15818 if (this.type === 'radio') { 15819 var is_selected = root.document.querySelectorAll('[name="'+this.name+'"]:checked').length; 15820 return closed(is_selected ? [] : [messages.blank]); 15821 } else { 15822 return closed(this.value.length ? [] : [messages.blank]); 15823 } 15824 }, 15825 15826 // ActiveModel::Validations::LengthValidator 15827 length: function(options, messages) { 15828 var msgs = [], 15829 types = { 15830 minimum: { operator: '<', message: 'too_short' }, 15831 maximum: { operator: '>', message: 'too_long' }, 15832 is: { operator: '!=', message: 'wrong_length' } 15833 }; 15834 _(types).each(function(properties, type) { 15835 var invalid = operate(this.value.length, properties.operator, options[type]); 15836 if (_(options).has(type) && invalid) { 15837 msgs.push(messages[properties.message]); 15838 } 15839 }, this); 15840 return closed(msgs); 15841 }, 15842 15843 // ActiveModel::Validations::ExclusionValidator 15844 exclusion: function(options, messages) { 15845 var stringIn = _(options['in']).map(function(o) { 15846 return o.toString(); 15847 }); 15848 return closed( 15849 _.include(stringIn, this.value) ? [messages.exclusion] : [] 15850 ); 15851 }, 15852 15853 // ActiveModel::Validations::InclusionValidator 15854 inclusion: function(options, messages) { 15855 var stringIn = _(options['in']).map(function(o) { 15856 return o.toString(); 15857 }); 15858 return closed( 15859 !_.include(stringIn, this.value) ? [messages.inclusion] : [] 15860 ); 15861 }, 15862 15863 // ActiveModel::Validations::NumericalityValidator 15864 numericality: function(options, messages) { 15865 var operators = { 15866 greater_than: '>', 15867 greater_than_or_equal_to: '>=', 15868 equal_to: '==', 15869 less_than: '<', 15870 less_than_or_equal_to: '<=' 15871 }, 15872 msgs = [], 15873 parsedValue = parseFloat(this.value, 10); 15874 15875 if (isNaN(Number(this.value))) { 15876 msgs.push(messages.not_a_number); 15877 } else { 15878 if (options.odd && isEven(parsedValue)) msgs.push(messages.odd); 15879 if (options.even && isOdd(parsedValue)) msgs.push(messages.even); 15880 if (options.only_integer && !isInt(parsedValue)) msgs.push(messages.not_an_integer); 15881 _(operators).each(function(operator, key) { 15882 var valid = operate(parsedValue, operators[key], parseFloat(options[key], 10)); 15883 if (_(options).has(key) && !valid) { 15884 msgs.push(messages[key]); 15885 } 15886 }); 15887 } 15888 return closed(msgs); 15889 }, 15890 15891 // ActiveModel::Validations::FormatValidator 15892 format: function(options, messages) { 15893 var msgs = []; 15894 if (_(options).has('with')) { 15895 var withReg = convertRegExp(options['with']); 15896 if (!withReg.test(this.value)) { 15897 msgs.push(messages.invalid); 15898 } 15899 } 15900 if (_(options).has('without')) { 15901 var withoutReg = convertRegExp(options.without); 15902 if (withoutReg.test(this.value)) { 15903 msgs.push(messages.invalid); 15904 } 15905 } 15906 return closed(msgs); 15907 }, 15908 15909 // ActiveModel::Validations::AcceptanceValidator 15910 acceptance: function(options, messages) { 15911 return closed(this.checked === true ? [] : [messages.accepted]); 15912 }, 15913 15914 // ActiveModel::Validations::ConfirmationValidator 15915 confirmation: function(options, messages) { 15916 var id = this.getAttribute('id'), 15917 confId = id.replace('_confirmation', ''), 15918 confElem = root.document.getElementById(confId); 15919 return closed( 15920 this.value === confElem.value ? [] : [messages.confirmation] 15921 ); 15922 }, 15923 15924 // ActiveModel::Validations::UniquenessValidator 15925 uniqueness: function(options, messages) {
15926 var validation = pending(); 15927 get(urlFor(this, 'uniqueness'), { 15928 success: function(status, headers, text) { 15929 validation.close(text); 15930 }, 15931 error: function(status, headers, text) { 15932 validation.close(['Request error: ' + status]); 15933 } 15934 }); 15935 return validation; 15936 } 15937 }; 15938 15939 var isCallbacksObj = function(obj) { 15940 return _.isObject(obj) && _.has(obj, 'valid') && _.has(obj, 'invalid'); 15941 }; 15942 15943 // Method for validating a form element. Pass either a single 15944 // callback or one for valid and one for invalid. 15945 judge.validate = function(element, callbacks) { 15946 var queue = new ValidationQueue(element); 15947 if (_.isFunction(callbacks)) { 15948 queue.on('close', callbacks); 15949 } else if (isCallbacksObj(callbacks)) { 15950 queue.on('valid', _.once(callbacks.valid)); 15951 queue.on('invalid', _.once(callbacks.invalid)); 15952 } 15953 return queue; 15954 }; 15955 15956}).call(this); 15957/*! 15958 * jQuery JavaScript Library v3.7.0 15959 * https://jquery.com/ 15960 * 15961 * Copyright OpenJS Foundation and other contributors 15962 * Released under the MIT license 15963 * https://jquery.org/license 15964 * 15965 * Date: 2023-05-11T18:29Z 15966 */ 15967 15968( function( global, factory ) { 15969 15970 "use strict"; 15971 15972 if ( typeof module === "object" && typeof module.exports === "object" ) { 15973 15974 // For CommonJS and CommonJS-like environments where a proper `window` 15975 // is present, execute the factory and get jQuery. 15976 // For environments that do not have a `window` with a `document` 15977 // (such as Node.js), expose a factory as module.exports. 15978 // This accentuates the need for the creation of a real `window`. 15979 // e.g. var jQuery = require("jquery")(window); 15980 // See ticket trac-14549 for more info. 15981 module.exports = global.document ? 15982 factory( global, true ) : 15983 function( w ) { 15984 if ( !w.document ) { 15985 throw new Error( "jQuery requires a window with a document" ); 15986 } 15987 return factory( w ); 15988 }; 15989 } else { 15990 factory( global ); 15991 } 15992 15993// Pass this if window is not defined yet 15994} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 15995 15996// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 15997// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 15998// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 15999// enough that all such attempts are guarded in a try block. 16000"use strict"; 16001 16002var arr = []; 16003 16004var getProto = Object.getPrototypeOf; 16005 16006var slice = arr.slice; 16007 16008var flat = arr.flat ? function( array ) { 16009 return arr.flat.call( array ); 16010} : function( array ) { 16011 return arr.concat.apply( [], array ); 16012}; 16013 16014 16015var push = arr.push; 16016 16017var indexOf = arr.indexOf; 16018 16019var class2type = {}; 16020 16021var toString = class2type.toString; 16022 16023var hasOwn = class2type.hasOwnProperty; 16024 16025var fnToString = hasOwn.toString; 16026 16027var ObjectFunctionString = fnToString.call( Object ); 16028 16029var support = {}; 16030 16031var isFunction = function isFunction( obj ) { 16032 16033 // Support: Chrome <=57, Firefox <=52 16034 // In some browsers, typeof returns "function" for HTML <object> elements 16035 // (i.e., `typeof document.createElement( "object" ) === "function"`). 16036 // We don't want to classify *any* DOM node as a function.
vendor: 8,132 bytes, lines 16037-16373
16037 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 16038 // Plus for old WebKit, typeof returns "function" for HTML collections 16039 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 16040 return typeof obj === "function" && typeof obj.nodeType !== "number" && 16041 typeof obj.item !== "function"; 16042 }; 16043 16044 16045var isWindow = function isWindow( obj ) { 16046 return obj != null && obj === obj.window; 16047 }; 16048 16049 16050var document = window.document; 16051 16052 16053 16054 var preservedScriptAttributes = { 16055 type: true, 16056 src: true, 16057 nonce: true, 16058 noModule: true 16059 }; 16060 16061 function DOMEval( code, node, doc ) { 16062 doc = doc || document; 16063 16064 var i, val, 16065 script = doc.createElement( "script" ); 16066 16067 script.text = code; 16068 if ( node ) { 16069 for ( i in preservedScriptAttributes ) { 16070 16071 // Support: Firefox 64+, Edge 18+ 16072 // Some browsers don't support the "nonce" property on scripts. 16073 // On the other hand, just using `getAttribute` is not enough as 16074 // the `nonce` attribute is reset to an empty string whenever it 16075 // becomes browsing-context connected. 16076 // See https://github.com/whatwg/html/issues/2369 16077 // See https://html.spec.whatwg.org/#nonce-attributes 16078 // The `node.getAttribute` check was added for the sake of 16079 // `jQuery.globalEval` so that it can fake a nonce-containing node 16080 // via an object. 16081 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 16082 if ( val ) { 16083 script.setAttribute( i, val ); 16084 } 16085 } 16086 } 16087 doc.head.appendChild( script ).parentNode.removeChild( script ); 16088 } 16089 16090 16091function toType( obj ) { 16092 if ( obj == null ) { 16093 return obj + ""; 16094 } 16095 16096 // Support: Android <=2.3 only (functionish RegExp) 16097 return typeof obj === "object" || typeof obj === "function" ? 16098 class2type[ toString.call( obj ) ] || "object" : 16099 typeof obj; 16100} 16101/* global Symbol */ 16102// Defining this global in .eslintrc.json would create a danger of using the global 16103// unguarded in another place, it seems safer to define global only for this module 16104 16105 16106 16107var version = "3.7.0", 16108 16109 rhtmlSuffix = /HTML$/i, 16110 16111 // Define a local copy of jQuery 16112 jQuery = function( selector, context ) { 16113 16114 // The jQuery object is actually just the init constructor 'enhanced' 16115 // Need init if jQuery is called (just allow error to be thrown if not included) 16116 return new jQuery.fn.init( selector, context ); 16117 }; 16118 16119jQuery.fn = jQuery.prototype = { 16120 16121 // The current version of jQuery being used 16122 jquery: version, 16123 16124 constructor: jQuery, 16125 16126 // The default length of a jQuery object is 0 16127 length: 0, 16128 16129 toArray: function() { 16130 return slice.call( this ); 16131 }, 16132 16133 // Get the Nth element in the matched element set OR 16134 // Get the whole matched element set as a clean array 16135 get: function( num ) { 16136 16137 // Return all the elements in a clean array 16138 if ( num == null ) { 16139 return slice.call( this ); 16140 } 16141 16142 // Return just the one element from the set 16143 return num < 0 ? this[ num + this.length ] : this[ num ]; 16144 }, 16145 16146 // Take an array of elements and push it onto the stack 16147 // (returning the new matched element set) 16148 pushStack: function( elems ) { 16149 16150 // Build a new jQuery matched element set 16151 var ret = jQuery.merge( this.constructor(), elems ); 16152 16153 // Add the old object onto the stack (as a reference) 16154 ret.prevObject = this; 16155 16156 // Return the newly-formed element set 16157 return ret; 16158 }, 16159 16160 // Execute a callback for every element in the matched set. 16161 each: function( callback ) { 16162 return jQuery.each( this, callback ); 16163 }, 16164 16165 map: function( callback ) { 16166 return this.pushStack( jQuery.map( this, function( elem, i ) { 16167 return callback.call( elem, i, elem ); 16168 } ) ); 16169 }, 16170 16171 slice: function() { 16172 return this.pushStack( slice.apply( this, arguments ) ); 16173 }, 16174 16175 first: function() { 16176 return this.eq( 0 ); 16177 }, 16178 16179 last: function() { 16180 return this.eq( -1 ); 16181 }, 16182 16183 even: function() { 16184 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 16185 return ( i + 1 ) % 2; 16186 } ) ); 16187 }, 16188 16189 odd: function() { 16190 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 16191 return i % 2; 16192 } ) ); 16193 }, 16194 16195 eq: function( i ) { 16196 var len = this.length, 16197 j = +i + ( i < 0 ? len : 0 ); 16198 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 16199 }, 16200 16201 end: function() { 16202 return this.prevObject || this.constructor(); 16203 }, 16204 16205 // For internal use only. 16206 // Behaves like an Array's method, not like a jQuery method. 16207 push: push, 16208 sort: arr.sort, 16209 splice: arr.splice 16210}; 16211 16212jQuery.extend = jQuery.fn.extend = function() { 16213 var options, name, src, copy, copyIsArray, clone, 16214 target = arguments[ 0 ] || {}, 16215 i = 1, 16216 length = arguments.length, 16217 deep = false; 16218 16219 // Handle a deep copy situation 16220 if ( typeof target === "boolean" ) { 16221 deep = target; 16222 16223 // Skip the boolean and the target 16224 target = arguments[ i ] || {}; 16225 i++; 16226 } 16227 16228 // Handle case when target is a string or something (possible in deep copy) 16229 if ( typeof target !== "object" && !isFunction( target ) ) { 16230 target = {}; 16231 } 16232 16233 // Extend jQuery itself if only one argument is passed 16234 if ( i === length ) { 16235 target = this; 16236 i--; 16237 } 16238 16239 for ( ; i < length; i++ ) { 16240 16241 // Only deal with non-null/undefined values 16242 if ( ( options = arguments[ i ] ) != null ) { 16243 16244 // Extend the base object 16245 for ( name in options ) { 16246 copy = options[ name ]; 16247 16248 // Prevent Object.prototype pollution 16249 // Prevent never-ending loop 16250 if ( name === "__proto__" || target === copy ) { 16251 continue; 16252 } 16253 16254 // Recurse if we're merging plain objects or arrays 16255 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 16256 ( copyIsArray = Array.isArray( copy ) ) ) ) { 16257 src = target[ name ]; 16258 16259 // Ensure proper type for the source value 16260 if ( copyIsArray && !Array.isArray( src ) ) { 16261 clone = []; 16262 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 16263 clone = {}; 16264 } else { 16265 clone = src; 16266 } 16267 copyIsArray = false; 16268 16269 // Never move original objects, clone them 16270 target[ name ] = jQuery.extend( deep, clone, copy ); 16271 16272 // Don't bring in undefined values 16273 } else if ( copy !== undefined ) { 16274 target[ name ] = copy; 16275 } 16276 } 16277 } 16278 } 16279 16280 // Return the modified object 16281 return target; 16282}; 16283 16284jQuery.extend( { 16285 16286 // Unique for each copy of jQuery on the page 16287 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 16288 16289 // Assume jQuery is ready without the ready module 16290 isReady: true, 16291 16292 error: function( msg ) { 16293 throw new Error( msg ); 16294 }, 16295 16296 noop: function() {}, 16297 16298 isPlainObject: function( obj ) { 16299 var proto, Ctor; 16300 16301 // Detect obvious negatives 16302 // Use toString instead of jQuery.type to catch host objects 16303 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 16304 return false; 16305 } 16306 16307 proto = getProto( obj ); 16308 16309 // Objects with no prototype (e.g., `Object.create( null )`) are plain 16310 if ( !proto ) { 16311 return true; 16312 } 16313 16314 // Objects with prototype are plain iff they were constructed by a global Object function 16315 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 16316 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 16317 }, 16318 16319 isEmptyObject: function( obj ) { 16320 var name; 16321 16322 for ( name in obj ) { 16323 return false; 16324 } 16325 return true; 16326 }, 16327 16328 // Evaluates a script in a provided context; falls back to the global one 16329 // if not specified. 16330 globalEval: function( code, options, doc ) { 16331 DOMEval( code, { nonce: options && options.nonce }, doc ); 16332 }, 16333 16334 each: function( obj, callback ) { 16335 var length, i = 0; 16336 16337 if ( isArrayLike( obj ) ) { 16338 length = obj.length; 16339 for ( ; i < length; i++ ) { 16340 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 16341 break; 16342 } 16343 } 16344 } else { 16345 for ( i in obj ) { 16346 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 16347 break; 16348 } 16349 } 16350 } 16351 16352 return obj; 16353 }, 16354 16355 16356 // Retrieve the text value of an array of DOM nodes 16357 text: function( elem ) { 16358 var node, 16359 ret = "", 16360 i = 0, 16361 nodeType = elem.nodeType; 16362 16363 if ( !nodeType ) { 16364 16365 // If no nodeType, this is expected to be an array 16366 while ( ( node = elem[ i++ ] ) ) { 16367 16368 // Do not traverse comment nodes 16369 ret += jQuery.text( node ); 16370 } 16371 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 16372 return elem.textContent; 16373 } else
vendor: 19,662 bytes, lines 16373-17086
16373if ( nodeType === 3 || nodeType === 4 ) { 16374 return elem.nodeValue; 16375 } 16376 16377 // Do not include comment or processing instruction nodes 16378 16379 return ret; 16380 }, 16381 16382 // results is for internal usage only 16383 makeArray: function( arr, results ) { 16384 var ret = results || []; 16385 16386 if ( arr != null ) { 16387 if ( isArrayLike( Object( arr ) ) ) { 16388 jQuery.merge( ret, 16389 typeof arr === "string" ? 16390 [ arr ] : arr 16391 ); 16392 } else { 16393 push.call( ret, arr ); 16394 } 16395 } 16396 16397 return ret; 16398 }, 16399 16400 inArray: function( elem, arr, i ) { 16401 return arr == null ? -1 : indexOf.call( arr, elem, i ); 16402 }, 16403 16404 isXMLDoc: function( elem ) { 16405 var namespace = elem && elem.namespaceURI, 16406 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 16407 16408 // Assume HTML when documentElement doesn't yet exist, such as inside 16409 // document fragments. 16410 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 16411 }, 16412 16413 // Support: Android <=4.0 only, PhantomJS 1 only 16414 // push.apply(_, arraylike) throws on ancient WebKit 16415 merge: function( first, second ) { 16416 var len = +second.length, 16417 j = 0, 16418 i = first.length; 16419 16420 for ( ; j < len; j++ ) { 16421 first[ i++ ] = second[ j ]; 16422 } 16423 16424 first.length = i; 16425 16426 return first; 16427 }, 16428 16429 grep: function( elems, callback, invert ) { 16430 var callbackInverse, 16431 matches = [], 16432 i = 0, 16433 length = elems.length, 16434 callbackExpect = !invert; 16435 16436 // Go through the array, only saving the items 16437 // that pass the validator function 16438 for ( ; i < length; i++ ) { 16439 callbackInverse = !callback( elems[ i ], i ); 16440 if ( callbackInverse !== callbackExpect ) { 16441 matches.push( elems[ i ] ); 16442 } 16443 } 16444 16445 return matches; 16446 }, 16447 16448 // arg is for internal usage only 16449 map: function( elems, callback, arg ) { 16450 var length, value, 16451 i = 0, 16452 ret = []; 16453 16454 // Go through the array, translating each of the items to their new values 16455 if ( isArrayLike( elems ) ) { 16456 length = elems.length; 16457 for ( ; i < length; i++ ) { 16458 value = callback( elems[ i ], i, arg ); 16459 16460 if ( value != null ) { 16461 ret.push( value ); 16462 } 16463 } 16464 16465 // Go through every key on the object, 16466 } else { 16467 for ( i in elems ) { 16468 value = callback( elems[ i ], i, arg ); 16469 16470 if ( value != null ) { 16471 ret.push( value ); 16472 } 16473 } 16474 } 16475 16476 // Flatten any nested arrays 16477 return flat( ret ); 16478 }, 16479 16480 // A global GUID counter for objects 16481 guid: 1, 16482 16483 // jQuery.support is not used in Core but other projects attach their 16484 // properties to it so it needs to exist. 16485 support: support 16486} ); 16487 16488if ( typeof Symbol === "function" ) { 16489 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 16490} 16491 16492// Populate the class2type map 16493jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 16494 function( _i, name ) { 16495 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 16496 } ); 16497 16498function isArrayLike( obj ) { 16499 16500 // Support: real iOS 8.2 only (not reproducible in simulator) 16501 // `in` check used to prevent JIT error (gh-2145) 16502 // hasOwn isn't used here due to false negatives 16503 // regarding Nodelist length in IE 16504 var length = !!obj && "length" in obj && obj.length, 16505 type = toType( obj ); 16506 16507 if ( isFunction( obj ) || isWindow( obj ) ) { 16508 return false; 16509 } 16510 16511 return type === "array" || length === 0 || 16512 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 16513} 16514 16515 16516function nodeName( elem, name ) { 16517 16518 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 16519 16520} 16521var pop = arr.pop; 16522 16523 16524var sort = arr.sort; 16525 16526 16527var splice = arr.splice; 16528 16529 16530var whitespace = "[\\x20\\t\\r\\n\\f]"; 16531 16532 16533var rtrimCSS = new RegExp( 16534 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 16535 "g" 16536); 16537 16538 16539 16540 16541// Note: an element does not contain itself 16542jQuery.contains = function( a, b ) { 16543 var bup = b && b.parentNode; 16544 16545 return a === bup || !!( bup && bup.nodeType === 1 && ( 16546 16547 // Support: IE 9 - 11+ 16548 // IE doesn't have `contains` on SVG. 16549 a.contains ? 16550 a.contains( bup ) : 16551 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 16552 ) ); 16553}; 16554 16555 16556 16557 16558// CSS string/identifier serialization 16559// https://drafts.csswg.org/cssom/#common-serializing-idioms 16560var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 16561 16562function fcssescape( ch, asCodePoint ) { 16563 if ( asCodePoint ) { 16564 16565 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 16566 if ( ch === "\0" ) { 16567 return "\uFFFD"; 16568 } 16569 16570 // Control characters and (dependent upon position) numbers get escaped as code points 16571 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 16572 } 16573 16574 // Other potentially-special ASCII characters get backslash-escaped 16575 return "\\" + ch; 16576} 16577 16578jQuery.escapeSelector = function( sel ) { 16579 return ( sel + "" ).replace( rcssescape, fcssescape ); 16580}; 16581 16582 16583 16584 16585var preferredDoc = document, 16586 pushNative = push; 16587 16588( function() { 16589 16590var i, 16591 Expr, 16592 outermostContext, 16593 sortInput, 16594 hasDuplicate, 16595 push = pushNative, 16596 16597 // Local document vars 16598 document, 16599 documentElement, 16600 documentIsHTML, 16601 rbuggyQSA, 16602 matches, 16603 16604 // Instance-specific data 16605 expando = jQuery.expando, 16606 dirruns = 0, 16607 done = 0, 16608 classCache = createCache(), 16609 tokenCache = createCache(), 16610 compilerCache = createCache(), 16611 nonnativeSelectorCache = createCache(), 16612 sortOrder = function( a, b ) { 16613 if ( a === b ) { 16614 hasDuplicate = true; 16615 } 16616 return 0; 16617 }, 16618 16619 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 16620 "loop|multiple|open|readonly|required|scoped", 16621 16622 // Regular expressions 16623 16624 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 16625 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 16626 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 16627 16628 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 16629 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 16630 16631 // Operator (capture 2) 16632 "*([*^$|!~]?=)" + whitespace + 16633 16634 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 16635 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 16636 whitespace + "*\\]", 16637 16638 pseudos = ":(" + identifier + ")(?:\\((" + 16639 16640 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 16641 // 1. quoted (capture 3; capture 4 or capture 5) 16642 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 16643 16644 // 2. simple (capture 6) 16645 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 16646 16647 // 3. anything else (capture 2) 16648 ".*" + 16649 ")\\)|)", 16650 16651 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 16652 rwhitespace = new RegExp( whitespace + "+", "g" ), 16653 16654 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 16655 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 16656 whitespace + "*" ), 16657 rdescend = new RegExp( whitespace + "|>" ), 16658 16659 rpseudo = new RegExp( pseudos ), 16660 ridentifier = new RegExp( "^" + identifier + "$" ), 16661 16662 matchExpr = { 16663 ID: new RegExp( "^#(" + identifier + ")" ), 16664 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 16665 TAG: new RegExp( "^(" + identifier + "|[*])" ), 16666 ATTR: new RegExp( "^" + attributes ), 16667 PSEUDO: new RegExp( "^" + pseudos ), 16668 CHILD: new RegExp( 16669 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 16670 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 16671 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 16672 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 16673 16674 // For use in libraries implementing .is() 16675 // We use this for POS matching in `select` 16676 needsContext: new RegExp( "^" + whitespace + 16677 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 16678 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 16679 }, 16680 16681 rinputs = /^(?:input|select|textarea|button)$/i, 16682 rheader = /^h\d$/i, 16683 16684 // Easily-parseable/retrievable ID or TAG or CLASS selectors 16685 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 16686 16687 rsibling = /[+~]/, 16688 16689 // CSS escapes 16690 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 16691 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 16692 "?|\\\\([^\\r\\n\\f])", "g" ), 16693 funescape = function( escape, nonHex ) { 16694 var high = "0x" + escape.slice( 1 ) - 0x10000; 16695 16696 if ( nonHex ) { 16697 16698 // Strip the backslash prefix from a non-hex escape sequence 16699 return nonHex; 16700 } 16701 16702 // Replace a hexadecimal escape sequence with the encoded Unicode code point 16703 // Support: IE <=11+ 16704 // For values outside the Basic Multilingual Plane (BMP), manually construct a 16705 // surrogate pair 16706 return high < 0 ? 16707 String.fromCharCode( high + 0x10000 ) : 16708 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 16709 }, 16710 16711 // Used for iframes; see `setDocument`. 16712 // Support: IE 9 - 11+, Edge 12 - 18+ 16713 // Removing the function wrapper causes a "Permission Denied" 16714 // error in IE/Edge. 16715 unloadHandler = function() { 16716 setDocument(); 16717 }, 16718 16719 inDisabledFieldset = addCombinator( 16720 function( elem ) { 16721 return elem.disabled === true && nodeName( elem, "fieldset" ); 16722 }, 16723 { dir: "parentNode", next: "legend" } 16724 ); 16725 16726// Support: IE <=9 only 16727// Accessing document.activeElement can throw unexpectedly 16728// https://bugs.jquery.com/ticket/13393 16729function safeActiveElement() { 16730 try { 16731 return document.activeElement; 16732 } catch ( err ) { } 16733} 16734 16735// Optimize for push.apply( _, NodeList ) 16736try { 16737 push.apply( 16738 ( arr = slice.call( preferredDoc.childNodes ) ), 16739 preferredDoc.childNodes 16740 ); 16741 16742 // Support: Android <=4.0 16743 // Detect silently failing push.apply 16744 // eslint-disable-next-line no-unused-expressions 16745 arr[ preferredDoc.childNodes.length ].nodeType; 16746} catch ( e ) { 16747 push = { 16748 apply: function( target, els ) { 16749 pushNative.apply( target, slice.call( els ) ); 16750 }, 16751 call: function( target ) { 16752 pushNative.apply( target, slice.call( arguments, 1 ) ); 16753 } 16754 }; 16755} 16756 16757function find( selector, context, results, seed ) { 16758 var m, i, elem, nid, match, groups, newSelector, 16759 newContext = context && context.ownerDocument, 16760 16761 // nodeType defaults to 9, since context defaults to document 16762 nodeType = context ? context.nodeType : 9; 16763 16764 results = results || []; 16765 16766 // Return early from calls with invalid selector or context 16767 if ( typeof selector !== "string" || !selector || 16768 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 16769 16770 return results; 16771 } 16772 16773 // Try to shortcut find operations (as opposed to filters) in HTML documents 16774 if ( !seed ) { 16775 setDocument( context ); 16776 context = context || document; 16777 16778 if ( documentIsHTML ) { 16779 16780 // If the selector is sufficiently simple, try using a "get*By*" DOM method 16781 // (excepting DocumentFragment context, where the methods don't exist) 16782 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 16783 16784 // ID selector 16785 if ( ( m = match[ 1 ] ) ) { 16786 16787 // Document context 16788 if ( nodeType === 9 ) { 16789 if ( ( elem = context.getElementById( m ) ) ) { 16790 16791 // Support: IE 9 only 16792 // getElementById can match elements by name instead of ID 16793 if ( elem.id === m ) { 16794 push.call( results, elem ); 16795 return results; 16796 } 16797 } else { 16798 return results; 16799 } 16800 16801 // Element context 16802 } else { 16803 16804 // Support: IE 9 only 16805 // getElementById can match elements by name instead of ID 16806 if ( newContext && ( elem = newContext.getElementById( m ) ) && 16807 find.contains( context, elem ) && 16808 elem.id === m ) { 16809 16810 push.call( results, elem ); 16811 return results; 16812 } 16813 } 16814 16815 // Type selector 16816 } else if ( match[ 2 ] ) { 16817 push.apply( results, context.getElementsByTagName( selector ) ); 16818 return results; 16819 16820 // Class selector 16821 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 16822 push.apply( results, context.getElementsByClassName( m ) ); 16823 return results; 16824 } 16825 } 16826 16827 // Take advantage of querySelectorAll 16828 if ( !nonnativeSelectorCache[ selector + " " ] && 16829 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 16830 16831 newSelector = selector; 16832 newContext = context; 16833 16834 // qSA considers elements outside a scoping root when evaluating child or 16835 // descendant combinators, which is not what we want. 16836 // In such cases, we work around the behavior by prefixing every selector in the 16837 // list with an ID selector referencing the scope context. 16838 // The technique has to be used as well when a leading combinator is used 16839 // as such selectors are not recognized by querySelectorAll. 16840 // Thanks to Andrew Dupont for this technique. 16841 if ( nodeType === 1 && 16842 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 16843 16844 // Expand context for sibling selectors 16845 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 16846 context; 16847 16848 // We can use :scope instead of the ID hack if the browser 16849 // supports it & if we're not changing the context. 16850 // Support: IE 11+, Edge 17 - 18+ 16851 // IE/Edge sometimes throw a "Permission denied" error when 16852 // strict-comparing two documents; shallow comparisons work. 16853 // eslint-disable-next-line eqeqeq 16854 if ( newContext != context || !support.scope ) { 16855 16856 // Capture the context ID, setting it first if necessary 16857 if ( ( nid = context.getAttribute( "id" ) ) ) { 16858 nid = jQuery.escapeSelector( nid ); 16859 } else { 16860 context.setAttribute( "id", ( nid = expando ) ); 16861 } 16862 } 16863 16864 // Prefix every selector in the list 16865 groups = tokenize( selector ); 16866 i = groups.length; 16867 while ( i-- ) { 16868 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 16869 toSelector( groups[ i ] ); 16870 } 16871 newSelector = groups.join( "," ); 16872 } 16873 16874 try { 16875 push.apply( results, 16876 newContext.querySelectorAll( newSelector ) 16877 ); 16878 return results; 16879 } catch ( qsaError ) { 16880 nonnativeSelectorCache( selector, true ); 16881 } finally { 16882 if ( nid === expando ) { 16883 context.removeAttribute( "id" ); 16884 } 16885 } 16886 } 16887 } 16888 } 16889 16890 // All others 16891 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 16892} 16893 16894/** 16895 * Create key-value caches of limited size 16896 * @returns {function(string, object)} Returns the Object data after storing it on itself with 16897 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 16898 * deleting the oldest entry 16899 */ 16900function createCache() { 16901 var keys = []; 16902 16903 function cache( key, value ) { 16904 16905 // Use (key + " ") to avoid collision with native prototype properties 16906 // (see https://github.com/jquery/sizzle/issues/157) 16907 if ( keys.push( key + " " ) > Expr.cacheLength ) { 16908 16909 // Only keep the most recent entries 16910 delete cache[ keys.shift() ]; 16911 } 16912 return ( cache[ key + " " ] = value ); 16913 } 16914 return cache; 16915} 16916 16917/** 16918 * Mark a function for special use by jQuery selector module 16919 * @param {Function} fn The function to mark 16920 */ 16921function markFunction( fn ) { 16922 fn[ expando ] = true; 16923 return fn; 16924} 16925 16926/** 16927 * Support testing using an element 16928 * @param {Function} fn Passed the created element and returns a boolean result 16929 */ 16930function assert( fn ) { 16931 var el = document.createElement( "fieldset" ); 16932 16933 try { 16934 return !!fn( el ); 16935 } catch ( e ) { 16936 return false; 16937 } finally { 16938 16939 // Remove from its parent by default 16940 if ( el.parentNode ) { 16941 el.parentNode.removeChild( el ); 16942 } 16943 16944 // release memory in IE 16945 el = null; 16946 } 16947} 16948 16949/** 16950 * Returns a function to use in pseudos for input types 16951 * @param {String} type 16952 */ 16953function createInputPseudo( type ) { 16954 return function( elem ) { 16955 return nodeName( elem, "input" ) && elem.type === type; 16956 }; 16957} 16958 16959/** 16960 * Returns a function to use in pseudos for buttons 16961 * @param {String} type 16962 */ 16963function createButtonPseudo( type ) { 16964 return function( elem ) { 16965 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 16966 elem.type === type; 16967 }; 16968} 16969 16970/** 16971 * Returns a function to use in pseudos for :enabled/:disabled 16972 * @param {Boolean} disabled true for :disabled; false for :enabled 16973 */ 16974function createDisabledPseudo( disabled ) { 16975 16976 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 16977 return function( elem ) { 16978 16979 // Only certain elements can match :enabled or :disabled 16980 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 16981 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 16982 if ( "form" in elem ) { 16983 16984 // Check for inherited disabledness on relevant non-disabled elements: 16985 // * listed form-associated elements in a disabled fieldset 16986 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 16987 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 16988 // * option elements in a disabled optgroup 16989 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 16990 // All such elements have a "form" property. 16991 if ( elem.parentNode && elem.disabled === false ) { 16992 16993 // Option elements defer to a parent optgroup if present 16994 if ( "label" in elem ) { 16995 if ( "label" in elem.parentNode ) { 16996 return elem.parentNode.disabled === disabled; 16997 } else { 16998 return elem.disabled === disabled; 16999 } 17000 } 17001 17002 // Support: IE 6 - 11+ 17003 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 17004 return elem.isDisabled === disabled || 17005 17006 // Where there is no isDisabled, check manually 17007 elem.isDisabled !== !disabled && 17008 inDisabledFieldset( elem ) === disabled; 17009 } 17010 17011 return elem.disabled === disabled; 17012 17013 // Try to winnow out elements that can't be disabled before trusting the disabled property. 17014 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 17015 // even exist on them, let alone have a boolean value. 17016 } else if ( "label" in elem ) { 17017 return elem.disabled === disabled; 17018 } 17019 17020 // Remaining elements are neither :enabled nor :disabled 17021 return false; 17022 }; 17023} 17024 17025/** 17026 * Returns a function to use in pseudos for positionals 17027 * @param {Function} fn 17028 */ 17029function createPositionalPseudo( fn ) { 17030 return markFunction( function( argument ) { 17031 argument = +argument; 17032 return markFunction( function( seed, matches ) { 17033 var j, 17034 matchIndexes = fn( [], seed.length, argument ), 17035 i = matchIndexes.length; 17036 17037 // Match elements found at the specified indexes 17038 while ( i-- ) { 17039 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 17040 seed[ j ] = !( matches[ j ] = seed[ j ] ); 17041 } 17042 } 17043 } ); 17044 } ); 17045} 17046 17047/** 17048 * Checks a node for validity as a jQuery selector context 17049 * @param {Element|Object=} context 17050 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 17051 */ 17052function testContext( context ) { 17053 return context && typeof context.getElementsByTagName !== "undefined" && context; 17054} 17055 17056/** 17057 * Sets document-related variables once based on the current document 17058 * @param {Element|Object} [node] An element or document object to use to set the document 17059 * @returns {Object} Returns the current document 17060 */ 17061function setDocument( node ) { 17062 var subWindow, 17063 doc = node ? node.ownerDocument || node : preferredDoc; 17064 17065 // Return early if doc is invalid or already selected 17066 // Support: IE 11+, Edge 17 - 18+ 17067 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17068 // two documents; shallow comparisons work. 17069 // eslint-disable-next-line eqeqeq 17070 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 17071 return document; 17072 } 17073 17074 // Update global variables 17075 document = doc; 17076 documentElement = document.documentElement; 17077 documentIsHTML = !jQuery.isXMLDoc( document ); 17078 17079 // Support: iOS 7 only, IE 9 - 11+ 17080 // Older browsers didn't support unprefixed `matches`. 17081 matches = documentElement.matches || 17082 documentElement.webkitMatchesSelector || 17083 documentElement.msMatchesSelector; 17084 17085 // Support: IE 9 - 11+, Edge 12 - 18+ 17086 // Accessing iframe documents after unload throws "permission denied" errors
17086 (see trac-13936) 17087 // Support: IE 11+, Edge 17 - 18+ 17088 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17089 // two documents; shallow comparisons work. 17090 // eslint-disable-next-line eqeqeq 17091 if (
vendor: 44,049 bytes, lines 17091-18654
17091preferredDoc != document && 17092 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 17093 17094 // Support: IE 9 - 11+, Edge 12 - 18+ 17095 subWindow.addEventListener( "unload", unloadHandler ); 17096 } 17097 17098 // Support: IE <10 17099 // Check if getElementById returns elements by name 17100 // The broken getElementById methods don't pick up programmatically-set names, 17101 // so use a roundabout getElementsByName test 17102 support.getById = assert( function( el ) { 17103 documentElement.appendChild( el ).id = jQuery.expando; 17104 return !document.getElementsByName || 17105 !document.getElementsByName( jQuery.expando ).length; 17106 } ); 17107 17108 // Support: IE 9 only 17109 // Check to see if it's possible to do matchesSelector 17110 // on a disconnected node. 17111 support.disconnectedMatch = assert( function( el ) { 17112 return matches.call( el, "*" ); 17113 } ); 17114 17115 // Support: IE 9 - 11+, Edge 12 - 18+ 17116 // IE/Edge don't support the :scope pseudo-class. 17117 support.scope = assert( function() { 17118 return document.querySelectorAll( ":scope" ); 17119 } ); 17120 17121 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 17122 // Make sure the `:has()` argument is parsed unforgivingly. 17123 // We include `*` in the test to detect buggy implementations that are 17124 // _selectively_ forgiving (specifically when the list includes at least 17125 // one valid selector). 17126 // Note that we treat complete lack of support for `:has()` as if it were 17127 // spec-compliant support, which is fine because use of `:has()` in such 17128 // environments will fail in the qSA path and fall back to jQuery traversal 17129 // anyway. 17130 support.cssHas = assert( function() { 17131 try { 17132 document.querySelector( ":has(*,:jqfake)" ); 17133 return false; 17134 } catch ( e ) { 17135 return true; 17136 } 17137 } ); 17138 17139 // ID filter and find 17140 if ( support.getById ) { 17141 Expr.filter.ID = function( id ) { 17142 var attrId = id.replace( runescape, funescape ); 17143 return function( elem ) { 17144 return elem.getAttribute( "id" ) === attrId; 17145 }; 17146 }; 17147 Expr.find.ID = function( id, context ) { 17148 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 17149 var elem = context.getElementById( id ); 17150 return elem ? [ elem ] : []; 17151 } 17152 }; 17153 } else { 17154 Expr.filter.ID = function( id ) { 17155 var attrId = id.replace( runescape, funescape ); 17156 return function( elem ) { 17157 var node = typeof elem.getAttributeNode !== "undefined" && 17158 elem.getAttributeNode( "id" ); 17159 return node && node.value === attrId; 17160 }; 17161 }; 17162 17163 // Support: IE 6 - 7 only 17164 // getElementById is not reliable as a find shortcut 17165 Expr.find.ID = function( id, context ) { 17166 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 17167 var node, i, elems, 17168 elem = context.getElementById( id ); 17169 17170 if ( elem ) { 17171 17172 // Verify the id attribute 17173 node = elem.getAttributeNode( "id" ); 17174 if ( node && node.value === id ) { 17175 return [ elem ]; 17176 } 17177 17178 // Fall back on getElementsByName 17179 elems = context.getElementsByName( id ); 17180 i = 0; 17181 while ( ( elem = elems[ i++ ] ) ) { 17182 node = elem.getAttributeNode( "id" ); 17183 if ( node && node.value === id ) { 17184 return [ elem ]; 17185 } 17186 } 17187 } 17188 17189 return []; 17190 } 17191 }; 17192 } 17193 17194 // Tag 17195 Expr.find.TAG = function( tag, context ) { 17196 if ( typeof context.getElementsByTagName !== "undefined" ) { 17197 return context.getElementsByTagName( tag ); 17198 17199 // DocumentFragment nodes don't have gEBTN 17200 } else { 17201 return context.querySelectorAll( tag ); 17202 } 17203 }; 17204 17205 // Class 17206 Expr.find.CLASS = function( className, context ) { 17207 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 17208 return context.getElementsByClassName( className ); 17209 } 17210 }; 17211 17212 /* QSA/matchesSelector 17213 ---------------------------------------------------------------------- */ 17214 17215 // QSA and matchesSelector support 17216 17217 rbuggyQSA = []; 17218 17219 // Build QSA regex 17220 // Regex strategy adopted from Diego Perini 17221 assert( function( el ) { 17222 17223 var input; 17224 17225 documentElement.appendChild( el ).innerHTML = 17226 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 17227 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 17228 "<option selected=''></option></select>"; 17229 17230 // Support: iOS <=7 - 8 only 17231 // Boolean attributes and "value" are not treated correctly in some XML documents 17232 if ( !el.querySelectorAll( "[selected]" ).length ) { 17233 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 17234 } 17235 17236 // Support: iOS <=7 - 8 only 17237 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 17238 rbuggyQSA.push( "~=" ); 17239 } 17240 17241 // Support: iOS 8 only 17242 // https://bugs.webkit.org/show_bug.cgi?id=136851 17243 // In-page `selector#id sibling-combinator selector` fails 17244 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 17245 rbuggyQSA.push( ".#.+[+~]" ); 17246 } 17247 17248 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 17249 // In some of the document kinds, these selectors wouldn't work natively. 17250 // This is probably OK but for backwards compatibility we want to maintain 17251 // handling them through jQuery traversal in jQuery 3.x. 17252 if ( !el.querySelectorAll( ":checked" ).length ) { 17253 rbuggyQSA.push( ":checked" ); 17254 } 17255 17256 // Support: Windows 8 Native Apps 17257 // The type and name attributes are restricted during .innerHTML assignment 17258 input = document.createElement( "input" ); 17259 input.setAttribute( "type", "hidden" ); 17260 el.appendChild( input ).setAttribute( "name", "D" ); 17261 17262 // Support: IE 9 - 11+ 17263 // IE's :disabled selector does not pick up the children of disabled fieldsets 17264 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 17265 // In some of the document kinds, these selectors wouldn't work natively. 17266 // This is probably OK but for backwards compatibility we want to maintain 17267 // handling them through jQuery traversal in jQuery 3.x. 17268 documentElement.appendChild( el ).disabled = true; 17269 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 17270 rbuggyQSA.push( ":enabled", ":disabled" ); 17271 } 17272 17273 // Support: IE 11+, Edge 15 - 18+ 17274 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 17275 // Adding a temporary attribute to the document before the selection works 17276 // around the issue. 17277 // Interestingly, IE 10 & older don't seem to have the issue. 17278 input = document.createElement( "input" ); 17279 input.setAttribute( "name", "" ); 17280 el.appendChild( input ); 17281 if ( !el.querySelectorAll( "[name='']" ).length ) { 17282 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 17283 whitespace + "*(?:''|\"\")" ); 17284 } 17285 } ); 17286 17287 if ( !support.cssHas ) { 17288 17289 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 17290 // Our regular `try-catch` mechanism fails to detect natively-unsupported 17291 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 17292 // in browsers that parse the `:has()` argument as a forgiving selector list. 17293 // https://drafts.csswg.org/selectors/#relational now requires the argument 17294 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 17295 rbuggyQSA.push( ":has" ); 17296 } 17297 17298 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 17299 17300 /* Sorting 17301 ---------------------------------------------------------------------- */ 17302 17303 // Document order sorting 17304 sortOrder = function( a, b ) { 17305 17306 // Flag for duplicate removal 17307 if ( a === b ) { 17308 hasDuplicate = true; 17309 return 0; 17310 } 17311 17312 // Sort on method existence if only one input has compareDocumentPosition 17313 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 17314 if ( compare ) { 17315 return compare; 17316 } 17317 17318 // Calculate position if both inputs belong to the same document 17319 // Support: IE 11+, Edge 17 - 18+ 17320 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17321 // two documents; shallow comparisons work. 17322 // eslint-disable-next-line eqeqeq 17323 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 17324 a.compareDocumentPosition( b ) : 17325 17326 // Otherwise we know they are disconnected 17327 1; 17328 17329 // Disconnected nodes 17330 if ( compare & 1 || 17331 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 17332 17333 // Choose the first element that is related to our preferred document 17334 // Support: IE 11+, Edge 17 - 18+ 17335 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17336 // two documents; shallow comparisons work. 17337 // eslint-disable-next-line eqeqeq 17338 if ( a === document || a.ownerDocument == preferredDoc && 17339 find.contains( preferredDoc, a ) ) { 17340 return -1; 17341 } 17342 17343 // Support: IE 11+, Edge 17 - 18+ 17344 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17345 // two documents; shallow comparisons work. 17346 // eslint-disable-next-line eqeqeq 17347 if ( b === document || b.ownerDocument == preferredDoc && 17348 find.contains( preferredDoc, b ) ) { 17349 return 1; 17350 } 17351 17352 // Maintain original order 17353 return sortInput ? 17354 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 17355 0; 17356 } 17357 17358 return compare & 4 ? -1 : 1; 17359 }; 17360 17361 return document; 17362} 17363 17364find.matches = function( expr, elements ) { 17365 return find( expr, null, null, elements ); 17366}; 17367 17368find.matchesSelector = function( elem, expr ) { 17369 setDocument( elem ); 17370 17371 if ( documentIsHTML && 17372 !nonnativeSelectorCache[ expr + " " ] && 17373 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 17374 17375 try { 17376 var ret = matches.call( elem, expr ); 17377 17378 // IE 9's matchesSelector returns false on disconnected nodes 17379 if ( ret || support.disconnectedMatch || 17380 17381 // As well, disconnected nodes are said to be in a document 17382 // fragment in IE 9 17383 elem.document && elem.document.nodeType !== 11 ) { 17384 return ret; 17385 } 17386 } catch ( e ) { 17387 nonnativeSelectorCache( expr, true ); 17388 } 17389 } 17390 17391 return find( expr, document, null, [ elem ] ).length > 0; 17392}; 17393 17394find.contains = function( context, elem ) { 17395 17396 // Set document vars if needed 17397 // Support: IE 11+, Edge 17 - 18+ 17398 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17399 // two documents; shallow comparisons work. 17400 // eslint-disable-next-line eqeqeq 17401 if ( ( context.ownerDocument || context ) != document ) { 17402 setDocument( context ); 17403 } 17404 return jQuery.contains( context, elem ); 17405}; 17406 17407 17408find.attr = function( elem, name ) { 17409 17410 // Set document vars if needed 17411 // Support: IE 11+, Edge 17 - 18+ 17412 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 17413 // two documents; shallow comparisons work. 17414 // eslint-disable-next-line eqeqeq 17415 if ( ( elem.ownerDocument || elem ) != document ) { 17416 setDocument( elem ); 17417 } 17418 17419 var fn = Expr.attrHandle[ name.toLowerCase() ], 17420 17421 // Don't get fooled by Object.prototype properties (see trac-13807) 17422 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 17423 fn( elem, name, !documentIsHTML ) : 17424 undefined; 17425 17426 if ( val !== undefined ) { 17427 return val; 17428 } 17429 17430 return elem.getAttribute( name ); 17431}; 17432 17433find.error = function( msg ) { 17434 throw new Error( "Syntax error, unrecognized expression: " + msg ); 17435}; 17436 17437/** 17438 * Document sorting and removing duplicates 17439 * @param {ArrayLike} results 17440 */ 17441jQuery.uniqueSort = function( results ) { 17442 var elem, 17443 duplicates = [], 17444 j = 0, 17445 i = 0; 17446 17447 // Unless we *know* we can detect duplicates, assume their presence 17448 // 17449 // Support: Android <=4.0+ 17450 // Testing for detecting duplicates is unpredictable so instead assume we can't 17451 // depend on duplicate detection in all browsers without a stable sort. 17452 hasDuplicate = !support.sortStable; 17453 sortInput = !support.sortStable && slice.call( results, 0 ); 17454 sort.call( results, sortOrder ); 17455 17456 if ( hasDuplicate ) { 17457 while ( ( elem = results[ i++ ] ) ) { 17458 if ( elem === results[ i ] ) { 17459 j = duplicates.push( i ); 17460 } 17461 } 17462 while ( j-- ) { 17463 splice.call( results, duplicates[ j ], 1 ); 17464 } 17465 } 17466 17467 // Clear input after sorting to release objects 17468 // See https://github.com/jquery/sizzle/pull/225 17469 sortInput = null; 17470 17471 return results; 17472}; 17473 17474jQuery.fn.uniqueSort = function() { 17475 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 17476}; 17477 17478Expr = jQuery.expr = { 17479 17480 // Can be adjusted by the user 17481 cacheLength: 50, 17482 17483 createPseudo: markFunction, 17484 17485 match: matchExpr, 17486 17487 attrHandle: {}, 17488 17489 find: {}, 17490 17491 relative: { 17492 ">": { dir: "parentNode", first: true }, 17493 " ": { dir: "parentNode" }, 17494 "+": { dir: "previousSibling", first: true }, 17495 "~": { dir: "previousSibling" } 17496 }, 17497 17498 preFilter: { 17499 ATTR: function( match ) { 17500 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 17501 17502 // Move the given value to match[3] whether quoted or unquoted 17503 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 17504 .replace( runescape, funescape ); 17505 17506 if ( match[ 2 ] === "~=" ) { 17507 match[ 3 ] = " " + match[ 3 ] + " "; 17508 } 17509 17510 return match.slice( 0, 4 ); 17511 }, 17512 17513 CHILD: function( match ) { 17514 17515 /* matches from matchExpr["CHILD"] 17516 1 type (only|nth|...) 17517 2 what (child|of-type) 17518 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 17519 4 xn-component of xn+y argument ([+-]?\d*n|) 17520 5 sign of xn-component 17521 6 x of xn-component 17522 7 sign of y-component 17523 8 y of y-component 17524 */ 17525 match[ 1 ] = match[ 1 ].toLowerCase(); 17526 17527 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 17528 17529 // nth-* requires argument 17530 if ( !match[ 3 ] ) { 17531 find.error( match[ 0 ] ); 17532 } 17533 17534 // numeric x and y parameters for Expr.filter.CHILD 17535 // remember that false/true cast respectively to 0/1 17536 match[ 4 ] = +( match[ 4 ] ? 17537 match[ 5 ] + ( match[ 6 ] || 1 ) : 17538 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 17539 ); 17540 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 17541 17542 // other types prohibit arguments 17543 } else if ( match[ 3 ] ) { 17544 find.error( match[ 0 ] ); 17545 } 17546 17547 return match; 17548 }, 17549 17550 PSEUDO: function( match ) { 17551 var excess, 17552 unquoted = !match[ 6 ] && match[ 2 ]; 17553 17554 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 17555 return null; 17556 } 17557 17558 // Accept quoted arguments as-is 17559 if ( match[ 3 ] ) { 17560 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 17561 17562 // Strip excess characters from unquoted arguments 17563 } else if ( unquoted && rpseudo.test( unquoted ) && 17564 17565 // Get excess from tokenize (recursively) 17566 ( excess = tokenize( unquoted, true ) ) && 17567 17568 // advance to the next closing parenthesis 17569 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 17570 17571 // excess is a negative index 17572 match[ 0 ] = match[ 0 ].slice( 0, excess ); 17573 match[ 2 ] = unquoted.slice( 0, excess ); 17574 } 17575 17576 // Return only captures needed by the pseudo filter method (type and argument) 17577 return match.slice( 0, 3 ); 17578 } 17579 }, 17580 17581 filter: { 17582 17583 TAG: function( nodeNameSelector ) { 17584 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 17585 return nodeNameSelector === "*" ? 17586 function() { 17587 return true; 17588 } : 17589 function( elem ) { 17590 return nodeName( elem, expectedNodeName ); 17591 }; 17592 }, 17593 17594 CLASS: function( className ) { 17595 var pattern = classCache[ className + " " ]; 17596 17597 return pattern || 17598 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 17599 "(" + whitespace + "|$)" ) ) && 17600 classCache( className, function( elem ) { 17601 return pattern.test( 17602 typeof elem.className === "string" && elem.className || 17603 typeof elem.getAttribute !== "undefined" && 17604 elem.getAttribute( "class" ) || 17605 "" 17606 ); 17607 } ); 17608 }, 17609 17610 ATTR: function( name, operator, check ) { 17611 return function( elem ) { 17612 var result = find.attr( elem, name ); 17613 17614 if ( result == null ) { 17615 return operator === "!="; 17616 } 17617 if ( !operator ) { 17618 return true; 17619 } 17620 17621 result += ""; 17622 17623 if ( operator === "=" ) { 17624 return result === check; 17625 } 17626 if ( operator === "!=" ) { 17627 return result !== check; 17628 } 17629 if ( operator === "^=" ) { 17630 return check && result.indexOf( check ) === 0; 17631 } 17632 if ( operator === "*=" ) { 17633 return check && result.indexOf( check ) > -1; 17634 } 17635 if ( operator === "$=" ) { 17636 return check && result.slice( -check.length ) === check; 17637 } 17638 if ( operator === "~=" ) { 17639 return ( " " + result.replace( rwhitespace, " " ) + " " ) 17640 .indexOf( check ) > -1; 17641 } 17642 if ( operator === "|=" ) { 17643 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 17644 } 17645 17646 return false; 17647 }; 17648 }, 17649 17650 CHILD: function( type, what, _argument, first, last ) { 17651 var simple = type.slice( 0, 3 ) !== "nth", 17652 forward = type.slice( -4 ) !== "last", 17653 ofType = what === "of-type"; 17654 17655 return first === 1 && last === 0 ? 17656 17657 // Shortcut for :nth-*(n) 17658 function( elem ) { 17659 return !!elem.parentNode; 17660 } : 17661 17662 function( elem, _context, xml ) { 17663 var cache, outerCache, node, nodeIndex, start, 17664 dir = simple !== forward ? "nextSibling" : "previousSibling", 17665 parent = elem.parentNode, 17666 name = ofType && elem.nodeName.toLowerCase(), 17667 useCache = !xml && !ofType, 17668 diff = false; 17669 17670 if ( parent ) { 17671 17672 // :(first|last|only)-(child|of-type) 17673 if ( simple ) { 17674 while ( dir ) { 17675 node = elem; 17676 while ( ( node = node[ dir ] ) ) { 17677 if ( ofType ? 17678 nodeName( node, name ) : 17679 node.nodeType === 1 ) { 17680 17681 return false; 17682 } 17683 } 17684 17685 // Reverse direction for :only-* (if we haven't yet done so) 17686 start = dir = type === "only" && !start && "nextSibling"; 17687 } 17688 return true; 17689 } 17690 17691 start = [ forward ? parent.firstChild : parent.lastChild ]; 17692 17693 // non-xml :nth-child(...) stores cache data on `parent` 17694 if ( forward && useCache ) { 17695 17696 // Seek `elem` from a previously-cached index 17697 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 17698 cache = outerCache[ type ] || []; 17699 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 17700 diff = nodeIndex && cache[ 2 ]; 17701 node = nodeIndex && parent.childNodes[ nodeIndex ]; 17702 17703 while ( ( node = ++nodeIndex && node && node[ dir ] || 17704 17705 // Fallback to seeking `elem` from the start 17706 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 17707 17708 // When found, cache indexes on `parent` and break 17709 if ( node.nodeType === 1 && ++diff && node === elem ) { 17710 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 17711 break; 17712 } 17713 } 17714 17715 } else { 17716 17717 // Use previously-cached element index if available 17718 if ( useCache ) { 17719 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 17720 cache = outerCache[ type ] || []; 17721 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 17722 diff = nodeIndex; 17723 } 17724 17725 // xml :nth-child(...) 17726 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 17727 if ( diff === false ) { 17728 17729 // Use the same loop as above to seek `elem` from the start 17730 while ( ( node = ++nodeIndex && node && node[ dir ] || 17731 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 17732 17733 if ( ( ofType ? 17734 nodeName( node, name ) : 17735 node.nodeType === 1 ) && 17736 ++diff ) { 17737 17738 // Cache the index of each encountered element 17739 if ( useCache ) { 17740 outerCache = node[ expando ] || 17741 ( node[ expando ] = {} ); 17742 outerCache[ type ] = [ dirruns, diff ]; 17743 } 17744 17745 if ( node === elem ) { 17746 break; 17747 } 17748 } 17749 } 17750 } 17751 } 17752 17753 // Incorporate the offset, then check against cycle size 17754 diff -= last; 17755 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 17756 } 17757 }; 17758 }, 17759 17760 PSEUDO: function( pseudo, argument ) { 17761 17762 // pseudo-class names are case-insensitive 17763 // https://www.w3.org/TR/selectors/#pseudo-classes 17764 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 17765 // Remember that setFilters inherits from pseudos 17766 var args, 17767 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 17768 find.error( "unsupported pseudo: " + pseudo ); 17769 17770 // The user may use createPseudo to indicate that 17771 // arguments are needed to create the filter function 17772 // just as jQuery does 17773 if ( fn[ expando ] ) { 17774 return fn( argument ); 17775 } 17776 17777 // But maintain support for old signatures 17778 if ( fn.length > 1 ) { 17779 args = [ pseudo, pseudo, "", argument ]; 17780 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 17781 markFunction( function( seed, matches ) { 17782 var idx, 17783 matched = fn( seed, argument ), 17784 i = matched.length; 17785 while ( i-- ) { 17786 idx = indexOf.call( seed, matched[ i ] ); 17787 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 17788 } 17789 } ) : 17790 function( elem ) { 17791 return fn( elem, 0, args ); 17792 }; 17793 } 17794 17795 return fn; 17796 } 17797 }, 17798 17799 pseudos: { 17800 17801 // Potentially complex pseudos 17802 not: markFunction( function( selector ) { 17803 17804 // Trim the selector passed to compile 17805 // to avoid treating leading and trailing 17806 // spaces as combinators 17807 var input = [], 17808 results = [], 17809 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 17810 17811 return matcher[ expando ] ? 17812 markFunction( function( seed, matches, _context, xml ) { 17813 var elem, 17814 unmatched = matcher( seed, null, xml, [] ), 17815 i = seed.length; 17816 17817 // Match elements unmatched by `matcher` 17818 while ( i-- ) { 17819 if ( ( elem = unmatched[ i ] ) ) { 17820 seed[ i ] = !( matches[ i ] = elem ); 17821 } 17822 } 17823 } ) : 17824 function( elem, _context, xml ) { 17825 input[ 0 ] = elem; 17826 matcher( input, null, xml, results ); 17827 17828 // Don't keep the element 17829 // (see https://github.com/jquery/sizzle/issues/299) 17830 input[ 0 ] = null; 17831 return !results.pop(); 17832 }; 17833 } ), 17834 17835 has: markFunction( function( selector ) { 17836 return function( elem ) { 17837 return find( selector, elem ).length > 0; 17838 }; 17839 } ), 17840 17841 contains: markFunction( function( text ) { 17842 text = text.replace( runescape, funescape ); 17843 return function( elem ) { 17844 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 17845 }; 17846 } ), 17847 17848 // "Whether an element is represented by a :lang() selector 17849 // is based solely on the element's language value 17850 // being equal to the identifier C, 17851 // or beginning with the identifier C immediately followed by "-". 17852 // The matching of C against the element's language value is performed case-insensitively. 17853 // The identifier C does not have to be a valid language name." 17854 // https://www.w3.org/TR/selectors/#lang-pseudo 17855 lang: markFunction( function( lang ) { 17856 17857 // lang value must be a valid identifier 17858 if ( !ridentifier.test( lang || "" ) ) { 17859 find.error( "unsupported lang: " + lang ); 17860 } 17861 lang = lang.replace( runescape, funescape ).toLowerCase(); 17862 return function( elem ) { 17863 var elemLang; 17864 do { 17865 if ( ( elemLang = documentIsHTML ? 17866 elem.lang : 17867 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 17868 17869 elemLang = elemLang.toLowerCase(); 17870 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 17871 } 17872 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 17873 return false; 17874 }; 17875 } ), 17876 17877 // Miscellaneous 17878 target: function( elem ) { 17879 var hash = window.location && window.location.hash; 17880 return hash && hash.slice( 1 ) === elem.id; 17881 }, 17882 17883 root: function( elem ) { 17884 return elem === documentElement; 17885 }, 17886 17887 focus: function( elem ) { 17888 return elem === safeActiveElement() && 17889 document.hasFocus() && 17890 !!( elem.type || elem.href || ~elem.tabIndex ); 17891 }, 17892 17893 // Boolean properties 17894 enabled: createDisabledPseudo( false ), 17895 disabled: createDisabledPseudo( true ), 17896 17897 checked: function( elem ) { 17898 17899 // In CSS3, :checked should return both checked and selected elements 17900 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 17901 return ( nodeName( elem, "input" ) && !!elem.checked ) || 17902 ( nodeName( elem, "option" ) && !!elem.selected ); 17903 }, 17904 17905 selected: function( elem ) { 17906 17907 // Support: IE <=11+ 17908 // Accessing the selectedIndex property 17909 // forces the browser to treat the default option as 17910 // selected when in an optgroup. 17911 if ( elem.parentNode ) { 17912 // eslint-disable-next-line no-unused-expressions 17913 elem.parentNode.selectedIndex; 17914 } 17915 17916 return elem.selected === true; 17917 }, 17918 17919 // Contents 17920 empty: function( elem ) { 17921 17922 // https://www.w3.org/TR/selectors/#empty-pseudo 17923 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 17924 // but not by others (comment: 8; processing instruction: 7; etc.) 17925 // nodeType < 6 works because attributes (2) do not appear as children 17926 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 17927 if ( elem.nodeType < 6 ) { 17928 return false; 17929 } 17930 } 17931 return true; 17932 }, 17933 17934 parent: function( elem ) { 17935 return !Expr.pseudos.empty( elem ); 17936 }, 17937 17938 // Element/input types 17939 header: function( elem ) { 17940 return rheader.test( elem.nodeName ); 17941 }, 17942 17943 input: function( elem ) { 17944 return rinputs.test( elem.nodeName ); 17945 }, 17946 17947 button: function( elem ) { 17948 return nodeName( elem, "input" ) && elem.type === "button" || 17949 nodeName( elem, "button" ); 17950 }, 17951 17952 text: function( elem ) { 17953 var attr; 17954 return nodeName( elem, "input" ) && elem.type === "text" && 17955 17956 // Support: IE <10 only 17957 // New HTML5 attribute values (e.g., "search") appear 17958 // with elem.type === "text" 17959 ( ( attr = elem.getAttribute( "type" ) ) == null || 17960 attr.toLowerCase() === "text" ); 17961 }, 17962 17963 // Position-in-collection 17964 first: createPositionalPseudo( function() { 17965 return [ 0 ]; 17966 } ), 17967 17968 last: createPositionalPseudo( function( _matchIndexes, length ) { 17969 return [ length - 1 ]; 17970 } ), 17971 17972 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 17973 return [ argument < 0 ? argument + length : argument ]; 17974 } ), 17975 17976 even: createPositionalPseudo( function( matchIndexes, length ) { 17977 var i = 0; 17978 for ( ; i < length; i += 2 ) { 17979 matchIndexes.push( i ); 17980 } 17981 return matchIndexes; 17982 } ), 17983 17984 odd: createPositionalPseudo( function( matchIndexes, length ) { 17985 var i = 1; 17986 for ( ; i < length; i += 2 ) { 17987 matchIndexes.push( i ); 17988 } 17989 return matchIndexes; 17990 } ), 17991 17992 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 17993 var i; 17994 17995 if ( argument < 0 ) { 17996 i = argument + length; 17997 } else if ( argument > length ) { 17998 i = length; 17999 } else { 18000 i = argument; 18001 } 18002 18003 for ( ; --i >= 0; ) { 18004 matchIndexes.push( i ); 18005 } 18006 return matchIndexes; 18007 } ), 18008 18009 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 18010 var i = argument < 0 ? argument + length : argument; 18011 for ( ; ++i < length; ) { 18012 matchIndexes.push( i ); 18013 } 18014 return matchIndexes; 18015 } ) 18016 } 18017}; 18018 18019Expr.pseudos.nth = Expr.pseudos.eq; 18020 18021// Add button/input type pseudos 18022for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 18023 Expr.pseudos[ i ] = createInputPseudo( i ); 18024} 18025for ( i in { submit: true, reset: true } ) { 18026 Expr.pseudos[ i ] = createButtonPseudo( i ); 18027} 18028 18029// Easy API for creating new setFilters 18030function setFilters() {} 18031setFilters.prototype = Expr.filters = Expr.pseudos; 18032Expr.setFilters = new setFilters(); 18033 18034function tokenize( selector, parseOnly ) { 18035 var matched, match, tokens, type, 18036 soFar, groups, preFilters, 18037 cached = tokenCache[ selector + " " ]; 18038 18039 if ( cached ) { 18040 return parseOnly ? 0 : cached.slice( 0 ); 18041 } 18042 18043 soFar = selector; 18044 groups = []; 18045 preFilters = Expr.preFilter; 18046 18047 while ( soFar ) { 18048 18049 // Comma and first run 18050 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 18051 if ( match ) { 18052 18053 // Don't consume trailing commas as valid 18054 soFar = soFar.slice( match[ 0 ].length ) || soFar; 18055 } 18056 groups.push( ( tokens = [] ) ); 18057 } 18058 18059 matched = false; 18060 18061 // Combinators 18062 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 18063 matched = match.shift(); 18064 tokens.push( { 18065 value: matched, 18066 18067 // Cast descendant combinators to space 18068 type: match[ 0 ].replace( rtrimCSS, " " ) 18069 } ); 18070 soFar = soFar.slice( matched.length ); 18071 } 18072 18073 // Filters 18074 for ( type in Expr.filter ) { 18075 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 18076 ( match = preFilters[ type ]( match ) ) ) ) { 18077 matched = match.shift(); 18078 tokens.push( { 18079 value: matched, 18080 type: type, 18081 matches: match 18082 } ); 18083 soFar = soFar.slice( matched.length ); 18084 } 18085 } 18086 18087 if ( !matched ) { 18088 break; 18089 } 18090 } 18091 18092 // Return the length of the invalid excess 18093 // if we're just parsing 18094 // Otherwise, throw an error or return tokens 18095 if ( parseOnly ) { 18096 return soFar.length; 18097 } 18098 18099 return soFar ? 18100 find.error( selector ) : 18101 18102 // Cache the tokens 18103 tokenCache( selector, groups ).slice( 0 ); 18104} 18105 18106function toSelector( tokens ) { 18107 var i = 0, 18108 len = tokens.length, 18109 selector = ""; 18110 for ( ; i < len; i++ ) { 18111 selector += tokens[ i ].value; 18112 } 18113 return selector; 18114} 18115 18116function addCombinator( matcher, combinator, base ) { 18117 var dir = combinator.dir, 18118 skip = combinator.next, 18119 key = skip || dir, 18120 checkNonElements = base && key === "parentNode", 18121 doneName = done++; 18122 18123 return combinator.first ? 18124 18125 // Check against closest ancestor/preceding element 18126 function( elem, context, xml ) { 18127 while ( ( elem = elem[ dir ] ) ) { 18128 if ( elem.nodeType === 1 || checkNonElements ) { 18129 return matcher( elem, context, xml ); 18130 } 18131 } 18132 return false; 18133 } : 18134 18135 // Check against all ancestor/preceding elements 18136 function( elem, context, xml ) { 18137 var oldCache, outerCache, 18138 newCache = [ dirruns, doneName ]; 18139 18140 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 18141 if ( xml ) { 18142 while ( ( elem = elem[ dir ] ) ) { 18143 if ( elem.nodeType === 1 || checkNonElements ) { 18144 if ( matcher( elem, context, xml ) ) { 18145 return true; 18146 } 18147 } 18148 } 18149 } else { 18150 while ( ( elem = elem[ dir ] ) ) { 18151 if ( elem.nodeType === 1 || checkNonElements ) { 18152 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 18153 18154 if ( skip && nodeName( elem, skip ) ) { 18155 elem = elem[ dir ] || elem; 18156 } else if ( ( oldCache = outerCache[ key ] ) && 18157 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 18158 18159 // Assign to newCache so results back-propagate to previous elements 18160 return ( newCache[ 2 ] = oldCache[ 2 ] ); 18161 } else { 18162 18163 // Reuse newcache so results back-propagate to previous elements 18164 outerCache[ key ] = newCache; 18165 18166 // A match means we're done; a fail means we have to keep checking 18167 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 18168 return true; 18169 } 18170 } 18171 } 18172 } 18173 } 18174 return false; 18175 }; 18176} 18177 18178function elementMatcher( matchers ) { 18179 return matchers.length > 1 ? 18180 function( elem, context, xml ) { 18181 var i = matchers.length; 18182 while ( i-- ) { 18183 if ( !matchers[ i ]( elem, context, xml ) ) { 18184 return false; 18185 } 18186 } 18187 return true; 18188 } : 18189 matchers[ 0 ]; 18190} 18191 18192function multipleContexts( selector, contexts, results ) { 18193 var i = 0, 18194 len = contexts.length; 18195 for ( ; i < len; i++ ) { 18196 find( selector, contexts[ i ], results ); 18197 } 18198 return results; 18199} 18200 18201function condense( unmatched, map, filter, context, xml ) { 18202 var elem, 18203 newUnmatched = [], 18204 i = 0, 18205 len = unmatched.length, 18206 mapped = map != null; 18207 18208 for ( ; i < len; i++ ) { 18209 if ( ( elem = unmatched[ i ] ) ) { 18210 if ( !filter || filter( elem, context, xml ) ) { 18211 newUnmatched.push( elem ); 18212 if ( mapped ) { 18213 map.push( i ); 18214 } 18215 } 18216 } 18217 } 18218 18219 return newUnmatched; 18220} 18221 18222function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 18223 if ( postFilter && !postFilter[ expando ] ) { 18224 postFilter = setMatcher( postFilter ); 18225 } 18226 if ( postFinder && !postFinder[ expando ] ) { 18227 postFinder = setMatcher( postFinder, postSelector ); 18228 } 18229 return markFunction( function( seed, results, context, xml ) { 18230 var temp, i, elem, matcherOut, 18231 preMap = [], 18232 postMap = [], 18233 preexisting = results.length, 18234 18235 // Get initial elements from seed or context 18236 elems = seed || 18237 multipleContexts( selector || "*", 18238 context.nodeType ? [ context ] : context, [] ), 18239 18240 // Prefilter to get matcher input, preserving a map for seed-results synchronization 18241 matcherIn = preFilter && ( seed || !selector ) ? 18242 condense( elems, preMap, preFilter, context, xml ) : 18243 elems; 18244 18245 if ( matcher ) { 18246 18247 // If we have a postFinder, or filtered seed, or non-seed postFilter 18248 // or preexisting results, 18249 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 18250 18251 // ...intermediate processing is necessary 18252 [] : 18253 18254 // ...otherwise use results directly 18255 results; 18256 18257 // Find primary matches 18258 matcher( matcherIn, matcherOut, context, xml ); 18259 } else { 18260 matcherOut = matcherIn; 18261 } 18262 18263 // Apply postFilter 18264 if ( postFilter ) { 18265 temp = condense( matcherOut, postMap ); 18266 postFilter( temp, [], context, xml ); 18267 18268 // Un-match failing elements by moving them back to matcherIn 18269 i = temp.length; 18270 while ( i-- ) { 18271 if ( ( elem = temp[ i ] ) ) { 18272 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 18273 } 18274 } 18275 } 18276 18277 if ( seed ) { 18278 if ( postFinder || preFilter ) { 18279 if ( postFinder ) { 18280 18281 // Get the final matcherOut by condensing this intermediate into postFinder contexts 18282 temp = []; 18283 i = matcherOut.length; 18284 while ( i-- ) { 18285 if ( ( elem = matcherOut[ i ] ) ) { 18286 18287 // Restore matcherIn since elem is not yet a final match 18288 temp.push( ( matcherIn[ i ] = elem ) ); 18289 } 18290 } 18291 postFinder( null, ( matcherOut = [] ), temp, xml ); 18292 } 18293 18294 // Move matched elements from seed to results to keep them synchronized 18295 i = matcherOut.length; 18296 while ( i-- ) { 18297 if ( ( elem = matcherOut[ i ] ) && 18298 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 18299 18300 seed[ temp ] = !( results[ temp ] = elem ); 18301 } 18302 } 18303 } 18304 18305 // Add elements to results, through postFinder if defined 18306 } else { 18307 matcherOut = condense( 18308 matcherOut === results ? 18309 matcherOut.splice( preexisting, matcherOut.length ) : 18310 matcherOut 18311 ); 18312 if ( postFinder ) { 18313 postFinder( null, results, matcherOut, xml ); 18314 } else { 18315 push.apply( results, matcherOut ); 18316 } 18317 } 18318 } ); 18319} 18320 18321function matcherFromTokens( tokens ) { 18322 var checkContext, matcher, j, 18323 len = tokens.length, 18324 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 18325 implicitRelative = leadingRelative || Expr.relative[ " " ], 18326 i = leadingRelative ? 1 : 0, 18327 18328 // The foundational matcher ensures that elements are reachable from top-level context(s) 18329 matchContext = addCombinator( function( elem ) { 18330 return elem === checkContext; 18331 }, implicitRelative, true ), 18332 matchAnyContext = addCombinator( function( elem ) { 18333 return indexOf.call( checkContext, elem ) > -1; 18334 }, implicitRelative, true ), 18335 matchers = [ function( elem, context, xml ) { 18336 18337 // Support: IE 11+, Edge 17 - 18+ 18338 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 18339 // two documents; shallow comparisons work. 18340 // eslint-disable-next-line eqeqeq 18341 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 18342 ( checkContext = context ).nodeType ? 18343 matchContext( elem, context, xml ) : 18344 matchAnyContext( elem, context, xml ) ); 18345 18346 // Avoid hanging onto element 18347 // (see https://github.com/jquery/sizzle/issues/299) 18348 checkContext = null; 18349 return ret; 18350 } ]; 18351 18352 for ( ; i < len; i++ ) { 18353 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 18354 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 18355 } else { 18356 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 18357 18358 // Return special upon seeing a positional matcher 18359 if ( matcher[ expando ] ) { 18360 18361 // Find the next relative operator (if any) for proper handling 18362 j = ++i; 18363 for ( ; j < len; j++ ) { 18364 if ( Expr.relative[ tokens[ j ].type ] ) { 18365 break; 18366 } 18367 } 18368 return setMatcher( 18369 i > 1 && elementMatcher( matchers ), 18370 i > 1 && toSelector( 18371 18372 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 18373 tokens.slice( 0, i - 1 ) 18374 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 18375 ).replace( rtrimCSS, "$1" ), 18376 matcher, 18377 i < j && matcherFromTokens( tokens.slice( i, j ) ), 18378 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 18379 j < len && toSelector( tokens ) 18380 ); 18381 } 18382 matchers.push( matcher ); 18383 } 18384 } 18385 18386 return elementMatcher( matchers ); 18387} 18388 18389function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 18390 var bySet = setMatchers.length > 0, 18391 byElement = elementMatchers.length > 0, 18392 superMatcher = function( seed, context, xml, results, outermost ) { 18393 var elem, j, matcher, 18394 matchedCount = 0, 18395 i = "0", 18396 unmatched = seed && [], 18397 setMatched = [], 18398 contextBackup = outermostContext, 18399 18400 // We must always have either seed elements or outermost context 18401 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 18402 18403 // Use integer dirruns iff this is the outermost matcher 18404 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 18405 len = elems.length; 18406 18407 if ( outermost ) { 18408 18409 // Support: IE 11+, Edge 17 - 18+ 18410 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 18411 // two documents; shallow comparisons work. 18412 // eslint-disable-next-line eqeqeq 18413 outermostContext = context == document || context || outermost; 18414 } 18415 18416 // Add elements passing elementMatchers directly to results 18417 // Support: iOS <=7 - 9 only 18418 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 18419 // elements by id. (see trac-14142) 18420 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 18421 if ( byElement && elem ) { 18422 j = 0; 18423 18424 // Support: IE 11+, Edge 17 - 18+ 18425 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 18426 // two documents; shallow comparisons work. 18427 // eslint-disable-next-line eqeqeq 18428 if ( !context && elem.ownerDocument != document ) { 18429 setDocument( elem ); 18430 xml = !documentIsHTML; 18431 } 18432 while ( ( matcher = elementMatchers[ j++ ] ) ) { 18433 if ( matcher( elem, context || document, xml ) ) { 18434 push.call( results, elem ); 18435 break; 18436 } 18437 } 18438 if ( outermost ) { 18439 dirruns = dirrunsUnique; 18440 } 18441 } 18442 18443 // Track unmatched elements for set filters 18444 if ( bySet ) { 18445 18446 // They will have gone through all possible matchers 18447 if ( ( elem = !matcher && elem ) ) { 18448 matchedCount--; 18449 } 18450 18451 // Lengthen the array for every element, matched or not 18452 if ( seed ) { 18453 unmatched.push( elem ); 18454 } 18455 } 18456 } 18457 18458 // `i` is now the count of elements visited above, and adding it to `matchedCount` 18459 // makes the latter nonnegative. 18460 matchedCount += i; 18461 18462 // Apply set filters to unmatched elements 18463 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 18464 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 18465 // no element matchers and no seed. 18466 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 18467 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 18468 // numerically zero. 18469 if ( bySet && i !== matchedCount ) { 18470 j = 0; 18471 while ( ( matcher = setMatchers[ j++ ] ) ) { 18472 matcher( unmatched, setMatched, context, xml ); 18473 } 18474 18475 if ( seed ) { 18476 18477 // Reintegrate element matches to eliminate the need for sorting 18478 if ( matchedCount > 0 ) { 18479 while ( i-- ) { 18480 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 18481 setMatched[ i ] = pop.call( results ); 18482 } 18483 } 18484 } 18485 18486 // Discard index placeholder values to get only actual matches 18487 setMatched = condense( setMatched ); 18488 } 18489 18490 // Add matches to results 18491 push.apply( results, setMatched ); 18492 18493 // Seedless set matches succeeding multiple successful matchers stipulate sorting 18494 if ( outermost && !seed && setMatched.length > 0 && 18495 ( matchedCount + setMatchers.length ) > 1 ) { 18496 18497 jQuery.uniqueSort( results ); 18498 } 18499 } 18500 18501 // Override manipulation of globals by nested matchers 18502 if ( outermost ) { 18503 dirruns = dirrunsUnique; 18504 outermostContext = contextBackup; 18505 } 18506 18507 return unmatched; 18508 }; 18509 18510 return bySet ? 18511 markFunction( superMatcher ) : 18512 superMatcher; 18513} 18514 18515function compile( selector, match /* Internal Use Only */ ) { 18516 var i, 18517 setMatchers = [], 18518 elementMatchers = [], 18519 cached = compilerCache[ selector + " " ]; 18520 18521 if ( !cached ) { 18522 18523 // Generate a function of recursive functions that can be used to check each element 18524 if ( !match ) { 18525 match = tokenize( selector ); 18526 } 18527 i = match.length; 18528 while ( i-- ) { 18529 cached = matcherFromTokens( match[ i ] ); 18530 if ( cached[ expando ] ) { 18531 setMatchers.push( cached ); 18532 } else { 18533 elementMatchers.push( cached ); 18534 } 18535 } 18536 18537 // Cache the compiled function 18538 cached = compilerCache( selector, 18539 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 18540 18541 // Save selector and tokenization 18542 cached.selector = selector; 18543 } 18544 return cached; 18545} 18546 18547/** 18548 * A low-level selection function that works with jQuery's compiled 18549 * selector functions 18550 * @param {String|Function} selector A selector or a pre-compiled 18551 * selector function built with jQuery selector compile 18552 * @param {Element} context 18553 * @param {Array} [results] 18554 * @param {Array} [seed] A set of elements to match against 18555 */ 18556function select( selector, context, results, seed ) { 18557 var i, tokens, token, type, find, 18558 compiled = typeof selector === "function" && selector, 18559 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 18560 18561 results = results || []; 18562 18563 // Try to minimize operations if there is only one selector in the list and no seed 18564 // (the latter of which guarantees us context) 18565 if ( match.length === 1 ) { 18566 18567 // Reduce context if the leading compound selector is an ID 18568 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 18569 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 18570 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 18571 18572 context = ( Expr.find.ID( 18573 token.matches[ 0 ].replace( runescape, funescape ), 18574 context 18575 ) || [] )[ 0 ]; 18576 if ( !context ) { 18577 return results; 18578 18579 // Precompiled matchers will still verify ancestry, so step up a level 18580 } else if ( compiled ) { 18581 context = context.parentNode; 18582 } 18583 18584 selector = selector.slice( tokens.shift().value.length ); 18585 } 18586 18587 // Fetch a seed set for right-to-left matching 18588 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 18589 while ( i-- ) { 18590 token = tokens[ i ]; 18591 18592 // Abort if we hit a combinator 18593 if ( Expr.relative[ ( type = token.type ) ] ) { 18594 break; 18595 } 18596 if ( ( find = Expr.find[ type ] ) ) { 18597 18598 // Search, expanding context for leading sibling combinators 18599 if ( ( seed = find( 18600 token.matches[ 0 ].replace( runescape, funescape ), 18601 rsibling.test( tokens[ 0 ].type ) && 18602 testContext( context.parentNode ) || context 18603 ) ) ) { 18604 18605 // If seed is empty or no tokens remain, we can return early 18606 tokens.splice( i, 1 ); 18607 selector = seed.length && toSelector( tokens ); 18608 if ( !selector ) { 18609 push.apply( results, seed ); 18610 return results; 18611 } 18612 18613 break; 18614 } 18615 } 18616 } 18617 } 18618 18619 // Compile and execute a filtering function if one is not provided 18620 // Provide `match` to avoid retokenization if we modified the selector above 18621 ( compiled || compile( selector, match ) )( 18622 seed, 18623 context, 18624 !documentIsHTML, 18625 results, 18626 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 18627 ); 18628 return results; 18629} 18630 18631// One-time assignments 18632 18633// Support: Android <=4.0 - 4.1+ 18634// Sort stability 18635support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 18636 18637// Initialize against the default document 18638setDocument(); 18639 18640// Support: Android <=4.0 - 4.1+ 18641// Detached nodes confoundingly follow *each other* 18642support.sortDetached = assert( function( el ) { 18643 18644 // Should return 1, but returns 4 (following) 18645 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 18646} ); 18647 18648jQuery.find = find; 18649 18650// Deprecated 18651jQuery.expr[ ":" ] = jQuery.expr.pseudos; 18652jQuery.unique = jQuery.uniqueSort; 18653 18654// These have always been private, but they used to be documented
18654 18655// as part of Sizzle so let's maintain them in the 3.x line 18656// for backwards compatibility purposes. 18657find.compile = compile; 18658find.select = select; 18659find.setDocument = setDocument
vendor: 12,898 bytes, lines 18659-19175
18659; 18660 18661find.escape = jQuery.escapeSelector; 18662find.getText = jQuery.text; 18663find.isXML = jQuery.isXMLDoc; 18664find.selectors = jQuery.expr; 18665find.support = jQuery.support; 18666find.uniqueSort = jQuery.uniqueSort; 18667 18668 /* eslint-enable */ 18669 18670} )(); 18671 18672 18673var dir = function( elem, dir, until ) { 18674 var matched = [], 18675 truncate = until !== undefined; 18676 18677 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 18678 if ( elem.nodeType === 1 ) { 18679 if ( truncate && jQuery( elem ).is( until ) ) { 18680 break; 18681 } 18682 matched.push( elem ); 18683 } 18684 } 18685 return matched; 18686}; 18687 18688 18689var siblings = function( n, elem ) { 18690 var matched = []; 18691 18692 for ( ; n; n = n.nextSibling ) { 18693 if ( n.nodeType === 1 && n !== elem ) { 18694 matched.push( n ); 18695 } 18696 } 18697 18698 return matched; 18699}; 18700 18701 18702var rneedsContext = jQuery.expr.match.needsContext; 18703 18704var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 18705 18706 18707 18708// Implement the identical functionality for filter and not 18709function winnow( elements, qualifier, not ) { 18710 if ( isFunction( qualifier ) ) { 18711 return jQuery.grep( elements, function( elem, i ) { 18712 return !!qualifier.call( elem, i, elem ) !== not; 18713 } ); 18714 } 18715 18716 // Single element 18717 if ( qualifier.nodeType ) { 18718 return jQuery.grep( elements, function( elem ) { 18719 return ( elem === qualifier ) !== not; 18720 } ); 18721 } 18722 18723 // Arraylike of elements (jQuery, arguments, Array) 18724 if ( typeof qualifier !== "string" ) { 18725 return jQuery.grep( elements, function( elem ) { 18726 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 18727 } ); 18728 } 18729 18730 // Filtered directly for both simple and complex selectors 18731 return jQuery.filter( qualifier, elements, not ); 18732} 18733 18734jQuery.filter = function( expr, elems, not ) { 18735 var elem = elems[ 0 ]; 18736 18737 if ( not ) { 18738 expr = ":not(" + expr + ")"; 18739 } 18740 18741 if ( elems.length === 1 && elem.nodeType === 1 ) { 18742 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 18743 } 18744 18745 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 18746 return elem.nodeType === 1; 18747 } ) ); 18748}; 18749 18750jQuery.fn.extend( { 18751 find: function( selector ) { 18752 var i, ret, 18753 len = this.length, 18754 self = this; 18755 18756 if ( typeof selector !== "string" ) { 18757 return this.pushStack( jQuery( selector ).filter( function() { 18758 for ( i = 0; i < len; i++ ) { 18759 if ( jQuery.contains( self[ i ], this ) ) { 18760 return true; 18761 } 18762 } 18763 } ) ); 18764 } 18765 18766 ret = this.pushStack( [] ); 18767 18768 for ( i = 0; i < len; i++ ) { 18769 jQuery.find( selector, self[ i ], ret ); 18770 } 18771 18772 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 18773 }, 18774 filter: function( selector ) { 18775 return this.pushStack( winnow( this, selector || [], false ) ); 18776 }, 18777 not: function( selector ) { 18778 return this.pushStack( winnow( this, selector || [], true ) ); 18779 }, 18780 is: function( selector ) { 18781 return !!winnow( 18782 this, 18783 18784 // If this is a positional/relative selector, check membership in the returned set 18785 // so $("p:first").is("p:last") won't return true for a doc with two "p". 18786 typeof selector === "string" && rneedsContext.test( selector ) ? 18787 jQuery( selector ) : 18788 selector || [], 18789 false 18790 ).length; 18791 } 18792} ); 18793 18794 18795// Initialize a jQuery object 18796 18797 18798// A central reference to the root jQuery(document) 18799var rootjQuery, 18800 18801 // A simple way to check for HTML strings 18802 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 18803 // Strict HTML recognition (trac-11290: must start with <) 18804 // Shortcut simple #id case for speed 18805 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 18806 18807 init = jQuery.fn.init = function( selector, context, root ) { 18808 var match, elem; 18809 18810 // HANDLE: $(""), $(null), $(undefined), $(false) 18811 if ( !selector ) { 18812 return this; 18813 } 18814 18815 // Method init() accepts an alternate rootjQuery 18816 // so migrate can support jQuery.sub (gh-2101) 18817 root = root || rootjQuery; 18818 18819 // Handle HTML strings 18820 if ( typeof selector === "string" ) { 18821 if ( selector[ 0 ] === "<" && 18822 selector[ selector.length - 1 ] === ">" && 18823 selector.length >= 3 ) { 18824 18825 // Assume that strings that start and end with <> are HTML and skip the regex check 18826 match = [ null, selector, null ]; 18827 18828 } else { 18829 match = rquickExpr.exec( selector ); 18830 } 18831 18832 // Match html or make sure no context is specified for #id 18833 if ( match && ( match[ 1 ] || !context ) ) { 18834 18835 // HANDLE: $(html) -> $(array) 18836 if ( match[ 1 ] ) { 18837 context = context instanceof jQuery ? context[ 0 ] : context; 18838 18839 // Option to run scripts is true for back-compat 18840 // Intentionally let the error be thrown if parseHTML is not present 18841 jQuery.merge( this, jQuery.parseHTML( 18842 match[ 1 ], 18843 context && context.nodeType ? context.ownerDocument || context : document, 18844 true 18845 ) ); 18846 18847 // HANDLE: $(html, props) 18848 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 18849 for ( match in context ) { 18850 18851 // Properties of context are called as methods if possible 18852 if ( isFunction( this[ match ] ) ) { 18853 this[ match ]( context[ match ] ); 18854 18855 // ...and otherwise set as attributes 18856 } else { 18857 this.attr( match, context[ match ] ); 18858 } 18859 } 18860 } 18861 18862 return this; 18863 18864 // HANDLE: $(#id) 18865 } else { 18866 elem = document.getElementById( match[ 2 ] ); 18867 18868 if ( elem ) { 18869 18870 // Inject the element directly into the jQuery object 18871 this[ 0 ] = elem; 18872 this.length = 1; 18873 } 18874 return this; 18875 } 18876 18877 // HANDLE: $(expr, $(...)) 18878 } else if ( !context || context.jquery ) { 18879 return ( context || root ).find( selector ); 18880 18881 // HANDLE: $(expr, context) 18882 // (which is just equivalent to: $(context).find(expr) 18883 } else { 18884 return this.constructor( context ).find( selector ); 18885 } 18886 18887 // HANDLE: $(DOMElement) 18888 } else if ( selector.nodeType ) { 18889 this[ 0 ] = selector; 18890 this.length = 1; 18891 return this; 18892 18893 // HANDLE: $(function) 18894 // Shortcut for document ready 18895 } else if ( isFunction( selector ) ) { 18896 return root.ready !== undefined ? 18897 root.ready( selector ) : 18898 18899 // Execute immediately if ready is not present 18900 selector( jQuery ); 18901 } 18902 18903 return jQuery.makeArray( selector, this ); 18904 }; 18905 18906// Give the init function the jQuery prototype for later instantiation 18907init.prototype = jQuery.fn; 18908 18909// Initialize central reference 18910rootjQuery = jQuery( document ); 18911 18912 18913var rparentsprev = /^(?:parents|prev(?:Until|All))/, 18914 18915 // Methods guaranteed to produce a unique set when starting from a unique set 18916 guaranteedUnique = { 18917 children: true, 18918 contents: true, 18919 next: true, 18920 prev: true 18921 }; 18922 18923jQuery.fn.extend( { 18924 has: function( target ) { 18925 var targets = jQuery( target, this ), 18926 l = targets.length; 18927 18928 return this.filter( function() { 18929 var i = 0; 18930 for ( ; i < l; i++ ) { 18931 if ( jQuery.contains( this, targets[ i ] ) ) { 18932 return true; 18933 } 18934 } 18935 } ); 18936 }, 18937 18938 closest: function( selectors, context ) { 18939 var cur, 18940 i = 0, 18941 l = this.length, 18942 matched = [], 18943 targets = typeof selectors !== "string" && jQuery( selectors ); 18944 18945 // Positional selectors never match, since there's no _selection_ context 18946 if ( !rneedsContext.test( selectors ) ) { 18947 for ( ; i < l; i++ ) { 18948 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 18949 18950 // Always skip document fragments 18951 if ( cur.nodeType < 11 && ( targets ? 18952 targets.index( cur ) > -1 : 18953 18954 // Don't pass non-elements to jQuery#find 18955 cur.nodeType === 1 && 18956 jQuery.find.matchesSelector( cur, selectors ) ) ) { 18957 18958 matched.push( cur ); 18959 break; 18960 } 18961 } 18962 } 18963 } 18964 18965 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 18966 }, 18967 18968 // Determine the position of an element within the set 18969 index: function( elem ) { 18970 18971 // No argument, return index in parent 18972 if ( !elem ) { 18973 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 18974 } 18975 18976 // Index in selector 18977 if ( typeof elem === "string" ) { 18978 return indexOf.call( jQuery( elem ), this[ 0 ] ); 18979 } 18980 18981 // Locate the position of the desired element 18982 return indexOf.call( this, 18983 18984 // If it receives a jQuery object, the first element is used 18985 elem.jquery ? elem[ 0 ] : elem 18986 ); 18987 }, 18988 18989 add: function( selector, context ) { 18990 return this.pushStack( 18991 jQuery.uniqueSort( 18992 jQuery.merge( this.get(), jQuery( selector, context ) ) 18993 ) 18994 ); 18995 }, 18996 18997 addBack: function( selector ) { 18998 return this.add( selector == null ? 18999 this.prevObject : this.prevObject.filter( selector ) 19000 ); 19001 } 19002} ); 19003 19004function sibling( cur, dir ) { 19005 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 19006 return cur; 19007} 19008 19009jQuery.each( { 19010 parent: function( elem ) { 19011 var parent = elem.parentNode; 19012 return parent && parent.nodeType !== 11 ? parent : null; 19013 }, 19014 parents: function( elem ) { 19015 return dir( elem, "parentNode" ); 19016 }, 19017 parentsUntil: function( elem, _i, until ) { 19018 return dir( elem, "parentNode", until ); 19019 }, 19020 next: function( elem ) { 19021 return sibling( elem, "nextSibling" ); 19022 }, 19023 prev: function( elem ) { 19024 return sibling( elem, "previousSibling" ); 19025 }, 19026 nextAll: function( elem ) { 19027 return dir( elem, "nextSibling" ); 19028 }, 19029 prevAll: function( elem ) { 19030 return dir( elem, "previousSibling" ); 19031 }, 19032 nextUntil: function( elem, _i, until ) { 19033 return dir( elem, "nextSibling", until ); 19034 }, 19035 prevUntil: function( elem, _i, until ) { 19036 return dir( elem, "previousSibling", until ); 19037 }, 19038 siblings: function( elem ) { 19039 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 19040 }, 19041 children: function( elem ) { 19042 return siblings( elem.firstChild ); 19043 }, 19044 contents: function( elem ) { 19045 if ( elem.contentDocument != null && 19046 19047 // Support: IE 11+ 19048 // <object> elements with no `data` attribute has an object 19049 // `contentDocument` with a `null` prototype. 19050 getProto( elem.contentDocument ) ) { 19051 19052 return elem.contentDocument; 19053 } 19054 19055 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 19056 // Treat the template element as a regular one in browsers that 19057 // don't support it. 19058 if ( nodeName( elem, "template" ) ) { 19059 elem = elem.content || elem; 19060 } 19061 19062 return jQuery.merge( [], elem.childNodes ); 19063 } 19064}, function( name, fn ) { 19065 jQuery.fn[ name ] = function( until, selector ) { 19066 var matched = jQuery.map( this, fn, until ); 19067 19068 if ( name.slice( -5 ) !== "Until" ) { 19069 selector = until; 19070 } 19071 19072 if ( selector && typeof selector === "string" ) { 19073 matched = jQuery.filter( selector, matched ); 19074 } 19075 19076 if ( this.length > 1 ) { 19077 19078 // Remove duplicates 19079 if ( !guaranteedUnique[ name ] ) { 19080 jQuery.uniqueSort( matched ); 19081 } 19082 19083 // Reverse order for parents* and prev-derivatives 19084 if ( rparentsprev.test( name ) ) { 19085 matched.reverse(); 19086 } 19087 } 19088 19089 return this.pushStack( matched ); 19090 }; 19091} ); 19092var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 19093 19094 19095 19096// Convert String-formatted options into Object-formatted ones 19097function createOptions( options ) { 19098 var object = {}; 19099 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 19100 object[ flag ] = true; 19101 } ); 19102 return object; 19103} 19104 19105/* 19106 * Create a callback list using the following parameters: 19107 * 19108 * options: an optional list of space-separated options that will change how 19109 * the callback list behaves or a more traditional option object 19110 * 19111 * By default a callback list will act like an event callback list and can be 19112 * "fired" multiple times. 19113 * 19114 * Possible options: 19115 * 19116 * once: will ensure the callback list can only be fired once (like a Deferred) 19117 * 19118 * memory: will keep track of previous values and will call any callback added 19119 * after the list has been fired right away with the latest "memorized" 19120 * values (like a Deferred) 19121 * 19122 * unique: will ensure a callback can only be added once (no duplicate in the list) 19123 * 19124 * stopOnFalse: interrupt callings when a callback returns false 19125 * 19126 */ 19127jQuery.Callbacks = function( options ) { 19128 19129 // Convert options from String-formatted to Object-formatted if needed 19130 // (we check in cache first) 19131 options = typeof options === "string" ? 19132 createOptions( options ) : 19133 jQuery.extend( {}, options ); 19134 19135 var // Flag to know if list is currently firing 19136 firing, 19137 19138 // Last fire value for non-forgettable lists 19139 memory, 19140 19141 // Flag to know if list was already fired 19142 fired, 19143 19144 // Flag to prevent firing 19145 locked, 19146 19147 // Actual callback list 19148 list = [], 19149 19150 // Queue of execution data for repeatable lists 19151 queue = [], 19152 19153 // Index of currently firing callback (modified by add/remove as needed) 19154 firingIndex = -1, 19155 19156 // Fire callbacks 19157 fire = function() { 19158 19159 // Enforce single-firing 19160 locked = locked || options.once; 19161 19162 // Execute callbacks for all pending executions, 19163 // respecting firingIndex overrides and runtime changes 19164 fired = firing = true; 19165 for ( ; queue.length; firingIndex = -1 ) { 19166 memory = queue.shift(); 19167 while ( ++firingIndex < list.length ) { 19168 19169 // Run callback and check for early termination 19170 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 19171 options.stopOnFalse ) { 19172 19173 // Jump to end and forget the data so .add doesn't re-fire 19174 firingIndex = list.length; 19175 memory = false;
vendor: 4,918 bytes, lines 19176-19385
19176 } 19177 } 19178 } 19179 19180 // Forget the data if we're done with it 19181 if ( !options.memory ) { 19182 memory = false; 19183 } 19184 19185 firing = false; 19186 19187 // Clean up if we're done firing for good 19188 if ( locked ) { 19189 19190 // Keep an empty list if we have data for future add calls 19191 if ( memory ) { 19192 list = []; 19193 19194 // Otherwise, this object is spent 19195 } else { 19196 list = ""; 19197 } 19198 } 19199 }, 19200 19201 // Actual Callbacks object 19202 self = { 19203 19204 // Add a callback or a collection of callbacks to the list 19205 add: function() { 19206 if ( list ) { 19207 19208 // If we have memory from a past run, we should fire after adding 19209 if ( memory && !firing ) { 19210 firingIndex = list.length - 1; 19211 queue.push( memory ); 19212 } 19213 19214 ( function add( args ) { 19215 jQuery.each( args, function( _, arg ) { 19216 if ( isFunction( arg ) ) { 19217 if ( !options.unique || !self.has( arg ) ) { 19218 list.push( arg ); 19219 } 19220 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 19221 19222 // Inspect recursively 19223 add( arg ); 19224 } 19225 } ); 19226 } )( arguments ); 19227 19228 if ( memory && !firing ) { 19229 fire(); 19230 } 19231 } 19232 return this; 19233 }, 19234 19235 // Remove a callback from the list 19236 remove: function() { 19237 jQuery.each( arguments, function( _, arg ) { 19238 var index; 19239 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 19240 list.splice( index, 1 ); 19241 19242 // Handle firing indexes 19243 if ( index <= firingIndex ) { 19244 firingIndex--; 19245 } 19246 } 19247 } ); 19248 return this; 19249 }, 19250 19251 // Check if a given callback is in the list. 19252 // If no argument is given, return whether or not list has callbacks attached. 19253 has: function( fn ) { 19254 return fn ? 19255 jQuery.inArray( fn, list ) > -1 : 19256 list.length > 0; 19257 }, 19258 19259 // Remove all callbacks from the list 19260 empty: function() { 19261 if ( list ) { 19262 list = []; 19263 } 19264 return this; 19265 }, 19266 19267 // Disable .fire and .add 19268 // Abort any current/pending executions 19269 // Clear all callbacks and values 19270 disable: function() { 19271 locked = queue = []; 19272 list = memory = ""; 19273 return this; 19274 }, 19275 disabled: function() { 19276 return !list; 19277 }, 19278 19279 // Disable .fire 19280 // Also disable .add unless we have memory (since it would have no effect) 19281 // Abort any pending executions 19282 lock: function() { 19283 locked = queue = []; 19284 if ( !memory && !firing ) { 19285 list = memory = ""; 19286 } 19287 return this; 19288 }, 19289 locked: function() { 19290 return !!locked; 19291 }, 19292 19293 // Call all callbacks with the given context and arguments 19294 fireWith: function( context, args ) { 19295 if ( !locked ) { 19296 args = args || []; 19297 args = [ context, args.slice ? args.slice() : args ]; 19298 queue.push( args ); 19299 if ( !firing ) { 19300 fire(); 19301 } 19302 } 19303 return this; 19304 }, 19305 19306 // Call all the callbacks with the given arguments 19307 fire: function() { 19308 self.fireWith( this, arguments ); 19309 return this; 19310 }, 19311 19312 // To know if the callbacks have already been called at least once 19313 fired: function() { 19314 return !!fired; 19315 } 19316 }; 19317 19318 return self; 19319}; 19320 19321 19322function Identity( v ) { 19323 return v; 19324} 19325function Thrower( ex ) { 19326 throw ex; 19327} 19328 19329function adoptValue( value, resolve, reject, noValue ) { 19330 var method; 19331 19332 try { 19333 19334 // Check for promise aspect first to privilege synchronous behavior 19335 if ( value && isFunction( ( method = value.promise ) ) ) { 19336 method.call( value ).done( resolve ).fail( reject ); 19337 19338 // Other thenables 19339 } else if ( value && isFunction( ( method = value.then ) ) ) { 19340 method.call( value, resolve, reject ); 19341 19342 // Other non-thenables 19343 } else { 19344 19345 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 19346 // * false: [ value ].slice( 0 ) => resolve( value ) 19347 // * true: [ value ].slice( 1 ) => resolve() 19348 resolve.apply( undefined, [ value ].slice( noValue ) ); 19349 } 19350 19351 // For Promises/A+, convert exceptions into rejections 19352 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 19353 // Deferred#then to conditionally suppress rejection. 19354 } catch ( value ) { 19355 19356 // Support: Android 4.0 only 19357 // Strict mode functions invoked without .call/.apply get global-object context 19358 reject.apply( undefined, [ value ] ); 19359 } 19360} 19361 19362jQuery.extend( { 19363 19364 Deferred: function( func ) { 19365 var tuples = [ 19366 19367 // action, add listener, callbacks, 19368 // ... .then handlers, argument index, [final state] 19369 [ "notify", "progress", jQuery.Callbacks( "memory" ), 19370 jQuery.Callbacks( "memory" ), 2 ], 19371 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 19372 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 19373 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 19374 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 19375 ], 19376 state = "pending", 19377 promise = { 19378 state: function() { 19379 return state; 19380 }, 19381 always: function() { 19382 deferred.done( arguments ).fail( arguments ); 19383 return this; 19384 }, 19385 "catch": function( fn ) {
vendor: 67,037 bytes, lines 19386-21873
19386 return promise.then( null, fn ); 19387 }, 19388 19389 // Keep pipe for back-compat 19390 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 19391 var fns = arguments; 19392 19393 return jQuery.Deferred( function( newDefer ) { 19394 jQuery.each( tuples, function( _i, tuple ) { 19395 19396 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 19397 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 19398 19399 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 19400 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 19401 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 19402 deferred[ tuple[ 1 ] ]( function() { 19403 var returned = fn && fn.apply( this, arguments ); 19404 if ( returned && isFunction( returned.promise ) ) { 19405 returned.promise() 19406 .progress( newDefer.notify ) 19407 .done( newDefer.resolve ) 19408 .fail( newDefer.reject ); 19409 } else { 19410 newDefer[ tuple[ 0 ] + "With" ]( 19411 this, 19412 fn ? [ returned ] : arguments 19413 ); 19414 } 19415 } ); 19416 } ); 19417 fns = null; 19418 } ).promise(); 19419 }, 19420 then: function( onFulfilled, onRejected, onProgress ) { 19421 var maxDepth = 0; 19422 function resolve( depth, deferred, handler, special ) { 19423 return function() { 19424 var that = this, 19425 args = arguments, 19426 mightThrow = function() { 19427 var returned, then; 19428 19429 // Support: Promises/A+ section 2.3.3.3.3 19430 // https://promisesaplus.com/#point-59 19431 // Ignore double-resolution attempts 19432 if ( depth < maxDepth ) { 19433 return; 19434 } 19435 19436 returned = handler.apply( that, args ); 19437 19438 // Support: Promises/A+ section 2.3.1 19439 // https://promisesaplus.com/#point-48 19440 if ( returned === deferred.promise() ) { 19441 throw new TypeError( "Thenable self-resolution" ); 19442 } 19443 19444 // Support: Promises/A+ sections 2.3.3.1, 3.5 19445 // https://promisesaplus.com/#point-54 19446 // https://promisesaplus.com/#point-75 19447 // Retrieve `then` only once 19448 then = returned && 19449 19450 // Support: Promises/A+ section 2.3.4 19451 // https://promisesaplus.com/#point-64 19452 // Only check objects and functions for thenability 19453 ( typeof returned === "object" || 19454 typeof returned === "function" ) && 19455 returned.then; 19456 19457 // Handle a returned thenable 19458 if ( isFunction( then ) ) { 19459 19460 // Special processors (notify) just wait for resolution 19461 if ( special ) { 19462 then.call( 19463 returned, 19464 resolve( maxDepth, deferred, Identity, special ), 19465 resolve( maxDepth, deferred, Thrower, special ) 19466 ); 19467 19468 // Normal processors (resolve) also hook into progress 19469 } else { 19470 19471 // ...and disregard older resolution values 19472 maxDepth++; 19473 19474 then.call( 19475 returned, 19476 resolve( maxDepth, deferred, Identity, special ), 19477 resolve( maxDepth, deferred, Thrower, special ), 19478 resolve( maxDepth, deferred, Identity, 19479 deferred.notifyWith ) 19480 ); 19481 } 19482 19483 // Handle all other returned values 19484 } else { 19485 19486 // Only substitute handlers pass on context 19487 // and multiple values (non-spec behavior) 19488 if ( handler !== Identity ) { 19489 that = undefined; 19490 args = [ returned ]; 19491 } 19492 19493 // Process the value(s) 19494 // Default process is resolve 19495 ( special || deferred.resolveWith )( that, args ); 19496 } 19497 }, 19498 19499 // Only normal processors (resolve) catch and reject exceptions 19500 process = special ? 19501 mightThrow : 19502 function() { 19503 try { 19504 mightThrow(); 19505 } catch ( e ) { 19506 19507 if ( jQuery.Deferred.exceptionHook ) { 19508 jQuery.Deferred.exceptionHook( e, 19509 process.error ); 19510 } 19511 19512 // Support: Promises/A+ section 2.3.3.3.4.1 19513 // https://promisesaplus.com/#point-61 19514 // Ignore post-resolution exceptions 19515 if ( depth + 1 >= maxDepth ) { 19516 19517 // Only substitute handlers pass on context 19518 // and multiple values (non-spec behavior) 19519 if ( handler !== Thrower ) { 19520 that = undefined; 19521 args = [ e ]; 19522 } 19523 19524 deferred.rejectWith( that, args ); 19525 } 19526 } 19527 }; 19528 19529 // Support: Promises/A+ section 2.3.3.3.1 19530 // https://promisesaplus.com/#point-57 19531 // Re-resolve promises immediately to dodge false rejection from 19532 // subsequent errors 19533 if ( depth ) { 19534 process(); 19535 } else { 19536 19537 // Call an optional hook to record the error, in case of exception 19538 // since it's otherwise lost when execution goes async 19539 if ( jQuery.Deferred.getErrorHook ) { 19540 process.error = jQuery.Deferred.getErrorHook(); 19541 19542 // The deprecated alias of the above. While the name suggests 19543 // returning the stack, not an error instance, jQuery just passes 19544 // it directly to `console.warn` so both will work; an instance 19545 // just better cooperates with source maps. 19546 } else if ( jQuery.Deferred.getStackHook ) { 19547 process.error = jQuery.Deferred.getStackHook(); 19548 } 19549 window.setTimeout( process ); 19550 } 19551 }; 19552 } 19553 19554 return jQuery.Deferred( function( newDefer ) { 19555 19556 // progress_handlers.add( ... ) 19557 tuples[ 0 ][ 3 ].add( 19558 resolve( 19559 0, 19560 newDefer, 19561 isFunction( onProgress ) ? 19562 onProgress : 19563 Identity, 19564 newDefer.notifyWith 19565 ) 19566 ); 19567 19568 // fulfilled_handlers.add( ... ) 19569 tuples[ 1 ][ 3 ].add( 19570 resolve( 19571 0, 19572 newDefer, 19573 isFunction( onFulfilled ) ? 19574 onFulfilled : 19575 Identity 19576 ) 19577 ); 19578 19579 // rejected_handlers.add( ... ) 19580 tuples[ 2 ][ 3 ].add( 19581 resolve( 19582 0, 19583 newDefer, 19584 isFunction( onRejected ) ? 19585 onRejected : 19586 Thrower 19587 ) 19588 ); 19589 } ).promise(); 19590 }, 19591 19592 // Get a promise for this deferred 19593 // If obj is provided, the promise aspect is added to the object 19594 promise: function( obj ) { 19595 return obj != null ? jQuery.extend( obj, promise ) : promise; 19596 } 19597 }, 19598 deferred = {}; 19599 19600 // Add list-specific methods 19601 jQuery.each( tuples, function( i, tuple ) { 19602 var list = tuple[ 2 ], 19603 stateString = tuple[ 5 ]; 19604 19605 // promise.progress = list.add 19606 // promise.done = list.add 19607 // promise.fail = list.add 19608 promise[ tuple[ 1 ] ] = list.add; 19609 19610 // Handle state 19611 if ( stateString ) { 19612 list.add( 19613 function() { 19614 19615 // state = "resolved" (i.e., fulfilled) 19616 // state = "rejected" 19617 state = stateString; 19618 }, 19619 19620 // rejected_callbacks.disable 19621 // fulfilled_callbacks.disable 19622 tuples[ 3 - i ][ 2 ].disable, 19623 19624 // rejected_handlers.disable 19625 // fulfilled_handlers.disable 19626 tuples[ 3 - i ][ 3 ].disable, 19627 19628 // progress_callbacks.lock 19629 tuples[ 0 ][ 2 ].lock, 19630 19631 // progress_handlers.lock 19632 tuples[ 0 ][ 3 ].lock 19633 ); 19634 } 19635 19636 // progress_handlers.fire 19637 // fulfilled_handlers.fire 19638 // rejected_handlers.fire 19639 list.add( tuple[ 3 ].fire ); 19640 19641 // deferred.notify = function() { deferred.notifyWith(...) } 19642 // deferred.resolve = function() { deferred.resolveWith(...) } 19643 // deferred.reject = function() { deferred.rejectWith(...) } 19644 deferred[ tuple[ 0 ] ] = function() { 19645 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 19646 return this; 19647 }; 19648 19649 // deferred.notifyWith = list.fireWith 19650 // deferred.resolveWith = list.fireWith 19651 // deferred.rejectWith = list.fireWith 19652 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 19653 } ); 19654 19655 // Make the deferred a promise 19656 promise.promise( deferred ); 19657 19658 // Call given func if any 19659 if ( func ) { 19660 func.call( deferred, deferred ); 19661 } 19662 19663 // All done! 19664 return deferred; 19665 }, 19666 19667 // Deferred helper 19668 when: function( singleValue ) { 19669 var 19670 19671 // count of uncompleted subordinates 19672 remaining = arguments.length, 19673 19674 // count of unprocessed arguments 19675 i = remaining, 19676 19677 // subordinate fulfillment data 19678 resolveContexts = Array( i ), 19679 resolveValues = slice.call( arguments ), 19680 19681 // the primary Deferred 19682 primary = jQuery.Deferred(), 19683 19684 // subordinate callback factory 19685 updateFunc = function( i ) { 19686 return function( value ) { 19687 resolveContexts[ i ] = this; 19688 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 19689 if ( !( --remaining ) ) { 19690 primary.resolveWith( resolveContexts, resolveValues ); 19691 } 19692 }; 19693 }; 19694 19695 // Single- and empty arguments are adopted like Promise.resolve 19696 if ( remaining <= 1 ) { 19697 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 19698 !remaining ); 19699 19700 // Use .then() to unwrap secondary thenables (cf. gh-3000) 19701 if ( primary.state() === "pending" || 19702 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 19703 19704 return primary.then(); 19705 } 19706 } 19707 19708 // Multiple arguments are aggregated like Promise.all array elements 19709 while ( i-- ) { 19710 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 19711 } 19712 19713 return primary.promise(); 19714 } 19715} ); 19716 19717 19718// These usually indicate a programmer mistake during development, 19719// warn about them ASAP rather than swallowing them by default. 19720var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 19721 19722// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 19723// captured before the async barrier to get the original error cause 19724// which may otherwise be hidden. 19725jQuery.Deferred.exceptionHook = function( error, asyncError ) { 19726 19727 // Support: IE 8 - 9 only 19728 // Console exists when dev tools are open, which can happen at any time 19729 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 19730 window.console.warn( "jQuery.Deferred exception: " + error.message, 19731 error.stack, asyncError ); 19732 } 19733}; 19734 19735 19736 19737 19738jQuery.readyException = function( error ) { 19739 window.setTimeout( function() { 19740 throw error; 19741 } ); 19742}; 19743 19744 19745 19746 19747// The deferred used on DOM ready 19748var readyList = jQuery.Deferred(); 19749 19750jQuery.fn.ready = function( fn ) { 19751 19752 readyList 19753 .then( fn ) 19754 19755 // Wrap jQuery.readyException in a function so that the lookup 19756 // happens at the time of error handling instead of callback 19757 // registration. 19758 .catch( function( error ) { 19759 jQuery.readyException( error ); 19760 } ); 19761 19762 return this; 19763}; 19764 19765jQuery.extend( { 19766 19767 // Is the DOM ready to be used? Set to true once it occurs. 19768 isReady: false, 19769 19770 // A counter to track how many items to wait for before 19771 // the ready event fires. See trac-6781 19772 readyWait: 1, 19773 19774 // Handle when the DOM is ready 19775 ready: function( wait ) { 19776 19777 // Abort if there are pending holds or we're already ready 19778 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 19779 return; 19780 } 19781 19782 // Remember that the DOM is ready 19783 jQuery.isReady = true; 19784 19785 // If a normal DOM Ready event fired, decrement, and wait if need be 19786 if ( wait !== true && --jQuery.readyWait > 0 ) { 19787 return; 19788 } 19789 19790 // If there are functions bound, to execute 19791 readyList.resolveWith( document, [ jQuery ] ); 19792 } 19793} ); 19794 19795jQuery.ready.then = readyList.then; 19796 19797// The ready event handler and self cleanup method 19798function completed() { 19799 document.removeEventListener( "DOMContentLoaded", completed ); 19800 window.removeEventListener( "load", completed ); 19801 jQuery.ready(); 19802} 19803 19804// Catch cases where $(document).ready() is called 19805// after the browser event has already occurred. 19806// Support: IE <=9 - 10 only 19807// Older IE sometimes signals "interactive" too soon 19808if ( document.readyState === "complete" || 19809 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 19810 19811 // Handle it asynchronously to allow scripts the opportunity to delay ready 19812 window.setTimeout( jQuery.ready ); 19813 19814} else { 19815 19816 // Use the handy event callback 19817 document.addEventListener( "DOMContentLoaded", completed ); 19818 19819 // A fallback to window.onload, that will always work 19820 window.addEventListener( "load", completed ); 19821} 19822 19823 19824 19825 19826// Multifunctional method to get and set values of a collection 19827// The value/s can optionally be executed if it's a function 19828var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 19829 var i = 0, 19830 len = elems.length, 19831 bulk = key == null; 19832 19833 // Sets many values 19834 if ( toType( key ) === "object" ) { 19835 chainable = true; 19836 for ( i in key ) { 19837 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 19838 } 19839 19840 // Sets one value 19841 } else if ( value !== undefined ) { 19842 chainable = true; 19843 19844 if ( !isFunction( value ) ) { 19845 raw = true; 19846 } 19847 19848 if ( bulk ) { 19849 19850 // Bulk operations run against the entire set 19851 if ( raw ) { 19852 fn.call( elems, value ); 19853 fn = null; 19854 19855 // ...except when executing function values 19856 } else { 19857 bulk = fn; 19858 fn = function( elem, _key, value ) { 19859 return bulk.call( jQuery( elem ), value ); 19860 }; 19861 } 19862 } 19863 19864 if ( fn ) { 19865 for ( ; i < len; i++ ) { 19866 fn( 19867 elems[ i ], key, raw ? 19868 value : 19869 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 19870 ); 19871 } 19872 } 19873 } 19874 19875 if ( chainable ) { 19876 return elems; 19877 } 19878 19879 // Gets 19880 if ( bulk ) { 19881 return fn.call( elems ); 19882 } 19883 19884 return len ? fn( elems[ 0 ], key ) : emptyGet; 19885}; 19886 19887 19888// Matches dashed string for camelizing 19889var rmsPrefix = /^-ms-/, 19890 rdashAlpha = /-([a-z])/g; 19891 19892// Used by camelCase as callback to replace() 19893function fcamelCase( _all, letter ) { 19894 return letter.toUpperCase(); 19895} 19896 19897// Convert dashed to camelCase; used by the css and data modules 19898// Support: IE <=9 - 11, Edge 12 - 15 19899// Microsoft forgot to hump their vendor prefix (trac-9572) 19900function camelCase( string ) { 19901 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 19902} 19903var acceptData = function( owner ) { 19904 19905 // Accepts only: 19906 // - Node 19907 // - Node.ELEMENT_NODE 19908 // - Node.DOCUMENT_NODE 19909 // - Object 19910 // - Any 19911 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 19912}; 19913 19914 19915 19916 19917function Data() { 19918 this.expando = jQuery.expando + Data.uid++; 19919} 19920 19921Data.uid = 1; 19922 19923Data.prototype = { 19924 19925 cache: function( owner ) { 19926 19927 // Check if the owner object already has a cache 19928 var value = owner[ this.expando ]; 19929 19930 // If not, create one 19931 if ( !value ) { 19932 value = {}; 19933 19934 // We can accept data for non-element nodes in modern browsers, 19935 // but we should not, see trac-8335. 19936 // Always return an empty object. 19937 if ( acceptData( owner ) ) { 19938 19939 // If it is a node unlikely to be stringify-ed or looped over 19940 // use plain assignment 19941 if ( owner.nodeType ) { 19942 owner[ this.expando ] = value; 19943 19944 // Otherwise secure it in a non-enumerable property 19945 // configurable must be true to allow the property to be 19946 // deleted when data is removed 19947 } else { 19948 Object.defineProperty( owner, this.expando, { 19949 value: value, 19950 configurable: true 19951 } ); 19952 } 19953 } 19954 } 19955 19956 return value; 19957 }, 19958 set: function( owner, data, value ) { 19959 var prop, 19960 cache = this.cache( owner ); 19961 19962 // Handle: [ owner, key, value ] args 19963 // Always use camelCase key (gh-2257) 19964 if ( typeof data === "string" ) { 19965 cache[ camelCase( data ) ] = value; 19966 19967 // Handle: [ owner, { properties } ] args 19968 } else { 19969 19970 // Copy the properties one-by-one to the cache object 19971 for ( prop in data ) { 19972 cache[ camelCase( prop ) ] = data[ prop ]; 19973 } 19974 } 19975 return cache; 19976 }, 19977 get: function( owner, key ) { 19978 return key === undefined ? 19979 this.cache( owner ) : 19980 19981 // Always use camelCase key (gh-2257) 19982 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 19983 }, 19984 access: function( owner, key, value ) { 19985 19986 // In cases where either: 19987 // 19988 // 1. No key was specified 19989 // 2. A string key was specified, but no value provided 19990 // 19991 // Take the "read" path and allow the get method to determine 19992 // which value to return, respectively either: 19993 // 19994 // 1. The entire cache object 19995 // 2. The data stored at the key 19996 // 19997 if ( key === undefined || 19998 ( ( key && typeof key === "string" ) && value === undefined ) ) { 19999 20000 return this.get( owner, key ); 20001 } 20002 20003 // When the key is not a string, or both a key and value 20004 // are specified, set or extend (existing objects) with either: 20005 // 20006 // 1. An object of properties 20007 // 2. A key and value 20008 // 20009 this.set( owner, key, value ); 20010 20011 // Since the "set" path can have two possible entry points 20012 // return the expected data based on which path was taken[*] 20013 return value !== undefined ? value : key; 20014 }, 20015 remove: function( owner, key ) { 20016 var i, 20017 cache = owner[ this.expando ]; 20018 20019 if ( cache === undefined ) { 20020 return; 20021 } 20022 20023 if ( key !== undefined ) { 20024 20025 // Support array or space separated string of keys 20026 if ( Array.isArray( key ) ) { 20027 20028 // If key is an array of keys... 20029 // We always set camelCase keys, so remove that. 20030 key = key.map( camelCase ); 20031 } else { 20032 key = camelCase( key ); 20033 20034 // If a key with the spaces exists, use it. 20035 // Otherwise, create an array by matching non-whitespace 20036 key = key in cache ? 20037 [ key ] : 20038 ( key.match( rnothtmlwhite ) || [] ); 20039 } 20040 20041 i = key.length; 20042 20043 while ( i-- ) { 20044 delete cache[ key[ i ] ]; 20045 } 20046 } 20047 20048 // Remove the expando if there's no more data 20049 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 20050 20051 // Support: Chrome <=35 - 45 20052 // Webkit & Blink performance suffers when deleting properties 20053 // from DOM nodes, so set to undefined instead 20054 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 20055 if ( owner.nodeType ) { 20056 owner[ this.expando ] = undefined; 20057 } else { 20058 delete owner[ this.expando ]; 20059 } 20060 } 20061 }, 20062 hasData: function( owner ) { 20063 var cache = owner[ this.expando ]; 20064 return cache !== undefined && !jQuery.isEmptyObject( cache ); 20065 } 20066}; 20067var dataPriv = new Data(); 20068 20069var dataUser = new Data(); 20070 20071 20072 20073// Implementation Summary 20074// 20075// 1. Enforce API surface and semantic compatibility with 1.9.x branch 20076// 2. Improve the module's maintainability by reducing the storage 20077// paths to a single mechanism. 20078// 3. Use the same single mechanism to support "private" and "user" data. 20079// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 20080// 5. Avoid exposing implementation details on user objects (eg. expando properties) 20081// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 20082 20083var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 20084 rmultiDash = /[A-Z]/g; 20085 20086function getData( data ) { 20087 if ( data === "true" ) { 20088 return true; 20089 } 20090 20091 if ( data === "false" ) { 20092 return false; 20093 } 20094 20095 if ( data === "null" ) { 20096 return null; 20097 } 20098 20099 // Only convert to a number if it doesn't change the string 20100 if ( data === +data + "" ) { 20101 return +data; 20102 } 20103 20104 if ( rbrace.test( data ) ) { 20105 return JSON.parse( data ); 20106 } 20107 20108 return data; 20109} 20110 20111function dataAttr( elem, key, data ) { 20112 var name; 20113 20114 // If nothing was found internally, try to fetch any 20115 // data from the HTML5 data-* attribute 20116 if ( data === undefined && elem.nodeType === 1 ) { 20117 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 20118 data = elem.getAttribute( name ); 20119 20120 if ( typeof data === "string" ) { 20121 try { 20122 data = getData( data ); 20123 } catch ( e ) {} 20124 20125 // Make sure we set the data so it isn't changed later 20126 dataUser.set( elem, key, data ); 20127 } else { 20128 data = undefined; 20129 } 20130 } 20131 return data; 20132} 20133 20134jQuery.extend( { 20135 hasData: function( elem ) { 20136 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 20137 }, 20138 20139 data: function( elem, name, data ) { 20140 return dataUser.access( elem, name, data ); 20141 }, 20142 20143 removeData: function( elem, name ) { 20144 dataUser.remove( elem, name ); 20145 }, 20146 20147 // TODO: Now that all calls to _data and _removeData have been replaced 20148 // with direct calls to dataPriv methods, these can be deprecated. 20149 _data: function( elem, name, data ) { 20150 return dataPriv.access( elem, name, data ); 20151 }, 20152 20153 _removeData: function( elem, name ) { 20154 dataPriv.remove( elem, name ); 20155 } 20156} ); 20157 20158jQuery.fn.extend( { 20159 data: function( key, value ) { 20160 var i, name, data, 20161 elem = this[ 0 ], 20162 attrs = elem && elem.attributes; 20163 20164 // Gets all values 20165 if ( key === undefined ) { 20166 if ( this.length ) { 20167 data = dataUser.get( elem ); 20168 20169 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 20170 i = attrs.length; 20171 while ( i-- ) { 20172 20173 // Support: IE 11 only 20174 // The attrs elements can be null (trac-14894) 20175 if ( attrs[ i ] ) { 20176 name = attrs[ i ].name; 20177 if ( name.indexOf( "data-" ) === 0 ) { 20178 name = camelCase( name.slice( 5 ) ); 20179 dataAttr( elem, name, data[ name ] ); 20180 } 20181 } 20182 } 20183 dataPriv.set( elem, "hasDataAttrs", true ); 20184 } 20185 } 20186 20187 return data; 20188 } 20189 20190 // Sets multiple values 20191 if ( typeof key === "object" ) { 20192 return this.each( function() { 20193 dataUser.set( this, key ); 20194 } ); 20195 } 20196 20197 return access( this, function( value ) { 20198 var data; 20199 20200 // The calling jQuery object (element matches) is not empty 20201 // (and therefore has an element appears at this[ 0 ]) and the 20202 // `value` parameter was not undefined. An empty jQuery object 20203 // will result in `undefined` for elem = this[ 0 ] which will 20204 // throw an exception if an attempt to read a data cache is made. 20205 if ( elem && value === undefined ) { 20206 20207 // Attempt to get data from the cache 20208 // The key will always be camelCased in Data 20209 data = dataUser.get( elem, key ); 20210 if ( data !== undefined ) { 20211 return data; 20212 } 20213 20214 // Attempt to "discover" the data in 20215 // HTML5 custom data-* attrs 20216 data = dataAttr( elem, key ); 20217 if ( data !== undefined ) { 20218 return data; 20219 } 20220 20221 // We tried really hard, but the data doesn't exist. 20222 return; 20223 } 20224 20225 // Set the data... 20226 this.each( function() { 20227 20228 // We always store the camelCased key 20229 dataUser.set( this, key, value ); 20230 } ); 20231 }, null, value, arguments.length > 1, null, true ); 20232 }, 20233 20234 removeData: function( key ) { 20235 return this.each( function() { 20236 dataUser.remove( this, key ); 20237 } ); 20238 } 20239} ); 20240 20241 20242jQuery.extend( { 20243 queue: function( elem, type, data ) { 20244 var queue; 20245 20246 if ( elem ) { 20247 type = ( type || "fx" ) + "queue"; 20248 queue = dataPriv.get( elem, type ); 20249 20250 // Speed up dequeue by getting out quickly if this is just a lookup 20251 if ( data ) { 20252 if ( !queue || Array.isArray( data ) ) { 20253 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 20254 } else { 20255 queue.push( data ); 20256 } 20257 } 20258 return queue || []; 20259 } 20260 }, 20261 20262 dequeue: function( elem, type ) { 20263 type = type || "fx"; 20264 20265 var queue = jQuery.queue( elem, type ), 20266 startLength = queue.length, 20267 fn = queue.shift(), 20268 hooks = jQuery._queueHooks( elem, type ), 20269 next = function() { 20270 jQuery.dequeue( elem, type ); 20271 }; 20272 20273 // If the fx queue is dequeued, always remove the progress sentinel 20274 if ( fn === "inprogress" ) { 20275 fn = queue.shift(); 20276 startLength--; 20277 } 20278 20279 if ( fn ) { 20280 20281 // Add a progress sentinel to prevent the fx queue from being 20282 // automatically dequeued 20283 if ( type === "fx" ) { 20284 queue.unshift( "inprogress" ); 20285 } 20286 20287 // Clear up the last queue stop function 20288 delete hooks.stop; 20289 fn.call( elem, next, hooks ); 20290 } 20291 20292 if ( !startLength && hooks ) { 20293 hooks.empty.fire(); 20294 } 20295 }, 20296 20297 // Not public - generate a queueHooks object, or return the current one 20298 _queueHooks: function( elem, type ) { 20299 var key = type + "queueHooks"; 20300 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 20301 empty: jQuery.Callbacks( "once memory" ).add( function() { 20302 dataPriv.remove( elem, [ type + "queue", key ] ); 20303 } ) 20304 } ); 20305 } 20306} ); 20307 20308jQuery.fn.extend( { 20309 queue: function( type, data ) { 20310 var setter = 2; 20311 20312 if ( typeof type !== "string" ) { 20313 data = type; 20314 type = "fx"; 20315 setter--; 20316 } 20317 20318 if ( arguments.length < setter ) { 20319 return jQuery.queue( this[ 0 ], type ); 20320 } 20321 20322 return data === undefined ? 20323 this : 20324 this.each( function() { 20325 var queue = jQuery.queue( this, type, data ); 20326 20327 // Ensure a hooks for this queue 20328 jQuery._queueHooks( this, type ); 20329 20330 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 20331 jQuery.dequeue( this, type ); 20332 } 20333 } ); 20334 }, 20335 dequeue: function( type ) { 20336 return this.each( function() { 20337 jQuery.dequeue( this, type ); 20338 } ); 20339 }, 20340 clearQueue: function( type ) { 20341 return this.queue( type || "fx", [] ); 20342 }, 20343 20344 // Get a promise resolved when queues of a certain type 20345 // are emptied (fx is the type by default) 20346 promise: function( type, obj ) { 20347 var tmp, 20348 count = 1, 20349 defer = jQuery.Deferred(), 20350 elements = this, 20351 i = this.length, 20352 resolve = function() { 20353 if ( !( --count ) ) { 20354 defer.resolveWith( elements, [ elements ] ); 20355 } 20356 }; 20357 20358 if ( typeof type !== "string" ) { 20359 obj = type; 20360 type = undefined; 20361 } 20362 type = type || "fx"; 20363 20364 while ( i-- ) { 20365 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 20366 if ( tmp && tmp.empty ) { 20367 count++; 20368 tmp.empty.add( resolve ); 20369 } 20370 } 20371 resolve(); 20372 return defer.promise( obj ); 20373 } 20374} ); 20375var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 20376 20377var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 20378 20379 20380var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 20381 20382var documentElement = document.documentElement; 20383 20384 20385 20386 var isAttached = function( elem ) { 20387 return jQuery.contains( elem.ownerDocument, elem ); 20388 }, 20389 composed = { composed: true }; 20390 20391 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 20392 // Check attachment across shadow DOM boundaries when possible (gh-3504) 20393 // Support: iOS 10.0-10.2 only 20394 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 20395 // leading to errors. We need to check for `getRootNode`. 20396 if ( documentElement.getRootNode ) { 20397 isAttached = function( elem ) { 20398 return jQuery.contains( elem.ownerDocument, elem ) || 20399 elem.getRootNode( composed ) === elem.ownerDocument; 20400 }; 20401 } 20402var isHiddenWithinTree = function( elem, el ) { 20403 20404 // isHiddenWithinTree might be called from jQuery#filter function; 20405 // in that case, element will be second argument 20406 elem = el || elem; 20407 20408 // Inline style trumps all 20409 return elem.style.display === "none" || 20410 elem.style.display === "" && 20411 20412 // Otherwise, check computed style 20413 // Support: Firefox <=43 - 45 20414 // Disconnected elements can have computed display: none, so first confirm that elem is 20415 // in the document. 20416 isAttached( elem ) && 20417 20418 jQuery.css( elem, "display" ) === "none"; 20419 }; 20420 20421 20422 20423function adjustCSS( elem, prop, valueParts, tween ) { 20424 var adjusted, scale, 20425 maxIterations = 20, 20426 currentValue = tween ? 20427 function() { 20428 return tween.cur(); 20429 } : 20430 function() { 20431 return jQuery.css( elem, prop, "" ); 20432 }, 20433 initial = currentValue(), 20434 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 20435 20436 // Starting value computation is required for potential unit mismatches 20437 initialInUnit = elem.nodeType && 20438 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 20439 rcssNum.exec( jQuery.css( elem, prop ) ); 20440 20441 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 20442 20443 // Support: Firefox <=54 20444 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 20445 initial = initial / 2; 20446 20447 // Trust units reported by jQuery.css 20448 unit = unit || initialInUnit[ 3 ]; 20449 20450 // Iteratively approximate from a nonzero starting point 20451 initialInUnit = +initial || 1; 20452 20453 while ( maxIterations-- ) { 20454 20455 // Evaluate and update our best guess (doubling guesses that zero out). 20456 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 20457 jQuery.style( elem, prop, initialInUnit + unit ); 20458 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 20459 maxIterations = 0; 20460 } 20461 initialInUnit = initialInUnit / scale; 20462 20463 } 20464 20465 initialInUnit = initialInUnit * 2; 20466 jQuery.style( elem, prop, initialInUnit + unit ); 20467 20468 // Make sure we update the tween properties later on 20469 valueParts = valueParts || []; 20470 } 20471 20472 if ( valueParts ) { 20473 initialInUnit = +initialInUnit || +initial || 0; 20474 20475 // Apply relative offset (+=/-=) if specified 20476 adjusted = valueParts[ 1 ] ? 20477 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 20478 +valueParts[ 2 ]; 20479 if ( tween ) { 20480 tween.unit = unit; 20481 tween.start = initialInUnit; 20482 tween.end = adjusted; 20483 } 20484 } 20485 return adjusted; 20486} 20487 20488 20489var defaultDisplayMap = {}; 20490 20491function getDefaultDisplay( elem ) { 20492 var temp, 20493 doc = elem.ownerDocument, 20494 nodeName = elem.nodeName, 20495 display = defaultDisplayMap[ nodeName ]; 20496 20497 if ( display ) { 20498 return display; 20499 } 20500 20501 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 20502 display = jQuery.css( temp, "display" ); 20503 20504 temp.parentNode.removeChild( temp ); 20505 20506 if ( display === "none" ) { 20507 display = "block"; 20508 } 20509 defaultDisplayMap[ nodeName ] = display; 20510 20511 return display; 20512} 20513 20514function showHide( elements, show ) { 20515 var display, elem, 20516 values = [], 20517 index = 0, 20518 length = elements.length; 20519 20520 // Determine new display value for elements that need to change 20521 for ( ; index < length; index++ ) { 20522 elem = elements[ index ]; 20523 if ( !elem.style ) { 20524 continue; 20525 } 20526 20527 display = elem.style.display; 20528 if ( show ) { 20529 20530 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 20531 // check is required in this first loop unless we have a nonempty display value (either 20532 // inline or about-to-be-restored) 20533 if ( display === "none" ) { 20534 values[ index ] = dataPriv.get( elem, "display" ) || null; 20535 if ( !values[ index ] ) { 20536 elem.style.display = ""; 20537 } 20538 } 20539 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 20540 values[ index ] = getDefaultDisplay( elem ); 20541 } 20542 } else { 20543 if ( display !== "none" ) { 20544 values[ index ] = "none"; 20545 20546 // Remember what we're overwriting 20547 dataPriv.set( elem, "display", display ); 20548 } 20549 } 20550 } 20551 20552 // Set the display of the elements in a second loop to avoid constant reflow 20553 for ( index = 0; index < length; index++ ) { 20554 if ( values[ index ] != null ) { 20555 elements[ index ].style.display = values[ index ]; 20556 } 20557 } 20558 20559 return elements; 20560} 20561 20562jQuery.fn.extend( { 20563 show: function() { 20564 return showHide( this, true ); 20565 }, 20566 hide: function() { 20567 return showHide( this ); 20568 }, 20569 toggle: function( state ) { 20570 if ( typeof state === "boolean" ) { 20571 return state ? this.show() : this.hide(); 20572 } 20573 20574 return this.each( function() { 20575 if ( isHiddenWithinTree( this ) ) { 20576 jQuery( this ).show(); 20577 } else { 20578 jQuery( this ).hide(); 20579 } 20580 } ); 20581 } 20582} ); 20583var rcheckableType = ( /^(?:checkbox|radio)$/i ); 20584 20585var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 20586 20587var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 20588 20589 20590 20591( function() { 20592 var fragment = document.createDocumentFragment(), 20593 div = fragment.appendChild( document.createElement( "div" ) ), 20594 input = document.createElement( "input" ); 20595 20596 // Support: Android 4.0 - 4.3 only 20597 // Check state lost if the name is set (trac-11217) 20598 // Support: Windows Web Apps (WWA) 20599 // `name` and `type` must use .setAttribute for WWA (trac-14901) 20600 input.setAttribute( "type", "radio" ); 20601 input.setAttribute( "checked", "checked" ); 20602 input.setAttribute( "name", "t" ); 20603 20604 div.appendChild( input ); 20605 20606 // Support: Android <=4.1 only 20607 // Older WebKit doesn't clone checked state correctly in fragments 20608 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 20609 20610 // Support: IE <=11 only 20611 // Make sure textarea (and checkbox) defaultValue is properly cloned 20612 div.innerHTML = "<textarea>x</textarea>"; 20613 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 20614 20615 // Support: IE <=9 only 20616 // IE <=9 replaces <option> tags with their contents when inserted outside of 20617 // the select element. 20618 div.innerHTML = "<option></option>"; 20619 support.option = !!div.lastChild; 20620} )(); 20621 20622 20623// We have to close these tags to support XHTML (trac-13200) 20624var wrapMap = { 20625 20626 // XHTML parsers do not magically insert elements in the 20627 // same way that tag soup parsers do. So we cannot shorten 20628 // this by omitting <tbody> or other required elements. 20629 thead: [ 1, "<table>", "</table>" ], 20630 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 20631 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 20632 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 20633 20634 _default: [ 0, "", "" ] 20635}; 20636 20637wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 20638wrapMap.th = wrapMap.td; 20639 20640// Support: IE <=9 only 20641if ( !support.option ) { 20642 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 20643} 20644 20645 20646function getAll( context, tag ) { 20647 20648 // Support: IE <=9 - 11 only 20649 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 20650 var ret; 20651 20652 if ( typeof context.getElementsByTagName !== "undefined" ) { 20653 ret = context.getElementsByTagName( tag || "*" ); 20654 20655 } else if ( typeof context.querySelectorAll !== "undefined" ) { 20656 ret = context.querySelectorAll( tag || "*" ); 20657 20658 } else { 20659 ret = []; 20660 } 20661 20662 if ( tag === undefined || tag && nodeName( context, tag ) ) { 20663 return jQuery.merge( [ context ], ret ); 20664 } 20665 20666 return ret; 20667} 20668 20669 20670// Mark scripts as having already been evaluated 20671function setGlobalEval( elems, refElements ) { 20672 var i = 0, 20673 l = elems.length; 20674 20675 for ( ; i < l; i++ ) { 20676 dataPriv.set( 20677 elems[ i ], 20678 "globalEval", 20679 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 20680 ); 20681 } 20682} 20683 20684 20685var rhtml = /<|&#?\w+;/; 20686 20687function buildFragment( elems, context, scripts, selection, ignored ) { 20688 var elem, tmp, tag, wrap, attached, j, 20689 fragment = context.createDocumentFragment(), 20690 nodes = [], 20691 i = 0, 20692 l = elems.length; 20693 20694 for ( ; i < l; i++ ) { 20695 elem = elems[ i ]; 20696 20697 if ( elem || elem === 0 ) { 20698 20699 // Add nodes directly 20700 if ( toType( elem ) === "object" ) { 20701 20702 // Support: Android <=4.0 only, PhantomJS 1 only 20703 // push.apply(_, arraylike) throws on ancient WebKit 20704 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 20705 20706 // Convert non-html into a text node 20707 } else if ( !rhtml.test( elem ) ) { 20708 nodes.push( context.createTextNode( elem ) ); 20709 20710 // Convert html into DOM nodes 20711 } else { 20712 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 20713 20714 // Deserialize a standard representation 20715 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 20716 wrap = wrapMap[ tag ] || wrapMap._default; 20717 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 20718 20719 // Descend through wrappers to the right content 20720 j = wrap[ 0 ]; 20721 while ( j-- ) { 20722 tmp = tmp.lastChild; 20723 } 20724 20725 // Support: Android <=4.0 only, PhantomJS 1 only 20726 // push.apply(_, arraylike) throws on ancient WebKit 20727 jQuery.merge( nodes, tmp.childNodes ); 20728 20729 // Remember the top-level container 20730 tmp = fragment.firstChild; 20731 20732 // Ensure the created nodes are orphaned (trac-12392) 20733 tmp.textContent = ""; 20734 } 20735 } 20736 } 20737 20738 // Remove wrapper from fragment 20739 fragment.textContent = ""; 20740 20741 i = 0; 20742 while ( ( elem = nodes[ i++ ] ) ) { 20743 20744 // Skip elements already in the context collection (trac-4087) 20745 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 20746 if ( ignored ) { 20747 ignored.push( elem ); 20748 } 20749 continue; 20750 } 20751 20752 attached = isAttached( elem ); 20753 20754 // Append to fragment 20755 tmp = getAll( fragment.appendChild( elem ), "script" ); 20756 20757 // Preserve script evaluation history 20758 if ( attached ) { 20759 setGlobalEval( tmp ); 20760 } 20761 20762 // Capture executables 20763 if ( scripts ) { 20764 j = 0; 20765 while ( ( elem = tmp[ j++ ] ) ) { 20766 if ( rscriptType.test( elem.type || "" ) ) { 20767 scripts.push( elem ); 20768 } 20769 } 20770 } 20771 } 20772 20773 return fragment; 20774} 20775 20776 20777var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 20778 20779function returnTrue() { 20780 return true; 20781} 20782 20783function returnFalse() { 20784 return false; 20785} 20786 20787function on( elem, types, selector, data, fn, one ) { 20788 var origFn, type; 20789 20790 // Types can be a map of types/handlers 20791 if ( typeof types === "object" ) { 20792 20793 // ( types-Object, selector, data ) 20794 if ( typeof selector !== "string" ) { 20795 20796 // ( types-Object, data ) 20797 data = data || selector; 20798 selector = undefined; 20799 } 20800 for ( type in types ) { 20801 on( elem, type, selector, data, types[ type ], one ); 20802 } 20803 return elem; 20804 } 20805 20806 if ( data == null && fn == null ) { 20807 20808 // ( types, fn ) 20809 fn = selector; 20810 data = selector = undefined; 20811 } else if ( fn == null ) { 20812 if ( typeof selector === "string" ) { 20813 20814 // ( types, selector, fn ) 20815 fn = data; 20816 data = undefined; 20817 } else { 20818 20819 // ( types, data, fn ) 20820 fn = data; 20821 data = selector; 20822 selector = undefined; 20823 } 20824 } 20825 if ( fn === false ) { 20826 fn = returnFalse; 20827 } else if ( !fn ) { 20828 return elem; 20829 } 20830 20831 if ( one === 1 ) { 20832 origFn = fn; 20833 fn = function( event ) { 20834 20835 // Can use an empty set, since event contains the info 20836 jQuery().off( event ); 20837 return origFn.apply( this, arguments ); 20838 }; 20839 20840 // Use same guid so caller can remove using origFn 20841 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 20842 } 20843 return elem.each( function() { 20844 jQuery.event.add( this, types, fn, data, selector ); 20845 } ); 20846} 20847 20848/* 20849 * Helper functions for managing events -- not part of the public interface. 20850 * Props to Dean Edwards' addEvent library for many of the ideas. 20851 */ 20852jQuery.event = { 20853 20854 global: {}, 20855 20856 add: function( elem, types, handler, data, selector ) { 20857 20858 var handleObjIn, eventHandle, tmp, 20859 events, t, handleObj, 20860 special, handlers, type, namespaces, origType, 20861 elemData = dataPriv.get( elem ); 20862 20863 // Only attach events to objects that accept data 20864 if ( !acceptData( elem ) ) { 20865 return; 20866 } 20867 20868 // Caller can pass in an object of custom data in lieu of the handler 20869 if ( handler.handler ) { 20870 handleObjIn = handler; 20871 handler = handleObjIn.handler; 20872 selector = handleObjIn.selector; 20873 } 20874 20875 // Ensure that invalid selectors throw exceptions at attach time 20876 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 20877 if ( selector ) { 20878 jQuery.find.matchesSelector( documentElement, selector ); 20879 } 20880 20881 // Make sure that the handler has a unique ID, used to find/remove it later 20882 if ( !handler.guid ) { 20883 handler.guid = jQuery.guid++; 20884 } 20885 20886 // Init the element's event structure and main handler, if this is the first 20887 if ( !( events = elemData.events ) ) { 20888 events = elemData.events = Object.create( null ); 20889 } 20890 if ( !( eventHandle = elemData.handle ) ) { 20891 eventHandle = elemData.handle = function( e ) { 20892 20893 // Discard the second event of a jQuery.event.trigger() and 20894 // when an event is called after a page has unloaded 20895 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 20896 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 20897 }; 20898 } 20899 20900 // Handle multiple events separated by a space 20901 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 20902 t = types.length; 20903 while ( t-- ) { 20904 tmp = rtypenamespace.exec( types[ t ] ) || []; 20905 type = origType = tmp[ 1 ]; 20906 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 20907 20908 // There *must* be a type, no attaching namespace-only handlers 20909 if ( !type ) { 20910 continue; 20911 } 20912 20913 // If event changes its type, use the special event handlers for the changed type 20914 special = jQuery.event.special[ type ] || {}; 20915 20916 // If selector defined, determine special event api type, otherwise given type 20917 type = ( selector ? special.delegateType : special.bindType ) || type; 20918 20919 // Update special based on newly reset type 20920 special = jQuery.event.special[ type ] || {}; 20921 20922 // handleObj is passed to all event handlers 20923 handleObj = jQuery.extend( { 20924 type: type, 20925 origType: origType, 20926 data: data, 20927 handler: handler, 20928 guid: handler.guid, 20929 selector: selector, 20930 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 20931 namespace: namespaces.join( "." ) 20932 }, handleObjIn ); 20933 20934 // Init the event handler queue if we're the first 20935 if ( !( handlers = events[ type ] ) ) { 20936 handlers = events[ type ] = []; 20937 handlers.delegateCount = 0; 20938 20939 // Only use addEventListener if the special events handler returns false 20940 if ( !special.setup || 20941 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 20942 20943 if ( elem.addEventListener ) { 20944 elem.addEventListener( type, eventHandle ); 20945 } 20946 } 20947 } 20948 20949 if ( special.add ) { 20950 special.add.call( elem, handleObj ); 20951 20952 if ( !handleObj.handler.guid ) { 20953 handleObj.handler.guid = handler.guid; 20954 } 20955 } 20956 20957 // Add to the element's handler list, delegates in front 20958 if ( selector ) { 20959 handlers.splice( handlers.delegateCount++, 0, handleObj ); 20960 } else { 20961 handlers.push( handleObj ); 20962 } 20963 20964 // Keep track of which events have ever been used, for event optimization 20965 jQuery.event.global[ type ] = true; 20966 } 20967 20968 }, 20969 20970 // Detach an event or set of events from an element 20971 remove: function( elem, types, handler, selector, mappedTypes ) { 20972 20973 var j, origCount, tmp, 20974 events, t, handleObj, 20975 special, handlers, type, namespaces, origType, 20976 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 20977 20978 if ( !elemData || !( events = elemData.events ) ) { 20979 return; 20980 } 20981 20982 // Once for each type.namespace in types; type may be omitted 20983 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 20984 t = types.length; 20985 while ( t-- ) { 20986 tmp = rtypenamespace.exec( types[ t ] ) || []; 20987 type = origType = tmp[ 1 ]; 20988 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 20989 20990 // Unbind all events (on this namespace, if provided) for the element 20991 if ( !type ) { 20992 for ( type in events ) { 20993 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 20994 } 20995 continue; 20996 } 20997 20998 special = jQuery.event.special[ type ] || {}; 20999 type = ( selector ? special.delegateType : special.bindType ) || type; 21000 handlers = events[ type ] || []; 21001 tmp = tmp[ 2 ] && 21002 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 21003 21004 // Remove matching events 21005 origCount = j = handlers.length; 21006 while ( j-- ) { 21007 handleObj = handlers[ j ]; 21008 21009 if ( ( mappedTypes || origType === handleObj.origType ) && 21010 ( !handler || handler.guid === handleObj.guid ) && 21011 ( !tmp || tmp.test( handleObj.namespace ) ) && 21012 ( !selector || selector === handleObj.selector || 21013 selector === "**" && handleObj.selector ) ) { 21014 handlers.splice( j, 1 ); 21015 21016 if ( handleObj.selector ) { 21017 handlers.delegateCount--; 21018 } 21019 if ( special.remove ) { 21020 special.remove.call( elem, handleObj ); 21021 } 21022 } 21023 } 21024 21025 // Remove generic event handler if we removed something and no more handlers exist 21026 // (avoids potential for endless recursion during removal of special event handlers) 21027 if ( origCount && !handlers.length ) { 21028 if ( !special.teardown || 21029 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 21030 21031 jQuery.removeEvent( elem, type, elemData.handle ); 21032 } 21033 21034 delete events[ type ]; 21035 } 21036 } 21037 21038 // Remove data and the expando if it's no longer used 21039 if ( jQuery.isEmptyObject( events ) ) { 21040 dataPriv.remove( elem, "handle events" ); 21041 } 21042 }, 21043 21044 dispatch: function( nativeEvent ) { 21045 21046 var i, j, ret, matched, handleObj, handlerQueue, 21047 args = new Array( arguments.length ), 21048 21049 // Make a writable jQuery.Event from the native event object 21050 event = jQuery.event.fix( nativeEvent ), 21051 21052 handlers = ( 21053 dataPriv.get( this, "events" ) || Object.create( null ) 21054 )[ event.type ] || [], 21055 special = jQuery.event.special[ event.type ] || {}; 21056 21057 // Use the fix-ed jQuery.Event rather than the (read-only) native event 21058 args[ 0 ] = event; 21059 21060 for ( i = 1; i < arguments.length; i++ ) { 21061 args[ i ] = arguments[ i ]; 21062 } 21063 21064 event.delegateTarget = this; 21065 21066 // Call the preDispatch hook for the mapped type, and let it bail if desired 21067 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 21068 return; 21069 } 21070 21071 // Determine handlers 21072 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 21073 21074 // Run delegates first; they may want to stop propagation beneath us 21075 i = 0; 21076 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 21077 event.currentTarget = matched.elem; 21078 21079 j = 0; 21080 while ( ( handleObj = matched.handlers[ j++ ] ) && 21081 !event.isImmediatePropagationStopped() ) { 21082 21083 // If the event is namespaced, then each handler is only invoked if it is 21084 // specially universal or its namespaces are a superset of the event's. 21085 if ( !event.rnamespace || handleObj.namespace === false || 21086 event.rnamespace.test( handleObj.namespace ) ) { 21087 21088 event.handleObj = handleObj; 21089 event.data = handleObj.data; 21090 21091 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 21092 handleObj.handler ).apply( matched.elem, args ); 21093 21094 if ( ret !== undefined ) { 21095 if ( ( event.result = ret ) === false ) { 21096 event.preventDefault(); 21097 event.stopPropagation(); 21098 } 21099 } 21100 } 21101 } 21102 } 21103 21104 // Call the postDispatch hook for the mapped type 21105 if ( special.postDispatch ) { 21106 special.postDispatch.call( this, event ); 21107 } 21108 21109 return event.result; 21110 }, 21111 21112 handlers: function( event, handlers ) { 21113 var i, handleObj, sel, matchedHandlers, matchedSelectors, 21114 handlerQueue = [], 21115 delegateCount = handlers.delegateCount, 21116 cur = event.target; 21117 21118 // Find delegate handlers 21119 if ( delegateCount && 21120 21121 // Support: IE <=9 21122 // Black-hole SVG <use> instance trees (trac-13180) 21123 cur.nodeType && 21124 21125 // Support: Firefox <=42 21126 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 21127 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 21128 // Support: IE 11 only 21129 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 21130 !( event.type === "click" && event.button >= 1 ) ) { 21131 21132 for ( ; cur !== this; cur = cur.parentNode || this ) { 21133 21134 // Don't check non-elements (trac-13208) 21135 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 21136 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 21137 matchedHandlers = []; 21138 matchedSelectors = {}; 21139 for ( i = 0; i < delegateCount; i++ ) { 21140 handleObj = handlers[ i ]; 21141 21142 // Don't conflict with Object.prototype properties (trac-13203) 21143 sel = handleObj.selector + " "; 21144 21145 if ( matchedSelectors[ sel ] === undefined ) { 21146 matchedSelectors[ sel ] = handleObj.needsContext ? 21147 jQuery( sel, this ).index( cur ) > -1 : 21148 jQuery.find( sel, this, null, [ cur ] ).length; 21149 } 21150 if ( matchedSelectors[ sel ] ) { 21151 matchedHandlers.push( handleObj ); 21152 } 21153 } 21154 if ( matchedHandlers.length ) { 21155 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 21156 } 21157 } 21158 } 21159 } 21160 21161 // Add the remaining (directly-bound) handlers 21162 cur = this; 21163 if ( delegateCount < handlers.length ) { 21164 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 21165 } 21166 21167 return handlerQueue; 21168 }, 21169 21170 addProp: function( name, hook ) { 21171 Object.defineProperty( jQuery.Event.prototype, name, { 21172 enumerable: true, 21173 configurable: true, 21174 21175 get: isFunction( hook ) ? 21176 function() { 21177 if ( this.originalEvent ) { 21178 return hook( this.originalEvent ); 21179 } 21180 } : 21181 function() { 21182 if ( this.originalEvent ) { 21183 return this.originalEvent[ name ]; 21184 } 21185 }, 21186 21187 set: function( value ) { 21188 Object.defineProperty( this, name, { 21189 enumerable: true, 21190 configurable: true, 21191 writable: true, 21192 value: value 21193 } ); 21194 } 21195 } ); 21196 }, 21197 21198 fix: function( originalEvent ) { 21199 return originalEvent[ jQuery.expando ] ? 21200 originalEvent : 21201 new jQuery.Event( originalEvent ); 21202 }, 21203 21204 special: { 21205 load: { 21206 21207 // Prevent triggered image.load events from bubbling to window.load 21208 noBubble: true 21209 }, 21210 click: { 21211 21212 // Utilize native event to ensure correct state for checkable inputs 21213 setup: function( data ) { 21214 21215 // For mutual compressibility with _default, replace `this` access with a local var. 21216 // `|| data` is dead code meant only to preserve the variable through minification. 21217 var el = this || data; 21218 21219 // Claim the first handler 21220 if ( rcheckableType.test( el.type ) && 21221 el.click && nodeName( el, "input" ) ) { 21222 21223 // dataPriv.set( el, "click", ... ) 21224 leverageNative( el, "click", true ); 21225 } 21226 21227 // Return false to allow normal processing in the caller 21228 return false; 21229 }, 21230 trigger: function( data ) { 21231 21232 // For mutual compressibility with _default, replace `this` access with a local var. 21233 // `|| data` is dead code meant only to preserve the variable through minification. 21234 var el = this || data; 21235 21236 // Force setup before triggering a click 21237 if ( rcheckableType.test( el.type ) && 21238 el.click && nodeName( el, "input" ) ) { 21239 21240 leverageNative( el, "click" ); 21241 } 21242 21243 // Return non-false to allow normal event-path propagation 21244 return true; 21245 }, 21246 21247 // For cross-browser consistency, suppress native .click() on links 21248 // Also prevent it if we're currently inside a leveraged native-event stack 21249 _default: function( event ) { 21250 var target = event.target; 21251 return rcheckableType.test( target.type ) && 21252 target.click && nodeName( target, "input" ) && 21253 dataPriv.get( target, "click" ) || 21254 nodeName( target, "a" ); 21255 } 21256 }, 21257 21258 beforeunload: { 21259 postDispatch: function( event ) { 21260 21261 // Support: Firefox 20+ 21262 // Firefox doesn't alert if the returnValue field is not set. 21263 if ( event.result !== undefined && event.originalEvent ) { 21264 event.originalEvent.returnValue = event.result; 21265 } 21266 } 21267 } 21268 } 21269}; 21270 21271// Ensure the presence of an event listener that handles manually-triggered 21272// synthetic events by interrupting progress until reinvoked in response to 21273// *native* events that it fires directly, ensuring that state changes have 21274// already occurred before other listeners are invoked. 21275function leverageNative( el, type, isSetup ) { 21276 21277 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 21278 if ( !isSetup ) { 21279 if ( dataPriv.get( el, type ) === undefined ) { 21280 jQuery.event.add( el, type, returnTrue ); 21281 } 21282 return; 21283 } 21284 21285 // Register the controller as a special universal handler for all event namespaces 21286 dataPriv.set( el, type, false ); 21287 jQuery.event.add( el, type, { 21288 namespace: false, 21289 handler: function( event ) { 21290 var result, 21291 saved = dataPriv.get( this, type ); 21292 21293 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 21294 21295 // Interrupt processing of the outer synthetic .trigger()ed event 21296 if ( !saved ) { 21297 21298 // Store arguments for use when handling the inner native event 21299 // There will always be at least one argument (an event object), so this array 21300 // will not be confused with a leftover capture object. 21301 saved = slice.call( arguments ); 21302 dataPriv.set( this, type, saved ); 21303 21304 // Trigger the native event and capture its result 21305 this[ type ](); 21306 result = dataPriv.get( this, type ); 21307 dataPriv.set( this, type, false ); 21308 21309 if ( saved !== result ) { 21310 21311 // Cancel the outer synthetic event 21312 event.stopImmediatePropagation(); 21313 event.preventDefault(); 21314 21315 return result; 21316 } 21317 21318 // If this is an inner synthetic event for an event with a bubbling surrogate 21319 // (focus or blur), assume that the surrogate already propagated from triggering 21320 // the native event and prevent that from happening again here. 21321 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 21322 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 21323 // less bad than duplication. 21324 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 21325 event.stopPropagation(); 21326 } 21327 21328 // If this is a native event triggered above, everything is now in order 21329 // Fire an inner synthetic event with the original arguments 21330 } else if ( saved ) { 21331 21332 // ...and capture the result 21333 dataPriv.set( this, type, jQuery.event.trigger( 21334 saved[ 0 ], 21335 saved.slice( 1 ), 21336 this 21337 ) ); 21338 21339 // Abort handling of the native event by all jQuery handlers while allowing 21340 // native handlers on the same element to run. On target, this is achieved 21341 // by stopping immediate propagation just on the jQuery event. However, 21342 // the native event is re-wrapped by a jQuery one on each level of the 21343 // propagation so the only way to stop it for jQuery is to stop it for 21344 // everyone via native `stopPropagation()`. This is not a problem for 21345 // focus/blur which don't bubble, but it does also stop click on checkboxes 21346 // and radios. We accept this limitation. 21347 event.stopPropagation(); 21348 event.isImmediatePropagationStopped = returnTrue; 21349 } 21350 } 21351 } ); 21352} 21353 21354jQuery.removeEvent = function( elem, type, handle ) { 21355 21356 // This "if" is needed for plain objects 21357 if ( elem.removeEventListener ) { 21358 elem.removeEventListener( type, handle ); 21359 } 21360}; 21361 21362jQuery.Event = function( src, props ) { 21363 21364 // Allow instantiation without the 'new' keyword 21365 if ( !( this instanceof jQuery.Event ) ) { 21366 return new jQuery.Event( src, props ); 21367 } 21368 21369 // Event object 21370 if ( src && src.type ) { 21371 this.originalEvent = src; 21372 this.type = src.type; 21373 21374 // Events bubbling up the document may have been marked as prevented 21375 // by a handler lower down the tree; reflect the correct value. 21376 this.isDefaultPrevented = src.defaultPrevented || 21377 src.defaultPrevented === undefined && 21378 21379 // Support: Android <=2.3 only 21380 src.returnValue === false ? 21381 returnTrue : 21382 returnFalse; 21383 21384 // Create target properties 21385 // Support: Safari <=6 - 7 only 21386 // Target should not be a text node (trac-504, trac-13143) 21387 this.target = ( src.target && src.target.nodeType === 3 ) ? 21388 src.target.parentNode : 21389 src.target; 21390 21391 this.currentTarget = src.currentTarget; 21392 this.relatedTarget = src.relatedTarget; 21393 21394 // Event type 21395 } else { 21396 this.type = src; 21397 } 21398 21399 // Put explicitly provided properties onto the event object 21400 if ( props ) { 21401 jQuery.extend( this, props ); 21402 } 21403 21404 // Create a timestamp if incoming event doesn't have one 21405 this.timeStamp = src && src.timeStamp || Date.now(); 21406 21407 // Mark it as fixed 21408 this[ jQuery.expando ] = true; 21409}; 21410 21411// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 21412// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 21413jQuery.Event.prototype = { 21414 constructor: jQuery.Event, 21415 isDefaultPrevented: returnFalse, 21416 isPropagationStopped: returnFalse, 21417 isImmediatePropagationStopped: returnFalse, 21418 isSimulated: false, 21419 21420 preventDefault: function() { 21421 var e = this.originalEvent; 21422 21423 this.isDefaultPrevented = returnTrue; 21424 21425 if ( e && !this.isSimulated ) { 21426 e.preventDefault(); 21427 } 21428 }, 21429 stopPropagation: function() { 21430 var e = this.originalEvent; 21431 21432 this.isPropagationStopped = returnTrue; 21433 21434 if ( e && !this.isSimulated ) { 21435 e.stopPropagation(); 21436 } 21437 }, 21438 stopImmediatePropagation: function() { 21439 var e = this.originalEvent; 21440 21441 this.isImmediatePropagationStopped = returnTrue; 21442 21443 if ( e && !this.isSimulated ) { 21444 e.stopImmediatePropagation(); 21445 } 21446 21447 this.stopPropagation(); 21448 } 21449}; 21450 21451// Includes all common event props including KeyEvent and MouseEvent specific props 21452jQuery.each( { 21453 altKey: true, 21454 bubbles: true, 21455 cancelable: true, 21456 changedTouches: true, 21457 ctrlKey: true, 21458 detail: true, 21459 eventPhase: true, 21460 metaKey: true, 21461 pageX: true, 21462 pageY: true, 21463 shiftKey: true, 21464 view: true, 21465 "char": true, 21466 code: true, 21467 charCode: true, 21468 key: true, 21469 keyCode: true, 21470 button: true, 21471 buttons: true, 21472 clientX: true, 21473 clientY: true, 21474 offsetX: true, 21475 offsetY: true, 21476 pointerId: true, 21477 pointerType: true, 21478 screenX: true, 21479 screenY: true, 21480 targetTouches: true, 21481 toElement: true, 21482 touches: true, 21483 which: true 21484}, jQuery.event.addProp ); 21485 21486jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 21487 21488 function focusMappedHandler( nativeEvent ) { 21489 if ( document.documentMode ) { 21490 21491 // Support: IE 11+ 21492 // Attach a single focusin/focusout handler on the document while someone wants 21493 // focus/blur. This is because the former are synchronous in IE while the latter 21494 // are async. In other browsers, all those handlers are invoked synchronously. 21495 21496 // `handle` from private data would already wrap the event, but we need 21497 // to change the `type` here. 21498 var handle = dataPriv.get( this, "handle" ), 21499 event = jQuery.event.fix( nativeEvent ); 21500 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 21501 event.isSimulated = true; 21502 21503 // First, handle focusin/focusout 21504 handle( nativeEvent ); 21505 21506 // ...then, handle focus/blur 21507 // 21508 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 21509 // invoking the handler at the lower level. 21510 if ( event.target === event.currentTarget ) { 21511 21512 // The setup part calls `leverageNative`, which, in turn, calls 21513 // `jQuery.event.add`, so event handle will already have been set 21514 // by this point. 21515 handle( event ); 21516 } 21517 } else { 21518 21519 // For non-IE browsers, attach a single capturing handler on the document 21520 // while someone wants focusin/focusout. 21521 jQuery.event.simulate( delegateType, nativeEvent.target, 21522 jQuery.event.fix( nativeEvent ) ); 21523 } 21524 } 21525 21526 jQuery.event.special[ type ] = { 21527 21528 // Utilize native event if possible so blur/focus sequence is correct 21529 setup: function() { 21530 21531 var attaches; 21532 21533 // Claim the first handler 21534 // dataPriv.set( this, "focus", ... ) 21535 // dataPriv.set( this, "blur", ... ) 21536 leverageNative( this, type, true ); 21537 21538 if ( document.documentMode ) { 21539 21540 // Support: IE 9 - 11+ 21541 // We use the same native handler for focusin & focus (and focusout & blur) 21542 // so we need to coordinate setup & teardown parts between those events. 21543 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 21544 attaches = dataPriv.get( this, delegateType ); 21545 if ( !attaches ) { 21546 this.addEventListener( delegateType, focusMappedHandler ); 21547 } 21548 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 21549 } else { 21550 21551 // Return false to allow normal processing in the caller 21552 return false; 21553 } 21554 }, 21555 trigger: function() { 21556 21557 // Force setup before trigger 21558 leverageNative( this, type ); 21559 21560 // Return non-false to allow normal event-path propagation 21561 return true; 21562 }, 21563 21564 teardown: function() { 21565 var attaches; 21566 21567 if ( document.documentMode ) { 21568 attaches = dataPriv.get( this, delegateType ) - 1; 21569 if ( !attaches ) { 21570 this.removeEventListener( delegateType, focusMappedHandler ); 21571 dataPriv.remove( this, delegateType ); 21572 } else { 21573 dataPriv.set( this, delegateType, attaches ); 21574 } 21575 } else { 21576 21577 // Return false to indicate standard teardown should be applied 21578 return false; 21579 } 21580 }, 21581 21582 // Suppress native focus or blur if we're currently inside 21583 // a leveraged native-event stack 21584 _default: function( event ) { 21585 return dataPriv.get( event.target, type ); 21586 }, 21587 21588 delegateType: delegateType 21589 }; 21590 21591 // Support: Firefox <=44 21592 // Firefox doesn't have focus(in | out) events 21593 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 21594 // 21595 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 21596 // focus(in | out) events fire after focus & blur events, 21597 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 21598 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 21599 // 21600 // Support: IE 9 - 11+ 21601 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 21602 // attach a single handler for both events in IE. 21603 jQuery.event.special[ delegateType ] = { 21604 setup: function() { 21605 21606 // Handle: regular nodes (via `this.ownerDocument`), window 21607 // (via `this.document`) & document (via `this`). 21608 var doc = this.ownerDocument || this.document || this, 21609 dataHolder = document.documentMode ? this : doc, 21610 attaches = dataPriv.get( dataHolder, delegateType ); 21611 21612 // Support: IE 9 - 11+ 21613 // We use the same native handler for focusin & focus (and focusout & blur) 21614 // so we need to coordinate setup & teardown parts between those events. 21615 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 21616 if ( !attaches ) { 21617 if ( document.documentMode ) { 21618 this.addEventListener( delegateType, focusMappedHandler ); 21619 } else { 21620 doc.addEventListener( type, focusMappedHandler, true ); 21621 } 21622 } 21623 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 21624 }, 21625 teardown: function() { 21626 var doc = this.ownerDocument || this.document || this, 21627 dataHolder = document.documentMode ? this : doc, 21628 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 21629 21630 if ( !attaches ) { 21631 if ( document.documentMode ) { 21632 this.removeEventListener( delegateType, focusMappedHandler ); 21633 } else { 21634 doc.removeEventListener( type, focusMappedHandler, true ); 21635 } 21636 dataPriv.remove( dataHolder, delegateType ); 21637 } else { 21638 dataPriv.set( dataHolder, delegateType, attaches ); 21639 } 21640 } 21641 }; 21642} ); 21643 21644// Create mouseenter/leave events using mouseover/out and event-time checks 21645// so that event delegation works in jQuery. 21646// Do the same for pointerenter/pointerleave and pointerover/pointerout 21647// 21648// Support: Safari 7 only 21649// Safari sends mouseenter too often; see: 21650// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 21651// for the description of the bug (it existed in older Chrome versions as well). 21652jQuery.each( { 21653 mouseenter: "mouseover", 21654 mouseleave: "mouseout", 21655 pointerenter: "pointerover", 21656 pointerleave: "pointerout" 21657}, function( orig, fix ) { 21658 jQuery.event.special[ orig ] = { 21659 delegateType: fix, 21660 bindType: fix, 21661 21662 handle: function( event ) { 21663 var ret, 21664 target = this, 21665 related = event.relatedTarget, 21666 handleObj = event.handleObj; 21667 21668 // For mouseenter/leave call the handler if related is outside the target. 21669 // NB: No relatedTarget if the mouse left/entered the browser window 21670 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 21671 event.type = handleObj.origType; 21672 ret = handleObj.handler.apply( this, arguments ); 21673 event.type = fix; 21674 } 21675 return ret; 21676 } 21677 }; 21678} ); 21679 21680jQuery.fn.extend( { 21681 21682 on: function( types, selector, data, fn ) { 21683 return on( this, types, selector, data, fn ); 21684 }, 21685 one: function( types, selector, data, fn ) { 21686 return on( this, types, selector, data, fn, 1 ); 21687 }, 21688 off: function( types, selector, fn ) { 21689 var handleObj, type; 21690 if ( types && types.preventDefault && types.handleObj ) { 21691 21692 // ( event ) dispatched jQuery.Event 21693 handleObj = types.handleObj; 21694 jQuery( types.delegateTarget ).off( 21695 handleObj.namespace ? 21696 handleObj.origType + "." + handleObj.namespace : 21697 handleObj.origType, 21698 handleObj.selector, 21699 handleObj.handler 21700 ); 21701 return this; 21702 } 21703 if ( typeof types === "object" ) { 21704 21705 // ( types-object [, selector] ) 21706 for ( type in types ) { 21707 this.off( type, selector, types[ type ] ); 21708 } 21709 return this; 21710 } 21711 if ( selector === false || typeof selector === "function" ) { 21712 21713 // ( types [, fn] ) 21714 fn = selector; 21715 selector = undefined; 21716 } 21717 if ( fn === false ) { 21718 fn = returnFalse; 21719 } 21720 return this.each( function() { 21721 jQuery.event.remove( this, types, fn, selector ); 21722 } ); 21723 } 21724} ); 21725 21726 21727var 21728 21729 // Support: IE <=10 - 11, Edge 12 - 13 only 21730 // In IE/Edge using regex groups here causes severe slowdowns. 21731 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 21732 rnoInnerhtml = /<script|<style|<link/i, 21733 21734 // checked="checked" or checked 21735 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 21736 21737 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 21738 21739// Prefer a tbody over its parent table for containing new rows 21740function manipulationTarget( elem, content ) { 21741 if ( nodeName( elem, "table" ) && 21742 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 21743 21744 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 21745 } 21746 21747 return elem; 21748} 21749 21750// Replace/restore the type attribute of script elements for safe DOM manipulation 21751function disableScript( elem ) { 21752 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 21753 return elem; 21754} 21755function restoreScript( elem ) { 21756 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 21757 elem.type = elem.type.slice( 5 ); 21758 } else { 21759 elem.removeAttribute( "type" ); 21760 } 21761 21762 return elem; 21763} 21764 21765function cloneCopyEvent( src, dest ) { 21766 var i, l, type, pdataOld, udataOld, udataCur, events; 21767 21768 if ( dest.nodeType !== 1 ) { 21769 return; 21770 } 21771 21772 // 1. Copy private data: events, handlers, etc. 21773 if ( dataPriv.hasData( src ) ) { 21774 pdataOld = dataPriv.get( src ); 21775 events = pdataOld.events; 21776 21777 if ( events ) { 21778 dataPriv.remove( dest, "handle events" ); 21779 21780 for ( type in events ) { 21781 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 21782 jQuery.event.add( dest, type, events[ type ][ i ] ); 21783 } 21784 } 21785 } 21786 } 21787 21788 // 2. Copy user data 21789 if ( dataUser.hasData( src ) ) { 21790 udataOld = dataUser.access( src ); 21791 udataCur = jQuery.extend( {}, udataOld ); 21792 21793 dataUser.set( dest, udataCur ); 21794 } 21795} 21796 21797// Fix IE bugs, see support tests 21798function fixInput( src, dest ) { 21799 var nodeName = dest.nodeName.toLowerCase(); 21800 21801 // Fails to persist the checked state of a cloned checkbox or radio button. 21802 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 21803 dest.checked = src.checked; 21804 21805 // Fails to return the selected option to the default selected state when cloning options 21806 } else if ( nodeName === "input" || nodeName === "textarea" ) { 21807 dest.defaultValue = src.defaultValue; 21808 } 21809} 21810 21811function domManip( collection, args, callback, ignored ) { 21812 21813 // Flatten any nested arrays 21814 args = flat( args ); 21815 21816 var fragment, first, scripts, hasScripts, node, doc, 21817 i = 0, 21818 l = collection.length, 21819 iNoClone = l - 1, 21820 value = args[ 0 ], 21821 valueIsFunction = isFunction( value ); 21822 21823 // We can't cloneNode fragments that contain checked, in WebKit 21824 if ( valueIsFunction || 21825 ( l > 1 && typeof value === "string" && 21826 !support.checkClone && rchecked.test( value ) ) ) { 21827 return collection.each( function( index ) { 21828 var self = collection.eq( index ); 21829 if ( valueIsFunction ) { 21830 args[ 0 ] = value.call( this, index, self.html() ); 21831 } 21832 domManip( self, args, callback, ignored ); 21833 } ); 21834 } 21835 21836 if ( l ) { 21837 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 21838 first = fragment.firstChild; 21839 21840 if ( fragment.childNodes.length === 1 ) { 21841 fragment = first; 21842 } 21843 21844 // Require either new content or an interest in ignored elements to invoke the callback 21845 if ( first || ignored ) { 21846 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 21847 hasScripts = scripts.length; 21848 21849 // Use the original fragment for the last item 21850 // instead of the first because it can end up 21851 // being emptied incorrectly in certain situations (trac-8070). 21852 for ( ; i < l; i++ ) { 21853 node = fragment; 21854 21855 if ( i !== iNoClone ) { 21856 node = jQuery.clone( node, true, true ); 21857 21858 // Keep references to cloned scripts for later restoration 21859 if ( hasScripts ) { 21860 21861 // Support: Android <=4.0 only, PhantomJS 1 only 21862 // push.apply(_, arraylike) throws on ancient WebKit 21863 jQuery.merge( scripts, getAll( node, "script" ) ); 21864 } 21865 } 21866 21867 callback.call( collection[ i ], node, i ); 21868 } 21869 21870 if ( hasScripts ) { 21871 doc = scripts[ scripts.length - 1 ].ownerDocument; 21872 21873 // Re
vendor: 2,059 bytes, lines 21873-21945
21873enable scripts 21874 jQuery.map( scripts, restoreScript ); 21875 21876 // Evaluate executable scripts on first document insertion 21877 for ( i = 0; i < hasScripts; i++ ) { 21878 node = scripts[ i ]; 21879 if ( rscriptType.test( node.type || "" ) && 21880 !dataPriv.access( node, "globalEval" ) && 21881 jQuery.contains( doc, node ) ) { 21882 21883 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 21884 21885 // Optional AJAX dependency, but won't run scripts if not present 21886 if ( jQuery._evalUrl && !node.noModule ) { 21887 jQuery._evalUrl( node.src, { 21888 nonce: node.nonce || node.getAttribute( "nonce" ) 21889 }, doc ); 21890 } 21891 } else { 21892 21893 // Unwrap a CDATA section containing script contents. This shouldn't be 21894 // needed as in XML documents they're already not visible when 21895 // inspecting element contents and in HTML documents they have no 21896 // meaning but we're preserving that logic for backwards compatibility. 21897 // This will be removed completely in 4.0. See gh-4904. 21898 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 21899 } 21900 } 21901 } 21902 } 21903 } 21904 } 21905 21906 return collection; 21907} 21908 21909function remove( elem, selector, keepData ) { 21910 var node, 21911 nodes = selector ? jQuery.filter( selector, elem ) : elem, 21912 i = 0; 21913 21914 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 21915 if ( !keepData && node.nodeType === 1 ) { 21916 jQuery.cleanData( getAll( node ) ); 21917 } 21918 21919 if ( node.parentNode ) { 21920 if ( keepData && isAttached( node ) ) { 21921 setGlobalEval( getAll( node, "script" ) ); 21922 } 21923 node.parentNode.removeChild( node ); 21924 } 21925 } 21926 21927 return elem; 21928} 21929 21930jQuery.extend( { 21931 htmlPrefilter: function( html ) { 21932 return html; 21933 }, 21934 21935 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 21936 var i, l, srcElements, destElements, 21937 clone = elem.cloneNode( true ), 21938 inPage = isAttached( elem ); 21939 21940 // Fix IE cloning issues 21941 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 21942 !jQuery.isXMLDoc( elem ) ) { 21943 21944 // We eschew jQuery#find here for performance reasons: 21945 //
vendor: 2,516 bytes, lines 21945-22042
21945 https://jsperf.com/getall-vs-sizzle/2 21946 destElements = getAll( clone ); 21947 srcElements = getAll( elem ); 21948 21949 for ( i = 0, l = srcElements.length; i < l; i++ ) { 21950 fixInput( srcElements[ i ], destElements[ i ] ); 21951 } 21952 } 21953 21954 // Copy the events from the original to the clone 21955 if ( dataAndEvents ) { 21956 if ( deepDataAndEvents ) { 21957 srcElements = srcElements || getAll( elem ); 21958 destElements = destElements || getAll( clone ); 21959 21960 for ( i = 0, l = srcElements.length; i < l; i++ ) { 21961 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 21962 } 21963 } else { 21964 cloneCopyEvent( elem, clone ); 21965 } 21966 } 21967 21968 // Preserve script evaluation history 21969 destElements = getAll( clone, "script" ); 21970 if ( destElements.length > 0 ) { 21971 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 21972 } 21973 21974 // Return the cloned set 21975 return clone; 21976 }, 21977 21978 cleanData: function( elems ) { 21979 var data, elem, type, 21980 special = jQuery.event.special, 21981 i = 0; 21982 21983 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 21984 if ( acceptData( elem ) ) { 21985 if ( ( data = elem[ dataPriv.expando ] ) ) { 21986 if ( data.events ) { 21987 for ( type in data.events ) { 21988 if ( special[ type ] ) { 21989 jQuery.event.remove( elem, type ); 21990 21991 // This is a shortcut to avoid jQuery.event.remove's overhead 21992 } else { 21993 jQuery.removeEvent( elem, type, data.handle ); 21994 } 21995 } 21996 } 21997 21998 // Support: Chrome <=35 - 45+ 21999 // Assign undefined instead of using delete, see Data#remove 22000 elem[ dataPriv.expando ] = undefined; 22001 } 22002 if ( elem[ dataUser.expando ] ) { 22003 22004 // Support: Chrome <=35 - 45+ 22005 // Assign undefined instead of using delete, see Data#remove 22006 elem[ dataUser.expando ] = undefined; 22007 } 22008 } 22009 } 22010 } 22011} ); 22012 22013jQuery.fn.extend( { 22014 detach: function( selector ) { 22015 return remove( this, selector, true ); 22016 }, 22017 22018 remove: function( selector ) { 22019 return remove( this, selector ); 22020 }, 22021 22022 text: function( value ) { 22023 return access( this, function( value ) { 22024 return value === undefined ? 22025 jQuery.text( this ) : 22026 this.empty().each( function() { 22027 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 22028 this.textContent = value; 22029 } 22030 } ); 22031 }, null, value, arguments.length ); 22032 }, 22033 22034 append: function() { 22035 return domManip( this, arguments, function( elem ) { 22036 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 22037 var target = manipulationTarget( this, elem ); 22038 target.appendChild( elem ); 22039 } 22040 } ); 22041 }, 22042
vendor: 7,872 bytes, lines 22043-22330
22043 prepend: function() { 22044 return domManip( this, arguments, function( elem ) { 22045 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 22046 var target = manipulationTarget( this, elem ); 22047 target.insertBefore( elem, target.firstChild ); 22048 } 22049 } ); 22050 }, 22051 22052 before: function() { 22053 return domManip( this, arguments, function( elem ) { 22054 if ( this.parentNode ) { 22055 this.parentNode.insertBefore( elem, this ); 22056 } 22057 } ); 22058 }, 22059 22060 after: function() { 22061 return domManip( this, arguments, function( elem ) { 22062 if ( this.parentNode ) { 22063 this.parentNode.insertBefore( elem, this.nextSibling ); 22064 } 22065 } ); 22066 }, 22067 22068 empty: function() { 22069 var elem, 22070 i = 0; 22071 22072 for ( ; ( elem = this[ i ] ) != null; i++ ) { 22073 if ( elem.nodeType === 1 ) { 22074 22075 // Prevent memory leaks 22076 jQuery.cleanData( getAll( elem, false ) ); 22077 22078 // Remove any remaining nodes 22079 elem.textContent = ""; 22080 } 22081 } 22082 22083 return this; 22084 }, 22085 22086 clone: function( dataAndEvents, deepDataAndEvents ) { 22087 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 22088 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 22089 22090 return this.map( function() { 22091 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 22092 } ); 22093 }, 22094 22095 html: function( value ) { 22096 return access( this, function( value ) { 22097 var elem = this[ 0 ] || {}, 22098 i = 0, 22099 l = this.length; 22100 22101 if ( value === undefined && elem.nodeType === 1 ) { 22102 return elem.innerHTML; 22103 } 22104 22105 // See if we can take a shortcut and just use innerHTML 22106 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 22107 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 22108 22109 value = jQuery.htmlPrefilter( value ); 22110 22111 try { 22112 for ( ; i < l; i++ ) { 22113 elem = this[ i ] || {}; 22114 22115 // Remove element nodes and prevent memory leaks 22116 if ( elem.nodeType === 1 ) { 22117 jQuery.cleanData( getAll( elem, false ) ); 22118 elem.innerHTML = value; 22119 } 22120 } 22121 22122 elem = 0; 22123 22124 // If using innerHTML throws an exception, use the fallback method 22125 } catch ( e ) {} 22126 } 22127 22128 if ( elem ) { 22129 this.empty().append( value ); 22130 } 22131 }, null, value, arguments.length ); 22132 }, 22133 22134 replaceWith: function() { 22135 var ignored = []; 22136 22137 // Make the changes, replacing each non-ignored context element with the new content 22138 return domManip( this, arguments, function( elem ) { 22139 var parent = this.parentNode; 22140 22141 if ( jQuery.inArray( this, ignored ) < 0 ) { 22142 jQuery.cleanData( getAll( this ) ); 22143 if ( parent ) { 22144 parent.replaceChild( elem, this ); 22145 } 22146 } 22147 22148 // Force callback invocation 22149 }, ignored ); 22150 } 22151} ); 22152 22153jQuery.each( { 22154 appendTo: "append", 22155 prependTo: "prepend", 22156 insertBefore: "before", 22157 insertAfter: "after", 22158 replaceAll: "replaceWith" 22159}, function( name, original ) { 22160 jQuery.fn[ name ] = function( selector ) { 22161 var elems, 22162 ret = [], 22163 insert = jQuery( selector ), 22164 last = insert.length - 1, 22165 i = 0; 22166 22167 for ( ; i <= last; i++ ) { 22168 elems = i === last ? this : this.clone( true ); 22169 jQuery( insert[ i ] )[ original ]( elems ); 22170 22171 // Support: Android <=4.0 only, PhantomJS 1 only 22172 // .get() because push.apply(_, arraylike) throws on ancient WebKit 22173 push.apply( ret, elems.get() ); 22174 } 22175 22176 return this.pushStack( ret ); 22177 }; 22178} ); 22179var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 22180 22181var rcustomProp = /^--/; 22182 22183 22184var getStyles = function( elem ) { 22185 22186 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 22187 // IE throws on elements created in popups 22188 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 22189 var view = elem.ownerDocument.defaultView; 22190 22191 if ( !view || !view.opener ) { 22192 view = window; 22193 } 22194 22195 return view.getComputedStyle( elem ); 22196 }; 22197 22198var swap = function( elem, options, callback ) { 22199 var ret, name, 22200 old = {}; 22201 22202 // Remember the old values, and insert the new ones 22203 for ( name in options ) { 22204 old[ name ] = elem.style[ name ]; 22205 elem.style[ name ] = options[ name ]; 22206 } 22207 22208 ret = callback.call( elem ); 22209 22210 // Revert the old values 22211 for ( name in options ) { 22212 elem.style[ name ] = old[ name ]; 22213 } 22214 22215 return ret; 22216}; 22217 22218 22219var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 22220 22221 22222 22223( function() { 22224 22225 // Executing both pixelPosition & boxSizingReliable tests require only one layout 22226 // so they're executed at the same time to save the second computation. 22227 function computeStyleTests() { 22228 22229 // This is a singleton, we need to execute it only once 22230 if ( !div ) { 22231 return; 22232 } 22233 22234 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 22235 "margin-top:1px;padding:0;border:0"; 22236 div.style.cssText = 22237 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 22238 "margin:auto;border:1px;padding:1px;" + 22239 "width:60%;top:1%"; 22240 documentElement.appendChild( container ).appendChild( div ); 22241 22242 var divStyle = window.getComputedStyle( div ); 22243 pixelPositionVal = divStyle.top !== "1%"; 22244 22245 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 22246 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 22247 22248 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 22249 // Some styles come back with percentage values, even though they shouldn't 22250 div.style.right = "60%"; 22251 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 22252 22253 // Support: IE 9 - 11 only 22254 // Detect misreporting of content dimensions for box-sizing:border-box elements 22255 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 22256 22257 // Support: IE 9 only 22258 // Detect overflow:scroll screwiness (gh-3699) 22259 // Support: Chrome <=64 22260 // Don't get tricked when zoom affects offsetWidth (gh-4029) 22261 div.style.position = "absolute"; 22262 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 22263 22264 documentElement.removeChild( container ); 22265 22266 // Nullify the div so it wouldn't be stored in the memory and 22267 // it will also be a sign that checks already performed 22268 div = null; 22269 } 22270 22271 function roundPixelMeasures( measure ) { 22272 return Math.round( parseFloat( measure ) ); 22273 } 22274 22275 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 22276 reliableTrDimensionsVal, reliableMarginLeftVal, 22277 container = document.createElement( "div" ), 22278 div = document.createElement( "div" ); 22279 22280 // Finish early in limited (non-browser) environments 22281 if ( !div.style ) { 22282 return; 22283 } 22284 22285 // Support: IE <=9 - 11 only 22286 // Style of cloned element affects source element cloned (trac-8908) 22287 div.style.backgroundClip = "content-box"; 22288 div.cloneNode( true ).style.backgroundClip = ""; 22289 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 22290 22291 jQuery.extend( support, { 22292 boxSizingReliable: function() { 22293 computeStyleTests(); 22294 return boxSizingReliableVal; 22295 }, 22296 pixelBoxStyles: function() { 22297 computeStyleTests(); 22298 return pixelBoxStylesVal; 22299 }, 22300 pixelPosition: function() { 22301 computeStyleTests(); 22302 return pixelPositionVal; 22303 }, 22304 reliableMarginLeft: function() { 22305 computeStyleTests(); 22306 return reliableMarginLeftVal; 22307 }, 22308 scrollboxSize: function() { 22309 computeStyleTests(); 22310 return scrollboxSizeVal; 22311 }, 22312 22313 // Support: IE 9 - 11+, Edge 15 - 18+ 22314 // IE/Edge misreport `getComputedStyle` of table rows with width/height 22315 // set in CSS while `offset*` properties report correct values. 22316 // Behavior in IE 9 is more subtle than in newer versions & it passes 22317 // some versions of this test; make sure not to make it pass there! 22318 // 22319 // Support: Firefox 70+ 22320 // Only Firefox includes border widths 22321 // in computed dimensions. (gh-4529) 22322 reliableTrDimensions: function() { 22323 var table, tr, trChild, trStyle; 22324 if ( reliableTrDimensionsVal == null ) { 22325 table = document.createElement( "table" ); 22326 tr = document.createElement( "tr" ); 22327 trChild = document.createElement( "div" ); 22328 22329 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 22330 tr.style.cssText = "bo
22330rder:1px solid"; 22331 22332 // Support: Chrome 86+ 22333 // Height set through cssText does not get applied. 22334 // Computed height then comes back as 0. 22335 tr.style.height = "1px"; 22336 trChild.style.height = "9px"; 22337 22338 // Support: Android 8 Chrome 86+ 22339 // In our bodyBackground.html iframe, 22340 // display for all div elements is set to "inline", 22341 // which causes a problem only in Android 8 Chrome 86. 22342 // Ensuring the div is display: block
vendor: 50,104 bytes, lines 22342-24257
22342 22343 // gets around this issue. 22344 trChild.style.display = "block"; 22345 22346 documentElement 22347 .appendChild( table ) 22348 .appendChild( tr ) 22349 .appendChild( trChild ); 22350 22351 trStyle = window.getComputedStyle( tr ); 22352 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 22353 parseInt( trStyle.borderTopWidth, 10 ) + 22354 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 22355 22356 documentElement.removeChild( table ); 22357 } 22358 return reliableTrDimensionsVal; 22359 } 22360 } ); 22361} )(); 22362 22363 22364function curCSS( elem, name, computed ) { 22365 var width, minWidth, maxWidth, ret, 22366 isCustomProp = rcustomProp.test( name ), 22367 22368 // Support: Firefox 51+ 22369 // Retrieving style before computed somehow 22370 // fixes an issue with getting wrong values 22371 // on detached elements 22372 style = elem.style; 22373 22374 computed = computed || getStyles( elem ); 22375 22376 // getPropertyValue is needed for: 22377 // .css('filter') (IE 9 only, trac-12537) 22378 // .css('--customProperty) (gh-3144) 22379 if ( computed ) { 22380 22381 // Support: IE <=9 - 11+ 22382 // IE only supports `"float"` in `getPropertyValue`; in computed styles 22383 // it's only available as `"cssFloat"`. We no longer modify properties 22384 // sent to `.css()` apart from camelCasing, so we need to check both. 22385 // Normally, this would create difference in behavior: if 22386 // `getPropertyValue` returns an empty string, the value returned 22387 // by `.css()` would be `undefined`. This is usually the case for 22388 // disconnected elements. However, in IE even disconnected elements 22389 // with no styles return `"none"` for `getPropertyValue( "float" )` 22390 ret = computed.getPropertyValue( name ) || computed[ name ]; 22391 22392 if ( isCustomProp && ret ) { 22393 22394 // Support: Firefox 105+, Chrome <=105+ 22395 // Spec requires trimming whitespace for custom properties (gh-4926). 22396 // Firefox only trims leading whitespace. Chrome just collapses 22397 // both leading & trailing whitespace to a single space. 22398 // 22399 // Fall back to `undefined` if empty string returned. 22400 // This collapses a missing definition with property defined 22401 // and set to an empty string but there's no standard API 22402 // allowing us to differentiate them without a performance penalty 22403 // and returning `undefined` aligns with older jQuery. 22404 // 22405 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 22406 // as whitespace while CSS does not, but this is not a problem 22407 // because CSS preprocessing replaces them with U+000A LINE FEED 22408 // (which *is* CSS whitespace) 22409 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 22410 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 22411 } 22412 22413 if ( ret === "" && !isAttached( elem ) ) { 22414 ret = jQuery.style( elem, name ); 22415 } 22416 22417 // A tribute to the "awesome hack by Dean Edwards" 22418 // Android Browser returns percentage for some values, 22419 // but width seems to be reliably pixels. 22420 // This is against the CSSOM draft spec: 22421 // https://drafts.csswg.org/cssom/#resolved-values 22422 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 22423 22424 // Remember the original values 22425 width = style.width; 22426 minWidth = style.minWidth; 22427 maxWidth = style.maxWidth; 22428 22429 // Put in the new values to get a computed value out 22430 style.minWidth = style.maxWidth = style.width = ret; 22431 ret = computed.width; 22432 22433 // Revert the changed values 22434 style.width = width; 22435 style.minWidth = minWidth; 22436 style.maxWidth = maxWidth; 22437 } 22438 } 22439 22440 return ret !== undefined ? 22441 22442 // Support: IE <=9 - 11 only 22443 // IE returns zIndex value as an integer. 22444 ret + "" : 22445 ret; 22446} 22447 22448 22449function addGetHookIf( conditionFn, hookFn ) { 22450 22451 // Define the hook, we'll check on the first run if it's really needed. 22452 return { 22453 get: function() { 22454 if ( conditionFn() ) { 22455 22456 // Hook not needed (or it's not possible to use it due 22457 // to missing dependency), remove it. 22458 delete this.get; 22459 return; 22460 } 22461 22462 // Hook needed; redefine it so that the support test is not executed again. 22463 return ( this.get = hookFn ).apply( this, arguments ); 22464 } 22465 }; 22466} 22467 22468 22469var cssPrefixes = [ "Webkit", "Moz", "ms" ], 22470 emptyStyle = document.createElement( "div" ).style, 22471 vendorProps = {}; 22472 22473// Return a vendor-prefixed property or undefined 22474function vendorPropName( name ) { 22475 22476 // Check for vendor prefixed names 22477 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 22478 i = cssPrefixes.length; 22479 22480 while ( i-- ) { 22481 name = cssPrefixes[ i ] + capName; 22482 if ( name in emptyStyle ) { 22483 return name; 22484 } 22485 } 22486} 22487 22488// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 22489function finalPropName( name ) { 22490 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 22491 22492 if ( final ) { 22493 return final; 22494 } 22495 if ( name in emptyStyle ) { 22496 return name; 22497 } 22498 return vendorProps[ name ] = vendorPropName( name ) || name; 22499} 22500 22501 22502var 22503 22504 // Swappable if display is none or starts with table 22505 // except "table", "table-cell", or "table-caption" 22506 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 22507 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 22508 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 22509 cssNormalTransform = { 22510 letterSpacing: "0", 22511 fontWeight: "400" 22512 }; 22513 22514function setPositiveNumber( _elem, value, subtract ) { 22515 22516 // Any relative (+/-) values have already been 22517 // normalized at this point 22518 var matches = rcssNum.exec( value ); 22519 return matches ? 22520 22521 // Guard against undefined "subtract", e.g., when used as in cssHooks 22522 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 22523 value; 22524} 22525 22526function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 22527 var i = dimension === "width" ? 1 : 0, 22528 extra = 0, 22529 delta = 0, 22530 marginDelta = 0; 22531 22532 // Adjustment may not be necessary 22533 if ( box === ( isBorderBox ? "border" : "content" ) ) { 22534 return 0; 22535 } 22536 22537 for ( ; i < 4; i += 2 ) { 22538 22539 // Both box models exclude margin 22540 // Count margin delta separately to only add it after scroll gutter adjustment. 22541 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 22542 if ( box === "margin" ) { 22543 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 22544 } 22545 22546 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 22547 if ( !isBorderBox ) { 22548 22549 // Add padding 22550 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 22551 22552 // For "border" or "margin", add border 22553 if ( box !== "padding" ) { 22554 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 22555 22556 // But still keep track of it otherwise 22557 } else { 22558 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 22559 } 22560 22561 // If we get here with a border-box (content + padding + border), we're seeking "content" or 22562 // "padding" or "margin" 22563 } else { 22564 22565 // For "content", subtract padding 22566 if ( box === "content" ) { 22567 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 22568 } 22569 22570 // For "content" or "padding", subtract border 22571 if ( box !== "margin" ) { 22572 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 22573 } 22574 } 22575 } 22576 22577 // Account for positive content-box scroll gutter when requested by providing computedVal 22578 if ( !isBorderBox && computedVal >= 0 ) { 22579 22580 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 22581 // Assuming integer scroll gutter, subtract the rest and round down 22582 delta += Math.max( 0, Math.ceil( 22583 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 22584 computedVal - 22585 delta - 22586 extra - 22587 0.5 22588 22589 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 22590 // Use an explicit zero to avoid NaN (gh-3964) 22591 ) ) || 0; 22592 } 22593 22594 return delta + marginDelta; 22595} 22596 22597function getWidthOrHeight( elem, dimension, extra ) { 22598 22599 // Start with computed style 22600 var styles = getStyles( elem ), 22601 22602 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 22603 // Fake content-box until we know it's needed to know the true value. 22604 boxSizingNeeded = !support.boxSizingReliable() || extra, 22605 isBorderBox = boxSizingNeeded && 22606 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 22607 valueIsBorderBox = isBorderBox, 22608 22609 val = curCSS( elem, dimension, styles ), 22610 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 22611 22612 // Support: Firefox <=54 22613 // Return a confounding non-pixel value or feign ignorance, as appropriate. 22614 if ( rnumnonpx.test( val ) ) { 22615 if ( !extra ) { 22616 return val; 22617 } 22618 val = "auto"; 22619 } 22620 22621 22622 // Support: IE 9 - 11 only 22623 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 22624 // In those cases, the computed value can be trusted to be border-box. 22625 if ( ( !support.boxSizingReliable() && isBorderBox || 22626 22627 // Support: IE 10 - 11+, Edge 15 - 18+ 22628 // IE/Edge misreport `getComputedStyle` of table rows with width/height 22629 // set in CSS while `offset*` properties report correct values. 22630 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 22631 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 22632 22633 // Fall back to offsetWidth/offsetHeight when value is "auto" 22634 // This happens for inline elements with no explicit setting (gh-3571) 22635 val === "auto" || 22636 22637 // Support: Android <=4.1 - 4.3 only 22638 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 22639 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 22640 22641 // Make sure the element is visible & connected 22642 elem.getClientRects().length ) { 22643 22644 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 22645 22646 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 22647 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 22648 // retrieved value as a content box dimension. 22649 valueIsBorderBox = offsetProp in elem; 22650 if ( valueIsBorderBox ) { 22651 val = elem[ offsetProp ]; 22652 } 22653 } 22654 22655 // Normalize "" and auto 22656 val = parseFloat( val ) || 0; 22657 22658 // Adjust for the element's box model 22659 return ( val + 22660 boxModelAdjustment( 22661 elem, 22662 dimension, 22663 extra || ( isBorderBox ? "border" : "content" ), 22664 valueIsBorderBox, 22665 styles, 22666 22667 // Provide the current computed size to request scroll gutter calculation (gh-3589) 22668 val 22669 ) 22670 ) + "px"; 22671} 22672 22673jQuery.extend( { 22674 22675 // Add in style property hooks for overriding the default 22676 // behavior of getting and setting a style property 22677 cssHooks: { 22678 opacity: { 22679 get: function( elem, computed ) { 22680 if ( computed ) { 22681 22682 // We should always get a number back from opacity 22683 var ret = curCSS( elem, "opacity" ); 22684 return ret === "" ? "1" : ret; 22685 } 22686 } 22687 } 22688 }, 22689 22690 // Don't automatically add "px" to these possibly-unitless properties 22691 cssNumber: { 22692 animationIterationCount: true, 22693 aspectRatio: true, 22694 borderImageSlice: true, 22695 columnCount: true, 22696 flexGrow: true, 22697 flexShrink: true, 22698 fontWeight: true, 22699 gridArea: true, 22700 gridColumn: true, 22701 gridColumnEnd: true, 22702 gridColumnStart: true, 22703 gridRow: true, 22704 gridRowEnd: true, 22705 gridRowStart: true, 22706 lineHeight: true, 22707 opacity: true, 22708 order: true, 22709 orphans: true, 22710 scale: true, 22711 widows: true, 22712 zIndex: true, 22713 zoom: true, 22714 22715 // SVG-related 22716 fillOpacity: true, 22717 floodOpacity: true, 22718 stopOpacity: true, 22719 strokeMiterlimit: true, 22720 strokeOpacity: true 22721 }, 22722 22723 // Add in properties whose names you wish to fix before 22724 // setting or getting the value 22725 cssProps: {}, 22726 22727 // Get and set the style property on a DOM Node 22728 style: function( elem, name, value, extra ) { 22729 22730 // Don't set styles on text and comment nodes 22731 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 22732 return; 22733 } 22734 22735 // Make sure that we're working with the right name 22736 var ret, type, hooks, 22737 origName = camelCase( name ), 22738 isCustomProp = rcustomProp.test( name ), 22739 style = elem.style; 22740 22741 // Make sure that we're working with the right name. We don't 22742 // want to query the value if it is a CSS custom property 22743 // since they are user-defined. 22744 if ( !isCustomProp ) { 22745 name = finalPropName( origName ); 22746 } 22747 22748 // Gets hook for the prefixed version, then unprefixed version 22749 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 22750 22751 // Check if we're setting a value 22752 if ( value !== undefined ) { 22753 type = typeof value; 22754 22755 // Convert "+=" or "-=" to relative numbers (trac-7345) 22756 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 22757 value = adjustCSS( elem, name, ret ); 22758 22759 // Fixes bug trac-9237 22760 type = "number"; 22761 } 22762 22763 // Make sure that null and NaN values aren't set (trac-7116) 22764 if ( value == null || value !== value ) { 22765 return; 22766 } 22767 22768 // If a number was passed in, add the unit (except for certain CSS properties) 22769 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 22770 // "px" to a few hardcoded values. 22771 if ( type === "number" && !isCustomProp ) { 22772 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 22773 } 22774 22775 // background-* props affect original clone's values 22776 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 22777 style[ name ] = "inherit"; 22778 } 22779 22780 // If a hook was provided, use that value, otherwise just set the specified value 22781 if ( !hooks || !( "set" in hooks ) || 22782 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 22783 22784 if ( isCustomProp ) { 22785 style.setProperty( name, value ); 22786 } else { 22787 style[ name ] = value; 22788 } 22789 } 22790 22791 } else { 22792 22793 // If a hook was provided get the non-computed value from there 22794 if ( hooks && "get" in hooks && 22795 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 22796 22797 return ret; 22798 } 22799 22800 // Otherwise just get the value from the style object 22801 return style[ name ]; 22802 } 22803 }, 22804 22805 css: function( elem, name, extra, styles ) { 22806 var val, num, hooks, 22807 origName = camelCase( name ), 22808 isCustomProp = rcustomProp.test( name ); 22809 22810 // Make sure that we're working with the right name. We don't 22811 // want to modify the value if it is a CSS custom property 22812 // since they are user-defined. 22813 if ( !isCustomProp ) { 22814 name = finalPropName( origName ); 22815 } 22816 22817 // Try prefixed name followed by the unprefixed name 22818 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 22819 22820 // If a hook was provided get the computed value from there 22821 if ( hooks && "get" in hooks ) { 22822 val = hooks.get( elem, true, extra ); 22823 } 22824 22825 // Otherwise, if a way to get the computed value exists, use that 22826 if ( val === undefined ) { 22827 val = curCSS( elem, name, styles ); 22828 } 22829 22830 // Convert "normal" to computed value 22831 if ( val === "normal" && name in cssNormalTransform ) { 22832 val = cssNormalTransform[ name ]; 22833 } 22834 22835 // Make numeric if forced or a qualifier was provided and val looks numeric 22836 if ( extra === "" || extra ) { 22837 num = parseFloat( val ); 22838 return extra === true || isFinite( num ) ? num || 0 : val; 22839 } 22840 22841 return val; 22842 } 22843} ); 22844 22845jQuery.each( [ "height", "width" ], function( _i, dimension ) { 22846 jQuery.cssHooks[ dimension ] = { 22847 get: function( elem, computed, extra ) { 22848 if ( computed ) { 22849 22850 // Certain elements can have dimension info if we invisibly show them 22851 // but it must have a current display style that would benefit 22852 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 22853 22854 // Support: Safari 8+ 22855 // Table columns in Safari have non-zero offsetWidth & zero 22856 // getBoundingClientRect().width unless display is changed. 22857 // Support: IE <=11 only 22858 // Running getBoundingClientRect on a disconnected node 22859 // in IE throws an error. 22860 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 22861 swap( elem, cssShow, function() { 22862 return getWidthOrHeight( elem, dimension, extra ); 22863 } ) : 22864 getWidthOrHeight( elem, dimension, extra ); 22865 } 22866 }, 22867 22868 set: function( elem, value, extra ) { 22869 var matches, 22870 styles = getStyles( elem ), 22871 22872 // Only read styles.position if the test has a chance to fail 22873 // to avoid forcing a reflow. 22874 scrollboxSizeBuggy = !support.scrollboxSize() && 22875 styles.position === "absolute", 22876 22877 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 22878 boxSizingNeeded = scrollboxSizeBuggy || extra, 22879 isBorderBox = boxSizingNeeded && 22880 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 22881 subtract = extra ? 22882 boxModelAdjustment( 22883 elem, 22884 dimension, 22885 extra, 22886 isBorderBox, 22887 styles 22888 ) : 22889 0; 22890 22891 // Account for unreliable border-box dimensions by comparing offset* to computed and 22892 // faking a content-box to get border and padding (gh-3699) 22893 if ( isBorderBox && scrollboxSizeBuggy ) { 22894 subtract -= Math.ceil( 22895 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 22896 parseFloat( styles[ dimension ] ) - 22897 boxModelAdjustment( elem, dimension, "border", false, styles ) - 22898 0.5 22899 ); 22900 } 22901 22902 // Convert to pixels if value adjustment is needed 22903 if ( subtract && ( matches = rcssNum.exec( value ) ) && 22904 ( matches[ 3 ] || "px" ) !== "px" ) { 22905 22906 elem.style[ dimension ] = value; 22907 value = jQuery.css( elem, dimension ); 22908 } 22909 22910 return setPositiveNumber( elem, value, subtract ); 22911 } 22912 }; 22913} ); 22914 22915jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 22916 function( elem, computed ) { 22917 if ( computed ) { 22918 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 22919 elem.getBoundingClientRect().left - 22920 swap( elem, { marginLeft: 0 }, function() { 22921 return elem.getBoundingClientRect().left; 22922 } ) 22923 ) + "px"; 22924 } 22925 } 22926); 22927 22928// These hooks are used by animate to expand properties 22929jQuery.each( { 22930 margin: "", 22931 padding: "", 22932 border: "Width" 22933}, function( prefix, suffix ) { 22934 jQuery.cssHooks[ prefix + suffix ] = { 22935 expand: function( value ) { 22936 var i = 0, 22937 expanded = {}, 22938 22939 // Assumes a single number if not a string 22940 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 22941 22942 for ( ; i < 4; i++ ) { 22943 expanded[ prefix + cssExpand[ i ] + suffix ] = 22944 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 22945 } 22946 22947 return expanded; 22948 } 22949 }; 22950 22951 if ( prefix !== "margin" ) { 22952 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 22953 } 22954} ); 22955 22956jQuery.fn.extend( { 22957 css: function( name, value ) { 22958 return access( this, function( elem, name, value ) { 22959 var styles, len, 22960 map = {}, 22961 i = 0; 22962 22963 if ( Array.isArray( name ) ) { 22964 styles = getStyles( elem ); 22965 len = name.length; 22966 22967 for ( ; i < len; i++ ) { 22968 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 22969 } 22970 22971 return map; 22972 } 22973 22974 return value !== undefined ? 22975 jQuery.style( elem, name, value ) : 22976 jQuery.css( elem, name ); 22977 }, name, value, arguments.length > 1 ); 22978 } 22979} ); 22980 22981 22982function Tween( elem, options, prop, end, easing ) { 22983 return new Tween.prototype.init( elem, options, prop, end, easing ); 22984} 22985jQuery.Tween = Tween; 22986 22987Tween.prototype = { 22988 constructor: Tween, 22989 init: function( elem, options, prop, end, easing, unit ) { 22990 this.elem = elem; 22991 this.prop = prop; 22992 this.easing = easing || jQuery.easing._default; 22993 this.options = options; 22994 this.start = this.now = this.cur(); 22995 this.end = end; 22996 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 22997 }, 22998 cur: function() { 22999 var hooks = Tween.propHooks[ this.prop ]; 23000 23001 return hooks && hooks.get ? 23002 hooks.get( this ) : 23003 Tween.propHooks._default.get( this ); 23004 }, 23005 run: function( percent ) { 23006 var eased, 23007 hooks = Tween.propHooks[ this.prop ]; 23008 23009 if ( this.options.duration ) { 23010 this.pos = eased = jQuery.easing[ this.easing ]( 23011 percent, this.options.duration * percent, 0, 1, this.options.duration 23012 ); 23013 } else { 23014 this.pos = eased = percent; 23015 } 23016 this.now = ( this.end - this.start ) * eased + this.start; 23017 23018 if ( this.options.step ) { 23019 this.options.step.call( this.elem, this.now, this ); 23020 } 23021 23022 if ( hooks && hooks.set ) { 23023 hooks.set( this ); 23024 } else { 23025 Tween.propHooks._default.set( this ); 23026 } 23027 return this; 23028 } 23029}; 23030 23031Tween.prototype.init.prototype = Tween.prototype; 23032 23033Tween.propHooks = { 23034 _default: { 23035 get: function( tween ) { 23036 var result; 23037 23038 // Use a property on the element directly when it is not a DOM element, 23039 // or when there is no matching style property that exists. 23040 if ( tween.elem.nodeType !== 1 || 23041 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 23042 return tween.elem[ tween.prop ]; 23043 } 23044 23045 // Passing an empty string as a 3rd parameter to .css will automatically 23046 // attempt a parseFloat and fallback to a string if the parse fails. 23047 // Simple values such as "10px" are parsed to Float; 23048 // complex values such as "rotate(1rad)" are returned as-is. 23049 result = jQuery.css( tween.elem, tween.prop, "" ); 23050 23051 // Empty strings, null, undefined and "auto" are converted to 0. 23052 return !result || result === "auto" ? 0 : result; 23053 }, 23054 set: function( tween ) { 23055 23056 // Use step hook for back compat. 23057 // Use cssHook if its there. 23058 // Use .style if available and use plain properties where available. 23059 if ( jQuery.fx.step[ tween.prop ] ) { 23060 jQuery.fx.step[ tween.prop ]( tween ); 23061 } else if ( tween.elem.nodeType === 1 && ( 23062 jQuery.cssHooks[ tween.prop ] || 23063 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 23064 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 23065 } else { 23066 tween.elem[ tween.prop ] = tween.now; 23067 } 23068 } 23069 } 23070}; 23071 23072// Support: IE <=9 only 23073// Panic based approach to setting things on disconnected nodes 23074Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 23075 set: function( tween ) { 23076 if ( tween.elem.nodeType && tween.elem.parentNode ) { 23077 tween.elem[ tween.prop ] = tween.now; 23078 } 23079 } 23080}; 23081 23082jQuery.easing = { 23083 linear: function( p ) { 23084 return p; 23085 }, 23086 swing: function( p ) { 23087 return 0.5 - Math.cos( p * Math.PI ) / 2; 23088 }, 23089 _default: "swing" 23090}; 23091 23092jQuery.fx = Tween.prototype.init; 23093 23094// Back compat <1.8 extension point 23095jQuery.fx.step = {}; 23096 23097 23098 23099 23100var 23101 fxNow, inProgress, 23102 rfxtypes = /^(?:toggle|show|hide)$/, 23103 rrun = /queueHooks$/; 23104 23105function schedule() { 23106 if ( inProgress ) { 23107 if ( document.hidden === false && window.requestAnimationFrame ) { 23108 window.requestAnimationFrame( schedule ); 23109 } else { 23110 window.setTimeout( schedule, jQuery.fx.interval ); 23111 } 23112 23113 jQuery.fx.tick(); 23114 } 23115} 23116 23117// Animations created synchronously will run synchronously 23118function createFxNow() { 23119 window.setTimeout( function() { 23120 fxNow = undefined; 23121 } ); 23122 return ( fxNow = Date.now() ); 23123} 23124 23125// Generate parameters to create a standard animation 23126function genFx( type, includeWidth ) { 23127 var which, 23128 i = 0, 23129 attrs = { height: type }; 23130 23131 // If we include width, step value is 1 to do all cssExpand values, 23132 // otherwise step value is 2 to skip over Left and Right 23133 includeWidth = includeWidth ? 1 : 0; 23134 for ( ; i < 4; i += 2 - includeWidth ) { 23135 which = cssExpand[ i ]; 23136 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 23137 } 23138 23139 if ( includeWidth ) { 23140 attrs.opacity = attrs.width = type; 23141 } 23142 23143 return attrs; 23144} 23145 23146function createTween( value, prop, animation ) { 23147 var tween, 23148 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 23149 index = 0, 23150 length = collection.length; 23151 for ( ; index < length; index++ ) { 23152 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 23153 23154 // We're done with this property 23155 return tween; 23156 } 23157 } 23158} 23159 23160function defaultPrefilter( elem, props, opts ) { 23161 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 23162 isBox = "width" in props || "height" in props, 23163 anim = this, 23164 orig = {}, 23165 style = elem.style, 23166 hidden = elem.nodeType && isHiddenWithinTree( elem ), 23167 dataShow = dataPriv.get( elem, "fxshow" ); 23168 23169 // Queue-skipping animations hijack the fx hooks 23170 if ( !opts.queue ) { 23171 hooks = jQuery._queueHooks( elem, "fx" ); 23172 if ( hooks.unqueued == null ) { 23173 hooks.unqueued = 0; 23174 oldfire = hooks.empty.fire; 23175 hooks.empty.fire = function() { 23176 if ( !hooks.unqueued ) { 23177 oldfire(); 23178 } 23179 }; 23180 } 23181 hooks.unqueued++; 23182 23183 anim.always( function() { 23184 23185 // Ensure the complete handler is called before this completes 23186 anim.always( function() { 23187 hooks.unqueued--; 23188 if ( !jQuery.queue( elem, "fx" ).length ) { 23189 hooks.empty.fire(); 23190 } 23191 } ); 23192 } ); 23193 } 23194 23195 // Detect show/hide animations 23196 for ( prop in props ) { 23197 value = props[ prop ]; 23198 if ( rfxtypes.test( value ) ) { 23199 delete props[ prop ]; 23200 toggle = toggle || value === "toggle"; 23201 if ( value === ( hidden ? "hide" : "show" ) ) { 23202 23203 // Pretend to be hidden if this is a "show" and 23204 // there is still data from a stopped show/hide 23205 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 23206 hidden = true; 23207 23208 // Ignore all other no-op show/hide data 23209 } else { 23210 continue; 23211 } 23212 } 23213 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 23214 } 23215 } 23216 23217 // Bail out if this is a no-op like .hide().hide() 23218 propTween = !jQuery.isEmptyObject( props ); 23219 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 23220 return; 23221 } 23222 23223 // Restrict "overflow" and "display" styles during box animations 23224 if ( isBox && elem.nodeType === 1 ) { 23225 23226 // Support: IE <=9 - 11, Edge 12 - 15 23227 // Record all 3 overflow attributes because IE does not infer the shorthand 23228 // from identically-valued overflowX and overflowY and Edge just mirrors 23229 // the overflowX value there. 23230 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 23231 23232 // Identify a display type, preferring old show/hide data over the CSS cascade 23233 restoreDisplay = dataShow && dataShow.display; 23234 if ( restoreDisplay == null ) { 23235 restoreDisplay = dataPriv.get( elem, "display" ); 23236 } 23237 display = jQuery.css( elem, "display" ); 23238 if ( display === "none" ) { 23239 if ( restoreDisplay ) { 23240 display = restoreDisplay; 23241 } else { 23242 23243 // Get nonempty value(s) by temporarily forcing visibility 23244 showHide( [ elem ], true ); 23245 restoreDisplay = elem.style.display || restoreDisplay; 23246 display = jQuery.css( elem, "display" ); 23247 showHide( [ elem ] ); 23248 } 23249 } 23250 23251 // Animate inline elements as inline-block 23252 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 23253 if ( jQuery.css( elem, "float" ) === "none" ) { 23254 23255 // Restore the original display value at the end of pure show/hide animations 23256 if ( !propTween ) { 23257 anim.done( function() { 23258 style.display = restoreDisplay; 23259 } ); 23260 if ( restoreDisplay == null ) { 23261 display = style.display; 23262 restoreDisplay = display === "none" ? "" : display; 23263 } 23264 } 23265 style.display = "inline-block"; 23266 } 23267 } 23268 } 23269 23270 if ( opts.overflow ) { 23271 style.overflow = "hidden"; 23272 anim.always( function() { 23273 style.overflow = opts.overflow[ 0 ]; 23274 style.overflowX = opts.overflow[ 1 ]; 23275 style.overflowY = opts.overflow[ 2 ]; 23276 } ); 23277 } 23278 23279 // Implement show/hide animations 23280 propTween = false; 23281 for ( prop in orig ) { 23282 23283 // General show/hide setup for this element animation 23284 if ( !propTween ) { 23285 if ( dataShow ) { 23286 if ( "hidden" in dataShow ) { 23287 hidden = dataShow.hidden; 23288 } 23289 } else { 23290 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 23291 } 23292 23293 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 23294 if ( toggle ) { 23295 dataShow.hidden = !hidden; 23296 } 23297 23298 // Show elements before animating them 23299 if ( hidden ) { 23300 showHide( [ elem ], true ); 23301 } 23302 23303 /* eslint-disable no-loop-func */ 23304 23305 anim.done( function() { 23306 23307 /* eslint-enable no-loop-func */ 23308 23309 // The final step of a "hide" animation is actually hiding the element 23310 if ( !hidden ) { 23311 showHide( [ elem ] ); 23312 } 23313 dataPriv.remove( elem, "fxshow" ); 23314 for ( prop in orig ) { 23315 jQuery.style( elem, prop, orig[ prop ] ); 23316 } 23317 } ); 23318 } 23319 23320 // Per-property setup 23321 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 23322 if ( !( prop in dataShow ) ) { 23323 dataShow[ prop ] = propTween.start; 23324 if ( hidden ) { 23325 propTween.end = propTween.start; 23326 propTween.start = 0; 23327 } 23328 } 23329 } 23330} 23331 23332function propFilter( props, specialEasing ) { 23333 var index, name, easing, value, hooks; 23334 23335 // camelCase, specialEasing and expand cssHook pass 23336 for ( index in props ) { 23337 name = camelCase( index ); 23338 easing = specialEasing[ name ]; 23339 value = props[ index ]; 23340 if ( Array.isArray( value ) ) { 23341 easing = value[ 1 ]; 23342 value = props[ index ] = value[ 0 ]; 23343 } 23344 23345 if ( index !== name ) { 23346 props[ name ] = value; 23347 delete props[ index ]; 23348 } 23349 23350 hooks = jQuery.cssHooks[ name ]; 23351 if ( hooks && "expand" in hooks ) { 23352 value = hooks.expand( value ); 23353 delete props[ name ]; 23354 23355 // Not quite $.extend, this won't overwrite existing keys. 23356 // Reusing 'index' because we have the correct "name" 23357 for ( index in value ) { 23358 if ( !( index in props ) ) { 23359 props[ index ] = value[ index ]; 23360 specialEasing[ index ] = easing; 23361 } 23362 } 23363 } else { 23364 specialEasing[ name ] = easing; 23365 } 23366 } 23367} 23368 23369function Animation( elem, properties, options ) { 23370 var result, 23371 stopped, 23372 index = 0, 23373 length = Animation.prefilters.length, 23374 deferred = jQuery.Deferred().always( function() { 23375 23376 // Don't match elem in the :animated selector 23377 delete tick.elem; 23378 } ), 23379 tick = function() { 23380 if ( stopped ) { 23381 return false; 23382 } 23383 var currentTime = fxNow || createFxNow(), 23384 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 23385 23386 // Support: Android 2.3 only 23387 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 23388 temp = remaining / animation.duration || 0, 23389 percent = 1 - temp, 23390 index = 0, 23391 length = animation.tweens.length; 23392 23393 for ( ; index < length; index++ ) { 23394 animation.tweens[ index ].run( percent ); 23395 } 23396 23397 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 23398 23399 // If there's more to do, yield 23400 if ( percent < 1 && length ) { 23401 return remaining; 23402 } 23403 23404 // If this was an empty animation, synthesize a final progress notification 23405 if ( !length ) { 23406 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 23407 } 23408 23409 // Resolve the animation and report its conclusion 23410 deferred.resolveWith( elem, [ animation ] ); 23411 return false; 23412 }, 23413 animation = deferred.promise( { 23414 elem: elem, 23415 props: jQuery.extend( {}, properties ), 23416 opts: jQuery.extend( true, { 23417 specialEasing: {}, 23418 easing: jQuery.easing._default 23419 }, options ), 23420 originalProperties: properties, 23421 originalOptions: options, 23422 startTime: fxNow || createFxNow(), 23423 duration: options.duration, 23424 tweens: [], 23425 createTween: function( prop, end ) { 23426 var tween = jQuery.Tween( elem, animation.opts, prop, end, 23427 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 23428 animation.tweens.push( tween ); 23429 return tween; 23430 }, 23431 stop: function( gotoEnd ) { 23432 var index = 0, 23433 23434 // If we are going to the end, we want to run all the tweens 23435 // otherwise we skip this part 23436 length = gotoEnd ? animation.tweens.length : 0; 23437 if ( stopped ) { 23438 return this; 23439 } 23440 stopped = true; 23441 for ( ; index < length; index++ ) { 23442 animation.tweens[ index ].run( 1 ); 23443 } 23444 23445 // Resolve when we played the last frame; otherwise, reject 23446 if ( gotoEnd ) { 23447 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 23448 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 23449 } else { 23450 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 23451 } 23452 return this; 23453 } 23454 } ), 23455 props = animation.props; 23456 23457 propFilter( props, animation.opts.specialEasing ); 23458 23459 for ( ; index < length; index++ ) { 23460 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 23461 if ( result ) { 23462 if ( isFunction( result.stop ) ) { 23463 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 23464 result.stop.bind( result ); 23465 } 23466 return result; 23467 } 23468 } 23469 23470 jQuery.map( props, createTween, animation ); 23471 23472 if ( isFunction( animation.opts.start ) ) { 23473 animation.opts.start.call( elem, animation ); 23474 } 23475 23476 // Attach callbacks from options 23477 animation 23478 .progress( animation.opts.progress ) 23479 .done( animation.opts.done, animation.opts.complete ) 23480 .fail( animation.opts.fail ) 23481 .always( animation.opts.always ); 23482 23483 jQuery.fx.timer( 23484 jQuery.extend( tick, { 23485 elem: elem, 23486 anim: animation, 23487 queue: animation.opts.queue 23488 } ) 23489 ); 23490 23491 return animation; 23492} 23493 23494jQuery.Animation = jQuery.extend( Animation, { 23495 23496 tweeners: { 23497 "*": [ function( prop, value ) { 23498 var tween = this.createTween( prop, value ); 23499 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 23500 return tween; 23501 } ] 23502 }, 23503 23504 tweener: function( props, callback ) { 23505 if ( isFunction( props ) ) { 23506 callback = props; 23507 props = [ "*" ]; 23508 } else { 23509 props = props.match( rnothtmlwhite ); 23510 } 23511 23512 var prop, 23513 index = 0, 23514 length = props.length; 23515 23516 for ( ; index < length; index++ ) { 23517 prop = props[ index ]; 23518 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 23519 Animation.tweeners[ prop ].unshift( callback ); 23520 } 23521 }, 23522 23523 prefilters: [ defaultPrefilter ], 23524 23525 prefilter: function( callback, prepend ) { 23526 if ( prepend ) { 23527 Animation.prefilters.unshift( callback ); 23528 } else { 23529 Animation.prefilters.push( callback ); 23530 } 23531 } 23532} ); 23533 23534jQuery.speed = function( speed, easing, fn ) { 23535 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 23536 complete: fn || !fn && easing || 23537 isFunction( speed ) && speed, 23538 duration: speed, 23539 easing: fn && easing || easing && !isFunction( easing ) && easing 23540 }; 23541 23542 // Go to the end state if fx are off 23543 if ( jQuery.fx.off ) { 23544 opt.duration = 0; 23545 23546 } else { 23547 if ( typeof opt.duration !== "number" ) { 23548 if ( opt.duration in jQuery.fx.speeds ) { 23549 opt.duration = jQuery.fx.speeds[ opt.duration ]; 23550 23551 } else { 23552 opt.duration = jQuery.fx.speeds._default; 23553 } 23554 } 23555 } 23556 23557 // Normalize opt.queue - true/undefined/null -> "fx" 23558 if ( opt.queue == null || opt.queue === true ) { 23559 opt.queue = "fx"; 23560 } 23561 23562 // Queueing 23563 opt.old = opt.complete; 23564 23565 opt.complete = function() { 23566 if ( isFunction( opt.old ) ) { 23567 opt.old.call( this ); 23568 } 23569 23570 if ( opt.queue ) { 23571 jQuery.dequeue( this, opt.queue ); 23572 } 23573 }; 23574 23575 return opt; 23576}; 23577 23578jQuery.fn.extend( { 23579 fadeTo: function( speed, to, easing, callback ) { 23580 23581 // Show any hidden elements after setting opacity to 0 23582 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 23583 23584 // Animate to the value specified 23585 .end().animate( { opacity: to }, speed, easing, callback ); 23586 }, 23587 animate: function( prop, speed, easing, callback ) { 23588 var empty = jQuery.isEmptyObject( prop ), 23589 optall = jQuery.speed( speed, easing, callback ), 23590 doAnimation = function() { 23591 23592 // Operate on a copy of prop so per-property easing won't be lost 23593 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 23594 23595 // Empty animations, or finishing resolves immediately 23596 if ( empty || dataPriv.get( this, "finish" ) ) { 23597 anim.stop( true ); 23598 } 23599 }; 23600 23601 doAnimation.finish = doAnimation; 23602 23603 return empty || optall.queue === false ? 23604 this.each( doAnimation ) : 23605 this.queue( optall.queue, doAnimation ); 23606 }, 23607 stop: function( type, clearQueue, gotoEnd ) { 23608 var stopQueue = function( hooks ) { 23609 var stop = hooks.stop; 23610 delete hooks.stop; 23611 stop( gotoEnd ); 23612 }; 23613 23614 if ( typeof type !== "string" ) { 23615 gotoEnd = clearQueue; 23616 clearQueue = type; 23617 type = undefined; 23618 } 23619 if ( clearQueue ) { 23620 this.queue( type || "fx", [] ); 23621 } 23622 23623 return this.each( function() { 23624 var dequeue = true, 23625 index = type != null && type + "queueHooks", 23626 timers = jQuery.timers, 23627 data = dataPriv.get( this ); 23628 23629 if ( index ) { 23630 if ( data[ index ] && data[ index ].stop ) { 23631 stopQueue( data[ index ] ); 23632 } 23633 } else { 23634 for ( index in data ) { 23635 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 23636 stopQueue( data[ index ] ); 23637 } 23638 } 23639 } 23640 23641 for ( index = timers.length; index--; ) { 23642 if ( timers[ index ].elem === this && 23643 ( type == null || timers[ index ].queue === type ) ) { 23644 23645 timers[ index ].anim.stop( gotoEnd ); 23646 dequeue = false; 23647 timers.splice( index, 1 ); 23648 } 23649 } 23650 23651 // Start the next in the queue if the last step wasn't forced. 23652 // Timers currently will call their complete callbacks, which 23653 // will dequeue but only if they were gotoEnd. 23654 if ( dequeue || !gotoEnd ) { 23655 jQuery.dequeue( this, type ); 23656 } 23657 } ); 23658 }, 23659 finish: function( type ) { 23660 if ( type !== false ) { 23661 type = type || "fx"; 23662 } 23663 return this.each( function() { 23664 var index, 23665 data = dataPriv.get( this ), 23666 queue = data[ type + "queue" ], 23667 hooks = data[ type + "queueHooks" ], 23668 timers = jQuery.timers, 23669 length = queue ? queue.length : 0; 23670 23671 // Enable finishing flag on private data 23672 data.finish = true; 23673 23674 // Empty the queue first 23675 jQuery.queue( this, type, [] ); 23676 23677 if ( hooks && hooks.stop ) { 23678 hooks.stop.call( this, true ); 23679 } 23680 23681 // Look for any active animations, and finish them 23682 for ( index = timers.length; index--; ) { 23683 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 23684 timers[ index ].anim.stop( true ); 23685 timers.splice( index, 1 ); 23686 } 23687 } 23688 23689 // Look for any animations in the old queue and finish them 23690 for ( index = 0; index < length; index++ ) { 23691 if ( queue[ index ] && queue[ index ].finish ) { 23692 queue[ index ].finish.call( this ); 23693 } 23694 } 23695 23696 // Turn off finishing flag 23697 delete data.finish; 23698 } ); 23699 } 23700} ); 23701 23702jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 23703 var cssFn = jQuery.fn[ name ]; 23704 jQuery.fn[ name ] = function( speed, easing, callback ) { 23705 return speed == null || typeof speed === "boolean" ? 23706 cssFn.apply( this, arguments ) : 23707 this.animate( genFx( name, true ), speed, easing, callback ); 23708 }; 23709} ); 23710 23711// Generate shortcuts for custom animations 23712jQuery.each( { 23713 slideDown: genFx( "show" ), 23714 slideUp: genFx( "hide" ), 23715 slideToggle: genFx( "toggle" ), 23716 fadeIn: { opacity: "show" }, 23717 fadeOut: { opacity: "hide" }, 23718 fadeToggle: { opacity: "toggle" } 23719}, function( name, props ) { 23720 jQuery.fn[ name ] = function( speed, easing, callback ) { 23721 return this.animate( props, speed, easing, callback ); 23722 }; 23723} ); 23724 23725jQuery.timers = []; 23726jQuery.fx.tick = function() { 23727 var timer, 23728 i = 0, 23729 timers = jQuery.timers; 23730 23731 fxNow = Date.now(); 23732 23733 for ( ; i < timers.length; i++ ) { 23734 timer = timers[ i ]; 23735 23736 // Run the timer and safely remove it when done (allowing for external removal) 23737 if ( !timer() && timers[ i ] === timer ) { 23738 timers.splice( i--, 1 ); 23739 } 23740 } 23741 23742 if ( !timers.length ) { 23743 jQuery.fx.stop(); 23744 } 23745 fxNow = undefined; 23746}; 23747 23748jQuery.fx.timer = function( timer ) { 23749 jQuery.timers.push( timer ); 23750 jQuery.fx.start(); 23751}; 23752 23753jQuery.fx.interval = 13; 23754jQuery.fx.start = function() { 23755 if ( inProgress ) { 23756 return; 23757 } 23758 23759 inProgress = true; 23760 schedule(); 23761}; 23762 23763jQuery.fx.stop = function() { 23764 inProgress = null; 23765}; 23766 23767jQuery.fx.speeds = { 23768 slow: 600, 23769 fast: 200, 23770 23771 // Default speed 23772 _default: 400 23773}; 23774 23775 23776// Based off of the plugin by Clint Helfers, with permission. 23777jQuery.fn.delay = function( time, type ) { 23778 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 23779 type = type || "fx"; 23780 23781 return this.queue( type, function( next, hooks ) { 23782 var timeout = window.setTimeout( next, time ); 23783 hooks.stop = function() { 23784 window.clearTimeout( timeout ); 23785 }; 23786 } ); 23787}; 23788 23789 23790( function() { 23791 var input = document.createElement( "input" ), 23792 select = document.createElement( "select" ), 23793 opt = select.appendChild( document.createElement( "option" ) ); 23794 23795 input.type = "checkbox"; 23796 23797 // Support: Android <=4.3 only 23798 // Default value for a checkbox should be "on" 23799 support.checkOn = input.value !== ""; 23800 23801 // Support: IE <=11 only 23802 // Must access selectedIndex to make default options select 23803 support.optSelected = opt.selected; 23804 23805 // Support: IE <=11 only 23806 // An input loses its value after becoming a radio 23807 input = document.createElement( "input" ); 23808 input.value = "t"; 23809 input.type = "radio"; 23810 support.radioValue = input.value === "t"; 23811} )(); 23812 23813 23814var boolHook, 23815 attrHandle = jQuery.expr.attrHandle; 23816 23817jQuery.fn.extend( { 23818 attr: function( name, value ) { 23819 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 23820 }, 23821 23822 removeAttr: function( name ) { 23823 return this.each( function() { 23824 jQuery.removeAttr( this, name ); 23825 } ); 23826 } 23827} ); 23828 23829jQuery.extend( { 23830 attr: function( elem, name, value ) { 23831 var ret, hooks, 23832 nType = elem.nodeType; 23833 23834 // Don't get/set attributes on text, comment and attribute nodes 23835 if ( nType === 3 || nType === 8 || nType === 2 ) { 23836 return; 23837 } 23838 23839 // Fallback to prop when attributes are not supported 23840 if ( typeof elem.getAttribute === "undefined" ) { 23841 return jQuery.prop( elem, name, value ); 23842 } 23843 23844 // Attribute hooks are determined by the lowercase version 23845 // Grab necessary hook if one is defined 23846 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 23847 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 23848 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 23849 } 23850 23851 if ( value !== undefined ) { 23852 if ( value === null ) { 23853 jQuery.removeAttr( elem, name ); 23854 return; 23855 } 23856 23857 if ( hooks && "set" in hooks && 23858 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 23859 return ret; 23860 } 23861 23862 elem.setAttribute( name, value + "" ); 23863 return value; 23864 } 23865 23866 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 23867 return ret; 23868 } 23869 23870 ret = jQuery.find.attr( elem, name ); 23871 23872 // Non-existent attributes return null, we normalize to undefined 23873 return ret == null ? undefined : ret; 23874 }, 23875 23876 attrHooks: { 23877 type: { 23878 set: function( elem, value ) { 23879 if ( !support.radioValue && value === "radio" && 23880 nodeName( elem, "input" ) ) { 23881 var val = elem.value; 23882 elem.setAttribute( "type", value ); 23883 if ( val ) { 23884 elem.value = val; 23885 } 23886 return value; 23887 } 23888 } 23889 } 23890 }, 23891 23892 removeAttr: function( elem, value ) { 23893 var name, 23894 i = 0, 23895 23896 // Attribute names can contain non-HTML whitespace characters 23897 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 23898 attrNames = value && value.match( rnothtmlwhite ); 23899 23900 if ( attrNames && elem.nodeType === 1 ) { 23901 while ( ( name = attrNames[ i++ ] ) ) { 23902 elem.removeAttribute( name ); 23903 } 23904 } 23905 } 23906} ); 23907 23908// Hooks for boolean attributes 23909boolHook = { 23910 set: function( elem, value, name ) { 23911 if ( value === false ) { 23912 23913 // Remove boolean attributes when set to false 23914 jQuery.removeAttr( elem, name ); 23915 } else { 23916 elem.setAttribute( name, name ); 23917 } 23918 return name; 23919 } 23920}; 23921 23922jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 23923 var getter = attrHandle[ name ] || jQuery.find.attr; 23924 23925 attrHandle[ name ] = function( elem, name, isXML ) { 23926 var ret, handle, 23927 lowercaseName = name.toLowerCase(); 23928 23929 if ( !isXML ) { 23930 23931 // Avoid an infinite loop by temporarily removing this function from the getter 23932 handle = attrHandle[ lowercaseName ]; 23933 attrHandle[ lowercaseName ] = ret; 23934 ret = getter( elem, name, isXML ) != null ? 23935 lowercaseName : 23936 null; 23937 attrHandle[ lowercaseName ] = handle; 23938 } 23939 return ret; 23940 }; 23941} ); 23942 23943 23944 23945 23946var rfocusable = /^(?:input|select|textarea|button)$/i, 23947 rclickable = /^(?:a|area)$/i; 23948 23949jQuery.fn.extend( { 23950 prop: function( name, value ) { 23951 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 23952 }, 23953 23954 removeProp: function( name ) { 23955 return this.each( function() { 23956 delete this[ jQuery.propFix[ name ] || name ]; 23957 } ); 23958 } 23959} ); 23960 23961jQuery.extend( { 23962 prop: function( elem, name, value ) { 23963 var ret, hooks, 23964 nType = elem.nodeType; 23965 23966 // Don't get/set properties on text, comment and attribute nodes 23967 if ( nType === 3 || nType === 8 || nType === 2 ) { 23968 return; 23969 } 23970 23971 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 23972 23973 // Fix name and attach hooks 23974 name = jQuery.propFix[ name ] || name; 23975 hooks = jQuery.propHooks[ name ]; 23976 } 23977 23978 if ( value !== undefined ) { 23979 if ( hooks && "set" in hooks && 23980 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 23981 return ret; 23982 } 23983 23984 return ( elem[ name ] = value ); 23985 } 23986 23987 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 23988 return ret; 23989 } 23990 23991 return elem[ name ]; 23992 }, 23993 23994 propHooks: { 23995 tabIndex: { 23996 get: function( elem ) { 23997 23998 // Support: IE <=9 - 11 only 23999 // elem.tabIndex doesn't always return the 24000 // correct value when it hasn't been explicitly set 24001 // Use proper attribute retrieval (trac-12072) 24002 var tabindex = jQuery.find.attr( elem, "tabindex" ); 24003 24004 if ( tabindex ) { 24005 return parseInt( tabindex, 10 ); 24006 } 24007 24008 if ( 24009 rfocusable.test( elem.nodeName ) || 24010 rclickable.test( elem.nodeName ) && 24011 elem.href 24012 ) { 24013 return 0; 24014 } 24015 24016 return -1; 24017 } 24018 } 24019 }, 24020 24021 propFix: { 24022 "for": "htmlFor", 24023 "class": "className" 24024 } 24025} ); 24026 24027// Support: IE <=11 only 24028// Accessing the selectedIndex property 24029// forces the browser to respect setting selected 24030// on the option 24031// The getter ensures a default option is selected 24032// when in an optgroup 24033// eslint rule "no-unused-expressions" is disabled for this code 24034// since it considers such accessions noop 24035if ( !support.optSelected ) { 24036 jQuery.propHooks.selected = { 24037 get: function( elem ) { 24038 24039 /* eslint no-unused-expressions: "off" */ 24040 24041 var parent = elem.parentNode; 24042 if ( parent && parent.parentNode ) { 24043 parent.parentNode.selectedIndex; 24044 } 24045 return null; 24046 }, 24047 set: function( elem ) { 24048 24049 /* eslint no-unused-expressions: "off" */ 24050 24051 var parent = elem.parentNode; 24052 if ( parent ) { 24053 parent.selectedIndex; 24054 24055 if ( parent.parentNode ) { 24056 parent.parentNode.selectedIndex; 24057 } 24058 } 24059 } 24060 }; 24061} 24062 24063jQuery.each( [ 24064 "tabIndex", 24065 "readOnly", 24066 "maxLength", 24067 "cellSpacing", 24068 "cellPadding", 24069 "rowSpan", 24070 "colSpan", 24071 "useMap", 24072 "frameBorder", 24073 "contentEditable" 24074], function() { 24075 jQuery.propFix[ this.toLowerCase() ] = this; 24076} ); 24077 24078 24079 24080 24081 // Strip and collapse whitespace according to HTML spec 24082 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 24083 function stripAndCollapse( value ) { 24084 var tokens = value.match( rnothtmlwhite ) || []; 24085 return tokens.join( " " ); 24086 } 24087 24088 24089function getClass( elem ) { 24090 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 24091} 24092 24093function classesToArray( value ) { 24094 if ( Array.isArray( value ) ) { 24095 return value; 24096 } 24097 if ( typeof value === "string" ) { 24098 return value.match( rnothtmlwhite ) || []; 24099 } 24100 return []; 24101} 24102 24103jQuery.fn.extend( { 24104 addClass: function( value ) { 24105 var classNames, cur, curValue, className, i, finalValue; 24106 24107 if ( isFunction( value ) ) { 24108 return this.each( function( j ) { 24109 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 24110 } ); 24111 } 24112 24113 classNames = classesToArray( value ); 24114 24115 if ( classNames.length ) { 24116 return this.each( function() { 24117 curValue = getClass( this ); 24118 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 24119 24120 if ( cur ) { 24121 for ( i = 0; i < classNames.length; i++ ) { 24122 className = classNames[ i ]; 24123 if ( cur.indexOf( " " + className + " " ) < 0 ) { 24124 cur += className + " "; 24125 } 24126 } 24127 24128 // Only assign if different to avoid unneeded rendering. 24129 finalValue = stripAndCollapse( cur ); 24130 if ( curValue !== finalValue ) { 24131 this.setAttribute( "class", finalValue ); 24132 } 24133 } 24134 } ); 24135 } 24136 24137 return this; 24138 }, 24139 24140 removeClass: function( value ) { 24141 var classNames, cur, curValue, className, i, finalValue; 24142 24143 if ( isFunction( value ) ) { 24144 return this.each( function( j ) { 24145 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 24146 } ); 24147 } 24148 24149 if ( !arguments.length ) { 24150 return this.attr( "class", "" ); 24151 } 24152 24153 classNames = classesToArray( value ); 24154 24155 if ( classNames.length ) { 24156 return this.each( function() { 24157 curValue = getClass( this ); 24158 24159 // This expression is here for better compressibility (see addClass) 24160 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 24161 24162 if ( cur ) { 24163 for ( i = 0; i < classNames.length; i++ ) { 24164 className = classNames[ i ]; 24165 24166 // Remove *all* instances 24167 while ( cur.indexOf( " " + className + " " ) > -1 ) { 24168 cur = cur.replace( " " + className + " ", " " ); 24169 } 24170 } 24171 24172 // Only assign if different to avoid unneeded rendering. 24173 finalValue = stripAndCollapse( cur ); 24174 if ( curValue !== finalValue ) { 24175 this.setAttribute( "class", finalValue ); 24176 } 24177 } 24178 } ); 24179 } 24180 24181 return this; 24182 }, 24183 24184 toggleClass: function( value, stateVal ) { 24185 var classNames, className, i, self, 24186 type = typeof value, 24187 isValidValue = type === "string" || Array.isArray( value ); 24188 24189 if ( isFunction( value ) ) { 24190 return this.each( function( i ) { 24191 jQuery( this ).toggleClass( 24192 value.call( this, i, getClass( this ), stateVal ), 24193 stateVal 24194 ); 24195 } ); 24196 } 24197 24198 if ( typeof stateVal === "boolean" && isValidValue ) { 24199 return stateVal ? this.addClass( value ) : this.removeClass( value ); 24200 } 24201 24202 classNames = classesToArray( value ); 24203 24204 return this.each( function() { 24205 if ( isValidValue ) { 24206 24207 // Toggle individual class names 24208 self = jQuery( this ); 24209 24210 for ( i = 0; i < classNames.length; i++ ) { 24211 className = classNames[ i ]; 24212 24213 // Check each className given, space separated list 24214 if ( self.hasClass( className ) ) { 24215 self.removeClass( className ); 24216 } else { 24217 self.addClass( className ); 24218 } 24219 } 24220 24221 // Toggle whole class name 24222 } else if ( value === undefined || type === "boolean" ) { 24223 className = getClass( this ); 24224 if ( className ) { 24225 24226 // Store className if set 24227 dataPriv.set( this, "__className__", className ); 24228 } 24229 24230 // If the element has a class name or if we're passed `false`, 24231 // then remove the whole classname (if there was one, the above saved it). 24232 // Otherwise bring back whatever was previously saved (if anything), 24233 // falling back to the empty string if nothing was stored. 24234 if ( this.setAttribute ) { 24235 this.setAttribute( "class", 24236 className || value === false ? 24237 "" : 24238 dataPriv.get( this, "__className__" ) || "" 24239 ); 24240 } 24241 } 24242 } ); 24243 }, 24244 24245 hasClass: function( selector ) { 24246 var className, elem, 24247 i = 0; 24248 24249 className = " " + selector + " "; 24250 while ( ( elem = this[ i++ ] ) ) { 24251 if ( elem.nodeType === 1 && 24252 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 24253 return true; 24254 } 24255 } 24256 24257 return false;
vendor: 1,385 bytes, lines 24258-24327
24258 } 24259} ); 24260 24261 24262 24263 24264var rreturn = /\r/g; 24265 24266jQuery.fn.extend( { 24267 val: function( value ) { 24268 var hooks, ret, valueIsFunction, 24269 elem = this[ 0 ]; 24270 24271 if ( !arguments.length ) { 24272 if ( elem ) { 24273 hooks = jQuery.valHooks[ elem.type ] || 24274 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 24275 24276 if ( hooks && 24277 "get" in hooks && 24278 ( ret = hooks.get( elem, "value" ) ) !== undefined 24279 ) { 24280 return ret; 24281 } 24282 24283 ret = elem.value; 24284 24285 // Handle most common string cases 24286 if ( typeof ret === "string" ) { 24287 return ret.replace( rreturn, "" ); 24288 } 24289 24290 // Handle cases where value is null/undef or number 24291 return ret == null ? "" : ret; 24292 } 24293 24294 return; 24295 } 24296 24297 valueIsFunction = isFunction( value ); 24298 24299 return this.each( function( i ) { 24300 var val; 24301 24302 if ( this.nodeType !== 1 ) { 24303 return; 24304 } 24305 24306 if ( valueIsFunction ) { 24307 val = value.call( this, i, jQuery( this ).val() ); 24308 } else { 24309 val = value; 24310 } 24311 24312 // Treat null/undefined as ""; convert numbers to string 24313 if ( val == null ) { 24314 val = ""; 24315 24316 } else if ( typeof val === "number" ) { 24317 val += ""; 24318 24319 } else if ( Array.isArray( val ) ) { 24320 val = jQuery.map( val, function( value ) { 24321 return value == null ? "" : value + ""; 24322 } ); 24323 } 24324 24325 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 24326 24327 // If set returns undefined, fall back to normal setting
vendor: 43,419 bytes, lines 24328-26017
24328 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 24329 this.value = val; 24330 } 24331 } ); 24332 } 24333} ); 24334 24335jQuery.extend( { 24336 valHooks: { 24337 option: { 24338 get: function( elem ) { 24339 24340 var val = jQuery.find.attr( elem, "value" ); 24341 return val != null ? 24342 val : 24343 24344 // Support: IE <=10 - 11 only 24345 // option.text throws exceptions (trac-14686, trac-14858) 24346 // Strip and collapse whitespace 24347 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 24348 stripAndCollapse( jQuery.text( elem ) ); 24349 } 24350 }, 24351 select: { 24352 get: function( elem ) { 24353 var value, option, i, 24354 options = elem.options, 24355 index = elem.selectedIndex, 24356 one = elem.type === "select-one", 24357 values = one ? null : [], 24358 max = one ? index + 1 : options.length; 24359 24360 if ( index < 0 ) { 24361 i = max; 24362 24363 } else { 24364 i = one ? index : 0; 24365 } 24366 24367 // Loop through all the selected options 24368 for ( ; i < max; i++ ) { 24369 option = options[ i ]; 24370 24371 // Support: IE <=9 only 24372 // IE8-9 doesn't update selected after form reset (trac-2551) 24373 if ( ( option.selected || i === index ) && 24374 24375 // Don't return options that are disabled or in a disabled optgroup 24376 !option.disabled && 24377 ( !option.parentNode.disabled || 24378 !nodeName( option.parentNode, "optgroup" ) ) ) { 24379 24380 // Get the specific value for the option 24381 value = jQuery( option ).val(); 24382 24383 // We don't need an array for one selects 24384 if ( one ) { 24385 return value; 24386 } 24387 24388 // Multi-Selects return an array 24389 values.push( value ); 24390 } 24391 } 24392 24393 return values; 24394 }, 24395 24396 set: function( elem, value ) { 24397 var optionSet, option, 24398 options = elem.options, 24399 values = jQuery.makeArray( value ), 24400 i = options.length; 24401 24402 while ( i-- ) { 24403 option = options[ i ]; 24404 24405 /* eslint-disable no-cond-assign */ 24406 24407 if ( option.selected = 24408 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 24409 ) { 24410 optionSet = true; 24411 } 24412 24413 /* eslint-enable no-cond-assign */ 24414 } 24415 24416 // Force browsers to behave consistently when non-matching value is set 24417 if ( !optionSet ) { 24418 elem.selectedIndex = -1; 24419 } 24420 return values; 24421 } 24422 } 24423 } 24424} ); 24425 24426// Radios and checkboxes getter/setter 24427jQuery.each( [ "radio", "checkbox" ], function() { 24428 jQuery.valHooks[ this ] = { 24429 set: function( elem, value ) { 24430 if ( Array.isArray( value ) ) { 24431 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 24432 } 24433 } 24434 }; 24435 if ( !support.checkOn ) { 24436 jQuery.valHooks[ this ].get = function( elem ) { 24437 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 24438 }; 24439 } 24440} ); 24441 24442 24443 24444 24445// Return jQuery for attributes-only inclusion 24446var location = window.location; 24447 24448var nonce = { guid: Date.now() }; 24449 24450var rquery = ( /\?/ ); 24451 24452 24453 24454// Cross-browser xml parsing 24455jQuery.parseXML = function( data ) { 24456 var xml, parserErrorElem; 24457 if ( !data || typeof data !== "string" ) { 24458 return null; 24459 } 24460 24461 // Support: IE 9 - 11 only 24462 // IE throws on parseFromString with invalid input. 24463 try { 24464 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 24465 } catch ( e ) {} 24466 24467 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 24468 if ( !xml || parserErrorElem ) { 24469 jQuery.error( "Invalid XML: " + ( 24470 parserErrorElem ? 24471 jQuery.map( parserErrorElem.childNodes, function( el ) { 24472 return el.textContent; 24473 } ).join( "\n" ) : 24474 data 24475 ) ); 24476 } 24477 return xml; 24478}; 24479 24480 24481var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 24482 stopPropagationCallback = function( e ) { 24483 e.stopPropagation(); 24484 }; 24485 24486jQuery.extend( jQuery.event, { 24487 24488 trigger: function( event, data, elem, onlyHandlers ) { 24489 24490 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 24491 eventPath = [ elem || document ], 24492 type = hasOwn.call( event, "type" ) ? event.type : event, 24493 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 24494 24495 cur = lastElement = tmp = elem = elem || document; 24496 24497 // Don't do events on text and comment nodes 24498 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 24499 return; 24500 } 24501 24502 // focus/blur morphs to focusin/out; ensure we're not firing them right now 24503 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 24504 return; 24505 } 24506 24507 if ( type.indexOf( "." ) > -1 ) { 24508 24509 // Namespaced trigger; create a regexp to match event type in handle() 24510 namespaces = type.split( "." ); 24511 type = namespaces.shift(); 24512 namespaces.sort(); 24513 } 24514 ontype = type.indexOf( ":" ) < 0 && "on" + type; 24515 24516 // Caller can pass in a jQuery.Event object, Object, or just an event type string 24517 event = event[ jQuery.expando ] ? 24518 event : 24519 new jQuery.Event( type, typeof event === "object" && event ); 24520 24521 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 24522 event.isTrigger = onlyHandlers ? 2 : 3; 24523 event.namespace = namespaces.join( "." ); 24524 event.rnamespace = event.namespace ? 24525 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 24526 null; 24527 24528 // Clean up the event in case it is being reused 24529 event.result = undefined; 24530 if ( !event.target ) { 24531 event.target = elem; 24532 } 24533 24534 // Clone any incoming data and prepend the event, creating the handler arg list 24535 data = data == null ? 24536 [ event ] : 24537 jQuery.makeArray( data, [ event ] ); 24538 24539 // Allow special events to draw outside the lines 24540 special = jQuery.event.special[ type ] || {}; 24541 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 24542 return; 24543 } 24544 24545 // Determine event propagation path in advance, per W3C events spec (trac-9951) 24546 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 24547 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 24548 24549 bubbleType = special.delegateType || type; 24550 if ( !rfocusMorph.test( bubbleType + type ) ) { 24551 cur = cur.parentNode; 24552 } 24553 for ( ; cur; cur = cur.parentNode ) { 24554 eventPath.push( cur ); 24555 tmp = cur; 24556 } 24557 24558 // Only add window if we got to document (e.g., not plain obj or detached DOM) 24559 if ( tmp === ( elem.ownerDocument || document ) ) { 24560 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 24561 } 24562 } 24563 24564 // Fire handlers on the event path 24565 i = 0; 24566 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 24567 lastElement = cur; 24568 event.type = i > 1 ? 24569 bubbleType : 24570 special.bindType || type; 24571 24572 // jQuery handler 24573 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 24574 dataPriv.get( cur, "handle" ); 24575 if ( handle ) { 24576 handle.apply( cur, data ); 24577 } 24578 24579 // Native handler 24580 handle = ontype && cur[ ontype ]; 24581 if ( handle && handle.apply && acceptData( cur ) ) { 24582 event.result = handle.apply( cur, data ); 24583 if ( event.result === false ) { 24584 event.preventDefault(); 24585 } 24586 } 24587 } 24588 event.type = type; 24589 24590 // If nobody prevented the default action, do it now 24591 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 24592 24593 if ( ( !special._default || 24594 special._default.apply( eventPath.pop(), data ) === false ) && 24595 acceptData( elem ) ) { 24596 24597 // Call a native DOM method on the target with the same name as the event. 24598 // Don't do default actions on window, that's where global variables be (trac-6170) 24599 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 24600 24601 // Don't re-trigger an onFOO event when we call its FOO() method 24602 tmp = elem[ ontype ]; 24603 24604 if ( tmp ) { 24605 elem[ ontype ] = null; 24606 } 24607 24608 // Prevent re-triggering of the same event, since we already bubbled it above 24609 jQuery.event.triggered = type; 24610 24611 if ( event.isPropagationStopped() ) { 24612 lastElement.addEventListener( type, stopPropagationCallback ); 24613 } 24614 24615 elem[ type ](); 24616 24617 if ( event.isPropagationStopped() ) { 24618 lastElement.removeEventListener( type, stopPropagationCallback ); 24619 } 24620 24621 jQuery.event.triggered = undefined; 24622 24623 if ( tmp ) { 24624 elem[ ontype ] = tmp; 24625 } 24626 } 24627 } 24628 } 24629 24630 return event.result; 24631 }, 24632 24633 // Piggyback on a donor event to simulate a different one 24634 // Used only for `focus(in | out)` events 24635 simulate: function( type, elem, event ) { 24636 var e = jQuery.extend( 24637 new jQuery.Event(), 24638 event, 24639 { 24640 type: type, 24641 isSimulated: true 24642 } 24643 ); 24644 24645 jQuery.event.trigger( e, null, elem ); 24646 } 24647 24648} ); 24649 24650jQuery.fn.extend( { 24651 24652 trigger: function( type, data ) { 24653 return this.each( function() { 24654 jQuery.event.trigger( type, data, this ); 24655 } ); 24656 }, 24657 triggerHandler: function( type, data ) { 24658 var elem = this[ 0 ]; 24659 if ( elem ) { 24660 return jQuery.event.trigger( type, data, elem, true ); 24661 } 24662 } 24663} ); 24664 24665 24666var 24667 rbracket = /\[\]$/, 24668 rCRLF = /\r?\n/g, 24669 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 24670 rsubmittable = /^(?:input|select|textarea|keygen)/i; 24671 24672function buildParams( prefix, obj, traditional, add ) { 24673 var name; 24674 24675 if ( Array.isArray( obj ) ) { 24676 24677 // Serialize array item. 24678 jQuery.each( obj, function( i, v ) { 24679 if ( traditional || rbracket.test( prefix ) ) { 24680 24681 // Treat each array item as a scalar. 24682 add( prefix, v ); 24683 24684 } else { 24685 24686 // Item is non-scalar (array or object), encode its numeric index. 24687 buildParams( 24688 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 24689 v, 24690 traditional, 24691 add 24692 ); 24693 } 24694 } ); 24695 24696 } else if ( !traditional && toType( obj ) === "object" ) { 24697 24698 // Serialize object item. 24699 for ( name in obj ) { 24700 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 24701 } 24702 24703 } else { 24704 24705 // Serialize scalar item. 24706 add( prefix, obj ); 24707 } 24708} 24709 24710// Serialize an array of form elements or a set of 24711// key/values into a query string 24712jQuery.param = function( a, traditional ) { 24713 var prefix, 24714 s = [], 24715 add = function( key, valueOrFunction ) { 24716 24717 // If value is a function, invoke it and use its return value 24718 var value = isFunction( valueOrFunction ) ? 24719 valueOrFunction() : 24720 valueOrFunction; 24721 24722 s[ s.length ] = encodeURIComponent( key ) + "=" + 24723 encodeURIComponent( value == null ? "" : value ); 24724 }; 24725 24726 if ( a == null ) { 24727 return ""; 24728 } 24729 24730 // If an array was passed in, assume that it is an array of form elements. 24731 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 24732 24733 // Serialize the form elements 24734 jQuery.each( a, function() { 24735 add( this.name, this.value ); 24736 } ); 24737 24738 } else { 24739 24740 // If traditional, encode the "old" way (the way 1.3.2 or older 24741 // did it), otherwise encode params recursively. 24742 for ( prefix in a ) { 24743 buildParams( prefix, a[ prefix ], traditional, add ); 24744 } 24745 } 24746 24747 // Return the resulting serialization 24748 return s.join( "&" ); 24749}; 24750 24751jQuery.fn.extend( { 24752 serialize: function() { 24753 return jQuery.param( this.serializeArray() ); 24754 }, 24755 serializeArray: function() { 24756 return this.map( function() { 24757 24758 // Can add propHook for "elements" to filter or add form elements 24759 var elements = jQuery.prop( this, "elements" ); 24760 return elements ? jQuery.makeArray( elements ) : this; 24761 } ).filter( function() { 24762 var type = this.type; 24763 24764 // Use .is( ":disabled" ) so that fieldset[disabled] works 24765 return this.name && !jQuery( this ).is( ":disabled" ) && 24766 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 24767 ( this.checked || !rcheckableType.test( type ) ); 24768 } ).map( function( _i, elem ) { 24769 var val = jQuery( this ).val(); 24770 24771 if ( val == null ) { 24772 return null; 24773 } 24774 24775 if ( Array.isArray( val ) ) { 24776 return jQuery.map( val, function( val ) { 24777 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 24778 } ); 24779 } 24780 24781 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 24782 } ).get(); 24783 } 24784} ); 24785 24786 24787var 24788 r20 = /%20/g, 24789 rhash = /#.*$/, 24790 rantiCache = /([?&])_=[^&]*/, 24791 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 24792 24793 // trac-7653, trac-8125, trac-8152: local protocol detection 24794 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 24795 rnoContent = /^(?:GET|HEAD)$/, 24796 rprotocol = /^\/\//, 24797 24798 /* Prefilters 24799 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 24800 * 2) These are called: 24801 * - BEFORE asking for a transport 24802 * - AFTER param serialization (s.data is a string if s.processData is true) 24803 * 3) key is the dataType 24804 * 4) the catchall symbol "*" can be used 24805 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 24806 */ 24807 prefilters = {}, 24808 24809 /* Transports bindings 24810 * 1) key is the dataType 24811 * 2) the catchall symbol "*" can be used 24812 * 3) selection will start with transport dataType and THEN go to "*" if needed 24813 */ 24814 transports = {}, 24815 24816 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 24817 allTypes = "*/".concat( "*" ), 24818 24819 // Anchor tag for parsing the document origin 24820 originAnchor = document.createElement( "a" ); 24821 24822originAnchor.href = location.href; 24823 24824// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 24825function addToPrefiltersOrTransports( structure ) { 24826 24827 // dataTypeExpression is optional and defaults to "*" 24828 return function( dataTypeExpression, func ) { 24829 24830 if ( typeof dataTypeExpression !== "string" ) { 24831 func = dataTypeExpression; 24832 dataTypeExpression = "*"; 24833 } 24834 24835 var dataType, 24836 i = 0, 24837 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 24838 24839 if ( isFunction( func ) ) { 24840 24841 // For each dataType in the dataTypeExpression 24842 while ( ( dataType = dataTypes[ i++ ] ) ) { 24843 24844 // Prepend if requested 24845 if ( dataType[ 0 ] === "+" ) { 24846 dataType = dataType.slice( 1 ) || "*"; 24847 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 24848 24849 // Otherwise append 24850 } else { 24851 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 24852 } 24853 } 24854 } 24855 }; 24856} 24857 24858// Base inspection function for prefilters and transports 24859function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 24860 24861 var inspected = {}, 24862 seekingTransport = ( structure === transports ); 24863 24864 function inspect( dataType ) { 24865 var selected; 24866 inspected[ dataType ] = true; 24867 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 24868 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 24869 if ( typeof dataTypeOrTransport === "string" && 24870 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 24871 24872 options.dataTypes.unshift( dataTypeOrTransport ); 24873 inspect( dataTypeOrTransport ); 24874 return false; 24875 } else if ( seekingTransport ) { 24876 return !( selected = dataTypeOrTransport ); 24877 } 24878 } ); 24879 return selected; 24880 } 24881 24882 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 24883} 24884 24885// A special extend for ajax options 24886// that takes "flat" options (not to be deep extended) 24887// Fixes trac-9887 24888function ajaxExtend( target, src ) { 24889 var key, deep, 24890 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 24891 24892 for ( key in src ) { 24893 if ( src[ key ] !== undefined ) { 24894 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 24895 } 24896 } 24897 if ( deep ) { 24898 jQuery.extend( true, target, deep ); 24899 } 24900 24901 return target; 24902} 24903 24904/* Handles responses to an ajax request: 24905 * - finds the right dataType (mediates between content-type and expected dataType) 24906 * - returns the corresponding response 24907 */ 24908function ajaxHandleResponses( s, jqXHR, responses ) { 24909 24910 var ct, type, finalDataType, firstDataType, 24911 contents = s.contents, 24912 dataTypes = s.dataTypes; 24913 24914 // Remove auto dataType and get content-type in the process 24915 while ( dataTypes[ 0 ] === "*" ) { 24916 dataTypes.shift(); 24917 if ( ct === undefined ) { 24918 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 24919 } 24920 } 24921 24922 // Check if we're dealing with a known content-type 24923 if ( ct ) { 24924 for ( type in contents ) { 24925 if ( contents[ type ] && contents[ type ].test( ct ) ) { 24926 dataTypes.unshift( type ); 24927 break; 24928 } 24929 } 24930 } 24931 24932 // Check to see if we have a response for the expected dataType 24933 if ( dataTypes[ 0 ] in responses ) { 24934 finalDataType = dataTypes[ 0 ]; 24935 } else { 24936 24937 // Try convertible dataTypes 24938 for ( type in responses ) { 24939 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 24940 finalDataType = type; 24941 break; 24942 } 24943 if ( !firstDataType ) { 24944 firstDataType = type; 24945 } 24946 } 24947 24948 // Or just use first one 24949 finalDataType = finalDataType || firstDataType; 24950 } 24951 24952 // If we found a dataType 24953 // We add the dataType to the list if needed 24954 // and return the corresponding response 24955 if ( finalDataType ) { 24956 if ( finalDataType !== dataTypes[ 0 ] ) { 24957 dataTypes.unshift( finalDataType ); 24958 } 24959 return responses[ finalDataType ]; 24960 } 24961} 24962 24963/* Chain conversions given the request and the original response 24964 * Also sets the responseXXX fields on the jqXHR instance 24965 */ 24966function ajaxConvert( s, response, jqXHR, isSuccess ) { 24967 var conv2, current, conv, tmp, prev, 24968 converters = {}, 24969 24970 // Work with a copy of dataTypes in case we need to modify it for conversion 24971 dataTypes = s.dataTypes.slice(); 24972 24973 // Create converters map with lowercased keys 24974 if ( dataTypes[ 1 ] ) { 24975 for ( conv in s.converters ) { 24976 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 24977 } 24978 } 24979 24980 current = dataTypes.shift(); 24981 24982 // Convert to each sequential dataType 24983 while ( current ) { 24984 24985 if ( s.responseFields[ current ] ) { 24986 jqXHR[ s.responseFields[ current ] ] = response; 24987 } 24988 24989 // Apply the dataFilter if provided 24990 if ( !prev && isSuccess && s.dataFilter ) { 24991 response = s.dataFilter( response, s.dataType ); 24992 } 24993 24994 prev = current; 24995 current = dataTypes.shift(); 24996 24997 if ( current ) { 24998 24999 // There's only work to do if current dataType is non-auto 25000 if ( current === "*" ) { 25001 25002 current = prev; 25003 25004 // Convert response if prev dataType is non-auto and differs from current 25005 } else if ( prev !== "*" && prev !== current ) { 25006 25007 // Seek a direct converter 25008 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 25009 25010 // If none found, seek a pair 25011 if ( !conv ) { 25012 for ( conv2 in converters ) { 25013 25014 // If conv2 outputs current 25015 tmp = conv2.split( " " ); 25016 if ( tmp[ 1 ] === current ) { 25017 25018 // If prev can be converted to accepted input 25019 conv = converters[ prev + " " + tmp[ 0 ] ] || 25020 converters[ "* " + tmp[ 0 ] ]; 25021 if ( conv ) { 25022 25023 // Condense equivalence converters 25024 if ( conv === true ) { 25025 conv = converters[ conv2 ]; 25026 25027 // Otherwise, insert the intermediate dataType 25028 } else if ( converters[ conv2 ] !== true ) { 25029 current = tmp[ 0 ]; 25030 dataTypes.unshift( tmp[ 1 ] ); 25031 } 25032 break; 25033 } 25034 } 25035 } 25036 } 25037 25038 // Apply converter (if not an equivalence) 25039 if ( conv !== true ) { 25040 25041 // Unless errors are allowed to bubble, catch and return them 25042 if ( conv && s.throws ) { 25043 response = conv( response ); 25044 } else { 25045 try { 25046 response = conv( response ); 25047 } catch ( e ) { 25048 return { 25049 state: "parsererror", 25050 error: conv ? e : "No conversion from " + prev + " to " + current 25051 }; 25052 } 25053 } 25054 } 25055 } 25056 } 25057 } 25058 25059 return { state: "success", data: response }; 25060} 25061 25062jQuery.extend( { 25063 25064 // Counter for holding the number of active queries 25065 active: 0, 25066 25067 // Last-Modified header cache for next request 25068 lastModified: {}, 25069 etag: {}, 25070 25071 ajaxSettings: { 25072 url: location.href, 25073 type: "GET", 25074 isLocal: rlocalProtocol.test( location.protocol ), 25075 global: true, 25076 processData: true, 25077 async: true, 25078 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 25079 25080 /* 25081 timeout: 0, 25082 data: null, 25083 dataType: null, 25084 username: null, 25085 password: null, 25086 cache: null, 25087 throws: false, 25088 traditional: false, 25089 headers: {}, 25090 */ 25091 25092 accepts: { 25093 "*": allTypes, 25094 text: "text/plain", 25095 html: "text/html", 25096 xml: "application/xml, text/xml", 25097 json: "application/json, text/javascript" 25098 }, 25099 25100 contents: { 25101 xml: /\bxml\b/, 25102 html: /\bhtml/, 25103 json: /\bjson\b/ 25104 }, 25105 25106 responseFields: { 25107 xml: "responseXML", 25108 text: "responseText", 25109 json: "responseJSON" 25110 }, 25111 25112 // Data converters 25113 // Keys separate source (or catchall "*") and destination types with a single space 25114 converters: { 25115 25116 // Convert anything to text 25117 "* text": String, 25118 25119 // Text to html (true = no transformation) 25120 "text html": true, 25121 25122 // Evaluate text as a json expression 25123 "text json": JSON.parse, 25124 25125 // Parse text as xml 25126 "text xml": jQuery.parseXML 25127 }, 25128 25129 // For options that shouldn't be deep extended: 25130 // you can add your own custom options here if 25131 // and when you create one that shouldn't be 25132 // deep extended (see ajaxExtend) 25133 flatOptions: { 25134 url: true, 25135 context: true 25136 } 25137 }, 25138 25139 // Creates a full fledged settings object into target 25140 // with both ajaxSettings and settings fields. 25141 // If target is omitted, writes into ajaxSettings. 25142 ajaxSetup: function( target, settings ) { 25143 return settings ? 25144 25145 // Building a settings object 25146 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 25147 25148 // Extending ajaxSettings 25149 ajaxExtend( jQuery.ajaxSettings, target ); 25150 }, 25151 25152 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 25153 ajaxTransport: addToPrefiltersOrTransports( transports ), 25154 25155 // Main method 25156 ajax: function( url, options ) { 25157 25158 // If url is an object, simulate pre-1.5 signature 25159 if ( typeof url === "object" ) { 25160 options = url; 25161 url = undefined; 25162 } 25163 25164 // Force options to be an object 25165 options = options || {}; 25166 25167 var transport, 25168 25169 // URL without anti-cache param 25170 cacheURL, 25171 25172 // Response headers 25173 responseHeadersString, 25174 responseHeaders, 25175 25176 // timeout handle 25177 timeoutTimer, 25178 25179 // Url cleanup var 25180 urlAnchor, 25181 25182 // Request state (becomes false upon send and true upon completion) 25183 completed, 25184 25185 // To know if global events are to be dispatched 25186 fireGlobals, 25187 25188 // Loop variable 25189 i, 25190 25191 // uncached part of the url 25192 uncached, 25193 25194 // Create the final options object 25195 s = jQuery.ajaxSetup( {}, options ), 25196 25197 // Callbacks context 25198 callbackContext = s.context || s, 25199 25200 // Context for global events is callbackContext if it is a DOM node or jQuery collection 25201 globalEventContext = s.context && 25202 ( callbackContext.nodeType || callbackContext.jquery ) ? 25203 jQuery( callbackContext ) : 25204 jQuery.event, 25205 25206 // Deferreds 25207 deferred = jQuery.Deferred(), 25208 completeDeferred = jQuery.Callbacks( "once memory" ), 25209 25210 // Status-dependent callbacks 25211 statusCode = s.statusCode || {}, 25212 25213 // Headers (they are sent all at once) 25214 requestHeaders = {}, 25215 requestHeadersNames = {}, 25216 25217 // Default abort message 25218 strAbort = "canceled", 25219 25220 // Fake xhr 25221 jqXHR = { 25222 readyState: 0, 25223 25224 // Builds headers hashtable if needed 25225 getResponseHeader: function( key ) { 25226 var match; 25227 if ( completed ) { 25228 if ( !responseHeaders ) { 25229 responseHeaders = {}; 25230 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 25231 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 25232 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 25233 .concat( match[ 2 ] ); 25234 } 25235 } 25236 match = responseHeaders[ key.toLowerCase() + " " ]; 25237 } 25238 return match == null ? null : match.join( ", " ); 25239 }, 25240 25241 // Raw string 25242 getAllResponseHeaders: function() { 25243 return completed ? responseHeadersString : null; 25244 }, 25245 25246 // Caches the header 25247 setRequestHeader: function( name, value ) { 25248 if ( completed == null ) { 25249 name = requestHeadersNames[ name.toLowerCase() ] = 25250 requestHeadersNames[ name.toLowerCase() ] || name; 25251 requestHeaders[ name ] = value; 25252 } 25253 return this; 25254 }, 25255 25256 // Overrides response content-type header 25257 overrideMimeType: function( type ) { 25258 if ( completed == null ) { 25259 s.mimeType = type; 25260 } 25261 return this; 25262 }, 25263 25264 // Status-dependent callbacks 25265 statusCode: function( map ) { 25266 var code; 25267 if ( map ) { 25268 if ( completed ) { 25269 25270 // Execute the appropriate callbacks 25271 jqXHR.always( map[ jqXHR.status ] ); 25272 } else { 25273 25274 // Lazy-add the new callbacks in a way that preserves old ones 25275 for ( code in map ) { 25276 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 25277 } 25278 } 25279 } 25280 return this; 25281 }, 25282 25283 // Cancel the request 25284 abort: function( statusText ) { 25285 var finalText = statusText || strAbort; 25286 if ( transport ) { 25287 transport.abort( finalText ); 25288 } 25289 done( 0, finalText ); 25290 return this; 25291 } 25292 }; 25293 25294 // Attach deferreds 25295 deferred.promise( jqXHR ); 25296 25297 // Add protocol if not provided (prefilters might expect it) 25298 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 25299 // We also use the url parameter if available 25300 s.url = ( ( url || s.url || location.href ) + "" ) 25301 .replace( rprotocol, location.protocol + "//" ); 25302 25303 // Alias method option to type as per ticket trac-12004 25304 s.type = options.method || options.type || s.method || s.type; 25305 25306 // Extract dataTypes list 25307 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 25308 25309 // A cross-domain request is in order when the origin doesn't match the current origin. 25310 if ( s.crossDomain == null ) { 25311 urlAnchor = document.createElement( "a" ); 25312 25313 // Support: IE <=8 - 11, Edge 12 - 15 25314 // IE throws exception on accessing the href property if url is malformed, 25315 // e.g. http://example.com:80x/ 25316 try { 25317 urlAnchor.href = s.url; 25318 25319 // Support: IE <=8 - 11 only 25320 // Anchor's host property isn't correctly set when s.url is relative 25321 urlAnchor.href = urlAnchor.href; 25322 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 25323 urlAnchor.protocol + "//" + urlAnchor.host; 25324 } catch ( e ) { 25325 25326 // If there is an error parsing the URL, assume it is crossDomain, 25327 // it can be rejected by the transport if it is invalid 25328 s.crossDomain = true; 25329 } 25330 } 25331 25332 // Convert data if not already a string 25333 if ( s.data && s.processData && typeof s.data !== "string" ) { 25334 s.data = jQuery.param( s.data, s.traditional ); 25335 } 25336 25337 // Apply prefilters 25338 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 25339 25340 // If request was aborted inside a prefilter, stop there 25341 if ( completed ) { 25342 return jqXHR; 25343 } 25344 25345 // We can fire global events as of now if asked to 25346 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 25347 fireGlobals = jQuery.event && s.global; 25348 25349 // Watch for a new set of requests 25350 if ( fireGlobals && jQuery.active++ === 0 ) { 25351 jQuery.event.trigger( "ajaxStart" ); 25352 } 25353 25354 // Uppercase the type 25355 s.type = s.type.toUpperCase(); 25356 25357 // Determine if request has content 25358 s.hasContent = !rnoContent.test( s.type ); 25359 25360 // Save the URL in case we're toying with the If-Modified-Since 25361 // and/or If-None-Match header later on 25362 // Remove hash to simplify url manipulation 25363 cacheURL = s.url.replace( rhash, "" ); 25364 25365 // More options handling for requests with no content 25366 if ( !s.hasContent ) { 25367 25368 // Remember the hash so we can put it back 25369 uncached = s.url.slice( cacheURL.length ); 25370 25371 // If data is available and should be processed, append data to url 25372 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 25373 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 25374 25375 // trac-9682: remove data so that it's not used in an eventual retry 25376 delete s.data; 25377 } 25378 25379 // Add or update anti-cache param if needed 25380 if ( s.cache === false ) { 25381 cacheURL = cacheURL.replace( rantiCache, "$1" ); 25382 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 25383 uncached; 25384 } 25385 25386 // Put hash and anti-cache on the URL that will be requested (gh-1732) 25387 s.url = cacheURL + uncached; 25388 25389 // Change '%20' to '+' if this is encoded form body content (gh-2658) 25390 } else if ( s.data && s.processData && 25391 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 25392 s.data = s.data.replace( r20, "+" ); 25393 } 25394 25395 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 25396 if ( s.ifModified ) { 25397 if ( jQuery.lastModified[ cacheURL ] ) { 25398 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 25399 } 25400 if ( jQuery.etag[ cacheURL ] ) { 25401 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 25402 } 25403 } 25404 25405 // Set the correct header, if data is being sent 25406 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 25407 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 25408 } 25409 25410 // Set the Accepts header for the server, depending on the dataType 25411 jqXHR.setRequestHeader( 25412 "Accept", 25413 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 25414 s.accepts[ s.dataTypes[ 0 ] ] + 25415 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 25416 s.accepts[ "*" ] 25417 ); 25418 25419 // Check for headers option 25420 for ( i in s.headers ) { 25421 jqXHR.setRequestHeader( i, s.headers[ i ] ); 25422 } 25423 25424 // Allow custom headers/mimetypes and early abort 25425 if ( s.beforeSend && 25426 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 25427 25428 // Abort if not done already and return 25429 return jqXHR.abort(); 25430 } 25431 25432 // Aborting is no longer a cancellation 25433 strAbort = "abort"; 25434 25435 // Install callbacks on deferreds 25436 completeDeferred.add( s.complete ); 25437 jqXHR.done( s.success ); 25438 jqXHR.fail( s.error ); 25439 25440 // Get transport 25441 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 25442 25443 // If no transport, we auto-abort 25444 if ( !transport ) { 25445 done( -1, "No Transport" ); 25446 } else { 25447 jqXHR.readyState = 1; 25448 25449 // Send global event 25450 if ( fireGlobals ) { 25451 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 25452 } 25453 25454 // If request was aborted inside ajaxSend, stop there 25455 if ( completed ) { 25456 return jqXHR; 25457 } 25458 25459 // Timeout 25460 if ( s.async && s.timeout > 0 ) { 25461 timeoutTimer = window.setTimeout( function() { 25462 jqXHR.abort( "timeout" ); 25463 }, s.timeout ); 25464 } 25465 25466 try { 25467 completed = false; 25468 transport.send( requestHeaders, done ); 25469 } catch ( e ) { 25470 25471 // Rethrow post-completion exceptions 25472 if ( completed ) { 25473 throw e; 25474 } 25475 25476 // Propagate others as results 25477 done( -1, e ); 25478 } 25479 } 25480 25481 // Callback for when everything is done 25482 function done( status, nativeStatusText, responses, headers ) { 25483 var isSuccess, success, error, response, modified, 25484 statusText = nativeStatusText; 25485 25486 // Ignore repeat invocations 25487 if ( completed ) { 25488 return; 25489 } 25490 25491 completed = true; 25492 25493 // Clear timeout if it exists 25494 if ( timeoutTimer ) { 25495 window.clearTimeout( timeoutTimer ); 25496 } 25497 25498 // Dereference transport for early garbage collection 25499 // (no matter how long the jqXHR object will be used) 25500 transport = undefined; 25501 25502 // Cache response headers 25503 responseHeadersString = headers || ""; 25504 25505 // Set readyState 25506 jqXHR.readyState = status > 0 ? 4 : 0; 25507 25508 // Determine if successful 25509 isSuccess = status >= 200 && status < 300 || status === 304; 25510 25511 // Get response data 25512 if ( responses ) { 25513 response = ajaxHandleResponses( s, jqXHR, responses ); 25514 } 25515 25516 // Use a noop converter for missing script but not if jsonp 25517 if ( !isSuccess && 25518 jQuery.inArray( "script", s.dataTypes ) > -1 && 25519 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 25520 s.converters[ "text script" ] = function() {}; 25521 } 25522 25523 // Convert no matter what (that way responseXXX fields are always set) 25524 response = ajaxConvert( s, response, jqXHR, isSuccess ); 25525 25526 // If successful, handle type chaining 25527 if ( isSuccess ) { 25528 25529 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 25530 if ( s.ifModified ) { 25531 modified = jqXHR.getResponseHeader( "Last-Modified" ); 25532 if ( modified ) { 25533 jQuery.lastModified[ cacheURL ] = modified; 25534 } 25535 modified = jqXHR.getResponseHeader( "etag" ); 25536 if ( modified ) { 25537 jQuery.etag[ cacheURL ] = modified; 25538 } 25539 } 25540 25541 // if no content 25542 if ( status === 204 || s.type === "HEAD" ) { 25543 statusText = "nocontent"; 25544 25545 // if not modified 25546 } else if ( status === 304 ) { 25547 statusText = "notmodified"; 25548 25549 // If we have data, let's convert it 25550 } else { 25551 statusText = response.state; 25552 success = response.data; 25553 error = response.error; 25554 isSuccess = !error; 25555 } 25556 } else { 25557 25558 // Extract error from statusText and normalize for non-aborts 25559 error = statusText; 25560 if ( status || !statusText ) { 25561 statusText = "error"; 25562 if ( status < 0 ) { 25563 status = 0; 25564 } 25565 } 25566 } 25567 25568 // Set data for the fake xhr object 25569 jqXHR.status = status; 25570 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 25571 25572 // Success/Error 25573 if ( isSuccess ) { 25574 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 25575 } else { 25576 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 25577 } 25578 25579 // Status-dependent callbacks 25580 jqXHR.statusCode( statusCode ); 25581 statusCode = undefined; 25582 25583 if ( fireGlobals ) { 25584 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 25585 [ jqXHR, s, isSuccess ? success : error ] ); 25586 } 25587 25588 // Complete 25589 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 25590 25591 if ( fireGlobals ) { 25592 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 25593 25594 // Handle the global AJAX counter 25595 if ( !( --jQuery.active ) ) { 25596 jQuery.event.trigger( "ajaxStop" ); 25597 } 25598 } 25599 } 25600 25601 return jqXHR; 25602 }, 25603 25604 getJSON: function( url, data, callback ) { 25605 return jQuery.get( url, data, callback, "json" ); 25606 }, 25607 25608 getScript: function( url, callback ) { 25609 return jQuery.get( url, undefined, callback, "script" ); 25610 } 25611} ); 25612 25613jQuery.each( [ "get", "post" ], function( _i, method ) { 25614 jQuery[ method ] = function( url, data, callback, type ) { 25615 25616 // Shift arguments if data argument was omitted 25617 if ( isFunction( data ) ) { 25618 type = type || callback; 25619 callback = data; 25620 data = undefined; 25621 } 25622 25623 // The url can be an options object (which then must have .url) 25624 return jQuery.ajax( jQuery.extend( { 25625 url: url, 25626 type: method, 25627 dataType: type, 25628 data: data, 25629 success: callback 25630 }, jQuery.isPlainObject( url ) && url ) ); 25631 }; 25632} ); 25633 25634jQuery.ajaxPrefilter( function( s ) { 25635 var i; 25636 for ( i in s.headers ) { 25637 if ( i.toLowerCase() === "content-type" ) { 25638 s.contentType = s.headers[ i ] || ""; 25639 } 25640 } 25641} ); 25642 25643 25644jQuery._evalUrl = function( url, options, doc ) { 25645 return jQuery.ajax( { 25646 url: url, 25647 25648 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 25649 type: "GET", 25650 dataType: "script", 25651 cache: true, 25652 async: false, 25653 global: false, 25654 25655 // Only evaluate the response if it is successful (gh-4126) 25656 // dataFilter is not invoked for failure responses, so using it instead 25657 // of the default converter is kludgy but it works. 25658 converters: { 25659 "text script": function() {} 25660 }, 25661 dataFilter: function( response ) { 25662 jQuery.globalEval( response, options, doc ); 25663 } 25664 } ); 25665}; 25666 25667 25668jQuery.fn.extend( { 25669 wrapAll: function( html ) { 25670 var wrap; 25671 25672 if ( this[ 0 ] ) { 25673 if ( isFunction( html ) ) { 25674 html = html.call( this[ 0 ] ); 25675 } 25676 25677 // The elements to wrap the target around 25678 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 25679 25680 if ( this[ 0 ].parentNode ) { 25681 wrap.insertBefore( this[ 0 ] ); 25682 } 25683 25684 wrap.map( function() { 25685 var elem = this; 25686 25687 while ( elem.firstElementChild ) { 25688 elem = elem.firstElementChild; 25689 } 25690 25691 return elem; 25692 } ).append( this ); 25693 } 25694 25695 return this; 25696 }, 25697 25698 wrapInner: function( html ) { 25699 if ( isFunction( html ) ) { 25700 return this.each( function( i ) { 25701 jQuery( this ).wrapInner( html.call( this, i ) ); 25702 } ); 25703 } 25704 25705 return this.each( function() { 25706 var self = jQuery( this ), 25707 contents = self.contents(); 25708 25709 if ( contents.length ) { 25710 contents.wrapAll( html ); 25711 25712 } else { 25713 self.append( html ); 25714 } 25715 } ); 25716 }, 25717 25718 wrap: function( html ) { 25719 var htmlIsFunction = isFunction( html ); 25720 25721 return this.each( function( i ) { 25722 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 25723 } ); 25724 }, 25725 25726 unwrap: function( selector ) { 25727 this.parent( selector ).not( "body" ).each( function() { 25728 jQuery( this ).replaceWith( this.childNodes ); 25729 } ); 25730 return this; 25731 } 25732} ); 25733 25734 25735jQuery.expr.pseudos.hidden = function( elem ) { 25736 return !jQuery.expr.pseudos.visible( elem ); 25737}; 25738jQuery.expr.pseudos.visible = function( elem ) { 25739 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 25740}; 25741 25742 25743 25744 25745jQuery.ajaxSettings.xhr = function() { 25746 try { 25747 return new window.XMLHttpRequest(); 25748 } catch ( e ) {} 25749}; 25750 25751var xhrSuccessStatus = { 25752 25753 // File protocol always yields status code 0, assume 200 25754 0: 200, 25755 25756 // Support: IE <=9 only 25757 // trac-1450: sometimes IE returns 1223 when it should be 204 25758 1223: 204 25759 }, 25760 xhrSupported = jQuery.ajaxSettings.xhr(); 25761 25762support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 25763support.ajax = xhrSupported = !!xhrSupported; 25764 25765jQuery.ajaxTransport( function( options ) { 25766 var callback, errorCallback; 25767 25768 // Cross domain only allowed if supported through XMLHttpRequest 25769 if ( support.cors || xhrSupported && !options.crossDomain ) { 25770 return { 25771 send: function( headers, complete ) { 25772 var i, 25773 xhr = options.xhr(); 25774 25775 xhr.open( 25776 options.type, 25777 options.url, 25778 options.async, 25779 options.username, 25780 options.password 25781 ); 25782 25783 // Apply custom fields if provided 25784 if ( options.xhrFields ) { 25785 for ( i in options.xhrFields ) { 25786 xhr[ i ] = options.xhrFields[ i ]; 25787 } 25788 } 25789 25790 // Override mime type if needed 25791 if ( options.mimeType && xhr.overrideMimeType ) { 25792 xhr.overrideMimeType( options.mimeType ); 25793 } 25794 25795 // X-Requested-With header 25796 // For cross-domain requests, seeing as conditions for a preflight are 25797 // akin to a jigsaw puzzle, we simply never set it to be sure. 25798 // (it can always be set on a per-request basis or even using ajaxSetup) 25799 // For same-domain requests, won't change header if already provided. 25800 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 25801 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 25802 } 25803 25804 // Set headers 25805 for ( i in headers ) { 25806 xhr.setRequestHeader( i, headers[ i ] ); 25807 } 25808 25809 // Callback 25810 callback = function( type ) { 25811 return function() { 25812 if ( callback ) { 25813 callback = errorCallback = xhr.onload = 25814 xhr.onerror = xhr.onabort = xhr.ontimeout = 25815 xhr.onreadystatechange = null; 25816 25817 if ( type === "abort" ) { 25818 xhr.abort(); 25819 } else if ( type === "error" ) { 25820 25821 // Support: IE <=9 only 25822 // On a manual native abort, IE9 throws 25823 // errors on any property access that is not readyState 25824 if ( typeof xhr.status !== "number" ) { 25825 complete( 0, "error" ); 25826 } else { 25827 complete( 25828 25829 // File: protocol always yields status 0; see trac-8605, trac-14207 25830 xhr.status, 25831 xhr.statusText 25832 ); 25833 } 25834 } else { 25835 complete( 25836 xhrSuccessStatus[ xhr.status ] || xhr.status, 25837 xhr.statusText, 25838 25839 // Support: IE <=9 only 25840 // IE9 has no XHR2 but throws on binary (trac-11426) 25841 // For XHR2 non-text, let the caller handle it (gh-2498) 25842 ( xhr.responseType || "text" ) !== "text" || 25843 typeof xhr.responseText !== "string" ? 25844 { binary: xhr.response } : 25845 { text: xhr.responseText }, 25846 xhr.getAllResponseHeaders() 25847 ); 25848 } 25849 } 25850 }; 25851 }; 25852 25853 // Listen to events 25854 xhr.onload = callback(); 25855 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 25856 25857 // Support: IE 9 only 25858 // Use onreadystatechange to replace onabort 25859 // to handle uncaught aborts 25860 if ( xhr.onabort !== undefined ) { 25861 xhr.onabort = errorCallback; 25862 } else { 25863 xhr.onreadystatechange = function() { 25864 25865 // Check readyState before timeout as it changes 25866 if ( xhr.readyState === 4 ) { 25867 25868 // Allow onerror to be called first, 25869 // but that will not handle a native abort 25870 // Also, save errorCallback to a variable 25871 // as xhr.onerror cannot be accessed 25872 window.setTimeout( function() { 25873 if ( callback ) { 25874 errorCallback(); 25875 } 25876 } ); 25877 } 25878 }; 25879 } 25880 25881 // Create the abort callback 25882 callback = callback( "abort" ); 25883 25884 try { 25885 25886 // Do send the request (this may raise an exception) 25887 xhr.send( options.hasContent && options.data || null ); 25888 } catch ( e ) { 25889 25890 // trac-14683: Only rethrow if this hasn't been notified as an error yet 25891 if ( callback ) { 25892 throw e; 25893 } 25894 } 25895 }, 25896 25897 abort: function() { 25898 if ( callback ) { 25899 callback(); 25900 } 25901 } 25902 }; 25903 } 25904} ); 25905 25906 25907 25908 25909// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 25910jQuery.ajaxPrefilter( function( s ) { 25911 if ( s.crossDomain ) { 25912 s.contents.script = false; 25913 } 25914} ); 25915 25916// Install script dataType 25917jQuery.ajaxSetup( { 25918 accepts: { 25919 script: "text/javascript, application/javascript, " + 25920 "application/ecmascript, application/x-ecmascript" 25921 }, 25922 contents: { 25923 script: /\b(?:java|ecma)script\b/ 25924 }, 25925 converters: { 25926 "text script": function( text ) { 25927 jQuery.globalEval( text ); 25928 return text; 25929 } 25930 } 25931} ); 25932 25933// Handle cache's special case and crossDomain 25934jQuery.ajaxPrefilter( "script", function( s ) { 25935 if ( s.cache === undefined ) { 25936 s.cache = false; 25937 } 25938 if ( s.crossDomain ) { 25939 s.type = "GET"; 25940 } 25941} ); 25942 25943// Bind script tag hack transport 25944jQuery.ajaxTransport( "script", function( s ) { 25945 25946 // This transport only deals with cross domain or forced-by-attrs requests 25947 if ( s.crossDomain || s.scriptAttrs ) { 25948 var script, callback; 25949 return { 25950 send: function( _, complete ) { 25951 script = jQuery( "<script>" ) 25952 .attr( s.scriptAttrs || {} ) 25953 .prop( { charset: s.scriptCharset, src: s.url } ) 25954 .on( "load error", callback = function( evt ) { 25955 script.remove(); 25956 callback = null; 25957 if ( evt ) { 25958 complete( evt.type === "error" ? 404 : 200, evt.type ); 25959 } 25960 } ); 25961 25962 // Use native DOM manipulation to avoid our domManip AJAX trickery 25963 document.head.appendChild( script[ 0 ] ); 25964 }, 25965 abort: function() { 25966 if ( callback ) { 25967 callback(); 25968 } 25969 } 25970 }; 25971 } 25972} ); 25973 25974 25975 25976 25977var oldCallbacks = [], 25978 rjsonp = /(=)\?(?=&|$)|\?\?/; 25979 25980// Default jsonp settings 25981jQuery.ajaxSetup( { 25982 jsonp: "callback", 25983 jsonpCallback: function() { 25984 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 25985 this[ callback ] = true; 25986 return callback; 25987 } 25988} ); 25989 25990// Detect, normalize options and install callbacks for jsonp requests 25991jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 25992 25993 var callbackName, overwritten, responseContainer, 25994 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 25995 "url" : 25996 typeof s.data === "string" && 25997 ( s.contentType || "" ) 25998 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 25999 rjsonp.test( s.data ) && "data" 26000 ); 26001 26002 // Handle iff the expected data type is "jsonp" or we have a parameter to set 26003 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 26004 26005 // Get callback name, remembering preexisting value associated with it 26006 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 26007 s.jsonpCallback() : 26008 s.jsonpCallback; 26009 26010 // Insert callback into url or form data 26011 if ( jsonProp ) { 26012 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 26013 } else if ( s.jsonp !== false ) { 26014 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 26015 } 26016 26017 // Use data converter to retrieve json after script execution
vendor: 2,987 bytes, lines 26018-26127
26018 s.converters[ "script json" ] = function() { 26019 if ( !responseContainer ) { 26020 jQuery.error( callbackName + " was not called" ); 26021 } 26022 return responseContainer[ 0 ]; 26023 }; 26024 26025 // Force json dataType 26026 s.dataTypes[ 0 ] = "json"; 26027 26028 // Install callback 26029 overwritten = window[ callbackName ]; 26030 window[ callbackName ] = function() { 26031 responseContainer = arguments; 26032 }; 26033 26034 // Clean-up function (fires after converters) 26035 jqXHR.always( function() { 26036 26037 // If previous value didn't exist - remove it 26038 if ( overwritten === undefined ) { 26039 jQuery( window ).removeProp( callbackName ); 26040 26041 // Otherwise restore preexisting value 26042 } else { 26043 window[ callbackName ] = overwritten; 26044 } 26045 26046 // Save back as free 26047 if ( s[ callbackName ] ) { 26048 26049 // Make sure that re-using the options doesn't screw things around 26050 s.jsonpCallback = originalSettings.jsonpCallback; 26051 26052 // Save the callback name for future use 26053 oldCallbacks.push( callbackName ); 26054 } 26055 26056 // Call if it was a function and we have a response 26057 if ( responseContainer && isFunction( overwritten ) ) { 26058 overwritten( responseContainer[ 0 ] ); 26059 } 26060 26061 responseContainer = overwritten = undefined; 26062 } ); 26063 26064 // Delegate to script 26065 return "script"; 26066 } 26067} ); 26068 26069 26070 26071 26072// Support: Safari 8 only 26073// In Safari 8 documents created via document.implementation.createHTMLDocument 26074// collapse sibling forms: the second one becomes a child of the first one. 26075// Because of that, this security measure has to be disabled in Safari 8. 26076// https://bugs.webkit.org/show_bug.cgi?id=137337 26077support.createHTMLDocument = ( function() { 26078 var body = document.implementation.createHTMLDocument( "" ).body; 26079 body.innerHTML = "<form></form><form></form>"; 26080 return body.childNodes.length === 2; 26081} )(); 26082 26083 26084// Argument "data" should be string of html 26085// context (optional): If specified, the fragment will be created in this context, 26086// defaults to document 26087// keepScripts (optional): If true, will include scripts passed in the html string 26088jQuery.parseHTML = function( data, context, keepScripts ) { 26089 if ( typeof data !== "string" ) { 26090 return []; 26091 } 26092 if ( typeof context === "boolean" ) { 26093 keepScripts = context; 26094 context = false; 26095 } 26096 26097 var base, parsed, scripts; 26098 26099 if ( !context ) { 26100 26101 // Stop scripts or inline event handlers from being executed immediately 26102 // by using document.implementation 26103 if ( support.createHTMLDocument ) { 26104 context = document.implementation.createHTMLDocument( "" ); 26105 26106 // Set the base href for the created document 26107 // so any parsed elements with URLs 26108 // are based on the document's URL (gh-2965) 26109 base = context.createElement( "base" ); 26110 base.href = document.location.href; 26111 context.head.appendChild( base ); 26112 } else { 26113 context = document; 26114 } 26115 } 26116 26117 parsed = rsingleTag.exec( data ); 26118 scripts = !keepScripts && []; 26119 26120 // Single tag 26121 if ( parsed ) { 26122 return [ context.createElement( parsed[ 1 ] ) ]; 26123 } 26124 26125 parsed = buildFragment( [ data ], context, scripts ); 26126 26127 if ( scripts && scripts.length ) {
vendor: 10,712 bytes, lines 26128-26510
26128 jQuery( scripts ).remove(); 26129 } 26130 26131 return jQuery.merge( [], parsed.childNodes ); 26132}; 26133 26134 26135/** 26136 * Load a url into a page 26137 */ 26138jQuery.fn.load = function( url, params, callback ) { 26139 var selector, type, response, 26140 self = this, 26141 off = url.indexOf( " " ); 26142 26143 if ( off > -1 ) { 26144 selector = stripAndCollapse( url.slice( off ) ); 26145 url = url.slice( 0, off ); 26146 } 26147 26148 // If it's a function 26149 if ( isFunction( params ) ) { 26150 26151 // We assume that it's the callback 26152 callback = params; 26153 params = undefined; 26154 26155 // Otherwise, build a param string 26156 } else if ( params && typeof params === "object" ) { 26157 type = "POST"; 26158 } 26159 26160 // If we have elements to modify, make the request 26161 if ( self.length > 0 ) { 26162 jQuery.ajax( { 26163 url: url, 26164 26165 // If "type" variable is undefined, then "GET" method will be used. 26166 // Make value of this field explicit since 26167 // user can override it through ajaxSetup method 26168 type: type || "GET", 26169 dataType: "html", 26170 data: params 26171 } ).done( function( responseText ) { 26172 26173 // Save response for use in complete callback 26174 response = arguments; 26175 26176 self.html( selector ? 26177 26178 // If a selector was specified, locate the right elements in a dummy div 26179 // Exclude scripts to avoid IE 'Permission Denied' errors 26180 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 26181 26182 // Otherwise use the full result 26183 responseText ); 26184 26185 // If the request succeeds, this function gets "data", "status", "jqXHR" 26186 // but they are ignored because response was set above. 26187 // If it fails, this function gets "jqXHR", "status", "error" 26188 } ).always( callback && function( jqXHR, status ) { 26189 self.each( function() { 26190 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 26191 } ); 26192 } ); 26193 } 26194 26195 return this; 26196}; 26197 26198 26199 26200 26201jQuery.expr.pseudos.animated = function( elem ) { 26202 return jQuery.grep( jQuery.timers, function( fn ) { 26203 return elem === fn.elem; 26204 } ).length; 26205}; 26206 26207 26208 26209 26210jQuery.offset = { 26211 setOffset: function( elem, options, i ) { 26212 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 26213 position = jQuery.css( elem, "position" ), 26214 curElem = jQuery( elem ), 26215 props = {}; 26216 26217 // Set position first, in-case top/left are set even on static elem 26218 if ( position === "static" ) { 26219 elem.style.position = "relative"; 26220 } 26221 26222 curOffset = curElem.offset(); 26223 curCSSTop = jQuery.css( elem, "top" ); 26224 curCSSLeft = jQuery.css( elem, "left" ); 26225 calculatePosition = ( position === "absolute" || position === "fixed" ) && 26226 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 26227 26228 // Need to be able to calculate position if either 26229 // top or left is auto and position is either absolute or fixed 26230 if ( calculatePosition ) { 26231 curPosition = curElem.position(); 26232 curTop = curPosition.top; 26233 curLeft = curPosition.left; 26234 26235 } else { 26236 curTop = parseFloat( curCSSTop ) || 0; 26237 curLeft = parseFloat( curCSSLeft ) || 0; 26238 } 26239 26240 if ( isFunction( options ) ) { 26241 26242 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 26243 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 26244 } 26245 26246 if ( options.top != null ) { 26247 props.top = ( options.top - curOffset.top ) + curTop; 26248 } 26249 if ( options.left != null ) { 26250 props.left = ( options.left - curOffset.left ) + curLeft; 26251 } 26252 26253 if ( "using" in options ) { 26254 options.using.call( elem, props ); 26255 26256 } else { 26257 curElem.css( props ); 26258 } 26259 } 26260}; 26261 26262jQuery.fn.extend( { 26263 26264 // offset() relates an element's border box to the document origin 26265 offset: function( options ) { 26266 26267 // Preserve chaining for setter 26268 if ( arguments.length ) { 26269 return options === undefined ? 26270 this : 26271 this.each( function( i ) { 26272 jQuery.offset.setOffset( this, options, i ); 26273 } ); 26274 } 26275 26276 var rect, win, 26277 elem = this[ 0 ]; 26278 26279 if ( !elem ) { 26280 return; 26281 } 26282 26283 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 26284 // Support: IE <=11 only 26285 // Running getBoundingClientRect on a 26286 // disconnected node in IE throws an error 26287 if ( !elem.getClientRects().length ) { 26288 return { top: 0, left: 0 }; 26289 } 26290 26291 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 26292 rect = elem.getBoundingClientRect(); 26293 win = elem.ownerDocument.defaultView; 26294 return { 26295 top: rect.top + win.pageYOffset, 26296 left: rect.left + win.pageXOffset 26297 }; 26298 }, 26299 26300 // position() relates an element's margin box to its offset parent's padding box 26301 // This corresponds to the behavior of CSS absolute positioning 26302 position: function() { 26303 if ( !this[ 0 ] ) { 26304 return; 26305 } 26306 26307 var offsetParent, offset, doc, 26308 elem = this[ 0 ], 26309 parentOffset = { top: 0, left: 0 }; 26310 26311 // position:fixed elements are offset from the viewport, which itself always has zero offset 26312 if ( jQuery.css( elem, "position" ) === "fixed" ) { 26313 26314 // Assume position:fixed implies availability of getBoundingClientRect 26315 offset = elem.getBoundingClientRect(); 26316 26317 } else { 26318 offset = this.offset(); 26319 26320 // Account for the *real* offset parent, which can be the document or its root element 26321 // when a statically positioned element is identified 26322 doc = elem.ownerDocument; 26323 offsetParent = elem.offsetParent || doc.documentElement; 26324 while ( offsetParent && 26325 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 26326 jQuery.css( offsetParent, "position" ) === "static" ) { 26327 26328 offsetParent = offsetParent.parentNode; 26329 } 26330 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 26331 26332 // Incorporate borders into its offset, since they are outside its content origin 26333 parentOffset = jQuery( offsetParent ).offset(); 26334 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 26335 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 26336 } 26337 } 26338 26339 // Subtract parent offsets and element margins 26340 return { 26341 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 26342 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 26343 }; 26344 }, 26345 26346 // This method will return documentElement in the following cases: 26347 // 1) For the element inside the iframe without offsetParent, this method will return 26348 // documentElement of the parent window 26349 // 2) For the hidden or detached element 26350 // 3) For body or html element, i.e. in case of the html node - it will return itself 26351 // 26352 // but those exceptions were never presented as a real life use-cases 26353 // and might be considered as more preferable results. 26354 // 26355 // This logic, however, is not guaranteed and can change at any point in the future 26356 offsetParent: function() { 26357 return this.map( function() { 26358 var offsetParent = this.offsetParent; 26359 26360 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 26361 offsetParent = offsetParent.offsetParent; 26362 } 26363 26364 return offsetParent || documentElement; 26365 } ); 26366 } 26367} ); 26368 26369// Create scrollLeft and scrollTop methods 26370jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 26371 var top = "pageYOffset" === prop; 26372 26373 jQuery.fn[ method ] = function( val ) { 26374 return access( this, function( elem, method, val ) { 26375 26376 // Coalesce documents and windows 26377 var win; 26378 if ( isWindow( elem ) ) { 26379 win = elem; 26380 } else if ( elem.nodeType === 9 ) { 26381 win = elem.defaultView; 26382 } 26383 26384 if ( val === undefined ) { 26385 return win ? win[ prop ] : elem[ method ]; 26386 } 26387 26388 if ( win ) { 26389 win.scrollTo( 26390 !top ? val : win.pageXOffset, 26391 top ? val : win.pageYOffset 26392 ); 26393 26394 } else { 26395 elem[ method ] = val; 26396 } 26397 }, method, val, arguments.length ); 26398 }; 26399} ); 26400 26401// Support: Safari <=7 - 9.1, Chrome <=37 - 49 26402// Add the top/left cssHooks using jQuery.fn.position 26403// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 26404// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 26405// getComputedStyle returns percent when specified for top/left/bottom/right; 26406// rather than make the css module depend on the offset module, just check for it here 26407jQuery.each( [ "top", "left" ], function( _i, prop ) { 26408 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 26409 function( elem, computed ) { 26410 if ( computed ) { 26411 computed = curCSS( elem, prop ); 26412 26413 // If curCSS returns percentage, fallback to offset 26414 return rnumnonpx.test( computed ) ? 26415 jQuery( elem ).position()[ prop ] + "px" : 26416 computed; 26417 } 26418 } 26419 ); 26420} ); 26421 26422 26423// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 26424jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 26425 jQuery.each( { 26426 padding: "inner" + name, 26427 content: type, 26428 "": "outer" + name 26429 }, function( defaultExtra, funcName ) { 26430 26431 // Margin is only for outerHeight, outerWidth 26432 jQuery.fn[ funcName ] = function( margin, value ) { 26433 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 26434 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 26435 26436 return access( this, function( elem, type, value ) { 26437 var doc; 26438 26439 if ( isWindow( elem ) ) { 26440 26441 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 26442 return funcName.indexOf( "outer" ) === 0 ? 26443 elem[ "inner" + name ] : 26444 elem.document.documentElement[ "client" + name ]; 26445 } 26446 26447 // Get document width or height 26448 if ( elem.nodeType === 9 ) { 26449 doc = elem.documentElement; 26450 26451 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 26452 // whichever is greatest 26453 return Math.max( 26454 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 26455 elem.body[ "offset" + name ], doc[ "offset" + name ], 26456 doc[ "client" + name ] 26457 ); 26458 } 26459 26460 return value === undefined ? 26461 26462 // Get width or height on the element, requesting but not forcing parseFloat 26463 jQuery.css( elem, type, extra ) : 26464 26465 // Set width or height on the element 26466 jQuery.style( elem, type, value, extra ); 26467 }, type, chainable ? margin : undefined, chainable ); 26468 }; 26469 } ); 26470} ); 26471 26472 26473jQuery.each( [ 26474 "ajaxStart", 26475 "ajaxStop", 26476 "ajaxComplete", 26477 "ajaxError", 26478 "ajaxSuccess", 26479 "ajaxSend" 26480], function( _i, type ) { 26481 jQuery.fn[ type ] = function( fn ) { 26482 return this.on( type, fn ); 26483 }; 26484} ); 26485 26486 26487 26488 26489jQuery.fn.extend( { 26490 26491 bind: function( types, data, fn ) { 26492 return this.on( types, null, data, fn ); 26493 }, 26494 unbind: function( types, fn ) { 26495 return this.off( types, null, fn ); 26496 }, 26497 26498 delegate: function( selector, types, data, fn ) { 26499 return this.on( types, selector, data, fn ); 26500 }, 26501 undelegate: function( selector, types, fn ) { 26502 26503 // ( namespace ) or ( selector, types [, fn] ) 26504 return arguments.length === 1 ? 26505 this.off( selector, "**" ) : 26506 this.off( types, selector || "**", fn ); 26507 }, 26508 26509 hover: function( fnOver, fnOut ) { 26510 return this
vendor: 2,565 bytes, lines 26510-26602
26510.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 26511 } 26512} ); 26513 26514jQuery.each( 26515 ( "blur focus focusin focusout resize scroll click dblclick " + 26516 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 26517 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 26518 function( _i, name ) { 26519 26520 // Handle event binding 26521 jQuery.fn[ name ] = function( data, fn ) { 26522 return arguments.length > 0 ? 26523 this.on( name, null, data, fn ) : 26524 this.trigger( name ); 26525 }; 26526 } 26527); 26528 26529 26530 26531 26532// Support: Android <=4.0 only 26533// Make sure we trim BOM and NBSP 26534// Require that the "whitespace run" starts from a non-whitespace 26535// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 26536var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 26537 26538// Bind a function to a context, optionally partially applying any 26539// arguments. 26540// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 26541// However, it is not slated for removal any time soon 26542jQuery.proxy = function( fn, context ) { 26543 var tmp, args, proxy; 26544 26545 if ( typeof context === "string" ) { 26546 tmp = fn[ context ]; 26547 context = fn; 26548 fn = tmp; 26549 } 26550 26551 // Quick check to determine if target is callable, in the spec 26552 // this throws a TypeError, but we will just return undefined. 26553 if ( !isFunction( fn ) ) { 26554 return undefined; 26555 } 26556 26557 // Simulated bind 26558 args = slice.call( arguments, 2 ); 26559 proxy = function() { 26560 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 26561 }; 26562 26563 // Set the guid of unique handler to the same of original handler, so it can be removed 26564 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 26565 26566 return proxy; 26567}; 26568 26569jQuery.holdReady = function( hold ) { 26570 if ( hold ) { 26571 jQuery.readyWait++; 26572 } else { 26573 jQuery.ready( true ); 26574 } 26575}; 26576jQuery.isArray = Array.isArray; 26577jQuery.parseJSON = JSON.parse; 26578jQuery.nodeName = nodeName; 26579jQuery.isFunction = isFunction; 26580jQuery.isWindow = isWindow; 26581jQuery.camelCase = camelCase; 26582jQuery.type = toType; 26583 26584jQuery.now = Date.now; 26585 26586jQuery.isNumeric = function( obj ) { 26587 26588 // As of jQuery 3.0, isNumeric is limited to 26589 // strings and numbers (primitives or objects) 26590 // that can be coerced to finite numbers (gh-2662) 26591 var type = jQuery.type( obj ); 26592 return ( type === "number" || type === "string" ) && 26593 26594 // parseFloat NaNs numeric-cast false positives ("") 26595 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 26596 // subtraction forces infinities to NaN 26597 !isNaN( obj - parseFloat( obj ) ); 26598}; 26599 26600jQuery.trim = function( text ) { 26601 return text == null ? 26602 "" :
26603 ( text + "" ).replace( rtrim, "$1" ); 26604}; 26605 26606 26607 26608// Register as a named AMD module, since jQuery can be concatenated with other 26609// files that may use define, but not via a proper concatenation script that 26610// understands anonymous AMD modules. A named AMD is safest and most robust 26611// way to register. Lowercase jquery is used because AMD module names are 26612// derived from file names, and jQuery is normally delivered in a lowercase 26613// file name. Do this after creating the global so that if an AMD module wants 26614// to call noConflict to hide this version of jQuery, it will work. 26615 26616// Note that for maximum portability, libraries that are not jQuery should 26617// declare themselves as anonymous modules, and avoid setting a global if an 26618// AMD loader is present. jQuery is a special case. For more information, see 26619// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 26620 26621if ( typeof define === "function" && define.amd ) { 26622 define( "jquery", [], function() { 26623 return jQuery; 26624 } ); 26625} 26626 26627 26628 26629 26630var 26631 26632 // Map over jQuery in case of overwrite 26633 _jQuery = window.jQuery, 26634 26635 // Map over the $ in case of overwrite 26636 _$ = window.$; 26637 26638jQuery.noConflict = function( deep ) { 26639 if ( window.$ === jQuery ) { 26640 window.$ = _$; 26641 } 26642 26643 if ( deep && window.jQuery === jQuery ) { 26644 window.jQuery = _jQuery; 26645 } 26646 26647 return jQuery; 26648}; 26649 26650// Expose jQuery and $ identifiers, even in AMD 26651// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 26652// and CommonJS for browser emulators (trac-13566) 26653if ( typeof noGlobal === "undefined" ) { 26654 window.jQuery = window.$ = jQuery; 26655} 26656 26657 26658 26659 26660return jQuery; 26661} ); 26662( function( factory ) { 26663 "use strict"; 26664 26665 if ( typeof define === "function" && define.amd ) { 26666 26667 // AMD. Register as an anonymous module. 26668 define( [ "jquery" ], factory ); 26669 } else { 26670 26671 // Browser globals 26672 factory( jQuery ); 26673 } 26674} )( function( $ ) { 26675"use strict"; 26676 26677$.ui = $.ui || {}; 26678 26679return $.ui.version = "1.13.3"; 26680 26681} ); 26682 26683 26684/*! 26685 * jQuery UI Keycode 1.13.3 26686 * https://jqueryui.com 26687 * 26688 * Copyright OpenJS Foundation and other contributors 26689 * Released under the MIT license. 26690 * https://jquery.org/license 26691 */ 26692 26693//>>label: Keycode 26694//>>group: Core 26695//>>description: Provide keycodes as keynames 26696//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 26697 26698( function( factory ) { 26699 "use strict"; 26700 26701 if ( typeof define === "function" && define.amd ) { 26702 26703 // AMD. Register as an anonymous module. 26704 define( [ "jquery", "./version" ], factory ); 26705 } else { 26706 26707 // Browser globals 26708 factory( jQuery ); 26709 } 26710} )( function( $ ) { 26711"use strict"; 26712 26713return $.ui.keyCode = { 26714 BACKSPACE: 8, 26715 COMMA: 188, 26716 DELETE: 46, 26717 DOWN: 40, 26718 END: 35, 26719 ENTER: 13, 26720 ESCAPE: 27, 26721 HOME: 36, 26722 LEFT: 37, 26723 PAGE_DOWN: 34, 26724 PAGE_UP: 33, 26725 PERIOD: 190, 26726 RIGHT: 39, 26727 SPACE: 32, 26728 TAB: 9, 26729 UP: 38 26730}; 26731 26732} ); 26733 26734 26735 26736/* eslint-disable max-len, camelcase */ 26737/*! 26738 * jQuery UI Datepicker 1.13.3 26739 * https://jqueryui.com 26740 * 26741 * Copyright OpenJS Foundation and other contributors 26742 * Released under the MIT license. 26743 * https://jquery.org/license 26744 */ 26745 26746//>>label: Datepicker 26747//>>group: Widgets 26748//>>description: Displays a calendar from an input or inline for selecting dates. 26749//>>docs: https://api.jqueryui.com/datepicker/ 26750//>>demos: https://jqueryui.com/datepicker/ 26751//>>css.structure: ../../themes/base/core.css 26752//>>css.structure: ../../themes/base/datepicker.css 26753//>>css.theme: ../../themes/base/theme.css 26754 26755( function( factory ) { 26756 "use strict"; 26757 26758 if ( typeof define === "function" && define.amd ) { 26759 26760 // AMD. Register as an anonymous module. 26761 define( [ 26762 "jquery", 26763 "../version", 26764 "../keycode" 26765 ], factory ); 26766 } else { 26767 26768 // Browser globals 26769 factory( jQuery ); 26770 } 26771} )( function( $ ) { 26772"use strict";
vendor: 43,361 bytes, lines 26772-27927
26772 26773 26774$.extend( $.ui, { datepicker: { version: "1.13.3" } } ); 26775 26776var datepicker_instActive; 26777 26778function datepicker_getZindex( elem ) { 26779 var position, value; 26780 while ( elem.length && elem[ 0 ] !== document ) { 26781 26782 // Ignore z-index if position is set to a value where z-index is ignored by the browser 26783 // This makes behavior of this function consistent across browsers 26784 // WebKit always returns auto if the element is positioned 26785 position = elem.css( "position" ); 26786 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 26787 26788 // IE returns 0 when zIndex is not specified 26789 // other browsers return a string 26790 // we ignore the case of nested elements with an explicit value of 0 26791 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 26792 value = parseInt( elem.css( "zIndex" ), 10 ); 26793 if ( !isNaN( value ) && value !== 0 ) { 26794 return value; 26795 } 26796 } 26797 elem = elem.parent(); 26798 } 26799 26800 return 0; 26801} 26802 26803/* Date picker manager. 26804 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 26805 Settings for (groups of) date pickers are maintained in an instance object, 26806 allowing multiple different settings on the same page. */ 26807 26808function Datepicker() { 26809 this._curInst = null; // The current instance in use 26810 this._keyEvent = false; // If the last event was a key event 26811 this._disabledInputs = []; // List of date picker inputs that have been disabled 26812 this._datepickerShowing = false; // True if the popup picker is showing , false if not 26813 this._inDialog = false; // True if showing within a "dialog", false if not 26814 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 26815 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 26816 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 26817 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 26818 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 26819 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 26820 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 26821 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 26822 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 26823 this.regional = []; // Available regional settings, indexed by language code 26824 this.regional[ "" ] = { // Default regional settings 26825 closeText: "Done", // Display text for close link 26826 prevText: "Prev", // Display text for previous month link 26827 nextText: "Next", // Display text for next month link 26828 currentText: "Today", // Display text for current month link 26829 monthNames: [ "January", "February", "March", "April", "May", "June", 26830 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 26831 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 26832 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 26833 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 26834 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 26835 weekHeader: "Wk", // Column header for week of the year 26836 dateFormat: "mm/dd/yy", // See format options on parseDate 26837 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 26838 isRTL: false, // True if right-to-left language, false if left-to-right 26839 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 26840 yearSuffix: "", // Additional text to append to the year in the month headers, 26841 selectMonthLabel: "Select month", // Invisible label for month selector 26842 selectYearLabel: "Select year" // Invisible label for year selector 26843 }; 26844 this._defaults = { // Global defaults for all the date picker instances 26845 showOn: "focus", // "focus" for popup on focus, 26846 // "button" for trigger button, or "both" for either 26847 showAnim: "fadeIn", // Name of jQuery animation for popup 26848 showOptions: {}, // Options for enhanced animations 26849 defaultDate: null, // Used when field is blank: actual date, 26850 // +/-number for offset from today, null for today 26851 appendText: "", // Display text following the input box, e.g. showing the format 26852 buttonText: "...", // Text for trigger button 26853 buttonImage: "", // URL for trigger button image 26854 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 26855 hideIfNoPrevNext: false, // True to hide next/previous month links 26856 // if not applicable, false to just disable them 26857 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 26858 gotoCurrent: false, // True if today link goes back to current selection instead 26859 changeMonth: false, // True if month can be selected directly, false if only prev/next 26860 changeYear: false, // True if year can be selected directly, false if only prev/next 26861 yearRange: "c-10:c+10", // Range of years to display in drop-down, 26862 // either relative to today's year (-nn:+nn), relative to currently displayed year 26863 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 26864 showOtherMonths: false, // True to show dates in other months, false to leave blank 26865 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 26866 showWeek: false, // True to show week of the year, false to not show it 26867 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 26868 // takes a Date and returns the number of the week for it 26869 shortYearCutoff: "+10", // Short year values < this are in the current century, 26870 // > this are in the previous century, 26871 // string value starting with "+" for current year + value 26872 minDate: null, // The earliest selectable date, or null for no limit 26873 maxDate: null, // The latest selectable date, or null for no limit 26874 duration: "fast", // Duration of display/closure 26875 beforeShowDay: null, // Function that takes a date and returns an array with 26876 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 26877 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 26878 beforeShow: null, // Function that takes an input field and 26879 // returns a set of custom settings for the date picker 26880 onSelect: null, // Define a callback function when a date is selected 26881 onChangeMonthYear: null, // Define a callback function when the month or year is changed 26882 onClose: null, // Define a callback function when the datepicker is closed 26883 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 26884 numberOfMonths: 1, // Number of months to show at a time 26885 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 26886 stepMonths: 1, // Number of months to step back/forward 26887 stepBigMonths: 12, // Number of months to step back/forward for the big links 26888 altField: "", // Selector for an alternate field to store selected dates into 26889 altFormat: "", // The date format to use for the alternate field 26890 constrainInput: true, // The input is constrained by the current date format 26891 showButtonPanel: false, // True to show button panel, false to not show it 26892 autoSize: false, // True to size the input for the date format, false to leave as is 26893 disabled: false // The initial disabled state 26894 }; 26895 $.extend( this._defaults, this.regional[ "" ] ); 26896 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 26897 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 26898 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 26899} 26900 26901$.extend( Datepicker.prototype, { 26902 26903 /* Class name added to elements to indicate already configured with a date picker. */ 26904 markerClassName: "hasDatepicker", 26905 26906 //Keep track of the maximum number of rows displayed (see #7043) 26907 maxRows: 4, 26908 26909 // TODO rename to "widget" when switching to widget factory 26910 _widgetDatepicker: function() { 26911 return this.dpDiv; 26912 }, 26913 26914 /* Override the default settings for all instances of the date picker. 26915 * @param settings object - the new settings to use as defaults (anonymous object) 26916 * @return the manager object 26917 */ 26918 setDefaults: function( settings ) { 26919 datepicker_extendRemove( this._defaults, settings || {} ); 26920 return this; 26921 }, 26922 26923 /* Attach the date picker to a jQuery selection. 26924 * @param target element - the target input field or division or span 26925 * @param settings object - the new settings to use for this date picker instance (anonymous) 26926 */ 26927 _attachDatepicker: function( target, settings ) { 26928 var nodeName, inline, inst; 26929 nodeName = target.nodeName.toLowerCase(); 26930 inline = ( nodeName === "div" || nodeName === "span" ); 26931 if ( !target.id ) { 26932 this.uuid += 1; 26933 target.id = "dp" + this.uuid; 26934 } 26935 inst = this._newInst( $( target ), inline ); 26936 inst.settings = $.extend( {}, settings || {} ); 26937 if ( nodeName === "input" ) { 26938 this._connectDatepicker( target, inst ); 26939 } else if ( inline ) { 26940 this._inlineDatepicker( target, inst ); 26941 } 26942 }, 26943 26944 /* Create a new instance object. */ 26945 _newInst: function( target, inline ) { 26946 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 26947 return { id: id, input: target, // associated target 26948 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 26949 drawMonth: 0, drawYear: 0, // month being drawn 26950 inline: inline, // is datepicker inline or not 26951 dpDiv: ( !inline ? this.dpDiv : // presentation div 26952 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 26953 }, 26954 26955 /* Attach the date picker to an input field. */ 26956 _connectDatepicker: function( target, inst ) { 26957 var input = $( target ); 26958 inst.append = $( [] ); 26959 inst.trigger = $( [] ); 26960 if ( input.hasClass( this.markerClassName ) ) { 26961 return; 26962 } 26963 this._attachments( input, inst ); 26964 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 26965 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 26966 this._autoSize( inst ); 26967 $.data( target, "datepicker", inst ); 26968 26969 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 26970 if ( inst.settings.disabled ) { 26971 this._disableDatepicker( target ); 26972 } 26973 }, 26974 26975 /* Make attachments based on settings. */ 26976 _attachments: function( input, inst ) { 26977 var showOn, buttonText, buttonImage, 26978 appendText = this._get( inst, "appendText" ), 26979 isRTL = this._get( inst, "isRTL" ); 26980 26981 if ( inst.append ) { 26982 inst.append.remove(); 26983 } 26984 if ( appendText ) { 26985 inst.append = $( "<span>" ) 26986 .addClass( this._appendClass ) 26987 .text( appendText ); 26988 input[ isRTL ? "before" : "after" ]( inst.append ); 26989 } 26990 26991 input.off( "focus", this._showDatepicker ); 26992 26993 if ( inst.trigger ) { 26994 inst.trigger.remove(); 26995 } 26996 26997 showOn = this._get( inst, "showOn" ); 26998 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 26999 input.on( "focus", this._showDatepicker ); 27000 } 27001 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 27002 buttonText = this._get( inst, "buttonText" ); 27003 buttonImage = this._get( inst, "buttonImage" ); 27004 27005 if ( this._get( inst, "buttonImageOnly" ) ) { 27006 inst.trigger = $( "<img>" ) 27007 .addClass( this._triggerClass ) 27008 .attr( { 27009 src: buttonImage, 27010 alt: buttonText, 27011 title: buttonText 27012 } ); 27013 } else { 27014 inst.trigger = $( "<button type='button'>" ) 27015 .addClass( this._triggerClass ); 27016 if ( buttonImage ) { 27017 inst.trigger.html( 27018 $( "<img>" ) 27019 .attr( { 27020 src: buttonImage, 27021 alt: buttonText, 27022 title: buttonText 27023 } ) 27024 ); 27025 } else { 27026 inst.trigger.text( buttonText ); 27027 } 27028 } 27029 27030 input[ isRTL ? "before" : "after" ]( inst.trigger ); 27031 inst.trigger.on( "click", function() { 27032 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 27033 $.datepicker._hideDatepicker(); 27034 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 27035 $.datepicker._hideDatepicker(); 27036 $.datepicker._showDatepicker( input[ 0 ] ); 27037 } else { 27038 $.datepicker._showDatepicker( input[ 0 ] ); 27039 } 27040 return false; 27041 } ); 27042 } 27043 }, 27044 27045 /* Apply the maximum length for the date format. */ 27046 _autoSize: function( inst ) { 27047 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 27048 var findMax, max, maxI, i, 27049 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 27050 dateFormat = this._get( inst, "dateFormat" ); 27051 27052 if ( dateFormat.match( /[DM]/ ) ) { 27053 findMax = function( names ) { 27054 max = 0; 27055 maxI = 0; 27056 for ( i = 0; i < names.length; i++ ) { 27057 if ( names[ i ].length > max ) { 27058 max = names[ i ].length; 27059 maxI = i; 27060 } 27061 } 27062 return maxI; 27063 }; 27064 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 27065 "monthNames" : "monthNamesShort" ) ) ) ); 27066 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 27067 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 27068 } 27069 inst.input.attr( "size", this._formatDate( inst, date ).length ); 27070 } 27071 }, 27072 27073 /* Attach an inline date picker to a div. */ 27074 _inlineDatepicker: function( target, inst ) { 27075 var divSpan = $( target ); 27076 if ( divSpan.hasClass( this.markerClassName ) ) { 27077 return; 27078 } 27079 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 27080 $.data( target, "datepicker", inst ); 27081 this._setDate( inst, this._getDefaultDate( inst ), true ); 27082 this._updateDatepicker( inst ); 27083 this._updateAlternate( inst ); 27084 27085 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 27086 if ( inst.settings.disabled ) { 27087 this._disableDatepicker( target ); 27088 } 27089 27090 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 27091 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 27092 inst.dpDiv.css( "display", "block" ); 27093 }, 27094 27095 /* Pop-up the date picker in a "dialog" box. 27096 * @param input element - ignored 27097 * @param date string or Date - the initial date to display 27098 * @param onSelect function - the function to call when a date is selected 27099 * @param settings object - update the dialog date picker instance's settings (anonymous object) 27100 * @param pos int[2] - coordinates for the dialog's position within the screen or 27101 * event - with x/y coordinates or 27102 * leave empty for default (screen centre) 27103 * @return the manager object 27104 */ 27105 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 27106 var id, browserWidth, browserHeight, scrollX, scrollY, 27107 inst = this._dialogInst; // internal instance 27108 27109 if ( !inst ) { 27110 this.uuid += 1; 27111 id = "dp" + this.uuid; 27112 this._dialogInput = $( "<input type='text' id='" + id + 27113 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 27114 this._dialogInput.on( "keydown", this._doKeyDown ); 27115 $( "body" ).append( this._dialogInput ); 27116 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 27117 inst.settings = {}; 27118 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 27119 } 27120 datepicker_extendRemove( inst.settings, settings || {} ); 27121 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 27122 this._dialogInput.val( date ); 27123 27124 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 27125 if ( !this._pos ) { 27126 browserWidth = document.documentElement.clientWidth; 27127 browserHeight = document.documentElement.clientHeight; 27128 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 27129 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 27130 this._pos = // should use actual width/height below 27131 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 27132 } 27133 27134 // Move input on screen for focus, but hidden behind dialog 27135 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 27136 inst.settings.onSelect = onSelect; 27137 this._inDialog = true; 27138 this.dpDiv.addClass( this._dialogClass ); 27139 this._showDatepicker( this._dialogInput[ 0 ] ); 27140 if ( $.blockUI ) { 27141 $.blockUI( this.dpDiv ); 27142 } 27143 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 27144 return this; 27145 }, 27146 27147 /* Detach a datepicker from its control. 27148 * @param target element - the target input field or division or span 27149 */ 27150 _destroyDatepicker: function( target ) { 27151 var nodeName, 27152 $target = $( target ), 27153 inst = $.data( target, "datepicker" ); 27154 27155 if ( !$target.hasClass( this.markerClassName ) ) { 27156 return; 27157 } 27158 27159 nodeName = target.nodeName.toLowerCase(); 27160 $.removeData( target, "datepicker" ); 27161 if ( nodeName === "input" ) { 27162 inst.append.remove(); 27163 inst.trigger.remove(); 27164 $target.removeClass( this.markerClassName ). 27165 off( "focus", this._showDatepicker ). 27166 off( "keydown", this._doKeyDown ). 27167 off( "keypress", this._doKeyPress ). 27168 off( "keyup", this._doKeyUp ); 27169 } else if ( nodeName === "div" || nodeName === "span" ) { 27170 $target.removeClass( this.markerClassName ).empty(); 27171 } 27172 27173 if ( datepicker_instActive === inst ) { 27174 datepicker_instActive = null; 27175 this._curInst = null; 27176 } 27177 }, 27178 27179 /* Enable the date picker to a jQuery selection. 27180 * @param target element - the target input field or division or span 27181 */ 27182 _enableDatepicker: function( target ) { 27183 var nodeName, inline, 27184 $target = $( target ), 27185 inst = $.data( target, "datepicker" ); 27186 27187 if ( !$target.hasClass( this.markerClassName ) ) { 27188 return; 27189 } 27190 27191 nodeName = target.nodeName.toLowerCase(); 27192 if ( nodeName === "input" ) { 27193 target.disabled = false; 27194 inst.trigger.filter( "button" ). 27195 each( function() { 27196 this.disabled = false; 27197 } ).end(). 27198 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 27199 } else if ( nodeName === "div" || nodeName === "span" ) { 27200 inline = $target.children( "." + this._inlineClass ); 27201 inline.children().removeClass( "ui-state-disabled" ); 27202 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 27203 prop( "disabled", false ); 27204 } 27205 this._disabledInputs = $.map( this._disabledInputs, 27206 27207 // Delete entry 27208 function( value ) { 27209 return ( value === target ? null : value ); 27210 } ); 27211 }, 27212 27213 /* Disable the date picker to a jQuery selection. 27214 * @param target element - the target input field or division or span 27215 */ 27216 _disableDatepicker: function( target ) { 27217 var nodeName, inline, 27218 $target = $( target ), 27219 inst = $.data( target, "datepicker" ); 27220 27221 if ( !$target.hasClass( this.markerClassName ) ) { 27222 return; 27223 } 27224 27225 nodeName = target.nodeName.toLowerCase(); 27226 if ( nodeName === "input" ) { 27227 target.disabled = true; 27228 inst.trigger.filter( "button" ). 27229 each( function() { 27230 this.disabled = true; 27231 } ).end(). 27232 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 27233 } else if ( nodeName === "div" || nodeName === "span" ) { 27234 inline = $target.children( "." + this._inlineClass ); 27235 inline.children().addClass( "ui-state-disabled" ); 27236 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 27237 prop( "disabled", true ); 27238 } 27239 this._disabledInputs = $.map( this._disabledInputs, 27240 27241 // Delete entry 27242 function( value ) { 27243 return ( value === target ? null : value ); 27244 } ); 27245 this._disabledInputs[ this._disabledInputs.length ] = target; 27246 }, 27247 27248 /* Is the first field in a jQuery collection disabled as a datepicker? 27249 * @param target element - the target input field or division or span 27250 * @return boolean - true if disabled, false if enabled 27251 */ 27252 _isDisabledDatepicker: function( target ) { 27253 if ( !target ) { 27254 return false; 27255 } 27256 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 27257 if ( this._disabledInputs[ i ] === target ) { 27258 return true; 27259 } 27260 } 27261 return false; 27262 }, 27263 27264 /* Retrieve the instance data for the target control. 27265 * @param target element - the target input field or division or span 27266 * @return object - the associated instance data 27267 * @throws error if a jQuery problem getting data 27268 */ 27269 _getInst: function( target ) { 27270 try { 27271 return $.data( target, "datepicker" ); 27272 } catch ( err ) { 27273 throw "Missing instance data for this datepicker"; 27274 } 27275 }, 27276 27277 /* Update or retrieve the settings for a date picker attached to an input field or division. 27278 * @param target element - the target input field or division or span 27279 * @param name object - the new settings to update or 27280 * string - the name of the setting to change or retrieve, 27281 * when retrieving also "all" for all instance settings or 27282 * "defaults" for all global defaults 27283 * @param value any - the new value for the setting 27284 * (omit if above is an object or to retrieve a value) 27285 */ 27286 _optionDatepicker: function( target, name, value ) { 27287 var settings, date, minDate, maxDate, 27288 inst = this._getInst( target ); 27289 27290 if ( arguments.length === 2 && typeof name === "string" ) { 27291 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 27292 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 27293 this._get( inst, name ) ) : null ) ); 27294 } 27295 27296 settings = name || {}; 27297 if ( typeof name === "string" ) { 27298 settings = {}; 27299 settings[ name ] = value; 27300 } 27301 27302 if ( inst ) { 27303 if ( this._curInst === inst ) { 27304 this._hideDatepicker(); 27305 } 27306 27307 date = this._getDateDatepicker( target, true ); 27308 minDate = this._getMinMaxDate( inst, "min" ); 27309 maxDate = this._getMinMaxDate( inst, "max" ); 27310 datepicker_extendRemove( inst.settings, settings ); 27311 27312 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 27313 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 27314 inst.settings.minDate = this._formatDate( inst, minDate ); 27315 } 27316 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 27317 inst.settings.maxDate = this._formatDate( inst, maxDate ); 27318 } 27319 if ( "disabled" in settings ) { 27320 if ( settings.disabled ) { 27321 this._disableDatepicker( target ); 27322 } else { 27323 this._enableDatepicker( target ); 27324 } 27325 } 27326 this._attachments( $( target ), inst ); 27327 this._autoSize( inst ); 27328 this._setDate( inst, date ); 27329 this._updateAlternate( inst ); 27330 this._updateDatepicker( inst ); 27331 } 27332 }, 27333 27334 // Change method deprecated 27335 _changeDatepicker: function( target, name, value ) { 27336 this._optionDatepicker( target, name, value ); 27337 }, 27338 27339 /* Redraw the date picker attached to an input field or division. 27340 * @param target element - the target input field or division or span 27341 */ 27342 _refreshDatepicker: function( target ) { 27343 var inst = this._getInst( target ); 27344 if ( inst ) { 27345 this._updateDatepicker( inst ); 27346 } 27347 }, 27348 27349 /* Set the dates for a jQuery selection. 27350 * @param target element - the target input field or division or span 27351 * @param date Date - the new date 27352 */ 27353 _setDateDatepicker: function( target, date ) { 27354 var inst = this._getInst( target ); 27355 if ( inst ) { 27356 this._setDate( inst, date ); 27357 this._updateDatepicker( inst ); 27358 this._updateAlternate( inst ); 27359 } 27360 }, 27361 27362 /* Get the date(s) for the first entry in a jQuery selection. 27363 * @param target element - the target input field or division or span 27364 * @param noDefault boolean - true if no default date is to be used 27365 * @return Date - the current date 27366 */ 27367 _getDateDatepicker: function( target, noDefault ) { 27368 var inst = this._getInst( target ); 27369 if ( inst && !inst.inline ) { 27370 this._setDateFromField( inst, noDefault ); 27371 } 27372 return ( inst ? this._getDate( inst ) : null ); 27373 }, 27374 27375 /* Handle keystrokes. */ 27376 _doKeyDown: function( event ) { 27377 var onSelect, dateStr, sel, 27378 inst = $.datepicker._getInst( event.target ), 27379 handled = true, 27380 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 27381 27382 inst._keyEvent = true; 27383 if ( $.datepicker._datepickerShowing ) { 27384 switch ( event.keyCode ) { 27385 case 9: $.datepicker._hideDatepicker(); 27386 handled = false; 27387 break; // hide on tab out 27388 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 27389 $.datepicker._currentClass + ")", inst.dpDiv ); 27390 if ( sel[ 0 ] ) { 27391 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 27392 } 27393 27394 onSelect = $.datepicker._get( inst, "onSelect" ); 27395 if ( onSelect ) { 27396 dateStr = $.datepicker._formatDate( inst ); 27397 27398 // Trigger custom callback 27399 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 27400 } else { 27401 $.datepicker._hideDatepicker(); 27402 } 27403 27404 return false; // don't submit the form 27405 case 27: $.datepicker._hideDatepicker(); 27406 break; // hide on escape 27407 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 27408 -$.datepicker._get( inst, "stepBigMonths" ) : 27409 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 27410 break; // previous month/year on page up/+ ctrl 27411 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 27412 +$.datepicker._get( inst, "stepBigMonths" ) : 27413 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 27414 break; // next month/year on page down/+ ctrl 27415 case 35: if ( event.ctrlKey || event.metaKey ) { 27416 $.datepicker._clearDate( event.target ); 27417 } 27418 handled = event.ctrlKey || event.metaKey; 27419 break; // clear on ctrl or command +end 27420 case 36: if ( event.ctrlKey || event.metaKey ) { 27421 $.datepicker._gotoToday( event.target ); 27422 } 27423 handled = event.ctrlKey || event.metaKey; 27424 break; // current on ctrl or command +home 27425 case 37: if ( event.ctrlKey || event.metaKey ) { 27426 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 27427 } 27428 handled = event.ctrlKey || event.metaKey; 27429 27430 // -1 day on ctrl or command +left 27431 if ( event.originalEvent.altKey ) { 27432 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 27433 -$.datepicker._get( inst, "stepBigMonths" ) : 27434 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 27435 } 27436 27437 // next month/year on alt +left on Mac 27438 break; 27439 case 38: if ( event.ctrlKey || event.metaKey ) { 27440 $.datepicker._adjustDate( event.target, -7, "D" ); 27441 } 27442 handled = event.ctrlKey || event.metaKey; 27443 break; // -1 week on ctrl or command +up 27444 case 39: if ( event.ctrlKey || event.metaKey ) { 27445 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 27446 } 27447 handled = event.ctrlKey || event.metaKey; 27448 27449 // +1 day on ctrl or command +right 27450 if ( event.originalEvent.altKey ) { 27451 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 27452 +$.datepicker._get( inst, "stepBigMonths" ) : 27453 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 27454 } 27455 27456 // next month/year on alt +right 27457 break; 27458 case 40: if ( event.ctrlKey || event.metaKey ) { 27459 $.datepicker._adjustDate( event.target, +7, "D" ); 27460 } 27461 handled = event.ctrlKey || event.metaKey; 27462 break; // +1 week on ctrl or command +down 27463 default: handled = false; 27464 } 27465 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 27466 $.datepicker._showDatepicker( this ); 27467 } else { 27468 handled = false; 27469 } 27470 27471 if ( handled ) { 27472 event.preventDefault(); 27473 event.stopPropagation(); 27474 } 27475 }, 27476 27477 /* Filter entered characters - based on date format. */ 27478 _doKeyPress: function( event ) { 27479 var chars, chr, 27480 inst = $.datepicker._getInst( event.target ); 27481 27482 if ( $.datepicker._get( inst, "constrainInput" ) ) { 27483 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 27484 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 27485 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 27486 } 27487 }, 27488 27489 /* Synchronise manual entry and field/alternate field. */ 27490 _doKeyUp: function( event ) { 27491 var date, 27492 inst = $.datepicker._getInst( event.target ); 27493 27494 if ( inst.input.val() !== inst.lastVal ) { 27495 try { 27496 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 27497 ( inst.input ? inst.input.val() : null ), 27498 $.datepicker._getFormatConfig( inst ) ); 27499 27500 if ( date ) { // only if valid 27501 $.datepicker._setDateFromField( inst ); 27502 $.datepicker._updateAlternate( inst ); 27503 $.datepicker._updateDatepicker( inst ); 27504 } 27505 } catch ( err ) { 27506 } 27507 } 27508 return true; 27509 }, 27510 27511 /* Pop-up the date picker for a given input field. 27512 * If false returned from beforeShow event handler do not show. 27513 * @param input element - the input field attached to the date picker or 27514 * event - if triggered by focus 27515 */ 27516 _showDatepicker: function( input ) { 27517 input = input.target || input; 27518 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 27519 input = $( "input", input.parentNode )[ 0 ]; 27520 } 27521 27522 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 27523 return; 27524 } 27525 27526 var inst, beforeShow, beforeShowSettings, isFixed, 27527 offset, showAnim, duration; 27528 27529 inst = $.datepicker._getInst( input ); 27530 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 27531 $.datepicker._curInst.dpDiv.stop( true, true ); 27532 if ( inst && $.datepicker._datepickerShowing ) { 27533 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 27534 } 27535 } 27536 27537 beforeShow = $.datepicker._get( inst, "beforeShow" ); 27538 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 27539 if ( beforeShowSettings === false ) { 27540 return; 27541 } 27542 datepicker_extendRemove( inst.settings, beforeShowSettings ); 27543 27544 inst.lastVal = null; 27545 $.datepicker._lastInput = input; 27546 $.datepicker._setDateFromField( inst ); 27547 27548 if ( $.datepicker._inDialog ) { // hide cursor 27549 input.value = ""; 27550 } 27551 if ( !$.datepicker._pos ) { // position below input 27552 $.datepicker._pos = $.datepicker._findPos( input ); 27553 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 27554 } 27555 27556 isFixed = false; 27557 $( input ).parents().each( function() { 27558 isFixed |= $( this ).css( "position" ) === "fixed"; 27559 return !isFixed; 27560 } ); 27561 27562 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 27563 $.datepicker._pos = null; 27564 27565 //to avoid flashes on Firefox 27566 inst.dpDiv.empty(); 27567 27568 // determine sizing offscreen 27569 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 27570 $.datepicker._updateDatepicker( inst ); 27571 27572 // fix width for dynamic number of date pickers 27573 // and adjust position before showing 27574 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 27575 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 27576 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 27577 left: offset.left + "px", top: offset.top + "px" } ); 27578 27579 if ( !inst.inline ) { 27580 showAnim = $.datepicker._get( inst, "showAnim" ); 27581 duration = $.datepicker._get( inst, "duration" ); 27582 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 27583 $.datepicker._datepickerShowing = true; 27584 27585 if ( $.effects && $.effects.effect[ showAnim ] ) { 27586 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 27587 } else { 27588 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 27589 } 27590 27591 if ( $.datepicker._shouldFocusInput( inst ) ) { 27592 inst.input.trigger( "focus" ); 27593 } 27594 27595 $.datepicker._curInst = inst; 27596 } 27597 }, 27598 27599 /* Generate the date picker content. */ 27600 _updateDatepicker: function( inst ) { 27601 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 27602 datepicker_instActive = inst; // for delegate hover events 27603 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 27604 this._attachHandlers( inst ); 27605 27606 var origyearshtml, 27607 numMonths = this._getNumberOfMonths( inst ), 27608 cols = numMonths[ 1 ], 27609 width = 17, 27610 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 27611 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 27612 27613 if ( activeCell.length > 0 ) { 27614 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 27615 } 27616 27617 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 27618 if ( cols > 1 ) { 27619 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 27620 } 27621 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 27622 "Class" ]( "ui-datepicker-multi" ); 27623 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 27624 "Class" ]( "ui-datepicker-rtl" ); 27625 27626 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 27627 inst.input.trigger( "focus" ); 27628 } 27629 27630 // Deffered render of the years select (to avoid flashes on Firefox) 27631 if ( inst.yearshtml ) { 27632 origyearshtml = inst.yearshtml; 27633 setTimeout( function() { 27634 27635 //assure that inst.yearshtml didn't change. 27636 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 27637 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 27638 } 27639 origyearshtml = inst.yearshtml = null; 27640 }, 0 ); 27641 } 27642 27643 if ( onUpdateDatepicker ) { 27644 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 27645 } 27646 }, 27647 27648 // #6694 - don't focus the input if it's already focused 27649 // this breaks the change event in IE 27650 // Support: IE and jQuery <1.9 27651 _shouldFocusInput: function( inst ) { 27652 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); 27653 }, 27654 27655 /* Check positioning to remain on screen. */ 27656 _checkOffset: function( inst, offset, isFixed ) { 27657 var dpWidth = inst.dpDiv.outerWidth(), 27658 dpHeight = inst.dpDiv.outerHeight(), 27659 inputWidth = inst.input ? inst.input.outerWidth() : 0, 27660 inputHeight = inst.input ? inst.input.outerHeight() : 0, 27661 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 27662 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 27663 27664 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 27665 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 27666 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 27667 27668 // Now check if datepicker is showing outside window viewport - move to a better place if so. 27669 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 27670 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 27671 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 27672 Math.abs( dpHeight + inputHeight ) : 0 ); 27673 27674 return offset; 27675 }, 27676 27677 /* Find an object's position on the screen. */ 27678 _findPos: function( obj ) { 27679 var position, 27680 inst = this._getInst( obj ), 27681 isRTL = this._get( inst, "isRTL" ); 27682 27683 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 27684 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 27685 } 27686 27687 position = $( obj ).offset(); 27688 return [ position.left, position.top ]; 27689 }, 27690 27691 /* Hide the date picker from view. 27692 * @param input element - the input field attached to the date picker 27693 */ 27694 _hideDatepicker: function( input ) { 27695 var showAnim, duration, postProcess, onClose, 27696 inst = this._curInst; 27697 27698 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 27699 return; 27700 } 27701 27702 if ( this._datepickerShowing ) { 27703 showAnim = this._get( inst, "showAnim" ); 27704 duration = this._get( inst, "duration" ); 27705 postProcess = function() { 27706 $.datepicker._tidyDialog( inst ); 27707 }; 27708 27709 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 27710 if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { 27711 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 27712 } else { 27713 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 27714 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 27715 } 27716 27717 if ( !showAnim ) { 27718 postProcess(); 27719 } 27720 this._datepickerShowing = false; 27721 27722 onClose = this._get( inst, "onClose" ); 27723 if ( onClose ) { 27724 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 27725 } 27726 27727 this._lastInput = null; 27728 if ( this._inDialog ) { 27729 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 27730 if ( $.blockUI ) { 27731 $.unblockUI(); 27732 $( "body" ).append( this.dpDiv ); 27733 } 27734 } 27735 this._inDialog = false; 27736 } 27737 }, 27738 27739 /* Tidy up after a dialog display. */ 27740 _tidyDialog: function( inst ) { 27741 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 27742 }, 27743 27744 /* Close date picker if clicked elsewhere. */ 27745 _checkExternalClick: function( event ) { 27746 if ( !$.datepicker._curInst ) { 27747 return; 27748 } 27749 27750 var $target = $( event.target ), 27751 inst = $.datepicker._getInst( $target[ 0 ] ); 27752 27753 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 27754 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 27755 !$target.hasClass( $.datepicker.markerClassName ) && 27756 !$target.closest( "." + $.datepicker._triggerClass ).length && 27757 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 27758 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 27759 $.datepicker._hideDatepicker(); 27760 } 27761 }, 27762 27763 /* Adjust one of the date sub-fields. */ 27764 _adjustDate: function( id, offset, period ) { 27765 var target = $( id ), 27766 inst = this._getInst( target[ 0 ] ); 27767 27768 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 27769 return; 27770 } 27771 this._adjustInstDate( inst, offset, period ); 27772 this._updateDatepicker( inst ); 27773 }, 27774 27775 /* Action for current link. */ 27776 _gotoToday: function( id ) { 27777 var date, 27778 target = $( id ), 27779 inst = this._getInst( target[ 0 ] ); 27780 27781 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 27782 inst.selectedDay = inst.currentDay; 27783 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 27784 inst.drawYear = inst.selectedYear = inst.currentYear; 27785 } else { 27786 date = new Date(); 27787 inst.selectedDay = date.getDate(); 27788 inst.drawMonth = inst.selectedMonth = date.getMonth(); 27789 inst.drawYear = inst.selectedYear = date.getFullYear(); 27790 } 27791 this._notifyChange( inst ); 27792 this._adjustDate( target ); 27793 }, 27794 27795 /* Action for selecting a new month/year. */ 27796 _selectMonthYear: function( id, select, period ) { 27797 var target = $( id ), 27798 inst = this._getInst( target[ 0 ] ); 27799 27800 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 27801 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 27802 parseInt( select.options[ select.selectedIndex ].value, 10 ); 27803 27804 this._notifyChange( inst ); 27805 this._adjustDate( target ); 27806 }, 27807 27808 /* Action for selecting a day. */ 27809 _selectDay: function( id, month, year, td ) { 27810 var inst, 27811 target = $( id ); 27812 27813 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 27814 return; 27815 } 27816 27817 inst = this._getInst( target[ 0 ] ); 27818 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 27819 inst.selectedMonth = inst.currentMonth = month; 27820 inst.selectedYear = inst.currentYear = year; 27821 this._selectDate( id, this._formatDate( inst, 27822 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 27823 }, 27824 27825 /* Erase the input field and hide the date picker. */ 27826 _clearDate: function( id ) { 27827 var target = $( id ); 27828 this._selectDate( target, "" ); 27829 }, 27830 27831 /* Update the input field with the selected date. */ 27832 _selectDate: function( id, dateStr ) { 27833 var onSelect, 27834 target = $( id ), 27835 inst = this._getInst( target[ 0 ] ); 27836 27837 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 27838 if ( inst.input ) { 27839 inst.input.val( dateStr ); 27840 } 27841 this._updateAlternate( inst ); 27842 27843 onSelect = this._get( inst, "onSelect" ); 27844 if ( onSelect ) { 27845 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 27846 } else if ( inst.input ) { 27847 inst.input.trigger( "change" ); // fire the change event 27848 } 27849 27850 if ( inst.inline ) { 27851 this._updateDatepicker( inst ); 27852 } else { 27853 this._hideDatepicker(); 27854 this._lastInput = inst.input[ 0 ]; 27855 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 27856 inst.input.trigger( "focus" ); // restore focus 27857 } 27858 this._lastInput = null; 27859 } 27860 }, 27861 27862 /* Update any alternate field to synchronise with the main field. */ 27863 _updateAlternate: function( inst ) { 27864 var altFormat, date, dateStr, 27865 altField = this._get( inst, "altField" ); 27866 27867 if ( altField ) { // update alternate field too 27868 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 27869 date = this._getDate( inst ); 27870 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 27871 $( document ).find( altField ).val( dateStr ); 27872 } 27873 }, 27874 27875 /* Set as beforeShowDay function to prevent selection of weekends. 27876 * @param date Date - the date to customise 27877 * @return [boolean, string] - is this date selectable?, what is its CSS class? 27878 */ 27879 noWeekends: function( date ) { 27880 var day = date.getDay(); 27881 return [ ( day > 0 && day < 6 ), "" ]; 27882 }, 27883 27884 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 27885 * @param date Date - the date to get the week for 27886 * @return number - the number of the week within the year that contains this date 27887 */ 27888 iso8601Week: function( date ) { 27889 var time, 27890 checkDate = new Date( date.getTime() ); 27891 27892 // Find Thursday of this week starting on Monday 27893 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 27894 27895 time = checkDate.getTime(); 27896 checkDate.setMonth( 0 ); // Compare with Jan 1 27897 checkDate.setDate( 1 ); 27898 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 27899 }, 27900 27901 /* Parse a string value into a date object. 27902 * See formatDate below for the possible formats. 27903 * 27904 * @param format string - the expected format of the date 27905 * @param value string - the date in the above format 27906 * @param settings Object - attributes include: 27907 * shortYearCutoff number - the cutoff year for determining the century (optional) 27908 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 27909 * dayNames string[7] - names of the days from Sunday (optional) 27910 * monthNamesShort string[12] - abbreviated names of the months (optional) 27911 * monthNames string[12] - names of the months (optional) 27912 * @return Date - the extracted date value or null if value is blank 27913 */ 27914 parseDate: function( format, value, settings ) { 27915 if ( format == null || value == null ) { 27916 throw "Invalid arguments"; 27917 } 27918 27919 value = ( typeof value === "object" ? value.toString() : value + "" ); 27920 if ( value === "" ) { 27921 return null; 27922 } 27923 27924 var iFormat, dim, extra, 27925 iValue = 0, 27926 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 27927 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 5,431 bytes, lines 27927-28117
27927: 27928 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 27929 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 27930 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 27931 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 27932 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 27933 year = -1, 27934 month = -1, 27935 day = -1, 27936 doy = -1, 27937 literal = false, 27938 date, 27939 27940 // Check whether a format character is doubled 27941 lookAhead = function( match ) { 27942 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 27943 if ( matches ) { 27944 iFormat++; 27945 } 27946 return matches; 27947 }, 27948 27949 // Extract a number from the string value 27950 getNumber = function( match ) { 27951 var isDoubled = lookAhead( match ), 27952 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 27953 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 27954 minSize = ( match === "y" ? size : 1 ), 27955 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 27956 num = value.substring( iValue ).match( digits ); 27957 if ( !num ) { 27958 throw "Missing number at position " + iValue; 27959 } 27960 iValue += num[ 0 ].length; 27961 return parseInt( num[ 0 ], 10 ); 27962 }, 27963 27964 // Extract a name from the string value and convert to an index 27965 getName = function( match, shortNames, longNames ) { 27966 var index = -1, 27967 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 27968 return [ [ k, v ] ]; 27969 } ).sort( function( a, b ) { 27970 return -( a[ 1 ].length - b[ 1 ].length ); 27971 } ); 27972 27973 $.each( names, function( i, pair ) { 27974 var name = pair[ 1 ]; 27975 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 27976 index = pair[ 0 ]; 27977 iValue += name.length; 27978 return false; 27979 } 27980 } ); 27981 if ( index !== -1 ) { 27982 return index + 1; 27983 } else { 27984 throw "Unknown name at position " + iValue; 27985 } 27986 }, 27987 27988 // Confirm that a literal character matches the string value 27989 checkLiteral = function() { 27990 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 27991 throw "Unexpected literal at position " + iValue; 27992 } 27993 iValue++; 27994 }; 27995 27996 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 27997 if ( literal ) { 27998 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 27999 literal = false; 28000 } else { 28001 checkLiteral(); 28002 } 28003 } else { 28004 switch ( format.charAt( iFormat ) ) { 28005 case "d": 28006 day = getNumber( "d" ); 28007 break; 28008 case "D": 28009 getName( "D", dayNamesShort, dayNames ); 28010 break; 28011 case "o": 28012 doy = getNumber( "o" ); 28013 break; 28014 case "m": 28015 month = getNumber( "m" ); 28016 break; 28017 case "M": 28018 month = getName( "M", monthNamesShort, monthNames ); 28019 break; 28020 case "y": 28021 year = getNumber( "y" ); 28022 break; 28023 case "@": 28024 date = new Date( getNumber( "@" ) ); 28025 year = date.getFullYear(); 28026 month = date.getMonth() + 1; 28027 day = date.getDate(); 28028 break; 28029 case "!": 28030 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 28031 year = date.getFullYear(); 28032 month = date.getMonth() + 1; 28033 day = date.getDate(); 28034 break; 28035 case "'": 28036 if ( lookAhead( "'" ) ) { 28037 checkLiteral(); 28038 } else { 28039 literal = true; 28040 } 28041 break; 28042 default: 28043 checkLiteral(); 28044 } 28045 } 28046 } 28047 28048 if ( iValue < value.length ) { 28049 extra = value.substr( iValue ); 28050 if ( !/^\s+/.test( extra ) ) { 28051 throw "Extra/unparsed characters found in date: " + extra; 28052 } 28053 } 28054 28055 if ( year === -1 ) { 28056 year = new Date().getFullYear(); 28057 } else if ( year < 100 ) { 28058 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 28059 ( year <= shortYearCutoff ? 0 : -100 ); 28060 } 28061 28062 if ( doy > -1 ) { 28063 month = 1; 28064 day = doy; 28065 do { 28066 dim = this._getDaysInMonth( year, month - 1 ); 28067 if ( day <= dim ) { 28068 break; 28069 } 28070 month++; 28071 day -= dim; 28072 } while ( true ); 28073 } 28074 28075 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 28076 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 28077 throw "Invalid date"; // E.g. 31/02/00 28078 } 28079 return date; 28080 }, 28081 28082 /* Standard date formats. */ 28083 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 28084 COOKIE: "D, dd M yy", 28085 ISO_8601: "yy-mm-dd", 28086 RFC_822: "D, d M y", 28087 RFC_850: "DD, dd-M-y", 28088 RFC_1036: "D, d M y", 28089 RFC_1123: "D, d M yy", 28090 RFC_2822: "D, d M yy", 28091 RSS: "D, d M y", // RFC 822 28092 TICKS: "!", 28093 TIMESTAMP: "@", 28094 W3C: "yy-mm-dd", // ISO 8601 28095 28096 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 28097 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 28098 28099 /* Format a date object into a string value. 28100 * The format can be combinations of the following: 28101 * d - day of month (no leading zero) 28102 * dd - day of month (two digit) 28103 * o - day of year (no leading zeros) 28104 * oo - day of year (three digit) 28105 * D - day name short 28106 * DD - day name long 28107 * m - month of year (no leading zero) 28108 * mm - month of year (two digit) 28109 * M - month name short 28110 * MM - month name long 28111 * y - year (two digit) 28112 * yy - year (four digit) 28113 * @ - Unix timestamp (ms since 01/01/1970) 28114 * ! - Windows ticks (100ns since 01/01/0001) 28115 * "..." - literal text 28116 * '' - single quote 28117 *
vendor: 6,198 bytes, lines 28118-28317
28118 * @param format string - the desired format of the date 28119 * @param date Date - the date value to format 28120 * @param settings Object - attributes include: 28121 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 28122 * dayNames string[7] - names of the days from Sunday (optional) 28123 * monthNamesShort string[12] - abbreviated names of the months (optional) 28124 * monthNames string[12] - names of the months (optional) 28125 * @return string - the date in the above format 28126 */ 28127 formatDate: function( format, date, settings ) { 28128 if ( !date ) { 28129 return ""; 28130 } 28131 28132 var iFormat, 28133 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 28134 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 28135 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 28136 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 28137 28138 // Check whether a format character is doubled 28139 lookAhead = function( match ) { 28140 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 28141 if ( matches ) { 28142 iFormat++; 28143 } 28144 return matches; 28145 }, 28146 28147 // Format a number, with leading zero if necessary 28148 formatNumber = function( match, value, len ) { 28149 var num = "" + value; 28150 if ( lookAhead( match ) ) { 28151 while ( num.length < len ) { 28152 num = "0" + num; 28153 } 28154 } 28155 return num; 28156 }, 28157 28158 // Format a name, short or long as requested 28159 formatName = function( match, value, shortNames, longNames ) { 28160 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 28161 }, 28162 output = "", 28163 literal = false; 28164 28165 if ( date ) { 28166 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 28167 if ( literal ) { 28168 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 28169 literal = false; 28170 } else { 28171 output += format.charAt( iFormat ); 28172 } 28173 } else { 28174 switch ( format.charAt( iFormat ) ) { 28175 case "d": 28176 output += formatNumber( "d", date.getDate(), 2 ); 28177 break; 28178 case "D": 28179 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 28180 break; 28181 case "o": 28182 output += formatNumber( "o", 28183 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 28184 break; 28185 case "m": 28186 output += formatNumber( "m", date.getMonth() + 1, 2 ); 28187 break; 28188 case "M": 28189 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 28190 break; 28191 case "y": 28192 output += ( lookAhead( "y" ) ? date.getFullYear() : 28193 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 28194 break; 28195 case "@": 28196 output += date.getTime(); 28197 break; 28198 case "!": 28199 output += date.getTime() * 10000 + this._ticksTo1970; 28200 break; 28201 case "'": 28202 if ( lookAhead( "'" ) ) { 28203 output += "'"; 28204 } else { 28205 literal = true; 28206 } 28207 break; 28208 default: 28209 output += format.charAt( iFormat ); 28210 } 28211 } 28212 } 28213 } 28214 return output; 28215 }, 28216 28217 /* Extract all possible characters from the date format. */ 28218 _possibleChars: function( format ) { 28219 var iFormat, 28220 chars = "", 28221 literal = false, 28222 28223 // Check whether a format character is doubled 28224 lookAhead = function( match ) { 28225 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 28226 if ( matches ) { 28227 iFormat++; 28228 } 28229 return matches; 28230 }; 28231 28232 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 28233 if ( literal ) { 28234 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 28235 literal = false; 28236 } else { 28237 chars += format.charAt( iFormat ); 28238 } 28239 } else { 28240 switch ( format.charAt( iFormat ) ) { 28241 case "d": case "m": case "y": case "@": 28242 chars += "0123456789"; 28243 break; 28244 case "D": case "M": 28245 return null; // Accept anything 28246 case "'": 28247 if ( lookAhead( "'" ) ) { 28248 chars += "'"; 28249 } else { 28250 literal = true; 28251 } 28252 break; 28253 default: 28254 chars += format.charAt( iFormat ); 28255 } 28256 } 28257 } 28258 return chars; 28259 }, 28260 28261 /* Get a setting value, defaulting if necessary. */ 28262 _get: function( inst, name ) { 28263 return inst.settings[ name ] !== undefined ? 28264 inst.settings[ name ] : this._defaults[ name ]; 28265 }, 28266 28267 /* Parse existing date and initialise date picker. */ 28268 _setDateFromField: function( inst, noDefault ) { 28269 if ( inst.input.val() === inst.lastVal ) { 28270 return; 28271 } 28272 28273 var dateFormat = this._get( inst, "dateFormat" ), 28274 dates = inst.lastVal = inst.input ? inst.input.val() : null, 28275 defaultDate = this._getDefaultDate( inst ), 28276 date = defaultDate, 28277 settings = this._getFormatConfig( inst ); 28278 28279 try { 28280 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 28281 } catch ( event ) { 28282 dates = ( noDefault ? "" : dates ); 28283 } 28284 inst.selectedDay = date.getDate(); 28285 inst.drawMonth = inst.selectedMonth = date.getMonth(); 28286 inst.drawYear = inst.selectedYear = date.getFullYear(); 28287 inst.currentDay = ( dates ? date.getDate() : 0 ); 28288 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 28289 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 28290 this._adjustInstDate( inst ); 28291 }, 28292 28293 /* Retrieve the default date shown on opening. */ 28294 _getDefaultDate: function( inst ) { 28295 return this._restrictMinMax( inst, 28296 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 28297 }, 28298 28299 /* A date may be specified as an exact value or a relative one. */ 28300 _determineDate: function( inst, date, defaultDate ) { 28301 var offsetNumeric = function( offset ) { 28302 var date = new Date(); 28303 date.setDate( date.getDate() + offset ); 28304 return date; 28305 }, 28306 offsetString = function( offset ) { 28307 try { 28308 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 28309 offset, $.datepicker._getFormatConfig( inst ) ); 28310 } catch ( e ) { 28311 28312 // Ignore 28313 } 28314 28315 var date = ( offset.toLowerCase().match( /^c/ ) ? 28316 $.datepicker._getDate( inst ) : null ) || new Date(), 28317 year = date.getFullYear(),
vendor: 5,359 bytes, lines 28318-28456
28318 month = date.getMonth(), 28319 day = date.getDate(), 28320 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 28321 matches = pattern.exec( offset ); 28322 28323 while ( matches ) { 28324 switch ( matches[ 2 ] || "d" ) { 28325 case "d" : case "D" : 28326 day += parseInt( matches[ 1 ], 10 ); break; 28327 case "w" : case "W" : 28328 day += parseInt( matches[ 1 ], 10 ) * 7; break; 28329 case "m" : case "M" : 28330 month += parseInt( matches[ 1 ], 10 ); 28331 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 28332 break; 28333 case "y": case "Y" : 28334 year += parseInt( matches[ 1 ], 10 ); 28335 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 28336 break; 28337 } 28338 matches = pattern.exec( offset ); 28339 } 28340 return new Date( year, month, day ); 28341 }, 28342 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 28343 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 28344 28345 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 28346 if ( newDate ) { 28347 newDate.setHours( 0 ); 28348 newDate.setMinutes( 0 ); 28349 newDate.setSeconds( 0 ); 28350 newDate.setMilliseconds( 0 ); 28351 } 28352 return this._daylightSavingAdjust( newDate ); 28353 }, 28354 28355 /* Handle switch to/from daylight saving. 28356 * Hours may be non-zero on daylight saving cut-over: 28357 * > 12 when midnight changeover, but then cannot generate 28358 * midnight datetime, so jump to 1AM, otherwise reset. 28359 * @param date (Date) the date to check 28360 * @return (Date) the corrected date 28361 */ 28362 _daylightSavingAdjust: function( date ) { 28363 if ( !date ) { 28364 return null; 28365 } 28366 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 28367 return date; 28368 }, 28369 28370 /* Set the date(s) directly. */ 28371 _setDate: function( inst, date, noChange ) { 28372 var clear = !date, 28373 origMonth = inst.selectedMonth, 28374 origYear = inst.selectedYear, 28375 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 28376 28377 inst.selectedDay = inst.currentDay = newDate.getDate(); 28378 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 28379 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 28380 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 28381 this._notifyChange( inst ); 28382 } 28383 this._adjustInstDate( inst ); 28384 if ( inst.input ) { 28385 inst.input.val( clear ? "" : this._formatDate( inst ) ); 28386 } 28387 }, 28388 28389 /* Retrieve the date(s) directly. */ 28390 _getDate: function( inst ) { 28391 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 28392 this._daylightSavingAdjust( new Date( 28393 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 28394 return startDate; 28395 }, 28396 28397 /* Attach the onxxx handlers. These are declared statically so 28398 * they work with static code transformers like Caja. 28399 */ 28400 _attachHandlers: function( inst ) { 28401 var stepMonths = this._get( inst, "stepMonths" ), 28402 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 28403 inst.dpDiv.find( "[data-handler]" ).map( function() { 28404 var handler = { 28405 prev: function() { 28406 $.datepicker._adjustDate( id, -stepMonths, "M" ); 28407 }, 28408 next: function() { 28409 $.datepicker._adjustDate( id, +stepMonths, "M" ); 28410 }, 28411 hide: function() { 28412 $.datepicker._hideDatepicker(); 28413 }, 28414 today: function() { 28415 $.datepicker._gotoToday( id ); 28416 }, 28417 selectDay: function() { 28418 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 28419 return false; 28420 }, 28421 selectMonth: function() { 28422 $.datepicker._selectMonthYear( id, this, "M" ); 28423 return false; 28424 }, 28425 selectYear: function() { 28426 $.datepicker._selectMonthYear( id, this, "Y" ); 28427 return false; 28428 } 28429 }; 28430 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 28431 } ); 28432 }, 28433 28434 /* Generate the HTML for the current state of the date picker. */ 28435 _generateHTML: function( inst ) { 28436 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 28437 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 28438 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 28439 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 28440 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 28441 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 28442 tempDate = new Date(), 28443 today = this._daylightSavingAdjust( 28444 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 28445 isRTL = this._get( inst, "isRTL" ), 28446 showButtonPanel = this._get( inst, "showButtonPanel" ), 28447 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 28448 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 28449 numMonths = this._getNumberOfMonths( inst ), 28450 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 28451 stepMonths = this._get( inst, "stepMonths" ), 28452 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 28453 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 28454 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 28455 minDate = this._getMinMaxDate( inst, "min" ), 28456 maxDate = this._getMinMaxDate( inst, "max" ),
vendor: 21,264 bytes, lines 28457-28972
28457 drawMonth = inst.drawMonth - showCurrentAtPos, 28458 drawYear = inst.drawYear; 28459 28460 if ( drawMonth < 0 ) { 28461 drawMonth += 12; 28462 drawYear--; 28463 } 28464 if ( maxDate ) { 28465 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 28466 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 28467 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 28468 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 28469 drawMonth--; 28470 if ( drawMonth < 0 ) { 28471 drawMonth = 11; 28472 drawYear--; 28473 } 28474 } 28475 } 28476 inst.drawMonth = drawMonth; 28477 inst.drawYear = drawYear; 28478 28479 prevText = this._get( inst, "prevText" ); 28480 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 28481 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 28482 this._getFormatConfig( inst ) ) ); 28483 28484 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 28485 prev = $( "<a>" ) 28486 .attr( { 28487 "class": "ui-datepicker-prev ui-corner-all", 28488 "data-handler": "prev", 28489 "data-event": "click", 28490 title: prevText 28491 } ) 28492 .append( 28493 $( "<span>" ) 28494 .addClass( "ui-icon ui-icon-circle-triangle-" + 28495 ( isRTL ? "e" : "w" ) ) 28496 .text( prevText ) 28497 )[ 0 ].outerHTML; 28498 } else if ( hideIfNoPrevNext ) { 28499 prev = ""; 28500 } else { 28501 prev = $( "<a>" ) 28502 .attr( { 28503 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 28504 title: prevText 28505 } ) 28506 .append( 28507 $( "<span>" ) 28508 .addClass( "ui-icon ui-icon-circle-triangle-" + 28509 ( isRTL ? "e" : "w" ) ) 28510 .text( prevText ) 28511 )[ 0 ].outerHTML; 28512 } 28513 28514 nextText = this._get( inst, "nextText" ); 28515 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 28516 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 28517 this._getFormatConfig( inst ) ) ); 28518 28519 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 28520 next = $( "<a>" ) 28521 .attr( { 28522 "class": "ui-datepicker-next ui-corner-all", 28523 "data-handler": "next", 28524 "data-event": "click", 28525 title: nextText 28526 } ) 28527 .append( 28528 $( "<span>" ) 28529 .addClass( "ui-icon ui-icon-circle-triangle-" + 28530 ( isRTL ? "w" : "e" ) ) 28531 .text( nextText ) 28532 )[ 0 ].outerHTML; 28533 } else if ( hideIfNoPrevNext ) { 28534 next = ""; 28535 } else { 28536 next = $( "<a>" ) 28537 .attr( { 28538 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 28539 title: nextText 28540 } ) 28541 .append( 28542 $( "<span>" ) 28543 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 28544 ( isRTL ? "w" : "e" ) ) 28545 .text( nextText ) 28546 )[ 0 ].outerHTML; 28547 } 28548 28549 currentText = this._get( inst, "currentText" ); 28550 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 28551 currentText = ( !navigationAsDateFormat ? currentText : 28552 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 28553 28554 controls = ""; 28555 if ( !inst.inline ) { 28556 controls = $( "<button>" ) 28557 .attr( { 28558 type: "button", 28559 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 28560 "data-handler": "hide", 28561 "data-event": "click" 28562 } ) 28563 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 28564 } 28565 28566 buttonPanel = ""; 28567 if ( showButtonPanel ) { 28568 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 28569 .append( isRTL ? controls : "" ) 28570 .append( this._isInRange( inst, gotoDate ) ? 28571 $( "<button>" ) 28572 .attr( { 28573 type: "button", 28574 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 28575 "data-handler": "today", 28576 "data-event": "click" 28577 } ) 28578 .text( currentText ) : 28579 "" ) 28580 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 28581 } 28582 28583 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 28584 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 28585 28586 showWeek = this._get( inst, "showWeek" ); 28587 dayNames = this._get( inst, "dayNames" ); 28588 dayNamesMin = this._get( inst, "dayNamesMin" ); 28589 monthNames = this._get( inst, "monthNames" ); 28590 monthNamesShort = this._get( inst, "monthNamesShort" ); 28591 beforeShowDay = this._get( inst, "beforeShowDay" ); 28592 showOtherMonths = this._get( inst, "showOtherMonths" ); 28593 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 28594 defaultDate = this._getDefaultDate( inst ); 28595 html = ""; 28596 28597 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 28598 group = ""; 28599 this.maxRows = 4; 28600 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 28601 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 28602 cornerClass = " ui-corner-all"; 28603 calender = ""; 28604 if ( isMultiMonth ) { 28605 calender += "<div class='ui-datepicker-group"; 28606 if ( numMonths[ 1 ] > 1 ) { 28607 switch ( col ) { 28608 case 0: calender += " ui-datepicker-group-first"; 28609 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 28610 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 28611 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 28612 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 28613 } 28614 } 28615 calender += "'>"; 28616 } 28617 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 28618 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 28619 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 28620 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 28621 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 28622 "</div><table class='ui-datepicker-calendar'><thead>" + 28623 "<tr>"; 28624 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 28625 for ( dow = 0; dow < 7; dow++ ) { // days of the week 28626 day = ( dow + firstDay ) % 7; 28627 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 28628 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 28629 } 28630 calender += thead + "</tr></thead><tbody>"; 28631 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 28632 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 28633 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 28634 } 28635 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 28636 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 28637 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 28638 this.maxRows = numRows; 28639 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 28640 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 28641 calender += "<tr>"; 28642 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 28643 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 28644 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 28645 daySettings = ( beforeShowDay ? 28646 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 28647 otherMonth = ( printDate.getMonth() !== drawMonth ); 28648 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 28649 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 28650 tbody += "<td class='" + 28651 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 28652 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 28653 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 28654 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 28655 28656 // or defaultDate is current printedDate and defaultDate is selectedDate 28657 " " + this._dayOverClass : "" ) + // highlight selected day 28658 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 28659 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 28660 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 28661 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 28662 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 28663 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 28664 ( otherMonth && !showOtherMonths ? " " : // display for other months 28665 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 28666 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 28667 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 28668 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 28669 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 28670 "' data-date='" + printDate.getDate() + // store date as data 28671 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 28672 printDate.setDate( printDate.getDate() + 1 ); 28673 printDate = this._daylightSavingAdjust( printDate ); 28674 } 28675 calender += tbody + "</tr>"; 28676 } 28677 drawMonth++; 28678 if ( drawMonth > 11 ) { 28679 drawMonth = 0; 28680 drawYear++; 28681 } 28682 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 28683 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 28684 group += calender; 28685 } 28686 html += group; 28687 } 28688 html += buttonPanel; 28689 inst._keyEvent = false; 28690 return html; 28691 }, 28692 28693 /* Generate the month and year header. */ 28694 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 28695 secondary, monthNames, monthNamesShort ) { 28696 28697 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 28698 changeMonth = this._get( inst, "changeMonth" ), 28699 changeYear = this._get( inst, "changeYear" ), 28700 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 28701 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 28702 selectYearLabel = this._get( inst, "selectYearLabel" ), 28703 html = "<div class='ui-datepicker-title'>", 28704 monthHtml = ""; 28705 28706 // Month selection 28707 if ( secondary || !changeMonth ) { 28708 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 28709 } else { 28710 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 28711 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 28712 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 28713 for ( month = 0; month < 12; month++ ) { 28714 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 28715 monthHtml += "<option value='" + month + "'" + 28716 ( month === drawMonth ? " selected='selected'" : "" ) + 28717 ">" + monthNamesShort[ month ] + "</option>"; 28718 } 28719 } 28720 monthHtml += "</select>"; 28721 } 28722 28723 if ( !showMonthAfterYear ) { 28724 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 28725 } 28726 28727 // Year selection 28728 if ( !inst.yearshtml ) { 28729 inst.yearshtml = ""; 28730 if ( secondary || !changeYear ) { 28731 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 28732 } else { 28733 28734 // determine range of years to display 28735 years = this._get( inst, "yearRange" ).split( ":" ); 28736 thisYear = new Date().getFullYear(); 28737 determineYear = function( value ) { 28738 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 28739 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 28740 parseInt( value, 10 ) ) ); 28741 return ( isNaN( year ) ? thisYear : year ); 28742 }; 28743 year = determineYear( years[ 0 ] ); 28744 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 28745 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 28746 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 28747 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 28748 for ( ; year <= endYear; year++ ) { 28749 inst.yearshtml += "<option value='" + year + "'" + 28750 ( year === drawYear ? " selected='selected'" : "" ) + 28751 ">" + year + "</option>"; 28752 } 28753 inst.yearshtml += "</select>"; 28754 28755 html += inst.yearshtml; 28756 inst.yearshtml = null; 28757 } 28758 } 28759 28760 html += this._get( inst, "yearSuffix" ); 28761 if ( showMonthAfterYear ) { 28762 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 28763 } 28764 html += "</div>"; // Close datepicker_header 28765 return html; 28766 }, 28767 28768 /* Adjust one of the date sub-fields. */ 28769 _adjustInstDate: function( inst, offset, period ) { 28770 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 28771 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 28772 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 28773 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 28774 28775 inst.selectedDay = date.getDate(); 28776 inst.drawMonth = inst.selectedMonth = date.getMonth(); 28777 inst.drawYear = inst.selectedYear = date.getFullYear(); 28778 if ( period === "M" || period === "Y" ) { 28779 this._notifyChange( inst ); 28780 } 28781 }, 28782 28783 /* Ensure a date is within any min/max bounds. */ 28784 _restrictMinMax: function( inst, date ) { 28785 var minDate = this._getMinMaxDate( inst, "min" ), 28786 maxDate = this._getMinMaxDate( inst, "max" ), 28787 newDate = ( minDate && date < minDate ? minDate : date ); 28788 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 28789 }, 28790 28791 /* Notify change of month/year. */ 28792 _notifyChange: function( inst ) { 28793 var onChange = this._get( inst, "onChangeMonthYear" ); 28794 if ( onChange ) { 28795 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 28796 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 28797 } 28798 }, 28799 28800 /* Determine the number of months to show. */ 28801 _getNumberOfMonths: function( inst ) { 28802 var numMonths = this._get( inst, "numberOfMonths" ); 28803 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 28804 }, 28805 28806 /* Determine the current maximum date - ensure no time components are set. */ 28807 _getMinMaxDate: function( inst, minMax ) { 28808 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 28809 }, 28810 28811 /* Find the number of days in a given month. */ 28812 _getDaysInMonth: function( year, month ) { 28813 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 28814 }, 28815 28816 /* Find the day of the week of the first of a month. */ 28817 _getFirstDayOfMonth: function( year, month ) { 28818 return new Date( year, month, 1 ).getDay(); 28819 }, 28820 28821 /* Determines if we should allow a "next/prev" month display change. */ 28822 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 28823 var numMonths = this._getNumberOfMonths( inst ), 28824 date = this._daylightSavingAdjust( new Date( curYear, 28825 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 28826 28827 if ( offset < 0 ) { 28828 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 28829 } 28830 return this._isInRange( inst, date ); 28831 }, 28832 28833 /* Is the given date in the accepted range? */ 28834 _isInRange: function( inst, date ) { 28835 var yearSplit, currentYear, 28836 minDate = this._getMinMaxDate( inst, "min" ), 28837 maxDate = this._getMinMaxDate( inst, "max" ), 28838 minYear = null, 28839 maxYear = null, 28840 years = this._get( inst, "yearRange" ); 28841 if ( years ) { 28842 yearSplit = years.split( ":" ); 28843 currentYear = new Date().getFullYear(); 28844 minYear = parseInt( yearSplit[ 0 ], 10 ); 28845 maxYear = parseInt( yearSplit[ 1 ], 10 ); 28846 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 28847 minYear += currentYear; 28848 } 28849 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 28850 maxYear += currentYear; 28851 } 28852 } 28853 28854 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 28855 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 28856 ( !minYear || date.getFullYear() >= minYear ) && 28857 ( !maxYear || date.getFullYear() <= maxYear ) ); 28858 }, 28859 28860 /* Provide the configuration settings for formatting/parsing. */ 28861 _getFormatConfig: function( inst ) { 28862 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 28863 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 28864 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 28865 return { shortYearCutoff: shortYearCutoff, 28866 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 28867 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 28868 }, 28869 28870 /* Format the given date for display. */ 28871 _formatDate: function( inst, day, month, year ) { 28872 if ( !day ) { 28873 inst.currentDay = inst.selectedDay; 28874 inst.currentMonth = inst.selectedMonth; 28875 inst.currentYear = inst.selectedYear; 28876 } 28877 var date = ( day ? ( typeof day === "object" ? day : 28878 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 28879 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 28880 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 28881 } 28882} ); 28883 28884/* 28885 * Bind hover events for datepicker elements. 28886 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 28887 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 28888 */ 28889function datepicker_bindHover( dpDiv ) { 28890 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 28891 return dpDiv.on( "mouseout", selector, function() { 28892 $( this ).removeClass( "ui-state-hover" ); 28893 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 28894 $( this ).removeClass( "ui-datepicker-prev-hover" ); 28895 } 28896 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 28897 $( this ).removeClass( "ui-datepicker-next-hover" ); 28898 } 28899 } ) 28900 .on( "mouseover", selector, datepicker_handleMouseover ); 28901} 28902 28903function datepicker_handleMouseover() { 28904 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 28905 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 28906 $( this ).addClass( "ui-state-hover" ); 28907 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 28908 $( this ).addClass( "ui-datepicker-prev-hover" ); 28909 } 28910 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 28911 $( this ).addClass( "ui-datepicker-next-hover" ); 28912 } 28913 } 28914} 28915 28916/* jQuery extend now ignores nulls! */ 28917function datepicker_extendRemove( target, props ) { 28918 $.extend( target, props ); 28919 for ( var name in props ) { 28920 if ( props[ name ] == null ) { 28921 target[ name ] = props[ name ]; 28922 } 28923 } 28924 return target; 28925} 28926 28927/* Invoke the datepicker functionality. 28928 @param options string - a command, optionally followed by additional parameters or 28929 Object - settings for attaching new datepicker functionality 28930 @return jQuery object */ 28931$.fn.datepicker = function( options ) { 28932 28933 /* Verify an empty collection wasn't passed - Fixes #6976 */ 28934 if ( !this.length ) { 28935 return this; 28936 } 28937 28938 /* Initialise the date picker. */ 28939 if ( !$.datepicker.initialized ) { 28940 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 28941 $.datepicker.initialized = true; 28942 } 28943 28944 /* Append datepicker main container to body if not exist. */ 28945 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 28946 $( "body" ).append( $.datepicker.dpDiv ); 28947 } 28948 28949 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 28950 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 28951 return $.datepicker[ "_" + options + "Datepicker" ]. 28952 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 28953 } 28954 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 28955 return $.datepicker[ "_" + options + "Datepicker" ]. 28956 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 28957 } 28958 return this.each( function() { 28959 if ( typeof options === "string" ) { 28960 $.datepicker[ "_" + options + "Datepicker" ] 28961 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 28962 } else { 28963 $.datepicker._attachDatepicker( this, options ); 28964 } 28965 } ); 28966}; 28967 28968$.datepicker = new Datepicker(); // singleton instance 28969$.datepicker.initialized = false; 28970$.datepicker.uuid = new Date().getTime(); 28971$.datepicker.version = "1.13.3"; 28972
vendor: 4,524 bytes, lines 28973-29134
28973return $.datepicker; 28974 28975} ); 28976 28977 28978/*! 28979 * jQuery UI Widget 1.13.3 28980 * https://jqueryui.com 28981 * 28982 * Copyright OpenJS Foundation and other contributors 28983 * Released under the MIT license. 28984 * https://jquery.org/license 28985 */ 28986 28987//>>label: Widget 28988//>>group: Core 28989//>>description: Provides a factory for creating stateful widgets with a common API. 28990//>>docs: https://api.jqueryui.com/jQuery.widget/ 28991//>>demos: https://jqueryui.com/widget/ 28992 28993( function( factory ) { 28994 "use strict"; 28995 28996 if ( typeof define === "function" && define.amd ) { 28997 28998 // AMD. Register as an anonymous module. 28999 define( [ "jquery", "./version" ], factory ); 29000 } else { 29001 29002 // Browser globals 29003 factory( jQuery ); 29004 } 29005} )( function( $ ) { 29006"use strict"; 29007 29008var widgetUuid = 0; 29009var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 29010var widgetSlice = Array.prototype.slice; 29011 29012$.cleanData = ( function( orig ) { 29013 return function( elems ) { 29014 var events, elem, i; 29015 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 29016 29017 // Only trigger remove when necessary to save time 29018 events = $._data( elem, "events" ); 29019 if ( events && events.remove ) { 29020 $( elem ).triggerHandler( "remove" ); 29021 } 29022 } 29023 orig( elems ); 29024 }; 29025} )( $.cleanData ); 29026 29027$.widget = function( name, base, prototype ) { 29028 var existingConstructor, constructor, basePrototype; 29029 29030 // ProxiedPrototype allows the provided prototype to remain unmodified 29031 // so that it can be used as a mixin for multiple widgets (#8876) 29032 var proxiedPrototype = {}; 29033 29034 var namespace = name.split( "." )[ 0 ]; 29035 name = name.split( "." )[ 1 ]; 29036 var fullName = namespace + "-" + name; 29037 29038 if ( !prototype ) { 29039 prototype = base; 29040 base = $.Widget; 29041 } 29042 29043 if ( Array.isArray( prototype ) ) { 29044 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 29045 } 29046 29047 // Create selector for plugin 29048 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 29049 return !!$.data( elem, fullName ); 29050 }; 29051 29052 $[ namespace ] = $[ namespace ] || {}; 29053 existingConstructor = $[ namespace ][ name ]; 29054 constructor = $[ namespace ][ name ] = function( options, element ) { 29055 29056 // Allow instantiation without "new" keyword 29057 if ( !this || !this._createWidget ) { 29058 return new constructor( options, element ); 29059 } 29060 29061 // Allow instantiation without initializing for simple inheritance 29062 // must use "new" keyword (the code above always passes args) 29063 if ( arguments.length ) { 29064 this._createWidget( options, element ); 29065 } 29066 }; 29067 29068 // Extend with the existing constructor to carry over any static properties 29069 $.extend( constructor, existingConstructor, { 29070 version: prototype.version, 29071 29072 // Copy the object used to create the prototype in case we need to 29073 // redefine the widget later 29074 _proto: $.extend( {}, prototype ), 29075 29076 // Track widgets that inherit from this widget in case this widget is 29077 // redefined after a widget inherits from it 29078 _childConstructors: [] 29079 } ); 29080 29081 basePrototype = new base(); 29082 29083 // We need to make the options hash a property directly on the new instance 29084 // otherwise we'll modify the options hash on the prototype that we're 29085 // inheriting from 29086 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 29087 $.each( prototype, function( prop, value ) { 29088 if ( typeof value !== "function" ) { 29089 proxiedPrototype[ prop ] = value; 29090 return; 29091 } 29092 proxiedPrototype[ prop ] = ( function() { 29093 function _super() { 29094 return base.prototype[ prop ].apply( this, arguments ); 29095 } 29096 29097 function _superApply( args ) { 29098 return base.prototype[ prop ].apply( this, args ); 29099 } 29100 29101 return function() { 29102 var __super = this._super; 29103 var __superApply = this._superApply; 29104 var returnValue; 29105 29106 this._super = _super; 29107 this._superApply = _superApply; 29108 29109 returnValue = value.apply( this, arguments ); 29110 29111 this._super = __super; 29112 this._superApply = __superApply; 29113 29114 return returnValue; 29115 }; 29116 } )(); 29117 } ); 29118 constructor.prototype = $.widget.extend( basePrototype, { 29119 29120 // TODO: remove support for widgetEventPrefix 29121 // always use the name + a colon as the prefix, e.g., draggable:start 29122 // don't prefix for widgets that aren't DOM-based 29123 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 29124 }, proxiedPrototype, { 29125 constructor: constructor, 29126 namespace: namespace, 29127 widgetName: name, 29128 widgetFullName: fullName 29129 } ); 29130 29131 // If this widget is being redefined then we need to find all widgets that 29132 // are inheriting from it and redefine all of them so that they inherit from 29133 // the new version of this widget. We're essentially trying to replace one 29134 // level in the prototype chain.
vendor: 3,345 bytes, lines 29135-29256
29135 if ( existingConstructor ) { 29136 $.each( existingConstructor._childConstructors, function( i, child ) { 29137 var childPrototype = child.prototype; 29138 29139 // Redefine the child widget using the same prototype that was 29140 // originally used, but inherit from the new version of the base 29141 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 29142 child._proto ); 29143 } ); 29144 29145 // Remove the list of existing child constructors from the old constructor 29146 // so the old child constructors can be garbage collected 29147 delete existingConstructor._childConstructors; 29148 } else { 29149 base._childConstructors.push( constructor ); 29150 } 29151 29152 $.widget.bridge( name, constructor ); 29153 29154 return constructor; 29155}; 29156 29157$.widget.extend = function( target ) { 29158 var input = widgetSlice.call( arguments, 1 ); 29159 var inputIndex = 0; 29160 var inputLength = input.length; 29161 var key; 29162 var value; 29163 29164 for ( ; inputIndex < inputLength; inputIndex++ ) { 29165 for ( key in input[ inputIndex ] ) { 29166 value = input[ inputIndex ][ key ]; 29167 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 29168 29169 // Clone objects 29170 if ( $.isPlainObject( value ) ) { 29171 target[ key ] = $.isPlainObject( target[ key ] ) ? 29172 $.widget.extend( {}, target[ key ], value ) : 29173 29174 // Don't extend strings, arrays, etc. with objects 29175 $.widget.extend( {}, value ); 29176 29177 // Copy everything else by reference 29178 } else { 29179 target[ key ] = value; 29180 } 29181 } 29182 } 29183 } 29184 return target; 29185}; 29186 29187$.widget.bridge = function( name, object ) { 29188 var fullName = object.prototype.widgetFullName || name; 29189 $.fn[ name ] = function( options ) { 29190 var isMethodCall = typeof options === "string"; 29191 var args = widgetSlice.call( arguments, 1 ); 29192 var returnValue = this; 29193 29194 if ( isMethodCall ) { 29195 29196 // If this is an empty collection, we need to have the instance method 29197 // return undefined instead of the jQuery instance 29198 if ( !this.length && options === "instance" ) { 29199 returnValue = undefined; 29200 } else { 29201 this.each( function() { 29202 var methodValue; 29203 var instance = $.data( this, fullName ); 29204 29205 if ( options === "instance" ) { 29206 returnValue = instance; 29207 return false; 29208 } 29209 29210 if ( !instance ) { 29211 return $.error( "cannot call methods on " + name + 29212 " prior to initialization; " + 29213 "attempted to call method '" + options + "'" ); 29214 } 29215 29216 if ( typeof instance[ options ] !== "function" || 29217 options.charAt( 0 ) === "_" ) { 29218 return $.error( "no such method '" + options + "' for " + name + 29219 " widget instance" ); 29220 } 29221 29222 methodValue = instance[ options ].apply( instance, args ); 29223 29224 if ( methodValue !== instance && methodValue !== undefined ) { 29225 returnValue = methodValue && methodValue.jquery ? 29226 returnValue.pushStack( methodValue.get() ) : 29227 methodValue; 29228 return false; 29229 } 29230 } ); 29231 } 29232 } else { 29233 29234 // Allow multiple hashes to be passed on init 29235 if ( args.length ) { 29236 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 29237 } 29238 29239 this.each( function() { 29240 var instance = $.data( this, fullName ); 29241 if ( instance ) { 29242 instance.option( options || {} ); 29243 if ( instance._init ) { 29244 instance._init(); 29245 } 29246 } else { 29247 $.data( this, fullName, new object( options, this ) ); 29248 } 29249 } ); 29250 } 29251 29252 return returnValue; 29253 }; 29254}; 29255 29256$.Widget =
vendor: 12,424 bytes, lines 29256-29730
29256 function( /* options, element */ ) {}; 29257$.Widget._childConstructors = []; 29258 29259$.Widget.prototype = { 29260 widgetName: "widget", 29261 widgetEventPrefix: "", 29262 defaultElement: "<div>", 29263 29264 options: { 29265 classes: {}, 29266 disabled: false, 29267 29268 // Callbacks 29269 create: null 29270 }, 29271 29272 _createWidget: function( options, element ) { 29273 element = $( element || this.defaultElement || this )[ 0 ]; 29274 this.element = $( element ); 29275 this.uuid = widgetUuid++; 29276 this.eventNamespace = "." + this.widgetName + this.uuid; 29277 29278 this.bindings = $(); 29279 this.hoverable = $(); 29280 this.focusable = $(); 29281 this.classesElementLookup = {}; 29282 29283 if ( element !== this ) { 29284 $.data( element, this.widgetFullName, this ); 29285 this._on( true, this.element, { 29286 remove: function( event ) { 29287 if ( event.target === element ) { 29288 this.destroy(); 29289 } 29290 } 29291 } ); 29292 this.document = $( element.style ? 29293 29294 // Element within the document 29295 element.ownerDocument : 29296 29297 // Element is window or document 29298 element.document || element ); 29299 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 29300 } 29301 29302 this.options = $.widget.extend( {}, 29303 this.options, 29304 this._getCreateOptions(), 29305 options ); 29306 29307 this._create(); 29308 29309 if ( this.options.disabled ) { 29310 this._setOptionDisabled( this.options.disabled ); 29311 } 29312 29313 this._trigger( "create", null, this._getCreateEventData() ); 29314 this._init(); 29315 }, 29316 29317 _getCreateOptions: function() { 29318 return {}; 29319 }, 29320 29321 _getCreateEventData: $.noop, 29322 29323 _create: $.noop, 29324 29325 _init: $.noop, 29326 29327 destroy: function() { 29328 var that = this; 29329 29330 this._destroy(); 29331 $.each( this.classesElementLookup, function( key, value ) { 29332 that._removeClass( value, key ); 29333 } ); 29334 29335 // We can probably remove the unbind calls in 2.0 29336 // all event bindings should go through this._on() 29337 this.element 29338 .off( this.eventNamespace ) 29339 .removeData( this.widgetFullName ); 29340 this.widget() 29341 .off( this.eventNamespace ) 29342 .removeAttr( "aria-disabled" ); 29343 29344 // Clean up events and states 29345 this.bindings.off( this.eventNamespace ); 29346 }, 29347 29348 _destroy: $.noop, 29349 29350 widget: function() { 29351 return this.element; 29352 }, 29353 29354 option: function( key, value ) { 29355 var options = key; 29356 var parts; 29357 var curOption; 29358 var i; 29359 29360 if ( arguments.length === 0 ) { 29361 29362 // Don't return a reference to the internal hash 29363 return $.widget.extend( {}, this.options ); 29364 } 29365 29366 if ( typeof key === "string" ) { 29367 29368 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 29369 options = {}; 29370 parts = key.split( "." ); 29371 key = parts.shift(); 29372 if ( parts.length ) { 29373 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 29374 for ( i = 0; i < parts.length - 1; i++ ) { 29375 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 29376 curOption = curOption[ parts[ i ] ]; 29377 } 29378 key = parts.pop(); 29379 if ( arguments.length === 1 ) { 29380 return curOption[ key ] === undefined ? null : curOption[ key ]; 29381 } 29382 curOption[ key ] = value; 29383 } else { 29384 if ( arguments.length === 1 ) { 29385 return this.options[ key ] === undefined ? null : this.options[ key ]; 29386 } 29387 options[ key ] = value; 29388 } 29389 } 29390 29391 this._setOptions( options ); 29392 29393 return this; 29394 }, 29395 29396 _setOptions: function( options ) { 29397 var key; 29398 29399 for ( key in options ) { 29400 this._setOption( key, options[ key ] ); 29401 } 29402 29403 return this; 29404 }, 29405 29406 _setOption: function( key, value ) { 29407 if ( key === "classes" ) { 29408 this._setOptionClasses( value ); 29409 } 29410 29411 this.options[ key ] = value; 29412 29413 if ( key === "disabled" ) { 29414 this._setOptionDisabled( value ); 29415 } 29416 29417 return this; 29418 }, 29419 29420 _setOptionClasses: function( value ) { 29421 var classKey, elements, currentElements; 29422 29423 for ( classKey in value ) { 29424 currentElements = this.classesElementLookup[ classKey ]; 29425 if ( value[ classKey ] === this.options.classes[ classKey ] || 29426 !currentElements || 29427 !currentElements.length ) { 29428 continue; 29429 } 29430 29431 // We are doing this to create a new jQuery object because the _removeClass() call 29432 // on the next line is going to destroy the reference to the current elements being 29433 // tracked. We need to save a copy of this collection so that we can add the new classes 29434 // below. 29435 elements = $( currentElements.get() ); 29436 this._removeClass( currentElements, classKey ); 29437 29438 // We don't use _addClass() here, because that uses this.options.classes 29439 // for generating the string of classes. We want to use the value passed in from 29440 // _setOption(), this is the new value of the classes option which was passed to 29441 // _setOption(). We pass this value directly to _classes(). 29442 elements.addClass( this._classes( { 29443 element: elements, 29444 keys: classKey, 29445 classes: value, 29446 add: true 29447 } ) ); 29448 } 29449 }, 29450 29451 _setOptionDisabled: function( value ) { 29452 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 29453 29454 // If the widget is becoming disabled, then nothing is interactive 29455 if ( value ) { 29456 this._removeClass( this.hoverable, null, "ui-state-hover" ); 29457 this._removeClass( this.focusable, null, "ui-state-focus" ); 29458 } 29459 }, 29460 29461 enable: function() { 29462 return this._setOptions( { disabled: false } ); 29463 }, 29464 29465 disable: function() { 29466 return this._setOptions( { disabled: true } ); 29467 }, 29468 29469 _classes: function( options ) { 29470 var full = []; 29471 var that = this; 29472 29473 options = $.extend( { 29474 element: this.element, 29475 classes: this.options.classes || {} 29476 }, options ); 29477 29478 function bindRemoveEvent() { 29479 var nodesToBind = []; 29480 29481 options.element.each( function( _, element ) { 29482 var isTracked = $.map( that.classesElementLookup, function( elements ) { 29483 return elements; 29484 } ) 29485 .some( function( elements ) { 29486 return elements.is( element ); 29487 } ); 29488 29489 if ( !isTracked ) { 29490 nodesToBind.push( element ); 29491 } 29492 } ); 29493 29494 that._on( $( nodesToBind ), { 29495 remove: "_untrackClassesElement" 29496 } ); 29497 } 29498 29499 function processClassString( classes, checkOption ) { 29500 var current, i; 29501 for ( i = 0; i < classes.length; i++ ) { 29502 current = that.classesElementLookup[ classes[ i ] ] || $(); 29503 if ( options.add ) { 29504 bindRemoveEvent(); 29505 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 29506 } else { 29507 current = $( current.not( options.element ).get() ); 29508 } 29509 that.classesElementLookup[ classes[ i ] ] = current; 29510 full.push( classes[ i ] ); 29511 if ( checkOption && options.classes[ classes[ i ] ] ) { 29512 full.push( options.classes[ classes[ i ] ] ); 29513 } 29514 } 29515 } 29516 29517 if ( options.keys ) { 29518 processClassString( options.keys.match( /\S+/g ) || [], true ); 29519 } 29520 if ( options.extra ) { 29521 processClassString( options.extra.match( /\S+/g ) || [] ); 29522 } 29523 29524 return full.join( " " ); 29525 }, 29526 29527 _untrackClassesElement: function( event ) { 29528 var that = this; 29529 $.each( that.classesElementLookup, function( key, value ) { 29530 if ( $.inArray( event.target, value ) !== -1 ) { 29531 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 29532 } 29533 } ); 29534 29535 this._off( $( event.target ) ); 29536 }, 29537 29538 _removeClass: function( element, keys, extra ) { 29539 return this._toggleClass( element, keys, extra, false ); 29540 }, 29541 29542 _addClass: function( element, keys, extra ) { 29543 return this._toggleClass( element, keys, extra, true ); 29544 }, 29545 29546 _toggleClass: function( element, keys, extra, add ) { 29547 add = ( typeof add === "boolean" ) ? add : extra; 29548 var shift = ( typeof element === "string" || element === null ), 29549 options = { 29550 extra: shift ? keys : extra, 29551 keys: shift ? element : keys, 29552 element: shift ? this.element : element, 29553 add: add 29554 }; 29555 options.element.toggleClass( this._classes( options ), add ); 29556 return this; 29557 }, 29558 29559 _on: function( suppressDisabledCheck, element, handlers ) { 29560 var delegateElement; 29561 var instance = this; 29562 29563 // No suppressDisabledCheck flag, shuffle arguments 29564 if ( typeof suppressDisabledCheck !== "boolean" ) { 29565 handlers = element; 29566 element = suppressDisabledCheck; 29567 suppressDisabledCheck = false; 29568 } 29569 29570 // No element argument, shuffle and use this.element 29571 if ( !handlers ) { 29572 handlers = element; 29573 element = this.element; 29574 delegateElement = this.widget(); 29575 } else { 29576 element = delegateElement = $( element ); 29577 this.bindings = this.bindings.add( element ); 29578 } 29579 29580 $.each( handlers, function( event, handler ) { 29581 function handlerProxy() { 29582 29583 // Allow widgets to customize the disabled handling 29584 // - disabled as an array instead of boolean 29585 // - disabled class as method for disabling individual parts 29586 if ( !suppressDisabledCheck && 29587 ( instance.options.disabled === true || 29588 $( this ).hasClass( "ui-state-disabled" ) ) ) { 29589 return; 29590 } 29591 return ( typeof handler === "string" ? instance[ handler ] : handler ) 29592 .apply( instance, arguments ); 29593 } 29594 29595 // Copy the guid so direct unbinding works 29596 if ( typeof handler !== "string" ) { 29597 handlerProxy.guid = handler.guid = 29598 handler.guid || handlerProxy.guid || $.guid++; 29599 } 29600 29601 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 29602 var eventName = match[ 1 ] + instance.eventNamespace; 29603 var selector = match[ 2 ]; 29604 29605 if ( selector ) { 29606 delegateElement.on( eventName, selector, handlerProxy ); 29607 } else { 29608 element.on( eventName, handlerProxy ); 29609 } 29610 } ); 29611 }, 29612 29613 _off: function( element, eventName ) { 29614 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 29615 this.eventNamespace; 29616 element.off( eventName ); 29617 29618 // Clear the stack to avoid memory leaks (#10056) 29619 this.bindings = $( this.bindings.not( element ).get() ); 29620 this.focusable = $( this.focusable.not( element ).get() ); 29621 this.hoverable = $( this.hoverable.not( element ).get() ); 29622 }, 29623 29624 _delay: function( handler, delay ) { 29625 function handlerProxy() { 29626 return ( typeof handler === "string" ? instance[ handler ] : handler ) 29627 .apply( instance, arguments ); 29628 } 29629 var instance = this; 29630 return setTimeout( handlerProxy, delay || 0 ); 29631 }, 29632 29633 _hoverable: function( element ) { 29634 this.hoverable = this.hoverable.add( element ); 29635 this._on( element, { 29636 mouseenter: function( event ) { 29637 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 29638 }, 29639 mouseleave: function( event ) { 29640 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 29641 } 29642 } ); 29643 }, 29644 29645 _focusable: function( element ) { 29646 this.focusable = this.focusable.add( element ); 29647 this._on( element, { 29648 focusin: function( event ) { 29649 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 29650 }, 29651 focusout: function( event ) { 29652 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 29653 } 29654 } ); 29655 }, 29656 29657 _trigger: function( type, event, data ) { 29658 var prop, orig; 29659 var callback = this.options[ type ]; 29660 29661 data = data || {}; 29662 event = $.Event( event ); 29663 event.type = ( type === this.widgetEventPrefix ? 29664 type : 29665 this.widgetEventPrefix + type ).toLowerCase(); 29666 29667 // The original event may come from any element 29668 // so we need to reset the target on the new event 29669 event.target = this.element[ 0 ]; 29670 29671 // Copy original event properties over to the new event 29672 orig = event.originalEvent; 29673 if ( orig ) { 29674 for ( prop in orig ) { 29675 if ( !( prop in event ) ) { 29676 event[ prop ] = orig[ prop ]; 29677 } 29678 } 29679 } 29680 29681 this.element.trigger( event, data ); 29682 return !( typeof callback === "function" && 29683 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 29684 event.isDefaultPrevented() ); 29685 } 29686}; 29687 29688$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 29689 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 29690 if ( typeof options === "string" ) { 29691 options = { effect: options }; 29692 } 29693 29694 var hasOptions; 29695 var effectName = !options ? 29696 method : 29697 options === true || typeof options === "number" ? 29698 defaultEffect : 29699 options.effect || defaultEffect; 29700 29701 options = options || {}; 29702 if ( typeof options === "number" ) { 29703 options = { duration: options }; 29704 } else if ( options === true ) { 29705 options = {}; 29706 } 29707 29708 hasOptions = !$.isEmptyObject( options ); 29709 options.complete = callback; 29710 29711 if ( options.delay ) { 29712 element.delay( options.delay ); 29713 } 29714 29715 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 29716 element[ method ]( options ); 29717 } else if ( effectName !== method && element[ effectName ] ) { 29718 element[ effectName ]( options.duration, options.easing, callback ); 29719 } else { 29720 element.queue( function( next ) { 29721 $( this )[ method ](); 29722 if ( callback ) { 29723 callback.call( element[ 0 ] ); 29724 } 29725 next(); 29726 } ); 29727 } 29728 }; 29729} ); 29730
vendor: 8,382 bytes, lines 29731-30025
29731return $.widget; 29732 29733} ); 29734 29735 29736/*! 29737 * jQuery UI Controlgroup 1.13.3 29738 * https://jqueryui.com 29739 * 29740 * Copyright OpenJS Foundation and other contributors 29741 * Released under the MIT license. 29742 * https://jquery.org/license 29743 */ 29744 29745//>>label: Controlgroup 29746//>>group: Widgets 29747//>>description: Visually groups form control widgets 29748//>>docs: https://api.jqueryui.com/controlgroup/ 29749//>>demos: https://jqueryui.com/controlgroup/ 29750//>>css.structure: ../../themes/base/core.css 29751//>>css.structure: ../../themes/base/controlgroup.css 29752//>>css.theme: ../../themes/base/theme.css 29753 29754( function( factory ) { 29755 "use strict"; 29756 29757 if ( typeof define === "function" && define.amd ) { 29758 29759 // AMD. Register as an anonymous module. 29760 define( [ 29761 "jquery", 29762 "../widget" 29763 ], factory ); 29764 } else { 29765 29766 // Browser globals 29767 factory( jQuery ); 29768 } 29769} )( function( $ ) { 29770"use strict"; 29771 29772var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 29773 29774return $.widget( "ui.controlgroup", { 29775 version: "1.13.3", 29776 defaultElement: "<div>", 29777 options: { 29778 direction: "horizontal", 29779 disabled: null, 29780 onlyVisible: true, 29781 items: { 29782 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 29783 "controlgroupLabel": ".ui-controlgroup-label", 29784 "checkboxradio": "input[type='checkbox'], input[type='radio']", 29785 "selectmenu": "select", 29786 "spinner": ".ui-spinner-input" 29787 } 29788 }, 29789 29790 _create: function() { 29791 this._enhance(); 29792 }, 29793 29794 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 29795 _enhance: function() { 29796 this.element.attr( "role", "toolbar" ); 29797 this.refresh(); 29798 }, 29799 29800 _destroy: function() { 29801 this._callChildMethod( "destroy" ); 29802 this.childWidgets.removeData( "ui-controlgroup-data" ); 29803 this.element.removeAttr( "role" ); 29804 if ( this.options.items.controlgroupLabel ) { 29805 this.element 29806 .find( this.options.items.controlgroupLabel ) 29807 .find( ".ui-controlgroup-label-contents" ) 29808 .contents().unwrap(); 29809 } 29810 }, 29811 29812 _initWidgets: function() { 29813 var that = this, 29814 childWidgets = []; 29815 29816 // First we iterate over each of the items options 29817 $.each( this.options.items, function( widget, selector ) { 29818 var labels; 29819 var options = {}; 29820 29821 // Make sure the widget has a selector set 29822 if ( !selector ) { 29823 return; 29824 } 29825 29826 if ( widget === "controlgroupLabel" ) { 29827 labels = that.element.find( selector ); 29828 labels.each( function() { 29829 var element = $( this ); 29830 29831 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 29832 return; 29833 } 29834 element.contents() 29835 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 29836 } ); 29837 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 29838 childWidgets = childWidgets.concat( labels.get() ); 29839 return; 29840 } 29841 29842 // Make sure the widget actually exists 29843 if ( !$.fn[ widget ] ) { 29844 return; 29845 } 29846 29847 // We assume everything is in the middle to start because we can't determine 29848 // first / last elements until all enhancments are done. 29849 if ( that[ "_" + widget + "Options" ] ) { 29850 options = that[ "_" + widget + "Options" ]( "middle" ); 29851 } else { 29852 options = { classes: {} }; 29853 } 29854 29855 // Find instances of this widget inside controlgroup and init them 29856 that.element 29857 .find( selector ) 29858 .each( function() { 29859 var element = $( this ); 29860 var instance = element[ widget ]( "instance" ); 29861 29862 // We need to clone the default options for this type of widget to avoid 29863 // polluting the variable options which has a wider scope than a single widget. 29864 var instanceOptions = $.widget.extend( {}, options ); 29865 29866 // If the button is the child of a spinner ignore it 29867 // TODO: Find a more generic solution 29868 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 29869 return; 29870 } 29871 29872 // Create the widget if it doesn't exist 29873 if ( !instance ) { 29874 instance = element[ widget ]()[ widget ]( "instance" ); 29875 } 29876 if ( instance ) { 29877 instanceOptions.classes = 29878 that._resolveClassesValues( instanceOptions.classes, instance ); 29879 } 29880 element[ widget ]( instanceOptions ); 29881 29882 // Store an instance of the controlgroup to be able to reference 29883 // from the outermost element for changing options and refresh 29884 var widgetElement = element[ widget ]( "widget" ); 29885 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 29886 instance ? instance : element[ widget ]( "instance" ) ); 29887 29888 childWidgets.push( widgetElement[ 0 ] ); 29889 } ); 29890 } ); 29891 29892 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 29893 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 29894 }, 29895 29896 _callChildMethod: function( method ) { 29897 this.childWidgets.each( function() { 29898 var element = $( this ), 29899 data = element.data( "ui-controlgroup-data" ); 29900 if ( data && data[ method ] ) { 29901 data[ method ](); 29902 } 29903 } ); 29904 }, 29905 29906 _updateCornerClass: function( element, position ) { 29907 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 29908 var add = this._buildSimpleOptions( position, "label" ).classes.label; 29909 29910 this._removeClass( element, null, remove ); 29911 this._addClass( element, null, add ); 29912 }, 29913 29914 _buildSimpleOptions: function( position, key ) { 29915 var direction = this.options.direction === "vertical"; 29916 var result = { 29917 classes: {} 29918 }; 29919 result.classes[ key ] = { 29920 "middle": "", 29921 "first": "ui-corner-" + ( direction ? "top" : "left" ), 29922 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 29923 "only": "ui-corner-all" 29924 }[ position ]; 29925 29926 return result; 29927 }, 29928 29929 _spinnerOptions: function( position ) { 29930 var options = this._buildSimpleOptions( position, "ui-spinner" ); 29931 29932 options.classes[ "ui-spinner-up" ] = ""; 29933 options.classes[ "ui-spinner-down" ] = ""; 29934 29935 return options; 29936 }, 29937 29938 _buttonOptions: function( position ) { 29939 return this._buildSimpleOptions( position, "ui-button" ); 29940 }, 29941 29942 _checkboxradioOptions: function( position ) { 29943 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 29944 }, 29945 29946 _selectmenuOptions: function( position ) { 29947 var direction = this.options.direction === "vertical"; 29948 return { 29949 width: direction ? "auto" : false, 29950 classes: { 29951 middle: { 29952 "ui-selectmenu-button-open": "", 29953 "ui-selectmenu-button-closed": "" 29954 }, 29955 first: { 29956 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 29957 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 29958 }, 29959 last: { 29960 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 29961 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 29962 }, 29963 only: { 29964 "ui-selectmenu-button-open": "ui-corner-top", 29965 "ui-selectmenu-button-closed": "ui-corner-all" 29966 } 29967 29968 }[ position ] 29969 }; 29970 }, 29971 29972 _resolveClassesValues: function( classes, instance ) { 29973 var result = {}; 29974 $.each( classes, function( key ) { 29975 var current = instance.options.classes[ key ] || ""; 29976 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 29977 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 29978 } ); 29979 return result; 29980 }, 29981 29982 _setOption: function( key, value ) { 29983 if ( key === "direction" ) { 29984 this._removeClass( "ui-controlgroup-" + this.options.direction ); 29985 } 29986 29987 this._super( key, value ); 29988 if ( key === "disabled" ) { 29989 this._callChildMethod( value ? "disable" : "enable" ); 29990 return; 29991 } 29992 29993 this.refresh(); 29994 }, 29995 29996 refresh: function() { 29997 var children, 29998 that = this; 29999 30000 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 30001 30002 if ( this.options.direction === "horizontal" ) { 30003 this._addClass( null, "ui-helper-clearfix" ); 30004 } 30005 this._initWidgets(); 30006 30007 children = this.childWidgets; 30008 30009 // We filter here because we need to track all childWidgets not just the visible ones 30010 if ( this.options.onlyVisible ) { 30011 children = children.filter( ":visible" ); 30012 } 30013 30014 if ( children.length ) { 30015 30016 // We do this last because we need to make sure all enhancment is done 30017 // before determining first and last 30018 $.each( [ "first", "last" ], function( index, value ) { 30019 var instance = children[ value ]().data( "ui-controlgroup-data" ); 30020 30021 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 30022 var options = that[ "_" + instance.widgetName + "Options" ]( 30023 children.length === 1 ? "only" : value 30024 ); 30025 options.classes = that._resolveClassesValues( options.classes, instance );
vendor: 9,901 bytes, lines 30026-30423
30026 instance.element[ instance.widgetName ]( options ); 30027 } else { 30028 that._updateCornerClass( children[ value ](), value ); 30029 } 30030 } ); 30031 30032 // Finally call the refresh method on each of the child widgets. 30033 this._callChildMethod( "refresh" ); 30034 } 30035 } 30036} ); 30037} ); 30038 30039( function( factory ) { 30040 "use strict"; 30041 30042 if ( typeof define === "function" && define.amd ) { 30043 30044 // AMD. Register as an anonymous module. 30045 define( [ "jquery", "./version" ], factory ); 30046 } else { 30047 30048 // Browser globals 30049 factory( jQuery ); 30050 } 30051} )( function( $ ) { 30052"use strict"; 30053 30054// Support: IE8 Only 30055// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 30056// with a string, so we need to find the proper form. 30057return $.fn._form = function() { 30058 return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); 30059}; 30060 30061} ); 30062 30063 30064 30065/*! 30066 * jQuery UI Form Reset Mixin 1.13.3 30067 * https://jqueryui.com 30068 * 30069 * Copyright OpenJS Foundation and other contributors 30070 * Released under the MIT license. 30071 * https://jquery.org/license 30072 */ 30073 30074//>>label: Form Reset Mixin 30075//>>group: Core 30076//>>description: Refresh input widgets when their form is reset 30077//>>docs: https://api.jqueryui.com/form-reset-mixin/ 30078 30079( function( factory ) { 30080 "use strict"; 30081 30082 if ( typeof define === "function" && define.amd ) { 30083 30084 // AMD. Register as an anonymous module. 30085 define( [ 30086 "jquery", 30087 "./form", 30088 "./version" 30089 ], factory ); 30090 } else { 30091 30092 // Browser globals 30093 factory( jQuery ); 30094 } 30095} )( function( $ ) { 30096"use strict"; 30097 30098return $.ui.formResetMixin = { 30099 _formResetHandler: function() { 30100 var form = $( this ); 30101 30102 // Wait for the form reset to actually happen before refreshing 30103 setTimeout( function() { 30104 var instances = form.data( "ui-form-reset-instances" ); 30105 $.each( instances, function() { 30106 this.refresh(); 30107 } ); 30108 } ); 30109 }, 30110 30111 _bindFormResetHandler: function() { 30112 this.form = this.element._form(); 30113 if ( !this.form.length ) { 30114 return; 30115 } 30116 30117 var instances = this.form.data( "ui-form-reset-instances" ) || []; 30118 if ( !instances.length ) { 30119 30120 // We don't use _on() here because we use a single event handler per form 30121 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 30122 } 30123 instances.push( this ); 30124 this.form.data( "ui-form-reset-instances", instances ); 30125 }, 30126 30127 _unbindFormResetHandler: function() { 30128 if ( !this.form.length ) { 30129 return; 30130 } 30131 30132 var instances = this.form.data( "ui-form-reset-instances" ); 30133 instances.splice( $.inArray( this, instances ), 1 ); 30134 if ( instances.length ) { 30135 this.form.data( "ui-form-reset-instances", instances ); 30136 } else { 30137 this.form 30138 .removeData( "ui-form-reset-instances" ) 30139 .off( "reset.ui-form-reset" ); 30140 } 30141 } 30142}; 30143 30144} ); 30145 30146 30147/*! 30148 * jQuery UI Labels 1.13.3 30149 * https://jqueryui.com 30150 * 30151 * Copyright OpenJS Foundation and other contributors 30152 * Released under the MIT license. 30153 * https://jquery.org/license 30154 */ 30155 30156//>>label: labels 30157//>>group: Core 30158//>>description: Find all the labels associated with a given input 30159//>>docs: https://api.jqueryui.com/labels/ 30160 30161( function( factory ) { 30162 "use strict"; 30163 30164 if ( typeof define === "function" && define.amd ) { 30165 30166 // AMD. Register as an anonymous module. 30167 define( [ "jquery", "./version" ], factory ); 30168 } else { 30169 30170 // Browser globals 30171 factory( jQuery ); 30172 } 30173} )( function( $ ) { 30174"use strict"; 30175 30176return $.fn.labels = function() { 30177 var ancestor, selector, id, labels, ancestors; 30178 30179 if ( !this.length ) { 30180 return this.pushStack( [] ); 30181 } 30182 30183 // Check control.labels first 30184 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 30185 return this.pushStack( this[ 0 ].labels ); 30186 } 30187 30188 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 30189 // Above browsers do not support control.labels. Everything below is to support them 30190 // as well as document fragments. control.labels does not work on document fragments 30191 labels = this.eq( 0 ).parents( "label" ); 30192 30193 // Look for the label based on the id 30194 id = this.attr( "id" ); 30195 if ( id ) { 30196 30197 // We don't search against the document in case the element 30198 // is disconnected from the DOM 30199 ancestor = this.eq( 0 ).parents().last(); 30200 30201 // Get a full set of top level ancestors 30202 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 30203 30204 // Create a selector for the label based on the id 30205 selector = "label[for='" + $.escapeSelector( id ) + "']"; 30206 30207 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 30208 30209 } 30210 30211 // Return whatever we have found for labels 30212 return this.pushStack( labels ); 30213}; 30214 30215} ); 30216 30217 30218 30219 30220/*! 30221 * jQuery UI Checkboxradio 1.13.3 30222 * https://jqueryui.com 30223 * 30224 * Copyright OpenJS Foundation and other contributors 30225 * Released under the MIT license. 30226 * https://jquery.org/license 30227 */ 30228 30229//>>label: Checkboxradio 30230//>>group: Widgets 30231//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 30232//>>docs: https://api.jqueryui.com/checkboxradio/ 30233//>>demos: https://jqueryui.com/checkboxradio/ 30234//>>css.structure: ../../themes/base/core.css 30235//>>css.structure: ../../themes/base/button.css 30236//>>css.structure: ../../themes/base/checkboxradio.css 30237//>>css.theme: ../../themes/base/theme.css 30238 30239( function( factory ) { 30240 "use strict"; 30241 30242 if ( typeof define === "function" && define.amd ) { 30243 30244 // AMD. Register as an anonymous module. 30245 define( [ 30246 "jquery", 30247 "../form-reset-mixin", 30248 "../labels", 30249 "../widget" 30250 ], factory ); 30251 } else { 30252 30253 // Browser globals 30254 factory( jQuery ); 30255 } 30256} )( function( $ ) { 30257"use strict"; 30258 30259$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 30260 version: "1.13.3", 30261 options: { 30262 disabled: null, 30263 label: null, 30264 icon: true, 30265 classes: { 30266 "ui-checkboxradio-label": "ui-corner-all", 30267 "ui-checkboxradio-icon": "ui-corner-all" 30268 } 30269 }, 30270 30271 _getCreateOptions: function() { 30272 var disabled, labels, labelContents; 30273 var options = this._super() || {}; 30274 30275 // We read the type here, because it makes more sense to throw a element type error first, 30276 // rather then the error for lack of a label. Often if its the wrong type, it 30277 // won't have a label (e.g. calling on a div, btn, etc) 30278 this._readType(); 30279 30280 labels = this.element.labels(); 30281 30282 // If there are multiple labels, use the last one 30283 this.label = $( labels[ labels.length - 1 ] ); 30284 if ( !this.label.length ) { 30285 $.error( "No label found for checkboxradio widget" ); 30286 } 30287 30288 this.originalLabel = ""; 30289 30290 // We need to get the label text but this may also need to make sure it does not contain the 30291 // input itself. 30292 // The label contents could be text, html, or a mix. We wrap all elements 30293 // and read the wrapper's `innerHTML` to get a string representation of 30294 // the label, without the input as part of it. 30295 labelContents = this.label.contents().not( this.element[ 0 ] ); 30296 30297 if ( labelContents.length ) { 30298 this.originalLabel += labelContents 30299 .clone() 30300 .wrapAll( "<div></div>" ) 30301 .parent() 30302 .html(); 30303 } 30304 30305 // Set the label option if we found label text 30306 if ( this.originalLabel ) { 30307 options.label = this.originalLabel; 30308 } 30309 30310 disabled = this.element[ 0 ].disabled; 30311 if ( disabled != null ) { 30312 options.disabled = disabled; 30313 } 30314 return options; 30315 }, 30316 30317 _create: function() { 30318 var checked = this.element[ 0 ].checked; 30319 30320 this._bindFormResetHandler(); 30321 30322 if ( this.options.disabled == null ) { 30323 this.options.disabled = this.element[ 0 ].disabled; 30324 } 30325 30326 this._setOption( "disabled", this.options.disabled ); 30327 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 30328 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 30329 30330 if ( this.type === "radio" ) { 30331 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 30332 } 30333 30334 if ( this.options.label && this.options.label !== this.originalLabel ) { 30335 this._updateLabel(); 30336 } else if ( this.originalLabel ) { 30337 this.options.label = this.originalLabel; 30338 } 30339 30340 this._enhance(); 30341 30342 if ( checked ) { 30343 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 30344 } 30345 30346 this._on( { 30347 change: "_toggleClasses", 30348 focus: function() { 30349 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 30350 }, 30351 blur: function() { 30352 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 30353 } 30354 } ); 30355 }, 30356 30357 _readType: function() { 30358 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 30359 this.type = this.element[ 0 ].type; 30360 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 30361 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 30362 " and element.type=" + this.type ); 30363 } 30364 }, 30365 30366 // Support jQuery Mobile enhanced option 30367 _enhance: function() { 30368 this._updateIcon( this.element[ 0 ].checked ); 30369 }, 30370 30371 widget: function() { 30372 return this.label; 30373 }, 30374 30375 _getRadioGroup: function() { 30376 var group; 30377 var name = this.element[ 0 ].name; 30378 var nameSelector = "input[name='" + $.escapeSelector( name ) + "']"; 30379 30380 if ( !name ) { 30381 return $( [] ); 30382 } 30383 30384 if ( this.form.length ) { 30385 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 30386 } else { 30387 30388 // Not inside a form, check all inputs that also are not inside a form 30389 group = $( nameSelector ).filter( function() { 30390 return $( this )._form().length === 0; 30391 } ); 30392 } 30393 30394 return group.not( this.element ); 30395 }, 30396 30397 _toggleClasses: function() { 30398 var checked = this.element[ 0 ].checked; 30399 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 30400 30401 if ( this.options.icon && this.type === "checkbox" ) { 30402 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 30403 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 30404 } 30405 30406 if ( this.type === "radio" ) { 30407 this._getRadioGroup() 30408 .each( function() { 30409 var instance = $( this ).checkboxradio( "instance" ); 30410 30411 if ( instance ) { 30412 instance._removeClass( instance.label, 30413 "ui-checkboxradio-checked", "ui-state-active" ); 30414 } 30415 } ); 30416 } 30417 }, 30418 30419 _destroy: function() { 30420 this._unbindFormResetHandler(); 30421 30422 if ( this.icon ) { 30423 this.icon.remove();
vendor: 3,069 bytes, lines 30424-30556
30424 this.iconSpace.remove(); 30425 } 30426 }, 30427 30428 _setOption: function( key, value ) { 30429 30430 // We don't allow the value to be set to nothing 30431 if ( key === "label" && !value ) { 30432 return; 30433 } 30434 30435 this._super( key, value ); 30436 30437 if ( key === "disabled" ) { 30438 this._toggleClass( this.label, null, "ui-state-disabled", value ); 30439 this.element[ 0 ].disabled = value; 30440 30441 // Don't refresh when setting disabled 30442 return; 30443 } 30444 this.refresh(); 30445 }, 30446 30447 _updateIcon: function( checked ) { 30448 var toAdd = "ui-icon ui-icon-background "; 30449 30450 if ( this.options.icon ) { 30451 if ( !this.icon ) { 30452 this.icon = $( "<span>" ); 30453 this.iconSpace = $( "<span> </span>" ); 30454 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 30455 } 30456 30457 if ( this.type === "checkbox" ) { 30458 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 30459 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 30460 } else { 30461 toAdd += "ui-icon-blank"; 30462 } 30463 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 30464 if ( !checked ) { 30465 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 30466 } 30467 this.icon.prependTo( this.label ).after( this.iconSpace ); 30468 } else if ( this.icon !== undefined ) { 30469 this.icon.remove(); 30470 this.iconSpace.remove(); 30471 delete this.icon; 30472 } 30473 }, 30474 30475 _updateLabel: function() { 30476 30477 // Remove the contents of the label ( minus the icon, icon space, and input ) 30478 var contents = this.label.contents().not( this.element[ 0 ] ); 30479 if ( this.icon ) { 30480 contents = contents.not( this.icon[ 0 ] ); 30481 } 30482 if ( this.iconSpace ) { 30483 contents = contents.not( this.iconSpace[ 0 ] ); 30484 } 30485 contents.remove(); 30486 30487 this.label.append( this.options.label ); 30488 }, 30489 30490 refresh: function() { 30491 var checked = this.element[ 0 ].checked, 30492 isDisabled = this.element[ 0 ].disabled; 30493 30494 this._updateIcon( checked ); 30495 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 30496 if ( this.options.label !== null ) { 30497 this._updateLabel(); 30498 } 30499 30500 if ( isDisabled !== this.options.disabled ) { 30501 this._setOptions( { "disabled": isDisabled } ); 30502 } 30503 } 30504 30505} ] ); 30506 30507return $.ui.checkboxradio; 30508 30509} ); 30510 30511 30512 30513 30514 30515/*! 30516 * jQuery UI Button 1.13.3 30517 * https://jqueryui.com 30518 * 30519 * Copyright OpenJS Foundation and other contributors 30520 * Released under the MIT license. 30521 * https://jquery.org/license 30522 */ 30523 30524//>>label: Button 30525//>>group: Widgets 30526//>>description: Enhances a form with themeable buttons. 30527//>>docs: https://api.jqueryui.com/button/ 30528//>>demos: https://jqueryui.com/button/ 30529//>>css.structure: ../../themes/base/core.css 30530//>>css.structure: ../../themes/base/button.css 30531//>>css.theme: ../../themes/base/theme.css 30532 30533( function( factory ) { 30534 "use strict"; 30535 30536 if ( typeof define === "function" && define.amd ) { 30537 30538 // AMD. Register as an anonymous module. 30539 define( [ 30540 "jquery", 30541 30542 // These are only for backcompat 30543 // TODO: Remove after 1.12 30544 "./controlgroup", 30545 "./checkboxradio", 30546 30547 "../keycode", 30548 "../widget" 30549 ], factory ); 30550 } else { 30551 30552 // Browser globals 30553 factory( jQuery ); 30554 } 30555} )( function( $ ) { 30556"use strict";
vendor: 10,772 bytes, lines 30556-30960
30556 30557 30558$.widget( "ui.button", { 30559 version: "1.13.3", 30560 defaultElement: "<button>", 30561 options: { 30562 classes: { 30563 "ui-button": "ui-corner-all" 30564 }, 30565 disabled: null, 30566 icon: null, 30567 iconPosition: "beginning", 30568 label: null, 30569 showLabel: true 30570 }, 30571 30572 _getCreateOptions: function() { 30573 var disabled, 30574 30575 // This is to support cases like in jQuery Mobile where the base widget does have 30576 // an implementation of _getCreateOptions 30577 options = this._super() || {}; 30578 30579 this.isInput = this.element.is( "input" ); 30580 30581 disabled = this.element[ 0 ].disabled; 30582 if ( disabled != null ) { 30583 options.disabled = disabled; 30584 } 30585 30586 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 30587 if ( this.originalLabel ) { 30588 options.label = this.originalLabel; 30589 } 30590 30591 return options; 30592 }, 30593 30594 _create: function() { 30595 if ( !this.option.showLabel & !this.options.icon ) { 30596 this.options.showLabel = true; 30597 } 30598 30599 // We have to check the option again here even though we did in _getCreateOptions, 30600 // because null may have been passed on init which would override what was set in 30601 // _getCreateOptions 30602 if ( this.options.disabled == null ) { 30603 this.options.disabled = this.element[ 0 ].disabled || false; 30604 } 30605 30606 this.hasTitle = !!this.element.attr( "title" ); 30607 30608 // Check to see if the label needs to be set or if its already correct 30609 if ( this.options.label && this.options.label !== this.originalLabel ) { 30610 if ( this.isInput ) { 30611 this.element.val( this.options.label ); 30612 } else { 30613 this.element.html( this.options.label ); 30614 } 30615 } 30616 this._addClass( "ui-button", "ui-widget" ); 30617 this._setOption( "disabled", this.options.disabled ); 30618 this._enhance(); 30619 30620 if ( this.element.is( "a" ) ) { 30621 this._on( { 30622 "keyup": function( event ) { 30623 if ( event.keyCode === $.ui.keyCode.SPACE ) { 30624 event.preventDefault(); 30625 30626 // Support: PhantomJS <= 1.9, IE 8 Only 30627 // If a native click is available use it so we actually cause navigation 30628 // otherwise just trigger a click event 30629 if ( this.element[ 0 ].click ) { 30630 this.element[ 0 ].click(); 30631 } else { 30632 this.element.trigger( "click" ); 30633 } 30634 } 30635 } 30636 } ); 30637 } 30638 }, 30639 30640 _enhance: function() { 30641 if ( !this.element.is( "button" ) ) { 30642 this.element.attr( "role", "button" ); 30643 } 30644 30645 if ( this.options.icon ) { 30646 this._updateIcon( "icon", this.options.icon ); 30647 this._updateTooltip(); 30648 } 30649 }, 30650 30651 _updateTooltip: function() { 30652 this.title = this.element.attr( "title" ); 30653 30654 if ( !this.options.showLabel && !this.title ) { 30655 this.element.attr( "title", this.options.label ); 30656 } 30657 }, 30658 30659 _updateIcon: function( option, value ) { 30660 var icon = option !== "iconPosition", 30661 position = icon ? this.options.iconPosition : value, 30662 displayBlock = position === "top" || position === "bottom"; 30663 30664 // Create icon 30665 if ( !this.icon ) { 30666 this.icon = $( "<span>" ); 30667 30668 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 30669 30670 if ( !this.options.showLabel ) { 30671 this._addClass( "ui-button-icon-only" ); 30672 } 30673 } else if ( icon ) { 30674 30675 // If we are updating the icon remove the old icon class 30676 this._removeClass( this.icon, null, this.options.icon ); 30677 } 30678 30679 // If we are updating the icon add the new icon class 30680 if ( icon ) { 30681 this._addClass( this.icon, null, value ); 30682 } 30683 30684 this._attachIcon( position ); 30685 30686 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 30687 // the iconSpace if there is one. 30688 if ( displayBlock ) { 30689 this._addClass( this.icon, null, "ui-widget-icon-block" ); 30690 if ( this.iconSpace ) { 30691 this.iconSpace.remove(); 30692 } 30693 } else { 30694 30695 // Position is beginning or end so remove the ui-widget-icon-block class and add the 30696 // space if it does not exist 30697 if ( !this.iconSpace ) { 30698 this.iconSpace = $( "<span> </span>" ); 30699 this._addClass( this.iconSpace, "ui-button-icon-space" ); 30700 } 30701 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 30702 this._attachIconSpace( position ); 30703 } 30704 }, 30705 30706 _destroy: function() { 30707 this.element.removeAttr( "role" ); 30708 30709 if ( this.icon ) { 30710 this.icon.remove(); 30711 } 30712 if ( this.iconSpace ) { 30713 this.iconSpace.remove(); 30714 } 30715 if ( !this.hasTitle ) { 30716 this.element.removeAttr( "title" ); 30717 } 30718 }, 30719 30720 _attachIconSpace: function( iconPosition ) { 30721 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 30722 }, 30723 30724 _attachIcon: function( iconPosition ) { 30725 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 30726 }, 30727 30728 _setOptions: function( options ) { 30729 var newShowLabel = options.showLabel === undefined ? 30730 this.options.showLabel : 30731 options.showLabel, 30732 newIcon = options.icon === undefined ? this.options.icon : options.icon; 30733 30734 if ( !newShowLabel && !newIcon ) { 30735 options.showLabel = true; 30736 } 30737 this._super( options ); 30738 }, 30739 30740 _setOption: function( key, value ) { 30741 if ( key === "icon" ) { 30742 if ( value ) { 30743 this._updateIcon( key, value ); 30744 } else if ( this.icon ) { 30745 this.icon.remove(); 30746 if ( this.iconSpace ) { 30747 this.iconSpace.remove(); 30748 } 30749 } 30750 } 30751 30752 if ( key === "iconPosition" ) { 30753 this._updateIcon( key, value ); 30754 } 30755 30756 // Make sure we can't end up with a button that has neither text nor icon 30757 if ( key === "showLabel" ) { 30758 this._toggleClass( "ui-button-icon-only", null, !value ); 30759 this._updateTooltip(); 30760 } 30761 30762 if ( key === "label" ) { 30763 if ( this.isInput ) { 30764 this.element.val( value ); 30765 } else { 30766 30767 // If there is an icon, append it, else nothing then append the value 30768 // this avoids removal of the icon when setting label text 30769 this.element.html( value ); 30770 if ( this.icon ) { 30771 this._attachIcon( this.options.iconPosition ); 30772 this._attachIconSpace( this.options.iconPosition ); 30773 } 30774 } 30775 } 30776 30777 this._super( key, value ); 30778 30779 if ( key === "disabled" ) { 30780 this._toggleClass( null, "ui-state-disabled", value ); 30781 this.element[ 0 ].disabled = value; 30782 if ( value ) { 30783 this.element.trigger( "blur" ); 30784 } 30785 } 30786 }, 30787 30788 refresh: function() { 30789 30790 // Make sure to only check disabled if its an element that supports this otherwise 30791 // check for the disabled class to determine state 30792 var isDisabled = this.element.is( "input, button" ) ? 30793 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 30794 30795 if ( isDisabled !== this.options.disabled ) { 30796 this._setOptions( { disabled: isDisabled } ); 30797 } 30798 30799 this._updateTooltip(); 30800 } 30801} ); 30802 30803// DEPRECATED 30804if ( $.uiBackCompat !== false ) { 30805 30806 // Text and Icons options 30807 $.widget( "ui.button", $.ui.button, { 30808 options: { 30809 text: true, 30810 icons: { 30811 primary: null, 30812 secondary: null 30813 } 30814 }, 30815 30816 _create: function() { 30817 if ( this.options.showLabel && !this.options.text ) { 30818 this.options.showLabel = this.options.text; 30819 } 30820 if ( !this.options.showLabel && this.options.text ) { 30821 this.options.text = this.options.showLabel; 30822 } 30823 if ( !this.options.icon && ( this.options.icons.primary || 30824 this.options.icons.secondary ) ) { 30825 if ( this.options.icons.primary ) { 30826 this.options.icon = this.options.icons.primary; 30827 } else { 30828 this.options.icon = this.options.icons.secondary; 30829 this.options.iconPosition = "end"; 30830 } 30831 } else if ( this.options.icon ) { 30832 this.options.icons.primary = this.options.icon; 30833 } 30834 this._super(); 30835 }, 30836 30837 _setOption: function( key, value ) { 30838 if ( key === "text" ) { 30839 this._super( "showLabel", value ); 30840 return; 30841 } 30842 if ( key === "showLabel" ) { 30843 this.options.text = value; 30844 } 30845 if ( key === "icon" ) { 30846 this.options.icons.primary = value; 30847 } 30848 if ( key === "icons" ) { 30849 if ( value.primary ) { 30850 this._super( "icon", value.primary ); 30851 this._super( "iconPosition", "beginning" ); 30852 } else if ( value.secondary ) { 30853 this._super( "icon", value.secondary ); 30854 this._super( "iconPosition", "end" ); 30855 } 30856 } 30857 this._superApply( arguments ); 30858 } 30859 } ); 30860 30861 $.fn.button = ( function( orig ) { 30862 return function( options ) { 30863 var isMethodCall = typeof options === "string"; 30864 var args = Array.prototype.slice.call( arguments, 1 ); 30865 var returnValue = this; 30866 30867 if ( isMethodCall ) { 30868 30869 // If this is an empty collection, we need to have the instance method 30870 // return undefined instead of the jQuery instance 30871 if ( !this.length && options === "instance" ) { 30872 returnValue = undefined; 30873 } else { 30874 this.each( function() { 30875 var methodValue; 30876 var type = $( this ).attr( "type" ); 30877 var name = type !== "checkbox" && type !== "radio" ? 30878 "button" : 30879 "checkboxradio"; 30880 var instance = $.data( this, "ui-" + name ); 30881 30882 if ( options === "instance" ) { 30883 returnValue = instance; 30884 return false; 30885 } 30886 30887 if ( !instance ) { 30888 return $.error( "cannot call methods on button" + 30889 " prior to initialization; " + 30890 "attempted to call method '" + options + "'" ); 30891 } 30892 30893 if ( typeof instance[ options ] !== "function" || 30894 options.charAt( 0 ) === "_" ) { 30895 return $.error( "no such method '" + options + "' for button" + 30896 " widget instance" ); 30897 } 30898 30899 methodValue = instance[ options ].apply( instance, args ); 30900 30901 if ( methodValue !== instance && methodValue !== undefined ) { 30902 returnValue = methodValue && methodValue.jquery ? 30903 returnValue.pushStack( methodValue.get() ) : 30904 methodValue; 30905 return false; 30906 } 30907 } ); 30908 } 30909 } else { 30910 30911 // Allow multiple hashes to be passed on init 30912 if ( args.length ) { 30913 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 30914 } 30915 30916 this.each( function() { 30917 var type = $( this ).attr( "type" ); 30918 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 30919 var instance = $.data( this, "ui-" + name ); 30920 30921 if ( instance ) { 30922 instance.option( options || {} ); 30923 if ( instance._init ) { 30924 instance._init(); 30925 } 30926 } else { 30927 if ( name === "button" ) { 30928 orig.call( $( this ), options ); 30929 return; 30930 } 30931 30932 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 30933 } 30934 } ); 30935 } 30936 30937 return returnValue; 30938 }; 30939 } )( $.fn.button ); 30940 30941 $.fn.buttonset = function() { 30942 if ( !$.ui.controlgroup ) { 30943 $.error( "Controlgroup widget missing" ); 30944 } 30945 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 30946 return this.controlgroup.apply( this, 30947 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 30948 } 30949 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 30950 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 30951 } 30952 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 30953 arguments[ 0 ].items = { 30954 button: arguments[ 0 ].items 30955 }; 30956 } 30957 return this.controlgroup.apply( this, arguments ); 30958 }; 30959} 30960
30961return $.ui.button; 30962 30963} ); 30964 30965( function( factory ) { 30966 "use strict"; 30967 30968 if ( typeof define === "function" && define.amd ) { 30969 30970 // AMD. Register as an anonymous module. 30971 define( [ "jquery", "./version" ], factory ); 30972 } else { 30973 30974 // Browser globals 30975 factory( jQuery ); 30976 } 30977} )( function( $ ) { 30978"use strict"; 30979 30980// This file is deprecated 30981return $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 30982} ); 30983 30984 30985 30986 30987/*! 30988 * jQuery UI Mouse 1.13.3 30989 * https://jqueryui.com 30990 * 30991 * Copyright OpenJS Foundation and other contributors 30992 * Released under the MIT license. 30993 * https://jquery.org/license 30994 */ 30995 30996//>>label: Mouse 30997//>>group: Widgets 30998//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 30999//>>docs: https://api.jqueryui.com/mouse/ 31000 31001( function( factory ) { 31002 "use strict"; 31003 31004 if ( typeof define === "function" && define.amd ) { 31005 31006 // AMD. Register as an anonymous module. 31007 define( [ 31008 "jquery", 31009 "../ie", 31010 "../version", 31011 "../widget" 31012 ], factory ); 31013 } else { 31014 31015 // Browser globals 31016 factory( jQuery ); 31017 } 31018} )( function( $ ) { 31019"use strict"; 31020 31021var mouseHandled = false; 31022$( document ).on( "mouseup", function() { 31023 mouseHandled = false; 31024} ); 31025 31026return $.widget( "ui.mouse", { 31027 version: "1.13.3", 31028 options: { 31029 cancel: "input, textarea, button, select, option", 31030 distance: 1, 31031 delay: 0 31032 }, 31033 _mouseInit: function() { 31034 var that = this; 31035 31036 this.element 31037 .on( "mousedown." + this.widgetName, function( event ) { 31038 return that._mouseDown( event ); 31039 } ) 31040 .on( "click." + this.widgetName, function( event ) { 31041 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 31042 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 31043 event.stopImmediatePropagation(); 31044 return false; 31045 } 31046 } ); 31047 31048 this.started = false; 31049 }, 31050 31051 // TODO: make sure destroying one instance of mouse doesn't mess with 31052 // other instances of mouse 31053 _mouseDestroy: function() { 31054 this.element.off( "." + this.widgetName ); 31055 if ( this._mouseMoveDelegate ) { 31056 this.document 31057 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 31058 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 31059 } 31060 }, 31061 31062 _mouseDown: function( event ) { 31063 31064 // don't let more than one widget handle mouseStart 31065 if ( mouseHandled ) { 31066 return; 31067 } 31068 31069 this._mouseMoved = false;
vendor: 4,521 bytes, lines 31070-31235
31070 31071 // We may have missed mouseup (out of window) 31072 if ( this._mouseStarted ) { 31073 this._mouseUp( event ); 31074 } 31075 31076 this._mouseDownEvent = event; 31077 31078 var that = this, 31079 btnIsLeft = ( event.which === 1 ), 31080 31081 // event.target.nodeName works around a bug in IE 8 with 31082 // disabled inputs (#7620) 31083 elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ? 31084 $( event.target ).closest( this.options.cancel ).length : false ); 31085 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 31086 return true; 31087 } 31088 31089 this.mouseDelayMet = !this.options.delay; 31090 if ( !this.mouseDelayMet ) { 31091 this._mouseDelayTimer = setTimeout( function() { 31092 that.mouseDelayMet = true; 31093 }, this.options.delay ); 31094 } 31095 31096 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 31097 this._mouseStarted = ( this._mouseStart( event ) !== false ); 31098 if ( !this._mouseStarted ) { 31099 event.preventDefault(); 31100 return true; 31101 } 31102 } 31103 31104 // Click event may never have fired (Gecko & Opera) 31105 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 31106 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 31107 } 31108 31109 // These delegates are required to keep context 31110 this._mouseMoveDelegate = function( event ) { 31111 return that._mouseMove( event ); 31112 }; 31113 this._mouseUpDelegate = function( event ) { 31114 return that._mouseUp( event ); 31115 }; 31116 31117 this.document 31118 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 31119 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 31120 31121 event.preventDefault(); 31122 31123 mouseHandled = true; 31124 return true; 31125 }, 31126 31127 _mouseMove: function( event ) { 31128 31129 // Only check for mouseups outside the document if you've moved inside the document 31130 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 31131 // fire a mousemove event if content is placed under the cursor. See #7778 31132 // Support: IE <9 31133 if ( this._mouseMoved ) { 31134 31135 // IE mouseup check - mouseup happened when mouse was out of window 31136 if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && 31137 !event.button ) { 31138 return this._mouseUp( event ); 31139 31140 // Iframe mouseup check - mouseup occurred in another document 31141 } else if ( !event.which ) { 31142 31143 // Support: Safari <=8 - 9 31144 // Safari sets which to 0 if you press any of the following keys 31145 // during a drag (#14461) 31146 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 31147 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 31148 this.ignoreMissingWhich = true; 31149 } else if ( !this.ignoreMissingWhich ) { 31150 return this._mouseUp( event ); 31151 } 31152 } 31153 } 31154 31155 if ( event.which || event.button ) { 31156 this._mouseMoved = true; 31157 } 31158 31159 if ( this._mouseStarted ) { 31160 this._mouseDrag( event ); 31161 return event.preventDefault(); 31162 } 31163 31164 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 31165 this._mouseStarted = 31166 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 31167 if ( this._mouseStarted ) { 31168 this._mouseDrag( event ); 31169 } else { 31170 this._mouseUp( event ); 31171 } 31172 } 31173 31174 return !this._mouseStarted; 31175 }, 31176 31177 _mouseUp: function( event ) { 31178 this.document 31179 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 31180 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 31181 31182 if ( this._mouseStarted ) { 31183 this._mouseStarted = false; 31184 31185 if ( event.target === this._mouseDownEvent.target ) { 31186 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 31187 } 31188 31189 this._mouseStop( event ); 31190 } 31191 31192 if ( this._mouseDelayTimer ) { 31193 clearTimeout( this._mouseDelayTimer ); 31194 delete this._mouseDelayTimer; 31195 } 31196 31197 this.ignoreMissingWhich = false; 31198 mouseHandled = false; 31199 event.preventDefault(); 31200 }, 31201 31202 _mouseDistanceMet: function( event ) { 31203 return ( Math.max( 31204 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 31205 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 31206 ) >= this.options.distance 31207 ); 31208 }, 31209 31210 _mouseDelayMet: function( /* event */ ) { 31211 return this.mouseDelayMet; 31212 }, 31213 31214 // These are placeholder methods, to be overriden by extending plugin 31215 _mouseStart: function( /* event */ ) {}, 31216 _mouseDrag: function( /* event */ ) {}, 31217 _mouseStop: function( /* event */ ) {}, 31218 _mouseCapture: function( /* event */ ) { 31219 return true; 31220 } 31221} ); 31222 31223} ); 31224 31225 31226/*! 31227 * jQuery UI :data 1.13.3 31228 * https://jqueryui.com 31229 * 31230 * Copyright OpenJS Foundation and other contributors 31231 * Released under the MIT license. 31232 * https://jquery.org/license 31233 */ 31234 31235//>>label: :data Selector
31236//>>group: Core 31237//>>description: Selects elements which have data stored under the specified key. 31238//>>docs: https://api.jqueryui.com/data-selector/ 31239 31240( function( factory ) { 31241 "use strict"; 31242 31243 if ( typeof define === "function" && define.amd ) { 31244 31245 // AMD. Register as an anonymous module. 31246 define( [ "jquery", "./version" ], factory ); 31247 } else { 31248 31249 // Browser globals 31250 factory( jQuery ); 31251 } 31252} )( function( $ ) { 31253"use strict"; 31254 31255return $.extend( $.expr.pseudos, { 31256 data: $.expr.createPseudo ? 31257 $.expr.createPseudo( function( dataName ) { 31258 return function( elem ) { 31259 return !!$.data( elem, dataName ); 31260 }; 31261 } ) : 31262 31263 // Support: jQuery <1.8 31264 function( elem, i, match ) { 31265 return !!$.data( elem, match[ 3 ] ); 31266 } 31267} ); 31268} ); 31269 31270( function( factory ) { 31271 "use strict"; 31272 31273 if ( typeof define === "function" && define.amd ) { 31274 31275 // AMD. Register as an anonymous module. 31276 define( [ "jquery", "./version" ], factory ); 31277 } else { 31278 31279 // Browser globals 31280 factory( jQuery ); 31281 } 31282} )( function( $ ) { 31283"use strict"; 31284 31285// $.ui.plugin is deprecated. Use $.widget() extensions instead. 31286return $.ui.plugin = { 31287 add: function( module, option, set ) { 31288 var i, 31289 proto = $.ui[ module ].prototype; 31290 for ( i in set ) { 31291 proto.plugins[ i ] = proto.plugins[ i ] || []; 31292 proto.plugins[ i ].push( [ option, set[ i ] ] ); 31293 } 31294 }, 31295 call: function( instance, name, args, allowDisconnected ) { 31296 var i, 31297 set = instance.plugins[ name ]; 31298 31299 if ( !set ) { 31300 return; 31301 } 31302 31303 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 31304 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 31305 return; 31306 } 31307 31308 for ( i = 0; i < set.length; i++ ) { 31309 if ( instance.options[ set[ i ][ 0 ] ] ) { 31310 set[ i ][ 1 ].apply( instance.element, args ); 31311 } 31312 } 31313 } 31314}; 31315 31316} ); 31317 31318( function( factory ) { 31319 "use strict"; 31320 31321 if ( typeof define === "function" && define.amd ) { 31322 31323 // AMD. Register as an anonymous module. 31324 define( [ "jquery", "./version" ], factory ); 31325 } else { 31326 31327 // Browser globals 31328 factory( jQuery ); 31329 } 31330} )( function( $ ) { 31331"use strict"; 31332 31333return $.ui.safeActiveElement = function( document ) { 31334 var activeElement; 31335 31336 // Support: IE 9 only 31337 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 31338 try { 31339 activeElement = document.activeElement; 31340 } catch ( error ) { 31341 activeElement = document.body; 31342 } 31343 31344 // Support: IE 9 - 11 only 31345 // IE may return null instead of an element 31346 // Interestingly, this only seems to occur when NOT in an iframe 31347 if ( !activeElement ) { 31348 activeElement = document.body; 31349 } 31350 31351 // Support: IE 11 only 31352 // IE11 returns a seemingly empty object in some cases when accessing 31353 // document.activeElement from an <iframe> 31354 if ( !activeElement.nodeName ) { 31355 activeElement = document.body; 31356 } 31357 31358 return activeElement; 31359}; 31360 31361} ); 31362 31363( function( factory ) { 31364 "use strict"; 31365 31366 if ( typeof define === "function" && define.amd ) { 31367 31368 // AMD. Register as an anonymous module. 31369 define( [ "jquery", "./version" ], factory ); 31370 } else { 31371 31372 // Browser globals 31373 factory( jQuery ); 31374 } 31375} )( function( $ ) { 31376"use strict"; 31377 31378return $.ui.safeBlur = function( element ) { 31379 31380 // Support: IE9 - 10 only 31381 // If the <body> is blurred, IE will switch windows, see #9420 31382 if ( element && element.nodeName.toLowerCase() !== "body" ) { 31383 $( element ).trigger( "blur" ); 31384 } 31385}; 31386 31387} ); 31388 31389 31390/*! 31391 * jQuery UI Scroll Parent 1.13.3 31392 * https://jqueryui.com 31393 * 31394 * Copyright OpenJS Foundation and other contributors 31395 * Released under the MIT license. 31396 * https://jquery.org/license 31397 */ 31398 31399//>>label: scrollParent 31400//>>group: Core 31401//>>description: Get the closest ancestor element that is scrollable. 31402//>>docs: https://api.jqueryui.com/scrollParent/ 31403 31404( function( factory ) { 31405 "use strict"; 31406 31407 if ( typeof define === "function" && define.amd ) { 31408 31409 // AMD. Register as an anonymous module. 31410 define( [ "jquery", "./version" ], factory ); 31411 } else { 31412 31413 // Browser globals 31414 factory( jQuery ); 31415 } 31416} )( function( $ ) { 31417"use strict"; 31418 31419return $.fn.scrollParent = function( includeHidden ) { 31420 var position = this.css( "position" ), 31421 excludeStaticParent = position === "absolute", 31422 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 31423 scrollParent = this.parents().filter( function() { 31424 var parent = $( this ); 31425 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 31426 return false;
vendor: 3,785 bytes, lines 31427-31607
31427 } 31428 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 31429 parent.css( "overflow-x" ) ); 31430 } ).eq( 0 ); 31431 31432 return position === "fixed" || !scrollParent.length ? 31433 $( this[ 0 ].ownerDocument || document ) : 31434 scrollParent; 31435}; 31436 31437} ); 31438 31439 31440 31441 31442 31443 31444 31445 31446 31447/*! 31448 * jQuery UI Draggable 1.13.3 31449 * https://jqueryui.com 31450 * 31451 * Copyright OpenJS Foundation and other contributors 31452 * Released under the MIT license. 31453 * https://jquery.org/license 31454 */ 31455 31456//>>label: Draggable 31457//>>group: Interactions 31458//>>description: Enables dragging functionality for any element. 31459//>>docs: https://api.jqueryui.com/draggable/ 31460//>>demos: https://jqueryui.com/draggable/ 31461//>>css.structure: ../../themes/base/draggable.css 31462 31463( function( factory ) { 31464 "use strict"; 31465 31466 if ( typeof define === "function" && define.amd ) { 31467 31468 // AMD. Register as an anonymous module. 31469 define( [ 31470 "jquery", 31471 "./mouse", 31472 "../data", 31473 "../plugin", 31474 "../safe-active-element", 31475 "../safe-blur", 31476 "../scroll-parent", 31477 "../version", 31478 "../widget" 31479 ], factory ); 31480 } else { 31481 31482 // Browser globals 31483 factory( jQuery ); 31484 } 31485} )( function( $ ) { 31486"use strict"; 31487 31488$.widget( "ui.draggable", $.ui.mouse, { 31489 version: "1.13.3", 31490 widgetEventPrefix: "drag", 31491 options: { 31492 addClasses: true, 31493 appendTo: "parent", 31494 axis: false, 31495 connectToSortable: false, 31496 containment: false, 31497 cursor: "auto", 31498 cursorAt: false, 31499 grid: false, 31500 handle: false, 31501 helper: "original", 31502 iframeFix: false, 31503 opacity: false, 31504 refreshPositions: false, 31505 revert: false, 31506 revertDuration: 500, 31507 scope: "default", 31508 scroll: true, 31509 scrollSensitivity: 20, 31510 scrollSpeed: 20, 31511 snap: false, 31512 snapMode: "both", 31513 snapTolerance: 20, 31514 stack: false, 31515 zIndex: false, 31516 31517 // Callbacks 31518 drag: null, 31519 start: null, 31520 stop: null 31521 }, 31522 _create: function() { 31523 31524 if ( this.options.helper === "original" ) { 31525 this._setPositionRelative(); 31526 } 31527 if ( this.options.addClasses ) { 31528 this._addClass( "ui-draggable" ); 31529 } 31530 this._setHandleClassName(); 31531 31532 this._mouseInit(); 31533 }, 31534 31535 _setOption: function( key, value ) { 31536 this._super( key, value ); 31537 if ( key === "handle" ) { 31538 this._removeHandleClassName(); 31539 this._setHandleClassName(); 31540 } 31541 }, 31542 31543 _destroy: function() { 31544 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 31545 this.destroyOnClear = true; 31546 return; 31547 } 31548 this._removeHandleClassName(); 31549 this._mouseDestroy(); 31550 }, 31551 31552 _mouseCapture: function( event ) { 31553 var o = this.options; 31554 31555 // Among others, prevent a drag on a resizable-handle 31556 if ( this.helper || o.disabled || 31557 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 31558 return false; 31559 } 31560 31561 //Quit if we're not on a valid handle 31562 this.handle = this._getHandle( event ); 31563 if ( !this.handle ) { 31564 return false; 31565 } 31566 31567 this._blurActiveElement( event ); 31568 31569 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 31570 31571 return true; 31572 31573 }, 31574 31575 _blockFrames: function( selector ) { 31576 this.iframeBlocks = this.document.find( selector ).map( function() { 31577 var iframe = $( this ); 31578 31579 return $( "<div>" ) 31580 .css( "position", "absolute" ) 31581 .appendTo( iframe.parent() ) 31582 .outerWidth( iframe.outerWidth() ) 31583 .outerHeight( iframe.outerHeight() ) 31584 .offset( iframe.offset() )[ 0 ]; 31585 } ); 31586 }, 31587 31588 _unblockFrames: function() { 31589 if ( this.iframeBlocks ) { 31590 this.iframeBlocks.remove(); 31591 delete this.iframeBlocks; 31592 } 31593 }, 31594 31595 _blurActiveElement: function( event ) { 31596 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 31597 target = $( event.target ); 31598 31599 // Don't blur if the event occurred on an element that is within 31600 // the currently focused element 31601 // See #10527, #12472 31602 if ( target.closest( activeElement ).length ) { 31603 return; 31604 } 31605 31606 // Blur any element that currently has focus, see #4261 31607 $.ui.safeBlur( activeElement
vendor: 10,660 bytes, lines 31607-31982
31607 ); 31608 }, 31609 31610 _mouseStart: function( event ) { 31611 31612 var o = this.options; 31613 31614 //Create and append the visible helper 31615 this.helper = this._createHelper( event ); 31616 31617 this._addClass( this.helper, "ui-draggable-dragging" ); 31618 31619 //Cache the helper size 31620 this._cacheHelperProportions(); 31621 31622 //If ddmanager is used for droppables, set the global draggable 31623 if ( $.ui.ddmanager ) { 31624 $.ui.ddmanager.current = this; 31625 } 31626 31627 /* 31628 * - Position generation - 31629 * This block generates everything position related - it's the core of draggables. 31630 */ 31631 31632 //Cache the margins of the original element 31633 this._cacheMargins(); 31634 31635 //Store the helper's css position 31636 this.cssPosition = this.helper.css( "position" ); 31637 this.scrollParent = this.helper.scrollParent( true ); 31638 this.offsetParent = this.helper.offsetParent(); 31639 this.hasFixedAncestor = this.helper.parents().filter( function() { 31640 return $( this ).css( "position" ) === "fixed"; 31641 } ).length > 0; 31642 31643 //The element's absolute position on the page minus margins 31644 this.positionAbs = this.element.offset(); 31645 this._refreshOffsets( event ); 31646 31647 //Generate the original position 31648 this.originalPosition = this.position = this._generatePosition( event, false ); 31649 this.originalPageX = event.pageX; 31650 this.originalPageY = event.pageY; 31651 31652 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 31653 if ( o.cursorAt ) { 31654 this._adjustOffsetFromHelper( o.cursorAt ); 31655 } 31656 31657 //Set a containment if given in the options 31658 this._setContainment(); 31659 31660 //Trigger event + callbacks 31661 if ( this._trigger( "start", event ) === false ) { 31662 this._clear(); 31663 return false; 31664 } 31665 31666 //Recache the helper size 31667 this._cacheHelperProportions(); 31668 31669 //Prepare the droppable offsets 31670 if ( $.ui.ddmanager && !o.dropBehaviour ) { 31671 $.ui.ddmanager.prepareOffsets( this, event ); 31672 } 31673 31674 // Execute the drag once - this causes the helper not to be visible before getting its 31675 // correct position 31676 this._mouseDrag( event, true ); 31677 31678 // If the ddmanager is used for droppables, inform the manager that dragging has started 31679 // (see #5003) 31680 if ( $.ui.ddmanager ) { 31681 $.ui.ddmanager.dragStart( this, event ); 31682 } 31683 31684 return true; 31685 }, 31686 31687 _refreshOffsets: function( event ) { 31688 this.offset = { 31689 top: this.positionAbs.top - this.margins.top, 31690 left: this.positionAbs.left - this.margins.left, 31691 scroll: false, 31692 parent: this._getParentOffset(), 31693 relative: this._getRelativeOffset() 31694 }; 31695 31696 this.offset.click = { 31697 left: event.pageX - this.offset.left, 31698 top: event.pageY - this.offset.top 31699 }; 31700 }, 31701 31702 _mouseDrag: function( event, noPropagation ) { 31703 31704 // reset any necessary cached properties (see #5009) 31705 if ( this.hasFixedAncestor ) { 31706 this.offset.parent = this._getParentOffset(); 31707 } 31708 31709 //Compute the helpers position 31710 this.position = this._generatePosition( event, true ); 31711 this.positionAbs = this._convertPositionTo( "absolute" ); 31712 31713 //Call plugins and callbacks and use the resulting position if something is returned 31714 if ( !noPropagation ) { 31715 var ui = this._uiHash(); 31716 if ( this._trigger( "drag", event, ui ) === false ) { 31717 this._mouseUp( new $.Event( "mouseup", event ) ); 31718 return false; 31719 } 31720 this.position = ui.position; 31721 } 31722 31723 this.helper[ 0 ].style.left = this.position.left + "px"; 31724 this.helper[ 0 ].style.top = this.position.top + "px"; 31725 31726 if ( $.ui.ddmanager ) { 31727 $.ui.ddmanager.drag( this, event ); 31728 } 31729 31730 return false; 31731 }, 31732 31733 _mouseStop: function( event ) { 31734 31735 //If we are using droppables, inform the manager about the drop 31736 var that = this, 31737 dropped = false; 31738 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 31739 dropped = $.ui.ddmanager.drop( this, event ); 31740 } 31741 31742 //if a drop comes from outside (a sortable) 31743 if ( this.dropped ) { 31744 dropped = this.dropped; 31745 this.dropped = false; 31746 } 31747 31748 if ( ( this.options.revert === "invalid" && !dropped ) || 31749 ( this.options.revert === "valid" && dropped ) || 31750 this.options.revert === true || ( typeof this.options.revert === "function" && 31751 this.options.revert.call( this.element, dropped ) ) 31752 ) { 31753 $( this.helper ).animate( 31754 this.originalPosition, 31755 parseInt( this.options.revertDuration, 10 ), 31756 function() { 31757 if ( that._trigger( "stop", event ) !== false ) { 31758 that._clear(); 31759 } 31760 } 31761 ); 31762 } else { 31763 if ( this._trigger( "stop", event ) !== false ) { 31764 this._clear(); 31765 } 31766 } 31767 31768 return false; 31769 }, 31770 31771 _mouseUp: function( event ) { 31772 this._unblockFrames(); 31773 31774 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 31775 // (see #5003) 31776 if ( $.ui.ddmanager ) { 31777 $.ui.ddmanager.dragStop( this, event ); 31778 } 31779 31780 // Only need to focus if the event occurred on the draggable itself, see #10527 31781 if ( this.handleElement.is( event.target ) ) { 31782 31783 // The interaction is over; whether or not the click resulted in a drag, 31784 // focus the element 31785 this.element.trigger( "focus" ); 31786 } 31787 31788 return $.ui.mouse.prototype._mouseUp.call( this, event ); 31789 }, 31790 31791 cancel: function() { 31792 31793 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 31794 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 31795 } else { 31796 this._clear(); 31797 } 31798 31799 return this; 31800 31801 }, 31802 31803 _getHandle: function( event ) { 31804 return this.options.handle ? 31805 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 31806 true; 31807 }, 31808 31809 _setHandleClassName: function() { 31810 this.handleElement = this.options.handle ? 31811 this.element.find( this.options.handle ) : this.element; 31812 this._addClass( this.handleElement, "ui-draggable-handle" ); 31813 }, 31814 31815 _removeHandleClassName: function() { 31816 this._removeClass( this.handleElement, "ui-draggable-handle" ); 31817 }, 31818 31819 _createHelper: function( event ) { 31820 31821 var o = this.options, 31822 helperIsFunction = typeof o.helper === "function", 31823 helper = helperIsFunction ? 31824 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 31825 ( o.helper === "clone" ? 31826 this.element.clone().removeAttr( "id" ) : 31827 this.element ); 31828 31829 if ( !helper.parents( "body" ).length ) { 31830 helper.appendTo( ( o.appendTo === "parent" ? 31831 this.element[ 0 ].parentNode : 31832 o.appendTo ) ); 31833 } 31834 31835 // https://bugs.jqueryui.com/ticket/9446 31836 // a helper function can return the original element 31837 // which wouldn't have been set to relative in _create 31838 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 31839 this._setPositionRelative(); 31840 } 31841 31842 if ( helper[ 0 ] !== this.element[ 0 ] && 31843 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 31844 helper.css( "position", "absolute" ); 31845 } 31846 31847 return helper; 31848 31849 }, 31850 31851 _setPositionRelative: function() { 31852 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 31853 this.element[ 0 ].style.position = "relative"; 31854 } 31855 }, 31856 31857 _adjustOffsetFromHelper: function( obj ) { 31858 if ( typeof obj === "string" ) { 31859 obj = obj.split( " " ); 31860 } 31861 if ( Array.isArray( obj ) ) { 31862 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 31863 } 31864 if ( "left" in obj ) { 31865 this.offset.click.left = obj.left + this.margins.left; 31866 } 31867 if ( "right" in obj ) { 31868 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 31869 } 31870 if ( "top" in obj ) { 31871 this.offset.click.top = obj.top + this.margins.top; 31872 } 31873 if ( "bottom" in obj ) { 31874 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 31875 } 31876 }, 31877 31878 _isRootNode: function( element ) { 31879 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 31880 }, 31881 31882 _getParentOffset: function() { 31883 31884 //Get the offsetParent and cache its position 31885 var po = this.offsetParent.offset(), 31886 document = this.document[ 0 ]; 31887 31888 // This is a special case where we need to modify a offset calculated on start, since the 31889 // following happened: 31890 // 1. The position of the helper is absolute, so it's position is calculated based on the 31891 // next positioned parent 31892 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 31893 // the document, which means that the scroll is included in the initial calculation of the 31894 // offset of the parent, and never recalculated upon drag 31895 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 31896 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 31897 po.left += this.scrollParent.scrollLeft(); 31898 po.top += this.scrollParent.scrollTop(); 31899 } 31900 31901 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 31902 po = { top: 0, left: 0 }; 31903 } 31904 31905 return { 31906 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 31907 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 31908 }; 31909 31910 }, 31911 31912 _getRelativeOffset: function() { 31913 if ( this.cssPosition !== "relative" ) { 31914 return { top: 0, left: 0 }; 31915 } 31916 31917 var p = this.element.position(), 31918 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 31919 31920 return { 31921 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 31922 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 31923 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 31924 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 31925 }; 31926 31927 }, 31928 31929 _cacheMargins: function() { 31930 this.margins = { 31931 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 31932 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 31933 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 31934 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 31935 }; 31936 }, 31937 31938 _cacheHelperProportions: function() { 31939 this.helperProportions = { 31940 width: this.helper.outerWidth(), 31941 height: this.helper.outerHeight() 31942 }; 31943 }, 31944 31945 _setContainment: function() { 31946 31947 var isUserScrollable, c, ce, 31948 o = this.options, 31949 document = this.document[ 0 ]; 31950 31951 this.relativeContainer = null; 31952 31953 if ( !o.containment ) { 31954 this.containment = null; 31955 return; 31956 } 31957 31958 if ( o.containment === "window" ) { 31959 this.containment = [ 31960 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 31961 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 31962 $( window ).scrollLeft() + $( window ).width() - 31963 this.helperProportions.width - this.margins.left, 31964 $( window ).scrollTop() + 31965 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 31966 this.helperProportions.height - this.margins.top 31967 ]; 31968 return; 31969 } 31970 31971 if ( o.containment === "document" ) { 31972 this.containment = [ 31973 0, 31974 0, 31975 $( document ).width() - this.helperProportions.width - this.margins.left, 31976 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 31977 this.helperProportions.height - this.margins.top 31978 ]; 31979 return; 31980 } 31981 31982 if ( o.containment.constructor === Array ) {
vendor: 10,369 bytes, lines 31983-32329
31983 this.containment = o.containment; 31984 return; 31985 } 31986 31987 if ( o.containment === "parent" ) { 31988 o.containment = this.helper[ 0 ].parentNode; 31989 } 31990 31991 c = $( o.containment ); 31992 ce = c[ 0 ]; 31993 31994 if ( !ce ) { 31995 return; 31996 } 31997 31998 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 31999 32000 this.containment = [ 32001 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 32002 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 32003 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 32004 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 32005 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 32006 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 32007 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 32008 this.helperProportions.width - 32009 this.margins.left - 32010 this.margins.right, 32011 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 32012 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 32013 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 32014 this.helperProportions.height - 32015 this.margins.top - 32016 this.margins.bottom 32017 ]; 32018 this.relativeContainer = c; 32019 }, 32020 32021 _convertPositionTo: function( d, pos ) { 32022 32023 if ( !pos ) { 32024 pos = this.position; 32025 } 32026 32027 var mod = d === "absolute" ? 1 : -1, 32028 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 32029 32030 return { 32031 top: ( 32032 32033 // The absolute mouse position 32034 pos.top + 32035 32036 // Only for relative positioned nodes: Relative offset from element to offset parent 32037 this.offset.relative.top * mod + 32038 32039 // The offsetParent's offset without borders (offset + border) 32040 this.offset.parent.top * mod - 32041 ( ( this.cssPosition === "fixed" ? 32042 -this.offset.scroll.top : 32043 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 32044 ), 32045 left: ( 32046 32047 // The absolute mouse position 32048 pos.left + 32049 32050 // Only for relative positioned nodes: Relative offset from element to offset parent 32051 this.offset.relative.left * mod + 32052 32053 // The offsetParent's offset without borders (offset + border) 32054 this.offset.parent.left * mod - 32055 ( ( this.cssPosition === "fixed" ? 32056 -this.offset.scroll.left : 32057 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 32058 ) 32059 }; 32060 32061 }, 32062 32063 _generatePosition: function( event, constrainPosition ) { 32064 32065 var containment, co, top, left, 32066 o = this.options, 32067 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 32068 pageX = event.pageX, 32069 pageY = event.pageY; 32070 32071 // Cache the scroll 32072 if ( !scrollIsRootNode || !this.offset.scroll ) { 32073 this.offset.scroll = { 32074 top: this.scrollParent.scrollTop(), 32075 left: this.scrollParent.scrollLeft() 32076 }; 32077 } 32078 32079 /* 32080 * - Position constraining - 32081 * Constrain the position to a mix of grid, containment. 32082 */ 32083 32084 // If we are not dragging yet, we won't check for options 32085 if ( constrainPosition ) { 32086 if ( this.containment ) { 32087 if ( this.relativeContainer ) { 32088 co = this.relativeContainer.offset(); 32089 containment = [ 32090 this.containment[ 0 ] + co.left, 32091 this.containment[ 1 ] + co.top, 32092 this.containment[ 2 ] + co.left, 32093 this.containment[ 3 ] + co.top 32094 ]; 32095 } else { 32096 containment = this.containment; 32097 } 32098 32099 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 32100 pageX = containment[ 0 ] + this.offset.click.left; 32101 } 32102 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 32103 pageY = containment[ 1 ] + this.offset.click.top; 32104 } 32105 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 32106 pageX = containment[ 2 ] + this.offset.click.left; 32107 } 32108 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 32109 pageY = containment[ 3 ] + this.offset.click.top; 32110 } 32111 } 32112 32113 if ( o.grid ) { 32114 32115 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 32116 // argument errors in IE (see ticket #6950) 32117 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 32118 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 32119 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 32120 top - this.offset.click.top > containment[ 3 ] ) ? 32121 top : 32122 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 32123 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 32124 32125 left = o.grid[ 0 ] ? this.originalPageX + 32126 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 32127 this.originalPageX; 32128 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 32129 left - this.offset.click.left > containment[ 2 ] ) ? 32130 left : 32131 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 32132 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 32133 } 32134 32135 if ( o.axis === "y" ) { 32136 pageX = this.originalPageX; 32137 } 32138 32139 if ( o.axis === "x" ) { 32140 pageY = this.originalPageY; 32141 } 32142 } 32143 32144 return { 32145 top: ( 32146 32147 // The absolute mouse position 32148 pageY - 32149 32150 // Click offset (relative to the element) 32151 this.offset.click.top - 32152 32153 // Only for relative positioned nodes: Relative offset from element to offset parent 32154 this.offset.relative.top - 32155 32156 // The offsetParent's offset without borders (offset + border) 32157 this.offset.parent.top + 32158 ( this.cssPosition === "fixed" ? 32159 -this.offset.scroll.top : 32160 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 32161 ), 32162 left: ( 32163 32164 // The absolute mouse position 32165 pageX - 32166 32167 // Click offset (relative to the element) 32168 this.offset.click.left - 32169 32170 // Only for relative positioned nodes: Relative offset from element to offset parent 32171 this.offset.relative.left - 32172 32173 // The offsetParent's offset without borders (offset + border) 32174 this.offset.parent.left + 32175 ( this.cssPosition === "fixed" ? 32176 -this.offset.scroll.left : 32177 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 32178 ) 32179 }; 32180 32181 }, 32182 32183 _clear: function() { 32184 this._removeClass( this.helper, "ui-draggable-dragging" ); 32185 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 32186 this.helper.remove(); 32187 } 32188 this.helper = null; 32189 this.cancelHelperRemoval = false; 32190 if ( this.destroyOnClear ) { 32191 this.destroy(); 32192 } 32193 }, 32194 32195 // From now on bulk stuff - mainly helpers 32196 32197 _trigger: function( type, event, ui ) { 32198 ui = ui || this._uiHash(); 32199 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 32200 32201 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 32202 if ( /^(drag|start|stop)/.test( type ) ) { 32203 this.positionAbs = this._convertPositionTo( "absolute" ); 32204 ui.offset = this.positionAbs; 32205 } 32206 return $.Widget.prototype._trigger.call( this, type, event, ui ); 32207 }, 32208 32209 plugins: {}, 32210 32211 _uiHash: function() { 32212 return { 32213 helper: this.helper, 32214 position: this.position, 32215 originalPosition: this.originalPosition, 32216 offset: this.positionAbs 32217 }; 32218 } 32219 32220} ); 32221 32222$.ui.plugin.add( "draggable", "connectToSortable", { 32223 start: function( event, ui, draggable ) { 32224 var uiSortable = $.extend( {}, ui, { 32225 item: draggable.element 32226 } ); 32227 32228 draggable.sortables = []; 32229 $( draggable.options.connectToSortable ).each( function() { 32230 var sortable = $( this ).sortable( "instance" ); 32231 32232 if ( sortable && !sortable.options.disabled ) { 32233 draggable.sortables.push( sortable ); 32234 32235 // RefreshPositions is called at drag start to refresh the containerCache 32236 // which is used in drag. This ensures it's initialized and synchronized 32237 // with any changes that might have happened on the page since initialization. 32238 sortable.refreshPositions(); 32239 sortable._trigger( "activate", event, uiSortable ); 32240 } 32241 } ); 32242 }, 32243 stop: function( event, ui, draggable ) { 32244 var uiSortable = $.extend( {}, ui, { 32245 item: draggable.element 32246 } ); 32247 32248 draggable.cancelHelperRemoval = false; 32249 32250 $.each( draggable.sortables, function() { 32251 var sortable = this; 32252 32253 if ( sortable.isOver ) { 32254 sortable.isOver = 0; 32255 32256 // Allow this sortable to handle removing the helper 32257 draggable.cancelHelperRemoval = true; 32258 sortable.cancelHelperRemoval = false; 32259 32260 // Use _storedCSS To restore properties in the sortable, 32261 // as this also handles revert (#9675) since the draggable 32262 // may have modified them in unexpected ways (#8809) 32263 sortable._storedCSS = { 32264 position: sortable.placeholder.css( "position" ), 32265 top: sortable.placeholder.css( "top" ), 32266 left: sortable.placeholder.css( "left" ) 32267 }; 32268 32269 sortable._mouseStop( event ); 32270 32271 // Once drag has ended, the sortable should return to using 32272 // its original helper, not the shared helper from draggable 32273 sortable.options.helper = sortable.options._helper; 32274 } else { 32275 32276 // Prevent this Sortable from removing the helper. 32277 // However, don't set the draggable to remove the helper 32278 // either as another connected Sortable may yet handle the removal. 32279 sortable.cancelHelperRemoval = true; 32280 32281 sortable._trigger( "deactivate", event, uiSortable ); 32282 } 32283 } ); 32284 }, 32285 drag: function( event, ui, draggable ) { 32286 $.each( draggable.sortables, function() { 32287 var innermostIntersecting = false, 32288 sortable = this; 32289 32290 // Copy over variables that sortable's _intersectsWith uses 32291 sortable.positionAbs = draggable.positionAbs; 32292 sortable.helperProportions = draggable.helperProportions; 32293 sortable.offset.click = draggable.offset.click; 32294 32295 if ( sortable._intersectsWith( sortable.containerCache ) ) { 32296 innermostIntersecting = true; 32297 32298 $.each( draggable.sortables, function() { 32299 32300 // Copy over variables that sortable's _intersectsWith uses 32301 this.positionAbs = draggable.positionAbs; 32302 this.helperProportions = draggable.helperProportions; 32303 this.offset.click = draggable.offset.click; 32304 32305 if ( this !== sortable && 32306 this._intersectsWith( this.containerCache ) && 32307 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 32308 innermostIntersecting = false; 32309 } 32310 32311 return innermostIntersecting; 32312 } ); 32313 } 32314 32315 if ( innermostIntersecting ) { 32316 32317 // If it intersects, we use a little isOver variable and set it once, 32318 // so that the move-in stuff gets fired only once. 32319 if ( !sortable.isOver ) { 32320 sortable.isOver = 1; 32321 32322 // Store draggable's parent in case we need to reappend to it later. 32323 draggable._parent = ui.helper.parent(); 32324 32325 sortable.currentItem = ui.helper 32326 .appendTo( sortable.element ) 32327 .data( "ui-sortable-item", true ); 32328 32329 // Store helper option to later restore it
vendor: 10,978 bytes, lines 32330-32702
32330 sortable.options._helper = sortable.options.helper; 32331 32332 sortable.options.helper = function() { 32333 return ui.helper[ 0 ]; 32334 }; 32335 32336 // Fire the start events of the sortable with our passed browser event, 32337 // and our own helper (so it doesn't create a new one) 32338 event.target = sortable.currentItem[ 0 ]; 32339 sortable._mouseCapture( event, true ); 32340 sortable._mouseStart( event, true, true ); 32341 32342 // Because the browser event is way off the new appended portlet, 32343 // modify necessary variables to reflect the changes 32344 sortable.offset.click.top = draggable.offset.click.top; 32345 sortable.offset.click.left = draggable.offset.click.left; 32346 sortable.offset.parent.left -= draggable.offset.parent.left - 32347 sortable.offset.parent.left; 32348 sortable.offset.parent.top -= draggable.offset.parent.top - 32349 sortable.offset.parent.top; 32350 32351 draggable._trigger( "toSortable", event ); 32352 32353 // Inform draggable that the helper is in a valid drop zone, 32354 // used solely in the revert option to handle "valid/invalid". 32355 draggable.dropped = sortable.element; 32356 32357 // Need to refreshPositions of all sortables in the case that 32358 // adding to one sortable changes the location of the other sortables (#9675) 32359 $.each( draggable.sortables, function() { 32360 this.refreshPositions(); 32361 } ); 32362 32363 // Hack so receive/update callbacks work (mostly) 32364 draggable.currentItem = draggable.element; 32365 sortable.fromOutside = draggable; 32366 } 32367 32368 if ( sortable.currentItem ) { 32369 sortable._mouseDrag( event ); 32370 32371 // Copy the sortable's position because the draggable's can potentially reflect 32372 // a relative position, while sortable is always absolute, which the dragged 32373 // element has now become. (#8809) 32374 ui.position = sortable.position; 32375 } 32376 } else { 32377 32378 // If it doesn't intersect with the sortable, and it intersected before, 32379 // we fake the drag stop of the sortable, but make sure it doesn't remove 32380 // the helper by using cancelHelperRemoval. 32381 if ( sortable.isOver ) { 32382 32383 sortable.isOver = 0; 32384 sortable.cancelHelperRemoval = true; 32385 32386 // Calling sortable's mouseStop would trigger a revert, 32387 // so revert must be temporarily false until after mouseStop is called. 32388 sortable.options._revert = sortable.options.revert; 32389 sortable.options.revert = false; 32390 32391 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 32392 sortable._mouseStop( event, true ); 32393 32394 // Restore sortable behaviors that were modfied 32395 // when the draggable entered the sortable area (#9481) 32396 sortable.options.revert = sortable.options._revert; 32397 sortable.options.helper = sortable.options._helper; 32398 32399 if ( sortable.placeholder ) { 32400 sortable.placeholder.remove(); 32401 } 32402 32403 // Restore and recalculate the draggable's offset considering the sortable 32404 // may have modified them in unexpected ways. (#8809, #10669) 32405 ui.helper.appendTo( draggable._parent ); 32406 draggable._refreshOffsets( event ); 32407 ui.position = draggable._generatePosition( event, true ); 32408 32409 draggable._trigger( "fromSortable", event ); 32410 32411 // Inform draggable that the helper is no longer in a valid drop zone 32412 draggable.dropped = false; 32413 32414 // Need to refreshPositions of all sortables just in case removing 32415 // from one sortable changes the location of other sortables (#9675) 32416 $.each( draggable.sortables, function() { 32417 this.refreshPositions(); 32418 } ); 32419 } 32420 } 32421 } ); 32422 } 32423} ); 32424 32425$.ui.plugin.add( "draggable", "cursor", { 32426 start: function( event, ui, instance ) { 32427 var t = $( "body" ), 32428 o = instance.options; 32429 32430 if ( t.css( "cursor" ) ) { 32431 o._cursor = t.css( "cursor" ); 32432 } 32433 t.css( "cursor", o.cursor ); 32434 }, 32435 stop: function( event, ui, instance ) { 32436 var o = instance.options; 32437 if ( o._cursor ) { 32438 $( "body" ).css( "cursor", o._cursor ); 32439 } 32440 } 32441} ); 32442 32443$.ui.plugin.add( "draggable", "opacity", { 32444 start: function( event, ui, instance ) { 32445 var t = $( ui.helper ), 32446 o = instance.options; 32447 if ( t.css( "opacity" ) ) { 32448 o._opacity = t.css( "opacity" ); 32449 } 32450 t.css( "opacity", o.opacity ); 32451 }, 32452 stop: function( event, ui, instance ) { 32453 var o = instance.options; 32454 if ( o._opacity ) { 32455 $( ui.helper ).css( "opacity", o._opacity ); 32456 } 32457 } 32458} ); 32459 32460$.ui.plugin.add( "draggable", "scroll", { 32461 start: function( event, ui, i ) { 32462 if ( !i.scrollParentNotHidden ) { 32463 i.scrollParentNotHidden = i.helper.scrollParent( false ); 32464 } 32465 32466 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 32467 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 32468 i.overflowOffset = i.scrollParentNotHidden.offset(); 32469 } 32470 }, 32471 drag: function( event, ui, i ) { 32472 32473 var o = i.options, 32474 scrolled = false, 32475 scrollParent = i.scrollParentNotHidden[ 0 ], 32476 document = i.document[ 0 ]; 32477 32478 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 32479 if ( !o.axis || o.axis !== "x" ) { 32480 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 32481 o.scrollSensitivity ) { 32482 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 32483 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 32484 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 32485 } 32486 } 32487 32488 if ( !o.axis || o.axis !== "y" ) { 32489 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 32490 o.scrollSensitivity ) { 32491 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 32492 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 32493 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 32494 } 32495 } 32496 32497 } else { 32498 32499 if ( !o.axis || o.axis !== "x" ) { 32500 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 32501 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 32502 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 32503 o.scrollSensitivity ) { 32504 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 32505 } 32506 } 32507 32508 if ( !o.axis || o.axis !== "y" ) { 32509 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 32510 scrolled = $( document ).scrollLeft( 32511 $( document ).scrollLeft() - o.scrollSpeed 32512 ); 32513 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 32514 o.scrollSensitivity ) { 32515 scrolled = $( document ).scrollLeft( 32516 $( document ).scrollLeft() + o.scrollSpeed 32517 ); 32518 } 32519 } 32520 32521 } 32522 32523 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 32524 $.ui.ddmanager.prepareOffsets( i, event ); 32525 } 32526 32527 } 32528} ); 32529 32530$.ui.plugin.add( "draggable", "snap", { 32531 start: function( event, ui, i ) { 32532 32533 var o = i.options; 32534 32535 i.snapElements = []; 32536 32537 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 32538 .each( function() { 32539 var $t = $( this ), 32540 $o = $t.offset(); 32541 if ( this !== i.element[ 0 ] ) { 32542 i.snapElements.push( { 32543 item: this, 32544 width: $t.outerWidth(), height: $t.outerHeight(), 32545 top: $o.top, left: $o.left 32546 } ); 32547 } 32548 } ); 32549 32550 }, 32551 drag: function( event, ui, inst ) { 32552 32553 var ts, bs, ls, rs, l, r, t, b, i, first, 32554 o = inst.options, 32555 d = o.snapTolerance, 32556 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 32557 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 32558 32559 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 32560 32561 l = inst.snapElements[ i ].left - inst.margins.left; 32562 r = l + inst.snapElements[ i ].width; 32563 t = inst.snapElements[ i ].top - inst.margins.top; 32564 b = t + inst.snapElements[ i ].height; 32565 32566 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 32567 !$.contains( inst.snapElements[ i ].item.ownerDocument, 32568 inst.snapElements[ i ].item ) ) { 32569 if ( inst.snapElements[ i ].snapping ) { 32570 if ( inst.options.snap.release ) { 32571 inst.options.snap.release.call( 32572 inst.element, 32573 event, 32574 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 32575 ); 32576 } 32577 } 32578 inst.snapElements[ i ].snapping = false; 32579 continue; 32580 } 32581 32582 if ( o.snapMode !== "inner" ) { 32583 ts = Math.abs( t - y2 ) <= d; 32584 bs = Math.abs( b - y1 ) <= d; 32585 ls = Math.abs( l - x2 ) <= d; 32586 rs = Math.abs( r - x1 ) <= d; 32587 if ( ts ) { 32588 ui.position.top = inst._convertPositionTo( "relative", { 32589 top: t - inst.helperProportions.height, 32590 left: 0 32591 } ).top; 32592 } 32593 if ( bs ) { 32594 ui.position.top = inst._convertPositionTo( "relative", { 32595 top: b, 32596 left: 0 32597 } ).top; 32598 } 32599 if ( ls ) { 32600 ui.position.left = inst._convertPositionTo( "relative", { 32601 top: 0, 32602 left: l - inst.helperProportions.width 32603 } ).left; 32604 } 32605 if ( rs ) { 32606 ui.position.left = inst._convertPositionTo( "relative", { 32607 top: 0, 32608 left: r 32609 } ).left; 32610 } 32611 } 32612 32613 first = ( ts || bs || ls || rs ); 32614 32615 if ( o.snapMode !== "outer" ) { 32616 ts = Math.abs( t - y1 ) <= d; 32617 bs = Math.abs( b - y2 ) <= d; 32618 ls = Math.abs( l - x1 ) <= d; 32619 rs = Math.abs( r - x2 ) <= d; 32620 if ( ts ) { 32621 ui.position.top = inst._convertPositionTo( "relative", { 32622 top: t, 32623 left: 0 32624 } ).top; 32625 } 32626 if ( bs ) { 32627 ui.position.top = inst._convertPositionTo( "relative", { 32628 top: b - inst.helperProportions.height, 32629 left: 0 32630 } ).top; 32631 } 32632 if ( ls ) { 32633 ui.position.left = inst._convertPositionTo( "relative", { 32634 top: 0, 32635 left: l 32636 } ).left; 32637 } 32638 if ( rs ) { 32639 ui.position.left = inst._convertPositionTo( "relative", { 32640 top: 0, 32641 left: r - inst.helperProportions.width 32642 } ).left; 32643 } 32644 } 32645 32646 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 32647 if ( inst.options.snap.snap ) { 32648 inst.options.snap.snap.call( 32649 inst.element, 32650 event, 32651 $.extend( inst._uiHash(), { 32652 snapItem: inst.snapElements[ i ].item 32653 } ) ); 32654 } 32655 } 32656 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 32657 32658 } 32659 32660 } 32661} ); 32662 32663$.ui.plugin.add( "draggable", "stack", { 32664 start: function( event, ui, instance ) { 32665 var min, 32666 o = instance.options, 32667 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 32668 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 32669 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 32670 } ); 32671 32672 if ( !group.length ) { 32673 return; 32674 } 32675 32676 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 32677 $( group ).each( function( i ) { 32678 $( this ).css( "zIndex", min + i ); 32679 } ); 32680 this.css( "zIndex", ( min + group.length ) ); 32681 } 32682} ); 32683 32684$.ui.plugin.add( "draggable", "zIndex", { 32685 start: function( event, ui, instance ) { 32686 var t = $( ui.helper ), 32687 o = instance.options; 32688 32689 if ( t.css( "zIndex" ) ) { 32690 o._zIndex = t.css( "zIndex" ); 32691 } 32692 t.css( "zIndex", o.zIndex ); 32693 }, 32694 stop: function( event, ui, instance ) { 32695 var o = instance.options; 32696 32697 if ( o._zIndex ) { 32698 $( ui.helper ).css( "zIndex", o._zIndex ); 32699 } 32700 } 32701} ); 32702
32703return $.ui.draggable; 32704 32705} ); 32706 32707 32708/*! 32709 * jQuery UI Disable Selection 1.13.3 32710 * https://jqueryui.com 32711 * 32712 * Copyright OpenJS Foundation and other contributors 32713 * Released under the MIT license. 32714 * https://jquery.org/license 32715 */ 32716 32717//>>label: disableSelection 32718//>>group: Core 32719//>>description: Disable selection of text content within the set of matched elements. 32720//>>docs: https://api.jqueryui.com/disableSelection/ 32721 32722// This file is deprecated 32723( function( factory ) { 32724 "use strict"; 32725 32726 if ( typeof define === "function" && define.amd ) { 32727 32728 // AMD. Register as an anonymous module. 32729 define( [ "jquery", "./version" ], factory ); 32730 } else { 32731 32732 // Browser globals 32733 factory( jQuery ); 32734 } 32735} )( function( $ ) { 32736"use strict"; 32737 32738return $.fn.extend( { 32739 disableSelection: ( function() { 32740 var eventType = "onselectstart" in document.createElement( "div" ) ? 32741 "selectstart" : 32742 "mousedown"; 32743 32744 return function() { 32745 return this.on( eventType + ".ui-disableSelection", function( event ) { 32746 event.preventDefault(); 32747 } ); 32748 }; 32749 } )(), 32750 32751 enableSelection: function() { 32752 return this.off( ".ui-disableSelection" ); 32753 } 32754} ); 32755 32756} ); 32757 32758 32759 32760 32761 32762 32763/*! 32764 * jQuery UI Resizable 1.13.3 32765 * https://jqueryui.com 32766 * 32767 * Copyright OpenJS Foundation and other contributors 32768 * Released under the MIT license. 32769 * https://jquery.org/license 32770 */ 32771 32772//>>label: Resizable 32773//>>group: Interactions 32774//>>description: Enables resize functionality for any element. 32775//>>docs: https://api.jqueryui.com/resizable/ 32776//>>demos: https://jqueryui.com/resizable/ 32777//>>css.structure: ../../themes/base/core.css 32778//>>css.structure: ../../themes/base/resizable.css 32779//>>css.theme: ../../themes/base/theme.css 32780 32781( function( factory ) { 32782 "use strict"; 32783 32784 if ( typeof define === "function" && define.amd ) { 32785 32786 // AMD. Register as an anonymous module. 32787 define( [ 32788 "jquery", 32789 "./mouse", 32790 "../disable-selection", 32791 "../plugin", 32792 "../version", 32793 "../widget" 32794 ], factory ); 32795 } else { 32796 32797 // Browser globals 32798 factory( jQuery ); 32799 } 32800} )( function( $ ) { 32801"use strict";
vendor: 29,581 bytes, lines 32801-33981
32801 32802 32803$.widget( "ui.resizable", $.ui.mouse, { 32804 version: "1.13.3", 32805 widgetEventPrefix: "resize", 32806 options: { 32807 alsoResize: false, 32808 animate: false, 32809 animateDuration: "slow", 32810 animateEasing: "swing", 32811 aspectRatio: false, 32812 autoHide: false, 32813 classes: { 32814 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 32815 }, 32816 containment: false, 32817 ghost: false, 32818 grid: false, 32819 handles: "e,s,se", 32820 helper: false, 32821 maxHeight: null, 32822 maxWidth: null, 32823 minHeight: 10, 32824 minWidth: 10, 32825 32826 // See #7960 32827 zIndex: 90, 32828 32829 // Callbacks 32830 resize: null, 32831 start: null, 32832 stop: null 32833 }, 32834 32835 _num: function( value ) { 32836 return parseFloat( value ) || 0; 32837 }, 32838 32839 _isNumber: function( value ) { 32840 return !isNaN( parseFloat( value ) ); 32841 }, 32842 32843 _hasScroll: function( el, a ) { 32844 32845 if ( $( el ).css( "overflow" ) === "hidden" ) { 32846 return false; 32847 } 32848 32849 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 32850 has = false; 32851 32852 if ( el[ scroll ] > 0 ) { 32853 return true; 32854 } 32855 32856 // TODO: determine which cases actually cause this to happen 32857 // if the element doesn't have the scroll set, see if it's possible to 32858 // set the scroll 32859 try { 32860 el[ scroll ] = 1; 32861 has = ( el[ scroll ] > 0 ); 32862 el[ scroll ] = 0; 32863 } catch ( e ) { 32864 32865 // `el` might be a string, then setting `scroll` will throw 32866 // an error in strict mode; ignore it. 32867 } 32868 return has; 32869 }, 32870 32871 _create: function() { 32872 32873 var margins, 32874 o = this.options, 32875 that = this; 32876 this._addClass( "ui-resizable" ); 32877 32878 $.extend( this, { 32879 _aspectRatio: !!( o.aspectRatio ), 32880 aspectRatio: o.aspectRatio, 32881 originalElement: this.element, 32882 _proportionallyResizeElements: [], 32883 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 32884 } ); 32885 32886 // Wrap the element if it cannot hold child nodes 32887 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 32888 32889 this.element.wrap( 32890 $( "<div class='ui-wrapper'></div>" ).css( { 32891 overflow: "hidden", 32892 position: this.element.css( "position" ), 32893 width: this.element.outerWidth(), 32894 height: this.element.outerHeight(), 32895 top: this.element.css( "top" ), 32896 left: this.element.css( "left" ) 32897 } ) 32898 ); 32899 32900 this.element = this.element.parent().data( 32901 "ui-resizable", this.element.resizable( "instance" ) 32902 ); 32903 32904 this.elementIsWrapper = true; 32905 32906 margins = { 32907 marginTop: this.originalElement.css( "marginTop" ), 32908 marginRight: this.originalElement.css( "marginRight" ), 32909 marginBottom: this.originalElement.css( "marginBottom" ), 32910 marginLeft: this.originalElement.css( "marginLeft" ) 32911 }; 32912 32913 this.element.css( margins ); 32914 this.originalElement.css( "margin", 0 ); 32915 32916 // support: Safari 32917 // Prevent Safari textarea resize 32918 this.originalResizeStyle = this.originalElement.css( "resize" ); 32919 this.originalElement.css( "resize", "none" ); 32920 32921 this._proportionallyResizeElements.push( this.originalElement.css( { 32922 position: "static", 32923 zoom: 1, 32924 display: "block" 32925 } ) ); 32926 32927 // Support: IE9 32928 // avoid IE jump (hard set the margin) 32929 this.originalElement.css( margins ); 32930 32931 this._proportionallyResize(); 32932 } 32933 32934 this._setupHandles(); 32935 32936 if ( o.autoHide ) { 32937 $( this.element ) 32938 .on( "mouseenter", function() { 32939 if ( o.disabled ) { 32940 return; 32941 } 32942 that._removeClass( "ui-resizable-autohide" ); 32943 that._handles.show(); 32944 } ) 32945 .on( "mouseleave", function() { 32946 if ( o.disabled ) { 32947 return; 32948 } 32949 if ( !that.resizing ) { 32950 that._addClass( "ui-resizable-autohide" ); 32951 that._handles.hide(); 32952 } 32953 } ); 32954 } 32955 32956 this._mouseInit(); 32957 }, 32958 32959 _destroy: function() { 32960 32961 this._mouseDestroy(); 32962 this._addedHandles.remove(); 32963 32964 var wrapper, 32965 _destroy = function( exp ) { 32966 $( exp ) 32967 .removeData( "resizable" ) 32968 .removeData( "ui-resizable" ) 32969 .off( ".resizable" ); 32970 }; 32971 32972 // TODO: Unwrap at same DOM position 32973 if ( this.elementIsWrapper ) { 32974 _destroy( this.element ); 32975 wrapper = this.element; 32976 this.originalElement.css( { 32977 position: wrapper.css( "position" ), 32978 width: wrapper.outerWidth(), 32979 height: wrapper.outerHeight(), 32980 top: wrapper.css( "top" ), 32981 left: wrapper.css( "left" ) 32982 } ).insertAfter( wrapper ); 32983 wrapper.remove(); 32984 } 32985 32986 this.originalElement.css( "resize", this.originalResizeStyle ); 32987 _destroy( this.originalElement ); 32988 32989 return this; 32990 }, 32991 32992 _setOption: function( key, value ) { 32993 this._super( key, value ); 32994 32995 switch ( key ) { 32996 case "handles": 32997 this._removeHandles(); 32998 this._setupHandles(); 32999 break; 33000 case "aspectRatio": 33001 this._aspectRatio = !!value; 33002 break; 33003 default: 33004 break; 33005 } 33006 }, 33007 33008 _setupHandles: function() { 33009 var o = this.options, handle, i, n, hname, axis, that = this; 33010 this.handles = o.handles || 33011 ( !$( ".ui-resizable-handle", this.element ).length ? 33012 "e,s,se" : { 33013 n: ".ui-resizable-n", 33014 e: ".ui-resizable-e", 33015 s: ".ui-resizable-s", 33016 w: ".ui-resizable-w", 33017 se: ".ui-resizable-se", 33018 sw: ".ui-resizable-sw", 33019 ne: ".ui-resizable-ne", 33020 nw: ".ui-resizable-nw" 33021 } ); 33022 33023 this._handles = $(); 33024 this._addedHandles = $(); 33025 if ( this.handles.constructor === String ) { 33026 33027 if ( this.handles === "all" ) { 33028 this.handles = "n,e,s,w,se,sw,ne,nw"; 33029 } 33030 33031 n = this.handles.split( "," ); 33032 this.handles = {}; 33033 33034 for ( i = 0; i < n.length; i++ ) { 33035 33036 handle = String.prototype.trim.call( n[ i ] ); 33037 hname = "ui-resizable-" + handle; 33038 axis = $( "<div>" ); 33039 this._addClass( axis, "ui-resizable-handle " + hname ); 33040 33041 axis.css( { zIndex: o.zIndex } ); 33042 33043 this.handles[ handle ] = ".ui-resizable-" + handle; 33044 if ( !this.element.children( this.handles[ handle ] ).length ) { 33045 this.element.append( axis ); 33046 this._addedHandles = this._addedHandles.add( axis ); 33047 } 33048 } 33049 33050 } 33051 33052 this._renderAxis = function( target ) { 33053 33054 var i, axis, padPos, padWrapper; 33055 33056 target = target || this.element; 33057 33058 for ( i in this.handles ) { 33059 33060 if ( this.handles[ i ].constructor === String ) { 33061 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 33062 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 33063 this.handles[ i ] = $( this.handles[ i ] ); 33064 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 33065 } 33066 33067 if ( this.elementIsWrapper && 33068 this.originalElement[ 0 ] 33069 .nodeName 33070 .match( /^(textarea|input|select|button)$/i ) ) { 33071 axis = $( this.handles[ i ], this.element ); 33072 33073 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 33074 axis.outerHeight() : 33075 axis.outerWidth(); 33076 33077 padPos = [ "padding", 33078 /ne|nw|n/.test( i ) ? "Top" : 33079 /se|sw|s/.test( i ) ? "Bottom" : 33080 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 33081 33082 target.css( padPos, padWrapper ); 33083 33084 this._proportionallyResize(); 33085 } 33086 33087 this._handles = this._handles.add( this.handles[ i ] ); 33088 } 33089 }; 33090 33091 // TODO: make renderAxis a prototype function 33092 this._renderAxis( this.element ); 33093 33094 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 33095 this._handles.disableSelection(); 33096 33097 this._handles.on( "mouseover", function() { 33098 if ( !that.resizing ) { 33099 if ( this.className ) { 33100 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 33101 } 33102 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 33103 } 33104 } ); 33105 33106 if ( o.autoHide ) { 33107 this._handles.hide(); 33108 this._addClass( "ui-resizable-autohide" ); 33109 } 33110 }, 33111 33112 _removeHandles: function() { 33113 this._addedHandles.remove(); 33114 }, 33115 33116 _mouseCapture: function( event ) { 33117 var i, handle, 33118 capture = false; 33119 33120 for ( i in this.handles ) { 33121 handle = $( this.handles[ i ] )[ 0 ]; 33122 if ( handle === event.target || $.contains( handle, event.target ) ) { 33123 capture = true; 33124 } 33125 } 33126 33127 return !this.options.disabled && capture; 33128 }, 33129 33130 _mouseStart: function( event ) { 33131 33132 var curleft, curtop, cursor, 33133 o = this.options, 33134 el = this.element; 33135 33136 this.resizing = true; 33137 33138 this._renderProxy(); 33139 33140 curleft = this._num( this.helper.css( "left" ) ); 33141 curtop = this._num( this.helper.css( "top" ) ); 33142 33143 if ( o.containment ) { 33144 curleft += $( o.containment ).scrollLeft() || 0; 33145 curtop += $( o.containment ).scrollTop() || 0; 33146 } 33147 33148 this.offset = this.helper.offset(); 33149 this.position = { left: curleft, top: curtop }; 33150 33151 this.size = this._helper ? { 33152 width: this.helper.width(), 33153 height: this.helper.height() 33154 } : { 33155 width: el.width(), 33156 height: el.height() 33157 }; 33158 33159 this.originalSize = this._helper ? { 33160 width: el.outerWidth(), 33161 height: el.outerHeight() 33162 } : { 33163 width: el.width(), 33164 height: el.height() 33165 }; 33166 33167 this.sizeDiff = { 33168 width: el.outerWidth() - el.width(), 33169 height: el.outerHeight() - el.height() 33170 }; 33171 33172 this.originalPosition = { left: curleft, top: curtop }; 33173 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 33174 33175 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 33176 o.aspectRatio : 33177 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 33178 33179 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 33180 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 33181 33182 this._addClass( "ui-resizable-resizing" ); 33183 this._propagate( "start", event ); 33184 return true; 33185 }, 33186 33187 _mouseDrag: function( event ) { 33188 33189 var data, props, 33190 smp = this.originalMousePosition, 33191 a = this.axis, 33192 dx = ( event.pageX - smp.left ) || 0, 33193 dy = ( event.pageY - smp.top ) || 0, 33194 trigger = this._change[ a ]; 33195 33196 this._updatePrevProperties(); 33197 33198 if ( !trigger ) { 33199 return false; 33200 } 33201 33202 data = trigger.apply( this, [ event, dx, dy ] ); 33203 33204 this._updateVirtualBoundaries( event.shiftKey ); 33205 if ( this._aspectRatio || event.shiftKey ) { 33206 data = this._updateRatio( data, event ); 33207 } 33208 33209 data = this._respectSize( data, event ); 33210 33211 this._updateCache( data ); 33212 33213 this._propagate( "resize", event ); 33214 33215 props = this._applyChanges(); 33216 33217 if ( !this._helper && this._proportionallyResizeElements.length ) { 33218 this._proportionallyResize(); 33219 } 33220 33221 if ( !$.isEmptyObject( props ) ) { 33222 this._updatePrevProperties(); 33223 this._trigger( "resize", event, this.ui() ); 33224 this._applyChanges(); 33225 } 33226 33227 return false; 33228 }, 33229 33230 _mouseStop: function( event ) { 33231 33232 this.resizing = false; 33233 var pr, ista, soffseth, soffsetw, s, left, top, 33234 o = this.options, that = this; 33235 33236 if ( this._helper ) { 33237 33238 pr = this._proportionallyResizeElements; 33239 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 33240 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 33241 soffsetw = ista ? 0 : that.sizeDiff.width; 33242 33243 s = { 33244 width: ( that.helper.width() - soffsetw ), 33245 height: ( that.helper.height() - soffseth ) 33246 }; 33247 left = ( parseFloat( that.element.css( "left" ) ) + 33248 ( that.position.left - that.originalPosition.left ) ) || null; 33249 top = ( parseFloat( that.element.css( "top" ) ) + 33250 ( that.position.top - that.originalPosition.top ) ) || null; 33251 33252 if ( !o.animate ) { 33253 this.element.css( $.extend( s, { top: top, left: left } ) ); 33254 } 33255 33256 that.helper.height( that.size.height ); 33257 that.helper.width( that.size.width ); 33258 33259 if ( this._helper && !o.animate ) { 33260 this._proportionallyResize(); 33261 } 33262 } 33263 33264 $( "body" ).css( "cursor", "auto" ); 33265 33266 this._removeClass( "ui-resizable-resizing" ); 33267 33268 this._propagate( "stop", event ); 33269 33270 if ( this._helper ) { 33271 this.helper.remove(); 33272 } 33273 33274 return false; 33275 33276 }, 33277 33278 _updatePrevProperties: function() { 33279 this.prevPosition = { 33280 top: this.position.top, 33281 left: this.position.left 33282 }; 33283 this.prevSize = { 33284 width: this.size.width, 33285 height: this.size.height 33286 }; 33287 }, 33288 33289 _applyChanges: function() { 33290 var props = {}; 33291 33292 if ( this.position.top !== this.prevPosition.top ) { 33293 props.top = this.position.top + "px"; 33294 } 33295 if ( this.position.left !== this.prevPosition.left ) { 33296 props.left = this.position.left + "px"; 33297 } 33298 33299 this.helper.css( props ); 33300 33301 if ( this.size.width !== this.prevSize.width ) { 33302 props.width = this.size.width + "px"; 33303 this.helper.width( props.width ); 33304 } 33305 if ( this.size.height !== this.prevSize.height ) { 33306 props.height = this.size.height + "px"; 33307 this.helper.height( props.height ); 33308 } 33309 33310 return props; 33311 }, 33312 33313 _updateVirtualBoundaries: function( forceAspectRatio ) { 33314 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 33315 o = this.options; 33316 33317 b = { 33318 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 33319 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 33320 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 33321 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 33322 }; 33323 33324 if ( this._aspectRatio || forceAspectRatio ) { 33325 pMinWidth = b.minHeight * this.aspectRatio; 33326 pMinHeight = b.minWidth / this.aspectRatio; 33327 pMaxWidth = b.maxHeight * this.aspectRatio; 33328 pMaxHeight = b.maxWidth / this.aspectRatio; 33329 33330 if ( pMinWidth > b.minWidth ) { 33331 b.minWidth = pMinWidth; 33332 } 33333 if ( pMinHeight > b.minHeight ) { 33334 b.minHeight = pMinHeight; 33335 } 33336 if ( pMaxWidth < b.maxWidth ) { 33337 b.maxWidth = pMaxWidth; 33338 } 33339 if ( pMaxHeight < b.maxHeight ) { 33340 b.maxHeight = pMaxHeight; 33341 } 33342 } 33343 this._vBoundaries = b; 33344 }, 33345 33346 _updateCache: function( data ) { 33347 this.offset = this.helper.offset(); 33348 if ( this._isNumber( data.left ) ) { 33349 this.position.left = data.left; 33350 } 33351 if ( this._isNumber( data.top ) ) { 33352 this.position.top = data.top; 33353 } 33354 if ( this._isNumber( data.height ) ) { 33355 this.size.height = data.height; 33356 } 33357 if ( this._isNumber( data.width ) ) { 33358 this.size.width = data.width; 33359 } 33360 }, 33361 33362 _updateRatio: function( data ) { 33363 33364 var cpos = this.position, 33365 csize = this.size, 33366 a = this.axis; 33367 33368 if ( this._isNumber( data.height ) ) { 33369 data.width = ( data.height * this.aspectRatio ); 33370 } else if ( this._isNumber( data.width ) ) { 33371 data.height = ( data.width / this.aspectRatio ); 33372 } 33373 33374 if ( a === "sw" ) { 33375 data.left = cpos.left + ( csize.width - data.width ); 33376 data.top = null; 33377 } 33378 if ( a === "nw" ) { 33379 data.top = cpos.top + ( csize.height - data.height ); 33380 data.left = cpos.left + ( csize.width - data.width ); 33381 } 33382 33383 return data; 33384 }, 33385 33386 _respectSize: function( data ) { 33387 33388 var o = this._vBoundaries, 33389 a = this.axis, 33390 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 33391 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 33392 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 33393 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 33394 dw = this.originalPosition.left + this.originalSize.width, 33395 dh = this.originalPosition.top + this.originalSize.height, 33396 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 33397 if ( isminw ) { 33398 data.width = o.minWidth; 33399 } 33400 if ( isminh ) { 33401 data.height = o.minHeight; 33402 } 33403 if ( ismaxw ) { 33404 data.width = o.maxWidth; 33405 } 33406 if ( ismaxh ) { 33407 data.height = o.maxHeight; 33408 } 33409 33410 if ( isminw && cw ) { 33411 data.left = dw - o.minWidth; 33412 } 33413 if ( ismaxw && cw ) { 33414 data.left = dw - o.maxWidth; 33415 } 33416 if ( isminh && ch ) { 33417 data.top = dh - o.minHeight; 33418 } 33419 if ( ismaxh && ch ) { 33420 data.top = dh - o.maxHeight; 33421 } 33422 33423 // Fixing jump error on top/left - bug #2330 33424 if ( !data.width && !data.height && !data.left && data.top ) { 33425 data.top = null; 33426 } else if ( !data.width && !data.height && !data.top && data.left ) { 33427 data.left = null; 33428 } 33429 33430 return data; 33431 }, 33432 33433 _getPaddingPlusBorderDimensions: function( element ) { 33434 var i = 0, 33435 widths = [], 33436 borders = [ 33437 element.css( "borderTopWidth" ), 33438 element.css( "borderRightWidth" ), 33439 element.css( "borderBottomWidth" ), 33440 element.css( "borderLeftWidth" ) 33441 ], 33442 paddings = [ 33443 element.css( "paddingTop" ), 33444 element.css( "paddingRight" ), 33445 element.css( "paddingBottom" ), 33446 element.css( "paddingLeft" ) 33447 ]; 33448 33449 for ( ; i < 4; i++ ) { 33450 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 33451 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 33452 } 33453 33454 return { 33455 height: widths[ 0 ] + widths[ 2 ], 33456 width: widths[ 1 ] + widths[ 3 ] 33457 }; 33458 }, 33459 33460 _proportionallyResize: function() { 33461 33462 if ( !this._proportionallyResizeElements.length ) { 33463 return; 33464 } 33465 33466 var prel, 33467 i = 0, 33468 element = this.helper || this.element; 33469 33470 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 33471 33472 prel = this._proportionallyResizeElements[ i ]; 33473 33474 // TODO: Seems like a bug to cache this.outerDimensions 33475 // considering that we are in a loop. 33476 if ( !this.outerDimensions ) { 33477 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 33478 } 33479 33480 prel.css( { 33481 height: ( element.height() - this.outerDimensions.height ) || 0, 33482 width: ( element.width() - this.outerDimensions.width ) || 0 33483 } ); 33484 33485 } 33486 33487 }, 33488 33489 _renderProxy: function() { 33490 33491 var el = this.element, o = this.options; 33492 this.elementOffset = el.offset(); 33493 33494 if ( this._helper ) { 33495 33496 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 33497 33498 this._addClass( this.helper, this._helper ); 33499 this.helper.css( { 33500 width: this.element.outerWidth(), 33501 height: this.element.outerHeight(), 33502 position: "absolute", 33503 left: this.elementOffset.left + "px", 33504 top: this.elementOffset.top + "px", 33505 zIndex: ++o.zIndex //TODO: Don't modify option 33506 } ); 33507 33508 this.helper 33509 .appendTo( "body" ) 33510 .disableSelection(); 33511 33512 } else { 33513 this.helper = this.element; 33514 } 33515 33516 }, 33517 33518 _change: { 33519 e: function( event, dx ) { 33520 return { width: this.originalSize.width + dx }; 33521 }, 33522 w: function( event, dx ) { 33523 var cs = this.originalSize, sp = this.originalPosition; 33524 return { left: sp.left + dx, width: cs.width - dx }; 33525 }, 33526 n: function( event, dx, dy ) { 33527 var cs = this.originalSize, sp = this.originalPosition; 33528 return { top: sp.top + dy, height: cs.height - dy }; 33529 }, 33530 s: function( event, dx, dy ) { 33531 return { height: this.originalSize.height + dy }; 33532 }, 33533 se: function( event, dx, dy ) { 33534 return $.extend( this._change.s.apply( this, arguments ), 33535 this._change.e.apply( this, [ event, dx, dy ] ) ); 33536 }, 33537 sw: function( event, dx, dy ) { 33538 return $.extend( this._change.s.apply( this, arguments ), 33539 this._change.w.apply( this, [ event, dx, dy ] ) ); 33540 }, 33541 ne: function( event, dx, dy ) { 33542 return $.extend( this._change.n.apply( this, arguments ), 33543 this._change.e.apply( this, [ event, dx, dy ] ) ); 33544 }, 33545 nw: function( event, dx, dy ) { 33546 return $.extend( this._change.n.apply( this, arguments ), 33547 this._change.w.apply( this, [ event, dx, dy ] ) ); 33548 } 33549 }, 33550 33551 _propagate: function( n, event ) { 33552 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 33553 if ( n !== "resize" ) { 33554 this._trigger( n, event, this.ui() ); 33555 } 33556 }, 33557 33558 plugins: {}, 33559 33560 ui: function() { 33561 return { 33562 originalElement: this.originalElement, 33563 element: this.element, 33564 helper: this.helper, 33565 position: this.position, 33566 size: this.size, 33567 originalSize: this.originalSize, 33568 originalPosition: this.originalPosition 33569 }; 33570 } 33571 33572} ); 33573 33574/* 33575 * Resizable Extensions 33576 */ 33577 33578$.ui.plugin.add( "resizable", "animate", { 33579 33580 stop: function( event ) { 33581 var that = $( this ).resizable( "instance" ), 33582 o = that.options, 33583 pr = that._proportionallyResizeElements, 33584 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 33585 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 33586 soffsetw = ista ? 0 : that.sizeDiff.width, 33587 style = { 33588 width: ( that.size.width - soffsetw ), 33589 height: ( that.size.height - soffseth ) 33590 }, 33591 left = ( parseFloat( that.element.css( "left" ) ) + 33592 ( that.position.left - that.originalPosition.left ) ) || null, 33593 top = ( parseFloat( that.element.css( "top" ) ) + 33594 ( that.position.top - that.originalPosition.top ) ) || null; 33595 33596 that.element.animate( 33597 $.extend( style, top && left ? { top: top, left: left } : {} ), { 33598 duration: o.animateDuration, 33599 easing: o.animateEasing, 33600 step: function() { 33601 33602 var data = { 33603 width: parseFloat( that.element.css( "width" ) ), 33604 height: parseFloat( that.element.css( "height" ) ), 33605 top: parseFloat( that.element.css( "top" ) ), 33606 left: parseFloat( that.element.css( "left" ) ) 33607 }; 33608 33609 if ( pr && pr.length ) { 33610 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 33611 } 33612 33613 // Propagating resize, and updating values for each animation step 33614 that._updateCache( data ); 33615 that._propagate( "resize", event ); 33616 33617 } 33618 } 33619 ); 33620 } 33621 33622} ); 33623 33624$.ui.plugin.add( "resizable", "containment", { 33625 33626 start: function() { 33627 var element, p, co, ch, cw, width, height, 33628 that = $( this ).resizable( "instance" ), 33629 o = that.options, 33630 el = that.element, 33631 oc = o.containment, 33632 ce = ( oc instanceof $ ) ? 33633 oc.get( 0 ) : 33634 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 33635 33636 if ( !ce ) { 33637 return; 33638 } 33639 33640 that.containerElement = $( ce ); 33641 33642 if ( /document/.test( oc ) || oc === document ) { 33643 that.containerOffset = { 33644 left: 0, 33645 top: 0 33646 }; 33647 that.containerPosition = { 33648 left: 0, 33649 top: 0 33650 }; 33651 33652 that.parentData = { 33653 element: $( document ), 33654 left: 0, 33655 top: 0, 33656 width: $( document ).width(), 33657 height: $( document ).height() || document.body.parentNode.scrollHeight 33658 }; 33659 } else { 33660 element = $( ce ); 33661 p = []; 33662 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 33663 p[ i ] = that._num( element.css( "padding" + name ) ); 33664 } ); 33665 33666 that.containerOffset = element.offset(); 33667 that.containerPosition = element.position(); 33668 that.containerSize = { 33669 height: ( element.innerHeight() - p[ 3 ] ), 33670 width: ( element.innerWidth() - p[ 1 ] ) 33671 }; 33672 33673 co = that.containerOffset; 33674 ch = that.containerSize.height; 33675 cw = that.containerSize.width; 33676 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 33677 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 33678 33679 that.parentData = { 33680 element: ce, 33681 left: co.left, 33682 top: co.top, 33683 width: width, 33684 height: height 33685 }; 33686 } 33687 }, 33688 33689 resize: function( event ) { 33690 var woset, hoset, isParent, isOffsetRelative, 33691 that = $( this ).resizable( "instance" ), 33692 o = that.options, 33693 co = that.containerOffset, 33694 cp = that.position, 33695 pRatio = that._aspectRatio || event.shiftKey, 33696 cop = { 33697 top: 0, 33698 left: 0 33699 }, 33700 ce = that.containerElement, 33701 continueResize = true; 33702 33703 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 33704 cop = co; 33705 } 33706 33707 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 33708 that.size.width = that.size.width + 33709 ( that._helper ? 33710 ( that.position.left - co.left ) : 33711 ( that.position.left - cop.left ) ); 33712 33713 if ( pRatio ) { 33714 that.size.height = that.size.width / that.aspectRatio; 33715 continueResize = false; 33716 } 33717 that.position.left = o.helper ? co.left : 0; 33718 } 33719 33720 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 33721 that.size.height = that.size.height + 33722 ( that._helper ? 33723 ( that.position.top - co.top ) : 33724 that.position.top ); 33725 33726 if ( pRatio ) { 33727 that.size.width = that.size.height * that.aspectRatio; 33728 continueResize = false; 33729 } 33730 that.position.top = that._helper ? co.top : 0; 33731 } 33732 33733 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 33734 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 33735 33736 if ( isParent && isOffsetRelative ) { 33737 that.offset.left = that.parentData.left + that.position.left; 33738 that.offset.top = that.parentData.top + that.position.top; 33739 } else { 33740 that.offset.left = that.element.offset().left; 33741 that.offset.top = that.element.offset().top; 33742 } 33743 33744 woset = Math.abs( that.sizeDiff.width + 33745 ( that._helper ? 33746 that.offset.left - cop.left : 33747 ( that.offset.left - co.left ) ) ); 33748 33749 hoset = Math.abs( that.sizeDiff.height + 33750 ( that._helper ? 33751 that.offset.top - cop.top : 33752 ( that.offset.top - co.top ) ) ); 33753 33754 if ( woset + that.size.width >= that.parentData.width ) { 33755 that.size.width = that.parentData.width - woset; 33756 if ( pRatio ) { 33757 that.size.height = that.size.width / that.aspectRatio; 33758 continueResize = false; 33759 } 33760 } 33761 33762 if ( hoset + that.size.height >= that.parentData.height ) { 33763 that.size.height = that.parentData.height - hoset; 33764 if ( pRatio ) { 33765 that.size.width = that.size.height * that.aspectRatio; 33766 continueResize = false; 33767 } 33768 } 33769 33770 if ( !continueResize ) { 33771 that.position.left = that.prevPosition.left; 33772 that.position.top = that.prevPosition.top; 33773 that.size.width = that.prevSize.width; 33774 that.size.height = that.prevSize.height; 33775 } 33776 }, 33777 33778 stop: function() { 33779 var that = $( this ).resizable( "instance" ), 33780 o = that.options, 33781 co = that.containerOffset, 33782 cop = that.containerPosition, 33783 ce = that.containerElement, 33784 helper = $( that.helper ), 33785 ho = helper.offset(), 33786 w = helper.outerWidth() - that.sizeDiff.width, 33787 h = helper.outerHeight() - that.sizeDiff.height; 33788 33789 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 33790 $( this ).css( { 33791 left: ho.left - cop.left - co.left, 33792 width: w, 33793 height: h 33794 } ); 33795 } 33796 33797 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 33798 $( this ).css( { 33799 left: ho.left - cop.left - co.left, 33800 width: w, 33801 height: h 33802 } ); 33803 } 33804 } 33805} ); 33806 33807$.ui.plugin.add( "resizable", "alsoResize", { 33808 33809 start: function() { 33810 var that = $( this ).resizable( "instance" ), 33811 o = that.options; 33812 33813 $( o.alsoResize ).each( function() { 33814 var el = $( this ); 33815 el.data( "ui-resizable-alsoresize", { 33816 width: parseFloat( el.css( "width" ) ), height: parseFloat( el.css( "height" ) ), 33817 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 33818 } ); 33819 } ); 33820 }, 33821 33822 resize: function( event, ui ) { 33823 var that = $( this ).resizable( "instance" ), 33824 o = that.options, 33825 os = that.originalSize, 33826 op = that.originalPosition, 33827 delta = { 33828 height: ( that.size.height - os.height ) || 0, 33829 width: ( that.size.width - os.width ) || 0, 33830 top: ( that.position.top - op.top ) || 0, 33831 left: ( that.position.left - op.left ) || 0 33832 }; 33833 33834 $( o.alsoResize ).each( function() { 33835 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 33836 css = el.parents( ui.originalElement[ 0 ] ).length ? 33837 [ "width", "height" ] : 33838 [ "width", "height", "top", "left" ]; 33839 33840 $.each( css, function( i, prop ) { 33841 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 33842 if ( sum && sum >= 0 ) { 33843 style[ prop ] = sum || null; 33844 } 33845 } ); 33846 33847 el.css( style ); 33848 } ); 33849 }, 33850 33851 stop: function() { 33852 $( this ).removeData( "ui-resizable-alsoresize" ); 33853 } 33854} ); 33855 33856$.ui.plugin.add( "resizable", "ghost", { 33857 33858 start: function() { 33859 33860 var that = $( this ).resizable( "instance" ), cs = that.size; 33861 33862 that.ghost = that.originalElement.clone(); 33863 that.ghost.css( { 33864 opacity: 0.25, 33865 display: "block", 33866 position: "relative", 33867 height: cs.height, 33868 width: cs.width, 33869 margin: 0, 33870 left: 0, 33871 top: 0 33872 } ); 33873 33874 that._addClass( that.ghost, "ui-resizable-ghost" ); 33875 33876 // DEPRECATED 33877 // TODO: remove after 1.12 33878 if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) { 33879 33880 // Ghost option 33881 that.ghost.addClass( this.options.ghost ); 33882 } 33883 33884 that.ghost.appendTo( that.helper ); 33885 33886 }, 33887 33888 resize: function() { 33889 var that = $( this ).resizable( "instance" ); 33890 if ( that.ghost ) { 33891 that.ghost.css( { 33892 position: "relative", 33893 height: that.size.height, 33894 width: that.size.width 33895 } ); 33896 } 33897 }, 33898 33899 stop: function() { 33900 var that = $( this ).resizable( "instance" ); 33901 if ( that.ghost && that.helper ) { 33902 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 33903 } 33904 } 33905 33906} ); 33907 33908$.ui.plugin.add( "resizable", "grid", { 33909 33910 resize: function() { 33911 var outerDimensions, 33912 that = $( this ).resizable( "instance" ), 33913 o = that.options, 33914 cs = that.size, 33915 os = that.originalSize, 33916 op = that.originalPosition, 33917 a = that.axis, 33918 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 33919 gridX = ( grid[ 0 ] || 1 ), 33920 gridY = ( grid[ 1 ] || 1 ), 33921 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 33922 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 33923 newWidth = os.width + ox, 33924 newHeight = os.height + oy, 33925 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 33926 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 33927 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 33928 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 33929 33930 o.grid = grid; 33931 33932 if ( isMinWidth ) { 33933 newWidth += gridX; 33934 } 33935 if ( isMinHeight ) { 33936 newHeight += gridY; 33937 } 33938 if ( isMaxWidth ) { 33939 newWidth -= gridX; 33940 } 33941 if ( isMaxHeight ) { 33942 newHeight -= gridY; 33943 } 33944 33945 if ( /^(se|s|e)$/.test( a ) ) { 33946 that.size.width = newWidth; 33947 that.size.height = newHeight; 33948 } else if ( /^(ne)$/.test( a ) ) { 33949 that.size.width = newWidth; 33950 that.size.height = newHeight; 33951 that.position.top = op.top - oy; 33952 } else if ( /^(sw)$/.test( a ) ) { 33953 that.size.width = newWidth; 33954 that.size.height = newHeight; 33955 that.position.left = op.left - ox; 33956 } else { 33957 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 33958 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 33959 } 33960 33961 if ( newHeight - gridY > 0 ) { 33962 that.size.height = newHeight; 33963 that.position.top = op.top - oy; 33964 } else { 33965 newHeight = gridY - outerDimensions.height; 33966 that.size.height = newHeight; 33967 that.position.top = op.top + os.height - newHeight; 33968 } 33969 if ( newWidth - gridX > 0 ) { 33970 that.size.width = newWidth; 33971 that.position.left = op.left - ox; 33972 } else { 33973 newWidth = gridX - outerDimensions.width; 33974 that.size.width = newWidth; 33975 that.position.left = op.left + os.width - newWidth; 33976 } 33977 } 33978 } 33979 33980} ); 33981
vendor: 2,182 bytes, lines 33982-34065
33982return $.ui.resizable; 33983 33984} ); 33985 33986 33987/*! 33988 * jQuery UI Focusable 1.13.3 33989 * https://jqueryui.com 33990 * 33991 * Copyright OpenJS Foundation and other contributors 33992 * Released under the MIT license. 33993 * https://jquery.org/license 33994 */ 33995 33996//>>label: :focusable Selector 33997//>>group: Core 33998//>>description: Selects elements which can be focused. 33999//>>docs: https://api.jqueryui.com/focusable-selector/ 34000 34001( function( factory ) { 34002 "use strict"; 34003 34004 if ( typeof define === "function" && define.amd ) { 34005 34006 // AMD. Register as an anonymous module. 34007 define( [ "jquery", "./version" ], factory ); 34008 } else { 34009 34010 // Browser globals 34011 factory( jQuery ); 34012 } 34013} )( function( $ ) { 34014"use strict"; 34015 34016// Selectors 34017$.ui.focusable = function( element, hasTabindex ) { 34018 var map, mapName, img, focusableIfVisible, fieldset, 34019 nodeName = element.nodeName.toLowerCase(); 34020 34021 if ( "area" === nodeName ) { 34022 map = element.parentNode; 34023 mapName = map.name; 34024 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 34025 return false; 34026 } 34027 img = $( "img[usemap='#" + mapName + "']" ); 34028 return img.length > 0 && img.is( ":visible" ); 34029 } 34030 34031 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 34032 focusableIfVisible = !element.disabled; 34033 34034 if ( focusableIfVisible ) { 34035 34036 // Form controls within a disabled fieldset are disabled. 34037 // However, controls within the fieldset's legend do not get disabled. 34038 // Since controls generally aren't placed inside legends, we skip 34039 // this portion of the check. 34040 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 34041 if ( fieldset ) { 34042 focusableIfVisible = !fieldset.disabled; 34043 } 34044 } 34045 } else if ( "a" === nodeName ) { 34046 focusableIfVisible = element.href || hasTabindex; 34047 } else { 34048 focusableIfVisible = hasTabindex; 34049 } 34050 34051 return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); 34052}; 34053 34054// Support: IE 8 only 34055// IE 8 doesn't resolve inherit to visible/hidden for computed values 34056function visible( element ) { 34057 var visibility = element.css( "visibility" ); 34058 while ( visibility === "inherit" ) { 34059 element = element.parent(); 34060 visibility = element.css( "visibility" ); 34061 } 34062 return visibility === "visible"; 34063} 34064 34065$.extend( $.expr.pseudos, {
vendor: 4,317 bytes, lines 34066-34234
34066 focusable: function( element ) { 34067 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 34068 } 34069} ); 34070 34071return $.ui.focusable; 34072 34073} ); 34074 34075 34076/*! 34077 * jQuery UI Position 1.13.3 34078 * https://jqueryui.com 34079 * 34080 * Copyright OpenJS Foundation and other contributors 34081 * Released under the MIT license. 34082 * https://jquery.org/license 34083 * 34084 * https://api.jqueryui.com/position/ 34085 */ 34086 34087//>>label: Position 34088//>>group: Core 34089//>>description: Positions elements relative to other elements. 34090//>>docs: https://api.jqueryui.com/position/ 34091//>>demos: https://jqueryui.com/position/ 34092 34093( function( factory ) { 34094 "use strict"; 34095 34096 if ( typeof define === "function" && define.amd ) { 34097 34098 // AMD. Register as an anonymous module. 34099 define( [ "jquery", "./version" ], factory ); 34100 } else { 34101 34102 // Browser globals 34103 factory( jQuery ); 34104 } 34105} )( function( $ ) { 34106"use strict"; 34107 34108( function() { 34109var cachedScrollbarWidth, 34110 max = Math.max, 34111 abs = Math.abs, 34112 rhorizontal = /left|center|right/, 34113 rvertical = /top|center|bottom/, 34114 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 34115 rposition = /^\w+/, 34116 rpercent = /%$/, 34117 _position = $.fn.position; 34118 34119function getOffsets( offsets, width, height ) { 34120 return [ 34121 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 34122 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 34123 ]; 34124} 34125 34126function parseCss( element, property ) { 34127 return parseInt( $.css( element, property ), 10 ) || 0; 34128} 34129 34130function isWindow( obj ) { 34131 return obj != null && obj === obj.window; 34132} 34133 34134function getDimensions( elem ) { 34135 var raw = elem[ 0 ]; 34136 if ( raw.nodeType === 9 ) { 34137 return { 34138 width: elem.width(), 34139 height: elem.height(), 34140 offset: { top: 0, left: 0 } 34141 }; 34142 } 34143 if ( isWindow( raw ) ) { 34144 return { 34145 width: elem.width(), 34146 height: elem.height(), 34147 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 34148 }; 34149 } 34150 if ( raw.preventDefault ) { 34151 return { 34152 width: 0, 34153 height: 0, 34154 offset: { top: raw.pageY, left: raw.pageX } 34155 }; 34156 } 34157 return { 34158 width: elem.outerWidth(), 34159 height: elem.outerHeight(), 34160 offset: elem.offset() 34161 }; 34162} 34163 34164$.position = { 34165 scrollbarWidth: function() { 34166 if ( cachedScrollbarWidth !== undefined ) { 34167 return cachedScrollbarWidth; 34168 } 34169 var w1, w2, 34170 div = $( "<div style=" + 34171 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 34172 "<div style='height:300px;width:auto;'></div></div>" ), 34173 innerDiv = div.children()[ 0 ]; 34174 34175 $( "body" ).append( div ); 34176 w1 = innerDiv.offsetWidth; 34177 div.css( "overflow", "scroll" ); 34178 34179 w2 = innerDiv.offsetWidth; 34180 34181 if ( w1 === w2 ) { 34182 w2 = div[ 0 ].clientWidth; 34183 } 34184 34185 div.remove(); 34186 34187 return ( cachedScrollbarWidth = w1 - w2 ); 34188 }, 34189 getScrollInfo: function( within ) { 34190 var overflowX = within.isWindow || within.isDocument ? "" : 34191 within.element.css( "overflow-x" ), 34192 overflowY = within.isWindow || within.isDocument ? "" : 34193 within.element.css( "overflow-y" ), 34194 hasOverflowX = overflowX === "scroll" || 34195 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 34196 hasOverflowY = overflowY === "scroll" || 34197 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 34198 return { 34199 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 34200 height: hasOverflowX ? $.position.scrollbarWidth() : 0 34201 }; 34202 }, 34203 getWithinInfo: function( element ) { 34204 var withinElement = $( element || window ), 34205 isElemWindow = isWindow( withinElement[ 0 ] ), 34206 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 34207 hasOffset = !isElemWindow && !isDocument; 34208 return { 34209 element: withinElement, 34210 isWindow: isElemWindow, 34211 isDocument: isDocument, 34212 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 34213 scrollLeft: withinElement.scrollLeft(), 34214 scrollTop: withinElement.scrollTop(), 34215 width: withinElement.outerWidth(), 34216 height: withinElement.outerHeight() 34217 }; 34218 } 34219}; 34220 34221$.fn.position = function( options ) { 34222 if ( !options || !options.of ) { 34223 return _position.apply( this, arguments ); 34224 } 34225 34226 // Make a copy, we don't want to modify arguments 34227 options = $.extend( {}, options ); 34228 34229 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 34230 34231 // Make sure string options are treated as CSS selectors 34232 target = typeof options.of === "string" ? 34233 $( document ).find( options.of ) : 34234 $( options.of ),
vendor: 10,934 bytes, lines 34235-34583
34235 34236 within = $.position.getWithinInfo( options.within ), 34237 scrollInfo = $.position.getScrollInfo( within ), 34238 collision = ( options.collision || "flip" ).split( " " ), 34239 offsets = {}; 34240 34241 dimensions = getDimensions( target ); 34242 if ( target[ 0 ].preventDefault ) { 34243 34244 // Force left top to allow flipping 34245 options.at = "left top"; 34246 } 34247 targetWidth = dimensions.width; 34248 targetHeight = dimensions.height; 34249 targetOffset = dimensions.offset; 34250 34251 // Clone to reuse original targetOffset later 34252 basePosition = $.extend( {}, targetOffset ); 34253 34254 // Force my and at to have valid horizontal and vertical positions 34255 // if a value is missing or invalid, it will be converted to center 34256 $.each( [ "my", "at" ], function() { 34257 var pos = ( options[ this ] || "" ).split( " " ), 34258 horizontalOffset, 34259 verticalOffset; 34260 34261 if ( pos.length === 1 ) { 34262 pos = rhorizontal.test( pos[ 0 ] ) ? 34263 pos.concat( [ "center" ] ) : 34264 rvertical.test( pos[ 0 ] ) ? 34265 [ "center" ].concat( pos ) : 34266 [ "center", "center" ]; 34267 } 34268 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 34269 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 34270 34271 // Calculate offsets 34272 horizontalOffset = roffset.exec( pos[ 0 ] ); 34273 verticalOffset = roffset.exec( pos[ 1 ] ); 34274 offsets[ this ] = [ 34275 horizontalOffset ? horizontalOffset[ 0 ] : 0, 34276 verticalOffset ? verticalOffset[ 0 ] : 0 34277 ]; 34278 34279 // Reduce to just the positions without the offsets 34280 options[ this ] = [ 34281 rposition.exec( pos[ 0 ] )[ 0 ], 34282 rposition.exec( pos[ 1 ] )[ 0 ] 34283 ]; 34284 } ); 34285 34286 // Normalize collision option 34287 if ( collision.length === 1 ) { 34288 collision[ 1 ] = collision[ 0 ]; 34289 } 34290 34291 if ( options.at[ 0 ] === "right" ) { 34292 basePosition.left += targetWidth; 34293 } else if ( options.at[ 0 ] === "center" ) { 34294 basePosition.left += targetWidth / 2; 34295 } 34296 34297 if ( options.at[ 1 ] === "bottom" ) { 34298 basePosition.top += targetHeight; 34299 } else if ( options.at[ 1 ] === "center" ) { 34300 basePosition.top += targetHeight / 2; 34301 } 34302 34303 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 34304 basePosition.left += atOffset[ 0 ]; 34305 basePosition.top += atOffset[ 1 ]; 34306 34307 return this.each( function() { 34308 var collisionPosition, using, 34309 elem = $( this ), 34310 elemWidth = elem.outerWidth(), 34311 elemHeight = elem.outerHeight(), 34312 marginLeft = parseCss( this, "marginLeft" ), 34313 marginTop = parseCss( this, "marginTop" ), 34314 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 34315 scrollInfo.width, 34316 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 34317 scrollInfo.height, 34318 position = $.extend( {}, basePosition ), 34319 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 34320 34321 if ( options.my[ 0 ] === "right" ) { 34322 position.left -= elemWidth; 34323 } else if ( options.my[ 0 ] === "center" ) { 34324 position.left -= elemWidth / 2; 34325 } 34326 34327 if ( options.my[ 1 ] === "bottom" ) { 34328 position.top -= elemHeight; 34329 } else if ( options.my[ 1 ] === "center" ) { 34330 position.top -= elemHeight / 2; 34331 } 34332 34333 position.left += myOffset[ 0 ]; 34334 position.top += myOffset[ 1 ]; 34335 34336 collisionPosition = { 34337 marginLeft: marginLeft, 34338 marginTop: marginTop 34339 }; 34340 34341 $.each( [ "left", "top" ], function( i, dir ) { 34342 if ( $.ui.position[ collision[ i ] ] ) { 34343 $.ui.position[ collision[ i ] ][ dir ]( position, { 34344 targetWidth: targetWidth, 34345 targetHeight: targetHeight, 34346 elemWidth: elemWidth, 34347 elemHeight: elemHeight, 34348 collisionPosition: collisionPosition, 34349 collisionWidth: collisionWidth, 34350 collisionHeight: collisionHeight, 34351 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 34352 my: options.my, 34353 at: options.at, 34354 within: within, 34355 elem: elem 34356 } ); 34357 } 34358 } ); 34359 34360 if ( options.using ) { 34361 34362 // Adds feedback as second argument to using callback, if present 34363 using = function( props ) { 34364 var left = targetOffset.left - position.left, 34365 right = left + targetWidth - elemWidth, 34366 top = targetOffset.top - position.top, 34367 bottom = top + targetHeight - elemHeight, 34368 feedback = { 34369 target: { 34370 element: target, 34371 left: targetOffset.left, 34372 top: targetOffset.top, 34373 width: targetWidth, 34374 height: targetHeight 34375 }, 34376 element: { 34377 element: elem, 34378 left: position.left, 34379 top: position.top, 34380 width: elemWidth, 34381 height: elemHeight 34382 }, 34383 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 34384 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 34385 }; 34386 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 34387 feedback.horizontal = "center"; 34388 } 34389 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 34390 feedback.vertical = "middle"; 34391 } 34392 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 34393 feedback.important = "horizontal"; 34394 } else { 34395 feedback.important = "vertical"; 34396 } 34397 options.using.call( this, props, feedback ); 34398 }; 34399 } 34400 34401 elem.offset( $.extend( position, { using: using } ) ); 34402 } ); 34403}; 34404 34405$.ui.position = { 34406 fit: { 34407 left: function( position, data ) { 34408 var within = data.within, 34409 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 34410 outerWidth = within.width, 34411 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 34412 overLeft = withinOffset - collisionPosLeft, 34413 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 34414 newOverRight; 34415 34416 // Element is wider than within 34417 if ( data.collisionWidth > outerWidth ) { 34418 34419 // Element is initially over the left side of within 34420 if ( overLeft > 0 && overRight <= 0 ) { 34421 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 34422 withinOffset; 34423 position.left += overLeft - newOverRight; 34424 34425 // Element is initially over right side of within 34426 } else if ( overRight > 0 && overLeft <= 0 ) { 34427 position.left = withinOffset; 34428 34429 // Element is initially over both left and right sides of within 34430 } else { 34431 if ( overLeft > overRight ) { 34432 position.left = withinOffset + outerWidth - data.collisionWidth; 34433 } else { 34434 position.left = withinOffset; 34435 } 34436 } 34437 34438 // Too far left -> align with left edge 34439 } else if ( overLeft > 0 ) { 34440 position.left += overLeft; 34441 34442 // Too far right -> align with right edge 34443 } else if ( overRight > 0 ) { 34444 position.left -= overRight; 34445 34446 // Adjust based on position and margin 34447 } else { 34448 position.left = max( position.left - collisionPosLeft, position.left ); 34449 } 34450 }, 34451 top: function( position, data ) { 34452 var within = data.within, 34453 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 34454 outerHeight = data.within.height, 34455 collisionPosTop = position.top - data.collisionPosition.marginTop, 34456 overTop = withinOffset - collisionPosTop, 34457 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 34458 newOverBottom; 34459 34460 // Element is taller than within 34461 if ( data.collisionHeight > outerHeight ) { 34462 34463 // Element is initially over the top of within 34464 if ( overTop > 0 && overBottom <= 0 ) { 34465 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 34466 withinOffset; 34467 position.top += overTop - newOverBottom; 34468 34469 // Element is initially over bottom of within 34470 } else if ( overBottom > 0 && overTop <= 0 ) { 34471 position.top = withinOffset; 34472 34473 // Element is initially over both top and bottom of within 34474 } else { 34475 if ( overTop > overBottom ) { 34476 position.top = withinOffset + outerHeight - data.collisionHeight; 34477 } else { 34478 position.top = withinOffset; 34479 } 34480 } 34481 34482 // Too far up -> align with top 34483 } else if ( overTop > 0 ) { 34484 position.top += overTop; 34485 34486 // Too far down -> align with bottom edge 34487 } else if ( overBottom > 0 ) { 34488 position.top -= overBottom; 34489 34490 // Adjust based on position and margin 34491 } else { 34492 position.top = max( position.top - collisionPosTop, position.top ); 34493 } 34494 } 34495 }, 34496 flip: { 34497 left: function( position, data ) { 34498 var within = data.within, 34499 withinOffset = within.offset.left + within.scrollLeft, 34500 outerWidth = within.width, 34501 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 34502 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 34503 overLeft = collisionPosLeft - offsetLeft, 34504 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 34505 myOffset = data.my[ 0 ] === "left" ? 34506 -data.elemWidth : 34507 data.my[ 0 ] === "right" ? 34508 data.elemWidth : 34509 0, 34510 atOffset = data.at[ 0 ] === "left" ? 34511 data.targetWidth : 34512 data.at[ 0 ] === "right" ? 34513 -data.targetWidth : 34514 0, 34515 offset = -2 * data.offset[ 0 ], 34516 newOverRight, 34517 newOverLeft; 34518 34519 if ( overLeft < 0 ) { 34520 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 34521 outerWidth - withinOffset; 34522 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 34523 position.left += myOffset + atOffset + offset; 34524 } 34525 } else if ( overRight > 0 ) { 34526 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 34527 atOffset + offset - offsetLeft; 34528 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 34529 position.left += myOffset + atOffset + offset; 34530 } 34531 } 34532 }, 34533 top: function( position, data ) { 34534 var within = data.within, 34535 withinOffset = within.offset.top + within.scrollTop, 34536 outerHeight = within.height, 34537 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 34538 collisionPosTop = position.top - data.collisionPosition.marginTop, 34539 overTop = collisionPosTop - offsetTop, 34540 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 34541 top = data.my[ 1 ] === "top", 34542 myOffset = top ? 34543 -data.elemHeight : 34544 data.my[ 1 ] === "bottom" ? 34545 data.elemHeight : 34546 0, 34547 atOffset = data.at[ 1 ] === "top" ? 34548 data.targetHeight : 34549 data.at[ 1 ] === "bottom" ? 34550 -data.targetHeight : 34551 0, 34552 offset = -2 * data.offset[ 1 ], 34553 newOverTop, 34554 newOverBottom; 34555 if ( overTop < 0 ) { 34556 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 34557 outerHeight - withinOffset; 34558 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 34559 position.top += myOffset + atOffset + offset; 34560 } 34561 } else if ( overBottom > 0 ) { 34562 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 34563 offset - offsetTop; 34564 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 34565 position.top += myOffset + atOffset + offset; 34566 } 34567 } 34568 } 34569 }, 34570 flipfit: { 34571 left: function() { 34572 $.ui.position.flip.left.apply( this, arguments ); 34573 $.ui.position.fit.left.apply( this, arguments ); 34574 }, 34575 top: function() { 34576 $.ui.position.flip.top.apply( this, arguments ); 34577 $.ui.position.fit.top.apply( this, arguments ); 34578 } 34579 } 34580}; 34581 34582} )(); 34583
34584return $.ui.position; 34585 34586} ); 34587 34588 34589 34590/*! 34591 * jQuery UI Tabbable 1.13.3 34592 * https://jqueryui.com 34593 * 34594 * Copyright OpenJS Foundation and other contributors 34595 * Released under the MIT license. 34596 * https://jquery.org/license 34597 */ 34598 34599//>>label: :tabbable Selector
34600//>>group: Core 34601//>>description: Selects elements which can be tabbed to. 34602//>>docs: https://api.jqueryui.com/tabbable-selector/ 34603 34604( function( factory ) { 34605 "use strict"; 34606 34607 if ( typeof define === "function" && define.amd ) { 34608 34609 // AMD. Register as an anonymous module. 34610 define( [ "jquery", "./version", "./focusable" ], factory ); 34611 } else { 34612 34613 // Browser globals 34614 factory( jQuery ); 34615 } 34616} )( function( $ ) { 34617"use strict"; 34618 34619return $.extend( $.expr.pseudos, { 34620 tabbable: function( element ) { 34621 var tabIndex = $.attr( element, "tabindex" ), 34622 hasTabindex = tabIndex != null; 34623 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 34624 } 34625} ); 34626 34627} ); 34628 34629 34630/*! 34631 * jQuery UI Unique ID 1.13.3 34632 * https://jqueryui.com 34633 * 34634 * Copyright OpenJS Foundation and other contributors 34635 * Released under the MIT license. 34636 * https://jquery.org/license 34637 */ 34638 34639//>>label: uniqueId 34640//>>group: Core 34641//>>description: Functions to generate and remove uniqueId's 34642//>>docs: https://api.jqueryui.com/uniqueId/ 34643 34644( function( factory ) { 34645 "use strict"; 34646 34647 if ( typeof define === "function" && define.amd ) { 34648 34649 // AMD. Register as an anonymous module. 34650 define( [ "jquery", "./version" ], factory ); 34651 } else { 34652 34653 // Browser globals 34654 factory( jQuery ); 34655 } 34656} )( function( $ ) { 34657"use strict"; 34658 34659return $.fn.extend( { 34660 uniqueId: ( function() { 34661 var uuid = 0; 34662 34663 return function() { 34664 return this.each( function() { 34665 if ( !this.id ) { 34666 this.id = "ui-id-" + ( ++uuid ); 34667 } 34668 } ); 34669 }; 34670 } )(), 34671 34672 removeUniqueId: function() { 34673 return this.each( function() { 34674 if ( /^ui-id-\d+$/.test( this.id ) ) { 34675 $( this ).removeAttr( "id" ); 34676 } 34677 } ); 34678 } 34679} ); 34680 34681} ); 34682 34683 34684 34685 34686 34687 34688 34689 34690 34691 34692 34693 34694 34695 34696/*! 34697 * jQuery UI Dialog 1.13.3 34698 * https://jqueryui.com 34699 * 34700 * Copyright OpenJS Foundation and other contributors 34701 * Released under the MIT license. 34702 * https://jquery.org/license 34703 */ 34704 34705//>>label: Dialog 34706//>>group: Widgets 34707//>>description: Displays customizable dialog windows. 34708//>>docs: https://api.jqueryui.com/dialog/ 34709//>>demos: https://jqueryui.com/dialog/ 34710//>>css.structure: ../../themes/base/core.css 34711//>>css.structure: ../../themes/base/dialog.css 34712//>>css.theme: ../../themes/base/theme.css 34713 34714( function( factory ) { 34715 "use strict"; 34716 34717 if ( typeof define === "function" && define.amd ) { 34718 34719 // AMD. Register as an anonymous module. 34720 define( [ 34721 "jquery", 34722 "./button", 34723 "./draggable", 34724 "./mouse", 34725 "./resizable", 34726 "../focusable", 34727 "../keycode", 34728 "../position", 34729 "../safe-active-element", 34730 "../safe-blur", 34731 "../tabbable", 34732 "../unique-id", 34733 "../version", 34734 "../widget" 34735 ], factory ); 34736 } else { 34737 34738 // Browser globals 34739 factory( jQuery ); 34740 } 34741} )( function( $ ) { 34742"use strict";
vendor: 22,871 bytes, lines 34742-35649
34742 34743 34744$.widget( "ui.dialog", { 34745 version: "1.13.3", 34746 options: { 34747 appendTo: "body", 34748 autoOpen: true, 34749 buttons: [], 34750 classes: { 34751 "ui-dialog": "ui-corner-all", 34752 "ui-dialog-titlebar": "ui-corner-all" 34753 }, 34754 closeOnEscape: true, 34755 closeText: "Close", 34756 draggable: true, 34757 hide: null, 34758 height: "auto", 34759 maxHeight: null, 34760 maxWidth: null, 34761 minHeight: 150, 34762 minWidth: 150, 34763 modal: false, 34764 position: { 34765 my: "center", 34766 at: "center", 34767 of: window, 34768 collision: "fit", 34769 34770 // Ensure the titlebar is always visible 34771 using: function( pos ) { 34772 var topOffset = $( this ).css( pos ).offset().top; 34773 if ( topOffset < 0 ) { 34774 $( this ).css( "top", pos.top - topOffset ); 34775 } 34776 } 34777 }, 34778 resizable: true, 34779 show: null, 34780 title: null, 34781 width: 300, 34782 34783 // Callbacks 34784 beforeClose: null, 34785 close: null, 34786 drag: null, 34787 dragStart: null, 34788 dragStop: null, 34789 focus: null, 34790 open: null, 34791 resize: null, 34792 resizeStart: null, 34793 resizeStop: null 34794 }, 34795 34796 sizeRelatedOptions: { 34797 buttons: true, 34798 height: true, 34799 maxHeight: true, 34800 maxWidth: true, 34801 minHeight: true, 34802 minWidth: true, 34803 width: true 34804 }, 34805 34806 resizableRelatedOptions: { 34807 maxHeight: true, 34808 maxWidth: true, 34809 minHeight: true, 34810 minWidth: true 34811 }, 34812 34813 _create: function() { 34814 this.originalCss = { 34815 display: this.element[ 0 ].style.display, 34816 width: this.element[ 0 ].style.width, 34817 minHeight: this.element[ 0 ].style.minHeight, 34818 maxHeight: this.element[ 0 ].style.maxHeight, 34819 height: this.element[ 0 ].style.height 34820 }; 34821 this.originalPosition = { 34822 parent: this.element.parent(), 34823 index: this.element.parent().children().index( this.element ) 34824 }; 34825 this.originalTitle = this.element.attr( "title" ); 34826 if ( this.options.title == null && this.originalTitle != null ) { 34827 this.options.title = this.originalTitle; 34828 } 34829 34830 // Dialogs can't be disabled 34831 if ( this.options.disabled ) { 34832 this.options.disabled = false; 34833 } 34834 34835 this._createWrapper(); 34836 34837 this.element 34838 .show() 34839 .removeAttr( "title" ) 34840 .appendTo( this.uiDialog ); 34841 34842 this._addClass( "ui-dialog-content", "ui-widget-content" ); 34843 34844 this._createTitlebar(); 34845 this._createButtonPane(); 34846 34847 if ( this.options.draggable && $.fn.draggable ) { 34848 this._makeDraggable(); 34849 } 34850 if ( this.options.resizable && $.fn.resizable ) { 34851 this._makeResizable(); 34852 } 34853 34854 this._isOpen = false; 34855 34856 this._trackFocus(); 34857 }, 34858 34859 _init: function() { 34860 if ( this.options.autoOpen ) { 34861 this.open(); 34862 } 34863 }, 34864 34865 _appendTo: function() { 34866 var element = this.options.appendTo; 34867 if ( element && ( element.jquery || element.nodeType ) ) { 34868 return $( element ); 34869 } 34870 return this.document.find( element || "body" ).eq( 0 ); 34871 }, 34872 34873 _destroy: function() { 34874 var next, 34875 originalPosition = this.originalPosition; 34876 34877 this._untrackInstance(); 34878 this._destroyOverlay(); 34879 34880 this.element 34881 .removeUniqueId() 34882 .css( this.originalCss ) 34883 34884 // Without detaching first, the following becomes really slow 34885 .detach(); 34886 34887 this.uiDialog.remove(); 34888 34889 if ( this.originalTitle ) { 34890 this.element.attr( "title", this.originalTitle ); 34891 } 34892 34893 next = originalPosition.parent.children().eq( originalPosition.index ); 34894 34895 // Don't try to place the dialog next to itself (#8613) 34896 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 34897 next.before( this.element ); 34898 } else { 34899 originalPosition.parent.append( this.element ); 34900 } 34901 }, 34902 34903 widget: function() { 34904 return this.uiDialog; 34905 }, 34906 34907 disable: $.noop, 34908 enable: $.noop, 34909 34910 close: function( event ) { 34911 var that = this; 34912 34913 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 34914 return; 34915 } 34916 34917 this._isOpen = false; 34918 this._focusedElement = null; 34919 this._destroyOverlay(); 34920 this._untrackInstance(); 34921 34922 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 34923 34924 // Hiding a focused element doesn't trigger blur in WebKit 34925 // so in case we have nothing to focus on, explicitly blur the active element 34926 // https://bugs.webkit.org/show_bug.cgi?id=47182 34927 $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); 34928 } 34929 34930 this._hide( this.uiDialog, this.options.hide, function() { 34931 that._trigger( "close", event ); 34932 } ); 34933 }, 34934 34935 isOpen: function() { 34936 return this._isOpen; 34937 }, 34938 34939 moveToTop: function() { 34940 this._moveToTop(); 34941 }, 34942 34943 _moveToTop: function( event, silent ) { 34944 var moved = false, 34945 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 34946 return +$( this ).css( "z-index" ); 34947 } ).get(), 34948 zIndexMax = Math.max.apply( null, zIndices ); 34949 34950 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 34951 this.uiDialog.css( "z-index", zIndexMax + 1 ); 34952 moved = true; 34953 } 34954 34955 if ( moved && !silent ) { 34956 this._trigger( "focus", event ); 34957 } 34958 return moved; 34959 }, 34960 34961 open: function() { 34962 var that = this; 34963 if ( this._isOpen ) { 34964 if ( this._moveToTop() ) { 34965 this._focusTabbable(); 34966 } 34967 return; 34968 } 34969 34970 this._isOpen = true; 34971 this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 34972 34973 this._size(); 34974 this._position(); 34975 this._createOverlay(); 34976 this._moveToTop( null, true ); 34977 34978 // Ensure the overlay is moved to the top with the dialog, but only when 34979 // opening. The overlay shouldn't move after the dialog is open so that 34980 // modeless dialogs opened after the modal dialog stack properly. 34981 if ( this.overlay ) { 34982 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 34983 } 34984 34985 this._show( this.uiDialog, this.options.show, function() { 34986 that._focusTabbable(); 34987 that._trigger( "focus" ); 34988 } ); 34989 34990 // Track the dialog immediately upon opening in case a focus event 34991 // somehow occurs outside of the dialog before an element inside the 34992 // dialog is focused (#10152) 34993 this._makeFocusTarget(); 34994 34995 this._trigger( "open" ); 34996 }, 34997 34998 _focusTabbable: function() { 34999 35000 // Set focus to the first match: 35001 // 1. An element that was focused previously 35002 // 2. First element inside the dialog matching [autofocus] 35003 // 3. Tabbable element inside the content element 35004 // 4. Tabbable element inside the buttonpane 35005 // 5. The close button 35006 // 6. The dialog itself 35007 var hasFocus = this._focusedElement; 35008 if ( !hasFocus ) { 35009 hasFocus = this.element.find( "[autofocus]" ); 35010 } 35011 if ( !hasFocus.length ) { 35012 hasFocus = this.element.find( ":tabbable" ); 35013 } 35014 if ( !hasFocus.length ) { 35015 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 35016 } 35017 if ( !hasFocus.length ) { 35018 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 35019 } 35020 if ( !hasFocus.length ) { 35021 hasFocus = this.uiDialog; 35022 } 35023 hasFocus.eq( 0 ).trigger( "focus" ); 35024 }, 35025 35026 _restoreTabbableFocus: function() { 35027 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 35028 isActive = this.uiDialog[ 0 ] === activeElement || 35029 $.contains( this.uiDialog[ 0 ], activeElement ); 35030 if ( !isActive ) { 35031 this._focusTabbable(); 35032 } 35033 }, 35034 35035 _keepFocus: function( event ) { 35036 event.preventDefault(); 35037 this._restoreTabbableFocus(); 35038 35039 // support: IE 35040 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 35041 // so we check again later 35042 this._delay( this._restoreTabbableFocus ); 35043 }, 35044 35045 _createWrapper: function() { 35046 this.uiDialog = $( "<div>" ) 35047 .hide() 35048 .attr( { 35049 35050 // Setting tabIndex makes the div focusable 35051 tabIndex: -1, 35052 role: "dialog" 35053 } ) 35054 .appendTo( this._appendTo() ); 35055 35056 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 35057 this._on( this.uiDialog, { 35058 keydown: function( event ) { 35059 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 35060 event.keyCode === $.ui.keyCode.ESCAPE ) { 35061 event.preventDefault(); 35062 this.close( event ); 35063 return; 35064 } 35065 35066 // Prevent tabbing out of dialogs 35067 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 35068 return; 35069 } 35070 var tabbables = this.uiDialog.find( ":tabbable" ), 35071 first = tabbables.first(), 35072 last = tabbables.last(); 35073 35074 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 35075 !event.shiftKey ) { 35076 this._delay( function() { 35077 first.trigger( "focus" ); 35078 } ); 35079 event.preventDefault(); 35080 } else if ( ( event.target === first[ 0 ] || 35081 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 35082 this._delay( function() { 35083 last.trigger( "focus" ); 35084 } ); 35085 event.preventDefault(); 35086 } 35087 }, 35088 mousedown: function( event ) { 35089 if ( this._moveToTop( event ) ) { 35090 this._focusTabbable(); 35091 } 35092 } 35093 } ); 35094 35095 // We assume that any existing aria-describedby attribute means 35096 // that the dialog content is marked up properly 35097 // otherwise we brute force the content as the description 35098 if ( !this.element.find( "[aria-describedby]" ).length ) { 35099 this.uiDialog.attr( { 35100 "aria-describedby": this.element.uniqueId().attr( "id" ) 35101 } ); 35102 } 35103 }, 35104 35105 _createTitlebar: function() { 35106 var uiDialogTitle; 35107 35108 this.uiDialogTitlebar = $( "<div>" ); 35109 this._addClass( this.uiDialogTitlebar, 35110 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 35111 this._on( this.uiDialogTitlebar, { 35112 mousedown: function( event ) { 35113 35114 // Don't prevent click on close button (#8838) 35115 // Focusing a dialog that is partially scrolled out of view 35116 // causes the browser to scroll it into view, preventing the click event 35117 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 35118 35119 // Dialog isn't getting focus when dragging (#8063) 35120 this.uiDialog.trigger( "focus" ); 35121 } 35122 } 35123 } ); 35124 35125 // Support: IE 35126 // Use type="button" to prevent enter keypresses in textboxes from closing the 35127 // dialog in IE (#9312) 35128 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 35129 .button( { 35130 label: $( "<a>" ).text( this.options.closeText ).html(), 35131 icon: "ui-icon-closethick", 35132 showLabel: false 35133 } ) 35134 .appendTo( this.uiDialogTitlebar ); 35135 35136 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 35137 this._on( this.uiDialogTitlebarClose, { 35138 click: function( event ) { 35139 event.preventDefault(); 35140 this.close( event ); 35141 } 35142 } ); 35143 35144 uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 35145 this._addClass( uiDialogTitle, "ui-dialog-title" ); 35146 this._title( uiDialogTitle ); 35147 35148 this.uiDialogTitlebar.prependTo( this.uiDialog ); 35149 35150 this.uiDialog.attr( { 35151 "aria-labelledby": uiDialogTitle.attr( "id" ) 35152 } ); 35153 }, 35154 35155 _title: function( title ) { 35156 if ( this.options.title ) { 35157 title.text( this.options.title ); 35158 } else { 35159 title.html( " " ); 35160 } 35161 }, 35162 35163 _createButtonPane: function() { 35164 this.uiDialogButtonPane = $( "<div>" ); 35165 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 35166 "ui-widget-content ui-helper-clearfix" ); 35167 35168 this.uiButtonSet = $( "<div>" ) 35169 .appendTo( this.uiDialogButtonPane ); 35170 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 35171 35172 this._createButtons(); 35173 }, 35174 35175 _createButtons: function() { 35176 var that = this, 35177 buttons = this.options.buttons; 35178 35179 // If we already have a button pane, remove it 35180 this.uiDialogButtonPane.remove(); 35181 this.uiButtonSet.empty(); 35182 35183 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 35184 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 35185 return; 35186 } 35187 35188 $.each( buttons, function( name, props ) { 35189 var click, buttonOptions; 35190 props = typeof props === "function" ? 35191 { click: props, text: name } : 35192 props; 35193 35194 // Default to a non-submitting button 35195 props = $.extend( { type: "button" }, props ); 35196 35197 // Change the context for the click callback to be the main element 35198 click = props.click; 35199 buttonOptions = { 35200 icon: props.icon, 35201 iconPosition: props.iconPosition, 35202 showLabel: props.showLabel, 35203 35204 // Deprecated options 35205 icons: props.icons, 35206 text: props.text 35207 }; 35208 35209 delete props.click; 35210 delete props.icon; 35211 delete props.iconPosition; 35212 delete props.showLabel; 35213 35214 // Deprecated options 35215 delete props.icons; 35216 if ( typeof props.text === "boolean" ) { 35217 delete props.text; 35218 } 35219 35220 $( "<button></button>", props ) 35221 .button( buttonOptions ) 35222 .appendTo( that.uiButtonSet ) 35223 .on( "click", function() { 35224 click.apply( that.element[ 0 ], arguments ); 35225 } ); 35226 } ); 35227 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 35228 this.uiDialogButtonPane.appendTo( this.uiDialog ); 35229 }, 35230 35231 _makeDraggable: function() { 35232 var that = this, 35233 options = this.options; 35234 35235 function filteredUi( ui ) { 35236 return { 35237 position: ui.position, 35238 offset: ui.offset 35239 }; 35240 } 35241 35242 this.uiDialog.draggable( { 35243 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 35244 handle: ".ui-dialog-titlebar", 35245 containment: "document", 35246 start: function( event, ui ) { 35247 that._addClass( $( this ), "ui-dialog-dragging" ); 35248 that._blockFrames(); 35249 that._trigger( "dragStart", event, filteredUi( ui ) ); 35250 }, 35251 drag: function( event, ui ) { 35252 that._trigger( "drag", event, filteredUi( ui ) ); 35253 }, 35254 stop: function( event, ui ) { 35255 var left = ui.offset.left - that.document.scrollLeft(), 35256 top = ui.offset.top - that.document.scrollTop(); 35257 35258 options.position = { 35259 my: "left top", 35260 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 35261 "top" + ( top >= 0 ? "+" : "" ) + top, 35262 of: that.window 35263 }; 35264 that._removeClass( $( this ), "ui-dialog-dragging" ); 35265 that._unblockFrames(); 35266 that._trigger( "dragStop", event, filteredUi( ui ) ); 35267 } 35268 } ); 35269 }, 35270 35271 _makeResizable: function() { 35272 var that = this, 35273 options = this.options, 35274 handles = options.resizable, 35275 35276 // .ui-resizable has position: relative defined in the stylesheet 35277 // but dialogs have to use absolute or fixed positioning 35278 position = this.uiDialog.css( "position" ), 35279 resizeHandles = typeof handles === "string" ? 35280 handles : 35281 "n,e,s,w,se,sw,ne,nw"; 35282 35283 function filteredUi( ui ) { 35284 return { 35285 originalPosition: ui.originalPosition, 35286 originalSize: ui.originalSize, 35287 position: ui.position, 35288 size: ui.size 35289 }; 35290 } 35291 35292 this.uiDialog.resizable( { 35293 cancel: ".ui-dialog-content", 35294 containment: "document", 35295 alsoResize: this.element, 35296 maxWidth: options.maxWidth, 35297 maxHeight: options.maxHeight, 35298 minWidth: options.minWidth, 35299 minHeight: this._minHeight(), 35300 handles: resizeHandles, 35301 start: function( event, ui ) { 35302 that._addClass( $( this ), "ui-dialog-resizing" ); 35303 that._blockFrames(); 35304 that._trigger( "resizeStart", event, filteredUi( ui ) ); 35305 }, 35306 resize: function( event, ui ) { 35307 that._trigger( "resize", event, filteredUi( ui ) ); 35308 }, 35309 stop: function( event, ui ) { 35310 var offset = that.uiDialog.offset(), 35311 left = offset.left - that.document.scrollLeft(), 35312 top = offset.top - that.document.scrollTop(); 35313 35314 options.height = that.uiDialog.height(); 35315 options.width = that.uiDialog.width(); 35316 options.position = { 35317 my: "left top", 35318 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 35319 "top" + ( top >= 0 ? "+" : "" ) + top, 35320 of: that.window 35321 }; 35322 that._removeClass( $( this ), "ui-dialog-resizing" ); 35323 that._unblockFrames(); 35324 that._trigger( "resizeStop", event, filteredUi( ui ) ); 35325 } 35326 } ) 35327 .css( "position", position ); 35328 }, 35329 35330 _trackFocus: function() { 35331 this._on( this.widget(), { 35332 focusin: function( event ) { 35333 this._makeFocusTarget(); 35334 this._focusedElement = $( event.target ); 35335 } 35336 } ); 35337 }, 35338 35339 _makeFocusTarget: function() { 35340 this._untrackInstance(); 35341 this._trackingInstances().unshift( this ); 35342 }, 35343 35344 _untrackInstance: function() { 35345 var instances = this._trackingInstances(), 35346 exists = $.inArray( this, instances ); 35347 if ( exists !== -1 ) { 35348 instances.splice( exists, 1 ); 35349 } 35350 }, 35351 35352 _trackingInstances: function() { 35353 var instances = this.document.data( "ui-dialog-instances" ); 35354 if ( !instances ) { 35355 instances = []; 35356 this.document.data( "ui-dialog-instances", instances ); 35357 } 35358 return instances; 35359 }, 35360 35361 _minHeight: function() { 35362 var options = this.options; 35363 35364 return options.height === "auto" ? 35365 options.minHeight : 35366 Math.min( options.minHeight, options.height ); 35367 }, 35368 35369 _position: function() { 35370 35371 // Need to show the dialog to get the actual offset in the position plugin 35372 var isVisible = this.uiDialog.is( ":visible" ); 35373 if ( !isVisible ) { 35374 this.uiDialog.show(); 35375 } 35376 this.uiDialog.position( this.options.position ); 35377 if ( !isVisible ) { 35378 this.uiDialog.hide(); 35379 } 35380 }, 35381 35382 _setOptions: function( options ) { 35383 var that = this, 35384 resize = false, 35385 resizableOptions = {}; 35386 35387 $.each( options, function( key, value ) { 35388 that._setOption( key, value ); 35389 35390 if ( key in that.sizeRelatedOptions ) { 35391 resize = true; 35392 } 35393 if ( key in that.resizableRelatedOptions ) { 35394 resizableOptions[ key ] = value; 35395 } 35396 } ); 35397 35398 if ( resize ) { 35399 this._size(); 35400 this._position(); 35401 } 35402 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 35403 this.uiDialog.resizable( "option", resizableOptions ); 35404 } 35405 }, 35406 35407 _setOption: function( key, value ) { 35408 var isDraggable, isResizable, 35409 uiDialog = this.uiDialog; 35410 35411 if ( key === "disabled" ) { 35412 return; 35413 } 35414 35415 this._super( key, value ); 35416 35417 if ( key === "appendTo" ) { 35418 this.uiDialog.appendTo( this._appendTo() ); 35419 } 35420 35421 if ( key === "buttons" ) { 35422 this._createButtons(); 35423 } 35424 35425 if ( key === "closeText" ) { 35426 this.uiDialogTitlebarClose.button( { 35427 35428 // Ensure that we always pass a string 35429 label: $( "<a>" ).text( "" + this.options.closeText ).html() 35430 } ); 35431 } 35432 35433 if ( key === "draggable" ) { 35434 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 35435 if ( isDraggable && !value ) { 35436 uiDialog.draggable( "destroy" ); 35437 } 35438 35439 if ( !isDraggable && value ) { 35440 this._makeDraggable(); 35441 } 35442 } 35443 35444 if ( key === "position" ) { 35445 this._position(); 35446 } 35447 35448 if ( key === "resizable" ) { 35449 35450 // currently resizable, becoming non-resizable 35451 isResizable = uiDialog.is( ":data(ui-resizable)" ); 35452 if ( isResizable && !value ) { 35453 uiDialog.resizable( "destroy" ); 35454 } 35455 35456 // Currently resizable, changing handles 35457 if ( isResizable && typeof value === "string" ) { 35458 uiDialog.resizable( "option", "handles", value ); 35459 } 35460 35461 // Currently non-resizable, becoming resizable 35462 if ( !isResizable && value !== false ) { 35463 this._makeResizable(); 35464 } 35465 } 35466 35467 if ( key === "title" ) { 35468 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 35469 } 35470 }, 35471 35472 _size: function() { 35473 35474 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 35475 // divs will both have width and height set, so we need to reset them 35476 var nonContentHeight, minContentHeight, maxContentHeight, 35477 options = this.options; 35478 35479 // Reset content sizing 35480 this.element.show().css( { 35481 width: "auto", 35482 minHeight: 0, 35483 maxHeight: "none", 35484 height: 0 35485 } ); 35486 35487 if ( options.minWidth > options.width ) { 35488 options.width = options.minWidth; 35489 } 35490 35491 // Reset wrapper sizing 35492 // determine the height of all the non-content elements 35493 nonContentHeight = this.uiDialog.css( { 35494 height: "auto", 35495 width: options.width 35496 } ) 35497 .outerHeight(); 35498 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 35499 maxContentHeight = typeof options.maxHeight === "number" ? 35500 Math.max( 0, options.maxHeight - nonContentHeight ) : 35501 "none"; 35502 35503 if ( options.height === "auto" ) { 35504 this.element.css( { 35505 minHeight: minContentHeight, 35506 maxHeight: maxContentHeight, 35507 height: "auto" 35508 } ); 35509 } else { 35510 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 35511 } 35512 35513 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 35514 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 35515 } 35516 }, 35517 35518 _blockFrames: function() { 35519 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 35520 var iframe = $( this ); 35521 35522 return $( "<div>" ) 35523 .css( { 35524 position: "absolute", 35525 width: iframe.outerWidth(), 35526 height: iframe.outerHeight() 35527 } ) 35528 .appendTo( iframe.parent() ) 35529 .offset( iframe.offset() )[ 0 ]; 35530 } ); 35531 }, 35532 35533 _unblockFrames: function() { 35534 if ( this.iframeBlocks ) { 35535 this.iframeBlocks.remove(); 35536 delete this.iframeBlocks; 35537 } 35538 }, 35539 35540 _allowInteraction: function( event ) { 35541 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 35542 return true; 35543 } 35544 35545 // TODO: Remove hack when datepicker implements 35546 // the .ui-front logic (#8989) 35547 return !!$( event.target ).closest( ".ui-datepicker" ).length; 35548 }, 35549 35550 _createOverlay: function() { 35551 if ( !this.options.modal ) { 35552 return; 35553 } 35554 35555 var jqMinor = $.fn.jquery.substring( 0, 4 ); 35556 35557 // We use a delay in case the overlay is created from an 35558 // event that we're going to be cancelling (#2804) 35559 var isOpening = true; 35560 this._delay( function() { 35561 isOpening = false; 35562 } ); 35563 35564 if ( !this.document.data( "ui-dialog-overlays" ) ) { 35565 35566 // Prevent use of anchors and inputs 35567 // This doesn't use `_on()` because it is a shared event handler 35568 // across all open modal dialogs. 35569 this.document.on( "focusin.ui-dialog", function( event ) { 35570 if ( isOpening ) { 35571 return; 35572 } 35573 35574 var instance = this._trackingInstances()[ 0 ]; 35575 if ( !instance._allowInteraction( event ) ) { 35576 event.preventDefault(); 35577 instance._focusTabbable(); 35578 35579 // Support: jQuery >=3.4 <3.7 only 35580 // In jQuery 3.4-3.6, there are multiple issues with focus/blur 35581 // trigger chains or when triggering is done on a hidden element 35582 // at least once. 35583 // Trigger focus in a delay in addition if needed to avoid the issues. 35584 // See https://github.com/jquery/jquery/issues/4382 35585 // See https://github.com/jquery/jquery/issues/4856 35586 // See https://github.com/jquery/jquery/issues/4950 35587 if ( jqMinor === "3.4." || jqMinor === "3.5." || jqMinor === "3.6." ) { 35588 instance._delay( instance._restoreTabbableFocus ); 35589 } 35590 } 35591 }.bind( this ) ); 35592 } 35593 35594 this.overlay = $( "<div>" ) 35595 .appendTo( this._appendTo() ); 35596 35597 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 35598 this._on( this.overlay, { 35599 mousedown: "_keepFocus" 35600 } ); 35601 this.document.data( "ui-dialog-overlays", 35602 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 35603 }, 35604 35605 _destroyOverlay: function() { 35606 if ( !this.options.modal ) { 35607 return; 35608 } 35609 35610 if ( this.overlay ) { 35611 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 35612 35613 if ( !overlays ) { 35614 this.document.off( "focusin.ui-dialog" ); 35615 this.document.removeData( "ui-dialog-overlays" ); 35616 } else { 35617 this.document.data( "ui-dialog-overlays", overlays ); 35618 } 35619 35620 this.overlay.remove(); 35621 this.overlay = null; 35622 } 35623 } 35624} ); 35625 35626// DEPRECATED 35627// TODO: switch return back to widget declaration at top of file when this is removed 35628if ( $.uiBackCompat !== false ) { 35629 35630 // Backcompat for dialogClass option 35631 $.widget( "ui.dialog", $.ui.dialog, { 35632 options: { 35633 dialogClass: "" 35634 }, 35635 _createWrapper: function() { 35636 this._super(); 35637 this.uiDialog.addClass( this.options.dialogClass ); 35638 }, 35639 _setOption: function( key, value ) { 35640 if ( key === "dialogClass" ) { 35641 this.uiDialog 35642 .removeClass( this.options.dialogClass ) 35643 .addClass( value ); 35644 } 35645 this._superApply( arguments ); 35646 } 35647 } ); 35648} 35649
35650return $.ui.dialog; 35651 35652} ); 35653 35654 35655 35656 35657 35658 35659 35660/*! 35661 * jQuery UI Sortable 1.13.3 35662 * https://jqueryui.com 35663 * 35664 * Copyright OpenJS Foundation and other contributors 35665 * Released under the MIT license. 35666 * https://jquery.org/license 35667 */ 35668 35669//>>label: Sortable 35670//>>group: Interactions 35671//>>description: Enables items in a list to be sorted using the mouse. 35672//>>docs: https://api.jqueryui.com/sortable/ 35673//>>demos: https://jqueryui.com/sortable/ 35674//>>css.structure: ../../themes/base/sortable.css 35675 35676( function( factory ) { 35677 "use strict"; 35678 35679 if ( typeof define === "function" && define.amd ) { 35680 35681 // AMD. Register as an anonymous module. 35682 define( [ 35683 "jquery", 35684 "./mouse", 35685 "../data", 35686 "../ie", 35687 "../scroll-parent", 35688 "../version", 35689 "../widget" 35690 ], factory ); 35691 } else { 35692 35693 // Browser globals 35694 factory( jQuery ); 35695 } 35696} )( function( $ ) { 35697"use strict"; 35698 35699return
vendor: 12,471 bytes, lines 35699-36162
35699 $.widget( "ui.sortable", $.ui.mouse, { 35700 version: "1.13.3", 35701 widgetEventPrefix: "sort", 35702 ready: false, 35703 options: { 35704 appendTo: "parent", 35705 axis: false, 35706 connectWith: false, 35707 containment: false, 35708 cursor: "auto", 35709 cursorAt: false, 35710 dropOnEmpty: true, 35711 forcePlaceholderSize: false, 35712 forceHelperSize: false, 35713 grid: false, 35714 handle: false, 35715 helper: "original", 35716 items: "> *", 35717 opacity: false, 35718 placeholder: false, 35719 revert: false, 35720 scroll: true, 35721 scrollSensitivity: 20, 35722 scrollSpeed: 20, 35723 scope: "default", 35724 tolerance: "intersect", 35725 zIndex: 1000, 35726 35727 // Callbacks 35728 activate: null, 35729 beforeStop: null, 35730 change: null, 35731 deactivate: null, 35732 out: null, 35733 over: null, 35734 receive: null, 35735 remove: null, 35736 sort: null, 35737 start: null, 35738 stop: null, 35739 update: null 35740 }, 35741 35742 _isOverAxis: function( x, reference, size ) { 35743 return ( x >= reference ) && ( x < ( reference + size ) ); 35744 }, 35745 35746 _isFloating: function( item ) { 35747 return ( /left|right/ ).test( item.css( "float" ) ) || 35748 ( /inline|table-cell/ ).test( item.css( "display" ) ); 35749 }, 35750 35751 _create: function() { 35752 this.containerCache = {}; 35753 this._addClass( "ui-sortable" ); 35754 35755 //Get the items 35756 this.refresh(); 35757 35758 //Let's determine the parent's offset 35759 this.offset = this.element.offset(); 35760 35761 //Initialize mouse events for interaction 35762 this._mouseInit(); 35763 35764 this._setHandleClassName(); 35765 35766 //We're ready to go 35767 this.ready = true; 35768 35769 }, 35770 35771 _setOption: function( key, value ) { 35772 this._super( key, value ); 35773 35774 if ( key === "handle" ) { 35775 this._setHandleClassName(); 35776 } 35777 }, 35778 35779 _setHandleClassName: function() { 35780 var that = this; 35781 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 35782 $.each( this.items, function() { 35783 that._addClass( 35784 this.instance.options.handle ? 35785 this.item.find( this.instance.options.handle ) : 35786 this.item, 35787 "ui-sortable-handle" 35788 ); 35789 } ); 35790 }, 35791 35792 _destroy: function() { 35793 this._mouseDestroy(); 35794 35795 for ( var i = this.items.length - 1; i >= 0; i-- ) { 35796 this.items[ i ].item.removeData( this.widgetName + "-item" ); 35797 } 35798 35799 return this; 35800 }, 35801 35802 _mouseCapture: function( event, overrideHandle ) { 35803 var currentItem = null, 35804 validHandle = false, 35805 that = this; 35806 35807 if ( this.reverting ) { 35808 return false; 35809 } 35810 35811 if ( this.options.disabled || this.options.type === "static" ) { 35812 return false; 35813 } 35814 35815 //We have to refresh the items data once first 35816 this._refreshItems( event ); 35817 35818 //Find out if the clicked node (or one of its parents) is a actual item in this.items 35819 $( event.target ).parents().each( function() { 35820 if ( $.data( this, that.widgetName + "-item" ) === that ) { 35821 currentItem = $( this ); 35822 return false; 35823 } 35824 } ); 35825 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 35826 currentItem = $( event.target ); 35827 } 35828 35829 if ( !currentItem ) { 35830 return false; 35831 } 35832 if ( this.options.handle && !overrideHandle ) { 35833 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 35834 if ( this === event.target ) { 35835 validHandle = true; 35836 } 35837 } ); 35838 if ( !validHandle ) { 35839 return false; 35840 } 35841 } 35842 35843 this.currentItem = currentItem; 35844 this._removeCurrentsFromItems(); 35845 return true; 35846 35847 }, 35848 35849 _mouseStart: function( event, overrideHandle, noActivation ) { 35850 35851 var i, body, 35852 o = this.options; 35853 35854 this.currentContainer = this; 35855 35856 //We only need to call refreshPositions, because the refreshItems call has been moved to 35857 // mouseCapture 35858 this.refreshPositions(); 35859 35860 //Prepare the dragged items parent 35861 this.appendTo = $( o.appendTo !== "parent" ? 35862 o.appendTo : 35863 this.currentItem.parent() ); 35864 35865 //Create and append the visible helper 35866 this.helper = this._createHelper( event ); 35867 35868 //Cache the helper size 35869 this._cacheHelperProportions(); 35870 35871 /* 35872 * - Position generation - 35873 * This block generates everything position related - it's the core of draggables. 35874 */ 35875 35876 //Cache the margins of the original element 35877 this._cacheMargins(); 35878 35879 //The element's absolute position on the page minus margins 35880 this.offset = this.currentItem.offset(); 35881 this.offset = { 35882 top: this.offset.top - this.margins.top, 35883 left: this.offset.left - this.margins.left 35884 }; 35885 35886 $.extend( this.offset, { 35887 click: { //Where the click happened, relative to the element 35888 left: event.pageX - this.offset.left, 35889 top: event.pageY - this.offset.top 35890 }, 35891 35892 // This is a relative to absolute position minus the actual position calculation - 35893 // only used for relative positioned helper 35894 relative: this._getRelativeOffset() 35895 } ); 35896 35897 // After we get the helper offset, but before we get the parent offset we can 35898 // change the helper's position to absolute 35899 // TODO: Still need to figure out a way to make relative sorting possible 35900 this.helper.css( "position", "absolute" ); 35901 this.cssPosition = this.helper.css( "position" ); 35902 35903 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 35904 if ( o.cursorAt ) { 35905 this._adjustOffsetFromHelper( o.cursorAt ); 35906 } 35907 35908 //Cache the former DOM position 35909 this.domPosition = { 35910 prev: this.currentItem.prev()[ 0 ], 35911 parent: this.currentItem.parent()[ 0 ] 35912 }; 35913 35914 // If the helper is not the original, hide the original so it's not playing any role during 35915 // the drag, won't cause anything bad this way 35916 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 35917 this.currentItem.hide(); 35918 } 35919 35920 //Create the placeholder 35921 this._createPlaceholder(); 35922 35923 //Get the next scrolling parent 35924 this.scrollParent = this.placeholder.scrollParent(); 35925 35926 $.extend( this.offset, { 35927 parent: this._getParentOffset() 35928 } ); 35929 35930 //Set a containment if given in the options 35931 if ( o.containment ) { 35932 this._setContainment(); 35933 } 35934 35935 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 35936 body = this.document.find( "body" ); 35937 35938 // Support: IE 35939 this.storedCursor = body.css( "cursor" ); 35940 body.css( "cursor", o.cursor ); 35941 35942 this.storedStylesheet = 35943 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 35944 } 35945 35946 // We need to make sure to grab the zIndex before setting the 35947 // opacity, because setting the opacity to anything lower than 1 35948 // causes the zIndex to change from "auto" to 0. 35949 if ( o.zIndex ) { // zIndex option 35950 if ( this.helper.css( "zIndex" ) ) { 35951 this._storedZIndex = this.helper.css( "zIndex" ); 35952 } 35953 this.helper.css( "zIndex", o.zIndex ); 35954 } 35955 35956 if ( o.opacity ) { // opacity option 35957 if ( this.helper.css( "opacity" ) ) { 35958 this._storedOpacity = this.helper.css( "opacity" ); 35959 } 35960 this.helper.css( "opacity", o.opacity ); 35961 } 35962 35963 //Prepare scrolling 35964 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 35965 this.scrollParent[ 0 ].tagName !== "HTML" ) { 35966 this.overflowOffset = this.scrollParent.offset(); 35967 } 35968 35969 //Call callbacks 35970 this._trigger( "start", event, this._uiHash() ); 35971 35972 //Recache the helper size 35973 if ( !this._preserveHelperProportions ) { 35974 this._cacheHelperProportions(); 35975 } 35976 35977 //Post "activate" events to possible containers 35978 if ( !noActivation ) { 35979 for ( i = this.containers.length - 1; i >= 0; i-- ) { 35980 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 35981 } 35982 } 35983 35984 //Prepare possible droppables 35985 if ( $.ui.ddmanager ) { 35986 $.ui.ddmanager.current = this; 35987 } 35988 35989 if ( $.ui.ddmanager && !o.dropBehaviour ) { 35990 $.ui.ddmanager.prepareOffsets( this, event ); 35991 } 35992 35993 this.dragging = true; 35994 35995 this._addClass( this.helper, "ui-sortable-helper" ); 35996 35997 //Move the helper, if needed 35998 if ( !this.helper.parent().is( this.appendTo ) ) { 35999 this.helper.detach().appendTo( this.appendTo ); 36000 36001 //Update position 36002 this.offset.parent = this._getParentOffset(); 36003 } 36004 36005 //Generate the original position 36006 this.position = this.originalPosition = this._generatePosition( event ); 36007 this.originalPageX = event.pageX; 36008 this.originalPageY = event.pageY; 36009 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 36010 36011 this._mouseDrag( event ); 36012 36013 return true; 36014 36015 }, 36016 36017 _scroll: function( event ) { 36018 var o = this.options, 36019 scrolled = false; 36020 36021 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 36022 this.scrollParent[ 0 ].tagName !== "HTML" ) { 36023 36024 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 36025 event.pageY < o.scrollSensitivity ) { 36026 this.scrollParent[ 0 ].scrollTop = 36027 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 36028 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 36029 this.scrollParent[ 0 ].scrollTop = 36030 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 36031 } 36032 36033 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 36034 event.pageX < o.scrollSensitivity ) { 36035 this.scrollParent[ 0 ].scrollLeft = scrolled = 36036 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 36037 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 36038 this.scrollParent[ 0 ].scrollLeft = scrolled = 36039 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 36040 } 36041 36042 } else { 36043 36044 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 36045 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 36046 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 36047 o.scrollSensitivity ) { 36048 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 36049 } 36050 36051 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 36052 scrolled = this.document.scrollLeft( 36053 this.document.scrollLeft() - o.scrollSpeed 36054 ); 36055 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 36056 o.scrollSensitivity ) { 36057 scrolled = this.document.scrollLeft( 36058 this.document.scrollLeft() + o.scrollSpeed 36059 ); 36060 } 36061 36062 } 36063 36064 return scrolled; 36065 }, 36066 36067 _mouseDrag: function( event ) { 36068 var i, item, itemElement, intersection, 36069 o = this.options; 36070 36071 //Compute the helpers position 36072 this.position = this._generatePosition( event ); 36073 this.positionAbs = this._convertPositionTo( "absolute" ); 36074 36075 //Set the helper position 36076 if ( !this.options.axis || this.options.axis !== "y" ) { 36077 this.helper[ 0 ].style.left = this.position.left + "px"; 36078 } 36079 if ( !this.options.axis || this.options.axis !== "x" ) { 36080 this.helper[ 0 ].style.top = this.position.top + "px"; 36081 } 36082 36083 //Do scrolling 36084 if ( o.scroll ) { 36085 if ( this._scroll( event ) !== false ) { 36086 36087 //Update item positions used in position checks 36088 this._refreshItemPositions( true ); 36089 36090 if ( $.ui.ddmanager && !o.dropBehaviour ) { 36091 $.ui.ddmanager.prepareOffsets( this, event ); 36092 } 36093 } 36094 } 36095 36096 this.dragDirection = { 36097 vertical: this._getDragVerticalDirection(), 36098 horizontal: this._getDragHorizontalDirection() 36099 }; 36100 36101 //Rearrange 36102 for ( i = this.items.length - 1; i >= 0; i-- ) { 36103 36104 //Cache variables and intersection, continue if no intersection 36105 item = this.items[ i ]; 36106 itemElement = item.item[ 0 ]; 36107 intersection = this._intersectsWithPointer( item ); 36108 if ( !intersection ) { 36109 continue; 36110 } 36111 36112 // Only put the placeholder inside the current Container, skip all 36113 // items from other containers. This works because when moving 36114 // an item from one container to another the 36115 // currentContainer is switched before the placeholder is moved. 36116 // 36117 // Without this, moving items in "sub-sortables" can cause 36118 // the placeholder to jitter between the outer and inner container. 36119 if ( item.instance !== this.currentContainer ) { 36120 continue; 36121 } 36122 36123 // Cannot intersect with itself 36124 // no useless actions that have been done before 36125 // no action if the item moved is the parent of the item checked 36126 if ( itemElement !== this.currentItem[ 0 ] && 36127 this.placeholder[ intersection === 1 ? 36128 "next" : "prev" ]()[ 0 ] !== itemElement && 36129 !$.contains( this.placeholder[ 0 ], itemElement ) && 36130 ( this.options.type === "semi-dynamic" ? 36131 !$.contains( this.element[ 0 ], itemElement ) : 36132 true 36133 ) 36134 ) { 36135 36136 this.direction = intersection === 1 ? "down" : "up"; 36137 36138 if ( this.options.tolerance === "pointer" || 36139 this._intersectsWithSides( item ) ) { 36140 this._rearrange( event, item ); 36141 } else { 36142 break; 36143 } 36144 36145 this._trigger( "change", event, this._uiHash() ); 36146 break; 36147 } 36148 } 36149 36150 //Post events to containers 36151 this._contactContainers( event ); 36152 36153 //Interconnect with droppables 36154 if ( $.ui.ddmanager ) { 36155 $.ui.ddmanager.drag( this, event ); 36156 } 36157 36158 //Call callbacks 36159 this._trigger( "sort", event, this._uiHash() ); 36160 36161 this.lastPositionAbs = this.positionAbs; 36162 return false;
vendor: 5,063 bytes, lines 36163-36352
36163 36164 }, 36165 36166 _mouseStop: function( event, noPropagation ) { 36167 36168 if ( !event ) { 36169 return; 36170 } 36171 36172 //If we are using droppables, inform the manager about the drop 36173 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 36174 $.ui.ddmanager.drop( this, event ); 36175 } 36176 36177 if ( this.options.revert ) { 36178 var that = this, 36179 cur = this.placeholder.offset(), 36180 axis = this.options.axis, 36181 animation = {}; 36182 36183 if ( !axis || axis === "x" ) { 36184 animation.left = cur.left - this.offset.parent.left - this.margins.left + 36185 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 36186 0 : 36187 this.offsetParent[ 0 ].scrollLeft 36188 ); 36189 } 36190 if ( !axis || axis === "y" ) { 36191 animation.top = cur.top - this.offset.parent.top - this.margins.top + 36192 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 36193 0 : 36194 this.offsetParent[ 0 ].scrollTop 36195 ); 36196 } 36197 this.reverting = true; 36198 $( this.helper ).animate( 36199 animation, 36200 parseInt( this.options.revert, 10 ) || 500, 36201 function() { 36202 that._clear( event ); 36203 } 36204 ); 36205 } else { 36206 this._clear( event, noPropagation ); 36207 } 36208 36209 return false; 36210 36211 }, 36212 36213 cancel: function() { 36214 36215 if ( this.dragging ) { 36216 36217 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 36218 36219 if ( this.options.helper === "original" ) { 36220 this.currentItem.css( this._storedCSS ); 36221 this._removeClass( this.currentItem, "ui-sortable-helper" ); 36222 } else { 36223 this.currentItem.show(); 36224 } 36225 36226 //Post deactivating events to containers 36227 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 36228 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 36229 if ( this.containers[ i ].containerCache.over ) { 36230 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 36231 this.containers[ i ].containerCache.over = 0; 36232 } 36233 } 36234 36235 } 36236 36237 if ( this.placeholder ) { 36238 36239 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 36240 // it unbinds ALL events from the original node! 36241 if ( this.placeholder[ 0 ].parentNode ) { 36242 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 36243 } 36244 if ( this.options.helper !== "original" && this.helper && 36245 this.helper[ 0 ].parentNode ) { 36246 this.helper.remove(); 36247 } 36248 36249 $.extend( this, { 36250 helper: null, 36251 dragging: false, 36252 reverting: false, 36253 _noFinalSort: null 36254 } ); 36255 36256 if ( this.domPosition.prev ) { 36257 $( this.domPosition.prev ).after( this.currentItem ); 36258 } else { 36259 $( this.domPosition.parent ).prepend( this.currentItem ); 36260 } 36261 } 36262 36263 return this; 36264 36265 }, 36266 36267 serialize: function( o ) { 36268 36269 var items = this._getItemsAsjQuery( o && o.connected ), 36270 str = []; 36271 o = o || {}; 36272 36273 $( items ).each( function() { 36274 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 36275 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 36276 if ( res ) { 36277 str.push( 36278 ( o.key || res[ 1 ] + "[]" ) + 36279 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 36280 } 36281 } ); 36282 36283 if ( !str.length && o.key ) { 36284 str.push( o.key + "=" ); 36285 } 36286 36287 return str.join( "&" ); 36288 36289 }, 36290 36291 toArray: function( o ) { 36292 36293 var items = this._getItemsAsjQuery( o && o.connected ), 36294 ret = []; 36295 36296 o = o || {}; 36297 36298 items.each( function() { 36299 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 36300 } ); 36301 return ret; 36302 36303 }, 36304 36305 /* Be careful with the following core functions */ 36306 _intersectsWith: function( item ) { 36307 36308 var x1 = this.positionAbs.left, 36309 x2 = x1 + this.helperProportions.width, 36310 y1 = this.positionAbs.top, 36311 y2 = y1 + this.helperProportions.height, 36312 l = item.left, 36313 r = l + item.width, 36314 t = item.top, 36315 b = t + item.height, 36316 dyClick = this.offset.click.top, 36317 dxClick = this.offset.click.left, 36318 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 36319 ( y1 + dyClick ) < b ), 36320 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 36321 ( x1 + dxClick ) < r ), 36322 isOverElement = isOverElementHeight && isOverElementWidth; 36323 36324 if ( this.options.tolerance === "pointer" || 36325 this.options.forcePointerForContainers || 36326 ( this.options.tolerance !== "pointer" && 36327 this.helperProportions[ this.floating ? "width" : "height" ] > 36328 item[ this.floating ? "width" : "height" ] ) 36329 ) { 36330 return isOverElement; 36331 } else { 36332 36333 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 36334 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 36335 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 36336 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 36337 36338 } 36339 }, 36340 36341 _intersectsWithPointer: function( item ) { 36342 var verticalDirection, horizontalDirection, 36343 isOverElementHeight = ( this.options.axis === "x" ) || 36344 this._isOverAxis( 36345 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 36346 isOverElementWidth = ( this.options.axis === "y" ) || 36347 this._isOverAxis( 36348 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 36349 isOverElement = isOverElementHeight && isOverElementWidth; 36350 36351 if ( !isOverElement ) { 36352 return false;
vendor: 18,663 bytes, lines 36353-36935
36353 } 36354 36355 verticalDirection = this.dragDirection.vertical; 36356 horizontalDirection = this.dragDirection.horizontal; 36357 36358 return this.floating ? 36359 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 36360 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 36361 36362 }, 36363 36364 _intersectsWithSides: function( item ) { 36365 36366 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 36367 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 36368 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 36369 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 36370 verticalDirection = this.dragDirection.vertical, 36371 horizontalDirection = this.dragDirection.horizontal; 36372 36373 if ( this.floating && horizontalDirection ) { 36374 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 36375 ( horizontalDirection === "left" && !isOverRightHalf ) ); 36376 } else { 36377 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 36378 ( verticalDirection === "up" && !isOverBottomHalf ) ); 36379 } 36380 36381 }, 36382 36383 _getDragVerticalDirection: function() { 36384 var delta = this.positionAbs.top - this.lastPositionAbs.top; 36385 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 36386 }, 36387 36388 _getDragHorizontalDirection: function() { 36389 var delta = this.positionAbs.left - this.lastPositionAbs.left; 36390 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 36391 }, 36392 36393 refresh: function( event ) { 36394 this._refreshItems( event ); 36395 this._setHandleClassName(); 36396 this.refreshPositions(); 36397 return this; 36398 }, 36399 36400 _connectWith: function() { 36401 var options = this.options; 36402 return options.connectWith.constructor === String ? 36403 [ options.connectWith ] : 36404 options.connectWith; 36405 }, 36406 36407 _getItemsAsjQuery: function( connected ) { 36408 36409 var i, j, cur, inst, 36410 items = [], 36411 queries = [], 36412 connectWith = this._connectWith(); 36413 36414 if ( connectWith && connected ) { 36415 for ( i = connectWith.length - 1; i >= 0; i-- ) { 36416 cur = $( connectWith[ i ], this.document[ 0 ] ); 36417 for ( j = cur.length - 1; j >= 0; j-- ) { 36418 inst = $.data( cur[ j ], this.widgetFullName ); 36419 if ( inst && inst !== this && !inst.options.disabled ) { 36420 queries.push( [ typeof inst.options.items === "function" ? 36421 inst.options.items.call( inst.element ) : 36422 $( inst.options.items, inst.element ) 36423 .not( ".ui-sortable-helper" ) 36424 .not( ".ui-sortable-placeholder" ), inst ] ); 36425 } 36426 } 36427 } 36428 } 36429 36430 queries.push( [ typeof this.options.items === "function" ? 36431 this.options.items 36432 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 36433 $( this.options.items, this.element ) 36434 .not( ".ui-sortable-helper" ) 36435 .not( ".ui-sortable-placeholder" ), this ] ); 36436 36437 function addItems() { 36438 items.push( this ); 36439 } 36440 for ( i = queries.length - 1; i >= 0; i-- ) { 36441 queries[ i ][ 0 ].each( addItems ); 36442 } 36443 36444 return $( items ); 36445 36446 }, 36447 36448 _removeCurrentsFromItems: function() { 36449 36450 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 36451 36452 this.items = $.grep( this.items, function( item ) { 36453 for ( var j = 0; j < list.length; j++ ) { 36454 if ( list[ j ] === item.item[ 0 ] ) { 36455 return false; 36456 } 36457 } 36458 return true; 36459 } ); 36460 36461 }, 36462 36463 _refreshItems: function( event ) { 36464 36465 this.items = []; 36466 this.containers = [ this ]; 36467 36468 var i, j, cur, inst, targetData, _queries, item, queriesLength, 36469 items = this.items, 36470 queries = [ [ typeof this.options.items === "function" ? 36471 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 36472 $( this.options.items, this.element ), this ] ], 36473 connectWith = this._connectWith(); 36474 36475 //Shouldn't be run the first time through due to massive slow-down 36476 if ( connectWith && this.ready ) { 36477 for ( i = connectWith.length - 1; i >= 0; i-- ) { 36478 cur = $( connectWith[ i ], this.document[ 0 ] ); 36479 for ( j = cur.length - 1; j >= 0; j-- ) { 36480 inst = $.data( cur[ j ], this.widgetFullName ); 36481 if ( inst && inst !== this && !inst.options.disabled ) { 36482 queries.push( [ typeof inst.options.items === "function" ? 36483 inst.options.items 36484 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 36485 $( inst.options.items, inst.element ), inst ] ); 36486 this.containers.push( inst ); 36487 } 36488 } 36489 } 36490 } 36491 36492 for ( i = queries.length - 1; i >= 0; i-- ) { 36493 targetData = queries[ i ][ 1 ]; 36494 _queries = queries[ i ][ 0 ]; 36495 36496 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 36497 item = $( _queries[ j ] ); 36498 36499 // Data for target checking (mouse manager) 36500 item.data( this.widgetName + "-item", targetData ); 36501 36502 items.push( { 36503 item: item, 36504 instance: targetData, 36505 width: 0, height: 0, 36506 left: 0, top: 0 36507 } ); 36508 } 36509 } 36510 36511 }, 36512 36513 _refreshItemPositions: function( fast ) { 36514 var i, item, t, p; 36515 36516 for ( i = this.items.length - 1; i >= 0; i-- ) { 36517 item = this.items[ i ]; 36518 36519 //We ignore calculating positions of all connected containers when we're not over them 36520 if ( this.currentContainer && item.instance !== this.currentContainer && 36521 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 36522 continue; 36523 } 36524 36525 t = this.options.toleranceElement ? 36526 $( this.options.toleranceElement, item.item ) : 36527 item.item; 36528 36529 if ( !fast ) { 36530 item.width = t.outerWidth(); 36531 item.height = t.outerHeight(); 36532 } 36533 36534 p = t.offset(); 36535 item.left = p.left; 36536 item.top = p.top; 36537 } 36538 }, 36539 36540 refreshPositions: function( fast ) { 36541 36542 // Determine whether items are being displayed horizontally 36543 this.floating = this.items.length ? 36544 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 36545 false; 36546 36547 // This has to be redone because due to the item being moved out/into the offsetParent, 36548 // the offsetParent's position will change 36549 if ( this.offsetParent && this.helper ) { 36550 this.offset.parent = this._getParentOffset(); 36551 } 36552 36553 this._refreshItemPositions( fast ); 36554 36555 var i, p; 36556 36557 if ( this.options.custom && this.options.custom.refreshContainers ) { 36558 this.options.custom.refreshContainers.call( this ); 36559 } else { 36560 for ( i = this.containers.length - 1; i >= 0; i-- ) { 36561 p = this.containers[ i ].element.offset(); 36562 this.containers[ i ].containerCache.left = p.left; 36563 this.containers[ i ].containerCache.top = p.top; 36564 this.containers[ i ].containerCache.width = 36565 this.containers[ i ].element.outerWidth(); 36566 this.containers[ i ].containerCache.height = 36567 this.containers[ i ].element.outerHeight(); 36568 } 36569 } 36570 36571 return this; 36572 }, 36573 36574 _createPlaceholder: function( that ) { 36575 that = that || this; 36576 var className, nodeName, 36577 o = that.options; 36578 36579 if ( !o.placeholder || o.placeholder.constructor === String ) { 36580 className = o.placeholder; 36581 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 36582 o.placeholder = { 36583 element: function() { 36584 36585 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 36586 36587 that._addClass( element, "ui-sortable-placeholder", 36588 className || that.currentItem[ 0 ].className ) 36589 ._removeClass( element, "ui-sortable-helper" ); 36590 36591 if ( nodeName === "tbody" ) { 36592 that._createTrPlaceholder( 36593 that.currentItem.find( "tr" ).eq( 0 ), 36594 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 36595 ); 36596 } else if ( nodeName === "tr" ) { 36597 that._createTrPlaceholder( that.currentItem, element ); 36598 } else if ( nodeName === "img" ) { 36599 element.attr( "src", that.currentItem.attr( "src" ) ); 36600 } 36601 36602 if ( !className ) { 36603 element.css( "visibility", "hidden" ); 36604 } 36605 36606 return element; 36607 }, 36608 update: function( container, p ) { 36609 36610 // 1. If a className is set as 'placeholder option, we don't force sizes - 36611 // the class is responsible for that 36612 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 36613 // class name is specified 36614 if ( className && !o.forcePlaceholderSize ) { 36615 return; 36616 } 36617 36618 // If the element doesn't have a actual height or width by itself (without 36619 // styles coming from a stylesheet), it receives the inline height and width 36620 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 36621 // anyway since we're populating them with <td>s above, but they're unlikely to 36622 // be the correct height on their own if the row heights are dynamic, so we'll 36623 // always assign the height of the dragged item given forcePlaceholderSize 36624 // is true. 36625 if ( !p.height() || ( o.forcePlaceholderSize && 36626 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 36627 p.height( 36628 that.currentItem.innerHeight() - 36629 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 36630 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 36631 } 36632 if ( !p.width() ) { 36633 p.width( 36634 that.currentItem.innerWidth() - 36635 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 36636 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 36637 } 36638 } 36639 }; 36640 } 36641 36642 //Create the placeholder 36643 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 36644 36645 //Append it after the actual current item 36646 that.currentItem.after( that.placeholder ); 36647 36648 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 36649 o.placeholder.update( that, that.placeholder ); 36650 36651 }, 36652 36653 _createTrPlaceholder: function( sourceTr, targetTr ) { 36654 var that = this; 36655 36656 sourceTr.children().each( function() { 36657 $( "<td> </td>", that.document[ 0 ] ) 36658 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 36659 .appendTo( targetTr ); 36660 } ); 36661 }, 36662 36663 _contactContainers: function( event ) { 36664 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 36665 floating, axis, 36666 innermostContainer = null, 36667 innermostIndex = null; 36668 36669 // Get innermost container that intersects with item 36670 for ( i = this.containers.length - 1; i >= 0; i-- ) { 36671 36672 // Never consider a container that's located within the item itself 36673 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 36674 continue; 36675 } 36676 36677 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 36678 36679 // If we've already found a container and it's more "inner" than this, then continue 36680 if ( innermostContainer && 36681 $.contains( 36682 this.containers[ i ].element[ 0 ], 36683 innermostContainer.element[ 0 ] ) ) { 36684 continue; 36685 } 36686 36687 innermostContainer = this.containers[ i ]; 36688 innermostIndex = i; 36689 36690 } else { 36691 36692 // container doesn't intersect. trigger "out" event if necessary 36693 if ( this.containers[ i ].containerCache.over ) { 36694 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 36695 this.containers[ i ].containerCache.over = 0; 36696 } 36697 } 36698 36699 } 36700 36701 // If no intersecting containers found, return 36702 if ( !innermostContainer ) { 36703 return; 36704 } 36705 36706 // Move the item into the container if it's not there already 36707 if ( this.containers.length === 1 ) { 36708 if ( !this.containers[ innermostIndex ].containerCache.over ) { 36709 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 36710 this.containers[ innermostIndex ].containerCache.over = 1; 36711 } 36712 } else { 36713 36714 // When entering a new container, we will find the item with the least distance and 36715 // append our item near it 36716 dist = 10000; 36717 itemWithLeastDistance = null; 36718 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 36719 posProperty = floating ? "left" : "top"; 36720 sizeProperty = floating ? "width" : "height"; 36721 axis = floating ? "pageX" : "pageY"; 36722 36723 for ( j = this.items.length - 1; j >= 0; j-- ) { 36724 if ( !$.contains( 36725 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 36726 ) { 36727 continue; 36728 } 36729 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 36730 continue; 36731 } 36732 36733 cur = this.items[ j ].item.offset()[ posProperty ]; 36734 nearBottom = false; 36735 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 36736 nearBottom = true; 36737 } 36738 36739 if ( Math.abs( event[ axis ] - cur ) < dist ) { 36740 dist = Math.abs( event[ axis ] - cur ); 36741 itemWithLeastDistance = this.items[ j ]; 36742 this.direction = nearBottom ? "up" : "down"; 36743 } 36744 } 36745 36746 //Check if dropOnEmpty is enabled 36747 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 36748 return; 36749 } 36750 36751 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 36752 if ( !this.currentContainer.containerCache.over ) { 36753 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 36754 this.currentContainer.containerCache.over = 1; 36755 } 36756 return; 36757 } 36758 36759 if ( itemWithLeastDistance ) { 36760 this._rearrange( event, itemWithLeastDistance, null, true ); 36761 } else { 36762 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 36763 } 36764 this._trigger( "change", event, this._uiHash() ); 36765 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 36766 this.currentContainer = this.containers[ innermostIndex ]; 36767 36768 //Update the placeholder 36769 this.options.placeholder.update( this.currentContainer, this.placeholder ); 36770 36771 //Update scrollParent 36772 this.scrollParent = this.placeholder.scrollParent(); 36773 36774 //Update overflowOffset 36775 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 36776 this.scrollParent[ 0 ].tagName !== "HTML" ) { 36777 this.overflowOffset = this.scrollParent.offset(); 36778 } 36779 36780 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 36781 this.containers[ innermostIndex ].containerCache.over = 1; 36782 } 36783 36784 }, 36785 36786 _createHelper: function( event ) { 36787 36788 var o = this.options, 36789 helper = typeof o.helper === "function" ? 36790 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 36791 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 36792 36793 //Add the helper to the DOM if that didn't happen already 36794 if ( !helper.parents( "body" ).length ) { 36795 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 36796 } 36797 36798 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 36799 this._storedCSS = { 36800 width: this.currentItem[ 0 ].style.width, 36801 height: this.currentItem[ 0 ].style.height, 36802 position: this.currentItem.css( "position" ), 36803 top: this.currentItem.css( "top" ), 36804 left: this.currentItem.css( "left" ) 36805 }; 36806 } 36807 36808 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 36809 helper.width( this.currentItem.width() ); 36810 } 36811 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 36812 helper.height( this.currentItem.height() ); 36813 } 36814 36815 return helper; 36816 36817 }, 36818 36819 _adjustOffsetFromHelper: function( obj ) { 36820 if ( typeof obj === "string" ) { 36821 obj = obj.split( " " ); 36822 } 36823 if ( Array.isArray( obj ) ) { 36824 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 36825 } 36826 if ( "left" in obj ) { 36827 this.offset.click.left = obj.left + this.margins.left; 36828 } 36829 if ( "right" in obj ) { 36830 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 36831 } 36832 if ( "top" in obj ) { 36833 this.offset.click.top = obj.top + this.margins.top; 36834 } 36835 if ( "bottom" in obj ) { 36836 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 36837 } 36838 }, 36839 36840 _getParentOffset: function() { 36841 36842 //Get the offsetParent and cache its position 36843 this.offsetParent = this.helper.offsetParent(); 36844 var po = this.offsetParent.offset(); 36845 36846 // This is a special case where we need to modify a offset calculated on start, since the 36847 // following happened: 36848 // 1. The position of the helper is absolute, so it's position is calculated based on the 36849 // next positioned parent 36850 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 36851 // the document, which means that the scroll is included in the initial calculation of the 36852 // offset of the parent, and never recalculated upon drag 36853 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 36854 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 36855 po.left += this.scrollParent.scrollLeft(); 36856 po.top += this.scrollParent.scrollTop(); 36857 } 36858 36859 // This needs to be actually done for all browsers, since pageX/pageY includes this 36860 // information with an ugly IE fix 36861 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body || 36862 ( this.offsetParent[ 0 ].tagName && 36863 this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) { 36864 po = { top: 0, left: 0 }; 36865 } 36866 36867 return { 36868 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 36869 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 36870 }; 36871 36872 }, 36873 36874 _getRelativeOffset: function() { 36875 36876 if ( this.cssPosition === "relative" ) { 36877 var p = this.currentItem.position(); 36878 return { 36879 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 36880 this.scrollParent.scrollTop(), 36881 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 36882 this.scrollParent.scrollLeft() 36883 }; 36884 } else { 36885 return { top: 0, left: 0 }; 36886 } 36887 36888 }, 36889 36890 _cacheMargins: function() { 36891 this.margins = { 36892 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 36893 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 36894 }; 36895 }, 36896 36897 _cacheHelperProportions: function() { 36898 this.helperProportions = { 36899 width: this.helper.outerWidth(), 36900 height: this.helper.outerHeight() 36901 }; 36902 }, 36903 36904 _setContainment: function() { 36905 36906 var ce, co, over, 36907 o = this.options; 36908 if ( o.containment === "parent" ) { 36909 o.containment = this.helper[ 0 ].parentNode; 36910 } 36911 if ( o.containment === "document" || o.containment === "window" ) { 36912 this.containment = [ 36913 0 - this.offset.relative.left - this.offset.parent.left, 36914 0 - this.offset.relative.top - this.offset.parent.top, 36915 o.containment === "document" ? 36916 this.document.width() : 36917 this.window.width() - this.helperProportions.width - this.margins.left, 36918 ( o.containment === "document" ? 36919 ( this.document.height() || document.body.parentNode.scrollHeight ) : 36920 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 36921 ) - this.helperProportions.height - this.margins.top 36922 ]; 36923 } 36924 36925 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 36926 ce = $( o.containment )[ 0 ]; 36927 co = $( o.containment ).offset(); 36928 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 36929 36930 this.containment = [ 36931 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 36932 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 36933 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 36934 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 36935 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth )
vendor: 1,747 bytes, lines 36935-36987
36935: ce.offsetWidth ) - 36936 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 36937 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 36938 this.helperProportions.width - this.margins.left, 36939 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 36940 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 36941 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 36942 this.helperProportions.height - this.margins.top 36943 ]; 36944 } 36945 36946 }, 36947 36948 _convertPositionTo: function( d, pos ) { 36949 36950 if ( !pos ) { 36951 pos = this.position; 36952 } 36953 var mod = d === "absolute" ? 1 : -1, 36954 scroll = this.cssPosition === "absolute" && 36955 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 36956 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 36957 this.offsetParent : 36958 this.scrollParent, 36959 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 36960 36961 return { 36962 top: ( 36963 36964 // The absolute mouse position 36965 pos.top + 36966 36967 // Only for relative positioned nodes: Relative offset from element to offset parent 36968 this.offset.relative.top * mod + 36969 36970 // The offsetParent's offset without borders (offset + border) 36971 this.offset.parent.top * mod - 36972 ( ( this.cssPosition === "fixed" ? 36973 -this.scrollParent.scrollTop() : 36974 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 36975 ), 36976 left: ( 36977 36978 // The absolute mouse position 36979 pos.left + 36980 36981 // Only for relative positioned nodes: Relative offset from element to offset parent 36982 this.offset.relative.left * mod + 36983 36984 // The offsetParent's offset without borders (offset + border) 36985 this.offset.parent.left * mod - 36986 ( ( this.cssPosition === "fixed" ? 36987 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,632 bytes, lines 36988-37131
36988 scroll.scrollLeft() ) * mod ) 36989 ) 36990 }; 36991 36992 }, 36993 36994 _generatePosition: function( event ) { 36995 36996 var top, left, 36997 o = this.options, 36998 pageX = event.pageX, 36999 pageY = event.pageY, 37000 scroll = this.cssPosition === "absolute" && 37001 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 37002 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 37003 this.offsetParent : 37004 this.scrollParent, 37005 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 37006 37007 // This is another very weird special case that only happens for relative elements: 37008 // 1. If the css position is relative 37009 // 2. and the scroll parent is the document or similar to the offset parent 37010 // we have to refresh the relative offset during the scroll so there are no jumps 37011 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 37012 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 37013 this.offset.relative = this._getRelativeOffset(); 37014 } 37015 37016 /* 37017 * - Position constraining - 37018 * Constrain the position to a mix of grid, containment. 37019 */ 37020 37021 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 37022 37023 if ( this.containment ) { 37024 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 37025 pageX = this.containment[ 0 ] + this.offset.click.left; 37026 } 37027 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 37028 pageY = this.containment[ 1 ] + this.offset.click.top; 37029 } 37030 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 37031 pageX = this.containment[ 2 ] + this.offset.click.left; 37032 } 37033 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 37034 pageY = this.containment[ 3 ] + this.offset.click.top; 37035 } 37036 } 37037 37038 if ( o.grid ) { 37039 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 37040 o.grid[ 1 ] ) * o.grid[ 1 ]; 37041 pageY = this.containment ? 37042 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 37043 top - this.offset.click.top <= this.containment[ 3 ] ) ? 37044 top : 37045 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 37046 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 37047 top; 37048 37049 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 37050 o.grid[ 0 ] ) * o.grid[ 0 ]; 37051 pageX = this.containment ? 37052 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 37053 left - this.offset.click.left <= this.containment[ 2 ] ) ? 37054 left : 37055 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 37056 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 37057 left; 37058 } 37059 37060 } 37061 37062 return { 37063 top: ( 37064 37065 // The absolute mouse position 37066 pageY - 37067 37068 // Click offset (relative to the element) 37069 this.offset.click.top - 37070 37071 // Only for relative positioned nodes: Relative offset from element to offset parent 37072 this.offset.relative.top - 37073 37074 // The offsetParent's offset without borders (offset + border) 37075 this.offset.parent.top + 37076 ( ( this.cssPosition === "fixed" ? 37077 -this.scrollParent.scrollTop() : 37078 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 37079 ), 37080 left: ( 37081 37082 // The absolute mouse position 37083 pageX - 37084 37085 // Click offset (relative to the element) 37086 this.offset.click.left - 37087 37088 // Only for relative positioned nodes: Relative offset from element to offset parent 37089 this.offset.relative.left - 37090 37091 // The offsetParent's offset without borders (offset + border) 37092 this.offset.parent.left + 37093 ( ( this.cssPosition === "fixed" ? 37094 -this.scrollParent.scrollLeft() : 37095 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 37096 ) 37097 }; 37098 37099 }, 37100 37101 _rearrange: function( event, i, a, hardRefresh ) { 37102 37103 if ( a ) { 37104 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 37105 } else { 37106 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 37107 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 37108 } 37109 37110 //Various things done here to improve the performance: 37111 // 1. we create a setTimeout, that calls refreshPositions 37112 // 2. on the instance, we have a counter variable, that get's higher after every append 37113 // 3. on the local scope, we copy the counter variable, and check in the timeout, 37114 // if it's still the same 37115 // 4. this lets only the last addition to the timeout stack through 37116 this.counter = this.counter ? ++this.counter : 1; 37117 var counter = this.counter; 37118 37119 this._delay( function() { 37120 if ( counter === this.counter ) { 37121 37122 //Precompute after each DOM insertion, NOT on mousemove 37123 this.refreshPositions( !hardRefresh ); 37124 } 37125 } ); 37126 37127 }, 37128 37129 _clear: function( event, noPropagation ) { 37130 37131 this.reverting = false;
vendor: 4,252 bytes, lines 37132-37273
37132 37133 // We delay all events that have to be triggered to after the point where the placeholder 37134 // has been removed and everything else normalized again 37135 var i, 37136 delayedTriggers = []; 37137 37138 // We first have to update the dom position of the actual currentItem 37139 // Note: don't do it if the current item is already removed (by a user), or it gets 37140 // reappended (see #4088) 37141 if ( !this._noFinalSort && this.currentItem.parent().length ) { 37142 this.placeholder.before( this.currentItem ); 37143 } 37144 this._noFinalSort = null; 37145 37146 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 37147 for ( i in this._storedCSS ) { 37148 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 37149 this._storedCSS[ i ] = ""; 37150 } 37151 } 37152 this.currentItem.css( this._storedCSS ); 37153 this._removeClass( this.currentItem, "ui-sortable-helper" ); 37154 } else { 37155 this.currentItem.show(); 37156 } 37157 37158 if ( this.fromOutside && !noPropagation ) { 37159 delayedTriggers.push( function( event ) { 37160 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 37161 } ); 37162 } 37163 if ( ( this.fromOutside || 37164 this.domPosition.prev !== 37165 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 37166 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 37167 37168 // Trigger update callback if the DOM position has changed 37169 delayedTriggers.push( function( event ) { 37170 this._trigger( "update", event, this._uiHash() ); 37171 } ); 37172 } 37173 37174 // Check if the items Container has Changed and trigger appropriate 37175 // events. 37176 if ( this !== this.currentContainer ) { 37177 if ( !noPropagation ) { 37178 delayedTriggers.push( function( event ) { 37179 this._trigger( "remove", event, this._uiHash() ); 37180 } ); 37181 delayedTriggers.push( ( function( c ) { 37182 return function( event ) { 37183 c._trigger( "receive", event, this._uiHash( this ) ); 37184 }; 37185 } ).call( this, this.currentContainer ) ); 37186 delayedTriggers.push( ( function( c ) { 37187 return function( event ) { 37188 c._trigger( "update", event, this._uiHash( this ) ); 37189 }; 37190 } ).call( this, this.currentContainer ) ); 37191 } 37192 } 37193 37194 //Post events to containers 37195 function delayEvent( type, instance, container ) { 37196 return function( event ) { 37197 container._trigger( type, event, instance._uiHash( instance ) ); 37198 }; 37199 } 37200 for ( i = this.containers.length - 1; i >= 0; i-- ) { 37201 if ( !noPropagation ) { 37202 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 37203 } 37204 if ( this.containers[ i ].containerCache.over ) { 37205 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 37206 this.containers[ i ].containerCache.over = 0; 37207 } 37208 } 37209 37210 //Do what was originally in plugins 37211 if ( this.storedCursor ) { 37212 this.document.find( "body" ).css( "cursor", this.storedCursor ); 37213 this.storedStylesheet.remove(); 37214 } 37215 if ( this._storedOpacity ) { 37216 this.helper.css( "opacity", this._storedOpacity ); 37217 } 37218 if ( this._storedZIndex ) { 37219 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 37220 } 37221 37222 this.dragging = false; 37223 37224 if ( !noPropagation ) { 37225 this._trigger( "beforeStop", event, this._uiHash() ); 37226 } 37227 37228 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 37229 // it unbinds ALL events from the original node! 37230 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 37231 37232 if ( !this.cancelHelperRemoval ) { 37233 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 37234 this.helper.remove(); 37235 } 37236 this.helper = null; 37237 } 37238 37239 if ( !noPropagation ) { 37240 for ( i = 0; i < delayedTriggers.length; i++ ) { 37241 37242 // Trigger all delayed events 37243 delayedTriggers[ i ].call( this, event ); 37244 } 37245 this._trigger( "stop", event, this._uiHash() ); 37246 } 37247 37248 this.fromOutside = false; 37249 return !this.cancelHelperRemoval; 37250 37251 }, 37252 37253 _trigger: function() { 37254 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 37255 this.cancel(); 37256 } 37257 }, 37258 37259 _uiHash: function( _inst ) { 37260 var inst = _inst || this; 37261 return { 37262 helper: inst.helper, 37263 placeholder: inst.placeholder || $( [] ), 37264 position: inst.position, 37265 originalPosition: inst.originalPosition, 37266 offset: inst.positionAbs, 37267 item: inst.currentItem, 37268 sender: _inst ? _inst.element : null 37269 }; 37270 } 37271 37272} ); 37273
vendor: 13,111 bytes, lines 37274-37787
37274} ); 37275 37276 37277 37278 37279 37280 37281/*! 37282 * jQuery UI Tabs 1.13.3 37283 * https://jqueryui.com 37284 * 37285 * Copyright OpenJS Foundation and other contributors 37286 * Released under the MIT license. 37287 * https://jquery.org/license 37288 */ 37289 37290//>>label: Tabs 37291//>>group: Widgets 37292//>>description: Transforms a set of container elements into a tab structure. 37293//>>docs: https://api.jqueryui.com/tabs/ 37294//>>demos: https://jqueryui.com/tabs/ 37295//>>css.structure: ../../themes/base/core.css 37296//>>css.structure: ../../themes/base/tabs.css 37297//>>css.theme: ../../themes/base/theme.css 37298 37299( function( factory ) { 37300 "use strict"; 37301 37302 if ( typeof define === "function" && define.amd ) { 37303 37304 // AMD. Register as an anonymous module. 37305 define( [ 37306 "jquery", 37307 "../keycode", 37308 "../safe-active-element", 37309 "../unique-id", 37310 "../version", 37311 "../widget" 37312 ], factory ); 37313 } else { 37314 37315 // Browser globals 37316 factory( jQuery ); 37317 } 37318} )( function( $ ) { 37319"use strict"; 37320 37321$.widget( "ui.tabs", { 37322 version: "1.13.3", 37323 delay: 300, 37324 options: { 37325 active: null, 37326 classes: { 37327 "ui-tabs": "ui-corner-all", 37328 "ui-tabs-nav": "ui-corner-all", 37329 "ui-tabs-panel": "ui-corner-bottom", 37330 "ui-tabs-tab": "ui-corner-top" 37331 }, 37332 collapsible: false, 37333 event: "click", 37334 heightStyle: "content", 37335 hide: null, 37336 show: null, 37337 37338 // Callbacks 37339 activate: null, 37340 beforeActivate: null, 37341 beforeLoad: null, 37342 load: null 37343 }, 37344 37345 _isLocal: ( function() { 37346 var rhash = /#.*$/; 37347 37348 return function( anchor ) { 37349 var anchorUrl, locationUrl; 37350 37351 anchorUrl = anchor.href.replace( rhash, "" ); 37352 locationUrl = location.href.replace( rhash, "" ); 37353 37354 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 37355 try { 37356 anchorUrl = decodeURIComponent( anchorUrl ); 37357 } catch ( error ) {} 37358 try { 37359 locationUrl = decodeURIComponent( locationUrl ); 37360 } catch ( error ) {} 37361 37362 return anchor.hash.length > 1 && anchorUrl === locationUrl; 37363 }; 37364 } )(), 37365 37366 _create: function() { 37367 var that = this, 37368 options = this.options; 37369 37370 this.running = false; 37371 37372 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 37373 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 37374 37375 this._processTabs(); 37376 options.active = this._initialActive(); 37377 37378 // Take disabling tabs via class attribute from HTML 37379 // into account and update option properly. 37380 if ( Array.isArray( options.disabled ) ) { 37381 options.disabled = $.uniqueSort( options.disabled.concat( 37382 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 37383 return that.tabs.index( li ); 37384 } ) 37385 ) ).sort(); 37386 } 37387 37388 // Check for length avoids error when initializing empty list 37389 if ( this.options.active !== false && this.anchors.length ) { 37390 this.active = this._findActive( options.active ); 37391 } else { 37392 this.active = $(); 37393 } 37394 37395 this._refresh(); 37396 37397 if ( this.active.length ) { 37398 this.load( options.active ); 37399 } 37400 }, 37401 37402 _initialActive: function() { 37403 var active = this.options.active, 37404 collapsible = this.options.collapsible, 37405 locationHash = location.hash.substring( 1 ); 37406 37407 if ( active === null ) { 37408 37409 // check the fragment identifier in the URL 37410 if ( locationHash ) { 37411 this.tabs.each( function( i, tab ) { 37412 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 37413 active = i; 37414 return false; 37415 } 37416 } ); 37417 } 37418 37419 // Check for a tab marked active via a class 37420 if ( active === null ) { 37421 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 37422 } 37423 37424 // No active tab, set to false 37425 if ( active === null || active === -1 ) { 37426 active = this.tabs.length ? 0 : false; 37427 } 37428 } 37429 37430 // Handle numbers: negative, out of range 37431 if ( active !== false ) { 37432 active = this.tabs.index( this.tabs.eq( active ) ); 37433 if ( active === -1 ) { 37434 active = collapsible ? false : 0; 37435 } 37436 } 37437 37438 // Don't allow collapsible: false and active: false 37439 if ( !collapsible && active === false && this.anchors.length ) { 37440 active = 0; 37441 } 37442 37443 return active; 37444 }, 37445 37446 _getCreateEventData: function() { 37447 return { 37448 tab: this.active, 37449 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 37450 }; 37451 }, 37452 37453 _tabKeydown: function( event ) { 37454 var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ), 37455 selectedIndex = this.tabs.index( focusedTab ), 37456 goingForward = true; 37457 37458 if ( this._handlePageNav( event ) ) { 37459 return; 37460 } 37461 37462 switch ( event.keyCode ) { 37463 case $.ui.keyCode.RIGHT: 37464 case $.ui.keyCode.DOWN: 37465 selectedIndex++; 37466 break; 37467 case $.ui.keyCode.UP: 37468 case $.ui.keyCode.LEFT: 37469 goingForward = false; 37470 selectedIndex--; 37471 break; 37472 case $.ui.keyCode.END: 37473 selectedIndex = this.anchors.length - 1; 37474 break; 37475 case $.ui.keyCode.HOME: 37476 selectedIndex = 0; 37477 break; 37478 case $.ui.keyCode.SPACE: 37479 37480 // Activate only, no collapsing 37481 event.preventDefault(); 37482 clearTimeout( this.activating ); 37483 this._activate( selectedIndex ); 37484 return; 37485 case $.ui.keyCode.ENTER: 37486 37487 // Toggle (cancel delayed activation, allow collapsing) 37488 event.preventDefault(); 37489 clearTimeout( this.activating ); 37490 37491 // Determine if we should collapse or activate 37492 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 37493 return; 37494 default: 37495 return; 37496 } 37497 37498 // Focus the appropriate tab, based on which key was pressed 37499 event.preventDefault(); 37500 clearTimeout( this.activating ); 37501 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 37502 37503 // Navigating with control/command key will prevent automatic activation 37504 if ( !event.ctrlKey && !event.metaKey ) { 37505 37506 // Update aria-selected immediately so that AT think the tab is already selected. 37507 // Otherwise AT may confuse the user by stating that they need to activate the tab, 37508 // but the tab will already be activated by the time the announcement finishes. 37509 focusedTab.attr( "aria-selected", "false" ); 37510 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 37511 37512 this.activating = this._delay( function() { 37513 this.option( "active", selectedIndex ); 37514 }, this.delay ); 37515 } 37516 }, 37517 37518 _panelKeydown: function( event ) { 37519 if ( this._handlePageNav( event ) ) { 37520 return; 37521 } 37522 37523 // Ctrl+up moves focus to the current tab 37524 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 37525 event.preventDefault(); 37526 this.active.trigger( "focus" ); 37527 } 37528 }, 37529 37530 // Alt+page up/down moves focus to the previous/next tab (and activates) 37531 _handlePageNav: function( event ) { 37532 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 37533 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 37534 return true; 37535 } 37536 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 37537 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 37538 return true; 37539 } 37540 }, 37541 37542 _findNextTab: function( index, goingForward ) { 37543 var lastTabIndex = this.tabs.length - 1; 37544 37545 function constrain() { 37546 if ( index > lastTabIndex ) { 37547 index = 0; 37548 } 37549 if ( index < 0 ) { 37550 index = lastTabIndex; 37551 } 37552 return index; 37553 } 37554 37555 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 37556 index = goingForward ? index + 1 : index - 1; 37557 } 37558 37559 return index; 37560 }, 37561 37562 _focusNextTab: function( index, goingForward ) { 37563 index = this._findNextTab( index, goingForward ); 37564 this.tabs.eq( index ).trigger( "focus" ); 37565 return index; 37566 }, 37567 37568 _setOption: function( key, value ) { 37569 if ( key === "active" ) { 37570 37571 // _activate() will handle invalid values and update this.options 37572 this._activate( value ); 37573 return; 37574 } 37575 37576 this._super( key, value ); 37577 37578 if ( key === "collapsible" ) { 37579 this._toggleClass( "ui-tabs-collapsible", null, value ); 37580 37581 // Setting collapsible: false while collapsed; open first panel 37582 if ( !value && this.options.active === false ) { 37583 this._activate( 0 ); 37584 } 37585 } 37586 37587 if ( key === "event" ) { 37588 this._setupEvents( value ); 37589 } 37590 37591 if ( key === "heightStyle" ) { 37592 this._setupHeightStyle( value ); 37593 } 37594 }, 37595 37596 _sanitizeSelector: function( hash ) { 37597 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 37598 }, 37599 37600 refresh: function() { 37601 var options = this.options, 37602 lis = this.tablist.children( ":has(a[href])" ); 37603 37604 // Get disabled tabs from class attribute from HTML 37605 // this will get converted to a boolean if needed in _refresh() 37606 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 37607 return lis.index( tab ); 37608 } ); 37609 37610 this._processTabs(); 37611 37612 // Was collapsed or no tabs 37613 if ( options.active === false || !this.anchors.length ) { 37614 options.active = false; 37615 this.active = $(); 37616 37617 // was active, but active tab is gone 37618 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 37619 37620 // all remaining tabs are disabled 37621 if ( this.tabs.length === options.disabled.length ) { 37622 options.active = false; 37623 this.active = $(); 37624 37625 // activate previous tab 37626 } else { 37627 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 37628 } 37629 37630 // was active, active tab still exists 37631 } else { 37632 37633 // make sure active index is correct 37634 options.active = this.tabs.index( this.active ); 37635 } 37636 37637 this._refresh(); 37638 }, 37639 37640 _refresh: function() { 37641 this._setOptionDisabled( this.options.disabled ); 37642 this._setupEvents( this.options.event ); 37643 this._setupHeightStyle( this.options.heightStyle ); 37644 37645 this.tabs.not( this.active ).attr( { 37646 "aria-selected": "false", 37647 "aria-expanded": "false", 37648 tabIndex: -1 37649 } ); 37650 this.panels.not( this._getPanelForTab( this.active ) ) 37651 .hide() 37652 .attr( { 37653 "aria-hidden": "true" 37654 } ); 37655 37656 // Make sure one tab is in the tab order 37657 if ( !this.active.length ) { 37658 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 37659 } else { 37660 this.active 37661 .attr( { 37662 "aria-selected": "true", 37663 "aria-expanded": "true", 37664 tabIndex: 0 37665 } ); 37666 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 37667 this._getPanelForTab( this.active ) 37668 .show() 37669 .attr( { 37670 "aria-hidden": "false" 37671 } ); 37672 } 37673 }, 37674 37675 _processTabs: function() { 37676 var that = this, 37677 prevTabs = this.tabs, 37678 prevAnchors = this.anchors, 37679 prevPanels = this.panels; 37680 37681 this.tablist = this._getList().attr( "role", "tablist" ); 37682 this._addClass( this.tablist, "ui-tabs-nav", 37683 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 37684 37685 // Prevent users from focusing disabled tabs via click 37686 this.tablist 37687 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 37688 if ( $( this ).is( ".ui-state-disabled" ) ) { 37689 event.preventDefault(); 37690 } 37691 } ) 37692 37693 // Support: IE <9 37694 // Preventing the default action in mousedown doesn't prevent IE 37695 // from focusing the element, so if the anchor gets focused, blur. 37696 // We don't have to worry about focusing the previously focused 37697 // element since clicking on a non-focusable element should focus 37698 // the body anyway. 37699 .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() { 37700 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 37701 this.blur(); 37702 } 37703 } ); 37704 37705 this.tabs = this.tablist.find( "> li:has(a[href])" ) 37706 .attr( { 37707 role: "tab", 37708 tabIndex: -1 37709 } ); 37710 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 37711 37712 this.anchors = this.tabs.map( function() { 37713 return $( "a", this )[ 0 ]; 37714 } ) 37715 .attr( { 37716 tabIndex: -1 37717 } ); 37718 this._addClass( this.anchors, "ui-tabs-anchor" ); 37719 37720 this.panels = $(); 37721 37722 this.anchors.each( function( i, anchor ) { 37723 var selector, panel, panelId, 37724 anchorId = $( anchor ).uniqueId().attr( "id" ), 37725 tab = $( anchor ).closest( "li" ), 37726 originalAriaControls = tab.attr( "aria-controls" ); 37727 37728 // Inline tab 37729 if ( that._isLocal( anchor ) ) { 37730 selector = anchor.hash; 37731 panelId = selector.substring( 1 ); 37732 panel = that.element.find( that._sanitizeSelector( selector ) ); 37733 37734 // remote tab 37735 } else { 37736 37737 // If the tab doesn't already have aria-controls, 37738 // generate an id by using a throw-away element 37739 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 37740 selector = "#" + panelId; 37741 panel = that.element.find( selector ); 37742 if ( !panel.length ) { 37743 panel = that._createPanel( panelId ); 37744 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 37745 } 37746 panel.attr( "aria-live", "polite" ); 37747 } 37748 37749 if ( panel.length ) { 37750 that.panels = that.panels.add( panel ); 37751 } 37752 if ( originalAriaControls ) { 37753 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 37754 } 37755 tab.attr( { 37756 "aria-controls": panelId, 37757 "aria-labelledby": anchorId 37758 } ); 37759 panel.attr( "aria-labelledby", anchorId ); 37760 } ); 37761 37762 this.panels.attr( "role", "tabpanel" ); 37763 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 37764 37765 // Avoid memory leaks (#10056) 37766 if ( prevTabs ) { 37767 this._off( prevTabs.not( this.tabs ) ); 37768 this._off( prevAnchors.not( this.anchors ) ); 37769 this._off( prevPanels.not( this.panels ) ); 37770 } 37771 }, 37772 37773 // Allow overriding how to find the list for rare usage scenarios (#7715) 37774 _getList: function() { 37775 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 37776 }, 37777 37778 _createPanel: function( id ) { 37779 return $( "<div>" ) 37780 .attr( "id", id ) 37781 .data( "ui-tabs-destroy", true ); 37782 }, 37783 37784 _setOptionDisabled: function( disabled ) { 37785 var currentItem, li, i; 37786 37787 if ( Array
vendor: 4,862 bytes, lines 37787-37967
37787.isArray( disabled ) ) { 37788 if ( !disabled.length ) { 37789 disabled = false; 37790 } else if ( disabled.length === this.anchors.length ) { 37791 disabled = true; 37792 } 37793 } 37794 37795 // Disable tabs 37796 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 37797 currentItem = $( li ); 37798 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 37799 currentItem.attr( "aria-disabled", "true" ); 37800 this._addClass( currentItem, null, "ui-state-disabled" ); 37801 } else { 37802 currentItem.removeAttr( "aria-disabled" ); 37803 this._removeClass( currentItem, null, "ui-state-disabled" ); 37804 } 37805 } 37806 37807 this.options.disabled = disabled; 37808 37809 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 37810 disabled === true ); 37811 }, 37812 37813 _setupEvents: function( event ) { 37814 var events = {}; 37815 if ( event ) { 37816 $.each( event.split( " " ), function( index, eventName ) { 37817 events[ eventName ] = "_eventHandler"; 37818 } ); 37819 } 37820 37821 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 37822 37823 // Always prevent the default action, even when disabled 37824 this._on( true, this.anchors, { 37825 click: function( event ) { 37826 event.preventDefault(); 37827 } 37828 } ); 37829 this._on( this.anchors, events ); 37830 this._on( this.tabs, { keydown: "_tabKeydown" } ); 37831 this._on( this.panels, { keydown: "_panelKeydown" } ); 37832 37833 this._focusable( this.tabs ); 37834 this._hoverable( this.tabs ); 37835 }, 37836 37837 _setupHeightStyle: function( heightStyle ) { 37838 var maxHeight, 37839 parent = this.element.parent(); 37840 37841 if ( heightStyle === "fill" ) { 37842 maxHeight = parent.height(); 37843 maxHeight -= this.element.outerHeight() - this.element.height(); 37844 37845 this.element.siblings( ":visible" ).each( function() { 37846 var elem = $( this ), 37847 position = elem.css( "position" ); 37848 37849 if ( position === "absolute" || position === "fixed" ) { 37850 return; 37851 } 37852 maxHeight -= elem.outerHeight( true ); 37853 } ); 37854 37855 this.element.children().not( this.panels ).each( function() { 37856 maxHeight -= $( this ).outerHeight( true ); 37857 } ); 37858 37859 this.panels.each( function() { 37860 $( this ).height( Math.max( 0, maxHeight - 37861 $( this ).innerHeight() + $( this ).height() ) ); 37862 } ) 37863 .css( "overflow", "auto" ); 37864 } else if ( heightStyle === "auto" ) { 37865 maxHeight = 0; 37866 this.panels.each( function() { 37867 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 37868 } ).height( maxHeight ); 37869 } 37870 }, 37871 37872 _eventHandler: function( event ) { 37873 var options = this.options, 37874 active = this.active, 37875 anchor = $( event.currentTarget ), 37876 tab = anchor.closest( "li" ), 37877 clickedIsActive = tab[ 0 ] === active[ 0 ], 37878 collapsing = clickedIsActive && options.collapsible, 37879 toShow = collapsing ? $() : this._getPanelForTab( tab ), 37880 toHide = !active.length ? $() : this._getPanelForTab( active ), 37881 eventData = { 37882 oldTab: active, 37883 oldPanel: toHide, 37884 newTab: collapsing ? $() : tab, 37885 newPanel: toShow 37886 }; 37887 37888 event.preventDefault(); 37889 37890 if ( tab.hasClass( "ui-state-disabled" ) || 37891 37892 // tab is already loading 37893 tab.hasClass( "ui-tabs-loading" ) || 37894 37895 // can't switch durning an animation 37896 this.running || 37897 37898 // click on active header, but not collapsible 37899 ( clickedIsActive && !options.collapsible ) || 37900 37901 // allow canceling activation 37902 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 37903 return; 37904 } 37905 37906 options.active = collapsing ? false : this.tabs.index( tab ); 37907 37908 this.active = clickedIsActive ? $() : tab; 37909 if ( this.xhr ) { 37910 this.xhr.abort(); 37911 } 37912 37913 if ( !toHide.length && !toShow.length ) { 37914 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 37915 } 37916 37917 if ( toShow.length ) { 37918 this.load( this.tabs.index( tab ), event ); 37919 } 37920 this._toggle( event, eventData ); 37921 }, 37922 37923 // Handles show/hide for selecting tabs 37924 _toggle: function( event, eventData ) { 37925 var that = this, 37926 toShow = eventData.newPanel, 37927 toHide = eventData.oldPanel; 37928 37929 this.running = true; 37930 37931 function complete() { 37932 that.running = false; 37933 that._trigger( "activate", event, eventData ); 37934 } 37935 37936 function show() { 37937 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 37938 37939 if ( toShow.length && that.options.show ) { 37940 that._show( toShow, that.options.show, complete ); 37941 } else { 37942 toShow.show(); 37943 complete(); 37944 } 37945 } 37946 37947 // Start out by hiding, then showing, then completing 37948 if ( toHide.length && this.options.hide ) { 37949 this._hide( toHide, this.options.hide, function() { 37950 that._removeClass( eventData.oldTab.closest( "li" ), 37951 "ui-tabs-active", "ui-state-active" ); 37952 show(); 37953 } ); 37954 } else { 37955 this._removeClass( eventData.oldTab.closest( "li" ), 37956 "ui-tabs-active", "ui-state-active" ); 37957 toHide.hide(); 37958 show(); 37959 } 37960 37961 toHide.attr( "aria-hidden", "true" ); 37962 eventData.oldTab.attr( { 37963 "aria-selected": "false", 37964 "aria-expanded": "false" 37965 } ); 37966 37967 // If we're switching tabs, remove the old tab from the tab order.
vendor: 5,678 bytes, lines 37968-38202
37968 // If we're opening from collapsed state, remove the previous tab from the tab order. 37969 // If we're collapsing, then keep the collapsing tab in the tab order. 37970 if ( toShow.length && toHide.length ) { 37971 eventData.oldTab.attr( "tabIndex", -1 ); 37972 } else if ( toShow.length ) { 37973 this.tabs.filter( function() { 37974 return $( this ).attr( "tabIndex" ) === 0; 37975 } ) 37976 .attr( "tabIndex", -1 ); 37977 } 37978 37979 toShow.attr( "aria-hidden", "false" ); 37980 eventData.newTab.attr( { 37981 "aria-selected": "true", 37982 "aria-expanded": "true", 37983 tabIndex: 0 37984 } ); 37985 }, 37986 37987 _activate: function( index ) { 37988 var anchor, 37989 active = this._findActive( index ); 37990 37991 // Trying to activate the already active panel 37992 if ( active[ 0 ] === this.active[ 0 ] ) { 37993 return; 37994 } 37995 37996 // Trying to collapse, simulate a click on the current active header 37997 if ( !active.length ) { 37998 active = this.active; 37999 } 38000 38001 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 38002 this._eventHandler( { 38003 target: anchor, 38004 currentTarget: anchor, 38005 preventDefault: $.noop 38006 } ); 38007 }, 38008 38009 _findActive: function( index ) { 38010 return index === false ? $() : this.tabs.eq( index ); 38011 }, 38012 38013 _getIndex: function( index ) { 38014 38015 // meta-function to give users option to provide a href string instead of a numerical index. 38016 if ( typeof index === "string" ) { 38017 index = this.anchors.index( this.anchors.filter( "[href$='" + 38018 $.escapeSelector( index ) + "']" ) ); 38019 } 38020 38021 return index; 38022 }, 38023 38024 _destroy: function() { 38025 if ( this.xhr ) { 38026 this.xhr.abort(); 38027 } 38028 38029 this.tablist 38030 .removeAttr( "role" ) 38031 .off( this.eventNamespace ); 38032 38033 this.anchors 38034 .removeAttr( "role tabIndex" ) 38035 .removeUniqueId(); 38036 38037 this.tabs.add( this.panels ).each( function() { 38038 if ( $.data( this, "ui-tabs-destroy" ) ) { 38039 $( this ).remove(); 38040 } else { 38041 $( this ).removeAttr( "role tabIndex " + 38042 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 38043 } 38044 } ); 38045 38046 this.tabs.each( function() { 38047 var li = $( this ), 38048 prev = li.data( "ui-tabs-aria-controls" ); 38049 if ( prev ) { 38050 li 38051 .attr( "aria-controls", prev ) 38052 .removeData( "ui-tabs-aria-controls" ); 38053 } else { 38054 li.removeAttr( "aria-controls" ); 38055 } 38056 } ); 38057 38058 this.panels.show(); 38059 38060 if ( this.options.heightStyle !== "content" ) { 38061 this.panels.css( "height", "" ); 38062 } 38063 }, 38064 38065 enable: function( index ) { 38066 var disabled = this.options.disabled; 38067 if ( disabled === false ) { 38068 return; 38069 } 38070 38071 if ( index === undefined ) { 38072 disabled = false; 38073 } else { 38074 index = this._getIndex( index ); 38075 if ( Array.isArray( disabled ) ) { 38076 disabled = $.map( disabled, function( num ) { 38077 return num !== index ? num : null; 38078 } ); 38079 } else { 38080 disabled = $.map( this.tabs, function( li, num ) { 38081 return num !== index ? num : null; 38082 } ); 38083 } 38084 } 38085 this._setOptionDisabled( disabled ); 38086 }, 38087 38088 disable: function( index ) { 38089 var disabled = this.options.disabled; 38090 if ( disabled === true ) { 38091 return; 38092 } 38093 38094 if ( index === undefined ) { 38095 disabled = true; 38096 } else { 38097 index = this._getIndex( index ); 38098 if ( $.inArray( index, disabled ) !== -1 ) { 38099 return; 38100 } 38101 if ( Array.isArray( disabled ) ) { 38102 disabled = $.merge( [ index ], disabled ).sort(); 38103 } else { 38104 disabled = [ index ]; 38105 } 38106 } 38107 this._setOptionDisabled( disabled ); 38108 }, 38109 38110 load: function( index, event ) { 38111 index = this._getIndex( index ); 38112 var that = this, 38113 tab = this.tabs.eq( index ), 38114 anchor = tab.find( ".ui-tabs-anchor" ), 38115 panel = this._getPanelForTab( tab ), 38116 eventData = { 38117 tab: tab, 38118 panel: panel 38119 }, 38120 complete = function( jqXHR, status ) { 38121 if ( status === "abort" ) { 38122 that.panels.stop( false, true ); 38123 } 38124 38125 that._removeClass( tab, "ui-tabs-loading" ); 38126 panel.removeAttr( "aria-busy" ); 38127 38128 if ( jqXHR === that.xhr ) { 38129 delete that.xhr; 38130 } 38131 }; 38132 38133 // Not remote 38134 if ( this._isLocal( anchor[ 0 ] ) ) { 38135 return; 38136 } 38137 38138 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 38139 38140 // Support: jQuery <1.8 38141 // jQuery <1.8 returns false if the request is canceled in beforeSend, 38142 // but as of 1.8, $.ajax() always returns a jqXHR object. 38143 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 38144 this._addClass( tab, "ui-tabs-loading" ); 38145 panel.attr( "aria-busy", "true" ); 38146 38147 this.xhr 38148 .done( function( response, status, jqXHR ) { 38149 38150 // support: jQuery <1.8 38151 // https://bugs.jquery.com/ticket/11778 38152 setTimeout( function() { 38153 panel.html( response ); 38154 that._trigger( "load", event, eventData ); 38155 38156 complete( jqXHR, status ); 38157 }, 1 ); 38158 } ) 38159 .fail( function( jqXHR, status ) { 38160 38161 // support: jQuery <1.8 38162 // https://bugs.jquery.com/ticket/11778 38163 setTimeout( function() { 38164 complete( jqXHR, status ); 38165 }, 1 ); 38166 } ); 38167 } 38168 }, 38169 38170 _ajaxSettings: function( anchor, event, eventData ) { 38171 var that = this; 38172 return { 38173 38174 // Support: IE <11 only 38175 // Strip any hash that exists to prevent errors with the Ajax request 38176 url: anchor.attr( "href" ).replace( /#.*$/, "" ), 38177 beforeSend: function( jqXHR, settings ) { 38178 return that._trigger( "beforeLoad", event, 38179 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 38180 } 38181 }; 38182 }, 38183 38184 _getPanelForTab: function( tab ) { 38185 var id = $( tab ).attr( "aria-controls" ); 38186 return this.element.find( this._sanitizeSelector( "#" + id ) ); 38187 } 38188} ); 38189 38190// DEPRECATED 38191// TODO: Switch return back to widget declaration at top of file when this is removed 38192if ( $.uiBackCompat !== false ) { 38193 38194 // Backcompat for ui-tab class (now ui-tabs-tab) 38195 $.widget( "ui.tabs", $.ui.tabs, { 38196 _processTabs: function() { 38197 this._superApply( arguments ); 38198 this._addClass( this.tabs, "ui-tab" ); 38199 } 38200 } ); 38201} 38202
38203return $.ui.tabs; 38204 38205} ); 38206/** 38207 * Warning: This file is auto-generated, do not modify. Instead, make your changes in 'app/javascript/active_admin/' and run `yarn build` 38208 */ 38209 38210 38211 38212 38213 38214 38215 38216 38217 38218(function(global, factory) { 38219 typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("jquery"), require("jquery-ui/ui/widgets/datepicker"), require("jquery-ui/ui/widgets/dialog"), require("jquery-ui/ui/widgets/sortable"), require("jquery-ui/ui/widgets/tabs"), require("jquery-ui/ui/widget"), require("jquery-ujs")) : typeof define === "function" && define.amd ? define([ "exports", "jquery", "jquery-ui/ui/widgets/datepicker", "jquery-ui/ui/widgets/dialog", "jquery-ui/ui/widgets/sortable", "jquery-ui/ui/widgets/tabs", "jquery-ui/ui/widget", "jquery-ujs" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, 38220 factory(global.ActiveAdmin = {})); 38221})(this, function(exports) { 38222 "use strict"; 38223 $.fn.serializeObject = function() { 38224 return this.serializeArray().reduce(function(obj, item) { 38225 obj[item.name] = item.value; 38226 return obj; 38227 }, {}); 38228 }; 38229 $.ui.dialog.prototype._focusTabbable = function() { 38230 this.uiDialog.focus(); 38231 }; 38232 function ModalDialog(message, inputs, callback) { 38233 var html = '<form id="dialog_confirm" title="' + message + '"><ul>'; 38234 for (var name in inputs) { 38235 var opts, wrapper; 38236 var type = inputs[name]; 38237 if (/^(datepicker|checkbox|text|number)$/.test(type)) { 38238 wrapper = "input"; 38239 } else if (type === "textarea") { 38240 wrapper = "textarea"; 38241 } else if ($.isArray(type)) { 38242 var _ref = [ "select", type, "" ]; 38243 wrapper = _ref[0]; 38244 opts = _ref[1]; 38245 type = _ref[2]; 38246 } else { 38247 throw new Error("Unsupported input type: {" + name + ": " + type + "}"); 38248 } 38249 var klass = type === "datepicker" ? type : ""; 38250 html += "<li>\n <label>" + (name.charAt(0).toUpperCase() + name.slice(1)) + "</label>\n <" + wrapper + ' name="' + name + '" class="' + klass + '" type="' + type + '">' + (opts ? function() { 38251 var result = []; 38252 opts.forEach(function(v) { 38253 var $elem = $("<option></option>"); 38254 if ($.isArray(v)) { 38255 $elem.text(v[0]).val(v[1]); 38256 } else { 38257 $elem.text(v); 38258 } 38259 result.push($elem.wrap("<div></div>").parent().html()); 38260 }); 38261 return result; 38262 }().join("") : "") + ("</" + wrapper + ">") + "</li>"; 38263 var _ref2 = []; 38264 wrapper = _ref2[0]; 38265 opts = _ref2[1]; 38266 type = _ref2[2]; 38267 klass = _ref2[3]; 38268 } 38269 html += "</ul></form>"; 38270 var form = $(html).appendTo("body"); 38271 $("body").trigger("modal_dialog:before_open", [ form ]); 38272 form.dialog({ 38273 modal: true, 38274 open: function open(_event, _ui) { 38275 $("body").trigger("modal_dialog:after_open", [ form ]); 38276 }, 38277 dialogClass: "active_admin_dialog", 38278 buttons: { 38279 OK: function OK() { 38280 callback($(this).serializeObject()); 38281 $(this).dialog("close"); 38282 }, 38283 Cancel: function Cancel() { 38284 $(this).dialog("close").remove(); 38285 } 38286 } 38287 }); 38288 } 38289 var onDOMReady$2 = function onDOMReady() {
38290 $(".batch_actions_selector li a").off("click confirm:complete"); 38291 $(".batch_actions_selector li a").on("click", function(event) { 38292 var _this = this; 38293 var message; 38294 event.stopPropagation(); 38295 event.preventDefault(); 38296 if (message = $(this).data("confirm")) { 38297 ModalDialog(message, $(this).data("inputs"), function(inputs) { 38298 $(_this).trigger("confirm:complete", inputs); 38299 }); 38300 } else { 38301 $(this).trigger("confirm:complete"); 38302 } 38303 }); 38304 $(".batch_actions_selector li a").on("confirm:complete", function(event, inputs) { 38305 var val; 38306 if (val = JSON.stringify(inputs)) { 38307 $("#batch_action_inputs").removeAttr("disabled").val(val); 38308 } else { 38309 $("#batch_action_inputs").attr("disabled", "disabled"); 38310 } 38311 $("#batch_action").val($(this).data("action")); 38312 $("#collection_selection").submit(); 38313 }); 38314 if ($(".batch_actions_selector").length && $(":checkbox.toggle_all").length) { 38315 if ($(".paginated_collection table.index_table").length) { 38316 $(".paginated_collection table.index_table").tableCheckboxToggler(); 38317 } else { 38318 $(".paginated_collection").checkboxToggler(); 38319 } 38320 $(document).on("change", ".paginated_collection :checkbox", function() { 38321 if ($(".paginated_collection :checkbox:checked").length && $(".dropdown_menu_list").children().length) { 38322 $(".batch_actions_selector").each(function() { 38323 $(this).aaDropdownMenu("enable"); 38324 }); 38325 } else { 38326 $(".batch_actions_selector").each(function() { 38327 $(this).aaDropdownMenu("disable"); 38328 }); 38329 } 38330 }); 38331 } 38332 }; 38333 $(document).ready(onDOMReady$2).on("page:load turbolinks:load", onDOMReady$2); 38334 var CheckboxToggler = function() { 38335 function CheckboxToggler(options, container) { 38336 this.options = options; 38337 this.container = container; 38338 this._init(); 38339 this._bind(); 38340 } 38341 var _proto = CheckboxToggler.prototype; 38342 _proto.option = function option(_key, _value) {}; 38343 _proto._init = function _init() { 38344 if (!this.container) { 38345 throw new Error("Container element not found"); 38346 } else { 38347 this.$container = $(this.container); 38348 } 38349 if (!this.$container.find(".toggle_all").length) { 38350 throw new Error('"toggle all" checkbox not found'); 38351 } else { 38352 this.toggle_all_checkbox = this.$container.find(".toggle_all"); 38353 } 38354 this.checkboxes = this.$container.find(":checkbox").not(this.toggle_all_checkbox); 38355 }; 38356 _proto._bind = function _bind() { 38357 var _this = this; 38358 this.checkboxes.change(function(event) { 38359 return _this._didChangeCheckbox(event.target); 38360 }); 38361 this.toggle_all_checkbox.change(function() { 38362 return _this._didChangeToggleAllCheckbox(); 38363 }); 38364 }; 38365 _proto._didChangeCheckbox = function _didChangeCheckbox(_checkbox) { 38366 var numChecked = this.checkboxes.filter(":checked").length; 38367 var allChecked = numChecked === this.checkboxes.length; 38368 var someChecked = numChecked > 0 && numChecked < this.checkboxes.length; 38369 this.toggle_all_checkbox.prop({ 38370 checked: allChecked, 38371 indeterminate: someChecked 38372 }); 38373 }; 38374 _proto._didChangeToggleAllCheckbox = function _didChangeToggleAllCheckbox() { 38375 var setting = this.toggle_all_checkbox.prop("checked"); 38376 this.checkboxes.prop({ 38377 checked: setting 38378 }); 38379 return setting; 38380 }; 38381 return CheckboxToggler; 38382 }(); 38383 $.widget.bridge("checkboxToggler", CheckboxToggler); 38384 (function($) { 38385 $(document).on("focus", "input.datepicker:not(.hasDatepicker)", function() { 38386 var input = $(this); 38387 if (input[0].type === "date") { 38388 return; 38389 } 38390 var defaults = { 38391 dateFormat: "yy-mm-dd" 38392 }; 38393 var options = input.data("datepicker-options"); 38394 input.datepicker($.extend(defaults, options)); 38395 }); 38396 })(jQuery); 38397 var DropdownMenu = function() { 38398 function DropdownMenu(options, element) { 38399 this.options = options; 38400 this.element = element; 38401 this.$element = $(this.element); 38402 var defaults = { 38403 fadeInDuration: 20, 38404 fadeOutDuration: 100, 38405 onClickActionItemCallback: null 38406 }; 38407 this.options = $.extend(defaults, this.options); 38408 this.isOpen = false;
38409 this.$menuButton = this.$element.find(".dropdown_menu_button"); 38410 this.$menuList = this.$element.find(".dropdown_menu_list_wrapper"); 38411 this._buildMenuList(); 38412 this._bind(); 38413 } 38414 var _proto = DropdownMenu.prototype; 38415 _proto.open = function open() { 38416 this.isOpen = true; 38417 this.$menuList.fadeIn(this.options.fadeInDuration); 38418 this._position(); 38419 return this; 38420 }; 38421 _proto.close = function close() { 38422 this.isOpen = false; 38423 this.$menuList.fadeOut(this.options.fadeOutDuration); 38424 return this; 38425 }; 38426 _proto.destroy = function destroy() { 38427 this.$element = null; 38428 return this; 38429 }; 38430 _proto.isDisabled = function isDisabled() { 38431 return this.$menuButton.hasClass("disabled"); 38432 }; 38433 _proto.disable = function disable() { 38434 this.$menuButton.addClass("disabled"); 38435 }; 38436 _proto.enable = function enable() { 38437 this.$menuButton.removeClass("disabled"); 38438 }; 38439 _proto.option = function option(key, value) { 38440 if ($.isPlainObject(key)) { 38441 return this.options = $.extend(true, this.options, key); 38442 } else if (key != null) { 38443 return this.options[key]; 38444 } else { 38445 return this.options[key] = value; 38446 } 38447 }; 38448 _proto._buildMenuList = function _buildMenuList() { 38449 this.$nipple = $('<div class="dropdown_menu_nipple"></div>'); 38450 this.$menuList.prepend(this.$nipple); 38451 this.$menuList.hide(); 38452 }; 38453 _proto._bind = function _bind() { 38454 var _this = this; 38455 $("body").click(function() { 38456 if (_this.isOpen) { 38457 _this.close(); 38458 } 38459 }); 38460 this.$menuButton.click(function() { 38461 if (!_this.isDisabled()) { 38462 if (_this.isOpen) { 38463 _this.close(); 38464 } else { 38465 _this.open(); 38466 } 38467 } 38468 return false; 38469 }); 38470 }; 38471 _proto._position = function _position() { 38472 this.$menuList.css("top", this.$menuButton.position().top + this.$menuButton.outerHeight() + 10); 38473 var button_left = this.$menuButton.position().left; 38474 var button_center = this.$menuButton.outerWidth() / 2; 38475 var button_right = button_left + button_center * 2; 38476 var menu_center = this.$menuList.outerWidth() / 2; 38477 var nipple_center = this.$nipple.outerWidth() / 2; 38478 var window_right = $(window).width(); 38479 var centered_menu_left = button_left + button_center - menu_center; 38480 var centered_menu_right = button_left + button_center + menu_center; 38481 if (centered_menu_left < 0) { 38482 this.$menuList.css("left", button_left); 38483 this.$nipple.css("left", button_center - nipple_center); 38484 } else if (centered_menu_right > window_right) { 38485 this.$menuList.css("right", window_right - button_right); 38486 this.$nipple.css("right", button_center - nipple_center); 38487 } else { 38488 this.$menuList.css("left", centered_menu_left); 38489 this.$nipple.css("left", menu_center - nipple_center); 38490 } 38491 }; 38492 return DropdownMenu; 38493 }(); 38494 $.widget.bridge("aaDropdownMenu", DropdownMenu); 38495 var onDOMReady$1 = function onDOMReady() { 38496 return $(".dropdown_menu").aaDropdownMenu(); 38497 }; 38498 $(document).ready(onDOMReady$1).on("page:load turbolinks:load", onDOMReady$1); 38499 function hasTurbolinks() { 38500 return typeof Turbolinks !== "undefined" && Turbolinks.supported; 38501 } 38502 function turbolinksVisit(params) { 38503 var path = [ window.location.pathname, "?", toQueryString(params) ].join(""); 38504 Turbolinks.visit(path); 38505 } 38506 function queryString() { 38507 return (window.location.search || "").replace(/^\?/, ""); 38508 } 38509 function queryStringToParams() { 38510 var decode = function decode(value) { 38511 return decodeURIComponent((value || "").replace(/\+/g, "%20")); 38512 }; 38513 return queryString().split("&").map(function(pair) { 38514 return pair.split("="); 38515 }).map(function(_ref) { 38516 var key = _ref[0], value = _ref[1]; 38517 return { 38518 name: decode(key), 38519 value: decode(value) 38520 }; 38521 }); 38522 } 38523 function toQueryString(params) { 38524 var encode = function encode(value) { 38525 return encodeURIComponent(value || ""); 38526 }; 38527 return params.map(function(_ref2) { 38528 var name = _ref2.name, value = _ref2.value; 38529 return [ encode(name), encode(value) ]; 38530 }).map(function(pair) { 38531 return pair.join("="); 38532 }).join("&"); 38533 } 38534 var Filters = function() { 38535 function Filters() {} 38536 Filters._clearForm = function _clearForm(event) { 38537 var regex = /^(q\[|q%5B|q%5b|page|utf8|commit)/; 38538 var params = queryStringToParams().filter(function(_ref) { 38539 var name = _ref.name; 38540 return !name.match(regex); 38541 }); 38542 event.preventDefault(); 38543 if (hasTurbolinks()) { 38544 turbolinksVisit(params); 38545 } else { 38546 window.location.search = toQueryString(params); 38547 } 38548 }; 38549 Filters._disableEmptyInputFields = function _disableEmptyInputFields(event) { 38550 var params = $(this).find(":input").filter(function(i, input) { 38551 return input.value === ""; 38552 }).prop({ 38553 disabled: true 38554 }).end().serializeArray(); 38555 if (hasTurbolinks()) { 38556 event.preventDefault(); 38557 turbolinksVisit(params); 38558 } 38559 }; 38560 Filters._setSearchType = function _setSearchType() { 38561 $(this).siblings("input").prop({ 38562 name: "q[" + this.value + "]" 38563 }); 38564 }; 38565 return Filters; 38566 }(); 38567 (function($) { 38568 $(document).on("click", ".clear_filters_btn", Filters._clearForm).on("submit", ".filter_form", Filters._disableEmptyInputFields).on("change", ".filter_form_field.select_and_search select", Filters._setSearchType); 38569 })(jQuery); 38570 $(function() { 38571 $(document).on("click", "a.button.has_many_remove", function(event) { 38572 event.preventDefault(); 38573 var parent = $(this).closest(".has_many_container"); 38574 var to_remove = $(this).closest("fieldset"); 38575 recompute_positions(parent); 38576 parent.trigger("has_many_remove:before", [ to_remove, parent ]); 38577 to_remove.remove(); 38578 return parent.trigger("has_many_remove:after", [ to_remove, parent ]); 38579 }); 38580 $(document).on("click", "a.button.has_many_add", function(event) { 38581 var before_add; 38582 event.preventDefault(); 38583 var parent = $(this).closest(".has_many_container"); 38584 parent.trigger(before_add = $.Event("has_many_add:before"), [ parent ]); 38585 if (!before_add.isDefaultPrevented()) { 38586 var index = parent.data("has_many_index") || parent.children("fieldset").length - 1; 38587 parent.data({ 38588 has_many_index: ++index 38589 }); 38590 var regex = new RegExp($(this).data("placeholder"), "g"); 38591 var html = $(this).data("html").replace(regex, index); 38592 var fieldset = $(html).insertBefore(this); 38593 recompute_positions(parent); 38594 return parent.trigger("has_many_add:after", [ fieldset, parent ]); 38595 } 38596 }); 38597 $(document).on("change", '.has_many_container[data-sortable] :input[name$="[_destroy]"]', function() { 38598 recompute_positions($(this).closest(".has_many")); 38599 }); 38600 $(document).on("has_many_add:after", ".has_many_container", init_sortable); 38601 }); 38602 var init_sortable = function init_sortable() { 38603 var elems = $(".has_many_container[data-sortable]:not(.ui-sortable)"); 38604 elems.sortable({ 38605 items: "> fieldset", 38606 handle: "> ol > .handle", 38607 start: function start(ev, ui) { 38608 ui.item.css({ 38609 opacity: .3 38610 }); 38611 }, 38612 stop: function stop(ev, ui) { 38613 ui.item.css({ 38614 opacity: 1 38615 }); 38616 recompute_positions($(this)); 38617 } 38618 }); 38619 elems.each(recompute_positions); 38620 }; 38621 var recompute_positions = function recompute_positions(parent) { 38622 parent = parent instanceof jQuery ? parent : $(this); 38623 var input_name = parent.data("sortable"); 38624 var position = parseInt(parent.data("sortable-start") || 0, 10); 38625 parent.children("fieldset").each(function() { 38626 var destroy_input = $(this).find("> ol > .input > :input[name$='[_destroy]']"); 38627 var sortable_input = $(this).find("> ol > .input > :input[name$='[" + input_name + "]']"); 38628 if (sortable_input.length) { 38629 sortable_input.val(destroy_input.is(":checked") ? "" : position++); 38630 } 38631 }); 38632 }; 38633 $(document).ready(init_sortable).on("page:load turbolinks:load", init_sortable); 38634 var PerPage = function() { 38635 function PerPage(element) { 38636 this.element = element; 38637 } 38638 var _proto = PerPage.prototype;
38639 _proto.update = function update() { 38640 var params = queryStringToParams().filter(function(_ref) { 38641 var name = _ref.name; 38642 return name != "per_page" || name != "page"; 38643 }); 38644 params.push({ 38645 name: "per_page", 38646 value: this.element.value 38647 }); 38648 if (hasTurbolinks()) { 38649 turbolinksVisit(params); 38650 } else { 38651 window.location.search = toQueryString(params); 38652 } 38653 }; 38654 PerPage._jQueryInterface = function _jQueryInterface(config) { 38655 return this.each(function() { 38656 var $this = $(this); 38657 var data = $this.data("perPage"); 38658 if (!data) { 38659 data = new PerPage(this); 38660 $this.data("perPage", data); 38661 } 38662 if (config === "update") { 38663 data[config](); 38664 } 38665 }); 38666 }; 38667 return PerPage; 38668 }(); 38669 (function($) { 38670 $(document).on("change", ".pagination_per_page > select", function(_event) { 38671 PerPage._jQueryInterface.call($(this), "update"); 38672 }); 38673 $.fn["perPage"] = PerPage._jQueryInterface; 38674 $.fn["perPage"].Constructor = PerPage; 38675 })(jQuery); 38676 function _inheritsLoose(subClass, superClass) { 38677 subClass.prototype = Object.create(superClass.prototype); 38678 subClass.prototype.constructor = subClass; 38679 _setPrototypeOf(subClass, superClass); 38680 } 38681 function _setPrototypeOf(o, p) { 38682 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { 38683 o.__proto__ = p; 38684 return o; 38685 }; 38686 return _setPrototypeOf(o, p); 38687 } 38688 var TableCheckboxToggler = function(_CheckboxToggler) { 38689 _inheritsLoose(TableCheckboxToggler, _CheckboxToggler); 38690 function TableCheckboxToggler() { 38691 return _CheckboxToggler.apply(this, arguments) || this; 38692 } 38693 var _proto = TableCheckboxToggler.prototype; 38694 _proto._bind = function _bind() { 38695 var _this = this; 38696 _CheckboxToggler.prototype._bind.apply(this, arguments); 38697 this.$container.find("tbody td").click(function(event) { 38698 if (event.target.type !== "checkbox") { 38699 _this._didClickCell(event.target); 38700 } 38701 }); 38702 }; 38703 _proto._didChangeCheckbox = function _didChangeCheckbox(checkbox) { 38704 _CheckboxToggler.prototype._didChangeCheckbox.apply(this, arguments); 38705 $(checkbox).parents("tr").toggleClass("selected", checkbox.checked); 38706 }; 38707 _proto._didChangeToggleAllCheckbox = function _didChangeToggleAllCheckbox() { 38708 this.$container.find("tbody tr").toggleClass("selected", _CheckboxToggler.prototype._didChangeToggleAllCheckbox.apply(this, arguments)); 38709 }; 38710 _proto._didClickCell = function _didClickCell(cell) { 38711 $(cell).parent("tr").find(":checkbox").click(); 38712 }; 38713 return TableCheckboxToggler; 38714 }(CheckboxToggler); 38715 $.widget.bridge("tableCheckboxToggler", TableCheckboxToggler); 38716 var onDOMReady = function onDOMReady() { 38717 return $("#active_admin_content .tabs").tabs(); 38718 }; 38719 $(document).ready(onDOMReady).on("page:load turbolinks:load", onDOMReady); 38720 function modal_dialog(message, inputs, callback) { 38721 console.warn("ActiveAdmin.modal_dialog is deprecated in favor of ActiveAdmin.ModalDialog, please update usage."); 38722 return ModalDialog(message, inputs, callback); 38723 } 38724 exports.ModalDialog = ModalDialog; 38725 exports.modal_dialog = modal_dialog; 38726}); 38727/*! 38728 Autosize v1.18.9 - 2014-05-27 38729 Automatically adjust textarea height based on user input. 38730 (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize 38731 license: http://www.opensource.org/licenses/mit-license.php 38732*/ 38733 38734(function ($) { 38735 'use strict'; 38736 var defaults = { 38737 className: 'autosizejs', 38738 id: 'autosizejs', 38739 append: '\n', 38740 callback: false, 38741 resizeDelay: 10, 38742 placeholder: true 38743 }, 38744 38745 // border:0 is unnecessary, but avoids a bug in Firefox on OSX 38746 copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>', 38747 38748 // line-height is conditionally included because IE7/IE8/old Opera do not return the correct value. 38749 typographyStyles = [ 38750 'fontFamily', 38751 'fontSize', 38752 'fontWeight', 38753 'fontStyle', 38754 'letterSpacing', 38755 'textTransform', 38756 'wordSpacing', 38757 'textIndent' 38758 ], 38759 38760 // to keep track which textarea is being mirrored when adjust() is called. 38761 mirrored, 38762 38763 // the mirror element, which is used to calculate what size the mirrored element should be. 38764 mirror = $(copy).data('autosize', true)[0]; 38765 38766 // test that line-height can be accurately copied. 38767 mirror.style.lineHeight = '99px'; 38768 if ($(mirror).css('lineHeight') === '99px') {
38769 typographyStyles.push('lineHeight'); 38770 } 38771 mirror.style.lineHeight = ''; 38772 38773 $.fn.autosize = function (options) { 38774 if (!this.length) { 38775 return this; 38776 } 38777 38778 options = $.extend({}, defaults, options || {}); 38779 38780 if (mirror.parentNode !== document.body) { 38781 $(document.body).append(mirror); 38782 } 38783 38784 return this.each(function () { 38785 var 38786 ta = this, 38787 $ta = $(ta), 38788 maxHeight, 38789 minHeight, 38790 boxOffset = 0, 38791 callback = $.isFunction(options.callback), 38792 originalStyles = { 38793 height: ta.style.height, 38794 overflow: ta.style.overflow, 38795 overflowY: ta.style.overflowY, 38796 wordWrap: ta.style.wordWrap, 38797 resize: ta.style.resize 38798 }, 38799 timeout, 38800 width = $ta.width(), 38801 taResize = $ta.css('resize'); 38802 38803 if ($ta.data('autosize')) { 38804 // exit if autosize has already been applied, or if the textarea is the mirror element. 38805 return; 38806 } 38807 $ta.data('autosize', true); 38808 38809 if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){ 38810 boxOffset = $ta.outerHeight() - $ta.height(); 38811 } 38812 38813 // IE8 and lower return 'auto', which parses to NaN, if no min-height is set. 38814 minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height()); 38815 38816 $ta.css({ 38817 overflow: 'hidden', 38818 overflowY: 'hidden', 38819 wordWrap: 'break-word' // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width 38820 }); 38821 38822 if (taResize === 'vertical') { 38823 $ta.css('resize','none'); 38824 } else if (taResize === 'both') { 38825 $ta.css('resize', 'horizontal'); 38826 } 38827 38828 // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value. 38829 // window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower. 38830 function setWidth() { 38831 var width; 38832 var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false; 38833 38834 if (style) { 38835 38836 width = ta.getBoundingClientRect().width; 38837 38838 if (width === 0 || typeof width !== 'number') { 38839 width = parseInt(style.width,10); 38840 } 38841 38842 $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){ 38843 width -= parseInt(style[val],10); 38844 }); 38845 } else { 38846 width = $ta.width(); 38847 } 38848 38849 mirror.style.width = Math.max(width,0) + 'px'; 38850 } 38851 38852 function initMirror() { 38853 var styles = {}; 38854 38855 mirrored = ta; 38856 mirror.className = options.className; 38857 mirror.id = options.id; 38858 maxHeight = parseInt($ta.css('maxHeight'), 10); 38859 38860 // mirror is a duplicate textarea located off-screen that 38861 // is automatically updated to contain the same text as the 38862 // original textarea. mirror always has a height of 0. 38863 // This gives a cross-browser supported way getting the actual 38864 // height of the text, through the scrollTop property. 38865 $.each(typographyStyles, function(i,val){ 38866 styles[val] = $ta.css(val); 38867 }); 38868 38869 $(mirror).css(styles).attr('wrap', $ta.attr('wrap')); 38870 38871 setWidth(); 38872 38873 // Chrome-specific fix: 38874 // When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space 38875 // made available by removing the scrollbar. This workaround triggers the reflow for Chrome. 38876 if (window.chrome) { 38877 var width = ta.style.width; 38878 ta.style.width = '0px'; 38879 var ignore = ta.offsetWidth; 38880 ta.style.width = width; 38881 } 38882 } 38883 38884 // Using mainly bare JS in this function because it is going 38885 // to fire very often while typing, and needs to very efficient. 38886 function adjust() { 38887 var height, original; 38888 38889 if (mirrored !== ta) { 38890 initMirror(); 38891 } else { 38892 setWidth(); 38893 } 38894 38895 if (!ta.value && options.placeholder) { 38896 // If the textarea is empty, copy the placeholder text into 38897 // the mirror control and use that for sizing so that we 38898 // don't end up with placeholder getting trimmed. 38899 mirror.value = ($ta.attr("placeholder") || '') + options.append; 38900 } else { 38901 mirror.value = ta.value + options.append; 38902 } 38903 38904 mirror.style.overflowY = ta.style.overflowY; 38905 original = parseInt(ta.style.height,10); 38906 38907 // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied 38908 mirror.scrollTop = 0; 38909 38910 mirror.scrollTop = 9e4; 38911 38912 // Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding. 38913 height = mirror.scrollTop; 38914 38915 if (maxHeight && height > maxHeight) { 38916 ta.style.overflowY = 'scroll'; 38917 height = maxHeight; 38918 } else { 38919 ta.style.overflowY = 'hidden'; 38920 if (height < minHeight) { 38921 height = minHeight; 38922 } 38923 } 38924 38925 height += boxOffset; 38926 38927 if (original !== height) { 38928 ta.style.height = height + 'px'; 38929 if (callback) { 38930 options.callback.call(ta,ta); 38931 } 38932 } 38933 } 38934 38935 function resize () { 38936 clearTimeout(timeout); 38937 timeout = setTimeout(function(){ 38938 var newWidth = $ta.width(); 38939 38940 if (newWidth !== width) { 38941 width = newWidth; 38942 adjust(); 38943 } 38944 }, parseInt(options.resizeDelay,10)); 38945 } 38946 38947 if ('onpropertychange' in ta) { 38948 if ('oninput' in ta) { 38949 // Detects IE9. IE9 does not fire onpropertychange or oninput for deleti
38949ons, 38950 // so binding to onkeyup to catch most of those occasions. There is no way that I 38951 // know of to detect something like 'cut' in IE9. 38952 $ta.on('input.autosize keyup.autosize', adjust); 38953 } else { 38954 // IE7 / IE8 38955 $ta.on('propertychange.autosize', function(){ 38956 if(event.propertyName === 'value'){ 38957 adjust(); 38958 } 38959 }); 38960 } 38961 } else { 38962 // Modern Browsers 38963 $ta.on('input.autosize', adjust); 38964 } 38965 38966 // Set options.resizeDelay to false if using fixed-width textarea elements. 38967 // Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize. 38968 38969 if (options.resizeDelay !== false) { 38970 $(window).on('resize.autosize', resize); 38971 } 38972 38973 // Event for manual triggering if needed. 38974 // Should only be needed when the value of the textarea is changed through JavaScript rather than user input. 38975 $ta.on('autosize.resize', adjust); 38976 38977 // Event for manual triggering that also forces the styles to update as well. 38978 // Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method. 38979 $ta.on('autosize.resizeIncludeStyle', function() { 38980 mirrored = null; 38981 adjust(); 38982 }); 38983 38984 $ta.on('autosize.destroy', function(){ 38985 mirrored = null; 38986 clearTimeout(timeout); 38987 $(window).off('resize', resize); 38988 $ta 38989 .off('autosize') 38990 .off('.autosize') 38991 .css(originalStyles) 38992 .removeData('autosize'); 38993 }); 38994 38995 // Call adjust in case the textarea already contains text. 38996 adjust(); 38997 }); 38998 }; 38999}(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto 39000; 39001/* 39002 * BestInPlace (for jQuery) 39003 * version: 3.0.0.alpha (2014) 39004 * 39005 * By Bernat Farrero based on the work of Jan Varwig. 39006 * Examples at http://bernatfarrero.com 39007 * 39008 * Licensed under the MIT: 39009 * http://www.opensource.org/licenses/mit-license.php 39010 * 39011 * @requires jQuery 39012 * 39013 * Usage: 39014 * 39015 * Attention. 39016 * The format of the JSON object given to the select inputs is the following: 39017 * [["key", "value"],["key", "value"]] 39018 * The format of the JSON object given to the checkbox inputs is the following: 39019 * ["falseValue", "trueValue"] 39020 39021 */ 39022 39023 39024function BestInPlaceEditor(e) { 39025 'use strict'; 39026 this.element = e; 39027 this.initOptions(); 39028 this.bindForm(); 39029 this.initPlaceHolder(); 39030 jQuery(this.activator).bind('click', {editor: this}, this.clickHandler); 39031} 39032 39033BestInPlaceEditor.prototype = { 39034 // Public Interface Functions ////////////////////////////////////////////// 39035 39036 activate: function () { 39037 'use strict'; 39038 var to_display; 39039 if (this.isPlaceHolder()) { 39040 to_display = ""; 39041 } else if (this.original_content) { 39042 to_display = this.original_content; 39043 } else { 39044 switch (this.formType) { 39045 case 'input': 39046 case 'textarea': 39047 if (this.display_raw) { 39048 to_display = this.element.html().replace(/&/gi, '&'); 39049 } 39050 else { 39051 var value = this.element.data('bipValue'); 39052 if (typeof value === 'undefined') { 39053 to_display = ''; 39054 } else if (typeof value === 'string') { 39055 to_display = this.element.data('bipValue').replace(/&/gi, '&'); 39056 } else { 39057 to_display = this.element.data('bipValue'); 39058 } 39059 } 39060 break; 39061 case 'select': 39062 to_display = this.element.html(); 39063 39064 } 39065 } 39066 39067 this.oldValue = this.isPlaceHolder() ? "" : this.element.html(); 39068 this.display_value = to_display; 39069 jQuery(this.activator).unbind("click", this.clickHandler); 39070 this.activateForm(); 39071 this.element.trigger(jQuery.Event("best_in_place:activate")); 39072 }, 39073 39074 abort: function () { 39075 'use strict'; 39076 this.activateText(this.oldValue); 39077 jQuery(this.activator).bind('click', {editor: this}, this.clickHandler); 39078 this.element.trigger(jQuery.Event("best_in_place:abort")); 39079 this.element.trigger(jQuery.Event("best_in_place:deactivate")); 39080 }, 39081 39082 abortIfConfirm: function () { 39083 'use strict'; 39084 if (!this.useConfirm) { 39085 this.abort(); 39086 return; 39087 } 39088 39089 if (confirm(BestInPlaceEditor.defaults.locales[''].confirmMessage)) { 39090 this.abort(); 39091 } 39092 }, 39093 39094 update: function () { 39095 'use strict'; 39096 39097 this.element.trigger(jQuery.Event("best_in_place:before-update")); 39098 39099 var editor = this, 39100 value = this.getValue(); 39101 39102 // Avoid request if no change is made 39103 if (this.formType in {"input": 1, "textarea": 1} && value === this.oldValue) { 39104 this.abort(); 39105 return true; 39106 } 39107 39108 editor.ajax({ 39109 "type": this.requestMethod(), 39110 "dataType": BestInPlaceEditor.defaults.ajaxDataType, 39111 "data": editor.requestData(), 39112 "success": function (data, status, xhr) { 39113 editor.loadSuccessCallback(data, status, xhr); 39114 }, 39115 "error": function (request, error) { 39116 editor.loadErrorCallback(request, error); 39117 } 39118 }); 39119 39120 39121 switch (this.formType) { 39122 case "select": 39123 this.previousCollectionValue = value; 39124 39125 // search for the text for the span 39126 $.each(this.values, function(index, arr){ if (String(arr[0]) === String(value)) editor.element.html(arr[1]); }); 39127 break; 39128 39129 case "checkbox": 39130 $.each(this.values, function(index, arr){ if (String(arr[0]) === String(value)) editor.element.html(arr[1]); }); 39131 break; 39132 39133 default: 39134 if (value !== "") { 39135 if (this.display_raw) { 39136 editor.element.html(value); 39137 } else { 39138 editor.element.text(value); 39139 } 39140 } else { 39141 editor.element.html(this.placeHolder); 39142 } 39143 } 39144 39145 editor.element.data('bipValue', value); 39146 editor.element.attr('data-bip-value', value); 39147 39148 editor.element.trigger(jQuery.Event("best_in_place:update")); 39149 }, 39150 39151 activateForm: function () { 39152 'use strict'; 39153 alert(BestInPlaceEditor.defaults.locales[''].uninitializedForm); 39154 }, 39155 39156 activateText: function (value) { 39157 'use strict'; 39158 this.element.html(value); 39159 if (this.isPlaceHolder()) { 39160 this.element.html(this.placeHolder); 39161 } 39162 }, 39163 39164 // Helper Functions //////////////////////////////////////////////////////// 39165 39166 initOptions: function () { 39167 // Try parent supplied info 39168 'use strict'; 39169 var self = this; 39170 self.element.parents().each(function () { 39171 var $parent = jQuery(this); 39172 self.url = self.url || $parent.data("bipUrl"); 39173 self.activator = self.activator || $parent.data("bipActivator"); 39174 self.okButton = self.okButton || $parent.data("bipOkButton"); 39175 self.okButtonClass = self.okButtonClass || $parent.data("bipOkButtonClass"); 39176 self.cancelButton = self.cancelButton || $parent.data("bipCancelButton"); 39177 self.cancelButtonClass = self.cancelButtonClass || $parent.data("bipCancelButtonClass"); 39178 self.skipBlur = self.skipBlur || $parent.data("bipSkipBlur"); 39179 }); 39180 39181 // Load own attributes (overrides all others) 39182 self.url = self.element.data("bipUrl") || self.url || document.location.pathname; 39183 self.collection = self.element.data("bipCollection") || self.collection; 39184 self.formType = self.element.data("bipType") || "input"; 39185 self.objectName = self.element.data("bipObject") || self.objectName; 39186 self.attributeName = self.element.data("bipAttribute") || self.attributeName; 39187 self.activator = self.element.data("bipActivator") || self.element; 39188 self.okButton = self.element.data("bipOkButton") || self.okButton; 39189 self.okButtonClass = self.element.data("bipOkButtonClass") || self.okButtonClass || BestInPlaceEditor.defaults.okButtonClass; 39190 self.cancelButton = self.element.data("bipCancelButton") || self.cancelButton; 39191 self.cancelButtonClass = self.element.data("bipCancelButtonClass") || self.cancelButtonClass || BestInPlaceEditor.defaults.cancelButtonClass; 39192 self.skipBlur = self.element.data("bipSkipBlur") || self.skipBlur || BestInPlaceEditor.defaults.skipBlur; 39193 self.isNewObject = self.element.data("bipNewObject"); 39194 self.dataExtraPayload = self.element.data("bipExtraPayload"); 39195 39196 // Fix for default values of 0 39197 if (self.element.data("bipPlaceholder") == null) { 39198 self.placeHolder = BestInPlaceEditor.defaults.locales[''].placeHolder; 39199 } else { 39200 self.placeHolder = self.element.data("bipPlaceholder"); 39201 } 39202 39203 self.inner_class = self.element.data("bipInnerClass"); 39204 self.html_attrs = self.element.data("bipHtmlAttrs"); 39205 self.original_content = self.element.data("bipOriginalContent") || self.original_content; 39206 39207 // if set the input won't be satinized
39208 self.display_raw = self.element.data("bip-raw"); 39209 39210 self.useConfirm = self.element.data("bip-confirm"); 39211 39212 if (self.formType === "select" || self.formType === "checkbox") { 39213 self.values = self.collection; 39214 self.collectionValue = self.element.data("bipValue") || self.collectionValue; 39215 } 39216 }, 39217 39218 bindForm: function () { 39219 'use strict'; 39220 this.activateForm = BestInPlaceEditor.forms[this.formType].activateForm; 39221 this.getValue = BestInPlaceEditor.forms[this.formType].getValue; 39222 }, 39223 39224 39225 initPlaceHolder: function () { 39226 'use strict'; 39227 // TODO add placeholder for select and checkbox 39228 if (this.element.html() === "") { 39229 this.element.addClass('bip-placeholder'); 39230 this.element.html(this.placeHolder); 39231 } 39232 }, 39233 39234 isPlaceHolder: function () { 39235 'use strict'; 39236 // TODO: It only work when form is deactivated. 39237 // Condition will fail when form is activated 39238 return this.element.html() === "" || this.element.html() === this.placeHolder; 39239 }, 39240 39241 getValue: function () { 39242 'use strict'; 39243 alert(BestInPlaceEditor.defaults.locales[''].uninitializedForm); 39244 }, 39245 39246 // Trim and Strips HTML from text 39247 sanitizeValue: function (s) { 39248 'use strict'; 39249 return jQuery.trim(s); 39250 }, 39251 39252 requestMethod: function() { 39253 'use strict'; 39254 return this.isNewObject ? 'post' : BestInPlaceEditor.defaults.ajaxMethod; 39255 }, 39256 39257 /* Generate the data sent in the POST request */ 39258 requestData: function () { 39259 'use strict'; 39260 // To prevent xss attacks, a csrf token must be defined as a meta attribute 39261 var csrf_token = jQuery('meta[name=csrf-token]').attr('content'), 39262 csrf_param = jQuery('meta[name=csrf-param]').attr('content'); 39263 39264 var data = {} 39265 data['_method'] = this.requestMethod() 39266 39267 data[this.objectName] = this.dataExtraPayload || {} 39268 39269 data[this.objectName][this.attributeName] = this.getValue() 39270 39271 if (csrf_param !== undefined && csrf_token !== undefined) { 39272 data[csrf_param] = csrf_token 39273 } 39274 return jQuery.param(data); 39275 }, 39276 39277 ajax: function (options) { 39278 'use strict'; 39279 options.url = this.url; 39280 options.beforeSend = function (xhr) { 39281 xhr.setRequestHeader("Accept", "application/json"); 39282 }; 39283 return jQuery.ajax(options); 39284 }, 39285 39286 // Handlers //////////////////////////////////////////////////////////////// 39287 39288 loadSuccessCallback: function (data, status, xhr) { 39289 'use strict'; 39290 data = jQuery.trim(data); 39291 //Update original content with current text. 39292 if (this.display_raw) { 39293 this.original_content = this.element.html(); 39294 } else { 39295 this.original_content = this.element.text(); 39296 } 39297 39298 if (data && data !== "") { 39299 var response = jQuery.parseJSON(data); 39300 if (response !== null && response.hasOwnProperty("display_as")) { 39301 this.element.data('bip-original-content', this.element.text()); 39302 this.element.html(response.display_as); 39303 } 39304 if (this.isNewObject && response && response[this.objectName]) { 39305 if (response[this.objectName]["id"]) { 39306 this.isNewObject = false 39307 this.url += "/" + response[this.objectName]["id"] // in REST a POST /thing url should become PUT /thing/123 39308 } 39309 } 39310 } 39311 this.element.toggleClass('bip-placeholder', this.isPlaceHolder()); 39312 39313 this.element.trigger(jQuery.Event("best_in_place:success"), [data, status, xhr]); 39314 this.element.trigger(jQuery.Event("ajax:success"), [data, status, xhr]); 39315 39316 // Binding back after being clicked 39317 jQuery(this.activator).bind('click', {editor: this}, this.clickHandler); 39318 this.element.trigger(jQuery.Event("best_in_place:deactivate")); 39319 39320 if (this.collectionValue !== null && this.formType === "select") { 39321 this.collectionValue = this.previousCollectionValue; 39322 this.previousCollectionValue = null; 39323 } 39324 }, 39325 39326 loadErrorCallback: function (request, error) { 39327 'use strict'; 39328 this.activateText(this.oldValue); 39329 39330 this.element.trigger(jQuery.Event("best_in_place:error"), [request, error]); 39331 this.element.trigger(jQuery.Event("ajax:error"), request, error); 39332 39333 // Binding back after being clicked 39334 jQuery(this.activator).bind('click', {editor: this}, this.clickHandler); 39335 this.element.trigger(jQuery.Event("best_in_place:deactivate")); 39336 }, 39337 39338 clickHandler: function (event) { 39339 'use strict'; 39340 event.preventDefault(); 39341 event.data.editor.activate(); 39342 }, 39343 39344 setHtmlAttributes: function () { 39345 'use strict'; 39346 var formField = this.element.find(this.formType); 39347 39348 if (this.html_attrs) { 39349 var attrs = this.html_attrs; 39350 $.each(attrs, function (key, val) { 39351 formField.attr(key, val); 39352 }); 39353 } 39354 }, 39355 39356 placeButtons: function (output, field) { 39357 'use strict'; 39358 if (field.okButton) { 39359 output.append( 39360 jQuery(document.createElement('input')) 39361 .attr('type', 'submit') 39362 .attr('class', field.okButtonClass) 39363 .attr('value', field.okButton) 39364 ); 39365 } 39366 if (field.cancelButton) { 39367 output.append( 39368 jQuery(document.createElement('input')) 39369 .attr('type', 'button') 39370 .attr('class', field.cancelButtonClass) 39371 .attr('value', field.cancelButton) 39372 ); 39373 } 39374 } 39375}; 39376 39377 39378// Button cases: 39379// If no buttons, then blur saves, ESC cancels 39380// If just Cancel button, then blur saves, ESC or clicking Cancel cancels (careful of blur event!) 39381// If just OK button, then clicking OK saves (careful of blur event!), ESC or blur cancels 39382// If both buttons, then clicking OK saves, ESC or clicking Cancel or blur cancels 39383BestInPlaceEditor.forms = { 39384 "input": { 39385 activateForm: function () { 39386 'use strict'; 39387 var output = jQuery(document.createElement('form')) 39388 .addClass('form_in_place') 39389 .attr('action', 'javascript:void(0);') 39390 .attr('style', 'display:inline'); 39391 var input_elt = jQuery(document.createElement('input')) 39392 .attr('type', 'text') 39393 .attr('name', this.attributeName) 39394 .val(this.display_value); 39395 39396 // Add class to form input 39397 if (this.inner_class) { 39398 input_elt.addClass(this.inner_class); 39399 } 39400 39401 output.append(input_elt); 39402 this.placeButtons(output, this); 39403 39404 this.element.html(output); 39405 this.setHtmlAttributes(); 39406 39407 this.element.find("input[type='text']")[0].select(); 39408 this.element.find("form").bind('submit', {editor: this}, BestInPlaceEditor.forms.input.submitHandler); 39409 if (this.cancelButton) { 39410 this.element.find("input[type='button']").bind('click', {editor: this}, BestInPlaceEditor.forms.input.cancelButtonHandler); 39411 } 39412 if (!this.okButton) { 39413 this.element.find("input[type='text']").bind('blur', {editor: this}, BestInPlaceEditor.forms.input.inputBlurHandler); 39414 } 39415 this.element.find("input[type='text']").bind('keyup', {editor: this}
39415, BestInPlaceEditor.forms.input.keyupHandler); 39416 this.blurTimer = null; 39417 this.userClicked = false; 39418 }, 39419 39420 getValue: function () { 39421 'use strict'; 39422 return this.sanitizeValue(this.element.find("input").val()); 39423 }, 39424 39425 // When buttons are present, use a timer on the blur event to give precedence to clicks 39426 inputBlurHandler: function (event) { 39427 'use strict'; 39428 if (event.data.editor.okButton) { 39429 event.data.editor.blurTimer = setTimeout(function () { 39430 if (!event.data.editor.userClicked) { 39431 event.data.editor.abort(); 39432 } 39433 }, 500); 39434 } else { 39435 if (event.data.editor.cancelButton) { 39436 event.data.editor.blurTimer = setTimeout(function () { 39437 if (!event.data.editor.userClicked) { 39438 event.data.editor.update(); 39439 } 39440 }, 500); 39441 } else { 39442 event.data.editor.update(); 39443 } 39444 } 39445 }, 39446 39447 submitHandler: function (event) { 39448 'use strict'; 39449 event.data.editor.userClicked = true; 39450 clearTimeout(event.data.editor.blurTimer); 39451 event.data.editor.update(); 39452 }, 39453 39454 cancelButtonHandler: function (event) { 39455 'use strict'; 39456 event.data.editor.userClicked = true; 39457 clearTimeout(event.data.editor.blurTimer); 39458 event.data.editor.abort(); 39459 event.stopPropagation(); // Without this, click isn't handled 39460 }, 39461 39462 keyupHandler: function (event) { 39463 'use strict'; 39464 if (event.keyCode === 27) { 39465 event.data.editor.abort(); 39466 event.stopImmediatePropagation(); 39467 } 39468 } 39469 }, 39470 39471 "select": { 39472 activateForm: function () { 39473 'use strict'; 39474 var output = jQuery(document.createElement('form')) 39475 .attr('action', 'javascript:void(0)') 39476 .attr('style', 'display:inline'), 39477 selected = '', 39478 select_elt = jQuery(document.createElement('select')) 39479 .attr('class', this.inner_class !== null ? this.inner_class : ''), 39480 currentCollectionValue = this.collectionValue, 39481 key, value, 39482 a = this.values; 39483 39484 $.each(a, function(index, arr){ 39485 key = arr[0]; 39486 value = arr[1]; 39487 var option_elt = jQuery(document.createElement('option')) 39488 .val(key) 39489 .html(value); 39490 39491 if (currentCollectionValue) { 39492 if (String(key) === String(currentCollectionValue)) option_elt.attr('selected', 'selected'); 39493 } 39494 select_elt.append(option_elt); 39495 }); 39496 output.append(select_elt); 39497 39498 this.element.html(output); 39499 this.setHtmlAttributes(); 39500 this.element.find("select").bind('change', {editor: this}, BestInPlaceEditor.forms.select.blurHandler); 39501 this.element.find("select").bind('blur', {editor: this}, BestInPlaceEditor.forms.select.blurHandler); 39502 this.element.find("select").bind('keyup', {editor: this}, BestInPlaceEditor.forms.select.keyupHandler); 39503 this.element.find("select")[0].focus(); 39504 39505 // automatically click on the select so you 39506 // don't have to click twice 39507 try { 39508 var e = document.createEvent("MouseEvents"); 39509 e.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 39510 this.element.find("select")[0].dispatchEvent(e); 39511 } 39512 catch(e) { 39513 // browser doesn't support this, e.g. IE8 39514 } 39515 }, 39516 39517 getValue: function () { 39518 'use strict'; 39519 return this.sanitizeValue(this.element.find("select").val()); 39520 }, 39521 39522 blurHandler: function (event) { 39523 'use strict';
39524 event.data.editor.update(); 39525 }, 39526 39527 keyupHandler: function (event) { 39528 'use strict'; 39529 if (event.keyCode === 27) { 39530 event.data.editor.abort(); 39531 } 39532 } 39533 }, 39534 39535 "checkbox": { 39536 activateForm: function () { 39537 'use strict'; 39538 this.collectionValue = !this.getValue(); 39539 this.setHtmlAttributes(); 39540 this.update(); 39541 }, 39542 39543 getValue: function () { 39544 'use strict'; 39545 return this.collectionValue; 39546 } 39547 }, 39548 39549 "textarea": { 39550 activateForm: function () { 39551 'use strict'; 39552 // grab width and height of text 39553 var width = this.element.css('width'); 39554 var height = this.element.css('height'); 39555 39556 // construct form 39557 var output = jQuery(document.createElement('form')) 39558 .addClass('form_in_place') 39559 .attr('action', 'javascript:void(0);') 39560 .attr('style', 'display:inline'); 39561 var textarea_elt = jQuery(document.createElement('textarea')) 39562 .attr('name', this.attributeName) 39563 .val(this.sanitizeValue(this.display_value)); 39564 39565 if (this.inner_class !== null) { 39566 textarea_elt.addClass(this.inner_class); 39567 } 39568 39569 output.append(textarea_elt); 39570 39571 this.placeButtons(output, this); 39572 39573 this.element.html(output); 39574 this.setHtmlAttributes(); 39575 39576 // set width and height of textarea 39577 jQuery(this.element.find("textarea")[0]).css({'min-width': width, 'min-height': height}); 39578 jQuery(this.element.find("textarea")[0]).autosize(); 39579 39580 this.element.find("textarea")[0].focus(); 39581 this.element.find("form").bind('submit', {editor: this}, BestInPlaceEditor.forms.textarea.submitHandler); 39582 39583 if (this.cancelButton) { 39584 this.element.find("input[type='button']").bind('click', {editor: this}, BestInPlaceEditor.forms.textarea.cancelButtonHandler); 39585 } 39586 39587 if (!this.skipBlur) { 39588 this.element.find("textarea").bind('blur', {editor: this}, BestInPlaceEditor.forms.textarea.blurHandler); 39589 } 39590 this.element.find("textarea").bind('keyup', {editor: this}, BestInPlaceEditor.forms.textarea.keyupHandler); 39591 this.blurTimer = null; 39592 this.userClicked = false; 39593 }, 39594 39595 getValue: function () { 39596 'use strict'; 39597 return this.sanitizeValue(this.element.find("textarea").val()); 39598 }, 39599 39600 // When buttons are present, use a timer on the blur event to give precedence to clicks 39601 blurHandler: function (event) { 39602 'use strict'; 39603 if (event.data.editor.okButton) { 39604 event.data.editor.blurTimer = setTimeout(function () { 39605 if (!event.data.editor.userClicked) { 39606 event.data.editor.abortIfConfirm(); 39607 } 39608 }, 500); 39609 } else { 39610 if (event.data.editor.cancelButton) { 39611 event.data.editor.blurTimer = setTimeout(function () { 39612 if (!event.data.editor.userClicked) { 39613 event.data.editor.update(); 39614 } 39615 }, 500); 39616 } else { 39617 event.data.editor.update(); 39618 } 39619 } 39620 }, 39621 39622 submitHandler: function (event) { 39623 'use strict'; 39624 event.data.editor.userClicked = true; 39625 clearTimeout(event.data.editor.blurTimer); 39626 event.data.editor.update(); 39627 }, 39628 39629 cancelButtonHandler: function (event) { 39630 'use strict'; 39631 event.data.editor.userClicked = true; 39632 clearTimeout(event.data.editor.blurTimer); 39633 event.data.editor.abortIfConfirm(); 39634 event.stopPropagation(); // Without this, click isn't handled 39635 }, 39636 39637 keyupHandler: function (event) { 39638 'use strict'; 39639 if (event.keyCode === 27) { 39640 event.data.editor.abortIfConfirm(); 39641 } 39642 } 39643 } 39644}; 39645 39646BestInPlaceEditor.defaults = { 39647 locales: {}, 39648 ajaxMethod: "put", //TODO Change to patch when support to 3.2 is dropped 39649 ajaxDataType: 'text', 39650 okButtonClass: '', 39651 cancelButtonClass: '', 39652 skipBlur: false 39653}; 39654 39655// Default locale 39656BestInPlaceEditor.defaults.locales[''] = { 39657 confirmMessage: "Are you sure you want to discard your changes?", 39658 uninitializedForm: "The form was not properly initialized. getValue is unbound", 39659 placeHolder: '-' 39660}; 39661 39662jQuery.fn.best_in_place = function () { 39663 'use strict'; 39664 function setBestInPlace(element) { 39665 if (!element.data('bestInPlaceEditor')) { 39666 element.data('bestInPlaceEditor', new BestInPlaceEditor(element)); 39667 return true; 39668 } 39669 } 39670 39671 jQuery(this.context).delegate(this.selector, 'click', function () { 39672 var el = jQuery(this); 39673 if (setBestInPlace(el)) { 39674 el.click(); 39675 } 39676 }); 39677 39678 this.each(function () { 39679 setBestInPlace(jQuery(this)); 39680 }); 39681 39682 return this; 39683}; 39684 39685 39686 39687/** 39688 * jquery.purr.js 39689 * Copyright (c) 2008 Net Perspective (net-perspective.com) 39690 * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php) 39691 * 39692 * @author R.A. Ray 39693 * @projectDescription jQuery plugin for dynamically displaying unobtrusive messages in the browser. Mimics the behavior of the MacOS program "Growl." 39694 * @version 0.1.0 39695 * 39696 * @requires jquery.js (tested with 1.2.6) 39697 * 39698 * @param fadeInSpeed int - Duration of fade in animation in miliseconds 39699 * default: 500 39700 * @param fadeOutSpeed int - Duration of fade out animationin miliseconds 39701 default: 500 39702 * @param removeTimer int - Timeout, in miliseconds, before notice is removed once it is the top non-sticky notice in the list 39703 default: 4000 39704 * @param isSticky bool - Whether the notice should fade out on its own or wait to be manually closed 39705 default: false 39706 * @param usingTransparentPNG bool - Whether or not the notice is using transparent .png images in its styling 39707 default: false 39708 */ 39709 39710 39711(function(jQuery) { 39712 39713 jQuery.purr = function(notice, options) 39714 { 39715 // Convert notice to a jQuery object 39716 notice = jQuery(notice); 39717 39718 // Add a class to denote the notice as not sticky 39719 notice.addClass('purr'); 39720 39721 // Get the container element from the page 39722 var cont = document.getElementById('purr-container'); 39723 39724 // If the container doesn't yet exist, we need to create it 39725 if (!cont) 39726 { 39727 cont = '<div id="purr-container"></div>'; 39728 } 39729 39730 // Convert cont to a jQuery object 39731 cont = jQuery(cont); 39732 39733 // Add the container to the page 39734 jQuery('body').append(cont); 39735 39736 notify(); 39737 39738 function notify () 39739 { 39740 // Set up the close button 39741 var close = document.createElement('a'); 39742 jQuery(close).attr({ 39743 'class': 'close', 39744 href: '#close' 39745 }).appendTo(notice).click(function() { 39746 removeNotice(); 39747 return false;
39748 }); 39749 39750 // If ESC is pressed remove notice 39751 jQuery(document).keyup(function(e) { 39752 if (e.keyCode === 27) { 39753 removeNotice(); 39754 } 39755 }); 39756 39757 // Add the notice to the page and keep it hidden initially 39758 notice.appendTo(cont).hide(); 39759 39760 //Fade in the notice we just added 39761 notice.fadeIn(options.fadeInSpeed); 39762 39763 // Set up the removal interval for the added notice if that notice is not a sticky 39764 if (!options.isSticky) 39765 { 39766 var topSpotInt = setInterval(function() { 39767 // Check to see if our notice is the first non-sticky notice in the list 39768 if (notice.prevAll('.purr').length === 0) 39769 { 39770 // Stop checking once the condition is met 39771 clearInterval(topSpotInt); 39772 39773 // Call the close action after the timeout set in options 39774 setTimeout(function() { 39775 removeNotice(); 39776 }, options.removeTimer); 39777 } 39778 }, 200); 39779 } 39780 } 39781 39782 function removeNotice() 39783 { 39784 // Fade the object out before reducing its height to produce the sliding effect 39785 notice.animate({ opacity: '0' }, 39786 { 39787 duration: options.fadeOutSpeed, 39788 complete: function () 39789 { 39790 notice.animate({ height: '0px' }, 39791 { 39792 duration: options.fadeOutSpeed, 39793 complete: function() 39794 { 39795 notice.remove(); 39796 } 39797 } 39798 ); 39799 } 39800 } 39801 ); 39802 }; 39803 }; 39804 39805 jQuery.fn.purr = function(options) 39806 { 39807 options = options || {}; 39808 options.fadeInSpeed = options.fadeInSpeed || 500; 39809 options.fadeOutSpeed = options.fadeOutSpeed || 500; 39810 options.removeTimer = options.removeTimer || 4000; 39811 options.isSticky = options.isSticky || false; 39812 options.usingTransparentPNG = options.usingTransparentPNG || false; 39813 39814 this.each(function() 39815 { 39816 new jQuery.purr( this, options ); 39817 } 39818 ); 39819 39820 return this; 39821 }; 39822})( jQuery ); 39823/* 39824 * BestInPlace 3.0.0.alpha (2014) 39825 * 39826 * Depends: 39827 * best_in_place.js 39828 * jquery.purr.js 39829 */ 39830/*global BestInPlaceEditor */ 39831 39832 39833BestInPlaceEditor.defaults.purrErrorContainer = "<span class='bip-flash-error'></span>"; 39834 39835jQuery(document).on('best_in_place:error', function (event, request, error) { 39836 'use strict'; 39837 // Display all error messages from server side validation 39838 jQuery.each(jQuery.parseJSON(request.responseText), function (index, value) { 39839 if (typeof value === "object") {value = index + " " + value.toString(); } 39840 var container = jQuery(BestInPlaceEditor.defaults.purrErrorContainer).html(value); 39841 container.purr(); 39842 }); 39843}); 39844(function() { 39845 $(document).ready(function() { 39846 jQuery(".best_in_place").best_in_place(); 39847 $(".col-time").css({ 39848 "min-width": "83px" 39849 }); 39850 $(".col-notes_section").css({ 39851 "min-width": "150px" 39852 }); 39853 $(".col-admin_action").css({ 39854 "min-width": "82px" 39855 }); 39856 $(".status_tag.blue").css({ 39857 "background": "#63B8FF" 39858 }); 39859 $(".status_tag.yellow").css({ 39860 "background": "#F1C40F" 39861 }); 39862 return $(".status_tag.grey").css({ 39863 "background": "#7F8FA6" 39864 }); 39865 }); 39866 39867}).call(this); 39868(function() { 39869 39870 39871}).call(this); 39872(function() { 39873 39874 39875}).call(this); 39876/* ======================================================================== 39877 * bootstrap-switch - v3.3.2 39878 * http://www.bootstrap-switch.org 39879 * ======================================================================== 39880 * Copyright 2012-2013 Mattia Larentis 39881 * 39882 * ======================================================================== 39883 * Licensed under the Apache License, Version 2.0 (the "License"); 39884 * you may not use this file except in compliance with the License. 39885 * You may obtain a copy of the License at 39886 * 39887 * http://www.apache.org/licenses/LICENSE-2.0 39888 * 39889 * Unless required by applicable law or agreed to in writing, software 39890 * distributed under the License is distributed on an "AS IS" BASIS, 39891 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 39892 * See the License for the specific language governing permissions and 39893 * limitations under the License. 39894 * ======================================================================== 39895 */ 39896 39897 39898(function() { 39899 var __slice = [].slice; 39900 39901 (function($, window) { 39902 "use strict"; 39903 var BootstrapSwitch; 39904 BootstrapSwitch = (function() { 39905 function BootstrapSwitch(element, options) { 39906 if (options == null) { 39907 options = {}; 39908 } 39909 this.$element = $(element); 39910 this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, { 39911 state: this.$element.is(":checked"), 39912 size: this.$element.data("size"), 39913 animate: this.$element.data("animate"), 39914 disabled: this.$element.is(":disabled"), 39915 readonly: this.$element.is("[readonly]"), 39916 indeterminate: this.$element.data("indeterminate"), 39917 inverse: this.$element.data("inverse"), 39918 radioAllOff: this.$element.data("radio-all-off"), 39919 onColor: this.$element.data("on-color"), 39920 offColor: this.$element.data("off-color"), 39921 onText: this.$element.data("on-text"), 39922 offText: this.$element.data("off-text"), 39923 labelText: this.$element.data("label-text"), 39924 handleWidth: this.$element.data("handle-width"), 39925 labelWidth: this.$element.data("label-width"), 39926 baseClass: this.$element.data("base-class"), 39927 wrapperClass: this.$element.data("wrapper-class") 39928 }, options); 39929 this.$wrapper = $("<div>", { 39930 "class": (function(_this) { 39931 return function() { 39932 var classes; 39933 classes = ["" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass)); 39934 classes.push(_this.options.state ? "" + _this.options.baseClass + "-on" : "" + _this.options.baseClass + "-off"); 39935 if (_this.options.size != null) { 39936 classes.push("" + _this.options.baseClass + "-" + _this.options.size); 39937 } 39938 if (_this.options.disabled) { 39939 classes.push("" + _this.options.baseClass + "-disabled"); 39940 } 39941 if (_this.options.readonly) { 39942 classes.push("" + _this.options.baseClass + "-readonly"); 39943 } 39944 if (_this.options.indeterminate) { 39945 classes.push("" + _this.options.baseClass + "-indeterminate"); 39946 } 39947 if (_this.options.inverse) { 39948 classes.push("" + _this.options.baseClass + "-inverse"); 39949 } 39950 if (_this.$element.attr("id")) { 39951 classes.push("" + _this.options.baseClass + "-id-" + (_this.$element.attr("id"))); 39952 } 39953 return classes.join(" "); 39954 }; 39955 })(this)() 39956 }); 39957 this.$container = $("<div>", { 39958 "class": "" + this.options.baseClass + "-container" 39959 }); 39960 this.$on = $("<span>", { 39961 html: this.options.onText, 39962 "class": "" + this.options.baseClass + "-handle-on " + this.options.baseClass + "-" + this.options.onColor 39963 }); 39964 this.$off = $("<span>", { 39965 html: this.options.offText, 39966 "class": "" + this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor 39967 }); 39968 this.$label = $("<span>", { 39969 html: this.options.labelText, 39970 "class": "" + this.options.baseClass + "-label" 39971 }); 39972 this.$element.on("init.bootstrapSwitch", (function(_this) { 39973 return function() { 39974 return _this.options.onInit.apply(element, arguments); 39975 }; 39976 })(this)); 39977 this.$element.on("switchChange.bootstrapSwitch", (function(_this) { 39978 return function() { 39979 return _this.options.onSwitchChange.apply(element, arguments); 39980 }; 39981 })(this)); 39982 this.$container = this.$element.wrap(this.$container).parent(); 39983 this.$wrapper = this.$container.wrap(this.$wrapper).parent(); 39984 this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off); 39985 if (this.options.indeterminate) { 39986 this.$element.prop("indeterminate", true); 39987 } 39988 this._init(); 39989 this._elementHandlers(); 39990 this._handleHandlers(); 39991 this._labelHandlers(); 39992 this._formHandler(); 39993 this._externalLabelHandler(); 39994 this.$element.trigger("init.bootstrapSwitch"); 39995 } 39996 39997 BootstrapSwitch.prototype._constructor = BootstrapSwitch; 39998 39999 BootstrapSwitch.prototype.state = function(value, skip) { 40000 if (typeof value === "undefined") { 40001 return this.options.state; 40002 } 40003 if (this.options.disabled || this.options.readonly) { 40004 return this.$element; 40005 } 40006 if (this.options.state && !this.options.radioAllOff && this.$element.is(":radio")) { 40007 return this.$element; 40008 } 40009 if (this.options.indeterminate) { 40010 this.indeterminate(false); 40011 } 40012 value = !!value; 40013 this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip); 40014 return this.$element; 40015 }; 40016 40017 BootstrapSwitch.prototype.toggleState = function(skip) { 40018 if (this.options.disabled || this.options.readonly) { 40019 return this.$element; 40020 } 40021 if (this.options.indeterminate) { 40022 this.indeterminate(false); 40023 return this.state(true); 40024 } else { 40025 return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip); 40026 } 40027 }; 40028 40029 BootstrapSwitch.prototype.size = function(value) { 40030 if (typeof value === "undefined") { 40031 return this.options.size; 40032 } 40033 if (this.options.size != null) { 40034 this.$wrapper.removeClass("" + this.options.baseClass + "-" + this.options.size); 40035 } 40036 if (value) { 40037 this.$wrapper.addClass("" + this.options.baseClass + "-" + value); 40038 } 40039 this._width(); 40040 this._containerPosition(); 40041 this.options.size = value; 40042 return this.$element; 40043 }; 40044 40045 BootstrapSwitch.prototype.animate = function(value) { 40046 if (typeof value === "undefined") { 40047 return this.options.animate; 40048 } 40049 value = !!value; 40050 if (value === this.options.animate) { 40051 return this.$element; 40052 } 40053 return this.toggleAnimate(); 40054 }; 40055 40056 BootstrapSwitch.prototype.toggleAnimate = function() { 40057 this.options.animate = !this.options.animate; 40058 this.$wrapper.toggleClass("" + this.options.baseClass + "-animate"); 40059 return this.$element; 40060 }; 40061 40062 BootstrapSwitch.prototype.disabled = function(value) { 40063 if (typeof value === "undefined") { 40064 return this.options.disabled; 40065 } 40066 value = !!value; 40067 if (value === this.options.disabled) { 40068 return this.$element; 40069 } 40070 return this.toggleDisabled(); 40071 }; 40072 40073 BootstrapSwitch.prototype.toggleDisabled = function() { 40074 this.options.disabled = !this.options.disabled; 40075 this.$element.prop("disabled", this.options.disabled); 40076 this.$wrapper.toggleClass("" + this.options.baseClass + "-disabled"); 40077 return this.$element; 40078 }; 40079 40080 BootstrapSwitch.prototype.readonly = function(value) { 40081 if (typeof value === "undefined") { 40082 return this.options.readonly; 40083 } 40084 value = !!value; 40085 if (value === this.options.readonly) { 40086 return this.$element; 40087 } 40088 return this.toggleReadonly(); 40089 }; 40090 40091 BootstrapSwitch.prototype.toggleReadonly = function() { 40092 this.options.readonly = !this.options.readonly; 40093 this.$element.prop("readonly", this.options.readonly); 40094 this.$wrapper.toggleClass("" + this.options.baseClass + "-readonly"); 40095 return this.$element; 40096 }; 40097 40098 BootstrapSwitch.prototype.indeterminate = function(value) { 40099 if (typeof value === "undefined") { 40100 return this.options.indeterminate; 40101 } 40102 value = !!value; 40103 if (value === this.options.indeterminate) { 40104 return this.$element; 40105 } 40106 return this.toggleIndeterminate(); 40107 }; 40108 40109 BootstrapSwitch.prototype.toggleIndeterminate = function() { 40110 this.options.indeterminate = !this.options.indeterminate; 40111 this.$element.prop("indeterminate", this.options.indeterminate); 40112 this.$wrapper.toggleClass("" + this.options.baseClass + "-indeterminate"); 40113 this._containerPosition(); 40114 return this.$element; 40115 }; 40116 40117 BootstrapSwitch.prototype.inverse = function(value) { 40118 if (typeof value === "undefined") { 40119 return this.options.inverse; 40120 } 40121 value = !!value; 40122 if (value === this.options.inverse) { 40123 return this.$element; 40124 } 40125 return this.toggleInverse(); 40126 }; 40127 40128 BootstrapSwitch.prototype.toggleInverse = function() { 40129 var $off, $on; 40130 this.$wrapper.toggleClass("" + this.options.baseClass + "-inverse"); 40131 $on = this.$on.clone(true); 40132 $off = this.$off.clone(true); 40133 this.$on.replaceWith($off); 40134 this.$off.replaceWith($on); 40135 this.$on = $off; 40136 this.$off = $on; 40137 this.options.inverse = !this.options.inverse; 40138 return this.$element; 40139 }; 40140 40141 BootstrapSwitch.prototype.onColor = function(value) { 40142 var color; 40143 color = this.options.onColor; 40144 if (typeof value === "undefined") { 40145 return color; 40146 } 40147 if (color != null) { 40148 this.$on.removeClass("" + this.options.baseClass + "-" + color); 40149 } 40150 this.$on.addClass("" + this.options.baseClass + "-" + value); 40151 this.options.onColor = value; 40152 return this.$element; 40153 }; 40154 40155 BootstrapSwitch.prototype.offColor = function(value) { 40156 var color; 40157 color = this.options.offColor; 40158 if (typeof value === "undefined") { 40159 return color; 40160 } 40161 if (color != null) { 40162 this.$off.removeClass("" + this.options.baseClass + "-" + color); 40163 } 40164 this.$off.addClass("" + this.options.baseClass + "-" + value); 40165 this.options.offColor = value; 40166 return this.$element; 40167 }; 40168 40169 BootstrapSwitch.prototype.onText = function(value) { 40170 if (typeof value === "undefined") { 40171 return this.options.onText; 40172 } 40173 this.$on.html(value); 40174 this._width(); 40175 this._containerPosition(); 40176 this.options.onText = value; 40177 return this.$element; 40178 }; 40179 40180 BootstrapSwitch.prototype.offText = function(value) { 40181 if (typeof value === "undefined") { 40182 return this.options.offText; 40183 } 40184 this.$off.html(value); 40185 this._width(); 40186 this._containerPosition(); 40187 this.options.offText = value; 40188 return this.$element; 40189 }; 40190 40191 BootstrapSwitch.prototype.labelText = function(value) { 40192 if (typeof value === "undefined") { 40193 return this.options.labelText; 40194 } 40195 this.$label.html(value); 40196 this._width(); 40197 this.options.labelText = value; 40198 return this.$element; 40199 }; 40200 40201 BootstrapSwitch.prototype.handleWidth = function(value) { 40202 if (typeof value === "undefined") { 40203 return this.options.handleWidth; 40204 } 40205 this.options.handleWidth = value; 40206 this._width(); 40207 this._containerPosition(); 40208 return this.$element; 40209 }; 40210 40211 BootstrapSwitch.prototype.labelWidth = function(value) { 40212 if (typeof value === "undefined") { 40213 return this.options.labelWidth; 40214 } 40215 this.options.labelWidth = value; 40216 this._width(); 40217 this._containerPosition(); 40218 return this.$element; 40219 }; 40220 40221 BootstrapSwitch.prototype.baseClass = function(value) { 40222 return this.options.baseClass; 40223 }; 40224 40225 BootstrapSwitch.prototype.wrapperClass = function(value) { 40226 if (typeof value === "undefined") { 40227 return this.options.wrapperClass; 40228 } 40229 if (!value) { 40230 value = $.fn.bootstrapSwitch.defaults.wrapperClass; 40231 } 40232 this.$wrapper.removeClass(this._getClasses(t
40232his.options.wrapperClass).join(" ")); 40233 this.$wrapper.addClass(this._getClasses(value).join(" ")); 40234 this.options.wrapperClass = value; 40235 return this.$element; 40236 }; 40237 40238 BootstrapSwitch.prototype.radioAllOff = function(value) { 40239 if (typeof value === "undefined") { 40240 return this.options.radioAllOff; 40241 } 40242 value = !!value; 40243 if (value === this.options.radioAllOff) { 40244 return this.$element; 40245 } 40246 this.options.radioAllOff = value; 40247 return this.$element; 40248 }; 40249 40250 BootstrapSwitch.prototype.onInit = function(value) { 40251 if (typeof value === "undefined") { 40252 return this.options.onInit; 40253 } 40254 if (!value) { 40255 value = $.fn.bootstrapSwitch.defaults.onInit; 40256 } 40257 this.options.onInit = value; 40258 return this.$element; 40259 }; 40260 40261 BootstrapSwitch.prototype.onSwitchChange = function(value) { 40262 if (typeof value === "undefined") { 40263 return this.options.onSwitchChange; 40264 } 40265 if (!value) { 40266 value = $.fn.bootstrapSwitch.defaults.onSwitchChange; 40267 } 40268 this.options.onSwitchChange = value; 40269 return this.$element; 40270 }; 40271 40272 BootstrapSwitch.prototype.destroy = function() { 40273 var $form; 40274 $form = this.$element.closest("form"); 40275 if ($form.length) { 40276 $form.off("reset.bootstrapSwitch").removeData("bootstrap-switch"); 40277 } 40278 this.$container.children().not(this.$element).remove(); 40279 this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch"); 40280 return this.$element; 40281 }; 40282 40283 BootstrapSwitch.prototype._width = function() { 40284 var $handles, handleWidth; 40285 $handles = this.$on.add(this.$off); 40286 $handles.add(this.$label).css("width", ""); 40287 handleWidth = this.options.handleWidth === "auto" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth; 40288 $handles.width(handleWidth); 40289 this.$label.width((function(_this) { 40290 return function(index, width) { 40291 if (_this.options.labelWidth !== "auto") { 40292 return _this.options.labelWidth; 40293 } 40294 if (width < handleWidth) { 40295 return handleWidth; 40296 } else { 40297 return width; 40298 } 40299 }; 40300 })(this)); 40301 this._handleWidth = this.$on.outerWidth(); 40302 this._labelWidth = this.$label.outerWidth(); 40303 this.$container.width((this._handleWidth * 2) + this._labelWidth); 40304 return this.$wrapper.width(this._handleWidth + this._labelWidth); 40305 }; 40306 40307 BootstrapSwitch.prototype._containerPosition = function(state, callback) { 40308 if (state == null) { 40309 state = this.options.state; 40310 } 40311 this.$container.css("margin-left", (function(_this) { 40312 return function() { 40313 var values; 40314 values = [0, "-" + _this._handleWidth + "px"]; 40315 if (_this.options.indeterminate) { 40316 return "-" + (_this._handleWidth / 2) + "px"; 40317 } 40318 if (state) { 40319 if (_this.options.inverse) { 40320 return values[1]; 40321 } else { 40322 return values[0]; 40323 } 40324 } else { 40325 if (_this.options.inverse) { 40326 return values[0]; 40327 } else { 40328 return values[1]; 40329 } 40330 } 40331 }; 40332 })(this)); 40333 if (!callback) { 40334 return; 40335 } 40336 return setTimeout(function() { 40337 return callback(); 40338 }, 50); 40339 }; 40340 40341 BootstrapSwitch.prototype._init = function() { 40342 var init, initInterval; 40343 init = (function(_this) { 40344 return function() { 40345 _this._width(); 40346 return _this._containerPosition(null, function() { 40347 if (_this.options.animate) { 40348 return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate"); 40349 } 40350 }); 40351 }; 40352 })(this); 40353 if (this.$wrapper.is(":visible")) { 40354 return init(); 40355 } 40356 return initInterval = window.setInterval((function(_this) { 40357 return function() { 40358 if (_this.$wrapper.is(":visible")) { 40359 init(); 40360 return window.clearInterval(initInterval); 40361 } 40362 }; 40363 })(this), 50); 40364 }; 40365 40366 BootstrapSwitch.prototype._elementHandlers = function() { 40367 return this.$element.on({ 40368 "change.bootstrapSwitch": (function(_this) { 40369 return function(e, skip) { 40370 var state; 40371 e.preventDefault(); 40372 e.stopImmediatePropagation(); 40373 state = _this.$element.is(":checked"); 40374 _this._containerPosition(state); 40375 if (state === _this.options.state) { 40376 return; 40377 } 40378 _this.options.state = state; 40379 _this.$wrapper.toggleClass("" + _this.options.baseClass + "-off").toggleClass("" + _this.options.baseClass + "-on"); 40380 if (!skip) { 40381 if (_this.$element.is(":radio")) { 40382 $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true); 40383 } 40384 return _this.$element.trigger("switchChange.bootstrapSwitch", [state]); 40385 } 40386 }; 40387 })(this), 40388 "focus.bootstrapSwitch": (function(_this) { 40389 return function(e) { 40390 e.preventDefault(); 40391 return _this.$wrapper.addClass("" + _this.options.baseClass + "-focused"); 40392 }; 40393 })(this), 40394 "blur.bootstrapSwitch": (function(_this) { 40395 return function(e) { 40396 e.preventDefault(); 40397 return _this.$wrapper.removeClass("" + _this.options.baseClass + "-focused"); 40398 }; 40399 })(this), 40400 "keydown.bootstrapSwitch": (function(_this) { 40401 return function(e) { 40402 if (!e.which || _this.options.disabled || _this.options.readonly) { 40403 return; 40404 } 40405 switch (e.which) { 40406 case 37: 40407 e.preventDefault(); 40408 e.stopImmediatePropagation(); 40409 return _this.state(false); 40410 case 39: 40411 e.preventDefault(); 40412 e.stopImmediatePropagation(); 40413 return _this.state(true); 40414 } 40415 }; 40416 })(this) 40417 }); 40418 }; 40419 40420 BootstrapSwitch.prototype._handleHandlers = function() { 40421 this.$on.on("click.bootstrapSwitch", (function(_this) { 40422 return function(event) { 40423 event.preventDefault(); 40424 event.stopPropagation(); 40425 _this.state(false); 40426 return _this.$element.trigger("focus.bootstrapSwitch"); 40427 }; 40428 })(this)); 40429 return this.$off.on("click.bootstrapSwitch", (function(_this) { 40430 return function(event) { 40431 event.preventDefault(); 40432 event.stopPropagation(); 40433 _this.state(true); 40434 return _this.$element.trigger("focus.bootstrapSwitch"); 40435 }; 40436 })(this)); 40437 }; 40438 40439 BootstrapSwitch.prototype._labelHandlers = function() { 40440 return this.$label.on({ 40441 "mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) { 40442 return function(e) { 40443 if (_this._dragStart || _this.options.disabled || _this.options.readonly) { 40444 return; 40445 } 40446 e.preventDefault(); 40447 e.stopPropagation(); 40448 _this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10); 40449 if (_this.options.animate) { 40450 _this.$wrapper.removeClass("" + _this.options.baseClass + "-animate"); 40451 } 40452 return _this.$element.trigger("focus.bootstrapSwitch"); 40453 }; 40454 })(this), 40455 "mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) { 40456 return function(e) { 40457 var difference; 40458 if (_this._dragStart == null) { 40459 return; 40460 } 40461 e.preventDefault(); 40462 difference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart; 40463 if (difference < -_this._handleWidth || difference > 0) { 40464 return; 40465 } 40466 _this._dragEnd = difference; 40467 return _this.$container.css("margin-left", "" + _this._dragEnd + "px"); 40468 }; 40469 })(this), 40470 "mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) { 40471 return function(e) { 40472 var state; 40473 if (!_this._dragStart) { 40474 return; 40475 } 40476 e.preventDefault(); 40477 if (_this.options.animate) { 40478 _this.$wrapper.addClass("" + _this.options.baseClass + "-animate"); 40479 } 40480 if (_this._dragEnd) { 40481 state = _this._dragEnd > -(_this._handleWidth / 2); 40482 _this._dragEnd = false;
40483 _this.state(_this.options.inverse ? !state : state); 40484 } else { 40485 _this.state(!_this.options.state); 40486 } 40487 return _this._dragStart = false; 40488 }; 40489 })(this), 40490 "mouseleave.bootstrapSwitch": (function(_this) { 40491 return function(e) { 40492 return _this.$label.trigger("mouseup.bootstrapSwitch"); 40493 }; 40494 })(this) 40495 }); 40496 }; 40497 40498 BootstrapSwitch.prototype._externalLabelHandler = function() { 40499 var $externalLabel; 40500 $externalLabel = this.$element.closest("label"); 40501 return $externalLabel.on("click", (function(_this) { 40502 return function(event) { 40503 event.preventDefault(); 40504 event.stopImmediatePropagation(); 40505 if (event.target === $externalLabel[0]) { 40506 return _this.toggleState(); 40507 } 40508 }; 40509 })(this)); 40510 }; 40511 40512 BootstrapSwitch.prototype._formHandler = function() { 40513 var $form; 40514 $form = this.$element.closest("form"); 40515 if ($form.data("bootstrap-switch")) { 40516 return; 40517 } 40518 return $form.on("reset.bootstrapSwitch", function() { 40519 return window.setTimeout(function() { 40520 return $form.find("input").filter(function() { 40521 return $(this).data("bootstrap-switch"); 40522 }).each(function() { 40523 return $(this).bootstrapSwitch("state", this.checked); 40524 }); 40525 }, 1); 40526 }).data("bootstrap-switch", true); 40527 }; 40528 40529 BootstrapSwitch.prototype._getClasses = function(classes) { 40530 var c, cls, _i, _len; 40531 if (!$.isArray(classes)) { 40532 return ["" + this.options.baseClass + "-" + classes]; 40533 } 40534 cls = []; 40535 for (_i = 0, _len = classes.length; _i < _len; _i++) { 40536 c = classes[_i]; 40537 cls.push("" + this.options.baseClass + "-" + c); 40538 } 40539 return cls; 40540 }; 40541 40542 return BootstrapSwitch; 40543 40544 })(); 40545 $.fn.bootstrapSwitch = function() { 40546 var args, option, ret; 40547 option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 40548 ret = this; 40549 this.each(function() { 40550 var $this, data; 40551 $this = $(this); 40552 data = $this.data("bootstrap-switch"); 40553 if (!data) { 40554 $this.data("bootstrap-switch", data = new BootstrapSwitch(this, option)); 40555 } 40556 if (typeof option === "string") { 40557 return ret = data[option].apply(data, args); 40558 } 40559 }); 40560 return ret; 40561 }; 40562 $.fn.bootstrapSwitch.Constructor = BootstrapSwitch; 40563 return $.fn.bootstrapSwitch.defaults = { 40564 state: true, 40565 size: null, 40566 animate: true, 40567 disabled: false, 40568 readonly: false, 40569 indeterminate: false, 40570 inverse: false, 40571 radioAllOff: false, 40572 onColor: "primary", 40573 offColor: "default", 40574 onText: "Yes", 40575 offText: "No", 40576 labelText: " ", 40577 handleWidth: "auto", 40578 labelWidth: "auto", 40579 baseClass: "bootstrap-switch", 40580 wrapperClass: "wrapper", 40581 onInit: function() {}, 40582 onSwitchChange: function() {} 40583 }; 40584 })(window.jQuery, window); 40585 40586}).call(this);var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}
40586return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);
40586if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}}); 40587/*! 40588 * Bootstrap v3.3.5 (http://getbootstrap.com) 40589 * Copyright 2011-2015 Twitter, Inc. 40590 * Licensed under the MIT license 40591 */ 40592 40593if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.5",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;
40593e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.5",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.5",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")}
vendor: 5,584 bytes, line 40593
40593,c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.5",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","fal
40593se"),e.removeClass("open").trigger("hidden.bs.dropdown",f))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.5",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.5",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("key
40593down.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.5",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focu
40593s":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.t
vendor: 6,971 bytes, lines 40593-40594
40593ype+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.5",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.5",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")), 40594d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.5",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;
40594e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.5",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); 40595!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t) 40596if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()} 40597var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".
vendor: 9,417 bytes, lines 40597-40600
40597item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")} 40598return s&&this.cycle(),this}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=(typeof n.content=="function"?n.content.call(t[0]):n.content)||t.attr("data-content"),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll-spy.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()} 40599t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var n=e(this),r=n.data("target")||n.attr("href"),i=/^#\w/.test(r)&&e(r);return i&&i.length&&[[i.position().top+(!e.isWindow(t.$scrollElement.get(0))&&t.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active:last a")[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()} 40600var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("key
40600down",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()} 40601e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()} 40602e.stopPropagation(),e.preventDefault()},focus:function(e){this.focused=!0},blur:function(e){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;n.typeahead(n.data())})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var t=e(document).height(),n=this.$window.scrollTop(),r=this.$element.offset(),i=this.options.offset,s=i.bottom,o=i.top,u="affix affix-top affix-bottom",a;typeof i!="object"&&(s=o=i),typeof o=="function"&&(o=i.top()),typeof s=="function"&&(s=i.bottom()),a=this.unpin!=null&&n+this.unpin<=r.top?!1:s!=null&&r.top+this.$element.height()>=t-s?"bottom":o!=null&&n<=o?"top":!1;if(this.affixed===a)return;this.affixed=a,this.unpin=a=="bottom"?r.top-n:null,this.$element.removeClass(u).addClass("affix"+(a?"-"+a:""))};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var r=e(this),i=r.data("affix"),s=typeof n=="object"&&n;i||r.data("affix",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery); 40603/*! 40604 * classie - class helper functions 40605 * from bonzo https://github.com/ded/bonzo 40606 * 40607 * classie.has( elem, 'my-class' ) -> true/false 40608 * classie.add( elem, 'my-new-class' ) 40609 * classie.remove( elem, 'my-unwanted-class' ) 40610 * classie.toggle( elem, 'my-class' ) 40611 */ 40612 40613/*jshint browser: true, strict: true, undef: true */ 40614 40615 40616( function( window ) { 40617 40618'use strict'; 40619 40620// class helper functions from bonzo https://github.com/ded/bonzo 40621 40622function classReg( className ) { 40623 return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); 40624} 40625 40626// classList support for class management 40627// altho to be fair, the api sucks because it won't accept multiple classes at once 40628var hasClass, addClass, removeClass; 40629 40630if ( 'classList' in document.documentElement ) { 40631 hasClass = function( elem, c ) { 40632 return elem.classList.contains( c ); 40633 }; 40634 addClass = function( elem, c ) { 40635 elem.classList.add( c ); 40636 }; 40637 removeClass = function( elem, c ) { 40638 elem.classList.remove( c ); 40639 }; 40640} 40641else { 40642 hasClass = function( elem, c ) { 40643 return classReg( c ).test( elem.className ); 40644 }; 40645 addClass = function( elem, c ) { 40646 if ( !hasClass( elem, c ) ) { 40647 elem.className = elem.className + ' ' + c; 40648 } 40649 }; 40650 removeClass = function( elem, c ) { 40651 elem.className = elem.className.replace( classReg( c ), ' ' ); 40652 }; 40653} 40654 40655function toggleClass( elem, c ) { 40656 var fn = hasClass( elem, c ) ? removeClass : addClass; 40657 fn( elem, c ); 40658} 40659 40660window.classie = { 40661 // full names 40662 hasClass: hasClass, 40663 addClass: addClass, 40664 removeClass: removeClass, 40665 toggleClass: toggleClass, 40666 // short names 40667 has: hasClass, 40668 add: addClass, 40669 remove: removeClass, 40670 toggle: toggleClass 40671}; 40672 40673})( window ); 40674(function() { 40675 var depositpayment; 40676 40677 jQuery(function() { 40678 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 40679 return depositpayment.setupForm(); 40680 }); 40681 40682 depositpayment = { 40683 setupForm: function() { 40684 return $('#new_depositpayment').submit(function() { 40685 $('input[type=submit]').attr('disabled', true); 40686 if ($('#card_number').length) { 40687 depositpayment.processCard(); 40688 return false;
40689 } else { 40690 return true; 40691 } 40692 }); 40693 }, 40694 processCard: function() { 40695 var card; 40696 card = { 40697 number: $('#card_number').val(), 40698 cvc: $('#card_code').val(), 40699 expMonth: $('#card_month').val(), 40700 expYear: $('#card_year').val() 40701 }; 40702 return Stripe.createToken(card, depositpayment.handleStripeResponse); 40703 }, 40704 handleStripeResponse: function(status, response) { 40705 if (status === 200) { 40706 $("#process").html("Processing payment"); 40707 $('#depositpayment_stripeToken').val(response.id); 40708 $('#new_depositpayment')[0].submit(); 40709 } else { 40710 40711 } 40712 if ($('#whopays').val() === 'Landlord') { 40713 $('#new_depositpayment')[0].submit(); 40714 } else { 40715 40716 } 40717 if ($('#whopays').val() === 'Paypal') { 40718 return $('#new_depositpayment')[0].submit(); 40719 } else { 40720 $('#stripe_error').text(response.error.message); 40721 return $('input[type=submit]').attr('disabled', false); 40722 } 40723 } 40724 }; 40725 40726}).call(this); 40727var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}
40727return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10}
40727,{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}}); 40728/*! 40729 * html2canvas 1.0.0-rc.7 <https://html2canvas.hertzen.com> 40730 * Copyright (c) 2020 Niklas von Hertzen <https://hertzen.com> 40731 * Released under MIT License 40732 */ 40733 40734(function (global, factory) { 40735 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 40736 typeof define === 'function' && define.amd ? define(factory) : 40737 (global = global || self, global.html2canvas = factory()); 40738}(this, function () { 'use strict'; 40739 40740 /*! ***************************************************************************** 40741 Copyright (c) Microsoft Corporation. All rights reserved. 40742 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 40743 this file except in compliance with the License. You may obtain a copy of the 40744 License at http://www.apache.org/licenses/LICENSE-2.0 40745 40746 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 40747 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 40748 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 40749 MERCHANTABLITY OR NON-INFRINGEMENT. 40750 40751 See the Apache Version 2.0 License for specific language governing permissions 40752 and limitations under the License. 40753 ***************************************************************************** */ 40754 /* global Reflect, Promise */ 40755 40756 var extendStatics = function(d, b) { 40757 extendStatics = Object.setPrototypeOf || 40758 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 40759 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 40760 return extendStatics(d, b); 40761 }; 40762 40763 function __extends(d, b) { 40764 extendStatics(d, b); 40765 function __() { this.constructor = d; } 40766 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 40767 } 40768 40769 var __assign = function() { 40770 __assign = Object.assign || function __assign(t) { 40771 for (var s, i = 1, n = arguments.length; i < n; i++) { 40772 s = arguments[i]; 40773 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 40774 } 40775 return t; 40776 }; 40777 return __assign.apply(this, arguments); 40778 }; 40779 40780 function __awaiter(thisArg, _arguments, P, generator) { 40781 return new (P || (P = Promise))(function (resolve, reject) { 40782 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 40783 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 40784 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 40785 step((generator = generator.apply(thisArg, _arguments || [])).next()); 40786 }); 40787 } 40788 40789 function __generator(thisArg, body) { 40790 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 40791 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 40792 function verb(n) { return function (v) { return step([n, v]); }; } 40793 function step(op) { 40794 if (f) throw new TypeError("Generator is already executing."); 40795 while (_) try {
vendor: 19,211 bytes, lines 40796-41089
40796 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 40797 if (y = 0, t) op = [op[0] & 2, t.value]; 40798 switch (op[0]) { 40799 case 0: case 1: t = op; break; 40800 case 4: _.label++; return { value: op[1], done: false }; 40801 case 5: _.label++; y = op[1]; op = [0]; continue; 40802 case 7: op = _.ops.pop(); _.trys.pop(); continue; 40803 default: 40804 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 40805 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 40806 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 40807 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 40808 if (t[2]) _.ops.pop(); 40809 _.trys.pop(); continue; 40810 } 40811 op = body.call(thisArg, _); 40812 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 40813 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 40814 } 40815 } 40816 40817 var Bounds = /** @class */ (function () { 40818 function Bounds(x, y, w, h) { 40819 this.left = x; 40820 this.top = y; 40821 this.width = w; 40822 this.height = h; 40823 } 40824 Bounds.prototype.add = function (x, y, w, h) { 40825 return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h); 40826 }; 40827 Bounds.fromClientRect = function (clientRect) { 40828 return new Bounds(clientRect.left, clientRect.top, clientRect.width, clientRect.height); 40829 }; 40830 return Bounds; 40831 }()); 40832 var parseBounds = function (node) { 40833 return Bounds.fromClientRect(node.getBoundingClientRect()); 40834 }; 40835 var parseDocumentSize = function (document) { 40836 var body = document.body; 40837 var documentElement = document.documentElement; 40838 if (!body || !documentElement) { 40839 throw new Error("Unable to get document size"); 40840 } 40841 var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth)); 40842 var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight)); 40843 return new Bounds(0, 0, width, height); 40844 }; 40845 40846 /* 40847 * css-line-break 1.1.1 <https://github.com/niklasvh/css-line-break#readme> 40848 * Copyright (c) 2019 Niklas von Hertzen <https://hertzen.com> 40849 * Released under MIT License 40850 */ 40851 var toCodePoints = function (str) { 40852 var codePoints = []; 40853 var i = 0; 40854 var length = str.length; 40855 while (i < length) { 40856 var value = str.charCodeAt(i++); 40857 if (value >= 0xd800 && value <= 0xdbff && i < length) { 40858 var extra = str.charCodeAt(i++); 40859 if ((extra & 0xfc00) === 0xdc00) { 40860 codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000); 40861 } 40862 else { 40863 codePoints.push(value); 40864 i--; 40865 } 40866 } 40867 else { 40868 codePoints.push(value); 40869 } 40870 } 40871 return codePoints; 40872 }; 40873 var fromCodePoint = function () { 40874 var codePoints = []; 40875 for (var _i = 0; _i < arguments.length; _i++) { 40876 codePoints[_i] = arguments[_i]; 40877 } 40878 if (String.fromCodePoint) { 40879 return String.fromCodePoint.apply(String, codePoints); 40880 } 40881 var length = codePoints.length; 40882 if (!length) { 40883 return ''; 40884 } 40885 var codeUnits = []; 40886 var index = -1; 40887 var result = ''; 40888 while (++index < length) { 40889 var codePoint = codePoints[index]; 40890 if (codePoint <= 0xffff) { 40891 codeUnits.push(codePoint); 40892 } 40893 else { 40894 codePoint -= 0x10000; 40895 codeUnits.push((codePoint >> 10) + 0xd800, codePoint % 0x400 + 0xdc00); 40896 } 40897 if (index + 1 === length || codeUnits.length > 0x4000) { 40898 result += String.fromCharCode.apply(String, codeUnits); 40899 codeUnits.length = 0; 40900 } 40901 } 40902 return result; 40903 }; 40904 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; 40905 // Use a lookup table to find the index. 40906 var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); 40907 for (var i = 0; i < chars.length; i++) { 40908 lookup[chars.charCodeAt(i)] = i; 40909 } 40910 var decode = function (base64) { 40911 var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; 40912 if (base64[base64.length - 1] === '=') { 40913 bufferLength--; 40914 if (base64[base64.length - 2] === '=') { 40915 bufferLength--; 40916 } 40917 } 40918 var buffer = typeof ArrayBuffer !== 'undefined' && 40919 typeof Uint8Array !== 'undefined' && 40920 typeof Uint8Array.prototype.slice !== 'undefined' 40921 ? new ArrayBuffer(bufferLength) 40922 : new Array(bufferLength); 40923 var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer); 40924 for (i = 0; i < len; i += 4) { 40925 encoded1 = lookup[base64.charCodeAt(i)]; 40926 encoded2 = lookup[base64.charCodeAt(i + 1)]; 40927 encoded3 = lookup[base64.charCodeAt(i + 2)]; 40928 encoded4 = lookup[base64.charCodeAt(i + 3)]; 40929 bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); 40930 bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); 40931 bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); 40932 } 40933 return buffer; 40934 }; 40935 var polyUint16Array = function (buffer) { 40936 var length = buffer.length; 40937 var bytes = []; 40938 for (var i = 0; i < length; i += 2) { 40939 bytes.push((buffer[i + 1] << 8) | buffer[i]); 40940 } 40941 return bytes; 40942 }; 40943 var polyUint32Array = function (buffer) { 40944 var length = buffer.length; 40945 var bytes = []; 40946 for (var i = 0; i < length; i += 4) { 40947 bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]); 40948 } 40949 return bytes; 40950 }; 40951 40952 /** Shift size for getting the index-2 table offset. */ 40953 var UTRIE2_SHIFT_2 = 5; 40954 /** Shift size for getting the index-1 table offset. */ 40955 var UTRIE2_SHIFT_1 = 6 + 5; 40956 /** 40957 * Shift size for shifting left the index array values. 40958 * Increases possible data size with 16-bit index values at the cost 40959 * of compactability. 40960 * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY. 40961 */ 40962 var UTRIE2_INDEX_SHIFT = 2; 40963 /** 40964 * Difference between the two shift sizes, 40965 * for getting an index-1 offset from an index-2 offset. 6=11-5 40966 */ 40967 var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2; 40968 /** 40969 * The part of the index-2 table for U+D800..U+DBFF stores values for 40970 * lead surrogate code _units_ not code _points_. 40971 * Values for lead surrogate code _points_ are indexed with this portion of the table. 40972 * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) 40973 */ 40974 var UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2; 40975 /** Number of entries in a data block. 32=0x20 */ 40976 var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2; 40977 /** Mask for getting the lower bits for the in-data-block offset. */ 40978 var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1; 40979 var UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2; 40980 /** Count the lengths of both BMP pieces. 2080=0x820 */ 40981 var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH; 40982 /** 40983 * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. 40984 * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. 40985 */ 40986 var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH; 40987 var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */ 40988 /** 40989 * The index-1 table, only used for supplementary code points, at offset 2112=0x840. 40990 * Variable length, for code points up to highStart, where the last single-value range starts. 40991 * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. 40992 * (For 0x100000 supplementary code points U+10000..U+10ffff.) 40993 * 40994 * The part of the index-2 table for supplementary code points starts 40995 * after this index-1 table. 40996 * 40997 * Both the index-1 table and the following part of the index-2 table 40998 * are omitted completely if there is only BMP data. 40999 */ 41000 var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH; 41001 /** 41002 * Number of index-1 entries for the BMP. 32=0x20 41003 * This part of the index-1 table is omitted from the serialized form. 41004 */ 41005 var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1; 41006 /** Number of entries in an index-2 block. 64=0x40 */ 41007 var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2; 41008 /** Mask for getting the lower bits for the in-index-2-block offset. */ 41009 var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1; 41010 var slice16 = function (view, start, end) { 41011 if (view.slice) { 41012 return view.slice(start, end); 41013 } 41014 return new Uint16Array(Array.prototype.slice.call(view, start, end)); 41015 }; 41016 var slice32 = function (view, start, end) { 41017 if (view.slice) { 41018 return view.slice(start, end); 41019 } 41020 return new Uint32Array(Array.prototype.slice.call(view, start, end)); 41021 }; 41022 var createTrieFromBase64 = function (base64) { 41023 var buffer = decode(base64); 41024 var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer); 41025 var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer); 41026 var headerLength = 24; 41027 var index = slice16(view16, headerLength / 2, view32[4] / 2); 41028 var data = view32[5] === 2 41029 ? slice16(view16, (headerLength + view32[4]) / 2) 41030 : slice32(view32, Math.ceil((headerLength + view32[4]) / 4)); 41031 return new Trie(view32[0], view32[1], view32[2], view32[3], index, data); 41032 }; 41033 var Trie = /** @class */ (function () { 41034 function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) { 41035 this.initialValue = initialValue; 41036 this.errorValue = errorValue; 41037 this.highStart = highStart; 41038 this.highValueIndex = highValueIndex; 41039 this.index = index; 41040 this.data = data; 41041 } 41042 /** 41043 * Get the value for a code point as stored in the Trie. 41044 * 41045 * @param codePoint the code point 41046 * @return the value 41047 */ 41048 Trie.prototype.get = function (codePoint) { 41049 var ix; 41050 if (codePoint >= 0) { 41051 if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) { 41052 // Ordinary BMP code point, excluding leading surrogates. 41053 // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. 41054 // 16 bit data is stored in the index array itself. 41055 ix = this.index[codePoint >> UTRIE2_SHIFT_2]; 41056 ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); 41057 return this.data[ix]; 41058 } 41059 if (codePoint <= 0xffff) { 41060 // Lead Surrogate Code Point. A Separate index section is stored for 41061 // lead surrogate code units and code points. 41062 // The main index has the code unit data. 41063 // For this function, we need the code point data. 41064 // Note: this expression could be refactored for slightly improved efficiency, but 41065 // surrogate code points will be so rare in practice that it's not worth it. 41066 ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2)]; 41067 ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); 41068 return this.data[ix]; 41069 } 41070 if (codePoint < this.highStart) { 41071 // Supplemental code point, use two-level lookup. 41072 ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1); 41073 ix = this.index[ix]; 41074 ix += (codePoint >> UTRIE2_SHIFT_2) & UTRIE2_INDEX_2_MASK; 41075 ix = this.index[ix]; 41076 ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); 41077 return this.data[ix]; 41078 } 41079 if (codePoint <= 0x10ffff) { 41080 return this.data[this.highValueIndex]; 41081 } 41082 } 41083 // Fall through. The code point is outside of the legal range of 0..0x10ffff. 41084 return this.errorValue; 41085 }; 41086 return Trie; 41087 }()); 41088 41089 var base64 = 'KwAAAAAAAAAACA4AIDoAAPAfAAACAAAAAAAIABAAGABAAEgAUABYAF4AZgBeAGYAYABoAHAAeABeAGYAfACEAIAAiACQAJgAoACoAK0AtQC9AMUAXgBmAF4AZgBeAGYAzQDVAF4AZgDRANkA3gDmAOwA9AD8AAQBDAEUARoBIgGAAIgAJwEvATcBPwFFAU0BTAFUAVwBZAFsAXMBewGDATAAiwGTAZsBogGkAawBtAG8AcIBygHSAdoB4AHoAfAB+AH+AQYCDgIWAv4BHgImAi4CNgI+AkUCTQJTAlsCYwJrAnECeQKBAk0CiQKRApkCoQKoArACuALAAsQCzAIwANQC3ALkAjAA7AL0AvwCAQMJAxADGAMwACADJgMuAzYDPgOAAEYDSgNSA1IDUgNaA1oDYANiA2IDgACAAGoDgAByA3YDfgOAAIQDgACKA5IDmgOAAIAAogOqA4AAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAK8DtwOAAIAAvwPHA88D1wPfAyAD5wPsA/QD/AOAAIAABAQMBBIEgAAWBB4EJgQuBDMEIAM7BEEEXgBJBCADUQRZBGEEaQQwADAAcQQ+AXkEgQSJBJEEgACYBIAAoASoBK8EtwQwAL8ExQSAAIAAgACAAIAAgACgAM0EXgBeAF4AXgBeAF4AXgBeANUEXgDZBOEEXgDpBPEE+QQBBQkFEQUZBSEFKQUxBTUFPQVFBUwFVAVcBV4AYwVeAGsFcwV7BYMFiwWSBV4AmgWgBacFXgBeAF4AXgBeAKsFXgCyBbEFugW7BcIFwgXIBcIFwgXQBdQF3AXkBesF8wX7BQMGCwYTBhsGIwYrBjMGOwZeAD8GRwZNBl4AVAZbBl4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAGMGXgBqBnEGXgBeAF4AXgBeAF4AXgBeAF4AXgB5BoAG4wSGBo4GkwaAAIADHgR5AF4AXgBeAJsGgABGA4AAowarBrMGswagALsGwwbLBjAA0wbaBtoG3QbaBtoG2gbaBtoG2gblBusG8wb7BgMHCwcTBxsHCwcjBysHMAc1BzUHOgdCB9oGSgdSB1oHYAfaBloHaAfaBlIH2gbaBtoG2gbaBtoG2gbaBjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHbQdeAF4ANQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQd1B30HNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B4MH2gaKB68EgACAAIAAgACAAIAAgACAAI8HlwdeAJ8HpweAAIAArwe3B14AXgC/B8UHygcwANAH2AfgB4AA6AfwBz4B+AcACFwBCAgPCBcIogEYAR8IJwiAAC8INwg/CCADRwhPCFcIXwhnCEoDGgSAAIAAgABvCHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIhAiLCI4IMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAANQc1BzUHNQc1BzUHNQc1BzUHNQc1B54INQc1B6II2gaqCLIIugiAAIAAvgjGCIAAgACAAIAAgACAAIAAgACAAIAAywiHAYAA0wiAANkI3QjlCO0I9Aj8CIAAgACAAAIJCgkSCRoJIgknCTYHLwk3CZYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiAAIAAAAFAA
41089XgBeAGAAcABeAHwAQACQAKAArQC9AJ4AXgBeAE0A3gBRAN4A7AD8AMwBGgEAAKcBNwEFAUwBXAF4QkhCmEKnArcCgAHHAsABz4LAAcABwAHAAd+C6ABoAG+C/4LAAcABwAHAAc+DF4MAAcAB54M3gweDV4Nng3eDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEeDqABVg6WDqABoQ6gAaABoAHXDvcONw/3DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DncPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB7cPPwlGCU4JMACAAIAAgABWCV4JYQmAAGkJcAl4CXwJgAkwADAAMAAwAIgJgACLCZMJgACZCZ8JowmrCYAAswkwAF4AXgB8AIAAuwkABMMJyQmAAM4JgADVCTAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAqwYWBNkIMAAwADAAMADdCeAJ6AnuCR4E9gkwAP4JBQoNCjAAMACAABUK0wiAAB0KJAosCjQKgAAwADwKQwqAAEsKvQmdCVMKWwowADAAgACAALcEMACAAGMKgABrCjAAMAAwADAAMAAwADAAMAAwADAAMAAeBDAAMAAwADAAMAAwADAAMAAwADAAMAAwAIkEPQFzCnoKiQSCCooKkAqJBJgKoAqkCokEGAGsCrQKvArBCjAAMADJCtEKFQHZCuEK/gHpCvEKMAAwADAAMACAAIwE+QowAIAAPwEBCzAAMAAwADAAMACAAAkLEQswAIAAPwEZCyELgAAOCCkLMAAxCzkLMAAwADAAMAAwADAAXgBeAEELMAAwADAAMAAwADAAMAAwAEkLTQtVC4AAXAtkC4AAiQkwADAAMAAwADAAMAAwADAAbAtxC3kLgAuFC4sLMAAwAJMLlwufCzAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAApwswADAAMACAAIAAgACvC4AAgACAAIAAgACAALcLMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAvwuAAMcLgACAAIAAgACAAIAAyguAAIAAgACAAIAA0QswADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAANkLgACAAIAA4AswADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACJCR4E6AswADAAhwHwC4AA+AsADAgMEAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMACAAIAAGAwdDCUMMAAwAC0MNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQw1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHPQwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADUHNQc1BzUHNQc1BzUHNQc2BzAAMAA5DDUHNQc1BzUHNQc1BzUHNQc1BzUHNQdFDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAATQxSDFoMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAF4AXgBeAF4AXgBeAF4AYgxeAGoMXgBxDHkMfwxeAIUMXgBeAI0MMAAwADAAMAAwAF4AXgCVDJ0MMAAwADAAMABeAF4ApQxeAKsMswy7DF4Awgy9DMoMXgBeAF4AXgBeAF4AXgBeAF4AXgDRDNkMeQBqCeAM3Ax8AOYM7Az0DPgMXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgCgAAANoAAHDQ4NFg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAeDSYNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAC4NMABeAF4ANg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAD4NRg1ODVYNXg1mDTAAbQ0wADAAMAAwADAAMAAwADAA2gbaBtoG2gbaBtoG2gbaBnUNeg3CBYANwgWFDdoGjA3aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gaUDZwNpA2oDdoG2gawDbcNvw3HDdoG2gbPDdYN3A3fDeYN2gbsDfMN2gbaBvoN/g3aBgYODg7aBl4AXgBeABYOXgBeACUG2gYeDl4AJA5eACwO2w3aBtoGMQ45DtoG2gbaBtoGQQ7aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B1EO2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQdZDjUHNQc1BzUHNQc1B2EONQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHaA41BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B3AO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B2EO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBkkOeA6gAKAAoAAwADAAMAAwA
41089KAAoACgAKAAoACgAKAAgA4wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAD//wQABAAEAAQABAAEAAQABAAEAA0AAwABAAEAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAKABMAFwAeABsAGgAeABcAFgASAB4AGwAYAA8AGAAcAEsASwBLAEsASwBLAEsASwBLAEsAGAAYAB4AHgAeABMAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAFgAbABIAHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYADQARAB4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkAFgAaABsAGwAbAB4AHQAdAB4ATwAXAB4ADQAeAB4AGgAbAE8ATwAOAFAAHQAdAB0ATwBPABcATwBPAE8AFgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwArAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAAQABAANAA0ASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAUAArACsAKwArACsAKwArACsABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAGgAaAFAAUABQAFAAUABMAB4AGwBQAB4AKwArACsABAAEAAQAKwBQAFAAUABQAFAAUAArACsAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUAArAFAAUAArACsABAArAAQABAAEAAQABAArACsAKwArAAQABAArACsABAAEAAQAKwArACsABAArACsAKwArACsAKwArAFAAUABQAFAAKwBQACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwAEAAQAUABQAFAABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQAKwArAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeABsAKwArACsAKwArACsAKwBQAAQABAAEAAQABAAEACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAKwArACsAKwArACsAKwArAAQABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwAEAFAAKwBQAFAAUABQAFAAUAArACsAKwBQAFAAUAArAFAAUABQAFAAKwArACsAUABQACsAUAArAFAAUAArACsAKwBQAFAAKwArACsAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQAKwArACsABAAEAAQAKwAEAAQABAAEACsAKwBQACsAKwArACsAKwArAAQAKwArACsAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAB4AHgAeAB4AHgAeABsAHgArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArAFAAUABQACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAB4AUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArACsAKwArACsAKwArAFAAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwArAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAKwBcAFwAKwBcACsAKwBcACsAKwArACsAKwArAFwAXABcAFwAKwBcAFwAXABcAFwAXABcACsAXABcAFwAKwBcACsAXAArACsAXABcACsAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgArACoAKgBcACsAKwBcAFwAXABcAFwAKwBcACsAKgAqACoAKgAqACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAFwAXABcAFwAUAAOAA4ADgAOAB4ADgAOAAkADgAOAA0ACQATABMAEwATABMACQAeABMAHgAeAB4ABAAEAB4AHgAeAB4AHgAeAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUAANAAQAHgAEAB4ABAAWABEAFgARAAQABABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAAQABAAEAAQABAANAAQABABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsADQANAB4AHgAeAB4AHgAeAAQAHgAeAB4AHgAeAB4AKwAeAB4ADgAOAA0ADgAeAB4AHgAeAB4ACQAJACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgAeAB4AHgBcAFwAXABcAFwAXAAqACoAKgAqAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAKgAqACoAKgAqACoAKgBcAFwAXAAqACoAKgAqAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAXAAqAEsASwBLAEsASwBLAEsASwBLAEsAKgAqACoAKgAqACoAUABQAFAAUABQAFAAKwBQACsAKwArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQACsAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwAEAAQABAAeAA0AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAEQArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAADQANAA0AUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAA0ADQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoADQANABUAXAANAB4ADQAbAFwAKgArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAB4AHgATABMADQANAA4AHgATABMAHgAEAAQABAAJACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAUABQAFAAUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwAeACsAKwArABMAEwBLAEsASwBLAEsASwBLAEsASwBLAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwBcAFwAXABcAFwAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcACsAKwArACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwAeAB4AXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsABABLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKgAqACoAKgAqACoAKgBcACoAKgAqACoAKgAqACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAUABQAFAAUABQAFAAUAArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4ADQANAA0ADQAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAHgAeAB4AHgBQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwANAA0ADQANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwBQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsABAAEAAQAHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAABABQAFAAUABQAAQABAAEAFAAUAAEAAQABAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAKwBQACsAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAKwArAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAKwAeAB4AHgAeAB4AHgAeAA4AHgArAA0ADQANAA0ADQANAA0ACQANAA0ADQAIAAQACwAEAAQADQAJAA0ADQAMAB0AHQAeABcAFwAWABcAFwAXABYAFwAdAB0AHgAeABQAFAAUAA0AAQABAAQABAAEAAQABAAJABoAGgAaABoAGgAaABoAGgAeABcAFwAdABUAFQAeAB4AHgAeAB4AHgAYABYAEQAVABUAFQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgANAB4ADQANAA0ADQAeAA0ADQANAAcAHgAeAB4AHgArAAQABAAEAAQABAAEAAQABAAEAAQAUABQACsAKwBPAFAAUABQAFAAUAAeAB4AHgAWABEATwBQAE8ATwBPAE8AUABQAFAAUABQAB4AHgAeABYAEQArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGgAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgBQABoAHgAdAB4AUAAeABoAHgAeAB4AHgAeAB4AHgAeAB4ATwAeAFAAGwAeAB4AUABQAFAAUABQAB4AHgAeAB0AH
41089QAeAFAAHgBQAB4AUAAeAFAATwBQAFAAHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AUABQAFAAUABPAE8AUABQAFAAUABQAE8AUABQAE8AUABPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAE8ATwBPAE8ATwBPAE8ATwBPAE8AUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAATwAeAB4AKwArACsAKwAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB0AHQAeAB4AHgAdAB0AHgAeAB0AHgAeAB4AHQAeAB0AGwAbAB4AHQAeAB4AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB0AHgAdAB4AHQAdAB0AHQAdAB0AHgAdAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAdAB0AHQAdAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAlACUAHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQBPAE8ATw
41089BPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB0AHQAeAB4AHgAeAB0AHQAdAB4AHgAdAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB0AHQAeAB4AHQAeAB4AHgAeAB0AHQAeAB4AHgAeACUAJQAdAB0AJQAeACUAJQAlACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHQAdAB0AHgAdACUAHQAdAB4AHQAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHQAdAB0AHQAlAB4AJQAlACUAHQAlACUAHQAdAB0AJQAlAB0AHQAlAB0AHQAlACUAJQAeAB0AHgAeAB4AHgAdAB0AJQAdAB0AHQAdAB0AHQAlACUAJQAlACUAHQAlACUAIAAlAB0AHQAlACUAJQAlACUAJQAlACUAHgAeAB4AJQAlACAAIAAgACAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeABcAFwAXABcAFwAXAB4AEwATACUAHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACUAJQBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwArACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAE8ATw
41089BPAE8ATwBPAE8ATwAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeACsAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUAArACsAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQBQAFAAUABQACsAKwArACsAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAABAAEAAQAKwAEAAQAKwArACsAKwArAAQABAAEAAQAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsABAAEAAQAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsADQANAA0ADQANAA0ADQANAB4AKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAUABQAFAAUABQAA0ADQANAA0ADQANABQAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwANAA0ADQANAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAeAAQABAAEAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLACsADQArAB4AKwArAAQABAAEAAQAUABQAB4AUAArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwAEAAQABAAEAAQABAAEAAQABAAOAA0ADQATABMAHgAeAB4ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0AUABQAFAAUAAEAAQAKwArAAQADQANAB4AUAArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXABcAA0ADQANACoASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUAArACsAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANACsADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEcARwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwAeAAQABAANAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAEAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUAArACsAUAArACsAUABQACsAKwBQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAeAB4ADQANAA0ADQAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAArAAQABAArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAEAAQABAAEAAQABAAEACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAFgAWAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAKwBQACsAKwArACsAKwArAFAAKwArACsAKwBQACsAUAArAFAAKwBQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQACsAUAArAFAAKwBQACsAUABQACsAUAArACsAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAUABQAFAAUAArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUA
vendor: 66,888 bytes, lines 41089-42565
41089BQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUAArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAlACUAJQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeACUAJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeACUAJQAlACUAJQAeACUAJQAlACUAJQAgACAAIAAlACUAIAAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIQAhACEAIQAhACUAJQAgACAAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAIAAlACUAJQAlACAAJQAgACAAIAAgACAAIAAgACAAIAAlACUAJQAgACUAJQAlACUAIAAgACAAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeACUAHgAlAB4AJQAlACUAJQAlACAAJQAlACUAJQAeACUAHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAIAAgACAAIAAgAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFwAXABcAFQAVABUAHgAeAB4AHgAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAlACAAIAAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsA'; 41090 41091 /* @flow */ 41092 var LETTER_NUMBER_MODIFIER = 50; 41093 // Non-tailorable Line Breaking Classes 41094 var BK = 1; // Cause a line break (after) 41095 var CR = 2; // Cause a line break (after), except between CR and LF 41096 var LF = 3; // Cause a line break (after) 41097 var CM = 4; // Prohibit a line break between the character and the preceding character 41098 var NL = 5; // Cause a line break (after) 41099 var WJ = 7; // Prohibit line breaks before and after 41100 var ZW = 8; // Provide a break opportunity 41101 var GL = 9; // Prohibit line breaks before and after 41102 var SP = 10; // Enable indirect line breaks 41103 var ZWJ = 11; // Prohibit line breaks within joiner sequences 41104 // Break Opportunities 41105 var B2 = 12; // Provide a line break opportunity before and after the character 41106 var BA = 13; // Generally provide a line break opportunity after the character 41107 var BB = 14; // Generally provide a line break opportunity before the character 41108 var HY = 15; // Provide a line break opportunity after the character, except in numeric context 41109 var CB = 16; // Provide a line break opportunity contingent on additional information 41110 // Characters Prohibiting Certain Breaks 41111 var CL = 17; // Prohibit line breaks before 41112 var CP = 18; // Prohibit line breaks before 41113 var EX = 19; // Prohibit line breaks before 41114 var IN = 20; // Allow only indirect line breaks between pairs 41115 var NS = 21; // Allow only indirect line breaks before 41116 var OP = 22; // Prohibit line breaks after 41117 var QU = 23; // Act like they are both opening and closing 41118 // Numeric Context 41119 var IS = 24; // Prevent breaks after any and before numeric 41120 var NU = 25; // Form numeric expressions for line breaking purposes 41121 var PO = 26; // Do not break following a numeric expression 41122 var PR = 27; // Do not break in front of a numeric expression 41123 var SY = 28; // Prevent a break before; and allow a break after 41124 // Other Characters 41125 var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID 41126 var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters 41127 var CJ = 31; // Treat as NS or ID for strict or normal breaking. 41128 var EB = 32; // Do not break from following Emoji Modifier 41129 var EM = 33; // Do not break from preceding Emoji Base 41130 var H2 = 34; // Form Korean syllable blocks 41131 var H3 = 35; // Form Korean syllable blocks 41132 var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic 41133 var ID = 37; // Break before or after; except in some numeric context 41134 var JL = 38; // Form Korean syllable blocks 41135 var JV = 39; // Form Korean syllable blocks 41136 var JT = 40; // Form Korean syllable blocks 41137 var RI = 41; // Keep pairs together. For pairs; break before and after other classes 41138 var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis 41139 var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions 41140 var BREAK_MANDATORY = '!'; 41141 var BREAK_NOT_ALLOWED = 'Ã'; 41142 var BREAK_ALLOWED = '÷'; 41143 var UnicodeTrie = createTrieFromBase64(base64); 41144 var ALPHABETICS = [AL, HL]; 41145 var HARD_LINE_BREAKS = [BK, CR, LF, NL]; 41146 var SPACE = [SP, ZW]; 41147 var PREFIX_POSTFIX = [PR, PO]; 41148 var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE); 41149 var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3]; 41150 var HYPHEN = [HY, BA]; 41151 var codePointsToCharacterClasses = function (codePoints, lineBreak) { 41152 if (lineBreak === void 0) { lineBreak = 'strict'; } 41153 var types = []; 41154 var indicies = []; 41155 var categories = []; 41156 codePoints.forEach(function (codePoint, index) { 41157 var classType = UnicodeTrie.get(codePoint); 41158 if (classType > LETTER_NUMBER_MODIFIER) { 41159 categories.push(true); 41160 classType -= LETTER_NUMBER_MODIFIER; 41161 } 41162 else { 41163 categories.push(false); 41164 } 41165 if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) { 41166 // U+2010, â U+2013, ã U+301C, ã U+30A0 41167 if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) { 41168 indicies.push(index); 41169 return types.push(CB); 41170 } 41171 } 41172 if (classType === CM || classType === ZWJ) { 41173 // LB10 Treat any remaining combining mark or ZWJ as AL. 41174 if (index === 0) { 41175 indicies.push(index); 41176 return types.push(AL); 41177 } 41178 // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of 41179 // the base character in all of the following rules. Treat ZWJ as if it were CM. 41180 var prev = types[index - 1]; 41181 if (LINE_BREAKS.indexOf(prev) === -1) { 41182 indicies.push(indicies[index - 1]); 41183 return types.push(prev); 41184 } 41185 indicies.push(index); 41186 return types.push(AL); 41187 } 41188 indicies.push(index); 41189 if (classType === CJ) { 41190 return types.push(lineBreak === 'strict' ? NS : ID); 41191 } 41192 if (classType === SA) { 41193 return types.push(AL); 41194 } 41195 if (classType === AI) { 41196 return types.push(AL); 41197 } 41198 // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL 41199 // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised 41200 // to take into account the actual line breaking properties for these characters. 41201 if (classType === XX) { 41202 if ((codePoint >= 0x20000 && codePoint <= 0x2fffd) || (codePoint >= 0x30000 && codePoint <= 0x3fffd)) { 41203 return types.push(ID); 41204 } 41205 else { 41206 return types.push(AL); 41207 } 41208 } 41209 types.push(classType); 41210 }); 41211 return [indicies, types, categories]; 41212 }; 41213 var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) { 41214 var current = classTypes[currentIndex]; 41215 if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) { 41216 var i = currentIndex; 41217 while (i <= classTypes.length) { 41218 i++; 41219 var next = classTypes[i]; 41220 if (next === b) { 41221 return true; 41222 } 41223 if (next !== SP) { 41224 break; 41225 } 41226 } 41227 } 41228 if (current === SP) { 41229 var i = currentIndex; 41230 while (i > 0) { 41231 i--; 41232 var prev = classTypes[i]; 41233 if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) { 41234 var n = currentIndex; 41235 while (n <= classTypes.length) { 41236 n++; 41237 var next = classTypes[n]; 41238 if (next === b) { 41239 return true; 41240 } 41241 if (next !== SP) { 41242 break; 41243 } 41244 } 41245 } 41246 if (prev !== SP) { 41247 break; 41248 } 41249 } 41250 } 41251 return false; 41252 }; 41253 var previousNonSpaceClassType = function (currentIndex, classTypes) { 41254 var i = currentIndex; 41255 while (i >= 0) { 41256 var type = classTypes[i]; 41257 if (type === SP) { 41258 i--; 41259 } 41260 else { 41261 return type; 41262 } 41263 } 41264 return 0; 41265 }; 41266 var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) { 41267 if (indicies[index] === 0) { 41268 return BREAK_NOT_ALLOWED; 41269 } 41270 var currentIndex = index - 1; 41271 if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) { 41272 return BREAK_NOT_ALLOWED; 41273 } 41274 var beforeIndex = currentIndex - 1; 41275 var afterIndex = currentIndex + 1; 41276 var current = classTypes[currentIndex]; 41277 // LB4 Always break after hard line breaks. 41278 // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks. 41279 var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0; 41280 var next = classTypes[afterIndex]; 41281 if (current === CR && next === LF) { 41282 return BREAK_NOT_ALLOWED; 41283 } 41284 if (HARD_LINE_BREAKS.indexOf(current) !== -1) { 41285 return BREAK_MANDATORY; 41286 } 41287 // LB6 Do not break before hard line breaks. 41288 if (HARD_LINE_BREAKS.indexOf(next) !== -1) { 41289 return BREAK_NOT_ALLOWED; 41290 } 41291 // LB7 Do not break before spaces or zero width space. 41292 if (SPACE.indexOf(next) !== -1) { 41293 return BREAK_NOT_ALLOWED; 41294 } 41295 // LB8 Break before any character following a zero-width space, even if one or more spaces intervene. 41296 if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) { 41297 return BREAK_ALLOWED; 41298 } 41299 // LB8a Do not break between a zero width joiner and an ideograph, emoji base or emoji modifier. 41300 if (UnicodeTrie.get(codePoints[currentIndex]) === ZWJ && (next === ID || next === EB || next === EM)) { 41301 return BREAK_NOT_ALLOWED; 41302 } 41303 // LB11 Do not break before or after Word joiner and related characters. 41304 if (current === WJ || next === WJ) { 41305 return BREAK_NOT_ALLOWED; 41306 } 41307 // LB12 Do not break after NBSP and related characters. 41308 if (current === GL) { 41309 return BREAK_NOT_ALLOWED; 41310 } 41311 // LB12a Do not break before NBSP and related characters, except after spaces and hyphens. 41312 if ([SP, BA, HY].indexOf(current) === -1 && next === GL) { 41313 return BREAK_NOT_ALLOWED; 41314 } 41315 // LB13 Do not break before â]â or â!â or â;â or â/â, even after spaces. 41316 if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) { 41317 return BREAK_NOT_ALLOWED; 41318 } 41319 // LB14 Do not break after â[â, even after spaces. 41320 if (previousNonSpaceClassType(currentIndex, classTypes) === OP) { 41321 return BREAK_NOT_ALLOWED; 41322 } 41323 // LB15 Do not break within ââ[â, even with intervening spaces. 41324 if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) { 41325 return BREAK_NOT_ALLOWED; 41326 } 41327 // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces. 41328 if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) { 41329 return BREAK_NOT_ALLOWED; 41330 } 41331 // LB17 Do not break within ââââ, even with intervening spaces. 41332 if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) { 41333 return BREAK_NOT_ALLOWED; 41334 } 41335 // LB18 Break after spaces. 41336 if (current === SP) { 41337 return BREAK_ALLOWED; 41338 } 41339 // LB19 Do not break before or after quotation marks, such as â â â. 41340 if (current === QU || next === QU) { 41341 return BREAK_NOT_ALLOWED; 41342 } 41343 // LB20 Break before and after unresolved CB. 41344 if (next === CB || current === CB) { 41345 return BREAK_ALLOWED; 41346 } 41347 // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents. 41348 if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) { 41349 return BREAK_NOT_ALLOWED; 41350 } 41351 // LB21a Don't break after Hebrew + Hyphen. 41352 if (before === HL && HYPHEN.indexOf(current) !== -1) { 41353 return BREAK_NOT_ALLOWED; 41354 } 41355 // LB21b Donât break between Solidus and Hebrew letters. 41356 if (current === SY && next === HL) { 41357 return BREAK_NOT_ALLOWED; 41358 } 41359 // LB22 Do not break between two ellipses, or between letters, numbers or exclamations and ellipsis. 41360 if (next === IN && ALPHABETICS.concat(IN, EX, NU, ID, EB, EM).indexOf(current) !== -1) { 41361 return BREAK_NOT_ALLOWED; 41362 } 41363 // LB23 Do not break between digits and letters. 41364 if ((ALPHABETICS.indexOf(next) !== -1 && current === NU) || (ALPHABETICS.indexOf(current) !== -1 && next === NU)) { 41365 return BREAK_NOT_ALLOWED; 41366 } 41367 // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes. 41368 if ((current === PR && [ID, EB, EM].indexOf(next) !== -1) || 41369 ([ID, EB, EM].indexOf(current) !== -1 && next === PO)) { 41370 return BREAK_NOT_ALLOWED; 41371 } 41372 // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix. 41373 if ((ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1) || 41374 (PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1)) { 41375 return BREAK_NOT_ALLOWED; 41376 } 41377 // LB25 Do not break between the following pairs of classes relevant to numbers: 41378 if ( 41379 // (PR | PO) à ( OP | HY )? NU 41380 ([PR, PO].indexOf(current) !== -1 && 41381 (next === NU || ([OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU))) || 41382 // ( OP | HY ) à NU 41383 ([OP, HY].indexOf(current) !== -1 && next === NU) || 41384 // NU à (NU | SY | IS) 41385 (current === NU && [NU, SY, IS].indexOf(next) !== -1)) { 41386 return BREAK_NOT_ALLOWED; 41387 } 41388 // NU (NU | SY | IS)* à (NU | SY | IS | CL | CP) 41389 if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) { 41390 var prevIndex = currentIndex; 41391 while (prevIndex >= 0) { 41392 var type = classTypes[prevIndex]; 41393 if (type === NU) { 41394 return BREAK_NOT_ALLOWED; 41395 } 41396 else if ([SY, IS].indexOf(type) !== -1) { 41397 prevIndex--; 41398 } 41399 else { 41400 break; 41401 } 41402 } 41403 } 41404 // NU (NU | SY | IS)* (CL | CP)? à (PO | PR)) 41405 if ([PR, PO].indexOf(next) !== -1) { 41406 var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex; 41407 while (prevIndex >= 0) { 41408 var type = classTypes[prevIndex]; 41409 if (type === NU) { 41410 return BREAK_NOT_ALLOWED; 41411 } 41412 else if ([SY, IS].indexOf(type) !== -1) { 41413 prevIndex--; 41414 } 41415 else { 41416 break; 41417 } 41418 } 41419 } 41420 // LB26 Do not break a Korean syllable. 41421 if ((JL === current && [JL, JV, H2, H3].indexOf(next) !== -1) || 41422 ([JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1) || 41423 ([JT, H3].indexOf(current) !== -1 && next === JT)) { 41424 return BREAK_NOT_ALLOWED; 41425 } 41426 // LB27 Treat a Korean Syllable Block the same as ID. 41427 if ((KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1) || 41428 (KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR)) { 41429 return BREAK_NOT_ALLOWED; 41430 } 41431 // LB28 Do not break between alphabetics (âatâ). 41432 if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) { 41433 return BREAK_NOT_ALLOWED; 41434 } 41435 // LB29 Do not break between numeric punctuation and alphabetics (âe.g.â). 41436 if (current === IS && ALPHABETICS.indexOf(next) !== -1) { 41437 return BREAK_NOT_ALLOWED; 41438 } 41439 // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses. 41440 if ((ALPHABETICS.concat(NU).indexOf(current) !== -1 && next === OP) || 41441 (ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP)) { 41442 return BREAK_NOT_ALLOWED; 41443 } 41444 // LB30a Break between two regional indicator symbols if and only if there are an even number of regional 41445 // indicators preceding the position of the break. 41446 if (current === RI && next === RI) { 41447 var i = indicies[currentIndex]; 41448 var count = 1; 41449 while (i > 0) { 41450 i--; 41451 if (classTypes[i] === RI) { 41452 count++; 41453 } 41454 else { 41455 break; 41456 } 41457 } 41458 if (count % 2 !== 0) { 41459 return BREAK_NOT_ALLOWED; 41460 } 41461 } 41462 // LB30b Do not break between an emoji base and an emoji modifier. 41463 if (current === EB && next === EM) { 41464 return BREAK_NOT_ALLOWED; 41465 } 41466 return BREAK_ALLOWED; 41467 }; 41468 var cssFormattedClasses = function (codePoints, options) { 41469 if (!options) { 41470 options = { lineBreak: 'normal', wordBreak: 'normal' }; 41471 } 41472 var _a = codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2]; 41473 if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') { 41474 classTypes = classTypes.map(function (type) { return ([NU, AL, SA].indexOf(type) !== -1 ? ID : type); }); 41475 } 41476 var forbiddenBreakpoints = options.wordBreak === 'keep-all' 41477 ? isLetterNumber.map(function (letterNumber, i) { 41478 return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff; 41479 }) 41480 : undefined; 41481 return [indicies, classTypes, forbiddenBreakpoints]; 41482 }; 41483 var Break = /** @class */ (function () { 41484 function Break(codePoints, lineBreak, start, end) { 41485 this.codePoints = codePoints; 41486 this.required = lineBreak === BREAK_MANDATORY; 41487 this.start = start; 41488 this.end = end; 41489 } 41490 Break.prototype.slice = function () { 41491 return fromCodePoint.apply(void 0, this.codePoints.slice(this.start, this.end)); 41492 }; 41493 return Break; 41494 }()); 41495 var LineBreaker = function (str, options) { 41496 var codePoints = toCodePoints(str); 41497 var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2]; 41498 var length = codePoints.length; 41499 var lastEnd = 0; 41500 var nextIndex = 0; 41501 return { 41502 next: function () { 41503 if (nextIndex >= length) { 41504 return { done: true, value: null }; 41505 } 41506 var lineBreak = BREAK_NOT_ALLOWED; 41507 while (nextIndex < length && 41508 (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === 41509 BREAK_NOT_ALLOWED) { } 41510 if (lineBreak !== BREAK_NOT_ALLOWED || nextIndex === length) { 41511 var value = new Break(codePoints, lineBreak, lastEnd, nextIndex); 41512 lastEnd = nextIndex; 41513 return { value: value, done: false }; 41514 } 41515 return { done: true, value: null }; 41516 }, 41517 }; 41518 }; 41519 41520 // https://www.w3.org/TR/css-syntax-3 41521 var TokenType; 41522 (function (TokenType) { 41523 TokenType[TokenType["STRING_TOKEN"] = 0] = "STRING_TOKEN"; 41524 TokenType[TokenType["BAD_STRING_TOKEN"] = 1] = "BAD_STRING_TOKEN"; 41525 TokenType[TokenType["LEFT_PARENTHESIS_TOKEN"] = 2] = "LEFT_PARENTHESIS_TOKEN"; 41526 TokenType[TokenType["RIGHT_PARENTHESIS_TOKEN"] = 3] = "RIGHT_PARENTHESIS_TOKEN"; 41527 TokenType[TokenType["COMMA_TOKEN"] = 4] = "COMMA_TOKEN"; 41528 TokenType[TokenType["HASH_TOKEN"] = 5] = "HASH_TOKEN"; 41529 TokenType[TokenType["DELIM_TOKEN"] = 6] = "DELIM_TOKEN"; 41530 TokenType[TokenType["AT_KEYWORD_TOKEN"] = 7] = "AT_KEYWORD_TOKEN"; 41531 TokenType[TokenType["PREFIX_MATCH_TOKEN"] = 8] = "PREFIX_MATCH_TOKEN"; 41532 TokenType[TokenType["DASH_MATCH_TOKEN"] = 9] = "DASH_MATCH_TOKEN"; 41533 TokenType[TokenType["INCLUDE_MATCH_TOKEN"] = 10] = "INCLUDE_MATCH_TOKEN"; 41534 TokenType[TokenType["LEFT_CURLY_BRACKET_TOKEN"] = 11] = "LEFT_CURLY_BRACKET_TOKEN"; 41535 TokenType[TokenType["RIGHT_CURLY_BRACKET_TOKEN"] = 12] = "RIGHT_CURLY_BRACKET_TOKEN"; 41536 TokenType[TokenType["SUFFIX_MATCH_TOKEN"] = 13] = "SUFFIX_MATCH_TOKEN"; 41537 TokenType[TokenType["SUBSTRING_MATCH_TOKEN"] = 14] = "SUBSTRING_MATCH_TOKEN"; 41538 TokenType[TokenType["DIMENSION_TOKEN"] = 15] = "DIMENSION_TOKEN"; 41539 TokenType[TokenType["PERCENTAGE_TOKEN"] = 16] = "PERCENTAGE_TOKEN"; 41540 TokenType[TokenType["NUMBER_TOKEN"] = 17] = "NUMBER_TOKEN"; 41541 TokenType[TokenType["FUNCTION"] = 18] = "FUNCTION"; 41542 TokenType[TokenType["FUNCTION_TOKEN"] = 19] = "FUNCTION_TOKEN"; 41543 TokenType[TokenType["IDENT_TOKEN"] = 20] = "IDENT_TOKEN"; 41544 TokenType[TokenType["COLUMN_TOKEN"] = 21] = "COLUMN_TOKEN"; 41545 TokenType[TokenType["URL_TOKEN"] = 22] = "URL_TOKEN"; 41546 TokenType[TokenType["BAD_URL_TOKEN"] = 23] = "BAD_URL_TOKEN"; 41547 TokenType[TokenType["CDC_TOKEN"] = 24] = "CDC_TOKEN"; 41548 TokenType[TokenType["CDO_TOKEN"] = 25] = "CDO_TOKEN"; 41549 TokenType[TokenType["COLON_TOKEN"] = 26] = "COLON_TOKEN"; 41550 TokenType[TokenType["SEMICOLON_TOKEN"] = 27] = "SEMICOLON_TOKEN"; 41551 TokenType[TokenType["LEFT_SQUARE_BRACKET_TOKEN"] = 28] = "LEFT_SQUARE_BRACKET_TOKEN"; 41552 TokenType[TokenType["RIGHT_SQUARE_BRACKET_TOKEN"] = 29] = "RIGHT_SQUARE_BRACKET_TOKEN"; 41553 TokenType[TokenType["UNICODE_RANGE_TOKEN"] = 30] = "UNICODE_RANGE_TOKEN"; 41554 TokenType[TokenType["WHITESPACE_TOKEN"] = 31] = "WHITESPACE_TOKEN"; 41555 TokenType[TokenType["EOF_TOKEN"] = 32] = "EOF_TOKEN"; 41556 })(TokenType || (TokenType = {})); 41557 var FLAG_UNRESTRICTED = 1 << 0; 41558 var FLAG_ID = 1 << 1; 41559 var FLAG_INTEGER = 1 << 2; 41560 var FLAG_NUMBER = 1 << 3; 41561 var LINE_FEED = 0x000a; 41562 var SOLIDUS = 0x002f; 41563 var REVERSE_SOLIDUS = 0x005c; 41564 var CHARACTER_TABULATION = 0x0009; 41565 var SPACE$1 = 0x0020; 41566 var QUOTATION_MARK = 0x0022; 41567 var EQUALS_SIGN = 0x003d; 41568 var NUMBER_SIGN = 0x0023; 41569 var DOLLAR_SIGN = 0x0024; 41570 var PERCENTAGE_SIGN = 0x0025; 41571 var APOSTROPHE = 0x0027; 41572 var LEFT_PARENTHESIS = 0x0028; 41573 var RIGHT_PARENTHESIS = 0x0029; 41574 var LOW_LINE = 0x005f; 41575 var HYPHEN_MINUS = 0x002d; 41576 var EXCLAMATION_MARK = 0x0021; 41577 var LESS_THAN_SIGN = 0x003c; 41578 var GREATER_THAN_SIGN = 0x003e; 41579 var COMMERCIAL_AT = 0x0040; 41580 var LEFT_SQUARE_BRACKET = 0x005b; 41581 var RIGHT_SQUARE_BRACKET = 0x005d; 41582 var CIRCUMFLEX_ACCENT = 0x003d; 41583 var LEFT_CURLY_BRACKET = 0x007b; 41584 var QUESTION_MARK = 0x003f; 41585 var RIGHT_CURLY_BRACKET = 0x007d; 41586 var VERTICAL_LINE = 0x007c; 41587 var TILDE = 0x007e; 41588 var CONTROL = 0x0080; 41589 var REPLACEMENT_CHARACTER = 0xfffd; 41590 var ASTERISK = 0x002a; 41591 var PLUS_SIGN = 0x002b; 41592 var COMMA = 0x002c; 41593 var COLON = 0x003a; 41594 var SEMICOLON = 0x003b; 41595 var FULL_STOP = 0x002e; 41596 var NULL = 0x0000; 41597 var BACKSPACE = 0x0008; 41598 var LINE_TABULATION = 0x000b; 41599 var SHIFT_OUT = 0x000e; 41600 var INFORMATION_SEPARATOR_ONE = 0x001f; 41601 var DELETE = 0x007f; 41602 var EOF = -1; 41603 var ZERO = 0x0030; 41604 var a = 0x0061; 41605 var e = 0x0065; 41606 var f = 0x0066; 41607 var u = 0x0075; 41608 var z = 0x007a; 41609 var A = 0x0041; 41610 var E = 0x0045; 41611 var F = 0x0046; 41612 var U = 0x0055; 41613 var Z = 0x005a; 41614 var isDigit = function (codePoint) { return codePoint >= ZERO && codePoint <= 0x0039; }; 41615 var isSurrogateCodePoint = function (codePoint) { return codePoint >= 0xd800 && codePoint <= 0xdfff; }; 41616 var isHex = function (codePoint) { 41617 return isDigit(codePoint) || (codePoint >= A && codePoint <= F) || (codePoint >= a && codePoint <= f); 41618 }; 41619 var isLowerCaseLetter = function (codePoint) { return codePoint >= a && codePoint <= z; }; 41620 var isUpperCaseLetter = function (codePoint) { return codePoint >= A && codePoint <= Z; }; 41621 var isLetter = function (codePoint) { return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint); }; 41622 var isNonASCIICodePoint = function (codePoint) { return codePoint >= CONTROL; }; 41623 var isWhiteSpace = function (codePoint) { 41624 return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE$1; 41625 }; 41626 var isNameStartCodePoint = function (codePoint) { 41627 return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE; 41628 }; 41629 var isNameCodePoint = function (codePoint) { 41630 return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS; 41631 }; 41632 var isNonPrintableCodePoint = function (codePoint) { 41633 return ((codePoint >= NULL && codePoint <= BACKSPACE) || 41634 codePoint === LINE_TABULATION || 41635 (codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE) || 41636 codePoint === DELETE); 41637 }; 41638 var isValidEscape = function (c1, c2) { 41639 if (c1 !== REVERSE_SOLIDUS) { 41640 return false; 41641 } 41642 return c2 !== LINE_FEED; 41643 }; 41644 var isIdentifierStart = function (c1, c2, c3) { 41645 if (c1 === HYPHEN_MINUS) { 41646 return isNameStartCodePoint(c2) || isValidEscape(c2, c3); 41647 } 41648 else if (isNameStartCodePoint(c1)) { 41649 return true; 41650 } 41651 else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) { 41652 return true; 41653 } 41654 return false; 41655 }; 41656 var isNumberStart = function (c1, c2, c3) { 41657 if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) { 41658 if (isDigit(c2)) { 41659 return true; 41660 } 41661 return c2 === FULL_STOP && isDigit(c3); 41662 } 41663 if (c1 === FULL_STOP) { 41664 return isDigit(c2); 41665 } 41666 return isDigit(c1); 41667 }; 41668 var stringToNumber = function (codePoints) { 41669 var c = 0; 41670 var sign = 1; 41671 if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) { 41672 if (codePoints[c] === HYPHEN_MINUS) { 41673 sign = -1; 41674 } 41675 c++; 41676 } 41677 var integers = []; 41678 while (isDigit(codePoints[c])) { 41679 integers.push(codePoints[c++]); 41680 } 41681 var int = integers.length ? parseInt(fromCodePoint.apply(void 0, integers), 10) : 0; 41682 if (codePoints[c] === FULL_STOP) { 41683 c++; 41684 } 41685 var fraction = []; 41686 while (isDigit(codePoints[c])) { 41687 fraction.push(codePoints[c++]); 41688 } 41689 var fracd = fraction.length; 41690 var frac = fracd ? parseInt(fromCodePoint.apply(void 0, fraction), 10) : 0; 41691 if (codePoints[c] === E || codePoints[c] === e) { 41692 c++; 41693 } 41694 var expsign = 1; 41695 if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) { 41696 if (codePoints[c] === HYPHEN_MINUS) { 41697 expsign = -1; 41698 } 41699 c++; 41700 } 41701 var exponent = []; 41702 while (isDigit(codePoints[c])) { 41703 exponent.push(codePoints[c++]); 41704 } 41705 var exp = exponent.length ? parseInt(fromCodePoint.apply(void 0, exponent), 10) : 0; 41706 return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp); 41707 }; 41708 var LEFT_PARENTHESIS_TOKEN = { 41709 type: TokenType.LEFT_PARENTHESIS_TOKEN 41710 }; 41711 var RIGHT_PARENTHESIS_TOKEN = { 41712 type: TokenType.RIGHT_PARENTHESIS_TOKEN 41713 }; 41714 var COMMA_TOKEN = { type: TokenType.COMMA_TOKEN }; 41715 var SUFFIX_MATCH_TOKEN = { type: TokenType.SUFFIX_MATCH_TOKEN }; 41716 var PREFIX_MATCH_TOKEN = { type: TokenType.PREFIX_MATCH_TOKEN }; 41717 var COLUMN_TOKEN = { type: TokenType.COLUMN_TOKEN }; 41718 var DASH_MATCH_TOKEN = { type: TokenType.DASH_MATCH_TOKEN }; 41719 var INCLUDE_MATCH_TOKEN = { type: TokenType.INCLUDE_MATCH_TOKEN }; 41720 var LEFT_CURLY_BRACKET_TOKEN = { 41721 type: TokenType.LEFT_CURLY_BRACKET_TOKEN 41722 }; 41723 var RIGHT_CURLY_BRACKET_TOKEN = { 41724 type: TokenType.RIGHT_CURLY_BRACKET_TOKEN 41725 }; 41726 var SUBSTRING_MATCH_TOKEN = { type: TokenType.SUBSTRING_MATCH_TOKEN }; 41727 var BAD_URL_TOKEN = { type: TokenType.BAD_URL_TOKEN }; 41728 var BAD_STRING_TOKEN = { type: TokenType.BAD_STRING_TOKEN }; 41729 var CDO_TOKEN = { type: TokenType.CDO_TOKEN }; 41730 var CDC_TOKEN = { type: TokenType.CDC_TOKEN }; 41731 var COLON_TOKEN = { type: TokenType.COLON_TOKEN }; 41732 var SEMICOLON_TOKEN = { type: TokenType.SEMICOLON_TOKEN }; 41733 var LEFT_SQUARE_BRACKET_TOKEN = { 41734 type: TokenType.LEFT_SQUARE_BRACKET_TOKEN 41735 }; 41736 var RIGHT_SQUARE_BRACKET_TOKEN = { 41737 type: TokenType.RIGHT_SQUARE_BRACKET_TOKEN 41738 }; 41739 var WHITESPACE_TOKEN = { type: TokenType.WHITESPACE_TOKEN }; 41740 var EOF_TOKEN = { type: TokenType.EOF_TOKEN }; 41741 var Tokenizer = /** @class */ (function () { 41742 function Tokenizer() { 41743 this._value = []; 41744 } 41745 Tokenizer.prototype.write = function (chunk) { 41746 this._value = this._value.concat(toCodePoints(chunk)); 41747 }; 41748 Tokenizer.prototype.read = function () { 41749 var tokens = []; 41750 var token = this.consumeToken(); 41751 while (token !== EOF_TOKEN) { 41752 tokens.push(token); 41753 token = this.consumeToken(); 41754 } 41755 return tokens; 41756 }; 41757 Tokenizer.prototype.consumeToken = function () { 41758 var codePoint = this.consumeCodePoint(); 41759 switch (codePoint) { 41760 case QUOTATION_MARK: 41761 return this.consumeStringToken(QUOTATION_MARK); 41762 case NUMBER_SIGN: 41763 var c1 = this.peekCodePoint(0); 41764 var c2 = this.peekCodePoint(1); 41765 var c3 = this.peekCodePoint(2); 41766 if (isNameCodePoint(c1) || isValidEscape(c2, c3)) { 41767 var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED; 41768 var value = this.consumeName(); 41769 return { type: TokenType.HASH_TOKEN, value: value, flags: flags }; 41770 } 41771 break; 41772 case DOLLAR_SIGN: 41773 if (this.peekCodePoint(0) === EQUALS_SIGN) { 41774 this.consumeCodePoint(); 41775 return SUFFIX_MATCH_TOKEN; 41776 } 41777 break; 41778 case APOSTROPHE: 41779 return this.consumeStringToken(APOSTROPHE); 41780 case LEFT_PARENTHESIS: 41781 return LEFT_PARENTHESIS_TOKEN; 41782 case RIGHT_PARENTHESIS: 41783 return RIGHT_PARENTHESIS_TOKEN; 41784 case ASTERISK: 41785 if (this.peekCodePoint(0) === EQUALS_SIGN) { 41786 this.consumeCodePoint(); 41787 return SUBSTRING_MATCH_TOKEN; 41788 } 41789 break; 41790 case PLUS_SIGN: 41791 if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { 41792 this.reconsumeCodePoint(codePoint); 41793 return this.consumeNumericToken(); 41794 } 41795 break; 41796 case COMMA: 41797 return COMMA_TOKEN; 41798 case HYPHEN_MINUS: 41799 var e1 = codePoint; 41800 var e2 = this.peekCodePoint(0); 41801 var e3 = this.peekCodePoint(1); 41802 if (isNumberStart(e1, e2, e3)) { 41803 this.reconsumeCodePoint(codePoint); 41804 return this.consumeNumericToken(); 41805 } 41806 if (isIdentifierStart(e1, e2, e3)) { 41807 this.reconsumeCodePoint(codePoint); 41808 return this.consumeIdentLikeToken(); 41809 } 41810 if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) { 41811 this.consumeCodePoint(); 41812 this.consumeCodePoint(); 41813 return CDC_TOKEN; 41814 } 41815 break; 41816 case FULL_STOP: 41817 if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { 41818 this.reconsumeCodePoint(codePoint); 41819 return this.consumeNumericToken(); 41820 } 41821 break; 41822 case SOLIDUS: 41823 if (this.peekCodePoint(0) === ASTERISK) { 41824 this.consumeCodePoint(); 41825 while (true) { 41826 var c = this.consumeCodePoint(); 41827 if (c === ASTERISK) { 41828 c = this.consumeCodePoint(); 41829 if (c === SOLIDUS) { 41830 return this.consumeToken(); 41831 } 41832 } 41833 if (c === EOF) { 41834 return this.consumeToken(); 41835 } 41836 } 41837 } 41838 break; 41839 case COLON: 41840 return COLON_TOKEN; 41841 case SEMICOLON: 41842 return SEMICOLON_TOKEN; 41843 case LESS_THAN_SIGN: 41844 if (this.peekCodePoint(0) === EXCLAMATION_MARK && 41845 this.peekCodePoint(1) === HYPHEN_MINUS && 41846 this.peekCodePoint(2) === HYPHEN_MINUS) { 41847 this.consumeCodePoint(); 41848 this.consumeCodePoint(); 41849 return CDO_TOKEN; 41850 } 41851 break; 41852 case COMMERCIAL_AT: 41853 var a1 = this.peekCodePoint(0); 41854 var a2 = this.peekCodePoint(1); 41855 var a3 = this.peekCodePoint(2); 41856 if (isIdentifierStart(a1, a2, a3)) { 41857 var value = this.consumeName(); 41858 return { type: TokenType.AT_KEYWORD_TOKEN, value: value }; 41859 } 41860 break; 41861 case LEFT_SQUARE_BRACKET: 41862 return LEFT_SQUARE_BRACKET_TOKEN; 41863 case REVERSE_SOLIDUS: 41864 if (isValidEscape(codePoint, this.peekCodePoint(0))) { 41865 this.reconsumeCodePoint(codePoint); 41866 return this.consumeIdentLikeToken(); 41867 } 41868 break; 41869 case RIGHT_SQUARE_BRACKET: 41870 return RIGHT_SQUARE_BRACKET_TOKEN; 41871 case CIRCUMFLEX_ACCENT: 41872 if (this.peekCodePoint(0) === EQUALS_SIGN) { 41873 this.consumeCodePoint(); 41874 return PREFIX_MATCH_TOKEN; 41875 } 41876 break; 41877 case LEFT_CURLY_BRACKET: 41878 return LEFT_CURLY_BRACKET_TOKEN; 41879 case RIGHT_CURLY_BRACKET: 41880 return RIGHT_CURLY_BRACKET_TOKEN; 41881 case u: 41882 case U: 41883 var u1 = this.peekCodePoint(0); 41884 var u2 = this.peekCodePoint(1); 41885 if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) { 41886 this.consumeCodePoint(); 41887 this.consumeUnicodeRangeToken(); 41888 } 41889 this.reconsumeCodePoint(codePoint); 41890 return this.consumeIdentLikeToken(); 41891 case VERTICAL_LINE: 41892 if (this.peekCodePoint(0) === EQUALS_SIGN) { 41893 this.consumeCodePoint(); 41894 return DASH_MATCH_TOKEN; 41895 } 41896 if (this.peekCodePoint(0) === VERTICAL_LINE) { 41897 this.consumeCodePoint(); 41898 return COLUMN_TOKEN; 41899 } 41900 break; 41901 case TILDE: 41902 if (this.peekCodePoint(0) === EQUALS_SIGN) { 41903 this.consumeCodePoint(); 41904 return INCLUDE_MATCH_TOKEN; 41905 } 41906 break; 41907 case EOF: 41908 return EOF_TOKEN; 41909 } 41910 if (isWhiteSpace(codePoint)) { 41911 this.consumeWhiteSpace(); 41912 return WHITESPACE_TOKEN; 41913 } 41914 if (isDigit(codePoint)) { 41915 this.reconsumeCodePoint(codePoint); 41916 return this.consumeNumericToken(); 41917 } 41918 if (isNameStartCodePoint(codePoint)) { 41919 this.reconsumeCodePoint(codePoint); 41920 return this.consumeIdentLikeToken(); 41921 } 41922 return { type: TokenType.DELIM_TOKEN, value: fromCodePoint(codePoint) }; 41923 }; 41924 Tokenizer.prototype.consumeCodePoint = function () { 41925 var value = this._value.shift(); 41926 return typeof value === 'undefined' ? -1 : value; 41927 }; 41928 Tokenizer.prototype.reconsumeCodePoint = function (codePoint) { 41929 this._value.unshift(codePoint); 41930 }; 41931 Tokenizer.prototype.peekCodePoint = function (delta) { 41932 if (delta >= this._value.length) { 41933 return -1; 41934 } 41935 return this._value[delta]; 41936 }; 41937 Tokenizer.prototype.consumeUnicodeRangeToken = function () { 41938 var digits = []; 41939 var codePoint = this.consumeCodePoint(); 41940 while (isHex(codePoint) && digits.length < 6) { 41941 digits.push(codePoint); 41942 codePoint = this.consumeCodePoint(); 41943 } 41944 var questionMarks = false; 41945 while (codePoint === QUESTION_MARK && digits.length < 6) { 41946 digits.push(codePoint); 41947 codePoint = this.consumeCodePoint(); 41948 questionMarks = true; 41949 } 41950 if (questionMarks) { 41951 var start_1 = parseInt(fromCodePoint.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16); 41952 var end = parseInt(fromCodePoint.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16); 41953 return { type: TokenType.UNICODE_RANGE_TOKEN, start: start_1, end: end }; 41954 } 41955 var start = parseInt(fromCodePoint.apply(void 0, digits), 16); 41956 if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) { 41957 this.consumeCodePoint(); 41958 codePoint = this.consumeCodePoint(); 41959 var endDigits = []; 41960 while (isHex(codePoint) && endDigits.length < 6) { 41961 endDigits.push(codePoint); 41962 codePoint = this.consumeCodePoint(); 41963 } 41964 var end = parseInt(fromCodePoint.apply(void 0, endDigits), 16); 41965 return { type: TokenType.UNICODE_RANGE_TOKEN, start: start, end: end }; 41966 } 41967 else { 41968 return { type: TokenType.UNICODE_RANGE_TOKEN, start: start, end: start }; 41969 } 41970 }; 41971 Tokenizer.prototype.consumeIdentLikeToken = function () { 41972 var value = this.consumeName(); 41973 if (value.toLowerCase() === 'url' && this.peekCodePoint(0) === LEFT_PARENTHESIS) { 41974 this.consumeCodePoint(); 41975 return this.consumeUrlToken(); 41976 } 41977 else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) { 41978 this.consumeCodePoint(); 41979 return { type: TokenType.FUNCTION_TOKEN, value: value }; 41980 } 41981 return { type: TokenType.IDENT_TOKEN, value: value }; 41982 }; 41983 Tokenizer.prototype.consumeUrlToken = function () { 41984 var value = []; 41985 this.consumeWhiteSpace(); 41986 if (this.peekCodePoint(0) === EOF) { 41987 return { type: TokenType.URL_TOKEN, value: '' }; 41988 } 41989 var next = this.peekCodePoint(0); 41990 if (next === APOSTROPHE || next === QUOTATION_MARK) { 41991 var stringToken = this.consumeStringToken(this.consumeCodePoint()); 41992 if (stringToken.type === TokenType.STRING_TOKEN) { 41993 this.consumeWhiteSpace(); 41994 if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) { 41995 this.consumeCodePoint(); 41996 return { type: TokenType.URL_TOKEN, value: stringToken.value }; 41997 } 41998 } 41999 this.consumeBadUrlRemnants(); 42000 return BAD_URL_TOKEN; 42001 } 42002 while (true) { 42003 var codePoint = this.consumeCodePoint(); 42004 if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) { 42005 return { type: TokenType.URL_TOKEN, value: fromCodePoint.apply(void 0, value) }; 42006 } 42007 else if (isWhiteSpace(codePoint)) { 42008 this.consumeWhiteSpace(); 42009 if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) { 42010 this.consumeCodePoint(); 42011 return { type: TokenType.URL_TOKEN, value: fromCodePoint.apply(void 0, value) }; 42012 } 42013 this.consumeBadUrlRemnants(); 42014 return BAD_URL_TOKEN; 42015 } 42016 else if (codePoint === QUOTATION_MARK || 42017 codePoint === APOSTROPHE || 42018 codePoint === LEFT_PARENTHESIS || 42019 isNonPrintableCodePoint(codePoint)) { 42020 this.consumeBadUrlRemnants(); 42021 return BAD_URL_TOKEN; 42022 } 42023 else if (codePoint === REVERSE_SOLIDUS) { 42024 if (isValidEscape(codePoint, this.peekCodePoint(0))) { 42025 value.push(this.consumeEscapedCodePoint()); 42026 } 42027 else { 42028 this.consumeBadUrlRemnants(); 42029 return BAD_URL_TOKEN; 42030 } 42031 } 42032 else { 42033 value.push(codePoint); 42034 } 42035 } 42036 }; 42037 Tokenizer.prototype.consumeWhiteSpace = function () { 42038 while (isWhiteSpace(this.peekCodePoint(0))) { 42039 this.consumeCodePoint(); 42040 } 42041 }; 42042 Tokenizer.prototype.consumeBadUrlRemnants = function () { 42043 while (true) { 42044 var codePoint = this.consumeCodePoint(); 42045 if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) { 42046 return; 42047 } 42048 if (isValidEscape(codePoint, this.peekCodePoint(0))) { 42049 this.consumeEscapedCodePoint(); 42050 } 42051 } 42052 }; 42053 Tokenizer.prototype.consumeStringSlice = function (count) { 42054 var SLICE_STACK_SIZE = 60000; 42055 var value = ''; 42056 while (count > 0) { 42057 var amount = Math.min(SLICE_STACK_SIZE, count); 42058 value += fromCodePoint.apply(void 0, this._value.splice(0, amount)); 42059 count -= amount; 42060 } 42061 this._value.shift(); 42062 return value; 42063 }; 42064 Tokenizer.prototype.consumeStringToken = function (endingCodePoint) { 42065 var value = ''; 42066 var i = 0; 42067 do { 42068 var codePoint = this._value[i]; 42069 if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) { 42070 value += this.consumeStringSlice(i); 42071 return { type: TokenType.STRING_TOKEN, value: value }; 42072 } 42073 if (codePoint === LINE_FEED) { 42074 this._value.splice(0, i); 42075 return BAD_STRING_TOKEN; 42076 } 42077 if (codePoint === REVERSE_SOLIDUS) { 42078 var next = this._value[i + 1]; 42079 if (next !== EOF && next !== undefined) { 42080 if (next === LINE_FEED) { 42081 value += this.consumeStringSlice(i); 42082 i = -1; 42083 this._value.shift(); 42084 } 42085 else if (isValidEscape(codePoint, next)) { 42086 value += this.consumeStringSlice(i); 42087 value += fromCodePoint(this.consumeEscapedCodePoint()); 42088 i = -1; 42089 } 42090 } 42091 } 42092 i++; 42093 } while (true); 42094 }; 42095 Tokenizer.prototype.consumeNumber = function () { 42096 var repr = []; 42097 var type = FLAG_INTEGER; 42098 var c1 = this.peekCodePoint(0); 42099 if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) { 42100 repr.push(this.consumeCodePoint()); 42101 } 42102 while (isDigit(this.peekCodePoint(0))) { 42103 repr.push(this.consumeCodePoint()); 42104 } 42105 c1 = this.peekCodePoint(0); 42106 var c2 = this.peekCodePoint(1); 42107 if (c1 === FULL_STOP && isDigit(c2)) { 42108 repr.push(this.consumeCodePoint(), this.consumeCodePoint()); 42109 type = FLAG_NUMBER; 42110 while (isDigit(this.peekCodePoint(0))) { 42111 repr.push(this.consumeCodePoint()); 42112 } 42113 } 42114 c1 = this.peekCodePoint(0); 42115 c2 = this.peekCodePoint(1); 42116 var c3 = this.peekCodePoint(2); 42117 if ((c1 === E || c1 === e) && (((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3)) || isDigit(c2))) { 42118 repr.push(this.consumeCodePoint(), this.consumeCodePoint()); 42119 type = FLAG_NUMBER; 42120 while (isDigit(this.peekCodePoint(0))) { 42121 repr.push(this.consumeCodePoint()); 42122 } 42123 } 42124 return [stringToNumber(repr), type]; 42125 }; 42126 Tokenizer.prototype.consumeNumericToken = function () { 42127 var _a = this.consumeNumber(), number = _a[0], flags = _a[1]; 42128 var c1 = this.peekCodePoint(0); 42129 var c2 = this.peekCodePoint(1); 42130 var c3 = this.peekCodePoint(2); 42131 if (isIdentifierStart(c1, c2, c3)) { 42132 var unit = this.consumeName(); 42133 return { type: TokenType.DIMENSION_TOKEN, number: number, flags: flags, unit: unit }; 42134 } 42135 if (c1 === PERCENTAGE_SIGN) { 42136 this.consumeCodePoint(); 42137 return { type: TokenType.PERCENTAGE_TOKEN, number: number, flags: flags }; 42138 } 42139 return { type: TokenType.NUMBER_TOKEN, number: number, flags: flags }; 42140 }; 42141 Tokenizer.prototype.consumeEscapedCodePoint = function () { 42142 var codePoint = this.consumeCodePoint(); 42143 if (isHex(codePoint)) { 42144 var hex = fromCodePoint(codePoint); 42145 while (isHex(this.peekCodePoint(0)) && hex.length < 6) { 42146 hex += fromCodePoint(this.consumeCodePoint()); 42147 } 42148 if (isWhiteSpace(this.peekCodePoint(0))) { 42149 this.consumeCodePoint(); 42150 } 42151 var hexCodePoint = parseInt(hex, 16); 42152 if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) { 42153 return REPLACEMENT_CHARACTER; 42154 } 42155 return hexCodePoint; 42156 } 42157 if (codePoint === EOF) { 42158 return REPLACEMENT_CHARACTER; 42159 } 42160 return codePoint; 42161 }; 42162 Tokenizer.prototype.consumeName = function () { 42163 var result = ''; 42164 while (true) { 42165 var codePoint = this.consumeCodePoint(); 42166 if (isNameCodePoint(codePoint)) { 42167 result += fromCodePoint(codePoint); 42168 } 42169 else if (isValidEscape(codePoint, this.peekCodePoint(0))) { 42170 result += fromCodePoint(this.consumeEscapedCodePoint()); 42171 } 42172 else { 42173 this.reconsumeCodePoint(codePoint); 42174 return result; 42175 } 42176 } 42177 }; 42178 return Tokenizer; 42179 }()); 42180 42181 var Parser = /** @class */ (function () { 42182 function Parser(tokens) { 42183 this._tokens = tokens; 42184 } 42185 Parser.create = function (value) { 42186 var tokenizer = new Tokenizer(); 42187 tokenizer.write(value); 42188 return new Parser(tokenizer.read()); 42189 }; 42190 Parser.parseValue = function (value) { 42191 return Parser.create(value).parseComponentValue(); 42192 }; 42193 Parser.parseValues = function (value) { 42194 return Parser.create(value).parseComponentValues(); 42195 }; 42196 Parser.prototype.parseComponentValue = function () { 42197 var token = this.consumeToken(); 42198 while (token.type === TokenType.WHITESPACE_TOKEN) { 42199 token = this.consumeToken(); 42200 } 42201 if (token.type === TokenType.EOF_TOKEN) { 42202 throw new SyntaxError("Error parsing CSS component value, unexpected EOF"); 42203 } 42204 this.reconsumeToken(token); 42205 var value = this.consumeComponentValue(); 42206 do { 42207 token = this.consumeToken(); 42208 } while (token.type === TokenType.WHITESPACE_TOKEN); 42209 if (token.type === TokenType.EOF_TOKEN) { 42210 return value; 42211 } 42212 throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one"); 42213 }; 42214 Parser.prototype.parseComponentValues = function () { 42215 var values = []; 42216 while (true) { 42217 var value = this.consumeComponentValue(); 42218 if (value.type === TokenType.EOF_TOKEN) { 42219 return values; 42220 } 42221 values.push(value); 42222 values.push(); 42223 } 42224 }; 42225 Parser.prototype.consumeComponentValue = function () { 42226 var token = this.consumeToken(); 42227 switch (token.type) { 42228 case TokenType.LEFT_CURLY_BRACKET_TOKEN: 42229 case TokenType.LEFT_SQUARE_BRACKET_TOKEN: 42230 case TokenType.LEFT_PARENTHESIS_TOKEN: 42231 return this.consumeSimpleBlock(token.type); 42232 case TokenType.FUNCTION_TOKEN: 42233 return this.consumeFunction(token); 42234 } 42235 return token; 42236 }; 42237 Parser.prototype.consumeSimpleBlock = function (type) { 42238 var block = { type: type, values: [] }; 42239 var token = this.consumeToken(); 42240 while (true) { 42241 if (token.type === TokenType.EOF_TOKEN || isEndingTokenFor(token, type)) { 42242 return block; 42243 } 42244 this.reconsumeToken(token); 42245 block.values.push(this.consumeComponentValue()); 42246 token = this.consumeToken(); 42247 } 42248 }; 42249 Parser.prototype.consumeFunction = function (functionToken) { 42250 var cssFunction = { 42251 name: functionToken.value, 42252 values: [], 42253 type: TokenType.FUNCTION 42254 }; 42255 while (true) { 42256 var token = this.consumeToken(); 42257 if (token.type === TokenType.EOF_TOKEN || token.type === TokenType.RIGHT_PARENTHESIS_TOKEN) { 42258 return cssFunction; 42259 } 42260 this.reconsumeToken(token); 42261 cssFunction.values.push(this.consumeComponentValue()); 42262 } 42263 }; 42264 Parser.prototype.consumeToken = function () { 42265 var token = this._tokens.shift(); 42266 return typeof token === 'undefined' ? EOF_TOKEN : token; 42267 }; 42268 Parser.prototype.reconsumeToken = function (token) { 42269 this._tokens.unshift(token); 42270 }; 42271 return Parser; 42272 }()); 42273 var isDimensionToken = function (token) { return token.type === TokenType.DIMENSION_TOKEN; }; 42274 var isNumberToken = function (token) { return token.type === TokenType.NUMBER_TOKEN; }; 42275 var isIdentToken = function (token) { return token.type === TokenType.IDENT_TOKEN; }; 42276 var isStringToken = function (token) { return token.type === TokenType.STRING_TOKEN; }; 42277 var isIdentWithValue = function (token, value) { 42278 return isIdentToken(token) && token.value === value; 42279 }; 42280 var nonWhiteSpace = function (token) { return token.type !== TokenType.WHITESPACE_TOKEN; }; 42281 var nonFunctionArgSeparator = function (token) { 42282 return token.type !== TokenType.WHITESPACE_TOKEN && token.type !== TokenType.COMMA_TOKEN; 42283 }; 42284 var parseFunctionArgs = function (tokens) { 42285 var args = []; 42286 var arg = []; 42287 tokens.forEach(function (token) { 42288 if (token.type === TokenType.COMMA_TOKEN) { 42289 if (arg.length === 0) { 42290 throw new Error("Error parsing function args, zero tokens for arg"); 42291 } 42292 args.push(arg); 42293 arg = []; 42294 return; 42295 } 42296 if (token.type !== TokenType.WHITESPACE_TOKEN) { 42297 arg.push(token); 42298 } 42299 }); 42300 if (arg.length) { 42301 args.push(arg); 42302 } 42303 return args; 42304 }; 42305 var isEndingTokenFor = function (token, type) { 42306 if (type === TokenType.LEFT_CURLY_BRACKET_TOKEN && token.type === TokenType.RIGHT_CURLY_BRACKET_TOKEN) { 42307 return true; 42308 } 42309 if (type === TokenType.LEFT_SQUARE_BRACKET_TOKEN && token.type === TokenType.RIGHT_SQUARE_BRACKET_TOKEN) { 42310 return true; 42311 } 42312 return type === TokenType.LEFT_PARENTHESIS_TOKEN && token.type === TokenType.RIGHT_PARENTHESIS_TOKEN; 42313 }; 42314 42315 var isLength = function (token) { 42316 return token.type === TokenType.NUMBER_TOKEN || token.type === TokenType.DIMENSION_TOKEN; 42317 }; 42318 42319 var isLengthPercentage = function (token) { 42320 return token.type === TokenType.PERCENTAGE_TOKEN || isLength(token); 42321 }; 42322 var parseLengthPercentageTuple = function (tokens) { 42323 return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]]; 42324 }; 42325 var ZERO_LENGTH = { 42326 type: TokenType.NUMBER_TOKEN, 42327 number: 0, 42328 flags: FLAG_INTEGER 42329 }; 42330 var FIFTY_PERCENT = { 42331 type: TokenType.PERCENTAGE_TOKEN, 42332 number: 50, 42333 flags: FLAG_INTEGER 42334 }; 42335 var HUNDRED_PERCENT = { 42336 type: TokenType.PERCENTAGE_TOKEN, 42337 number: 100, 42338 flags: FLAG_INTEGER 42339 }; 42340 var getAbsoluteValueForTuple = function (tuple, width, height) { 42341 var x = tuple[0], y = tuple[1]; 42342 return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)]; 42343 }; 42344 var getAbsoluteValue = function (token, parent) { 42345 if (token.type === TokenType.PERCENTAGE_TOKEN) { 42346 return (token.number / 100) * parent; 42347 } 42348 if (isDimensionToken(token)) { 42349 switch (token.unit) { 42350 case 'rem': 42351 case 'em': 42352 return 16 * token.number; // TODO use correct font-size 42353 case 'px': 42354 default: 42355 return token.number; 42356 } 42357 } 42358 return token.number; 42359 }; 42360 42361 var DEG = 'deg'; 42362 var GRAD = 'grad'; 42363 var RAD = 'rad'; 42364 var TURN = 'turn'; 42365 var angle = { 42366 name: 'angle', 42367 parse: function (value) { 42368 if (value.type === TokenType.DIMENSION_TOKEN) { 42369 switch (value.unit) { 42370 case DEG: 42371 return (Math.PI * value.number) / 180; 42372 case GRAD: 42373 return (Math.PI / 200) * value.number; 42374 case RAD: 42375 return value.number; 42376 case TURN: 42377 return Math.PI * 2 * value.number; 42378 } 42379 } 42380 throw new Error("Unsupported angle type"); 42381 } 42382 }; 42383 var isAngle = function (value) { 42384 if (value.type === TokenType.DIMENSION_TOKEN) { 42385 if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) { 42386 return true; 42387 } 42388 } 42389 return false; 42390 }; 42391 var parseNamedSide = function (tokens) { 42392 var sideOrCorner = tokens 42393 .filter(isIdentToken) 42394 .map(function (ident) { return ident.value; }) 42395 .join(' '); 42396 switch (sideOrCorner) { 42397 case 'to bottom right': 42398 case 'to right bottom': 42399 case 'left top': 42400 case 'top left': 42401 return [ZERO_LENGTH, ZERO_LENGTH]; 42402 case 'to top': 42403 case 'bottom': 42404 return deg(0); 42405 case 'to bottom left': 42406 case 'to left bottom': 42407 case 'right top': 42408 case 'top right': 42409 return [ZERO_LENGTH, HUNDRED_PERCENT]; 42410 case 'to right': 42411 case 'left': 42412 return deg(90); 42413 case 'to top left': 42414 case 'to left top': 42415 case 'right bottom': 42416 case 'bottom right': 42417 return [HUNDRED_PERCENT, HUNDRED_PERCENT]; 42418 case 'to bottom': 42419 case 'top': 42420 return deg(180); 42421 case 'to top right': 42422 case 'to right top': 42423 case 'left bottom': 42424 case 'bottom left': 42425 return [HUNDRED_PERCENT, ZERO_LENGTH]; 42426 case 'to left': 42427 case 'right': 42428 return deg(270); 42429 } 42430 return 0; 42431 }; 42432 var deg = function (deg) { return (Math.PI * deg) / 180; }; 42433 42434 var color = { 42435 name: 'color', 42436 parse: function (value) { 42437 if (value.type === TokenType.FUNCTION) { 42438 var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name]; 42439 if (typeof colorFunction === 'undefined') { 42440 throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\""); 42441 } 42442 return colorFunction(value.values); 42443 } 42444 if (value.type === TokenType.HASH_TOKEN) { 42445 if (value.value.length === 3) { 42446 var r = value.value.substring(0, 1); 42447 var g = value.value.substring(1, 2); 42448 var b = value.value.substring(2, 3); 42449 return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1); 42450 } 42451 if (value.value.length === 4) { 42452 var r = value.value.substring(0, 1); 42453 var g = value.value.substring(1, 2); 42454 var b = value.value.substring(2, 3); 42455 var a = value.value.substring(3, 4); 42456 return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255); 42457 } 42458 if (value.value.length === 6) { 42459 var r = value.value.substring(0, 2); 42460 var g = value.value.substring(2, 4); 42461 var b = value.value.substring(4, 6); 42462 return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1); 42463 } 42464 if (value.value.length === 8) { 42465 var r = value.value.substring(0, 2); 42466 var g = value.value.substring(2, 4); 42467 var b = value.value.substring(4, 6); 42468 var a = value.value.substring(6, 8); 42469 return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255); 42470 } 42471 } 42472 if (value.type === TokenType.IDENT_TOKEN) { 42473 var namedColor = COLORS[value.value.toUpperCase()]; 42474 if (typeof namedColor !== 'undefined') { 42475 return namedColor; 42476 } 42477 } 42478 return COLORS.TRANSPARENT; 42479 } 42480 }; 42481 var isTransparent = function (color) { return (0xff & color) === 0; }; 42482 var asString = function (color) { 42483 var alpha = 0xff & color; 42484 var blue = 0xff & (color >> 8); 42485 var green = 0xff & (color >> 16); 42486 var red = 0xff & (color >> 24); 42487 return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")"; 42488 }; 42489 var pack = function (r, g, b, a) { 42490 return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0; 42491 }; 42492 var getTokenColorValue = function (token, i) { 42493 if (token.type === TokenType.NUMBER_TOKEN) { 42494 return token.number; 42495 } 42496 if (token.type === TokenType.PERCENTAGE_TOKEN) { 42497 var max = i === 3 ? 1 : 255; 42498 return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max); 42499 } 42500 return 0; 42501 }; 42502 var rgb = function (args) { 42503 var tokens = args.filter(nonFunctionArgSeparator); 42504 if (tokens.length === 3) { 42505 var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2]; 42506 return pack(r, g, b, 1); 42507 } 42508 if (tokens.length === 4) { 42509 var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3]; 42510 return pack(r, g, b, a); 42511 } 42512 return 0; 42513 }; 42514 function hue2rgb(t1, t2, hue) { 42515 if (hue < 0) { 42516 hue += 1; 42517 } 42518 if (hue >= 1) { 42519 hue -= 1; 42520 } 42521 if (hue < 1 / 6) { 42522 return (t2 - t1) * hue * 6 + t1; 42523 } 42524 else if (hue < 1 / 2) { 42525 return t2; 42526 } 42527 else if (hue < 2 / 3) { 42528 return (t2 - t1) * 6 * (2 / 3 - hue) + t1; 42529 } 42530 else { 42531 return t1; 42532 } 42533 } 42534 var hsl = function (args) { 42535 var tokens = args.filter(nonFunctionArgSeparator); 42536 var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3]; 42537 var h = (hue.type === TokenType.NUMBER_TOKEN ? deg(hue.number) : angle.parse(hue)) / (Math.PI * 2); 42538 var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0; 42539 var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0; 42540 var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1; 42541 if (s === 0) { 42542 return pack(l * 255, l * 255, l * 255, 1); 42543 } 42544 var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; 42545 var t1 = l * 2 - t2; 42546 var r = hue2rgb(t1, t2, h + 1 / 3); 42547 var g = hue2rgb(t1, t2, h); 42548 var b = hue2rgb(t1, t2, h - 1 / 3); 42549 return pack(r * 255, g * 255, b * 255, a); 42550 }; 42551 var SUPPORTED_COLOR_FUNCTIONS = { 42552 hsl: hsl, 42553 hsla: hsl, 42554 rgb: rgb, 42555 rgba: rgb 42556 }; 42557 var COLORS = { 42558 ALICEBLUE: 0xf0f8ffff, 42559 ANTIQUEWHITE: 0xfaebd7ff, 42560 AQUA: 0x00ffffff, 42561 AQUAMARINE: 0x7fffd4ff, 42562 AZURE: 0xf0ffffff, 42563 BEIGE: 0xf5f5dcff, 42564 BISQUE: 0xffe4c4ff, 42565 BLACK: 0x000000ff,
42566 BLANCHEDALMOND: 0xffebcdff, 42567 BLUE: 0x0000ffff, 42568 BLUEVIOLET: 0x8a2be2ff, 42569 BROWN: 0xa52a2aff, 42570 BURLYWOOD: 0xdeb887ff, 42571 CADETBLUE: 0x5f9ea0ff, 42572 CHARTREUSE: 0x7fff00ff, 42573 CHOCOLATE: 0xd2691eff, 42574 CORAL: 0xff7f50ff, 42575 CORNFLOWERBLUE: 0x6495edff, 42576 CORNSILK: 0xfff8dcff, 42577 CRIMSON: 0xdc143cff, 42578 CYAN: 0x00ffffff, 42579 DARKBLUE: 0x00008bff, 42580 DARKCYAN: 0x008b8bff, 42581 DARKGOLDENROD: 0xb886bbff, 42582 DARKGRAY: 0xa9a9a9ff, 42583 DARKGREEN: 0x006400ff, 42584 DARKGREY: 0xa9a9a9ff, 42585 DARKKHAKI: 0xbdb76bff, 42586 DARKMAGENTA: 0x8b008bff, 42587 DARKOLIVEGREEN: 0x556b2fff, 42588 DARKORANGE: 0xff8c00ff, 42589 DARKORCHID: 0x9932ccff, 42590 DARKRED: 0x8b0000ff, 42591 DARKSALMON: 0xe9967aff, 42592 DARKSEAGREEN: 0x8fbc8fff, 42593 DARKSLATEBLUE: 0x483d8bff, 42594 DARKSLATEGRAY: 0x2f4f4fff, 42595 DARKSLATEGREY: 0x2f4f4fff, 42596 DARKTURQUOISE: 0x00ced1ff, 42597 DARKVIOLET: 0x9400d3ff, 42598 DEEPPINK: 0xff1493ff, 42599 DEEPSKYBLUE: 0x00bfffff, 42600 DIMGRAY: 0x696969ff, 42601 DIMGREY: 0x696969ff, 42602 DODGERBLUE: 0x1e90ffff, 42603 FIREBRICK: 0xb22222ff, 42604 FLORALWHITE: 0xfffaf0ff, 42605 FORESTGREEN: 0x228b22ff, 42606 FUCHSIA: 0xff00ffff, 42607 GAINSBORO: 0xdcdcdcff, 42608 GHOSTWHITE: 0xf8f8ffff, 42609 GOLD: 0xffd700ff, 42610 GOLDENROD: 0xdaa520ff, 42611 GRAY: 0x808080ff, 42612 GREEN: 0x008000ff, 42613 GREENYELLOW: 0xadff2fff, 42614 GREY: 0x808080ff, 42615 HONEYDEW: 0xf0fff0ff, 42616 HOTPINK: 0xff69b4ff, 42617 INDIANRED: 0xcd5c5cff, 42618 INDIGO: 0x4b0082ff, 42619 IVORY: 0xfffff0ff, 42620 KHAKI: 0xf0e68cff, 42621 LAVENDER: 0xe6e6faff, 42622 LAVENDERBLUSH: 0xfff0f5ff, 42623 LAWNGREEN: 0x7cfc00ff, 42624 LEMONCHIFFON: 0xfffacdff, 42625 LIGHTBLUE: 0xadd8e6ff, 42626 LIGHTCORAL: 0xf08080ff, 42627 LIGHTCYAN: 0xe0ffffff, 42628 LIGHTGOLDENRODYELLOW: 0xfafad2ff, 42629 LIGHTGRAY: 0xd3d3d3ff, 42630 LIGHTGREEN: 0x90ee90ff, 42631 LIGHTGREY: 0xd3d3d3ff, 42632 LIGHTPINK: 0xffb6c1ff, 42633 LIGHTSALMON: 0xffa07aff, 42634 LIGHTSEAGREEN: 0x20b2aaff, 42635 LIGHTSKYBLUE: 0x87cefaff, 42636 LIGHTSLATEGRAY: 0x778899ff, 42637 LIGHTSLATEGREY: 0x778899ff, 42638 LIGHTSTEELBLUE: 0xb0c4deff, 42639 LIGHTYELLOW: 0xffffe0ff, 42640 LIME: 0x00ff00ff, 42641 LIMEGREEN: 0x32cd32ff, 42642 LINEN: 0xfaf0e6ff, 42643 MAGENTA: 0xff00ffff, 42644 MAROON: 0x800000ff, 42645 MEDIUMAQUAMARINE: 0x66cdaaff, 42646 MEDIUMBLUE: 0x0000cdff, 42647 MEDIUMORCHID: 0xba55d3ff, 42648 MEDIUMPURPLE: 0x9370dbff, 42649 MEDIUMSEAGREEN: 0x3cb371ff, 42650 MEDIUMSLATEBLUE: 0x7b68eeff, 42651 MEDIUMSPRINGGREEN: 0x00fa9aff, 42652 MEDIUMTURQUOISE: 0x48d1ccff, 42653 MEDIUMVIOLETRED: 0xc71585ff, 42654 MIDNIGHTBLUE: 0x191970ff, 42655 MINTCREAM: 0xf5fffaff, 42656 MISTYROSE: 0xffe4e1ff, 42657 MOCCASIN: 0xffe4b5ff, 42658 NAVAJOWHITE: 0xffdeadff, 42659 NAVY: 0x000080ff, 42660 OLDLACE: 0xfdf5e6ff, 42661 OLIVE: 0x808000ff, 42662 OLIVEDRAB: 0x6b8e23ff, 42663 ORANGE: 0xffa500ff, 42664 ORANGERED: 0xff4500ff, 42665 ORCHID: 0xda70d6ff, 42666 PALEGOLDENROD: 0xeee8aaff, 42667 PALEGREEN: 0x98fb98ff, 42668 PALETURQUOISE: 0xafeeeeff, 42669 PALEVIOLETRED: 0xdb7093ff, 42670 PAPAYAWHIP: 0xffefd5ff, 42671 PEACHPUFF: 0xffdab9ff, 42672 PERU: 0xcd853fff, 42673 PINK: 0xffc0cbff, 42674 PLUM: 0xdda0ddff, 42675 POWDERBLUE: 0xb0e0e6ff, 42676 PURPLE: 0x800080ff, 42677 REBECCAPURPLE: 0x663399ff, 42678 RED: 0xff0000ff, 42679 ROSYBROWN: 0xbc8f8fff, 42680 ROYALBLUE: 0x4169e1ff, 42681 SADDLEBROWN: 0x8b4513ff, 42682 SALMON: 0xfa8072ff, 42683 SANDYBROWN: 0xf4a460ff, 42684 SEAGREEN: 0x2e8b57ff, 42685 SEASHELL: 0xfff5eeff, 42686 SIENNA: 0xa0522dff, 42687 SILVER: 0xc0c0c0ff, 42688 SKYBLUE: 0x87ceebff, 42689 SLATEBLUE: 0x6a5acdff, 42690 SLATEGRAY: 0x708090ff, 42691 SLATEGREY: 0x708090ff, 42692 SNOW: 0xfffafaff, 42693 SPRINGGREEN: 0x00ff7fff, 42694 STEELBLUE: 0x4682b4ff, 42695 TAN: 0xd2b48cff, 42696 TEAL: 0x008080ff, 42697 THISTLE: 0xd8bfd8ff, 42698 TOMATO: 0xff6347ff, 42699 TRANSPARENT: 0x00000000, 42700 TURQUOISE: 0x40e0d0ff, 42701 VIOLET: 0xee82eeff, 42702 WHEAT: 0xf5deb3ff, 42703 WHITE: 0xffffffff, 42704 WHITESMOKE: 0xf5f5f5ff, 42705 YELLOW: 0xffff00ff, 42706 YELLOWGREEN: 0x9acd32ff 42707 }; 42708 42709 var PropertyDescriptorParsingType; 42710 (function (PropertyDescriptorParsingType) { 42711 PropertyDescriptorParsingType[PropertyDescriptorParsingType["VALUE"] = 0] = "VALUE"; 42712 PropertyDescriptorParsingType[PropertyDescriptorParsingType["LIST"] = 1] = "LIST"; 42713 PropertyDescriptorParsingType[PropertyDescriptorParsingType["IDENT_VALUE"] = 2] = "IDENT_VALUE"; 42714 PropertyDescriptorParsingType[PropertyDescriptorParsingType["TYPE_VALUE"] = 3] = "TYPE_VALUE"; 42715 PropertyDescriptorParsingType[PropertyDescriptorParsingType["TOKEN_VALUE"] = 4] = "TOKEN_VALUE"; 42716 })(PropertyDescriptorParsingType || (PropertyDescriptorParsingType = {})); 42717 42718 var BACKGROUND_CLIP; 42719 (function (BACKGROUND_CLIP) { 42720 BACKGROUND_CLIP[BACKGROUND_CLIP["BORDER_BOX"] = 0] = "BORDER_BOX"; 42721 BACKGROUND_CLIP[BACKGROUND_CLIP["PADDING_BOX"] = 1] = "PADD
vendor: 12,966 bytes, lines 42721-43017
42721ING_BOX"; 42722 BACKGROUND_CLIP[BACKGROUND_CLIP["CONTENT_BOX"] = 2] = "CONTENT_BOX"; 42723 })(BACKGROUND_CLIP || (BACKGROUND_CLIP = {})); 42724 var backgroundClip = { 42725 name: 'background-clip', 42726 initialValue: 'border-box', 42727 prefix: false, 42728 type: PropertyDescriptorParsingType.LIST, 42729 parse: function (tokens) { 42730 return tokens.map(function (token) { 42731 if (isIdentToken(token)) { 42732 switch (token.value) { 42733 case 'padding-box': 42734 return BACKGROUND_CLIP.PADDING_BOX; 42735 case 'content-box': 42736 return BACKGROUND_CLIP.CONTENT_BOX; 42737 } 42738 } 42739 return BACKGROUND_CLIP.BORDER_BOX; 42740 }); 42741 } 42742 }; 42743 42744 var backgroundColor = { 42745 name: "background-color", 42746 initialValue: 'transparent', 42747 prefix: false, 42748 type: PropertyDescriptorParsingType.TYPE_VALUE, 42749 format: 'color' 42750 }; 42751 42752 var parseColorStop = function (args) { 42753 var color$1 = color.parse(args[0]); 42754 var stop = args[1]; 42755 return stop && isLengthPercentage(stop) ? { color: color$1, stop: stop } : { color: color$1, stop: null }; 42756 }; 42757 var processColorStops = function (stops, lineLength) { 42758 var first = stops[0]; 42759 var last = stops[stops.length - 1]; 42760 if (first.stop === null) { 42761 first.stop = ZERO_LENGTH; 42762 } 42763 if (last.stop === null) { 42764 last.stop = HUNDRED_PERCENT; 42765 } 42766 var processStops = []; 42767 var previous = 0; 42768 for (var i = 0; i < stops.length; i++) { 42769 var stop_1 = stops[i].stop; 42770 if (stop_1 !== null) { 42771 var absoluteValue = getAbsoluteValue(stop_1, lineLength); 42772 if (absoluteValue > previous) { 42773 processStops.push(absoluteValue); 42774 } 42775 else { 42776 processStops.push(previous); 42777 } 42778 previous = absoluteValue; 42779 } 42780 else { 42781 processStops.push(null); 42782 } 42783 } 42784 var gapBegin = null; 42785 for (var i = 0; i < processStops.length; i++) { 42786 var stop_2 = processStops[i]; 42787 if (stop_2 === null) { 42788 if (gapBegin === null) { 42789 gapBegin = i; 42790 } 42791 } 42792 else if (gapBegin !== null) { 42793 var gapLength = i - gapBegin; 42794 var beforeGap = processStops[gapBegin - 1]; 42795 var gapValue = (stop_2 - beforeGap) / (gapLength + 1); 42796 for (var g = 1; g <= gapLength; g++) { 42797 processStops[gapBegin + g - 1] = gapValue * g; 42798 } 42799 gapBegin = null; 42800 } 42801 } 42802 return stops.map(function (_a, i) { 42803 var color = _a.color; 42804 return { color: color, stop: Math.max(Math.min(1, processStops[i] / lineLength), 0) }; 42805 }); 42806 }; 42807 var getAngleFromCorner = function (corner, width, height) { 42808 var centerX = width / 2; 42809 var centerY = height / 2; 42810 var x = getAbsoluteValue(corner[0], width) - centerX; 42811 var y = centerY - getAbsoluteValue(corner[1], height); 42812 return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2); 42813 }; 42814 var calculateGradientDirection = function (angle, width, height) { 42815 var radian = typeof angle === 'number' ? angle : getAngleFromCorner(angle, width, height); 42816 var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian)); 42817 var halfWidth = width / 2; 42818 var halfHeight = height / 2; 42819 var halfLineLength = lineLength / 2; 42820 var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength; 42821 var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength; 42822 return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff]; 42823 }; 42824 var distance = function (a, b) { return Math.sqrt(a * a + b * b); }; 42825 var findCorner = function (width, height, x, y, closest) { 42826 var corners = [[0, 0], [0, height], [width, 0], [width, height]]; 42827 return corners.reduce(function (stat, corner) { 42828 var cx = corner[0], cy = corner[1]; 42829 var d = distance(x - cx, y - cy); 42830 if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) { 42831 return { 42832 optimumCorner: corner, 42833 optimumDistance: d 42834 }; 42835 } 42836 return stat; 42837 }, { 42838 optimumDistance: closest ? Infinity : -Infinity, 42839 optimumCorner: null 42840 }).optimumCorner; 42841 }; 42842 var calculateRadius = function (gradient, x, y, width, height) { 42843 var rx = 0; 42844 var ry = 0; 42845 switch (gradient.size) { 42846 case CSSRadialExtent.CLOSEST_SIDE: 42847 // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradientâs center. 42848 // If the shape is an ellipse, it exactly meets the closest side in each dimension. 42849 if (gradient.shape === CSSRadialShape.CIRCLE) { 42850 rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height)); 42851 } 42852 else if (gradient.shape === CSSRadialShape.ELLIPSE) { 42853 rx = Math.min(Math.abs(x), Math.abs(x - width)); 42854 ry = Math.min(Math.abs(y), Math.abs(y - height)); 42855 } 42856 break; 42857 case CSSRadialExtent.CLOSEST_CORNER: 42858 // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradientâs center. 42859 // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified. 42860 if (gradient.shape === CSSRadialShape.CIRCLE) { 42861 rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height)); 42862 } 42863 else if (gradient.shape === CSSRadialShape.ELLIPSE) { 42864 // Compute the ratio ry/rx (which is to be the same as for "closest-side") 42865 var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width)); 42866 var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1]; 42867 rx = distance(cx - x, (cy - y) / c); 42868 ry = c * rx; 42869 } 42870 break; 42871 case CSSRadialExtent.FARTHEST_SIDE: 42872 // Same as closest-side, except the ending shape is sized based on the farthest side(s) 42873 if (gradient.shape === CSSRadialShape.CIRCLE) { 42874 rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height)); 42875 } 42876 else if (gradient.shape === CSSRadialShape.ELLIPSE) { 42877 rx = Math.max(Math.abs(x), Math.abs(x - width)); 42878 ry = Math.max(Math.abs(y), Math.abs(y - height)); 42879 } 42880 break; 42881 case CSSRadialExtent.FARTHEST_CORNER: 42882 // Same as closest-corner, except the ending shape is sized based on the farthest corner. 42883 // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified. 42884 if (gradient.shape === CSSRadialShape.CIRCLE) { 42885 rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height)); 42886 } 42887 else if (gradient.shape === CSSRadialShape.ELLIPSE) { 42888 // Compute the ratio ry/rx (which is to be the same as for "farthest-side") 42889 var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width)); 42890 var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1]; 42891 rx = distance(cx - x, (cy - y) / c); 42892 ry = c * rx; 42893 } 42894 break; 42895 } 42896 if (Array.isArray(gradient.size)) { 42897 rx = getAbsoluteValue(gradient.size[0], width); 42898 ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx; 42899 } 42900 return [rx, ry]; 42901 }; 42902 42903 var linearGradient = function (tokens) { 42904 var angle$1 = deg(180); 42905 var stops = []; 42906 parseFunctionArgs(tokens).forEach(function (arg, i) { 42907 if (i === 0) { 42908 var firstToken = arg[0]; 42909 if (firstToken.type === TokenType.IDENT_TOKEN && firstToken.value === 'to') { 42910 angle$1 = parseNamedSide(arg); 42911 return; 42912 } 42913 else if (isAngle(firstToken)) { 42914 angle$1 = angle.parse(firstToken); 42915 return; 42916 } 42917 } 42918 var colorStop = parseColorStop(arg); 42919 stops.push(colorStop); 42920 }); 42921 return { angle: angle$1, stops: stops, type: CSSImageType.LINEAR_GRADIENT }; 42922 }; 42923 42924 var prefixLinearGradient = function (tokens) { 42925 var angle$1 = deg(180); 42926 var stops = []; 42927 parseFunctionArgs(tokens).forEach(function (arg, i) { 42928 if (i === 0) { 42929 var firstToken = arg[0]; 42930 if (firstToken.type === TokenType.IDENT_TOKEN && 42931 ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) { 42932 angle$1 = parseNamedSide(arg); 42933 return; 42934 } 42935 else if (isAngle(firstToken)) { 42936 angle$1 = (angle.parse(firstToken) + deg(270)) % deg(360); 42937 return; 42938 } 42939 } 42940 var colorStop = parseColorStop(arg); 42941 stops.push(colorStop); 42942 }); 42943 return { 42944 angle: angle$1, 42945 stops: stops, 42946 type: CSSImageType.LINEAR_GRADIENT 42947 }; 42948 }; 42949 42950 var testRangeBounds = function (document) { 42951 var TEST_HEIGHT = 123; 42952 if (document.createRange) { 42953 var range = document.createRange(); 42954 if (range.getBoundingClientRect) { 42955 var testElement = document.createElement('boundtest'); 42956 testElement.style.height = TEST_HEIGHT + "px"; 42957 testElement.style.display = 'block'; 42958 document.body.appendChild(testElement); 42959 range.selectNode(testElement); 42960 var rangeBounds = range.getBoundingClientRect(); 42961 var rangeHeight = Math.round(rangeBounds.height); 42962 document.body.removeChild(testElement); 42963 if (rangeHeight === TEST_HEIGHT) { 42964 return true; 42965 } 42966 } 42967 } 42968 return false; 42969 }; 42970 var testCORS = function () { return typeof new Image().crossOrigin !== 'undefined'; }; 42971 var testResponseType = function () { return typeof new XMLHttpRequest().responseType === 'string'; }; 42972 var testSVG = function (document) { 42973 var img = new Image(); 42974 var canvas = document.createElement('canvas'); 42975 var ctx = canvas.getContext('2d'); 42976 if (!ctx) { 42977 return false; 42978 } 42979 img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"; 42980 try { 42981 ctx.drawImage(img, 0, 0); 42982 canvas.toDataURL(); 42983 } 42984 catch (e) { 42985 return false; 42986 } 42987 return true; 42988 }; 42989 var isGreenPixel = function (data) { 42990 return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255; 42991 }; 42992 var testForeignObject = function (document) { 42993 var canvas = document.createElement('canvas'); 42994 var size = 100; 42995 canvas.width = size; 42996 canvas.height = size; 42997 var ctx = canvas.getContext('2d'); 42998 if (!ctx) { 42999 return Promise.reject(false); 43000 } 43001 ctx.fillStyle = 'rgb(0, 255, 0)'; 43002 ctx.fillRect(0, 0, size, size); 43003 var img = new Image(); 43004 var greenImageSrc = canvas.toDataURL(); 43005 img.src = greenImageSrc; 43006 var svg = createForeignObjectSVG(size, size, 0, 0, img); 43007 ctx.fillStyle = 'red'; 43008 ctx.fillRect(0, 0, size, size); 43009 return loadSerializedSVG(svg) 43010 .then(function (img) { 43011 ctx.drawImage(img, 0, 0); 43012 var data = ctx.getImageData(0, 0, size, size).data; 43013 ctx.fillStyle = 'red'; 43014 ctx.fillRect(0, 0, size, size); 43015 var node = document.createElement('div'); 43016 node.style.backgroundImage = "url(" + greenImageSrc + ")"; 43017 node.style.height = size + "px";
43018 // Firefox 55 does not render inline <img /> tags 43019 return isGreenPixel(data) 43020 ? loadSerializedSVG(createForeignObjectSVG(size, size, 0, 0, node)) 43021 : Promise.reject(false); 43022 }) 43023 .then(function (img) { 43024 ctx.drawImage(img, 0, 0); 43025 // Edge does not render background-images 43026 return isGreenPixel(ctx.getImageData(0, 0, size, size).data); 43027 }) 43028 .catch(function () { return false; }); 43029 }; 43030 var createForeignObjectSVG = function (width, height, x, y, node) { 43031 var xmlns = 'http://www.w3.org/2000/svg'; 43032 var svg = document.createElementNS(xmlns, 'svg'); 43033 var foreignObject = document.createElementNS(xmlns, 'foreignObject'); 43034 svg.setAttributeNS(null, 'width', width.toString()); 43035 svg.setAttributeNS(null, 'height', height.toString()); 43036 foreignObject.setAttributeNS(null, 'width', '100%'); 43037 foreignObject.setAttributeNS(null, 'height', '100%'); 43038 foreignObject.setAttributeNS(null, 'x', x.toString()); 43039 foreignObject.setAttributeNS(null, 'y', y.toString()); 43040 foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true'); 43041 svg.appendChild(foreignObject); 43042 foreignObject.appendChild(node); 43043 return svg; 43044 }; 43045 var loadSerializedSVG = function (svg) { 43046 return new Promise(function (resolve, reject) { 43047 var img = new Image(); 43048 img.onload = function () { return resolve(img); }; 43049 img.onerror = reject; 43050 img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg)); 43051 }); 43052 }; 43053 var FEATURES = { 43054 get SUPPORT_RANGE_BOUNDS() { 43055 var value = testRangeBounds(document); 43056 Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value }); 43057 return value; 43058 }, 43059 get SUPPORT_SVG_DRAWING() { 43060 var value = testSVG(document); 43061 Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value }); 43062 return value; 43063 }, 43064 get SUPPORT_FOREIGNOBJECT_DRAWING() { 43065 var value = typeof Array.from === 'function' && typeof window.fetch === 'function' 43066 ? testForeignObject(document) 43067 : Promise.resolve(false); 43068 Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value }); 43069 return value; 43070 }, 43071 get SUPPORT_CORS_IMAGES() { 43072 var value = testCORS(); 43073 Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value }); 43074 return value; 43075 }, 43076 get SUPPORT_RESPONSE_TYPE() { 43077 var value = testResponseType(); 43078 Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value }); 43079 return value; 43080 }, 43081 get SUPPORT_CORS_XHR() { 43082 var value = 'withCredentials' in new XMLHttpRequest(); 43083 Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value }); 43084 return value; 43085 } 43086 }; 43087 43088 var Logger = /** @class */ (function () { 43089 function Logger(_a) { 43090 var id = _a.id, enabled = _a.enabled; 43091 this.id = id; 43092 this.enabled = enabled; 43093 this.start = Date.now(); 43094 } 43095 // eslint-disable-next-line @typescript-eslint/no-explicit-any 43096 Logger.prototype.debug = function () { 43097 var args = []; 43098 for (var _i = 0; _i < arguments.length; _i++) { 43099 args[_i] = arguments[_i]; 43100 } 43101 if (this.enabled) { 43102 // eslint-disable-next-line no-console 43103 if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') { 43104 // eslint-disable-next-line no-console 43105 console.debug.apply(console, [this.id, this.getTime() + "ms"].concat(args)); 43106 } 43107 else { 43108 this.info.apply(this, args); 43109 } 43110 } 43111 }; 43112 Logger.prototype.getTime = function () { 43113 return Date.now() - this.start; 43114 }; 43115 Logger.create = function (options) { 43116 Logger.instances[options.id] = new Logger(options); 43117 }; 43118 Logger.destroy = function (id) { 43119 delete Logger.instances[id]; 43120 }; 43121 Logger.getInstance = function (id) { 43122 var instance = Logger.instances[id]; 43123 if (typeof instance === 'undefined') { 43124 throw new Error("No logger instance found with id " + id); 43125 } 43126 return instance; 43127 }; 43128 // eslint-disable-next-line @typescript-eslint/no-explicit-any 43129 Logger.prototype.info = function () { 43130 var args = []; 43131 for (var _i = 0; _i < arguments.length; _i++) { 43132 args[_i] = arguments[_i]; 43133 } 43134 if (this.enabled) { 43135 // eslint-disable-next-line no-console 43136 if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') { 43137 // eslint-disable-next-line no-console 43138 console.info.apply(console, [this.id, this.getTime() + "ms"].concat(args)); 43139 } 43140 } 43141 }; 43142 // eslint-disable-next-line @typescript-eslint/no-explicit-any 43143 Logger.prototype.error = function () { 43144 var args = []; 43145 for (var _i = 0; _i < arguments.length; _i++) { 43146 args[_i] = arguments[_i]; 43147 } 43148 if (this.enabled) { 43149 // eslint-disable-next-line no-console 43150 if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') { 43151 // eslint-disable-next-line no-console 43152 console.error.apply(console, [this.id, this.getTime() + "ms"].concat(args)); 43153 } 43154 else { 43155 this.info.apply(this, args); 43156 } 43157 } 43158 }; 43159 Logger.instances = {}; 43160 return Logger; 43161 }()); 43162 43163 var CacheStorage = /** @class */ (function () { 43164 function CacheStorage() { 43165 } 43166 CacheStorage.create = function (name, options) { 43167 return (CacheStorage._caches[name] = new Cache(name, options)); 43168 }; 43169 CacheStorage.destroy = function (name) { 43170 delete CacheStorage._caches[name]; 43171 }; 43172 CacheStorage.open = function (name) { 43173 var cache = CacheStorage._caches[name]; 43174 if (typeof cache !== 'undefined') { 43175 return cache; 43176 } 43177 throw new Error("Cache with key \"" + name + "\" not found"); 43178 }; 43179 CacheStorage.getOrigin = function (url) { 43180 var link = CacheStorage._link; 43181 if (!link) { 43182 return 'about:blank'; 43183 } 43184 link.href = url; 43185 link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/ 43186 return link.protocol + link.hostname + link.port; 43187 }; 43188 CacheStorage.isSameOrigin = function (src) { 43189 return CacheStorage.getOrigin(src) === CacheStorage._origin; 43190 }; 43191 CacheStorage.setContext = function (window) { 43192 CacheStorage._link = window.document.createElement('a'); 43193 CacheStorage._origin = CacheStorage.getOrigin(window.location.href); 43194 }; 43195 CacheStorage.getInstance = function () { 43196 var current = CacheStorage._current; 43197 if (current === null) { 43198 throw new Error("No cache instance attached"); 43199 } 43200 return current; 43201 }; 43202 CacheStorage.attachInstance = function (cache) { 43203 CacheStorage._current = cache; 43204 }; 43205 CacheStorage.detachInstance = function () { 43206 CacheStorage._current = null; 43207 }; 43208 CacheStorage._caches = {}; 43209 CacheStorage._origin = 'about:blank'; 43210 CacheStorage._current = null; 43211 return CacheStorage; 43212 }()); 43213 var Cache = /** @class */ (function () { 43214 function Cache(id, options) { 43215 this.id = id; 43216 this._options = options; 43217 this._cache = {}; 43218 } 43219 Cache.prototype.addImage = function (src) { 43220 var result = Promise.resolve(); 43221 if (this.has(src)) { 43222 return result; 43223 } 43224 if (isBlobImage(src) || isRenderable(src)) { 43225 this._cache[src] = this.loadImage(src); 43226 return result; 43227 } 43228 return result; 43229 }; 43230 // eslint-disable-next-line @typescript-eslint/no-explicit-any 43231 Cache.prototype.match = function (src) { 43232 return this._cache[src]; 43233 }; 43234 Cache.prototype.loadImage = function (key) { 43235 return __awaiter(this, void 0, void 0, function () { 43236 var isSameOrigin, useCORS, useProxy, src; 43237 var _this = this; 43238 return __generator(this, function (_a) { 43239 switch (_a.label) { 43240 case 0: 43241 isSameOrigin = CacheStorage.isSameOrigin(key); 43242 useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin; 43243 useProxy = !isInlineImage(key) && 43244 !isSameOrigin && 43245 typeof this._options.proxy === 'string' && 43246 FEATURES.SUPPORT_CORS_XHR && 43247 !useCORS; 43248 if (!isSameOrigin && this._options.allowTaint === false && !isInlineImage(key) && !useProxy && !useCORS) { 43249 return [2 /*return*/]; 43250 } 43251 src = key; 43252 if (!useProxy) return [3 /*break*/, 2]; 43253 return [4 /*yield*/, this.proxy(src)]; 43254 case 1: 43255 src = _a.sent(); 43256 _a.label = 2; 43257 case 2:
vendor: 4,574 bytes, lines 43258-43343
43258 Logger.getInstance(this.id).debug("Added image " + key.substring(0, 256)); 43259 return [4 /*yield*/, new Promise(function (resolve, reject) { 43260 var img = new Image(); 43261 img.onload = function () { return resolve(img); }; 43262 img.onerror = reject; 43263 //ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous 43264 if (isInlineBase64Image(src) || useCORS) { 43265 img.crossOrigin = 'anonymous'; 43266 } 43267 img.src = src; 43268 if (img.complete === true) { 43269 // Inline XML images may fail to parse, throwing an Error later on 43270 setTimeout(function () { return resolve(img); }, 500); 43271 } 43272 if (_this._options.imageTimeout > 0) { 43273 setTimeout(function () { return reject("Timed out (" + _this._options.imageTimeout + "ms) loading image"); }, _this._options.imageTimeout); 43274 } 43275 })]; 43276 case 3: return [2 /*return*/, _a.sent()]; 43277 } 43278 }); 43279 }); 43280 }; 43281 Cache.prototype.has = function (key) { 43282 return typeof this._cache[key] !== 'undefined'; 43283 }; 43284 Cache.prototype.keys = function () { 43285 return Promise.resolve(Object.keys(this._cache)); 43286 }; 43287 Cache.prototype.proxy = function (src) { 43288 var _this = this; 43289 var proxy = this._options.proxy; 43290 if (!proxy) { 43291 throw new Error('No proxy defined'); 43292 } 43293 var key = src.substring(0, 256); 43294 return new Promise(function (resolve, reject) { 43295 var responseType = FEATURES.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text'; 43296 var xhr = new XMLHttpRequest(); 43297 xhr.onload = function () { 43298 if (xhr.status === 200) { 43299 if (responseType === 'text') { 43300 resolve(xhr.response); 43301 } 43302 else { 43303 var reader_1 = new FileReader(); 43304 reader_1.addEventListener('load', function () { return resolve(reader_1.result); }, false); 43305 reader_1.addEventListener('error', function (e) { return reject(e); }, false); 43306 reader_1.readAsDataURL(xhr.response); 43307 } 43308 } 43309 else { 43310 reject("Failed to proxy resource " + key + " with status code " + xhr.status); 43311 } 43312 }; 43313 xhr.onerror = reject; 43314 xhr.open('GET', proxy + "?url=" + encodeURIComponent(src) + "&responseType=" + responseType); 43315 if (responseType !== 'text' && xhr instanceof XMLHttpRequest) { 43316 xhr.responseType = responseType; 43317 } 43318 if (_this._options.imageTimeout) { 43319 var timeout_1 = _this._options.imageTimeout; 43320 xhr.timeout = timeout_1; 43321 xhr.ontimeout = function () { return reject("Timed out (" + timeout_1 + "ms) proxying " + key); }; 43322 } 43323 xhr.send(); 43324 }); 43325 }; 43326 return Cache; 43327 }()); 43328 var INLINE_SVG = /^data:image\/svg\+xml/i; 43329 var INLINE_BASE64 = /^data:image\/.*;base64,/i; 43330 var INLINE_IMG = /^data:image\/.*/i; 43331 var isRenderable = function (src) { return FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src); }; 43332 var isInlineImage = function (src) { return INLINE_IMG.test(src); }; 43333 var isInlineBase64Image = function (src) { return INLINE_BASE64.test(src); }; 43334 var isBlobImage = function (src) { return src.substr(0, 4) === 'blob'; }; 43335 var isSVG = function (src) { return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src); }; 43336 43337 var webkitGradient = function (tokens) { 43338 var angle = deg(180); 43339 var stops = []; 43340 var type = CSSImageType.LINEAR_GRADIENT; 43341 var shape = CSSRadialShape.CIRCLE; 43342 var size = CSSRadialExtent.FARTHEST_CORNER; 43343 var position = [];
43344 parseFunctionArgs(tokens).forEach(function (arg, i) { 43345 var firstToken = arg[0]; 43346 if (i === 0) { 43347 if (isIdentToken(firstToken) && firstToken.value === 'linear') { 43348 type = CSSImageType.LINEAR_GRADIENT; 43349 return; 43350 } 43351 else if (isIdentToken(firstToken) && firstToken.value === 'radial') { 43352 type = CSSImageType.RADIAL_GRADIENT; 43353 return; 43354 } 43355 } 43356 if (firstToken.type === TokenType.FUNCTION) { 43357 if (firstToken.name === 'from') { 43358 var color$1 = color.parse(firstToken.values[0]); 43359 stops.push({ stop: ZERO_LENGTH, color: color$1 }); 43360 } 43361 else if (firstToken.name === 'to') { 43362 var color$1 = color.parse(firstToken.values[0]); 43363 stops.push({ stop: HUNDRED_PERCENT, color: color$1 }); 43364 } 43365 else if (firstToken.name === 'color-stop') { 43366 var values = firstToken.values.filter(nonFunctionArgSeparator); 43367 if (values.length === 2) { 43368 var color$1 = color.parse(values[1]); 43369 var stop_1 = values[0]; 43370 if (isNumberToken(stop_1)) { 43371 stops.push({ 43372 stop: { type: TokenType.PERCENTAGE_TOKEN, number: stop_1.number * 100, flags: stop_1.flags }, 43373 color: color$1 43374 }); 43375 } 43376 } 43377 } 43378 } 43379 }); 43380 return type === CSSImageType.LINEAR_GRADIENT 43381 ? { 43382 angle: (angle + deg(180)) % deg(360), 43383 stops: stops, 43384 type: type 43385 } 43386 : { size: size, shape: shape, stops: stops, position: position, type: type }; 43387 }; 43388 43389 var CLOSEST_SIDE = 'closest-side'; 43390 var FARTHEST_SIDE = 'farthest-side'; 43391 var CLOSEST_CORNER = 'closest-corner'; 43392 var FARTHEST_CORNER = 'farthest-corner'; 43393 var CIRCLE = 'circle'; 43394 var ELLIPSE = 'ellipse'; 43395 var COVER = 'cover'; 43396 var CONTAIN = 'contain'; 43397 var radialGradient = function (tokens) { 43398 var shape = CSSRadialShape.CIRCLE; 43399 var size = CSSRadialExtent.FARTHEST_CORNER; 43400 var stops = []; 43401 var position = []; 43402 parseFunctionArgs(tokens).forEach(function (arg, i) { 43403 var isColorStop = true; 43404 if (i === 0) { 43405 var isAtPosition_1 = false; 43406 isColorStop = arg.reduce(function (acc, token) { 43407 if (isAtPosition_1) { 43408 if (isIdentToken(token)) { 43409 switch (token.value) { 43410 case 'center': 43411 position.push(FIFTY_PERCENT); 43412 return acc; 43413 case 'top': 43414 case 'left': 43415 position.push(ZERO_LENGTH); 43416 return acc; 43417 case 'right': 43418 case 'bottom': 43419 position.push(HUNDRED_PERCENT); 43420 return acc; 43421 } 43422 } 43423 else if (isLengthPercentage(token) || isLength(token)) { 43424 position.push(token); 43425 } 43426 } 43427 else if (isIdentToken(token)) { 43428 switch (token.value) { 43429 case CIRCLE: 43430 shape = CSSRadialShape.CIRCLE; 43431 return false; 43432 case ELLIPSE: 43433 shape = CSSRadialShape.ELLIPSE; 43434 return false; 43435 case 'at': 43436 isAtPosition_1 = true; 43437 return false;
43438 case CLOSEST_SIDE: 43439 size = CSSRadialExtent.CLOSEST_SIDE; 43440 return false; 43441 case COVER: 43442 case FARTHEST_SIDE: 43443 size = CSSRadialExtent.FARTHEST_SIDE; 43444 return false; 43445 case CONTAIN: 43446 case CLOSEST_CORNER: 43447 size = CSSRadialExtent.CLOSEST_CORNER; 43448 return false; 43449 case FARTHEST_CORNER: 43450 size = CSSRadialExtent.FARTHEST_CORNER; 43451 return false; 43452 } 43453 } 43454 else if (isLength(token) || isLengthPercentage(token)) { 43455 if (!Array.isArray(size)) { 43456 size = []; 43457 } 43458 size.push(token); 43459 return false; 43460 } 43461 return acc; 43462 }, isColorStop); 43463 } 43464 if (isColorStop) { 43465 var colorStop = parseColorStop(arg); 43466 stops.push(colorStop); 43467 } 43468 }); 43469 return { size: size, shape: shape, stops: stops, position: position, type: CSSImageType.RADIAL_GRADIENT }; 43470 }; 43471 43472 var prefixRadialGradient = function (tokens) { 43473 var shape = CSSRadialShape.CIRCLE; 43474 var size = CSSRadialExtent.FARTHEST_CORNER; 43475 var stops = []; 43476 var position = []; 43477 parseFunctionArgs(tokens).forEach(function (arg, i) { 43478 var isColorStop = true; 43479 if (i === 0) { 43480 isColorStop = arg.reduce(function (acc, token) { 43481 if (isIdentToken(token)) { 43482 switch (token.value) { 43483 case 'center': 43484 position.push(FIFTY_PERCENT); 43485 return false; 43486 case 'top': 43487 case 'left': 43488 position.push(ZERO_LENGTH); 43489 return false; 43490 case 'right': 43491 case 'bottom': 43492 position.push(HUNDRED_PERCENT); 43493 return false; 43494 } 43495 } 43496 else if (isLengthPercentage(token) || isLength(token)) { 43497 position.push(token); 43498 return false; 43499 } 43500 return acc; 43501 }, isColorStop); 43502 } 43503 else if (i === 1) { 43504 isColorStop = arg.reduce(function (acc, token) { 43505 if (isIdentToken(token)) { 43506 switch (token.value) { 43507 case CIRCLE: 43508 shape = CSSRadialShape.CIRCLE; 43509 return false; 43510 case ELLIPSE: 43511 shape = CSSRadialShape.ELLIPSE; 43512 return false; 43513 case CONTAIN: 43514 case CLOSEST_SIDE: 43515 size = CSSRadialExtent.CLOSEST_SIDE; 43516 return false; 43517 case FARTHEST_SIDE: 43518 size = CSSRadialExtent.FARTHEST_SIDE; 43519 return false; 43520 case CLOSEST_CORNER: 43521 size = CSSRadialExtent.CLOSEST_CORNER; 43522 return false; 43523 case COVER: 43524 case FARTHEST_CORNER: 43525 size = CSSRadialExtent.FARTHEST_CORNER; 43526 return false; 43527 } 43528 } 43529 else if (isLength(token) || isLengthPercentage(token)) { 43530 if (!Array.isArray(size)) { 43531 size = []; 43532 } 43533 size.push(token); 43534 return false;
43535 } 43536 return acc; 43537 }, isColorStop); 43538 } 43539 if (isColorStop) { 43540 var colorStop = parseColorStop(arg); 43541 stops.push(colorStop); 43542 } 43543 }); 43544 return { size: size, shape: shape, stops: stops, position: position, type: CSSImageType.RADIAL_GRADIENT }; 43545 }; 43546 43547 var CSSImageType; 43548 (function (CSSImageType) { 43549 CSSImageType[CSSImageType["URL"] = 0] = "URL"; 43550 CSSImageType[CSSImageType["LINEAR_GRADIENT"] = 1] = "LINEAR_GRADIENT"; 43551 CSSImageType[CSSImageType["RADIAL_GRADIENT"] = 2] = "RADIAL_GRADIENT"; 43552 })(CSSImageType || (CSSImageType = {})); 43553 var isLinearGradient = function (background) { 43554 return background.type === CSSImageType.LINEAR_GRADIENT; 43555 }; 43556 var isRadialGradient = function (background) { 43557 return background.type === CSSImageType.RADIAL_GRADIENT; 43558 }; 43559 var CSSRadialShape; 43560 (function (CSSRadialShape) { 43561 CSSRadialShape[CSSRadialShape["CIRCLE"] = 0] = "CIRCLE"; 43562 CSSRadialShape[CSSRadialShape["ELLIPSE"] = 1] = "ELLIPSE"; 43563 })(CSSRadialShape || (CSSRadialShape = {})); 43564 var CSSRadialExtent; 43565 (function (CSSRadialExtent) { 43566 CSSRadialExtent[CSSRadialExtent["CLOSEST_SIDE"] = 0] = "CLOSEST_SIDE"; 43567 CSSRadialExtent[CSSRadialExtent["FARTHEST_SIDE"] = 1] = "FARTHEST_SIDE"; 43568 CSSRadialExtent[CSSRadialExtent["CLOSEST_CORNER"] = 2] = "CLOSEST_CORNER"; 43569 CSSRadialExtent[CSSRadialExtent["FARTHEST_CORNER"] = 3] = "FARTHEST_CORNER"; 43570 })(CSSRadialExtent || (CSSRadialExtent = {})); 43571 var image = { 43572 name: 'image', 43573 parse: function (value) { 43574 if (value.type === TokenType.URL_TOKEN) { 43575 var image_1 = { url: value.value, type: CSSImageType.URL }; 43576 CacheStorage.getInstance().addImage(value.value); 43577 return image_1; 43578 } 43579 if (value.type === TokenType.FUNCTION) { 43580 var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name]; 43581 if (typeof imageFunction === 'undefined') { 43582 throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\""); 43583 } 43584 return imageFunction(value.values); 43585 } 43586 throw new Error("Unsupported image type"); 43587 } 43588 }; 43589 function isSupportedImage(value) { 43590 return value.type !== TokenType.FUNCTION || SUPPORTED_IMAGE_FUNCTIONS[value.name]; 43591 } 43592 var SUPPORTED_IMAGE_FUNCTIONS = { 43593 'linear-gradient': linearGradient,
43594 '-moz-linear-gradient': prefixLinearGradient, 43595 '-ms-linear-gradient': prefixLinearGradient, 43596 '-o-linear-gradient': prefixLinearGradient, 43597 '-webkit-linear-gradient': prefixLinearGradient, 43598 'radial-gradient': radialGradient, 43599 '-moz-radial-gradient': prefixRadialGradient, 43600 '-ms-radial-gradient': prefixRadialGradient, 43601 '-o-radial-gradient': prefixRadialGradient, 43602 '-webkit-radial-gradient': prefixRadialGradient, 43603 '-webkit-gradient': webkitGradient 43604 }; 43605 43606 var backgroundImage = { 43607 name: 'background-image', 43608 initialValue: 'none', 43609 type: PropertyDescriptorParsingType.LIST, 43610 prefix: false, 43611 parse: function (tokens) { 43612 if (tokens.length === 0) { 43613 return []; 43614 } 43615 var first = tokens[0]; 43616 if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') { 43617 return []; 43618 } 43619 return tokens.filter(function (value) { return nonFunctionArgSeparator(value) && isSupportedImage(value); }).map(image.parse); 43620 } 43621 }; 43622 43623 var backgroundOrigin = { 43624 name: 'background-origin', 43625 initialValue: 'border-box', 43626 prefix: false, 43627 type: PropertyDescriptorParsingType.LIST, 43628 parse: function (tokens) { 43629 return tokens.map(function (token) { 43630 if (isIdentToken(token)) { 43631 switch (token.value) { 43632 case 'padding-box': 43633 return 1 /* PADDING_BOX */; 43634 case 'content-box': 43635 return 2 /* CONTENT_BOX */; 43636 } 43637 } 43638 return 0 /* BORDER_BOX */; 43639 }); 43640 } 43641 }; 43642 43643 var backgroundPosition = { 43644 name: 'background-position', 43645 initialValue: '0% 0%', 43646 type: PropertyDescriptorParsingType.LIST, 43647 prefix: false, 43648 parse: function (tokens) { 43649 return parseFunctionArgs(tokens) 43650 .map(function (values) { return values.filter(isLengthPercentage); }) 43651 .map(parseLengthPercentageTuple); 43652 } 43653 }; 43654 43655 var BACKGROUND_REPEAT; 43656 (function (BACKGROUND_REPEAT) { 43657 BACKGROUND_REPEAT[BACKGROUND_REPEAT["REPEAT"] = 0] = "REPEAT"; 43658 BACKGROUND_REPEAT[BACKGROUND_REPEAT["NO_REPEAT"] = 1] = "NO_REPEAT"; 43659 BACKGROUND_REPEAT[BACKGROUND_REPEAT["REPEAT_X"] = 2] = "REPEAT_X"; 43660 BACKGROUND_REPEAT[BACKGROUND_REPEAT["REPEAT_Y"] = 3] = "REPEAT_Y"; 43661 })(BACKGROUND_REPEAT || (BACKGROUND_REPEAT = {})); 43662 var backgroundRepeat = { 43663 name: 'background-repeat', 43664 initialValue: 'repeat', 43665 prefix: false, 43666 type: PropertyDescriptorParsingType.LIST, 43667 parse: function (tokens) { 43668 return parseFunctionArgs(tokens) 43669 .map(function (values) { 43670 return values 43671 .filter(isIdentToken) 43672 .map(function (token) { return token.value; }) 43673 .join(' '); 43674 }) 43675 .map(parseBackgroundRepeat); 43676 } 43677 }; 43678 var parseBackgroundRepeat = function (value) { 43679 switch (value) { 43680 case 'no-repeat': 43681 return BACKGROUND_REPEAT.NO_REPEAT; 43682 case 'repeat-x': 43683 case 'repeat no-repeat': 43684 return BACKGROUND_REPEAT.REPEAT_X; 43685 case 'repeat-y': 43686 case 'no-repeat repeat': 43687 return BACKGROUND_REPEAT.REPEAT_Y; 43688 case 'repeat': 43689 default: 43690 return BACKGROUND_REPEAT.REPEAT; 43691 } 43692 }; 43693 43694 var BACKGROUND_SIZE; 43695 (function (BACKGROUND_SIZE) { 43696 BACKGROUND_SIZE["AUTO"] = "auto"; 43697 BACKGROUND_SIZE["CONTAIN"] = "contain"; 43698 BACKGROUND_SIZE["COVER"] = "cover"; 43699 })(BACKGROUND_SIZE || (BACKGROUND_SIZE = {})); 43700 var backgroundSize = { 43701 name: 'background-size', 43702 initialValue: '0', 43703 prefix: false, 43704 type: PropertyDescriptorParsingType.LIST, 43705 parse: function (tokens) { 43706 return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroun
43706dSizeInfoToken); }); 43707 } 43708 }; 43709 var isBackgroundSizeInfoToken = function (value) { 43710 return isIdentToken(value) || isLengthPercentage(value); 43711 }; 43712 43713 var borderColorForSide = function (side) { return ({ 43714 name: "border-" + side + "-color", 43715 initialValue: 'transparent', 43716 prefix: false, 43717 type: PropertyDescriptorParsingType.TYPE_VALUE, 43718 format: 'color' 43719 }); }; 43720 var borderTopColor = borderColorForSide('top'); 43721 var borderRightColor = borderColorForSide('right'); 43722 var borderBottomColor = borderColorForSide('bottom'); 43723 var borderLeftColor = borderColorForSide('left'); 43724 43725 var borderRadiusForSide = function (side) { return ({ 43726 name: "border-radius-" + side, 43727 initialValue: '0 0', 43728 prefix: false, 43729 type: PropertyDescriptorParsingType.LIST, 43730 parse: function (tokens) { return parseLengthPercentageTuple(tokens.filter(isLengthPercentage)); } 43731 }); }; 43732 var borderTopLeftRadius = borderRadiusForSide('top-left'); 43733 var borderTopRightRadius = borderRadiusForSide('top-right'); 43734 var borderBottomRightRadius = borderRadiusForSide('bottom-right'); 43735 var borderBottomLeftRadius = borderRadiusForSide('bottom-left'); 43736 43737 var BORDER_STYLE; 43738 (function (BORDER_STYLE) { 43739 BORDER_STYLE[BORDER_STYLE["NONE"] = 0] = "NONE"; 43740 BORDER_STYLE[BORDER_STYLE["SOLID"] = 1] = "SOLID"; 43741 })(BORDER_STYLE || (BORDER_STYLE = {})); 43742 var borderStyleForSide = function (side) { return ({ 43743 name: "border-" + side + "-style", 43744 initialValue: 'solid', 43745 prefix: false, 43746 type: PropertyDescriptorParsingType.IDENT_VALUE, 43747 parse: function (style) { 43748 switch (style) { 43749 case 'none': 43750 return BORDER_STYLE.NONE; 43751 } 43752 return BORDER_STYLE.SOLID; 43753 } 43754 }); }; 43755 var borderTopStyle = borderStyleForSide('top'); 43756 var borderRightStyle = borderStyleForSide('right'); 43757 var borderBottomStyle = borderStyleForSide('bottom'); 43758 var borderLeftStyle = borderStyleForSide('left'); 43759 43760 var borderWidthForSide = function (side) { return ({ 43761 name: "border-" + side + "-width", 43762 initialValue: '0', 43763 type: PropertyDescriptorParsingType.VALUE, 43764 prefix: false, 43765 parse: function (token) { 43766 if (isDimensionToken(token)) { 43767 return token.number; 43768 } 43769 return 0; 43770 } 43771 }); }; 43772 var borderTopWidth = borderWidthForSide('top'); 43773 var borderRightWidth = borderWidthForSide('right'); 43774 var borderBottomWidth = borderWidthForSide('bottom'); 43775 var borderLeftWidth = borderWidthForSide('left'); 43776 43777 var color$1 = { 43778 name: "color", 43779 initialValue: 'transparent', 43780 prefix: false, 43781 type: PropertyDescriptorParsingType.TYPE_VALUE, 43782 format: 'color' 43783 }; 43784 43785 var display = { 43786 name: 'display', 43787 initialValue: 'inline-block', 43788 prefix: false, 43789 type: PropertyDescriptorParsingType.LIST, 43790 parse: function (tokens) { 43791 return tokens.filter(isIdentToken).reduce(function (bit, token) { 43792 return bit | parseDisplayValue(token.value); 43793 }, 0 /* NONE */); 43794 } 43795 }; 43796 var parseDisplayValue = function (display) { 43797 switch (display) { 43798 case 'block': 43799 return 2 /* BLOCK */; 43800 case 'inline': 43801 return 4 /* INLINE */; 43802 case 'run-in': 43803 return 8 /* RUN_IN */; 43804 case 'flow': 43805 return 16 /* FLOW */; 43806 case 'flow-root': 43807 return 32 /* FLOW_ROOT */; 43808 case 'table': 43809 return 64 /* TABLE */; 43810 case 'flex': 43811 case '-webkit-flex': 43812 return 128 /* FLEX */; 43813 case 'grid': 43814 case '-ms-grid': 43815 return 256 /* GRID */; 43816 case 'ruby': 43817 return 512 /* RUBY */; 43818 case 'subgrid': 43819 return 1024 /* SUBGRID */; 43820 case 'list-item': 43821 return 2048 /* LIST_ITEM */; 43822 case 'table-row-group': 43823 return 4096 /* TABLE_ROW_GROUP */; 43824 case 'table-header-group': 43825 return 8192 /* TABLE_HEADER_GROUP */; 43826 case 'table-footer-group': 43827 return 16384 /* TABLE_FOOTER_GROUP */; 43828 case 'table-row': 43829 return 32768 /* TABLE_ROW */; 43830 case 'table-cell': 43831 return 65536 /* TABLE_CELL */; 43832 case 'table-column-group': 43833 return 131072 /* TABLE_COLUMN_GROUP */; 43834 case 'table-column': 43835 return 262144 /* TABLE_COLUMN */; 43836 case 'table-caption': 43837 return 524288 /* TABLE_CAPTION */; 43838 case 'ruby-base': 43839 return 1048576 /* RUBY_BASE */; 43840 case 'ruby-text': 43841 return 2097152 /* RUBY_TEXT */; 43842 case 'ruby-base-container': 43843 return 4194304 /* RUBY_BASE_CONTAINER */; 43844 case 'ruby-text-container': 43845 return 8388608 /* RUBY_TEXT_CONTAINER */; 43846 case 'contents': 43847 return 16777216 /* CONTENTS */; 43848 case 'inline-block': 43849 return 33554432 /* INLINE_BLOCK */; 43850 case 'inline-list-item': 43851 return 67108864 /* INLINE_LIST_ITEM */; 43852 case 'inline-table': 43853 return 134217728 /* INLINE_TABLE */; 43854 case 'inline-flex': 43855 return 268435456 /* INLINE_FLEX */; 43856 case 'inline-grid': 43857 return 536870912 /* INLINE_GRID */; 43858 } 43859 return 0 /* NONE */; 43860 }; 43861 43862 var FLOAT; 43863 (function (FLOAT) { 43864 FLOAT[FLOAT["NONE"] = 0] = "NONE"; 43865 FLOAT[FLOAT["LEFT"] = 1] = "LEFT"; 43866 FLOAT[FLOAT["RIGHT"] = 2] = "RIGHT"; 43867 FLOAT[FLOAT["INLINE_START"] = 3] = "INLINE_START"; 43868 FLOAT[FLOAT["INLINE_END"] = 4] = "INLINE_END"; 43869 })(FLOAT || (FLOAT = {})); 43870 var float = { 43871 name: 'float', 43872 initialValue: 'none', 43873 prefix: false, 43874 type: PropertyDescriptorParsingType.IDENT_VALUE, 43875 parse: function (float) { 43876 switch (float) { 43877 case 'left': 43878 return FLOAT.LEFT; 43879 case 'right': 43880 return FLOAT.RIGHT; 43881 case 'inline-start': 43882 return FLOAT.INLINE_START; 43883 case 'inline-end': 43884 return FLOAT.INLINE_END; 43885 } 43886 return FLOAT.NONE; 43887 } 43888 }; 43889 43890 var letterSpacing = { 43891 name: 'letter-spacing', 43892 initialValue: '0', 43893 prefix: false, 43894 type: PropertyDescriptorParsingType.VALUE, 43895 parse: function (token) { 43896 if (token.type === TokenType.IDENT_TOKEN && token.value === 'normal') { 43897 return 0; 43898 } 43899 if (token.type === TokenType.NUMBER_TOKEN) { 43900 return token.number; 43901 } 43902 if (token.type === TokenType.DIMENSION_TOKEN) { 43903 return token.number; 43904 } 43905 return 0; 43906 } 43907 }; 43908 43909 var LINE_BREAK; 43910 (function (LINE_BREAK) { 43911 LINE_BREAK["NORMAL"] = "normal"; 43912 LINE_BREAK["STRICT"] = "strict"; 43913 })(LINE_BREAK || (LINE_BREAK = {})); 43914 var lineBreak = { 43915 name: 'line-break', 43916 initialValue: 'normal', 43917 prefix: false, 43918 type: PropertyDescriptorParsingType.IDENT_VALUE, 43919 parse: function (lineBreak) { 43920 switch (lineBreak) { 43921 case 'strict': 43922 return LINE_BREAK.STRICT; 43923 case 'normal': 43924 default: 43925 return LINE_BREAK.NORMAL; 43926 } 43927 } 43928 }; 43929 43930 var lineHeight = { 43931 name: 'line-height', 43932 initialValue: 'normal', 43933 prefix: false, 43934 type: PropertyDescriptorParsingType.TOKEN_VALUE 43935 }; 43936 var computeLineHeight = function (token, fontSize) { 43937 if (isIdentToken(token) && token.value === 'normal') { 43938 return 1.2 * fontSize; 43939 } 43940 else if (token.type === TokenType.NUMBER_TOKEN) { 43941 return fontSize * token.number; 43942 } 43943 else if (isLengthPercentage(token)) { 43944 return getAbsoluteValue(token, fontSize); 43945 } 43946 return fontSize; 43947 }; 43948 43949 var listStyleImage = { 43950 name: 'list-style-image', 43951 initialValue: 'none', 43952 type: PropertyDescriptorParsingType.VALUE, 43953 prefix: false, 43954 parse: function (token) { 43955 if (token.type === TokenType.IDENT_TOKEN && token.value === 'none') { 43956 return null; 43957 } 43958 return image.parse(token); 43959 } 43960 }; 43961 43962 var LIST_STYLE_POSITION; 43963 (function (LIST_STYLE_POSITION) { 43964 LIST_STYLE_POSITION[LIST_STYLE_POSITION["INSIDE"] = 0] = "INSI
43964DE"; 43965 LIST_STYLE_POSITION[LIST_STYLE_POSITION["OUTSIDE"] = 1] = "OUTSIDE"; 43966 })(LIST_STYLE_POSITION || (LIST_STYLE_POSITION = {})); 43967 var listStylePosition = { 43968 name: 'list-style-position', 43969 initialValue: 'outside', 43970 prefix: false, 43971 type: PropertyDescriptorParsingType.IDENT_VALUE, 43972 parse: function (position) { 43973 switch (position) { 43974 case 'inside': 43975 return LIST_STYLE_POSITION.INSIDE; 43976 case 'outside': 43977 default: 43978 return LIST_STYLE_POSITION.OUTSIDE; 43979 } 43980 } 43981 }; 43982 43983 var LIST_STYLE_TYPE; 43984 (function (LIST_STYLE_TYPE) { 43985 LIST_STYLE_TYPE[LIST_STYLE_TYPE["NONE"] = -1] = "NONE"; 43986 LIST_STYLE_TYPE[LIST_STYLE_TYPE["DISC"] = 0] = "DISC"; 43987 LIST_STYLE_TYPE[LIST_STYLE_TYPE["CIRCLE"] = 1] = "CIRCLE"; 43988 LIST_STYLE_TYPE[LIST_STYLE_TYPE["SQUARE"] = 2] = "SQUARE"; 43989 LIST_STYLE_TYPE[LIST_STYLE_TYPE["DECIMAL"] = 3] = "DECIMAL"; 43990 LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_DECIMAL"] = 4] = "CJK_DECIMAL"; 43991 LIST_STYLE_TYPE[LIST_STYLE_TYPE["DECIMAL_LEADING_ZERO"] = 5] = "DECIMAL_LEADING_ZERO"; 43992 LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_ROMAN"] = 6] = "LOWER_ROMAN"; 43993 LIST_STYLE_TYPE[LIST_STYLE_TYPE["UPPER_ROMAN"] = 7] = "UPPER_ROMAN"; 43994 LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_GREEK"] = 8] = "LOWER_GREEK"; 43995 LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_ALPHA"] = 9] = "LOWER_ALPHA"; 43996 LIST_STYLE_TYPE[LIST_STYLE_TYPE["UPPER_ALPHA"] = 10] = "UPPER_ALPHA"; 43997 LIST_STYLE_TYPE[LIST_STYLE_TYPE["ARABIC_INDIC"] = 11] = "ARABIC_INDIC"; 43998 LIST_STYLE_TYPE[LIST_STYLE_TYPE["ARMENIAN"] = 12] = "ARMENIAN"; 43999 LIST_STYLE_TYPE[LIST_STYLE_TYPE["BENGALI"] = 13] = "BENGALI"; 44000 LIST_STYLE_TYPE[LIST_STYLE_TYPE["CAMBODIAN"] = 14] = "CAMBODIAN"; 44001 LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_EARTHLY_BRANCH"] = 15] = "CJK_EARTHLY_BRANCH"; 44002 LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_HEAVENLY_STEM"] = 16] = "CJK_HEAVENLY_STEM"; 44003 LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_IDEOGRAPHIC"] = 17] = "CJK_IDEOGRAPHIC"; 44004 LIST_STYLE_TYPE[LIST_STYLE_TYPE["DEVANAGARI"] = 18] = "DEVANAGARI"; 44005 LIST_STYLE_TYPE[LIST_STYLE_TYPE["ETHIOPIC_NUMERIC"] = 19] = "ETHIOPIC_NUMERIC"; 44006 LIST_STYLE_TYPE[LIST_STYLE_TYPE["GEORGIAN"] = 20] = "GEORGIAN"; 44007 LIST_STYLE_TYPE[LIST_STYLE_TYPE["GUJARATI"] = 21] = "GUJARATI"; 44008 LIST_STYLE_TYPE[LIST_STYLE_TYPE["GURMUKHI"] = 22] = "GURMUKHI"; 44009 LIST_STYLE_TYPE[LIST_STYLE_TYPE["HEBREW"] = 22] = "HEBREW"; 44010 LIST_STYLE_TYPE[LIST_STYLE_TYPE["HIRAGANA"] = 23] = "HIRAGANA"; 44011 LIST_STYLE_TYPE[LIST_STYLE_TYPE["HIRAGANA_IROHA"] = 24] = "HIRAGANA_IROHA"; 44012 LIST_STYLE_TYPE[LIST_STYLE_TYPE["JAPANESE_FORMAL"] = 25] = "JAPANESE_FORMAL"; 44013 LIST_STYLE_TYPE[LIST_STYLE_TYPE["JAPANESE_INFORMAL"] = 26] = "JAPANESE_INFORMAL"; 44014 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KANNADA"] = 27] = "KANNADA"; 44015 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KATAKANA"] = 28] = "KATAKANA"; 44016 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KATAKANA_IROHA"] = 29] = "KATAKANA_IROHA"; 44017 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KHMER"] = 30] = "KHMER"; 44018 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KOREAN_HANGUL_FORMAL"] = 31] = "KOREAN_HANGUL_FORMAL"; 44019 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KOREAN_HANJA_FORMAL"] = 32] = "KOREAN_HANJA_FORMAL"; 44020 LIST_STYLE_TYPE[LIST_STYLE_TYPE["KOREAN_HANJA_INFORMAL"] = 33] = "KOREAN_HANJA_INFORMAL"; 44021 LIST_STYLE_TYPE[LIST_STYLE_TYPE["LAO"] = 34] = "LAO"; 44022 LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_ARMENIAN"] = 35] = "LOWER_ARMENIAN"; 44023 LIST_STYLE_TYPE[LIST_STYLE_TYPE["MALAYALAM"] = 36] = "MALAYALAM"; 44024 LIST_STYLE_TYPE[LIST_STYLE_TYPE["MONGOLIAN"] = 37] = "MONGOLIAN"; 44025 LIST_STYLE_TYPE[LIST_STYLE_TYPE["MYANMAR"] = 38] = "MYANMAR"; 44026 LIST_STYLE_TYPE[LIST_STYLE_TYPE["ORIYA"] = 39] = "ORIYA"; 44027 LIST_STYLE_TYPE[LIST_STYLE_TYPE["PERSIAN"] = 40] = "PERSIAN"; 44028 LIST_STYLE_TYPE[LIST_STYLE_TYPE["SIMP_CHINESE_FORMAL"] = 41] = "SIMP_CHINESE_FORMAL"; 44029 LIST_STYLE_TYPE[LIST_STYLE_TYPE["SIMP_CHINESE_INFORMAL"] = 42] = "SIMP_CHINESE_INFORMAL"; 44030 LIST_STYLE_TYPE[LIST_STYLE_TYPE["TAMIL"] = 43] = "TAMIL"; 44031 LIST_STYLE_TYPE[LIST_STYLE_TYPE["TELUGU"] = 44] = "TELUGU"; 44032 LIST_STYLE_TYPE[LIST_STYLE_TYPE["THAI"] = 45] = "THAI"; 44033 LIST_STYLE_TYPE[LIST_STYLE_TYPE["TIBETAN"] = 46] = "TIBETAN"; 44034 LIST_STYLE_TYPE[LIST_STYLE_TYPE["TRAD_CHINESE_FORMAL"] = 47] = "TRAD_CHINESE_FORMAL"; 44035 LIST_STYLE_TYPE[LIST_STYLE_TYPE["TRAD_CHINESE_INFORMAL"] = 48] = "TRAD_CHINESE_INFORMAL"; 44036 LIST_STYLE_TYPE[LIST_STYLE_TYPE["UPPER_ARMENIAN"] = 49] = "UPPER_ARMENIAN"; 44037 LIST_STYLE_TYPE[LIST_STYLE_TYPE["DISCLOSURE_OPEN"] = 50] = "DISCLOSURE_OPEN"; 44038 LIST_STYLE_TYPE[LIST_STYLE_TYPE["DISCLOSURE_CLOSED"] = 51] = "DISCLOSURE_CLOSED"; 44039 })(LIST_STYLE_TYPE || (LIST_STYLE_TYPE = {})); 44040 var listStyleType = { 44041 name: 'list-style-type', 44042 initialValue: 'none', 44043 prefix: false, 44044 type: PropertyDescriptorParsingType.IDENT_VALUE, 44045 parse: function (type) { 44046 switch (type) { 44047 case 'disc': 44048 return LIST_STYLE_TYPE.DISC; 44049 case 'circle': 44050 return LIST_STYLE_TYPE.CIRCLE; 44051 case 'square': 44052 return LIST_STYLE_TYPE.SQUARE; 44053 case 'decimal': 44054 return LIST_STYLE_TYPE.DECIMAL; 44055 case 'cjk-decimal': 44056 return LIST_STYLE_TYPE.CJK_DECIMAL; 44057 case 'decimal-leading-zero': 44058 return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;
44059 case 'lower-roman': 44060 return LIST_STYLE_TYPE.LOWER_ROMAN; 44061 case 'upper-roman': 44062 return LIST_STYLE_TYPE.UPPER_ROMAN; 44063 case 'lower-greek': 44064 return LIST_STYLE_TYPE.LOWER_GREEK; 44065 case 'lower-alpha': 44066 return LIST_STYLE_TYPE.LOWER_ALPHA; 44067 case 'upper-alpha': 44068 return LIST_STYLE_TYPE.UPPER_ALPHA; 44069 case 'arabic-indic': 44070 return LIST_STYLE_TYPE.ARABIC_INDIC; 44071 case 'armenian': 44072 return LIST_STYLE_TYPE.ARMENIAN; 44073 case 'bengali': 44074 return LIST_STYLE_TYPE.BENGALI; 44075 case 'cambodian': 44076 return LIST_STYLE_TYPE.CAMBODIAN; 44077 case 'cjk-earthly-branch': 44078 return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH; 44079 case 'cjk-heavenly-stem': 44080 return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM; 44081 case 'cjk-ideographic': 44082 return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC; 44083 case 'devanagari': 44084 return LIST_STYLE_TYPE.DEVANAGARI; 44085 case 'ethiopic-numeric': 44086 return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC; 44087 case 'georgian': 44088 return LIST_STYLE_TYPE.GEORGIAN; 44089 case 'gujarati': 44090 return LIST_STYLE_TYPE.GUJARATI; 44091 case 'gurmukhi': 44092 return LIST_STYLE_TYPE.GURMUKHI; 44093 case 'hebrew': 44094 return LIST_STYLE_TYPE.HEBREW; 44095 case 'hiragana': 44096 return LIST_STYLE_TYPE.HIRAGANA; 44097 case 'hiragana-iroha': 44098 return LIST_STYLE_TYPE.HIRAGANA_IROHA; 44099 case 'japanese-formal': 44100 return LIST_STYLE_TYPE.JAPANESE_FORMAL; 44101 case 'japanese-informal': 44102 return LIST_STYLE_TYPE.JAPANESE_INFORMAL; 44103 case 'kannada': 44104 return LIST_STYLE_TYPE.KANNADA; 44105 case 'katakana': 44106 return LIST_STYLE_TYPE.KATAKANA; 44107 case 'katakana-iroha': 44108 return LIST_STYLE_TYPE.KATAKANA_IROHA; 44109 case 'khmer': 44110 return LIST_STYLE_TYPE.KHMER; 44111 case 'korean-hangul-formal': 44112 return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL; 44113 case 'korean-hanja-formal': 44114 return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL; 44115 case 'korean-hanja-informal': 44116 return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL; 44117 case 'lao': 44118 return LIST_STYLE_TYPE.LAO; 44119 case 'lower-armenian': 44120 return LIST_STYLE_TYPE.LOWER_ARMENIAN; 44121 case 'malayalam': 44122 return LIST_STYLE_TYPE.MALAYALAM; 44123 case 'mongolian': 44124 return LIST_STYLE_TYPE.MONGOLIAN; 44125 case 'myanmar': 44126 return LIST_STYLE_TYPE.MYANMAR; 44127 case 'oriya': 44128 return LIST_STYLE_TYPE.ORIYA; 44129 case 'persian': 44130 return LIST_STYLE_TYPE.PERSIAN; 44131 case 'simp-chinese-formal': 44132 return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL; 44133 case 'simp-chinese-informal': 44134 return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL; 44135 case 'tamil': 44136 return LIST_STYLE_TYPE.TAMIL; 44137 case 'telugu': 44138 return LIST_STYLE_TYPE.TELUGU; 44139 case 'thai': 44140 return LIST_STYLE_TYPE.THAI; 44141 case 'tibetan': 44142 return LIST_STYLE_TYPE.TIBETAN; 44143 case 'trad-chinese-formal': 44144 return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL; 44145 case 'trad-chinese-informal': 44146 return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL; 44147 case 'upper-armenian': 44148 return LIST_STYLE_TYPE.UPPER_ARMENIAN; 44149 case 'disclosure-open': 44150 return LIST_STYLE_TYPE.DISCLOSURE_OPEN; 44151 case 'disclosure-closed': 44152 return LIST_STYLE_TYPE.DISCLOSURE_CLOSED; 44153 case 'none': 44154 default: 44155 return LIST_STYLE_TYPE.NONE; 44156 } 44157 } 44158 }; 44159 44160 var marginForSide = function (side) { return ({ 44161 name: "margin-" + side, 44162 initialValue: '0', 44163 prefix: false, 44164 type: PropertyDescriptorParsingType.TOKEN_VALUE 44165 }); }; 44166 var marginTop = marginForSide('top'); 44167 var marginRight = marginForSide('right'); 44168 var marginBottom = marginForSide('bottom'); 44169 var marginLeft = marginForSide('left'); 44170 44171 var OVERFLOW; 44172 (function (OVERFLOW) { 44173 OVERFLOW[OVERFLOW["VISIBLE"] = 0] = "VISIBLE"; 44174 OVERFLOW[OVERFLOW["HIDDEN"] = 1] = "HIDDEN"; 44175 OVERFLOW[OVERFLOW["SCROLL"] = 2] = "SCROLL"; 44176 OVERFLOW[OVERFLOW["AUTO"] = 3] = "AUTO"; 44177 })(OVERFLOW || (OVERFLOW = {})); 44178 var overflow = { 44179 name: 'overflow', 44180 initialValue: 'visible', 44181 prefix: false, 44182 type: PropertyDescriptorParsingType.LIST, 44183 parse: function (tokens) { 44184 return tokens.filter(isIdentToken).map(function (overflow) { 44185 switch (overflow.value) { 44186 case 'hidden': 44187 return OVERFLOW.HIDDEN; 44188 case 'scroll': 44189 return OVERFLOW.SCROLL; 44190 case 'auto': 44191 return OVERFLOW.AUTO; 44192 case 'visible': 44193 default: 44194 return OVERFLOW.VISIBLE; 44195 } 44196 }); 44197 } 44198 }; 44199 44200 var OVERFLOW_WRAP; 44201 (function (OVERFLOW_WRAP) { 44202 OVERFLOW_WRAP["NORMAL"] = "normal"; 44203 OVERFLOW_WRAP["BREAK_WORD"] = "break-word"; 44204 })(OVERFLOW_WRAP || (OVERFLOW_WRAP = {})); 44205 var overflowWrap = { 44206 name: 'overflow-wrap', 44207 initialValue: 'normal', 44208 prefix: false, 44209 type: PropertyDescriptorParsingType.IDENT_VALUE, 44210 parse: function (overflow) { 44211 switch (overflow) { 44212 case 'break-word': 44213 return OVERFLOW_WRAP.BREAK_WORD; 44214 case 'normal': 44215 default: 44216 return OVERFLOW_WRAP.NORMAL; 44217 } 44218 } 44219 }; 44220 44221 var paddingForSide = function (side) { return ({ 44222 name: "padding-" + side, 44223 initialValue: '0', 44224 prefix: false, 44225 type: PropertyDescriptorParsingType.TYPE_VALUE, 44226 format: 'length-percentage' 44227 }); }; 44228 var paddingTop = paddingForSide('top'); 44229 var paddingRight = paddingForSide('right'); 44230 var paddingBottom = paddingForSide('bottom'); 44231 var paddingLeft = paddingForSide('left'); 44232 44233 var TEXT_ALIGN; 44234 (function (TEXT_ALIGN) { 44235 TEXT_ALIGN[TEXT_ALIGN["LEFT"] = 0] = "LEFT";
44236 TEXT_ALIGN[TEXT_ALIGN["CENTER"] = 1] = "CENTER"; 44237 TEXT_ALIGN[TEXT_ALIGN["RIGHT"] = 2] = "RIGHT"; 44238 })(TEXT_ALIGN || (TEXT_ALIGN = {})); 44239 var textAlign = { 44240 name: 'text-align', 44241 initialValue: 'left', 44242 prefix: false, 44243 type: PropertyDescriptorParsingType.IDENT_VALUE, 44244 parse: function (textAlign) { 44245 switch (textAlign) { 44246 case 'right': 44247 return TEXT_ALIGN.RIGHT; 44248 case 'center': 44249 case 'justify': 44250 return TEXT_ALIGN.CENTER; 44251 case 'left': 44252 default: 44253 return TEXT_ALIGN.LEFT; 44254 } 44255 } 44256 }; 44257 44258 var POSITION; 44259 (function (POSITION) { 44260 POSITION[POSITION["STATIC"] = 0] = "STATIC"; 44261 POSITION[POSITION["RELATIVE"] = 1] = "RELATIVE"; 44262 POSITION[POSITION["ABSOLUTE"] = 2] = "ABSOLUTE"; 44263 POSITION[POSITION["FIXED"] = 3] = "FIXED"; 44264 POSITION[POSITION["STICKY"] = 4] = "STICKY"; 44265 })(POSITION || (POSITION = {})); 44266 var position = { 44267 name: 'position', 44268 initialValue: 'static', 44269 prefix: false, 44270 type: PropertyDescriptorParsingType.IDENT_VALUE, 44271 parse: function (position) { 44272 switch (position) { 44273 case 'relative': 44274 return POSITION.RELATIVE; 44275 case 'absolute': 44276 return POSITION.ABSOLUTE; 44277 case 'fixed': 44278 return POSITION.FIXED; 44279 case 'sticky': 44280 return POSITION.STICKY; 44281 } 44282 return POSITION.STATIC; 44283 } 44284 }; 44285 44286 var textShadow = { 44287 name: 'text-shadow', 44288 initialValue: 'none', 44289 type: PropertyDescriptorParsingType.LIST, 44290 prefix: false, 44291 parse: function (tokens) { 44292 if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) { 44293 return []; 44294 } 44295 return parseFunctionArgs(tokens).map(function (values) { 44296 var shadow = { 44297 color: COLORS.TRANSPARENT, 44298 offsetX: ZERO_LENGTH, 44299 offsetY: ZERO_LENGTH, 44300 blur: ZERO_LENGTH 44301 }; 44302 var c = 0; 44303 for (var i = 0; i < values.length; i++) { 44304 var token = values[i]; 44305 if (isLength(token)) { 44306 if (c === 0) { 44307 shadow.offsetX = token; 44308 } 44309 else if (c === 1) { 44310 shadow.offsetY = token; 44311 } 44312 else { 44313 shadow.blur = token; 44314 } 44315 c++; 44316 } 44317 else { 44318 shadow.color = color.parse(token); 44319 } 44320 } 44321 return shadow; 44322 }); 44323 } 44324 }; 44325 44326 var TEXT_TRANSFORM; 44327 (function (TEXT_TRANSFORM) { 44328 TEXT_TRANSFORM[TEXT_TRANSFORM["NONE"] = 0] = "NONE"; 44329 TEXT_TRANSFORM[TEXT_TRANSFORM["LOWERCASE"] = 1] = "LOWERCASE"; 44330 TEXT_TRANSFORM[TEXT_TRANSFORM["UPPERCASE"] = 2] = "UPPERCASE"; 44331 TEXT_TRANSFORM[TEXT_TRANSFORM["CAPITALIZE"] = 3] = "CAPITALIZE"; 44332 })(TEXT_TRANSFORM || (TEXT_TRANSFORM = {})); 44333 var textTransform = { 44334 name: 'text-transform', 44335 initialValue: 'none', 44336 prefix: false, 44337 type: PropertyDescriptorParsingType.IDENT_VALUE, 44338 parse: function (textTransform) { 44339 switch (textTransform) { 44340 case 'uppercase': 44341 return TEXT_TRANSFORM.UPPERCASE; 44342 case 'lowercase': 44343 return TEXT_TRANSFORM.LOWERCASE; 44344 case 'capitalize': 44345 return TEXT_TRANSFORM.CAPITALIZE; 44346 } 44347 return TEXT_TRANSFORM.NONE; 44348 } 44349 }; 44350 44351 var transform = { 44352 name: 'transform', 44353 initialValue: 'none', 44354 prefix: true, 44355 type: PropertyDescriptorParsingType.VALUE, 44356 parse: function (token) { 44357 if (token.type === TokenType.IDENT_TOKEN && token.value === 'none') { 44358 return null; 44359 } 44360 if (token.type === TokenType.FUNCTION) { 44361 var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name]; 44362 if (typeof transformFunction === 'undefined') { 44363 throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\""); 44364 } 44365 return transformFunction(token.values); 44366 } 44367 return null; 44368 } 44369 }; 44370 var matrix = function (args) { 44371 var values = args.filter(function (arg) { return arg.type === TokenType.NUMBER_TOKEN; }).map(function (arg) { return arg.number; }); 44372 return values.length === 6 ? values : null; 44373 }; 44374 // doesn't support 3D transforms at the moment 44375 var matrix3d = function (args) { 44376 var values = args.filter(function (arg) { return arg.type === TokenType.NUMBER_TOKEN; }).map(function (arg) { return arg.number; }); 44377 var a1 = values[0], b1 = values[1], _a = values[2], _b = values[3], a2 = values[4], b2 = values[5], _c = values[6], _d = values[7], _e = values[8], _f = values[9], _g = values[10], _h = values[11], a4 = values[12], b4 = values[13], _j = values[14], _k = values[15]; 44378 return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null; 44379 }; 44380 var SUPPORTED_TRANSFORM_FUNCTIONS = { 44381 matrix: matrix, 44382 matrix3d: matrix3d 44383 }; 44384 44385 var DEFAULT_VALUE = { 44386 type: TokenType.PERCENTAGE_TOKEN, 44387 number: 50, 44388 flags: FLAG_INTEGER 44389 }; 44390 var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE]; 44391 var transformOrigin = { 44392 name: 'transform-origin', 44393 initialValue: '50% 50%', 44394 prefix: true, 44395 type: PropertyDescriptorParsingType.LIST, 44396 parse: function (tokens) { 44397 var origins = tokens.filter(isLengthPercentage); 44398 if (origins.length !== 2) { 44399 return DEFAULT; 44400 } 44401 return [origins[0], origins[1]]; 44402 } 44403 }; 44404 44405 var VISIBILITY; 44406 (function (VISIBILITY) { 44407 VISIBILITY[VISIBILITY["VISIBLE"] = 0] = "VISIBLE"; 44408 VISIBILITY[VISIBILITY["HIDDEN"] = 1] = "HIDDEN"; 44409 VISIBILITY[VISIBILITY["COLLAPSE"] = 2] = "COLLAPSE"; 44410 })(VISIBILITY || (VISIBILITY = {})); 44411 var visibility = { 44412 name: 'visible', 44413 initialValue: 'none', 44414 prefix: false, 44415 type: PropertyDescriptorParsingType.IDENT_VALUE, 44416 parse: function (visibility) { 44417 switch (visibility) { 44418 case 'hidden': 44419 return VISIBILITY.HIDDEN; 44420 case 'collapse': 44421 return VISIBILITY.COLLAPSE; 44422 case 'visible': 44423 default:
vendor: 16,134 bytes, lines 44424-44829
44424 return VISIBILITY.VISIBLE; 44425 } 44426 } 44427 }; 44428 44429 var WORD_BREAK; 44430 (function (WORD_BREAK) { 44431 WORD_BREAK["NORMAL"] = "normal"; 44432 WORD_BREAK["BREAK_ALL"] = "break-all"; 44433 WORD_BREAK["KEEP_ALL"] = "keep-all"; 44434 })(WORD_BREAK || (WORD_BREAK = {})); 44435 var wordBreak = { 44436 name: 'word-break', 44437 initialValue: 'normal', 44438 prefix: false, 44439 type: PropertyDescriptorParsingType.IDENT_VALUE, 44440 parse: function (wordBreak) { 44441 switch (wordBreak) { 44442 case 'break-all': 44443 return WORD_BREAK.BREAK_ALL; 44444 case 'keep-all': 44445 return WORD_BREAK.KEEP_ALL; 44446 case 'normal': 44447 default: 44448 return WORD_BREAK.NORMAL; 44449 } 44450 } 44451 }; 44452 44453 var zIndex = { 44454 name: 'z-index', 44455 initialValue: 'auto', 44456 prefix: false, 44457 type: PropertyDescriptorParsingType.VALUE, 44458 parse: function (token) { 44459 if (token.type === TokenType.IDENT_TOKEN) { 44460 return { auto: true, order: 0 }; 44461 } 44462 if (isNumberToken(token)) { 44463 return { auto: false, order: token.number }; 44464 } 44465 throw new Error("Invalid z-index number parsed"); 44466 } 44467 }; 44468 44469 var opacity = { 44470 name: 'opacity', 44471 initialValue: '1', 44472 type: PropertyDescriptorParsingType.VALUE, 44473 prefix: false, 44474 parse: function (token) { 44475 if (isNumberToken(token)) { 44476 return token.number; 44477 } 44478 return 1; 44479 } 44480 }; 44481 44482 var textDecorationColor = { 44483 name: "text-decoration-color", 44484 initialValue: 'transparent', 44485 prefix: false, 44486 type: PropertyDescriptorParsingType.TYPE_VALUE, 44487 format: 'color' 44488 }; 44489 44490 var textDecorationLine = { 44491 name: 'text-decoration-line', 44492 initialValue: 'none', 44493 prefix: false, 44494 type: PropertyDescriptorParsingType.LIST, 44495 parse: function (tokens) { 44496 return tokens 44497 .filter(isIdentToken) 44498 .map(function (token) { 44499 switch (token.value) { 44500 case 'underline': 44501 return 1 /* UNDERLINE */; 44502 case 'overline': 44503 return 2 /* OVERLINE */; 44504 case 'line-through': 44505 return 3 /* LINE_THROUGH */; 44506 case 'none': 44507 return 4 /* BLINK */; 44508 } 44509 return 0 /* NONE */; 44510 }) 44511 .filter(function (line) { return line !== 0 /* NONE */; }); 44512 } 44513 }; 44514 44515 var fontFamily = { 44516 name: "font-family", 44517 initialValue: '', 44518 prefix: false, 44519 type: PropertyDescriptorParsingType.LIST, 44520 parse: function (tokens) { 44521 var accumulator = []; 44522 var results = []; 44523 tokens.forEach(function (token) { 44524 switch (token.type) { 44525 case TokenType.IDENT_TOKEN: 44526 case TokenType.STRING_TOKEN: 44527 accumulator.push(token.value); 44528 break; 44529 case TokenType.NUMBER_TOKEN: 44530 accumulator.push(token.number.toString()); 44531 break; 44532 case TokenType.COMMA_TOKEN: 44533 results.push(accumulator.join(' ')); 44534 accumulator.length = 0; 44535 break; 44536 } 44537 }); 44538 if (accumulator.length) { 44539 results.push(accumulator.join(' ')); 44540 } 44541 return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'" + result + "'"); }); 44542 } 44543 }; 44544 44545 var fontSize = { 44546 name: "font-size", 44547 initialValue: '0', 44548 prefix: false, 44549 type: PropertyDescriptorParsingType.TYPE_VALUE, 44550 format: 'length' 44551 }; 44552 44553 var fontWeight = { 44554 name: 'font-weight', 44555 initialValue: 'normal', 44556 type: PropertyDescriptorParsingType.VALUE, 44557 prefix: false, 44558 parse: function (token) { 44559 if (isNumberToken(token)) { 44560 return token.number; 44561 } 44562 if (isIdentToken(token)) { 44563 switch (token.value) { 44564 case 'bold': 44565 return 700; 44566 case 'normal': 44567 default: 44568 return 400; 44569 } 44570 } 44571 return 400; 44572 } 44573 }; 44574 44575 var fontVariant = { 44576 name: 'font-variant', 44577 initialValue: 'none', 44578 type: PropertyDescriptorParsingType.LIST, 44579 prefix: false, 44580 parse: function (tokens) { 44581 return tokens.filter(isIdentToken).map(function (token) { return token.value; }); 44582 } 44583 }; 44584 44585 var FONT_STYLE; 44586 (function (FONT_STYLE) { 44587 FONT_STYLE["NORMAL"] = "normal"; 44588 FONT_STYLE["ITALIC"] = "italic"; 44589 FONT_STYLE["OBLIQUE"] = "oblique"; 44590 })(FONT_STYLE || (FONT_STYLE = {})); 44591 var fontStyle = { 44592 name: 'font-style', 44593 initialValue: 'normal', 44594 prefix: false, 44595 type: PropertyDescriptorParsingType.IDENT_VALUE, 44596 parse: function (overflow) { 44597 switch (overflow) { 44598 case 'oblique': 44599 return FONT_STYLE.OBLIQUE; 44600 case 'italic': 44601 return FONT_STYLE.ITALIC; 44602 case 'normal': 44603 default: 44604 return FONT_STYLE.NORMAL; 44605 } 44606 } 44607 }; 44608 44609 var contains = function (bit, value) { return (bit & value) !== 0; }; 44610 44611 var content = { 44612 name: 'content', 44613 initialValue: 'none', 44614 type: PropertyDescriptorParsingType.LIST, 44615 prefix: false, 44616 parse: function (tokens) { 44617 if (tokens.length === 0) { 44618 return []; 44619 } 44620 var first = tokens[0]; 44621 if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') { 44622 return []; 44623 } 44624 return tokens; 44625 } 44626 }; 44627 44628 var counterIncrement = { 44629 name: 'counter-increment', 44630 initialValue: 'none', 44631 prefix: true, 44632 type: PropertyDescriptorParsingType.LIST, 44633 parse: function (tokens) { 44634 if (tokens.length === 0) { 44635 return null; 44636 } 44637 var first = tokens[0]; 44638 if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') { 44639 return null; 44640 } 44641 var increments = []; 44642 var filtered = tokens.filter(nonWhiteSpace); 44643 for (var i = 0; i < filtered.length; i++) { 44644 var counter = filtered[i]; 44645 var next = filtered[i + 1]; 44646 if (counter.type === TokenType.IDENT_TOKEN) { 44647 var increment = next && isNumberToken(next) ? next.number : 1; 44648 increments.push({ counter: counter.value, increment: increment }); 44649 } 44650 } 44651 return increments; 44652 } 44653 }; 44654 44655 var counterReset = { 44656 name: 'counter-reset', 44657 initialValue: 'none', 44658 prefix: true, 44659 type: PropertyDescriptorParsingType.LIST, 44660 parse: function (tokens) { 44661 if (tokens.length === 0) { 44662 return []; 44663 } 44664 var resets = []; 44665 var filtered = tokens.filter(nonWhiteSpace); 44666 for (var i = 0; i < filtered.length; i++) { 44667 var counter = filtered[i]; 44668 var next = filtered[i + 1]; 44669 if (isIdentToken(counter) && counter.value !== 'none') { 44670 var reset = next && isNumberToken(next) ? next.number : 0; 44671 resets.push({ counter: counter.value, reset: reset }); 44672 } 44673 } 44674 return resets; 44675 } 44676 }; 44677 44678 var quotes = { 44679 name: 'quotes', 44680 initialValue: 'none', 44681 prefix: true, 44682 type: PropertyDescriptorParsingType.LIST, 44683 parse: function (tokens) { 44684 if (tokens.length === 0) { 44685 return null; 44686 } 44687 var first = tokens[0]; 44688 if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') { 44689 return null; 44690 } 44691 var quotes = []; 44692 var filtered = tokens.filter(isStringToken); 44693 if (filtered.length % 2 !== 0) { 44694 return null; 44695 } 44696 for (var i = 0; i < filtered.length; i += 2) { 44697 var open_1 = filtered[i].value; 44698 var close_1 = filtered[i + 1].value; 44699 quotes.push({ open: open_1, close: close_1 }); 44700 } 44701 return quotes; 44702 } 44703 }; 44704 var getQuote = function (quotes, depth, open) { 44705 if (!quotes) { 44706 return ''; 44707 } 44708 var quote = quotes[Math.min(depth, quotes.length - 1)]; 44709 if (!quote) { 44710 return ''; 44711 } 44712 return open ? quote.open : quote.close; 44713 }; 44714 44715 var boxShadow = { 44716 name: 'box-shadow', 44717 initialValue: 'none', 44718 type: PropertyDescriptorParsingType.LIST, 44719 prefix: false, 44720 parse: function (tokens) { 44721 if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) { 44722 return []; 44723 } 44724 return parseFunctionArgs(tokens).map(function (values) { 44725 var shadow = { 44726 color: 0x000000ff, 44727 offsetX: ZERO_LENGTH, 44728 offsetY: ZERO_LENGTH, 44729 blur: ZERO_LENGTH, 44730 spread: ZERO_LENGTH, 44731 inset: false 44732 }; 44733 var c = 0; 44734 for (var i = 0; i < values.length; i++) { 44735 var token = values[i]; 44736 if (isIdentWithValue(token, 'inset')) { 44737 shadow.inset = true; 44738 } 44739 else if (isLength(token)) { 44740 if (c === 0) { 44741 shadow.offsetX = token; 44742 } 44743 else if (c === 1) { 44744 shadow.offsetY = token; 44745 } 44746 else if (c === 2) { 44747 shadow.blur = token; 44748 } 44749 else { 44750 shadow.spread = token; 44751 } 44752 c++; 44753 } 44754 else { 44755 shadow.color = color.parse(token); 44756 } 44757 } 44758 return shadow; 44759 }); 44760 } 44761 }; 44762 44763 var CSSParsedDeclaration = /** @class */ (function () { 44764 function CSSParsedDeclaration(declaration) { 44765 this.backgroundClip = parse(backgroundClip, declaration.backgroundClip); 44766 this.backgroundColor = parse(backgroundColor, declaration.backgroundColor); 44767 this.backgroundImage = parse(backgroundImage, declaration.backgroundImage); 44768 this.backgroundOrigin = parse(backgroundOrigin, declaration.backgroundOrigin); 44769 this.backgroundPosition = parse(backgroundPosition, declaration.backgroundPosition); 44770 this.backgroundRepeat = parse(backgroundRepeat, declaration.backgroundRepeat); 44771 this.backgroundSize = parse(backgroundSize, declaration.backgroundSize); 44772 this.borderTopColor = parse(borderTopColor, declaration.borderTopColor); 44773 this.borderRightColor = parse(borderRightColor, declaration.borderRightColor); 44774 this.borderBottomColor = parse(borderBottomColor, declaration.borderBottomColor); 44775 this.borderLeftColor = parse(borderLeftColor, declaration.borderLeftColor); 44776 this.borderTopLeftRadius = parse(borderTopLeftRadius, declaration.borderTopLeftRadius); 44777 this.borderTopRightRadius = parse(borderTopRightRadius, declaration.borderTopRightRadius); 44778 this.borderBottomRightRadius = parse(borderBottomRightRadius, declaration.borderBottomRightRadius); 44779 this.borderBottomLeftRadius = parse(borderBottomLeftRadius, declaration.borderBottomLeftRadius); 44780 this.borderTopStyle = parse(borderTopStyle, declaration.borderTopStyle); 44781 this.borderRightStyle = parse(borderRightStyle, declaration.borderRightStyle); 44782 this.borderBottomStyle = parse(borderBottomStyle, declaration.borderBottomStyle); 44783 this.borderLeftStyle = parse(borderLeftStyle, declaration.borderLeftStyle); 44784 this.borderTopWidth = parse(borderTopWidth, declaration.borderTopWidth); 44785 this.borderRightWidth = parse(borderRightWidth, declaration.borderRightWidth); 44786 this.borderBottomWidth = parse(borderBottomWidth, declaration.borderBottomWidth); 44787 this.borderLeftWidth = parse(borderLeftWidth, declaration.borderLeftWidth); 44788 this.boxShadow = parse(boxShadow, declaration.boxShadow); 44789 this.color = parse(color$1, declaration.color); 44790 this.display = parse(display, declaration.display); 44791 this.float = parse(float, declaration.cssFloat); 44792 this.fontFamily = parse(fontFamily, declaration.fontFamily); 44793 this.fontSize = parse(fontSize, declaration.fontSize); 44794 this.fontStyle = parse(fontStyle, declaration.fontStyle); 44795 this.fontVariant = parse(fontVariant, declaration.fontVariant); 44796 this.fontWeight = parse(fontWeight, declaration.fontWeight); 44797 this.letterSpacing = parse(letterSpacing, declaration.letterSpacing); 44798 this.lineBreak = parse(lineBreak, declaration.lineBreak); 44799 this.lineHeight = parse(lineHeight, declaration.lineHeight); 44800 this.listStyleImage = parse(listStyleImage, declaration.listStyleImage); 44801 this.listStylePosition = parse(listStylePosition, declaration.listStylePosition); 44802 this.listStyleType = parse(listStyleType, declaration.listStyleType); 44803 this.marginTop = parse(marginTop, declaration.marginTop); 44804 this.marginRight = parse(marginRight, declaration.marginRight); 44805 this.marginBottom = parse(marginBottom, declaration.marginBottom); 44806 this.marginLeft = parse(marginLeft, declaration.marginLeft); 44807 this.opacity = parse(opacity, declaration.opacity); 44808 var overflowTuple = parse(overflow, declaration.overflow); 44809 this.overflowX = overflowTuple[0]; 44810 this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0]; 44811 this.overflowWrap = parse(overflowWrap, declaration.overflowWrap); 44812 this.paddingTop = parse(paddingTop, declaration.paddingTop); 44813 this.paddingRight = parse(paddingRight, declaration.paddingRight); 44814 this.paddingBottom = parse(paddingBottom, declaration.paddingBottom); 44815 this.paddingLeft = parse(paddingLeft, declaration.paddingLeft); 44816 this.position = parse(position, declaration.position); 44817 this.textAlign = parse(textAlign, declaration.textAlign); 44818 this.textDecorationColor = parse(textDecorationColor, declaration.textDecorationColor || declaration.color); 44819 this.textDecorationLine = parse(textDecorationLine, declaration.textDecorationLine); 44820 this.textShadow = parse(textShadow, declaration.textShadow); 44821 this.textTransform = parse(textTransform, declaration.textTransform); 44822 this.transform = parse(transform, declaration.transform); 44823 this.transformOrigin = parse(transformOrigin, declaration.transformOrigin); 44824 this.visibility = parse(visibility, declaration.visibility); 44825 this.wordBreak = parse(wordBreak, declaration.wordBreak); 44826 this.zIndex = parse(zIndex, declaration.zIndex); 44827 } 44828 CSSParsedDeclaration.prototype.isVisible = function () { 44829 return this.display > 0 && this.opacity >
44829 0 && this.visibility === VISIBILITY.VISIBLE; 44830 }; 44831 CSSParsedDeclaration.prototype.isTransparent = function () { 44832 return isTransparent(this.backgroundColor); 44833 }; 44834 CSSParsedDeclaration.prototype.isTransformed = function () { 44835 return this.transform !== null; 44836 }; 44837 CSSParsedDeclaration.prototype.isPositioned = function () { 44838 return this.position !== POSITION.STATIC; 44839 }; 44840 CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () { 44841 return this.isPositioned() && !this.zIndex.auto; 44842 }; 44843 CSSParsedDeclaration.prototype.isFloating = function () { 44844 return this.float !== FLOAT.NONE; 44845 }; 44846 CSSParsedDeclaration.prototype.isInlineLevel = function () { 44847 return (contains(this.display, 4 /* INLINE */) || 44848 contains(this.display, 33554432 /* INLINE_BLOCK */) || 44849 contains(this.display, 268435456 /* INLINE_FLEX */) || 44850 contains(this.display, 536870912 /* INLINE_GRID */) || 44851 contains(this.display, 67108864 /* INLINE_LIST_ITEM */) || 44852 contains(this.display, 134217728 /* INLINE_TABLE */)); 44853 }; 44854 return CSSParsedDeclaration; 44855 }()); 44856 var CSSParsedPseudoDeclaration = /** @class */ (function () { 44857 function CSSParsedPseudoDeclaration(declaration) { 44858 this.content = parse(content, declaration.content); 44859 this.quotes = parse(quotes, declaration.quotes); 44860 } 44861 return CSSParsedPseudoDeclaration; 44862 }()); 44863 var CSSParsedCounterDeclaration = /** @class */ (function () { 44864 function CSSParsedCounterDeclaration(declaration) { 44865 this.counterIncrement = parse(counterIncrement, declaration.counterIncrement); 44866 this.counterReset = parse(counterReset, declaration.counterReset); 44867 } 44868 return CSSParsedCounterDeclaration; 44869 }()); 44870 // eslint-disable-next-line @typescript-eslint/no-explicit-any 44871 var parse = function (descriptor, style) { 44872 var tokenizer = new Tokenizer(); 44873 var value = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue; 44874 tokenizer.write(value); 44875 var parser = new Parser(tokenizer.read()); 44876 switch (descriptor.type) { 44877 case PropertyDescriptorParsingType.IDENT_VALUE: 44878 var token = parser.parseComponentValue(); 44879 return descriptor.parse(isIdentToken(token) ? token.value : descriptor.initialValue); 44880 case PropertyDescriptorParsingType.VALUE: 44881 return descriptor.parse(parser.parseComponentValue()); 44882 case PropertyDescriptorParsingType.LIST: 44883 return descriptor.parse(parser.parseComponentValues()); 44884 case PropertyDescriptorParsingType.TOKEN_VALUE: 44885 return parser.parseComponentValue(); 44886 case PropertyDescriptorParsingType.TYPE_VALUE: 44887 switch (descriptor.format) { 44888 case 'angle': 44889 return angle.parse(parser.parseComponentValue()); 44890 case 'color': 44891 return color.parse(parser.parseComponentValue()); 44892 case 'image': 44893 return image.parse(parser.parseComponentValue()); 44894 case 'length': 44895 var length_1 = parser.parseComponentValue(); 44896 return isLength(length_1) ? length_1 : ZERO_LENGTH; 44897 case 'length-percentage': 44898 var value_1 = parser.parseComponentValue(); 44899 return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH; 44900 } 44901 } 44902 throw new Error("Attempting to parse unsupported css format type " + descriptor.format); 44903 }; 44904 44905 var ElementContainer = /** @class */ (function () { 44906 function ElementContainer(element) { 44907 this.styles = new CSSParsedDeclaration(window.getComputedStyle(element, null)); 44908 this.textNodes = []; 44909 this.elements = []; 44910 if (this.styles.transform !== null && isHTMLElementNode(element)) { 44911 // getBoundingClientRect takes transforms into account 44912 element.style.transform = 'none'; 44913 } 44914 this.bounds = parseBounds(element); 44915 this.flags = 0; 44916 } 44917 return ElementContainer; 44918 }()); 44919 44920 var TextBounds = /** @class */ (function () { 44921 function TextBounds(text, bounds) { 44922 this.text = text; 44923 this.bounds = bounds; 44924 } 44925 return TextBounds; 44926 }()); 44927 var parseTextBounds = function (value, styles, node) { 44928 var textList = breakText(value, styles); 44929 var textBounds = []; 44930 var offset = 0; 44931 textList.forEach(function (text) { 44932 if (styles.textDecorationLine.length || text.trim().length > 0) { 44933 if (FEATURES.SUPPORT_RANGE_BOUNDS) { 44934 textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length))); 44935 } 44936 else { 44937 var replacementNode = node.splitText(text.length); 44938 textBounds.push(new TextBounds(text, getWrapperBounds(node))); 44939 node = replacementNode; 44940 } 44941 } 44942 else if (!FEATURES.SUPPORT_RANGE_BOUNDS) { 44943 node = node.splitText(text.length); 44944 } 44945 offset += text.length; 44946 }); 44947 return textBounds; 44948 }; 44949 var getWrapperBounds = function (node) { 44950 var ownerDocument = node.ownerDocument; 44951 if (ownerDocument) { 44952 var wrapper = ownerDocument.createElement('html2canvaswrapper'); 44953 wrapper.appendChild(node.cloneNode(true)); 44954 var parentNode = node.parentNode; 44955 if (parentNode) { 44956 parentNode.replaceChild(wrapper, node); 44957 var bounds = parseBounds(wrapper); 44958 if (wrapper.firstChild) { 44959 parentNode.replaceChild(wrapper.firstChild, wrapper); 44960 } 44961 return bounds; 44962 } 44963 } 44964 return new Bounds(0, 0, 0, 0); 44965 }; 44966 var getRangeBounds = function (node, offset, length) { 44967 var ownerDocument = node.ownerDocument; 44968 if (!ownerDocument) { 44969 throw new Error('Node has no owner document'); 44970 } 44971 var range = ownerDocument.createRange(); 44972 range.setStart(node, offset); 44973 range.setEnd(node, offset + length); 44974 return Bounds.fromClientRect(range.getBoundingClientRect()); 44975 }; 44976 var breakText = function (value, styles) { 44977 return styles.letterSpacing !== 0 ? toCodePoints(value).map(function (i) { return fromCodePoint(i); }) : breakWords(value, styles); 44978 }; 44979 var breakWords = function (str, styles) { 44980 var breaker = LineBreaker(str, { 44981 lineBreak: styles.lineBreak,
44982 wordBreak: styles.overflowWrap === OVERFLOW_WRAP.BREAK_WORD ? 'break-word' : styles.wordBreak 44983 }); 44984 var words = []; 44985 var bk; 44986 while (!(bk = breaker.next()).done) { 44987 if (bk.value) { 44988 words.push(bk.value.slice()); 44989 } 44990 } 44991 return words; 44992 }; 44993 44994 var TextContainer = /** @class */ (function () { 44995 function TextContainer(node, styles) { 44996 this.text = transform$1(node.data, styles.textTransform); 44997 this.textBounds = parseTextBounds(this.text, styles, node); 44998 } 44999 return TextContainer; 45000 }()); 45001 var transform$1 = function (text, transform) { 45002 switch (transform) { 45003 case TEXT_TRANSFORM.LOWERCASE: 45004 return text.toLowerCase(); 45005 case TEXT_TRANSFORM.CAPITALIZE: 45006 return text.replace(CAPITALIZE, capitalize); 45007 case TEXT_TRANSFORM.UPPERCASE: 45008 return text.toUpperCase(); 45009 default: 45010 return text; 45011 } 45012 }; 45013 var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g; 45014 var capitalize = function (m, p1, p2) { 45015 if (m.length > 0) { 45016 return p1 + p2.toUpperCase(); 45017 } 45018 return m; 45019 }; 45020 45021 var ImageElementContainer = /** @class */ (function (_super) { 45022 __extends(ImageElementContainer, _super); 45023 function ImageElementContainer(img) { 45024 var _this = _super.call(this, img) || this; 45025 _this.src = img.currentSrc || img.src; 45026 _this.intrinsicWidth = img.naturalWidth; 45027 _this.intrinsicHeight = img.naturalHeight; 45028 CacheStorage.getInstance().addImage(_this.src); 45029 return _this; 45030 } 45031 return ImageElementContainer; 45032 }(ElementContainer)); 45033 45034 var CanvasElementContainer = /** @class */ (function (_super) { 45035 __extends(CanvasElementContainer, _super); 45036 function CanvasElementContainer(canvas) { 45037 var _this = _super.call(this, canvas) || this; 45038 _this.canvas = canvas; 45039 _this.intrinsicWidth = canvas.width; 45040 _this.intrinsicHeight = canvas.height; 45041 return _this; 45042 } 45043 return CanvasElementContainer; 45044 }(ElementContainer)); 45045 45046 var SVGElementContainer = /** @class */ (function (_super) { 45047 __extends(SVGElementContainer, _super); 45048 function SVGElementContainer(img) { 45049 var _this = _super.call(this, img) || this; 45050 var s = new XMLSerializer(); 45051 _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img)); 45052 _this.intrinsicWidth = img.width.baseVal.value; 45053 _this.intrinsicHeight = img.height.baseVal.value; 45054 CacheStorage.getInstance().addImage(_this.svg); 45055 return _this; 45056 } 45057 return SVGElementContainer; 45058 }(ElementContainer)); 45059 45060 var LIElementContainer = /** @class */ (function (_super) { 45061 __extends(LIElementContainer, _super); 45062 function LIElementContainer(element) { 45063 var _this = _super.call(this, element) || this; 45064 _this.value = element.value; 45065 return _this; 45066 } 45067 return LIElementContainer; 45068 }(ElementContainer)); 45069 45070 var OLElementContainer = /** @class */ (function (_super) { 45071 __extends(OLElementContainer, _super); 45072 function OLElementContainer(element) { 45073 var _this = _super.call(this, element) || this; 45074 _this.start = element.start; 45075 _this.reversed = typeof element.reversed === 'boolean' && element.reversed === true; 45076 return _this; 45077 } 45078 return OLElementContainer; 45079 }(ElementContainer)); 45080 45081 var CHECKBOX_BORDER_RADIUS = [ 45082 { 45083 type: TokenType.DIMENSION_TOKEN, 45084 flags: 0, 45085 unit: 'px', 45086 number: 3 45087 } 45088 ]; 45089 var RADIO_BORDER_RADIUS = [ 45090 { 45091 type: TokenType.PERCENTAGE_TOKEN, 45092 flags: 0, 45093 number: 50 45094 } 45095 ]; 45096 var reformatInputBounds = function (bounds) { 45097 if (bounds.width > bounds.height) { 45098 return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height); 45099 } 45100 else if (bounds.width < bounds.height) { 45101 return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width); 45102 } 45103 return bounds; 45104 }; 45105 var getInputValue = function (node) { 45106 var value = node.type === PASSWORD ? new Array(node.value.length + 1).join('\u2022') : node.value; 45107 return value.length === 0 ? node.placeholder || '' : value; 45108 }; 45109 var CHECKBOX = 'checkbox'; 45110 var RADIO = 'radio'; 45111 var PASSWORD = 'password'; 45112 var INPUT_COLOR = 0x2a2a2aff; 45113 var InputElementContainer = /** @class */ (function (_super) { 45114 __extends(InputElementContainer, _super); 45115 function InputElementContainer(input) { 45116 var _this = _super.call(this, input) || this; 45117 _this.type = input.type.toLowerCase(); 45118 _this.checked = input.checked; 45119 _this.value = getInputValue(input); 45120 if (_this.type === CHECKBOX || _this.type === RADIO) { 45121 _this.styles.backgroundColor = 0xdededeff; 45122 _this.styles.borderTopColor = _this.styles.borderRightColor = _this.styles.borderBottomColor = _this.styles.borderLeftColor = 0xa5a5a5ff; 45123 _this.styles.borderTopWidth = _this.styles.borderRightWidth = _this.styles.borderBottomWidth = _this.styles.borderLeftWidth = 1; 45124 _this.styles.borderTopStyle = _this.styles.borderRightStyle = _this.styles.borderBottomStyle = _this.styles.borderLeftStyle = 45125 BORDER_STYLE.SOLID; 45126 _this.styles.backgroundClip = [BACKGROUND_CLIP.BORDER_BOX]; 45127 _this.styles.backgroundOrigin = [0 /* BORDER_BOX */]; 45128 _this.bounds = reformatInputBounds(_this.bounds); 45129 } 45130 switch (_this.type) { 45131 case CHECKBOX: 45132 _this.styles.borderTopRightRadius = _this.styles.borderTopLeftRadius = _this.styles.borderBottomRightRadius = _this.styles.borderBottomLeftRadius = CHECKBOX_BORDER_RADIUS; 45133 break; 45134 case RADIO: 45135 _this.styles.borderTopRightRadius = _this.styles.borderTopLeftRadius = _this.styles.borderBottomRightRadius = _this.styles.borderBottomLeftRadius = RADIO_BORDER_RADIUS; 45136 break; 45137 } 45138 return _this; 45139 } 45140 return InputElementContainer; 45141 }(ElementContainer)); 45142 45143 var SelectElementContainer = /** @class */ (function (_super) { 45144 __extends(SelectElementContainer, _super); 45145 function SelectElementContainer(element) { 45146 var _this = _super.call(this, element) || this; 45147 var option = element.options[element.selectedIndex || 0]; 45148 _this.value = option ? option.text || '' : ''; 45149 return _this; 45150 } 45151 return SelectElementContainer; 45152 }(ElementContainer)); 45153 45154 var TextareaElementContainer = /** @class */ (function (_super) { 45155 __extends(TextareaElementContainer, _super); 45156 function TextareaElementContainer(element) { 45157 var _this = _super.call(this, element) || this; 45158 _this.value = element.value; 45159 return _this; 45160 } 45161 return TextareaElementContainer; 45162 }(ElementContainer)); 45163 45164 var parseColor = function (value) { return color.parse(Parser.create(value).parseComponentValue()); }; 45165 var IFrameElementContainer = /** @class */ (function (_super) { 45166 __extends(IFrameElementContainer, _super); 45167 function IFrameElementContainer(iframe) { 45168 var _this = _super.call(this, iframe) || this;
45169 _this.src = iframe.src; 45170 _this.width = parseInt(iframe.width, 10) || 0; 45171 _this.height = parseInt(iframe.height, 10) || 0; 45172 _this.backgroundColor = _this.styles.backgroundColor; 45173 try { 45174 if (iframe.contentWindow && 45175 iframe.contentWindow.document && 45176 iframe.contentWindow.document.documentElement) { 45177 _this.tree = parseTree(iframe.contentWindow.document.documentElement); 45178 // http://www.w3.org/TR/css3-background/#special-backgrounds 45179 var documentBackgroundColor = iframe.contentWindow.document.documentElement 45180 ? parseColor(getComputedStyle(iframe.contentWindow.document.documentElement) 45181 .backgroundColor) 45182 : COLORS.TRANSPARENT; 45183 var bodyBackgroundColor = iframe.contentWindow.document.body 45184 ? parseColor(getComputedStyle(iframe.contentWindow.document.body).backgroundColor) 45185 : COLORS.TRANSPARENT; 45186 _this.backgroundColor = isTransparent(documentBackgroundColor) 45187 ? isTransparent(bodyBackgroundColor) 45188 ? _this.styles.backgroundColor 45189 : bodyBackgroundColor 45190 : documentBackgroundColor; 45191 } 45192 } 45193 catch (e) { } 45194 return _this; 45195 } 45196 return IFrameElementContainer; 45197 }(ElementContainer)); 45198 45199 var LIST_OWNERS = ['OL', 'UL', 'MENU']; 45200 var parseNodeTree = function (node, parent, root) { 45201 for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) { 45202 nextNode = childNode.nextSibling; 45203 if (isTextNode(childNode) && childNode.data.trim().length > 0) { 45204 parent.textNodes.push(new TextContainer(childNode, parent.styles)); 45205 } 45206 else if (isElementNode(childNode)) { 45207 var container = createContainer(childNode); 45208 if (container.styles.isVisible()) { 45209 if (createsRealStackingContext(childNode, container, root)) { 45210 container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */; 45211 } 45212 else if (createsStackingContext(container.styles)) { 45213 container.flags |= 2 /* CREATES_STACKING_CONTEXT */; 45214 } 45215 if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) { 45216 container.flags |= 8 /* IS_LIST_OWNER */; 45217 } 45218 parent.elements.push(container); 45219 if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) { 45220 parseNodeTree(childNode, container, root); 45221 } 45222 } 45223 } 45224 } 45225 }; 45226 var createContainer = function (element) { 45227 if (isImageElement(element)) { 45228 return new ImageElementContainer(element); 45229 } 45230 if (isCanvasElement(element)) { 45231 return new CanvasElementContainer(element); 45232 } 45233 if (isSVGElement(element)) { 45234 return new SVGElementContainer(element); 45235 } 45236 if (isLIElement(element)) { 45237 return new LIElementContainer(element); 45238 } 45239 if (isOLElement(element)) { 45240 return new OLElementContainer(element); 45241 } 45242 if (isInputElement(element)) { 45243 return new InputElementContainer(element); 45244 } 45245 if (isSelectElement(element)) { 45246 return new SelectElementContainer(element); 45247 } 45248 if (isTextareaElement(element)) { 45249 return new TextareaElementContainer(element); 45250 } 45251 if (isIFrameElement(element)) { 45252 return new IFrameElementContainer(element); 45253 } 45254 return new ElementContainer(element); 45255 }; 45256 var parseTree = function (element) { 45257 var container = createContainer(element); 45258 container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */; 45259 parseNodeTree(element, container, container); 45260 return container; 45261 }; 45262 var createsRealStackingContext = function (node, container, root) { 45263 return (container.styles.isPositionedWithZIndex() || 45264 container.styles.opacity < 1 || 45265 container.styles.isTransformed() ||
vendor: 8,568 bytes, lines 45266-45598
45266 (isBodyElement(node) && root.styles.isTransparent())); 45267 }; 45268 var createsStackingContext = function (styles) { return styles.isPositioned() || styles.isFloating(); }; 45269 var isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; }; 45270 var isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; }; 45271 var isHTMLElementNode = function (node) { 45272 return isElementNode(node) && typeof node.style !== 'undefined' && !isSVGElementNode(node); 45273 }; 45274 var isSVGElementNode = function (element) { 45275 return typeof element.className === 'object'; 45276 }; 45277 var isLIElement = function (node) { return node.tagName === 'LI'; }; 45278 var isOLElement = function (node) { return node.tagName === 'OL'; }; 45279 var isInputElement = function (node) { return node.tagName === 'INPUT'; }; 45280 var isHTMLElement = function (node) { return node.tagName === 'HTML'; }; 45281 var isSVGElement = function (node) { return node.tagName === 'svg'; }; 45282 var isBodyElement = function (node) { return node.tagName === 'BODY'; }; 45283 var isCanvasElement = function (node) { return node.tagName === 'CANVAS'; }; 45284 var isImageElement = function (node) { return node.tagName === 'IMG'; }; 45285 var isIFrameElement = function (node) { return node.tagName === 'IFRAME'; }; 45286 var isStyleElement = function (node) { return node.tagName === 'STYLE'; }; 45287 var isScriptElement = function (node) { return node.tagName === 'SCRIPT'; }; 45288 var isTextareaElement = function (node) { return node.tagName === 'TEXTAREA'; }; 45289 var isSelectElement = function (node) { return node.tagName === 'SELECT'; }; 45290 45291 var CounterState = /** @class */ (function () { 45292 function CounterState() { 45293 this.counters = {}; 45294 } 45295 CounterState.prototype.getCounterValue = function (name) { 45296 var counter = this.counters[name]; 45297 if (counter && counter.length) { 45298 return counter[counter.length - 1]; 45299 } 45300 return 1; 45301 }; 45302 CounterState.prototype.getCounterValues = function (name) { 45303 var counter = this.counters[name]; 45304 return counter ? counter : []; 45305 }; 45306 CounterState.prototype.pop = function (counters) { 45307 var _this = this; 45308 counters.forEach(function (counter) { return _this.counters[counter].pop(); }); 45309 }; 45310 CounterState.prototype.parse = function (style) { 45311 var _this = this; 45312 var counterIncrement = style.counterIncrement; 45313 var counterReset = style.counterReset; 45314 var canReset = true; 45315 if (counterIncrement !== null) { 45316 counterIncrement.forEach(function (entry) { 45317 var counter = _this.counters[entry.counter]; 45318 if (counter && entry.increment !== 0) { 45319 canReset = false; 45320 counter[Math.max(0, counter.length - 1)] += entry.increment; 45321 } 45322 }); 45323 } 45324 var counterNames = []; 45325 if (canReset) { 45326 counterReset.forEach(function (entry) { 45327 var counter = _this.counters[entry.counter]; 45328 counterNames.push(entry.counter); 45329 if (!counter) { 45330 counter = _this.counters[entry.counter] = []; 45331 } 45332 counter.push(entry.reset); 45333 }); 45334 } 45335 return counterNames; 45336 }; 45337 return CounterState; 45338 }()); 45339 var ROMAN_UPPER = { 45340 integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1], 45341 values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] 45342 }; 45343 var ARMENIAN = { 45344 integers: [ 45345 9000, 45346 8000, 45347 7000, 45348 6000, 45349 5000, 45350 4000, 45351 3000, 45352 2000, 45353 1000, 45354 900, 45355 800, 45356 700, 45357 600, 45358 500, 45359 400, 45360 300, 45361 200, 45362 100, 45363 90, 45364 80, 45365 70, 45366 60, 45367 50, 45368 40, 45369 30, 45370 20, 45371 10, 45372 9, 45373 8, 45374 7, 45375 6, 45376 5, 45377 4, 45378 3, 45379 2, 45380 1 45381 ], 45382 values: [ 45383 'Õ', 45384 'Õ', 45385 'Õ', 45386 'Õ', 45387 'Õ', 45388 'Õ', 45389 'Õ', 45390 'Õ', 45391 'Õ', 45392 'Õ', 45393 'Õ', 45394 'Õ', 45395 'Õ', 45396 'Õ', 45397 'Õ', 45398 'Õ ', 45399 'Õ', 45400 'Õ', 45401 'Õ', 45402 'Õ', 45403 'Õ', 45404 'Ô¿', 45405 'Ô¾', 45406 'Ô½', 45407 'Ô¼', 45408 'Ô»', 45409 'Ôº', 45410 'Ô¹', 45411 'Ô¸', 45412 'Ô·', 45413 'Ô¶', 45414 'Ôµ', 45415 'Ô´', 45416 'Ô³', 45417 'Ô²', 45418 'Ô±' 45419 ] 45420 }; 45421 var HEBREW = { 45422 integers: [ 45423 10000, 45424 9000, 45425 8000, 45426 7000, 45427 6000, 45428 5000, 45429 4000, 45430 3000, 45431 2000, 45432 1000, 45433 400, 45434 300, 45435 200, 45436 100, 45437 90, 45438 80, 45439 70, 45440 60, 45441 50, 45442 40, 45443 30, 45444 20, 45445 19, 45446 18, 45447 17, 45448 16, 45449 15, 45450 10, 45451 9, 45452 8, 45453 7, 45454 6, 45455 5, 45456 4, 45457 3, 45458 2, 45459 1 45460 ], 45461 values: [ 45462 '×׳', 45463 '×׳', 45464 '×׳', 45465 '×׳', 45466 '×׳', 45467 '×׳', 45468 '×׳', 45469 '×׳', 45470 '×׳', 45471 '×׳', 45472 'ת', 45473 'ש', 45474 'ר', 45475 '×§', 45476 'צ', 45477 'פ', 45478 '×¢', 45479 'ס', 45480 '× ', 45481 '×', 45482 '×', 45483 '×', 45484 '××', 45485 '××', 45486 '××', 45487 '××', 45488 '××', 45489 '×', 45490 '×', 45491 '×', 45492 '×', 45493 '×', 45494 '×', 45495 '×', 45496 '×', 45497 '×', 45498 '×' 45499 ] 45500 }; 45501 var GEORGIAN = { 45502 integers: [ 45503 10000, 45504 9000, 45505 8000, 45506 7000, 45507 6000, 45508 5000, 45509 4000, 45510 3000, 45511 2000, 45512 1000, 45513 900, 45514 800, 45515 700, 45516 600, 45517 500, 45518 400, 45519 300, 45520 200, 45521 100, 45522 90, 45523 80, 45524 70, 45525 60, 45526 50, 45527 40, 45528 30, 45529 20, 45530 10, 45531 9, 45532 8, 45533 7, 45534 6, 45535 5, 45536 4, 45537 3, 45538 2, 45539 1 45540 ], 45541 values: [ 45542 'áµ', 45543 'á°', 45544 'á¯', 45545 'á´', 45546 'á®', 45547 'á', 45548 'á¬', 45549 'á«', 45550 'áª', 45551 'á©', 45552 'á¨', 45553 'á§', 45554 'á¦', 45555 'á¥', 45556 'á¤', 45557 'á³', 45558 'á¢', 45559 'á¡', 45560 'á ', 45561 'á', 45562 'á', 45563 'á', 45564 'á²', 45565 'á', 45566 'á', 45567 'á', 45568 'á', 45569 'á', 45570 'á', 45571 'á±', 45572 'á', 45573 'á', 45574 'á', 45575 'á', 45576 'á', 45577 'á', 45578 'á' 45579 ] 45580 }; 45581 var createAdditiveCounter = function (value, min, max, symbols, fallback, suffix) { 45582 if (value < min || value > max) { 45583 return createCounterText(value, fallback, suffix.length > 0); 45584 } 45585 return (symbols.integers.reduce(function (string, integer, index) { 45586 while (value >= integer) { 45587 value -= integer; 45588 string += symbols.values[index]; 45589 } 45590 return string; 45591 }, '') + suffix); 45592 }; 45593 var createCounterStyleWithSymbolResolver = function (value, codePointRangeLength, isNumeric, resolver) { 45594 var string = ''; 45595 do { 45596 if (!isNumeric) { 45597 value--; 45598 }
45599 string = resolver(value) + string; 45600 value /= codePointRangeLength; 45601 } while (value * codePointRangeLength >= codePointRangeLength); 45602 return string; 45603 }; 45604 var createCounterStyleFromRange = function (value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) { 45605 var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1; 45606 return ((value < 0 ? '-' : '') + 45607 (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) { 45608 return fromCodePoint(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart); 45609 }) + 45610 suffix)); 45611 }; 45612 var createCounterStyleFromSymbols = function (value, symbols, suffix) { 45613 if (suffix === void 0) { suffix = '. '; } 45614 var codePointRangeLength = symbols.length; 45615 return (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) { return symbols[Math.floor(codePoint % codePointRangeLength)]; }) + suffix); 45616 }; 45617 var CJK_ZEROS = 1 << 0; 45618 var CJK_TEN_COEFFICIENTS = 1 << 1; 45619 var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2; 45620 var CJK_HUNDRED_COEFFICIENTS = 1 << 3; 45621 var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) { 45622 if (value < -9999 || value > 9999) { 45623 return createCounterText(value, LIST_STYLE_TYPE.CJK_DECIMAL, suffix.length > 0); 45624 } 45625 var tmp = Math.abs(value); 45626 var string = suffix; 45627 if (tmp === 0) { 45628 return numbers[0] + string; 45629 } 45630 for (var digit = 0; tmp > 0 && digit <= 4; digit++) { 45631 var coefficient = tmp % 10; 45632 if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== '') { 45633 string = numbers[coefficient] + string; 45634 } 45635 else if (coefficient > 1 || 45636 (coefficient === 1 && digit === 0) || 45637 (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS)) || 45638 (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100) || 45639 (coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS))) { 45640 string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string; 45641 } 45642 else if (coefficient === 1 && digit > 0) { 45643 string = multipliers[digit - 1] + string; 45644 } 45645 tmp = Math.floor(tmp / 10); 45646 } 45647 return (value < 0 ? negativeSign : '') + string; 45648 }; 45649 var CHINESE_INFORMAL_MULTIPLIERS = 'åç¾åè¬'; 45650 var CHINESE_FORMAL_MULTIPLIERS = 'æ¾ä½°ä»è¬'; 45651 var JAPANESE_NEGATIVE = 'ãã¤ãã¹'; 45652 var KOREAN_NEGATIVE = 'ë§ì´ëì¤'; 45653 var createCounterText = function (value, type, appendSuffix) { 45654 var defaultSuffix = appendSuffix ? '. ' : ''; 45655 var cjkSuffix = appendSuffix ? 'ã' : ''; 45656 var koreanSuffix = appendSuffix ? ', ' : ''; 45657 var spaceSuffix = appendSuffix ? ' ' : ''; 45658 switch (type) { 45659 case LIST_STYLE_TYPE.DISC: 45660 return 'â¢' + spaceSuffix; 45661 case LIST_STYLE_TYPE.CIRCLE: 45662 return 'â¦' + spaceSuffix; 45663 case LIST_STYLE_TYPE.SQUARE: 45664 return 'â¾' + spaceSuffix; 45665 case LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO: 45666 var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix); 45667 return string.length < 4 ? "0" + string : string; 45668 case LIST_STYLE_TYPE.CJK_DECIMAL: 45669 return createCounterStyleFromSymbols(value, 'ãä¸äºä¸åäºå ä¸å «ä¹', cjkSuffix); 45670 case LIST_STYLE_TYPE.LOWER_ROMAN: 45671 return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase(); 45672 case LIST_STYLE_TYPE.UPPER_ROMAN: 45673 return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, LIST_STYLE_TYPE.DECIMAL, defaultSuffix); 45674 case LIST_STYLE_TYPE.LOWER_GREEK: 45675 return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix); 45676 case LIST_STYLE_TYPE.LOWER_ALPHA: 45677 return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix); 45678 case LIST_STYLE_TYPE.UPPER_ALPHA: 45679 return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix); 45680 case LIST_STYLE_TYPE.ARABIC_INDIC: 45681 return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix); 45682 case LIST_STYLE_TYPE.ARMENIAN: 45683 case LIST_STYLE_TYPE.UPPER_ARMENIAN: 45684 return createAdditiveCounter(value, 1, 9999, ARMENIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix); 45685 case LIST_STYLE_TYPE.LOWER_ARMENIAN: 45686 return createAdditiveCounter(value, 1, 9999, ARMENIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase(); 45687 case LIST_STYLE_TYPE.BENGALI: 45688 return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix); 45689 case LIST_STYLE_TYPE.CAMBODIAN: 45690 case LIST_STYLE_TYPE.KHMER: 45691 return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix); 45692 case LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH: 45693 return createCounterStyleFromSymbols(value, 'åä¸å¯ å¯è¾°å·³åæªç³é æäº¥', cjkSuffix); 45694 case LIST_STYLE_TYPE.CJK_HEAVENLY_STEM: 45695 return createCounterStyleFromSymbols(value, 'ç²ä¹ä¸ä¸æå·±åºè¾å£¬ç¸', cjkSuffix); 45696 case LIST_STYLE_TYPE.CJK_IDEOGRAPHIC: 45697 case LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL: 45698 return createCJKCounter(value, 'é¶ä¸äºä¸åäºå ä¸å «ä¹', CHINESE_INFORMAL_MULTIPLIERS, 'è² ', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); 45699 case LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL: 45700 return createCJKCounter(value, 'é¶å£¹è²³åèä¼é¸ææç', CHINESE_FORMAL_MULTIPLIERS, 'è² ', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); 45701 case LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL: 45702 return createCJKCounter(value, 'é¶ä¸äºä¸åäºå ä¸å «ä¹', CHINESE_INFORMAL_MULTIPLIERS, 'è´', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); 45703 case LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL: 45704 return createCJKCounter(value, 'é¶å£¹è´°åèä¼éææç', CHINESE_FORMAL_MULTIPLIERS, 'è´', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); 45705 case LIST_STYLE_TYPE.JAPANESE_INFORMAL: 45706 return createCJKCounter(value, 'ãä¸äºä¸åäºå ä¸å «ä¹', 'åç¾åä¸', JAPANESE_NEGATIVE, cjkSuffix, 0); 45707 case LIST_STYLE_TYPE.JAPANESE_FORMAL: 45708 return createCJKCounter(value, 'é¶å£±å¼ååä¼å ä¸å «ä¹', 'æ¾ç¾åä¸', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); 45709 case LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL: 45710 return createCJKCounter(value, 'ìì¼ì´ì¼ì¬ì¤ì¡ì¹ í구', 'ìë°±ì²ë§', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); 45711 case LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL: 45712 return createCJKCounter(value, 'é¶ä¸äºä¸åäºå ä¸å «ä¹', 'åç¾åè¬', KOREAN_NEGATIVE, koreanSuffix, 0); 45713 case LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL: 45714 return createCJKCounter(value, 'é¶å£¹è²³ååäºå ä¸å «ä¹', 'æ¾ç¾å', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); 45715 case LIST_STYLE_TYPE.DEVANAGARI: 45716 return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix); 45717 case LIST_STYLE_TYPE.GEORGIAN: 45718 return createAdditiveCounter(value, 1, 19999, GEORGIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix); 45719 case LIST_STYLE_TYPE.GUJARATI: 45720 return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix); 45721 case LIST_STYLE_TYPE.GURMUKHI: 45722 return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix); 45723 case LIST_STYLE_TYPE.HEBREW: 45724 return createAdditiveCounter(value, 1, 10999, HEBREW, LIST_STYLE_TYPE.DECIMAL, defaultSuffix); 45725 case LIST_STYLE_TYPE.HIRAGANA: 45726 return createCounterStyleFromSymbols(value, 'ããããããããããããããããã¡ã¤ã¦ã¨ãªã«ã¬ãã®ã¯ã²ãµã¸ã»ã¾ã¿ãããããããããããããããã'); 45727 case LIST_STYLE_TYPE.HIRAGANA_IROHA: 45728 return createCounterStyleFromSymbols(value, 'ããã¯ã«ã»ã¸ã¨ã¡ãã¬ããããããããã¤ããªããããã®ãããã¾ããµããã¦ãããããã¿ããã²ããã'); 45729 case LIST_STYLE_TYPE.KANNADA: 45730 return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
45731 case LIST_STYLE_TYPE.KATAKANA: 45732 return createCounterStyleFromSymbols(value, 'ã¢ã¤ã¦ã¨ãªã«ãã¯ã±ã³ãµã·ã¹ã»ã½ã¿ããããããããããããããããã ã¡ã¢ã¤ã¦ã¨ã©ãªã«ã¬ãã¯ã°ã±ã²ã³', cjkSuffix); 45733 case LIST_STYLE_TYPE.KATAKANA_IROHA: 45734 return createCounterStyleFromSymbols(value, 'ã¤ããããããããªãã«ã²ã¯ã«ã¨ã¿ã¬ã½ãããã©ã ã¦ã°ããªã¯ã¤ãã±ãã³ã¨ãã¢ãµãã¦ã¡ãã·ã±ãã¢ã»ã¹', cjkSuffix); 45735 case LIST_STYLE_TYPE.LAO: 45736 return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix); 45737 case LIST_STYLE_TYPE.MONGOLIAN: 45738 return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix); 45739 case LIST_STYLE_TYPE.MYANMAR: 45740 return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix); 45741 case LIST_STYLE_TYPE.ORIYA: 45742 return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix); 45743 case LIST_STYLE_TYPE.PERSIAN: 45744 return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix); 45745 case LIST_STYLE_TYPE.TAMIL: 45746 return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix); 45747 case LIST_STYLE_TYPE.TELUGU: 45748 return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix); 45749 case LIST_STYLE_TYPE.THAI: 45750 return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix); 45751 case LIST_STYLE_TYPE.TIBETAN: 45752 return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix); 45753 case LIST_STYLE_TYPE.DECIMAL: 45754 default: 45755 return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix); 45756 } 45757 }; 45758 45759 var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore'; 45760 var DocumentCloner = /** @class */ (function () { 45761 function DocumentCloner(element, options) { 45762 this.options = options; 45763 this.scrolledElements = []; 45764 this.referenceElement = element; 45765 this.counters = new CounterState(); 45766 this.quoteDepth = 0; 45767 if (!element.ownerDocument) { 45768 throw new Error('Cloned element does not have an owner document'); 45769 } 45770 this.documentElement = this.cloneNode(element.ownerDocument.documentElement); 45771 } 45772 DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) { 45773 var _this = this; 45774 var iframe = createIFrameContainer(ownerDocument, windowSize); 45775 if (!iframe.contentWindow) { 45776 return Promise.reject("Unable to find iframe window"); 45777 } 45778 var scrollX = ownerDocument.defaultView.pageXOffset; 45779 var scrollY = ownerDocument.defaultView.pageYOffset; 45780 var cloneWindow = iframe.contentWindow; 45781 var documentClone = cloneWindow.document; 45782 /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle 45783 if window url is about:blank, we can assign the url to current by writing onto the document 45784 */ 45785 var iframeLoad = iframeLoader(iframe).then(function () { return __awaiter(_this, void 0, void 0, function () { 45786 var onclone; 45787 return __generator(this, function (_a) { 45788 switch (_a.label) { 45789 case 0: 45790 this.scrolledElements.forEach(restoreNodeScroll); 45791 if (cloneWindow) { 45792 cloneWindow.scrollTo(windowSize.left, windowSize.top); 45793 if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && 45794 (cloneWindow.scrollY !== windowSize.top || cloneWindow.scrollX !== windowSize.left)) { 45795 documentClone.documentElement.style.top = -windowSize.top + 'px'; 45796 documentClone.documentElement.style.left = -windowSize.left + 'px'; 45797 documentClone.documentElement.style.position = 'absolute'; 45798 } 45799 } 45800 onclone = this.options.onclone; 45801 if (typeof this.clonedReferenceElement === 'undefined') { 45802 return [2 /*return*/, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")
vendor: 9,952 bytes, lines 45802-46003
45802]; 45803 } 45804 if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2]; 45805 return [4 /*yield*/, documentClone.fonts.ready]; 45806 case 1: 45807 _a.sent(); 45808 _a.label = 2; 45809 case 2: 45810 if (typeof onclone === 'function') { 45811 return [2 /*return*/, Promise.resolve() 45812 .then(function () { return onclone(documentClone); }) 45813 .then(function () { return iframe; })]; 45814 } 45815 return [2 /*return*/, iframe]; 45816 } 45817 }); 45818 }); }); 45819 documentClone.open(); 45820 documentClone.write(serializeDoctype(document.doctype) + "<html></html>"); 45821 // Chrome scrolls the parent document for some reason after the write to the cloned window??? 45822 restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY); 45823 documentClone.replaceChild(documentClone.adoptNode(this.documentElement), documentClone.documentElement); 45824 documentClone.close(); 45825 return iframeLoad; 45826 }; 45827 DocumentCloner.prototype.createElementClone = function (node) { 45828 if (isCanvasElement(node)) { 45829 return this.createCanvasClone(node); 45830 } 45831 /* 45832 if (isIFrameElement(node)) { 45833 return this.createIFrameClone(node); 45834 } 45835 */ 45836 if (isStyleElement(node)) { 45837 return this.createStyleClone(node); 45838 } 45839 var clone = node.cloneNode(false); 45840 // @ts-ignore 45841 if (isImageElement(clone) && clone.loading === 'lazy') { 45842 // @ts-ignore 45843 clone.loading = 'eager'; 45844 } 45845 return clone; 45846 }; 45847 DocumentCloner.prototype.createStyleClone = function (node) { 45848 try { 45849 var sheet = node.sheet; 45850 if (sheet && sheet.cssRules) { 45851 var css = [].slice.call(sheet.cssRules, 0).reduce(function (css, rule) { 45852 if (rule && typeof rule.cssText === 'string') { 45853 return css + rule.cssText; 45854 } 45855 return css; 45856 }, ''); 45857 var style = node.cloneNode(false); 45858 style.textContent = css; 45859 return style; 45860 } 45861 } 45862 catch (e) { 45863 // accessing node.sheet.cssRules throws a DOMException 45864 Logger.getInstance(this.options.id).error('Unable to access cssRules property', e); 45865 if (e.name !== 'SecurityError') { 45866 throw e; 45867 } 45868 } 45869 return node.cloneNode(false); 45870 }; 45871 DocumentCloner.prototype.createCanvasClone = function (canvas) { 45872 if (this.options.inlineImages && canvas.ownerDocument) { 45873 var img = canvas.ownerDocument.createElement('img'); 45874 try { 45875 img.src = canvas.toDataURL(); 45876 return img; 45877 } 45878 catch (e) { 45879 Logger.getInstance(this.options.id).info("Unable to clone canvas contents, canvas is tainted"); 45880 } 45881 } 45882 var clonedCanvas = canvas.cloneNode(false); 45883 try { 45884 clonedCanvas.width = canvas.width; 45885 clonedCanvas.height = canvas.height; 45886 var ctx = canvas.getContext('2d'); 45887 var clonedCtx = clonedCanvas.getContext('2d'); 45888 if (clonedCtx) { 45889 if (ctx) { 45890 clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0); 45891 } 45892 else { 45893 clonedCtx.drawImage(canvas, 0, 0); 45894 } 45895 } 45896 return clonedCanvas; 45897 } 45898 catch (e) { } 45899 return clonedCanvas; 45900 }; 45901 /* 45902 createIFrameClone(iframe: HTMLIFrameElement) { 45903 const tempIframe = <HTMLIFrameElement>iframe.cloneNode(false); 45904 const iframeKey = generateIframeKey(); 45905 tempIframe.setAttribute('data-html2canvas-internal-iframe-key', iframeKey); 45906 45907 const {width, height} = parseBounds(iframe); 45908 45909 this.resourceLoader.cache[iframeKey] = getIframeDocumentElement(iframe, this.options) 45910 .then(documentElement => { 45911 return this.renderer( 45912 documentElement, 45913 { 45914 allowTaint: this.options.allowTaint, 45915 backgroundColor: '#ffffff', 45916 canvas: null, 45917 imageTimeout: this.options.imageTimeout, 45918 logging: this.options.logging, 45919 proxy: this.options.proxy, 45920 removeContainer: this.options.removeContainer, 45921 scale: this.options.scale, 45922 foreignObjectRendering: this.options.foreignObjectRendering, 45923 useCORS: this.options.useCORS, 45924 target: new CanvasRenderer(), 45925 width, 45926 height, 45927 x: 0, 45928 y: 0, 45929 windowWidth: documentElement.ownerDocument.defaultView.innerWidth, 45930 windowHeight: documentElement.ownerDocument.defaultView.innerHeight, 45931 scrollX: documentElement.ownerDocument.defaultView.pageXOffset, 45932 scrollY: documentElement.ownerDocument.defaultView.pageYOffset 45933 }, 45934 ); 45935 }) 45936 .then( 45937 (canvas: HTMLCanvasElement) => 45938 new Promise((resolve, reject) => { 45939 const iframeCanvas = document.createElement('img'); 45940 iframeCanvas.onload = () => resolve(canvas); 45941 iframeCanvas.onerror = (event) => { 45942 // Empty iframes may result in empty "data:," URLs, which are invalid from the <img>'s point of view 45943 // and instead of `onload` cause `onerror` and unhandled rejection warnings 45944 // https://github.com/niklasvh/html2canvas/issues/1502 45945 iframeCanvas.src == 'data:,' ? resolve(canvas) : reject(event); 45946 }; 45947 iframeCanvas.src = canvas.toDataURL(); 45948 if (tempIframe.parentNode && iframe.ownerDocument && iframe.ownerDocument.defaultView) { 45949 tempIframe.parentNode.replaceChild( 45950 copyCSSStyles( 45951 iframe.ownerDocument.defaultView.getComputedStyle(iframe), 45952 iframeCanvas 45953 ), 45954 tempIframe 45955 ); 45956 } 45957 }) 45958 ); 45959 return tempIframe; 45960 } 45961 */ 45962 DocumentCloner.prototype.cloneNode = function (node) { 45963 if (isTextNode(node)) { 45964 return document.createTextNode(node.data); 45965 } 45966 if (!node.ownerDocument) { 45967 return node.cloneNode(false); 45968 } 45969 var window = node.ownerDocument.defaultView; 45970 if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) { 45971 var clone = this.createElementClone(node); 45972 var style = window.getComputedStyle(node); 45973 var styleBefore = window.getComputedStyle(node, ':before'); 45974 var styleAfter = window.getComputedStyle(node, ':after'); 45975 if (this.referenceElement === node && isHTMLElementNode(clone)) { 45976 this.clonedReferenceElement = clone; 45977 } 45978 if (isBodyElement(clone)) { 45979 createPseudoHideStyles(clone); 45980 } 45981 var counters = this.counters.parse(new CSSParsedCounterDeclaration(style)); 45982 var before = this.resolvePseudoContent(node, clone, styleBefore, PseudoElementType.BEFORE); 45983 for (var child = node.firstChild; child; child = child.nextSibling) { 45984 if (!isElementNode(child) || 45985 (!isScriptElement(child) && 45986 !child.hasAttribute(IGNORE_ATTRIBUTE) && 45987 (typeof this.options.ignoreElements !== 'function' || !this.options.ignoreElements(child)))) { 45988 if (!this.options.copyStyles || !isElementNode(child) || !isStyleElement(child)) { 45989 clone.appendChild(this.cloneNode(child)); 45990 } 45991 } 45992 } 45993 if (before) { 45994 clone.insertBefore(before, clone.firstChild); 45995 } 45996 var after = this.resolvePseudoContent(node, clone, styleAfter, PseudoElementType.AFTER); 45997 if (after) { 45998 clone.appendChild(after); 45999 } 46000 this.counters.pop(counters); 46001 if (style && (this.options.copyStyles || isSVGElementNode(node)) && !isIFrameElement(node)) { 46002 copyCSSStyles(style, clone); 46003 }
46004 //this.inlineAllImages(clone); 46005 if (node.scrollTop !== 0 || node.scrollLeft !== 0) { 46006 this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]); 46007 } 46008 if ((isTextareaElement(node) || isSelectElement(node)) && 46009 (isTextareaElement(clone) || isSelectElement(clone))) { 46010 clone.value = node.value; 46011 } 46012 return clone; 46013 } 46014 return node.cloneNode(false); 46015 }; 46016 DocumentCloner.prototype.resolvePseudoContent = function (node, clone, style, pseudoElt) { 46017 var _this = this; 46018 if (!style) { 46019 return; 46020 } 46021 var value = style.content; 46022 var document = clone.ownerDocument; 46023 if (!document || !value || value === 'none' || value === '-moz-alt-content' || style.display === 'none') { 46024 return; 46025 } 46026 this.counters.parse(new CSSParsedCounterDeclaration(style)); 46027 var declaration = new CSSParsedPseudoDeclaration(style); 46028 var anonymousReplacedElement = document.createElement('html2canvaspseudoelement'); 46029 copyCSSStyles(style, anonymousReplacedElement); 46030 declaration.content.forEach(function (token) { 46031 if (token.type === TokenType.STRING_TOKEN) { 46032 anonymousReplacedElement.appendChild(document.createTextNode(token.value)); 46033 } 46034 else if (token.type === TokenType.URL_TOKEN) { 46035 var img = document.createElement('img'); 46036 img.src = token.value; 46037 img.style.opacity = '1'; 46038 anonymousReplacedElement.appendChild(img); 46039 } 46040 else if (token.type === TokenType.FUNCTION) { 46041 if (token.name === 'attr') { 46042 var attr = token.values.filter(isIdentToken); 46043 if (attr.length) { 46044 anonymousReplacedElement.appendChild(document.createTextNode(node.getAttribute(attr[0].value) || '')); 46045 } 46046 } 46047 else if (token.name === 'counter') { 46048 var _a = token.values.filter(nonFunctionArgSeparator), counter = _a[0], counterStyle = _a[1]; 46049 if (counter && isIdentToken(counter)) { 46050 var counterState = _this.counters.getCounterValue(counter.value); 46051 var counterType = counterStyle && isIdentToken(counterStyle) 46052 ? listStyleType.parse(counterStyle.value) 46053 : LIST_STYLE_TYPE.DECIMAL; 46054 anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false))); 46055 } 46056 } 46057 else if (token.name === 'counters') { 46058 var _b = token.values.filter(nonFunctionArgSeparator), counter = _b[0], delim = _b[1], counterStyle = _b[2]; 46059 if (counter && isIdentToken(counter)) { 46060 var counterStates = _this.counters.getCounterValues(counter.value); 46061 var counterType_1 = counterStyle && isIdentToken(counterStyle) 46062 ? listStyleType.parse(counterStyle.value) 46063 : LIST_STYLE_TYPE.DECIMAL; 46064 var separator = delim && delim.type === TokenType.STRING_TOKEN ? delim.value : ''; 46065 var text = counterStates 46066 .map(function (value) { return createCounterText(value, counterType_1, false); }) 46067 .join(separator); 46068 anonymousReplacedElement.appendChild(document.createTextNode(text)); 46069 } 46070 } 46071 } 46072 else if (token.type === TokenType.IDENT_TOKEN) { 46073 switch (token.value) { 46074 case 'open-quote': 46075 anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true))); 46076 break; 46077 case 'close-quote': 46078 anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, --_this.quoteDepth, false))); 46079 break; 46080 default: 46081 // safari doesn't parse string tokens correctly because of lack of quotes 46082 anonymousReplacedElement.appendChild(document.createTextNode(token.value)); 46083 } 46084 } 46085 }); 46086 anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER; 46087 var newClassName = pseudoElt === PseudoElementType.BEFORE 46088 ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE 46089 : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER; 46090 if (isSVGElementNode(clone)) { 46091 clone.className.baseValue += newClassName; 46092 } 46093 else { 46094 clone.className += newClassName; 46095 } 46096 return anonymousReplacedElement; 46097 }; 46098 DocumentCloner.destroy = function (container) { 46099 if (container.parentNode) { 46100 container.parentNode.removeChild(container); 46101 return true; 46102 } 46103 return false;
vendor: 15,958 bytes, lines 46104-46406
46104 }; 46105 return DocumentCloner; 46106 }()); 46107 var PseudoElementType; 46108 (function (PseudoElementType) { 46109 PseudoElementType[PseudoElementType["BEFORE"] = 0] = "BEFORE"; 46110 PseudoElementType[PseudoElementType["AFTER"] = 1] = "AFTER"; 46111 })(PseudoElementType || (PseudoElementType = {})); 46112 var createIFrameContainer = function (ownerDocument, bounds) { 46113 var cloneIframeContainer = ownerDocument.createElement('iframe'); 46114 cloneIframeContainer.className = 'html2canvas-container'; 46115 cloneIframeContainer.style.visibility = 'hidden'; 46116 cloneIframeContainer.style.position = 'fixed'; 46117 cloneIframeContainer.style.left = '-10000px'; 46118 cloneIframeContainer.style.top = '0px'; 46119 cloneIframeContainer.style.border = '0'; 46120 cloneIframeContainer.width = bounds.width.toString(); 46121 cloneIframeContainer.height = bounds.height.toString(); 46122 cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it 46123 cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true'); 46124 ownerDocument.body.appendChild(cloneIframeContainer); 46125 return cloneIframeContainer; 46126 }; 46127 var iframeLoader = function (iframe) { 46128 return new Promise(function (resolve, reject) { 46129 var cloneWindow = iframe.contentWindow; 46130 if (!cloneWindow) { 46131 return reject("No window assigned for iframe"); 46132 } 46133 var documentClone = cloneWindow.document; 46134 cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = function () { 46135 cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null; 46136 var interval = setInterval(function () { 46137 if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') { 46138 clearInterval(interval); 46139 resolve(iframe); 46140 } 46141 }, 50); 46142 }; 46143 }); 46144 }; 46145 var copyCSSStyles = function (style, target) { 46146 // Edge does not provide value for cssText 46147 for (var i = style.length - 1; i >= 0; i--) { 46148 var property = style.item(i); 46149 // Safari shows pseudoelements if content is set 46150 if (property !== 'content') { 46151 target.style.setProperty(property, style.getPropertyValue(property)); 46152 } 46153 } 46154 return target; 46155 }; 46156 var serializeDoctype = function (doctype) { 46157 var str = ''; 46158 if (doctype) { 46159 str += '<!DOCTYPE '; 46160 if (doctype.name) { 46161 str += doctype.name; 46162 } 46163 if (doctype.internalSubset) { 46164 str += doctype.internalSubset; 46165 } 46166 if (doctype.publicId) { 46167 str += "\"" + doctype.publicId + "\""; 46168 } 46169 if (doctype.systemId) { 46170 str += "\"" + doctype.systemId + "\""; 46171 } 46172 str += '>'; 46173 } 46174 return str; 46175 }; 46176 var restoreOwnerScroll = function (ownerDocument, x, y) { 46177 if (ownerDocument && 46178 ownerDocument.defaultView && 46179 (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) { 46180 ownerDocument.defaultView.scrollTo(x, y); 46181 } 46182 }; 46183 var restoreNodeScroll = function (_a) { 46184 var element = _a[0], x = _a[1], y = _a[2]; 46185 element.scrollLeft = x; 46186 element.scrollTop = y; 46187 }; 46188 var PSEUDO_BEFORE = ':before'; 46189 var PSEUDO_AFTER = ':after'; 46190 var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = '___html2canvas___pseudoelement_before'; 46191 var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after'; 46192 var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}"; 46193 var createPseudoHideStyles = function (body) { 46194 createStyles(body, "." + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + "\n ." + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE); 46195 }; 46196 var createStyles = function (body, styles) { 46197 var document = body.ownerDocument; 46198 if (document) { 46199 var style = document.createElement('style'); 46200 style.textContent = styles; 46201 body.appendChild(style); 46202 } 46203 }; 46204 46205 var PathType; 46206 (function (PathType) { 46207 PathType[PathType["VECTOR"] = 0] = "VECTOR"; 46208 PathType[PathType["BEZIER_CURVE"] = 1] = "BEZIER_CURVE"; 46209 })(PathType || (PathType = {})); 46210 var equalPath = function (a, b) { 46211 if (a.length === b.length) { 46212 return a.some(function (v, i) { return v === b[i]; }); 46213 } 46214 return false; 46215 }; 46216 var transformPath = function (path, deltaX, deltaY, deltaW, deltaH) { 46217 return path.map(function (point, index) { 46218 switch (index) { 46219 case 0: 46220 return point.add(deltaX, deltaY); 46221 case 1: 46222 return point.add(deltaX + deltaW, deltaY); 46223 case 2: 46224 return point.add(deltaX + deltaW, deltaY + deltaH); 46225 case 3: 46226 return point.add(deltaX, deltaY + deltaH); 46227 } 46228 return point; 46229 }); 46230 }; 46231 46232 var Vector = /** @class */ (function () { 46233 function Vector(x, y) { 46234 this.type = PathType.VECTOR; 46235 this.x = x; 46236 this.y = y; 46237 } 46238 Vector.prototype.add = function (deltaX, deltaY) { 46239 return new Vector(this.x + deltaX, this.y + deltaY); 46240 }; 46241 return Vector; 46242 }()); 46243 46244 var lerp = function (a, b, t) { 46245 return new Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); 46246 }; 46247 var BezierCurve = /** @class */ (function () { 46248 function BezierCurve(start, startControl, endControl, end) { 46249 this.type = PathType.BEZIER_CURVE; 46250 this.start = start; 46251 this.startControl = startControl; 46252 this.endControl = endControl; 46253 this.end = end; 46254 } 46255 BezierCurve.prototype.subdivide = function (t, firstHalf) { 46256 var ab = lerp(this.start, this.startControl, t); 46257 var bc = lerp(this.startControl, this.endControl, t); 46258 var cd = lerp(this.endControl, this.end, t); 46259 var abbc = lerp(ab, bc, t); 46260 var bccd = lerp(bc, cd, t); 46261 var dest = lerp(abbc, bccd, t); 46262 return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end); 46263 }; 46264 BezierCurve.prototype.add = function (deltaX, deltaY) { 46265 return new BezierCurve(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY)); 46266 }; 46267 BezierCurve.prototype.reverse = function () { 46268 return new BezierCurve(this.end, this.endControl, this.startControl, this.start); 46269 }; 46270 return BezierCurve; 46271 }()); 46272 var isBezierCurve = function (path) { return path.type === PathType.BEZIER_CURVE; }; 46273 46274 var BoundCurves = /** @class */ (function () { 46275 function BoundCurves(element) { 46276 var styles = element.styles; 46277 var bounds = element.bounds; 46278 var _a = getAbsoluteValueForTuple(styles.borderTopLeftRadius, bounds.width, bounds.height), tlh = _a[0], tlv = _a[1]; 46279 var _b = getAbsoluteValueForTuple(styles.borderTopRightRadius, bounds.width, bounds.height), trh = _b[0], trv = _b[1]; 46280 var _c = getAbsoluteValueForTuple(styles.borderBottomRightRadius, bounds.width, bounds.height), brh = _c[0], brv = _c[1]; 46281 var _d = getAbsoluteValueForTuple(styles.borderBottomLeftRadius, bounds.width, bounds.height), blh = _d[0], blv = _d[1]; 46282 var factors = []; 46283 factors.push((tlh + trh) / bounds.width); 46284 factors.push((blh + brh) / bounds.width); 46285 factors.push((tlv + blv) / bounds.height); 46286 factors.push((trv + brv) / bounds.height); 46287 var maxFactor = Math.max.apply(Math, factors); 46288 if (maxFactor > 1) { 46289 tlh /= maxFactor; 46290 tlv /= maxFactor; 46291 trh /= maxFactor; 46292 trv /= maxFactor; 46293 brh /= maxFactor; 46294 brv /= maxFactor; 46295 blh /= maxFactor; 46296 blv /= maxFactor; 46297 } 46298 var topWidth = bounds.width - trh; 46299 var rightHeight = bounds.height - brv; 46300 var bottomWidth = bounds.width - brh; 46301 var leftHeight = bounds.height - blv; 46302 var borderTopWidth = styles.borderTopWidth; 46303 var borderRightWidth = styles.borderRightWidth; 46304 var borderBottomWidth = styles.borderBottomWidth; 46305 var borderLeftWidth = styles.borderLeftWidth; 46306 var paddingTop = getAbsoluteValue(styles.paddingTop, element.bounds.width); 46307 var paddingRight = getAbsoluteValue(styles.paddingRight, element.bounds.width); 46308 var paddingBottom = getAbsoluteValue(styles.paddingBottom, element.bounds.width); 46309 var paddingLeft = getAbsoluteValue(styles.paddingLeft, element.bounds.width); 46310 this.topLeftBorderBox = 46311 tlh > 0 || tlv > 0 46312 ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) 46313 : new Vector(bounds.left, bounds.top); 46314 this.topRightBorderBox = 46315 trh > 0 || trv > 0 46316 ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) 46317 : new Vector(bounds.left + bounds.width, bounds.top); 46318 this.bottomRightBorderBox = 46319 brh > 0 || brv > 0 46320 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) 46321 : new Vector(bounds.left + bounds.width, bounds.top + bounds.height); 46322 this.bottomLeftBorderBox = 46323 blh > 0 || blv > 0 46324 ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) 46325 : new Vector(bounds.left, bounds.top + bounds.height); 46326 this.topLeftPaddingBox = 46327 tlh > 0 || tlv > 0 46328 ? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + borderTopWidth, Math.max(0, tlh - borderLeftWidth), Math.max(0, tlv - borderTopWidth), CORNER.TOP_LEFT) 46329 : new Vector(bounds.left + borderLeftWidth, bounds.top + borderTopWidth); 46330 this.topRightPaddingBox = 46331 trh > 0 || trv > 0 46332 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth), bounds.top + borderTopWidth, topWidth > bounds.width + borderLeftWidth ? 0 : trh - borderLeftWidth, trv - borderTopWidth, CORNER.TOP_RIGHT) 46333 : new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + borderTopWidth); 46334 this.bottomRightPaddingBox = 46335 brh > 0 || brv > 0 46336 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borderLeftWidth), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth), Math.max(0, brh - borderRightWidth), brv - borderBottomWidth, CORNER.BOTTOM_RIGHT) 46337 : new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + bounds.height - borderBottomWidth); 46338 this.bottomLeftPaddingBox = 46339 blh > 0 || blv > 0 46340 ? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + leftHeight, Math.max(0, blh - borderLeftWidth), blv - borderBottomWidth, CORNER.BOTTOM_LEFT) 46341 : new Vector(bounds.left + borderLeftWidth, bounds.top + bounds.height - borderBottomWidth); 46342 this.topLeftContentBox = 46343 tlh > 0 || tlv > 0 46344 ? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop, Math.max(0, tlh - (borderLeftWidth + paddingLeft)), Math.max(0, tlv - (borderTopWidth + paddingTop)), CORNER.TOP_LEFT) 46345 : new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop); 46346 this.topRightContentBox = 46347 trh > 0 || trv > 0 46348 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth + paddingLeft), bounds.top + borderTopWidth + paddingTop, topWidth > bounds.width + borderLeftWidth + paddingLeft ? 0 : trh - borderLeftWidth + paddingLeft, trv - (borderTopWidth + paddingTop), CORNER.TOP_RIGHT) 46349 : new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + borderTopWidth + paddingTop); 46350 this.bottomRightContentBox = 46351 brh > 0 || brv > 0 46352 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - (borderLeftWidth + paddingLeft)), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth + paddingTop), Math.max(0, brh - (borderRightWidth + paddingRight)), brv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_RIGHT) 46353 : new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + bounds.height - (borderBottomWidth + paddingBottom)); 46354 this.bottomLeftContentBox = 46355 blh > 0 || blv > 0 46356 ? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + leftHeight, Math.max(0, blh - (borderLeftWidth + paddingLeft)), blv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_LEFT) 46357 : new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + bounds.height - (borderBottomWidth + paddingBottom)); 46358 } 46359 return BoundCurves; 46360 }()); 46361 var CORNER; 46362 (function (CORNER) { 46363 CORNER[CORNER["TOP_LEFT"] = 0] = "TOP_LEFT"; 46364 CORNER[CORNER["TOP_RIGHT"] = 1] = "TOP_RIGHT"; 46365 CORNER[CORNER["BOTTOM_RIGHT"] = 2] = "BOTTOM_RIGHT"; 46366 CORNER[CORNER["BOTTOM_LEFT"] = 3] = "BOTTOM_LEFT"; 46367 })(CORNER || (CORNER = {})); 46368 var getCurvePoints = function (x, y, r1, r2, position) { 46369 var kappa = 4 * ((Math.sqrt(2) - 1) / 3); 46370 var ox = r1 * kappa; // control point offset horizontal 46371 var oy = r2 * kappa; // control point offset vertical 46372 var xm = x + r1; // x-middle 46373 var ym = y + r2; // y-middle 46374 switch (position) { 46375 case CORNER.TOP_LEFT: 46376 return new BezierCurve(new Vector(x, ym), new Vector(x, ym - oy), new Vector(xm - ox, y), new Vector(xm, y)); 46377 case CORNER.TOP_RIGHT: 46378 return new BezierCurve(new Vector(x, y), new Vector(x + ox, y), new Vector(xm, ym - oy), new Vector(xm, ym)); 46379 case CORNER.BOTTOM_RIGHT: 46380 return new BezierCurve(new Vector(xm, y), new Vector(xm, y + oy), new Vector(x + ox, ym), new Vector(x, ym)); 46381 case CORNER.BOTTOM_LEFT: 46382 default: 46383 return new BezierCurve(new Vector(xm, ym), new Vector(xm - ox, ym), new Vector(x, y + oy), new Vector(x, y)); 46384 } 46385 }; 46386 var calculateBorderBoxPath = function (curves) { 46387 return [curves.topLeftBorderBox, curves.topRightBorderBox, curves.bottomRightBorderBox, curves.bottomLeftBorderBox]; 46388 }; 46389 var calculateContentBoxPath = function (curves) { 46390 return [ 46391 curves.topLeftContentBox, 46392 curves.topRightContentBox, 46393 curves.bottomRightContentBox, 46394 curves.bottomLeftContentBox 46395 ]; 46396 }; 46397 var calculatePaddingBoxPath = function (curves) { 46398 return [ 46399 curves.topLeftPaddingBox, 46400 curves.topRightPaddingBox, 46401 curves.bottomRightPaddingBox, 46402 curves.bottomLeftPaddingBox 46403 ]; 46404 }; 46405 46406 var TransformEffect = /** @class */ (function () {
46407 function TransformEffect(offsetX, offsetY, matrix) { 46408 this.type = 0 /* TRANSFORM */; 46409 this.offsetX = offsetX; 46410 this.offsetY = offsetY; 46411 this.matrix = matrix; 46412 this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */; 46413 } 46414 return TransformEffect; 46415 }()); 46416 var ClipEffect = /** @class */ (function () { 46417 function ClipEffect(path, target) { 46418 this.type = 1 /* CLIP */; 46419 this.target = target; 46420 this.path = path; 46421 } 46422 return ClipEffect; 46423 }()); 46424 var isTransformEffect = function (effect) { 46425 return effect.type === 0 /* TRANSFORM */; 46426 }; 46427 var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; }; 46428 46429 var StackingContext = /** @class */ (function () { 46430 function StackingContext(container) { 46431 this.element = container; 46432 this.inlineLevel = []; 46433 this.nonInlineLevel = []; 46434 this.negativeZIndex = []; 46435 this.zeroOrAutoZIndexOrTransformedOrOpacity = []; 46436 this.positiveZIndex = []; 46437 this.nonPositionedFloats = []; 46438 this.nonPositionedInlineLevel = []; 46439 } 46440 return StackingContext; 46441 }()); 46442 var ElementPaint = /** @class */ (function () { 46443 function ElementPaint(element, parentStack) { 46444 this.container = element; 46445 this.effects = parentStack.slice(0); 46446 this.curves = new BoundCurves(element); 46447 if (element.styles.transform !== null) { 46448 var offsetX = element.bounds.left + element.styles.transformOrigin[0].number; 46449 var offsetY = element.bounds.top + element.styles.transformOrigin[1].number; 46450 var matrix = element.styles.transform; 46451 this.effects.push(new TransformEffect(offsetX, offsetY, matrix)); 46452 } 46453 if (element.styles.overflowX !== OVERFLOW.VISIBLE) { 46454 var borderBox = calculateBorderBoxPath(this.curves); 46455 var paddingBox = calculatePaddingBoxPath(this.curves); 46456 if (equalPath(borderBox, paddingBox)) { 46457 this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */)); 46458 } 46459 else { 46460 this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */)); 46461 this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */)); 46462 } 46463 } 46464 } 46465 ElementPaint.prototype.getParentEffects = function () { 46466 var effects = this.effects.slice(0); 46467 if (this.container.styles.overflowX !== OVERFLOW.VISIBLE) { 46468 var borderBox = calculateBorderBoxPath(this.curves); 46469 var paddingBox = calculatePaddingBoxPath(this.curves); 46470 if (!equalPath(borderBox, paddingBox)) { 46471 effects.push(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */)); 46472 } 46473 } 46474 return effects; 46475 }; 46476 return ElementPaint; 46477 }()); 46478 var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) { 46479 parent.container.elements.forEach(function (child) { 46480 var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */); 46481 var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */); 46482 var paintContainer = new ElementPaint(child, parent.getParentEffects()); 46483 if (contains(child.styles.display, 2048 /* LIST_ITEM */)) { 46484 listItems.push(paintContainer); 46485 } 46486 var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems; 46487 if (treatAsRealStackingContext || createsStackingContext) { 46488 var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext; 46489 var stack = new StackingContext(paintContainer); 46490 if (child.styles.isPositioned() || child.styles.opacity < 1 || child.styles.isTransformed()) { 46491 var order_1 = child.styles.zIndex.order; 46492 if (order_1 < 0) { 46493 var index_1 = 0; 46494 parentStack.negativeZIndex.some(function (current, i) { 46495 if (order_1 > current.element.container.styles.zIndex.order) { 46496 index_1 = i; 46497 return false;
vendor: 13,287 bytes, lines 46498-46754
46498 } 46499 else if (index_1 > 0) { 46500 return true; 46501 } 46502 return false; 46503 }); 46504 parentStack.negativeZIndex.splice(index_1, 0, stack); 46505 } 46506 else if (order_1 > 0) { 46507 var index_2 = 0; 46508 parentStack.positiveZIndex.some(function (current, i) { 46509 if (order_1 >= current.element.container.styles.zIndex.order) { 46510 index_2 = i + 1; 46511 return false; 46512 } 46513 else if (index_2 > 0) { 46514 return true; 46515 } 46516 return false; 46517 }); 46518 parentStack.positiveZIndex.splice(index_2, 0, stack); 46519 } 46520 else { 46521 parentStack.zeroOrAutoZIndexOrTransformedOrOpacity.push(stack); 46522 } 46523 } 46524 else { 46525 if (child.styles.isFloating()) { 46526 parentStack.nonPositionedFloats.push(stack); 46527 } 46528 else { 46529 parentStack.nonPositionedInlineLevel.push(stack); 46530 } 46531 } 46532 parseStackTree(paintContainer, stack, treatAsRealStackingContext ? stack : realStackingContext, listOwnerItems); 46533 } 46534 else { 46535 if (child.styles.isInlineLevel()) { 46536 stackingContext.inlineLevel.push(paintContainer); 46537 } 46538 else { 46539 stackingContext.nonInlineLevel.push(paintContainer); 46540 } 46541 parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems); 46542 } 46543 if (contains(child.flags, 8 /* IS_LIST_OWNER */)) { 46544 processListItems(child, listOwnerItems); 46545 } 46546 }); 46547 }; 46548 var processListItems = function (owner, elements) { 46549 var numbering = owner instanceof OLElementContainer ? owner.start : 1; 46550 var reversed = owner instanceof OLElementContainer ? owner.reversed : false; 46551 for (var i = 0; i < elements.length; i++) { 46552 var item = elements[i]; 46553 if (item.container instanceof LIElementContainer && 46554 typeof item.container.value === 'number' && 46555 item.container.value !== 0) { 46556 numbering = item.container.value; 46557 } 46558 item.listValue = createCounterText(numbering, item.container.styles.listStyleType, true); 46559 numbering += reversed ? -1 : 1; 46560 } 46561 }; 46562 var parseStackingContexts = function (container) { 46563 var paintContainer = new ElementPaint(container, []); 46564 var root = new StackingContext(paintContainer); 46565 var listItems = []; 46566 parseStackTree(paintContainer, root, root, listItems); 46567 processListItems(paintContainer.container, listItems); 46568 return root; 46569 }; 46570 46571 var parsePathForBorder = function (curves, borderSide) { 46572 switch (borderSide) { 46573 case 0: 46574 return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox); 46575 case 1: 46576 return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox); 46577 case 2: 46578 return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox); 46579 case 3: 46580 default: 46581 return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox); 46582 } 46583 }; 46584 var createPathFromCurves = function (outer1, inner1, outer2, inner2) { 46585 var path = []; 46586 if (isBezierCurve(outer1)) { 46587 path.push(outer1.subdivide(0.5, false)); 46588 } 46589 else { 46590 path.push(outer1); 46591 } 46592 if (isBezierCurve(outer2)) { 46593 path.push(outer2.subdivide(0.5, true)); 46594 } 46595 else { 46596 path.push(outer2); 46597 } 46598 if (isBezierCurve(inner2)) { 46599 path.push(inner2.subdivide(0.5, true).reverse()); 46600 } 46601 else { 46602 path.push(inner2); 46603 } 46604 if (isBezierCurve(inner1)) { 46605 path.push(inner1.subdivide(0.5, false).reverse()); 46606 } 46607 else { 46608 path.push(inner1); 46609 } 46610 return path; 46611 }; 46612 46613 var paddingBox = function (element) { 46614 var bounds = element.bounds; 46615 var styles = element.styles; 46616 return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth)); 46617 }; 46618 var contentBox = function (element) { 46619 var styles = element.styles; 46620 var bounds = element.bounds; 46621 var paddingLeft = getAbsoluteValue(styles.paddingLeft, bounds.width); 46622 var paddingRight = getAbsoluteValue(styles.paddingRight, bounds.width); 46623 var paddingTop = getAbsoluteValue(styles.paddingTop, bounds.width); 46624 var paddingBottom = getAbsoluteValue(styles.paddingBottom, bounds.width); 46625 return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom)); 46626 }; 46627 46628 var calculateBackgroundPositioningArea = function (backgroundOrigin, element) { 46629 if (backgroundOrigin === 0 /* BORDER_BOX */) { 46630 return element.bounds; 46631 } 46632 if (backgroundOrigin === 2 /* CONTENT_BOX */) { 46633 return contentBox(element); 46634 } 46635 return paddingBox(element); 46636 }; 46637 var calculateBackgroundPaintingArea = function (backgroundClip, element) { 46638 if (backgroundClip === BACKGROUND_CLIP.BORDER_BOX) { 46639 return element.bounds; 46640 } 46641 if (backgroundClip === BACKGROUND_CLIP.CONTENT_BOX) { 46642 return contentBox(element); 46643 } 46644 return paddingBox(element); 46645 }; 46646 var calculateBackgroundRendering = function (container, index, intrinsicSize) { 46647 var backgroundPositioningArea = calculateBackgroundPositioningArea(getBackgroundValueForIndex(container.styles.backgroundOrigin, index), container); 46648 var backgroundPaintingArea = calculateBackgroundPaintingArea(getBackgroundValueForIndex(container.styles.backgroundClip, index), container); 46649 var backgroundImageSize = calculateBackgroundSize(getBackgroundValueForIndex(container.styles.backgroundSize, index), intrinsicSize, backgroundPositioningArea); 46650 var sizeWidth = backgroundImageSize[0], sizeHeight = backgroundImageSize[1]; 46651 var position = getAbsoluteValueForTuple(getBackgroundValueForIndex(container.styles.backgroundPosition, index), backgroundPositioningArea.width - sizeWidth, backgroundPositioningArea.height - sizeHeight); 46652 var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea); 46653 var offsetX = Math.round(backgroundPositioningArea.left + position[0]); 46654 var offsetY = Math.round(backgroundPositioningArea.top + position[1]); 46655 return [path, offsetX, offsetY, sizeWidth, sizeHeight]; 46656 }; 46657 var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; }; 46658 var hasIntrinsicValue = function (value) { return typeof value === 'number'; }; 46659 var calculateBackgroundSize = function (size, _a, bounds) { 46660 var intrinsicWidth = _a[0], intrinsicHeight = _a[1], intrinsicProportion = _a[2]; 46661 var first = size[0], second = size[1]; 46662 if (isLengthPercentage(first) && second && isLengthPercentage(second)) { 46663 return [getAbsoluteValue(first, bounds.width), getAbsoluteValue(second, bounds.height)]; 46664 } 46665 var hasIntrinsicProportion = hasIntrinsicValue(intrinsicProportion); 46666 if (isIdentToken(first) && (first.value === BACKGROUND_SIZE.CONTAIN || first.value === BACKGROUND_SIZE.COVER)) { 46667 if (hasIntrinsicValue(intrinsicProportion)) { 46668 var targetRatio = bounds.width / bounds.height; 46669 return targetRatio < intrinsicProportion !== (first.value === BACKGROUND_SIZE.COVER) 46670 ? [bounds.width, bounds.width / intrinsicProportion] 46671 : [bounds.height * intrinsicProportion, bounds.height]; 46672 } 46673 return [bounds.width, bounds.height]; 46674 } 46675 var hasIntrinsicWidth = hasIntrinsicValue(intrinsicWidth); 46676 var hasIntrinsicHeight = hasIntrinsicValue(intrinsicHeight); 46677 var hasIntrinsicDimensions = hasIntrinsicWidth || hasIntrinsicHeight; 46678 // If the background-size is auto or auto auto: 46679 if (isAuto(first) && (!second || isAuto(second))) { 46680 // If the image has both horizontal and vertical intrinsic dimensions, it's rendered at that size. 46681 if (hasIntrinsicWidth && hasIntrinsicHeight) { 46682 return [intrinsicWidth, intrinsicHeight]; 46683 } 46684 // If the image has no intrinsic dimensions and has no intrinsic proportions, 46685 // it's rendered at the size of the background positioning area. 46686 if (!hasIntrinsicProportion && !hasIntrinsicDimensions) { 46687 return [bounds.width, bounds.height]; 46688 } 46689 // TODO If the image has no intrinsic dimensions but has intrinsic proportions, it's rendered as if contain had been specified instead. 46690 // If the image has only one intrinsic dimension and has intrinsic proportions, it's rendered at the size corresponding to that one dimension. 46691 // The other dimension is computed using the specified dimension and the intrinsic proportions. 46692 if (hasIntrinsicDimensions && hasIntrinsicProportion) { 46693 var width_1 = hasIntrinsicWidth 46694 ? intrinsicWidth 46695 : intrinsicHeight * intrinsicProportion; 46696 var height_1 = hasIntrinsicHeight 46697 ? intrinsicHeight 46698 : intrinsicWidth / intrinsicProportion; 46699 return [width_1, height_1]; 46700 } 46701 // If the image has only one intrinsic dimension but has no intrinsic proportions, 46702 // it's rendered using the specified dimension and the other dimension of the background positioning area. 46703 var width_2 = hasIntrinsicWidth ? intrinsicWidth : bounds.width; 46704 var height_2 = hasIntrinsicHeight ? intrinsicHeight : bounds.height; 46705 return [width_2, height_2]; 46706 } 46707 // If the image has intrinsic proportions, it's stretched to the specified dimension. 46708 // The unspecified dimension is computed using the specified dimension and the intrinsic proportions. 46709 if (hasIntrinsicProportion) { 46710 var width_3 = 0; 46711 var height_3 = 0; 46712 if (isLengthPercentage(first)) { 46713 width_3 = getAbsoluteValue(first, bounds.width); 46714 } 46715 else if (isLengthPercentage(second)) { 46716 height_3 = getAbsoluteValue(second, bounds.height); 46717 } 46718 if (isAuto(first)) { 46719 width_3 = height_3 * intrinsicProportion; 46720 } 46721 else if (!second || isAuto(second)) { 46722 height_3 = width_3 / intrinsicProportion; 46723 } 46724 return [width_3, height_3]; 46725 } 46726 // If the image has no intrinsic proportions, it's stretched to the specified dimension. 46727 // The unspecified dimension is computed using the image's corresponding intrinsic dimension, 46728 // if there is one. If there is no such intrinsic dimension, 46729 // it becomes the corresponding dimension of the background positioning area. 46730 var width = null; 46731 var height = null; 46732 if (isLengthPercentage(first)) { 46733 width = getAbsoluteValue(first, bounds.width); 46734 } 46735 else if (second && isLengthPercentage(second)) { 46736 height = getAbsoluteValue(second, bounds.height); 46737 } 46738 if (width !== null && (!second || isAuto(second))) { 46739 height = 46740 hasIntrinsicWidth && hasIntrinsicHeight 46741 ? (width / intrinsicWidth) * intrinsicHeight 46742 : bounds.height; 46743 } 46744 if (height !== null && isAuto(first)) { 46745 width = 46746 hasIntrinsicWidth && hasIntrinsicHeight 46747 ? (height / intrinsicHeight) * intrinsicWidth 46748 : bounds.width; 46749 } 46750 if (width !== null && height !== null) { 46751 return [width, height]; 46752 } 46753 throw new Error("Unable to calculate background-size for element"); 46754 };
46755 var getBackgroundValueForIndex = function (values, index) { 46756 var value = values[index]; 46757 if (typeof value === 'undefined') { 46758 return values[0]; 46759 } 46760 return value; 46761 }; 46762 var calculateBackgroundRepeatPath = function (repeat, _a, _b, backgroundPositioningArea, backgroundPaintingArea) { 46763 var x = _a[0], y = _a[1]; 46764 var width = _b[0], height = _b[1]; 46765 switch (repeat) { 46766 case BACKGROUND_REPEAT.REPEAT_X: 46767 return [ 46768 new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)), 46769 new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)), 46770 new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)), 46771 new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y)) 46772 ]; 46773 case BACKGROUND_REPEAT.REPEAT_Y: 46774 return [ 46775 new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)), 46776 new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)), 46777 new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)), 46778 new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)) 46779 ]; 46780 case BACKGROUND_REPEAT.NO_REPEAT: 46781 return [ 46782 new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)), 46783 new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)), 46784 new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y + height)), 46785 new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y + height)) 46786 ]; 46787 default: 46788 return [ 46789 new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.top)), 46790 new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.top)), 46791 new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)), 46792 new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)) 46793 ]; 46794 } 46795 }; 46796 46797 var SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; 46798 46799 var SAMPLE_TEXT = 'Hidden Text'; 46800 var FontMetrics = /** @class */ (function () { 46801 function FontMetrics(document) { 46802 this._data = {}; 46803 this._document = document; 46804 } 46805 FontMetrics.prototype.parseMetrics = function (fontFamily, fontSize) { 46806 var container = this._document.createElement('div'); 46807 var img = this._document.createElement('img'); 46808 var span = this._document.createElement('span'); 46809 var body = this._document.body; 46810 container.style.visibility = 'hidden'; 46811 container.style.fontFamily = fontFamily; 46812 container.style.fontSize = fontSize; 46813 container.style.margin = '0'; 46814 container.style.padding = '0'; 46815 body.appendChild(container); 46816 img.src = SMALL_IMAGE; 46817 img.width = 1; 46818 img.height = 1; 46819 img.style.margin = '0'; 46820 img.style.padding = '0'; 46821 img.style.verticalAlign = 'baseline'; 46822 span.style.fontFamily = fontFamily; 46823 span.style.fontSize = fontSize; 46824 span.style.margin = '0'; 46825 span.style.padding = '0'; 46826 span.appendChild(this._document.createTextNode(SAMPLE_TEXT)); 46827 container.appendChild(span); 46828 container.appendChild(img); 46829 var baseline = img.offsetTop - span.offsetTop + 2; 46830 container.removeChild(span); 46831 container.appendChild(this._document.createTextNode(SAMPLE_TEXT)); 46832 container.style.lineHeight = 'normal'; 46833 img.style.verticalAlign = 'super'; 46834 var middle = img.offsetTop - container.offsetTop + 2; 46835 body.removeChild(container); 46836 return { baseline: baseline, middle: middle }; 46837 }; 46838 FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) { 46839 var key = fontFamily + " " + fontSize; 46840 if (typeof this._data[key] === 'undefined') { 46841 this._data[key] = this.parseMetrics(fontFamily, fontSize); 46842 } 46843 return this._data[key]; 46844 }; 46845 return FontMetrics; 46846 }()); 46847 46848 var MASK_OFFSET = 10000; 46849 var CanvasRenderer = /** @class */ (function () { 46850 function CanvasRenderer(options) { 46851 this._activeEffects = []; 46852 this.canvas = options.canvas ? options.canvas : document.createElement('canvas'); 46853 this.ctx = this.canvas.getContext('2d'); 46854 this.options = options; 46855 if (!options.canvas) { 46856 this.canvas.width = Math.floor(options.width * options.scale); 46857 this.canvas.height = Math.floor(options.height * options.scale); 46858 this.canvas.style.width = options.width + "px"; 46859 this.canvas.style.height = options.height + "px"; 46860 } 46861 this.fontMetrics = new FontMetrics(document); 46862 this.ctx.scale(this.options.scale, this.options.scale); 46863 this.ctx.translate(-options.x + options.scrollX, -options.y + options.scrollY); 46864 this.ctx.textBaseline = 'bottom'; 46865 this._activeEffects = []; 46866 Logger.getInstance(options.id).debug("Canvas renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale); 46867 } 46868 CanvasRenderer.prototype.applyEffects = function (effects, target) { 46869 var _this = this; 46870 while (this._activeEffects.length) { 46871 this.popEffect(); 46872 } 46873 effects.filter(function (effect) { return contains(effect.target, target); }
vendor: 40,582 bytes, lines 46873-47541
46873).forEach(function (effect) { return _this.applyEffect(effect); }); 46874 }; 46875 CanvasRenderer.prototype.applyEffect = function (effect) { 46876 this.ctx.save(); 46877 if (isTransformEffect(effect)) { 46878 this.ctx.translate(effect.offsetX, effect.offsetY); 46879 this.ctx.transform(effect.matrix[0], effect.matrix[1], effect.matrix[2], effect.matrix[3], effect.matrix[4], effect.matrix[5]); 46880 this.ctx.translate(-effect.offsetX, -effect.offsetY); 46881 } 46882 if (isClipEffect(effect)) { 46883 this.path(effect.path); 46884 this.ctx.clip(); 46885 } 46886 this._activeEffects.push(effect); 46887 }; 46888 CanvasRenderer.prototype.popEffect = function () { 46889 this._activeEffects.pop(); 46890 this.ctx.restore(); 46891 }; 46892 CanvasRenderer.prototype.renderStack = function (stack) { 46893 return __awaiter(this, void 0, void 0, function () { 46894 var styles; 46895 return __generator(this, function (_a) { 46896 switch (_a.label) { 46897 case 0: 46898 styles = stack.element.container.styles; 46899 if (!styles.isVisible()) return [3 /*break*/, 2]; 46900 this.ctx.globalAlpha = styles.opacity; 46901 return [4 /*yield*/, this.renderStackContent(stack)]; 46902 case 1: 46903 _a.sent(); 46904 _a.label = 2; 46905 case 2: return [2 /*return*/]; 46906 } 46907 }); 46908 }); 46909 }; 46910 CanvasRenderer.prototype.renderNode = function (paint) { 46911 return __awaiter(this, void 0, void 0, function () { 46912 return __generator(this, function (_a) { 46913 switch (_a.label) { 46914 case 0: 46915 if (!paint.container.styles.isVisible()) return [3 /*break*/, 3]; 46916 return [4 /*yield*/, this.renderNodeBackgroundAndBorders(paint)]; 46917 case 1: 46918 _a.sent(); 46919 return [4 /*yield*/, this.renderNodeContent(paint)]; 46920 case 2: 46921 _a.sent(); 46922 _a.label = 3; 46923 case 3: return [2 /*return*/]; 46924 } 46925 }); 46926 }); 46927 }; 46928 CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing) { 46929 var _this = this; 46930 if (letterSpacing === 0) { 46931 this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height); 46932 } 46933 else { 46934 var letters = toCodePoints(text.text).map(function (i) { return fromCodePoint(i); }); 46935 letters.reduce(function (left, letter) { 46936 _this.ctx.fillText(letter, left, text.bounds.top + text.bounds.height); 46937 return left + _this.ctx.measureText(letter).width; 46938 }, text.bounds.left); 46939 } 46940 }; 46941 CanvasRenderer.prototype.createFontStyle = function (styles) { 46942 var fontVariant = styles.fontVariant 46943 .filter(function (variant) { return variant === 'normal' || variant === 'small-caps'; }) 46944 .join(''); 46945 var fontFamily = styles.fontFamily.join(', '); 46946 var fontSize = isDimensionToken(styles.fontSize) 46947 ? "" + styles.fontSize.number + styles.fontSize.unit 46948 : styles.fontSize.number + "px"; 46949 return [ 46950 [styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '), 46951 fontFamily, 46952 fontSize 46953 ]; 46954 }; 46955 CanvasRenderer.prototype.renderTextNode = function (text, styles) { 46956 return __awaiter(this, void 0, void 0, function () { 46957 var _a, font, fontFamily, fontSize; 46958 var _this = this; 46959 return __generator(this, function (_b) { 46960 _a = this.createFontStyle(styles), font = _a[0], fontFamily = _a[1], fontSize = _a[2]; 46961 this.ctx.font = font; 46962 text.textBounds.forEach(function (text) { 46963 _this.ctx.fillStyle = asString(styles.color); 46964 _this.renderTextWithLetterSpacing(text, styles.letterSpacing); 46965 var textShadows = styles.textShadow; 46966 if (textShadows.length && text.text.trim().length) { 46967 textShadows 46968 .slice(0) 46969 .reverse() 46970 .forEach(function (textShadow) { 46971 _this.ctx.shadowColor = asString(textShadow.color); 46972 _this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale; 46973 _this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale; 46974 _this.ctx.shadowBlur = textShadow.blur.number; 46975 _this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height); 46976 }); 46977 _this.ctx.shadowColor = ''; 46978 _this.ctx.shadowOffsetX = 0; 46979 _this.ctx.shadowOffsetY = 0; 46980 _this.ctx.shadowBlur = 0; 46981 } 46982 if (styles.textDecorationLine.length) { 46983 _this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color); 46984 styles.textDecorationLine.forEach(function (textDecorationLine) { 46985 switch (textDecorationLine) { 46986 case 1 /* UNDERLINE */: 46987 // Draws a line at the baseline of the font 46988 // TODO As some browsers display the line as more than 1px if the font-size is big, 46989 // need to take that into account both in position and size 46990 var baseline = _this.fontMetrics.getMetrics(fontFamily, fontSize).baseline; 46991 _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1); 46992 break; 46993 case 2 /* OVERLINE */: 46994 _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1); 46995 break; 46996 case 3 /* LINE_THROUGH */: 46997 // TODO try and find exact position for line-through 46998 var middle = _this.fontMetrics.getMetrics(fontFamily, fontSize).middle; 46999 _this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1); 47000 break; 47001 } 47002 }); 47003 } 47004 }); 47005 return [2 /*return*/]; 47006 }); 47007 }); 47008 }; 47009 CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) { 47010 if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) { 47011 var box = contentBox(container); 47012 var path = calculatePaddingBoxPath(curves); 47013 this.path(path); 47014 this.ctx.save(); 47015 this.ctx.clip(); 47016 this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height); 47017 this.ctx.restore(); 47018 } 47019 }; 47020 CanvasRenderer.prototype.renderNodeContent = function (paint) { 47021 return __awaiter(this, void 0, void 0, function () { 47022 var container, curves, styles, _i, _a, child, image, e_1, image, e_2, iframeRenderer, canvas, size, bounds, x, textBounds, img, image, url, e_3, bounds; 47023 return __generator(this, function (_b) { 47024 switch (_b.label) { 47025 case 0: 47026 this.applyEffects(paint.effects, 4 /* CONTENT */); 47027 container = paint.container; 47028 curves = paint.curves; 47029 styles = container.styles; 47030 _i = 0, _a = container.textNodes; 47031 _b.label = 1; 47032 case 1: 47033 if (!(_i < _a.length)) return [3 /*break*/, 4]; 47034 child = _a[_i]; 47035 return [4 /*yield*/, this.renderTextNode(child, styles)]; 47036 case 2: 47037 _b.sent(); 47038 _b.label = 3; 47039 case 3: 47040 _i++; 47041 return [3 /*break*/, 1]; 47042 case 4: 47043 if (!(container instanceof ImageElementContainer)) return [3 /*break*/, 8]; 47044 _b.label = 5; 47045 case 5: 47046 _b.trys.push([5, 7, , 8]); 47047 return [4 /*yield*/, this.options.cache.match(container.src)]; 47048 case 6: 47049 image = _b.sent(); 47050 this.renderReplacedElement(container, curves, image); 47051 return [3 /*break*/, 8]; 47052 case 7: 47053 e_1 = _b.sent(); 47054 Logger.getInstance(this.options.id).error("Error loading image " + container.src); 47055 return [3 /*break*/, 8]; 47056 case 8: 47057 if (container instanceof CanvasElementContainer) { 47058 this.renderReplacedElement(container, curves, container.canvas); 47059 } 47060 if (!(container instanceof SVGElementContainer)) return [3 /*break*/, 12]; 47061 _b.label = 9; 47062 case 9: 47063 _b.trys.push([9, 11, , 12]); 47064 return [4 /*yield*/, this.options.cache.match(container.svg)]; 47065 case 10: 47066 image = _b.sent(); 47067 this.renderReplacedElement(container, curves, image); 47068 return [3 /*break*/, 12]; 47069 case 11: 47070 e_2 = _b.sent(); 47071 Logger.getInstance(this.options.id).error("Error loading svg " + container.svg.substring(0, 255)); 47072 return [3 /*break*/, 12]; 47073 case 12: 47074 if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14]; 47075 iframeRenderer = new CanvasRenderer({ 47076 id: this.options.id, 47077 scale: this.options.scale, 47078 backgroundColor: container.backgroundColor, 47079 x: 0, 47080 y: 0, 47081 scrollX: 0, 47082 scrollY: 0, 47083 width: container.width, 47084 height: container.height, 47085 cache: this.options.cache, 47086 windowWidth: container.width, 47087 windowHeight: container.height 47088 }); 47089 return [4 /*yield*/, iframeRenderer.render(container.tree)]; 47090 case 13: 47091 canvas = _b.sent(); 47092 if (container.width && container.height) { 47093 this.ctx.drawImage(canvas, 0, 0, container.width, container.height, container.bounds.left, container.bounds.top, container.bounds.width, container.bounds.height); 47094 } 47095 _b.label = 14; 47096 case 14: 47097 if (container instanceof InputElementContainer) { 47098 size = Math.min(container.bounds.width, container.bounds.height); 47099 if (container.type === CHECKBOX) { 47100 if (container.checked) { 47101 this.ctx.save(); 47102 this.path([ 47103 new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79), 47104 new Vector(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549), 47105 new Vector(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071), 47106 new Vector(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649), 47107 new Vector(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23), 47108 new Vector(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085), 47109 new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79) 47110 ]); 47111 this.ctx.fillStyle = asString(INPUT_COLOR); 47112 this.ctx.fill(); 47113 this.ctx.restore(); 47114 } 47115 } 47116 else if (container.type === RADIO) { 47117 if (container.checked) { 47118 this.ctx.save(); 47119 this.ctx.beginPath(); 47120 this.ctx.arc(container.bounds.left + size / 2, container.bounds.top + size / 2, size / 4, 0, Math.PI * 2, true); 47121 this.ctx.fillStyle = asString(INPUT_COLOR); 47122 this.ctx.fill(); 47123 this.ctx.restore(); 47124 } 47125 } 47126 } 47127 if (isTextInputElement(container) && container.value.length) { 47128 this.ctx.font = this.createFontStyle(styles)[0]; 47129 this.ctx.fillStyle = asString(styles.color); 47130 this.ctx.textBaseline = 'middle'; 47131 this.ctx.textAlign = canvasTextAlign(container.styles.textAlign); 47132 bounds = contentBox(container); 47133 x = 0; 47134 switch (container.styles.textAlign) { 47135 case TEXT_ALIGN.CENTER: 47136 x += bounds.width / 2; 47137 break; 47138 case TEXT_ALIGN.RIGHT: 47139 x += bounds.width; 47140 break; 47141 } 47142 textBounds = bounds.add(x, 0, 0, -bounds.height / 2 + 1); 47143 this.ctx.save(); 47144 this.path([ 47145 new Vector(bounds.left, bounds.top), 47146 new Vector(bounds.left + bounds.width, bounds.top), 47147 new Vector(bounds.left + bounds.width, bounds.top + bounds.height), 47148 new Vector(bounds.left, bounds.top + bounds.height) 47149 ]); 47150 this.ctx.clip(); 47151 this.renderTextWithLetterSpacing(new TextBounds(container.value, textBounds), styles.letterSpacing); 47152 this.ctx.restore(); 47153 this.ctx.textBaseline = 'bottom'; 47154 this.ctx.textAlign = 'left'; 47155 } 47156 if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20]; 47157 if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19]; 47158 img = container.styles.listStyleImage; 47159 if (!(img.type === CSSImageType.URL)) return [3 /*break*/, 18]; 47160 image = void 0; 47161 url = img.url; 47162 _b.label = 15; 47163 case 15: 47164 _b.trys.push([15, 17, , 18]); 47165 return [4 /*yield*/, this.options.cache.match(url)]; 47166 case 16: 47167 image = _b.sent(); 47168 this.ctx.drawImage(image, container.bounds.left - (image.width + 10), container.bounds.top); 47169 return [3 /*break*/, 18]; 47170 case 17: 47171 e_3 = _b.sent(); 47172 Logger.getInstance(this.options.id).error("Error loading list-style-image " + url); 47173 return [3 /*break*/, 18]; 47174 case 18: return [3 /*break*/, 20]; 47175 case 19: 47176 if (paint.listValue && container.styles.listStyleType !== LIST_STYLE_TYPE.NONE) { 47177 this.ctx.font = this.createFontStyle(styles)[0]; 47178 this.ctx.fillStyle = asString(styles.color); 47179 this.ctx.textBaseline = 'middle'; 47180 this.ctx.textAlign = 'right'; 47181 bounds = new Bounds(container.bounds.left, container.bounds.top + getAbsoluteValue(container.styles.paddingTop, container.bounds.width), container.bounds.width, computeLineHeight(styles.lineHeight, styles.fontSize.number) / 2 + 1); 47182 this.renderTextWithLetterSpacing(new TextBounds(paint.listValue, bounds), styles.letterSpacing); 47183 this.ctx.textBaseline = 'bottom'; 47184 this.ctx.textAlign = 'left'; 47185 } 47186 _b.label = 20; 47187 case 20: return [2 /*return*/]; 47188 } 47189 }); 47190 }); 47191 }; 47192 CanvasRenderer.prototype.renderStackContent = function (stack) { 47193 return __awaiter(this, void 0, void 0, function () { 47194 var _i, _a, child, _b, _c, child, _d, _e, child, _f, _g, child, _h, _j, child, _k, _l, child, _m, _o, child; 47195 return __generator(this, function (_p) { 47196 switch (_p.label) { 47197 case 0: 47198 // https://www.w3.org/TR/css-position-3/#painting-order 47199 // 1. the background and borders of the element forming the stacking context. 47200 return [4 /*yield*/, this.renderNodeBackgroundAndBorders(stack.element)]; 47201 case 1: 47202 // https://www.w3.org/TR/css-position-3/#painting-order 47203 // 1. the background and borders of the element forming the stacking context. 47204 _p.sent(); 47205 _i = 0, _a = stack.negativeZIndex; 47206 _p.label = 2; 47207 case 2: 47208 if (!(_i < _a.length)) return [3 /*break*/, 5]; 47209 child = _a[_i]; 47210 return [4 /*yield*/, this.renderStack(child)]; 47211 case 3: 47212 _p.sent(); 47213 _p.label = 4; 47214 case 4: 47215 _i++; 47216 return [3 /*break*/, 2]; 47217 case 5: 47218 // 3. For all its in-flow, non-positioned, block-level descendants in tree order: 47219 return [4 /*yield*/, this.renderNodeContent(stack.element)]; 47220 case 6: 47221 // 3. For all its in-flow, non-positioned, block-level descendants in tree order: 47222 _p.sent(); 47223 _b = 0, _c = stack.nonInlineLevel; 47224 _p.label = 7; 47225 case 7: 47226 if (!(_b < _c.length)) return [3 /*break*/, 10]; 47227 child = _c[_b]; 47228 return [4 /*yield*/, this.renderNode(child)]; 47229 case 8: 47230 _p.sent(); 47231 _p.label = 9; 47232 case 9: 47233 _b++; 47234 return [3 /*break*/, 7]; 47235 case 10: 47236 _d = 0, _e = stack.nonPositionedFloats; 47237 _p.label = 11; 47238 case 11: 47239 if (!(_d < _e.length)) return [3 /*break*/, 14]; 47240 child = _e[_d]; 47241 return [4 /*yield*/, this.renderStack(child)]; 47242 case 12: 47243 _p.sent(); 47244 _p.label = 13; 47245 case 13: 47246 _d++; 47247 return [3 /*break*/, 11]; 47248 case 14: 47249 _f = 0, _g = stack.nonPositionedInlineLevel; 47250 _p.label = 15; 47251 case 15: 47252 if (!(_f < _g.length)) return [3 /*break*/, 18]; 47253 child = _g[_f]; 47254 return [4 /*yield*/, this.renderStack(child)]; 47255 case 16: 47256 _p.sent(); 47257 _p.label = 17; 47258 case 17: 47259 _f++; 47260 return [3 /*break*/, 15]; 47261 case 18: 47262 _h = 0, _j = stack.inlineLevel; 47263 _p.label = 19; 47264 case 19: 47265 if (!(_h < _j.length)) return [3 /*break*/, 22]; 47266 child = _j[_h]; 47267 return [4 /*yield*/, this.renderNode(child)]; 47268 case 20: 47269 _p.sent(); 47270 _p.label = 21; 47271 case 21: 47272 _h++; 47273 return [3 /*break*/, 19]; 47274 case 22: 47275 _k = 0, _l = stack.zeroOrAutoZIndexOrTransformedOrOpacity; 47276 _p.label = 23; 47277 case 23: 47278 if (!(_k < _l.length)) return [3 /*break*/, 26]; 47279 child = _l[_k]; 47280 return [4 /*yield*/, this.renderStack(child)]; 47281 case 24: 47282 _p.sent(); 47283 _p.label = 25; 47284 case 25: 47285 _k++; 47286 return [3 /*break*/, 23]; 47287 case 26: 47288 _m = 0, _o = stack.positiveZIndex; 47289 _p.label = 27; 47290 case 27: 47291 if (!(_m < _o.length)) return [3 /*break*/, 30]; 47292 child = _o[_m]; 47293 return [4 /*yield*/, this.renderStack(child)]; 47294 case 28: 47295 _p.sent(); 47296 _p.label = 29; 47297 case 29: 47298 _m++; 47299 return [3 /*break*/, 27]; 47300 case 30: return [2 /*return*/]; 47301 } 47302 }); 47303 }); 47304 }; 47305 CanvasRenderer.prototype.mask = function (paths) { 47306 this.ctx.beginPath(); 47307 this.ctx.moveTo(0, 0); 47308 this.ctx.lineTo(this.canvas.width, 0); 47309 this.ctx.lineTo(this.canvas.width, this.canvas.height); 47310 this.ctx.lineTo(0, this.canvas.height); 47311 this.ctx.lineTo(0, 0); 47312 this.formatPath(paths.slice(0).reverse()); 47313 this.ctx.closePath(); 47314 }; 47315 CanvasRenderer.prototype.path = function (paths) { 47316 this.ctx.beginPath(); 47317 this.formatPath(paths); 47318 this.ctx.closePath(); 47319 }; 47320 CanvasRenderer.prototype.formatPath = function (paths) { 47321 var _this = this; 47322 paths.forEach(function (point, index) { 47323 var start = isBezierCurve(point) ? point.start : point; 47324 if (index === 0) { 47325 _this.ctx.moveTo(start.x, start.y); 47326 } 47327 else { 47328 _this.ctx.lineTo(start.x, start.y); 47329 } 47330 if (isBezierCurve(point)) { 47331 _this.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y); 47332 } 47333 }); 47334 }; 47335 CanvasRenderer.prototype.renderRepeat = function (path, pattern, offsetX, offsetY) { 47336 this.path(path); 47337 this.ctx.fillStyle = pattern; 47338 this.ctx.translate(offsetX, offsetY); 47339 this.ctx.fill(); 47340 this.ctx.translate(-offsetX, -offsetY); 47341 }; 47342 CanvasRenderer.prototype.resizeImage = function (image, width, height) { 47343 if (image.width === width && image.height === height) { 47344 return image; 47345 } 47346 var canvas = this.canvas.ownerDocument.createElement('canvas'); 47347 canvas.width = width; 47348 canvas.height = height; 47349 var ctx = canvas.getContext('2d'); 47350 ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, width, height); 47351 return canvas; 47352 }; 47353 CanvasRenderer.prototype.renderBackgroundImage = function (container) { 47354 return __awaiter(this, void 0, void 0, function () { 47355 var index, _loop_1, this_1, _i, _a, backgroundImage; 47356 return __generator(this, function (_b) { 47357 switch (_b.label) { 47358 case 0: 47359 index = container.styles.backgroundImage.length - 1; 47360 _loop_1 = function (backgroundImage) { 47361 var image, url, e_4, _a, path, x, y, width, height, pattern, _b, path, x, y, width, height, _c, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _d, path, left, top_1, width, height, position, x, y, _e, rx, ry, radialGradient_1, midX, midY, f, invF; 47362 return __generator(this, function (_f) { 47363 switch (_f.label) { 47364 case 0: 47365 if (!(backgroundImage.type === CSSImageType.URL)) return [3 /*break*/, 5]; 47366 image = void 0; 47367 url = backgroundImage.url; 47368 _f.label = 1; 47369 case 1: 47370 _f.trys.push([1, 3, , 4]); 47371 return [4 /*yield*/, this_1.options.cache.match(url)]; 47372 case 2: 47373 image = _f.sent(); 47374 return [3 /*break*/, 4]; 47375 case 3: 47376 e_4 = _f.sent(); 47377 Logger.getInstance(this_1.options.id).error("Error loading background-image " + url); 47378 return [3 /*break*/, 4]; 47379 case 4: 47380 if (image) { 47381 _a = calculateBackgroundRendering(container, index, [ 47382 image.width, 47383 image.height, 47384 image.width / image.height 47385 ]), path = _a[0], x = _a[1], y = _a[2], width = _a[3], height = _a[4]; 47386 pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat'); 47387 this_1.renderRepeat(path, pattern, x, y); 47388 } 47389 return [3 /*break*/, 6]; 47390 case 5: 47391 if (isLinearGradient(backgroundImage)) { 47392 _b = calculateBackgroundRendering(container, index, [null, null, null]), path = _b[0], x = _b[1], y = _b[2], width = _b[3], height = _b[4]; 47393 _c = calculateGradientDirection(backgroundImage.angle, width, height), lineLength = _c[0], x0 = _c[1], x1 = _c[2], y0 = _c[3], y1 = _c[4]; 47394 canvas = document.createElement('canvas'); 47395 canvas.width = width; 47396 canvas.height = height; 47397 ctx = canvas.getContext('2d'); 47398 gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1); 47399 processColorStops(backgroundImage.stops, lineLength).forEach(function (colorStop) { 47400 return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color)); 47401 }); 47402 ctx.fillStyle = gradient_1; 47403 ctx.fillRect(0, 0, width, height); 47404 if (width > 0 && height > 0) { 47405 pattern = this_1.ctx.createPattern(canvas, 'repeat'); 47406 this_1.renderRepeat(path, pattern, x, y); 47407 } 47408 } 47409 else if (isRadialGradient(backgroundImage)) { 47410 _d = calculateBackgroundRendering(container, index, [ 47411 null, 47412 null, 47413 null 47414 ]), path = _d[0], left = _d[1], top_1 = _d[2], width = _d[3], height = _d[4]; 47415 position = backgroundImage.position.length === 0 ? [FIFTY_PERCENT] : backgroundImage.position; 47416 x = getAbsoluteValue(position[0], width); 47417 y = getAbsoluteValue(position[position.length - 1], height); 47418 _e = calculateRadius(backgroundImage, x, y, width, height), rx = _e[0], ry = _e[1]; 47419 if (rx > 0 && rx > 0) { 47420 radialGradient_1 = this_1.ctx.createRadialGradient(left + x, top_1 + y, 0, left + x, top_1 + y, rx); 47421 processColorStops(backgroundImage.stops, rx * 2).forEach(function (colorStop) { 47422 return radialGradient_1.addColorStop(colorStop.stop, asString(colorStop.color)); 47423 }); 47424 this_1.path(path); 47425 this_1.ctx.fillStyle = radialGradient_1; 47426 if (rx !== ry) { 47427 midX = container.bounds.left + 0.5 * container.bounds.width; 47428 midY = container.bounds.top + 0.5 * container.bounds.height; 47429 f = ry / rx; 47430 invF = 1 / f; 47431 this_1.ctx.save(); 47432 this_1.ctx.translate(midX, midY); 47433 this_1.ctx.transform(1, 0, 0, f, 0, 0); 47434 this_1.ctx.translate(-midX, -midY); 47435 this_1.ctx.fillRect(left, invF * (top_1 - midY) + midY, width, height * invF); 47436 this_1.ctx.restore(); 47437 } 47438 else { 47439 this_1.ctx.fill(); 47440 } 47441 } 47442 } 47443 _f.label = 6; 47444 case 6: 47445 index--; 47446 return [2 /*return*/]; 47447 } 47448 }); 47449 }; 47450 this_1 = this; 47451 _i = 0, _a = container.styles.backgroundImage.slice(0).reverse(); 47452 _b.label = 1; 47453 case 1: 47454 if (!(_i < _a.length)) return [3 /*break*/, 4]; 47455 backgroundImage = _a[_i]; 47456 return [5 /*yield**/, _loop_1(backgroundImage)]; 47457 case 2: 47458 _b.sent(); 47459 _b.label = 3; 47460 case 3: 47461 _i++; 47462 return [3 /*break*/, 1]; 47463 case 4: return [2 /*return*/]; 47464 } 47465 }); 47466 }); 47467 }; 47468 CanvasRenderer.prototype.renderBorder = function (color, side, curvePoints) { 47469 return __awaiter(this, void 0, void 0, function () { 47470 return __generator(this, function (_a) { 47471 this.path(parsePathForBorder(curvePoints, side)); 47472 this.ctx.fillStyle = asString(color); 47473 this.ctx.fill(); 47474 return [2 /*return*/]; 47475 }); 47476 }); 47477 }; 47478 CanvasRenderer.prototype.renderNodeBackgroundAndBorders = function (paint) { 47479 return __awaiter(this, void 0, void 0, function () { 47480 var styles, hasBackground, borders, backgroundPaintingArea, side, _i, borders_1, border; 47481 var _this = this; 47482 return __generator(this, function (_a) { 47483 switch (_a.label) { 47484 case 0: 47485 this.applyEffects(paint.effects, 2 /* BACKGROUND_BORDERS */); 47486 styles = paint.container.styles; 47487 hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length; 47488 borders = [ 47489 { style: styles.borderTopStyle, color: styles.borderTopColor }, 47490 { style: styles.borderRightStyle, color: styles.borderRightColor }, 47491 { style: styles.borderBottomStyle, color: styles.borderBottomColor }, 47492 { style: styles.borderLeftStyle, color: styles.borderLeftColor } 47493 ]; 47494 backgroundPaintingArea = calculateBackgroundCurvedPaintingArea(getBackgroundValueForIndex(styles.backgroundClip, 0), paint.curves); 47495 if (!(hasBackground || styles.boxShadow.length)) return [3 /*break*/, 2]; 47496 this.ctx.save(); 47497 this.path(backgroundPaintingArea); 47498 this.ctx.clip(); 47499 if (!isTransparent(styles.backgroundColor)) { 47500 this.ctx.fillStyle = asString(styles.backgroundColor); 47501 this.ctx.fill(); 47502 } 47503 return [4 /*yield*/, this.renderBackgroundImage(paint.container)]; 47504 case 1: 47505 _a.sent(); 47506 this.ctx.restore(); 47507 styles.boxShadow 47508 .slice(0) 47509 .reverse() 47510 .forEach(function (shadow) { 47511 _this.ctx.save(); 47512 var borderBoxArea = calculateBorderBoxPath(paint.curves); 47513 var maskOffset = shadow.inset ? 0 : MASK_OFFSET; 47514 var shadowPaintingArea = transformPath(borderBoxArea, -maskOffset + (shadow.inset ? 1 : -1) * shadow.spread.number, (shadow.inset ? 1 : -1) * shadow.spread.number, shadow.spread.number * (shadow.inset ? -2 : 2), shadow.spread.number * (shadow.inset ? -2 : 2)); 47515 if (shadow.inset) { 47516 _this.path(borderBoxArea); 47517 _this.ctx.clip(); 47518 _this.mask(shadowPaintingArea); 47519 } 47520 else { 47521 _this.mask(borderBoxArea); 47522 _this.ctx.clip(); 47523 _this.path(shadowPaintingArea); 47524 } 47525 _this.ctx.shadowOffsetX = shadow.offsetX.number + maskOffset; 47526 _this.ctx.shadowOffsetY = shadow.offsetY.number; 47527 _this.ctx.shadowColor = asString(shadow.color); 47528 _this.ctx.shadowBlur = shadow.blur.number; 47529 _this.ctx.fillStyle = shadow.inset ? asString(shadow.color) : 'rgba(0,0,0,1)'; 47530 _this.ctx.fill(); 47531 _this.ctx.restore(); 47532 }); 47533 _a.label = 2; 47534 case 2: 47535 side = 0; 47536 _i = 0, borders_1 = borders; 47537 _a.label = 3; 47538 case 3: 47539 if (!(_i < borders_1.length)) return [3 /*break*/, 7]; 47540 border = borders_1[_i]; 47541 if (!(border.style !== BORDER_STYLE.NONE && !isTransparent
47541(border.color))) return [3 /*break*/, 5]; 47542 return [4 /*yield*/, this.renderBorder(border.color, side, paint.curves)]; 47543 case 4: 47544 _a.sent(); 47545 _a.label = 5; 47546 case 5: 47547 side++; 47548 _a.label = 6; 47549 case 6: 47550 _i++; 47551 return [3 /*break*/, 3]; 47552 case 7: return [2 /*return*/]; 47553 } 47554 }); 47555 }); 47556 }; 47557 CanvasRenderer.prototype.render = function (element) { 47558 return __awaiter(this, void 0, void 0, function () { 47559 var stack; 47560 return __generator(this, function (_a) { 47561 switch (_a.label) { 47562 case 0: 47563 if (this.options.backgroundColor) { 47564 this.ctx.fillStyle = asString(this.options.backgroundColor); 47565 this.ctx.fillRect(this.options.x - this.options.scrollX, this.options.y - this.options.scrollY, this.options.width, this.options.height); 47566 } 47567 stack = parseStackingContexts(element); 47568 return [4 /*yield*/, this.renderStack(stack)]; 47569 case 1: 47570 _a.sent(); 47571 this.applyEffects([], 2 /* BACKGROUND_BORDERS */); 47572 return [2 /*return*/, this.canvas]; 47573 } 47574 }); 47575 }); 47576 }; 47577 return CanvasRenderer; 47578 }()); 47579 var isTextInputElement = function (container) { 47580 if (container instanceof TextareaElementContainer) { 47581 return true; 47582 } 47583 else if (container instanceof SelectElementContainer) { 47584 return true; 47585 } 47586 else if (container instanceof InputElementContainer && container.type !== RADIO && container.type !== CHECKBOX) { 47587 return true; 47588 } 47589 return false; 47590 }; 47591 var calculateBackgroundCurvedPaintingArea = function (clip, curves) { 47592 switch (clip) { 47593 case BACKGROUND_CLIP.BORDER_BOX: 47594 return calculateBorderBoxPath(curves); 47595 case BACKGROUND_CLIP.CONTENT_BOX: 47596 return calculateContentBoxPath(curves); 47597 case BACKGROUND_CLIP.PADDING_BOX: 47598 default: 47599 return calculatePaddingBoxPath(curves); 47600 } 47601 }; 47602 var canvasTextAlign = function (textAlign) { 47603 switch (textAlign) { 47604 case TEXT_ALIGN.CENTER: 47605 return 'center'; 47606 case TEXT_ALIGN.RIGHT: 47607 return 'right'; 47608 case TEXT_ALIGN.LEFT: 47609 default: 47610 return 'left'; 47611 } 47612 }; 47613 47614 var ForeignObjectRenderer = /** @class */ (function () { 47615 function ForeignObjectRenderer(options) { 47616 this.canvas = options.canvas ? options.canvas : document.createElement('canvas'); 47617 this.ctx = this.canvas.getContext('2d'); 47618 this.options = options; 47619 this.canvas.width = Math.floor(options.width * options.scale); 47620 this.canvas.height = Math.floor(options.height * options.scale); 47621 this.canvas.style.width = options.width + "px"; 47622 this.canvas.style.height = options.height + "px"; 47623 this.ctx.scale(this.options.scale, this.options.scale); 47624 this.ctx.translate(-options.x + options.scrollX, -options.y + options.scrollY); 47625 Logger.getInstance(options.id).debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale); 47626 } 47627 ForeignObjectRenderer.prototype.render = function (element) { 47628 return __awaiter(this, void 0, void 0, function () { 47629 var svg, img; 47630 return __generator(this, function (_a) { 47631 switch (_a.label) { 47632 case 0: 47633 svg = createForeignObjectSVG(Math.max(this.options.windowWidth, this.options.width) * this.options.scale, Math.max(this.options.windowHeight, this.options.height) * this.options.scale, this.options.scrollX * this.options.scale, this.options.scrollY * this.options.scale, element); 47634 return [4 /*yield*/, loadSerializedSVG$1(svg)]; 47635 case 1: 47636 img = _a.sent(); 47637 if (this.options.backgroundColor) { 47638 this.ctx.fillStyle = asString(this.options.backgroundColor); 47639 this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale); 47640 } 47641 this.ctx.drawImage(img, -this.options.x * this.options.scale, -this.options.y * this.options.scale); 47642 return [2 /*return*/, this.canvas]; 47643 } 47644 }); 47645 }); 47646 }; 47647 return ForeignObjectRenderer; 47648 }()); 47649 var loadSerializedSVG$1 = function (svg) { 47650 return new Promise(function (resolve, reject) { 47651 var img = new Image(); 47652 img.onload = function () { 47653 resolve(img); 47654 }; 47655 img.onerror = reject; 47656 img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg)); 47657 }); 47658 }; 47659 47660 var _this = undefined; 47661 var parseColor$1 = function (value) { return color.parse(Parser.create(value).parseComponentValue()); }; 47662 var html2canvas = function (element, options) { 47663 if (options === void 0) { options = {}; } 47664 return renderElement(element, options); 47665 }; 47666 if (typeof window !== 'undefined') { 47667 CacheStorage.setContext(window); 47668 } 47669 var renderElement = function (element, opts) { return __awaiter(_this, void 0, void 0, function () { 47670 var ownerDocument, defaultView, instanceName, _a, width, height, left, top, defaultResourceOptions, resourceOptions, defaultOptions, options, windowBounds, documentCloner, clonedElement, container, documentBackgroun
47670dColor, bodyBackgroundColor, bgColor, defaultBackgroundColor, backgroundColor, renderOptions, canvas, renderer, root, renderer; 47671 return __generator(this, function (_b) { 47672 switch (_b.label) { 47673 case 0: 47674 ownerDocument = element.ownerDocument; 47675 if (!ownerDocument) { 47676 throw new Error("Element is not attached to a Document"); 47677 } 47678 defaultView = ownerDocument.defaultView; 47679 if (!defaultView) { 47680 throw new Error("Document is not attached to a Window"); 47681 } 47682 instanceName = (Math.round(Math.random() * 1000) + Date.now()).toString(16); 47683 _a = isBodyElement(element) || isHTMLElement(element) ? parseDocumentSize(ownerDocument) : parseBounds(element), width = _a.width, height = _a.height, left = _a.left, top = _a.top; 47684 defaultResourceOptions = { 47685 allowTaint: false, 47686 imageTimeout: 15000, 47687 proxy: undefined, 47688 useCORS: false 47689 }; 47690 resourceOptions = __assign({}, defaultResourceOptions, opts); 47691 defaultOptions = { 47692 backgroundColor: '#ffffff', 47693 cache: opts.cache ? opts.cache : CacheStorage.create(instanceName, resourceOptions), 47694 logging: true, 47695 removeContainer: true, 47696 foreignObjectRendering: false, 47697 scale: defaultView.devicePixelRatio || 1, 47698 windowWidth: defaultView.innerWidth, 47699 windowHeight: defaultView.innerHeight, 47700 scrollX: defaultView.pageXOffset, 47701 scrollY: defaultView.pageYOffset, 47702 x: left, 47703 y: top, 47704 width: Math.ceil(width), 47705 height: Math.ceil(height), 47706 id: instanceName 47707 }; 47708 options = __assign({}, defaultOptions, resourceOptions, opts); 47709 windowBounds = new Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight); 47710 Logger.create({ id: instanceName, enabled: options.logging }); 47711 Logger.getInstance(instanceName).debug("Starting document clone"); 47712 documentCloner = new DocumentCloner(element, { 47713 id: instanceName, 47714 onclone: options.onclone, 47715 ignoreElements: options.ignoreElements, 47716 inlineImages: options.foreignObjectRendering, 47717 copyStyles: options.foreignObjectRendering 47718 }); 47719 clonedElement = documentCloner.clonedReferenceElement; 47720 if (!clonedElement) { 47721 return [2 /*return*/, Promise.reject("Unable to find element in cloned iframe")]; 47722 } 47723 return [4 /*yield*/, documentCloner.toIFrame(ownerDocument, windowBounds)]; 47724 case 1: 47725 container = _b.sent(); 47726 documentBackgroundColor = ownerDocument.documentElement 47727 ? parseColor$1(getComputedStyle(ownerDocument.documentElement).backgroundColor) 47728 : COLORS.TRANSPARENT; 47729 bodyBackgroundColor = ownerDocument.body 47730 ? parseColor$1(getComputedStyle(ownerDocument.body).backgroundColor) 47731 : COLORS.TRANSPARENT; 47732 bgColor = opts.backgroundColor; 47733 defaultBackgroundColor = typeof bgColor === 'string' ? parseColor$1(bgColor) : bgColor === null ? COLORS.TRANSPARENT : 0xffffffff; 47734 backgroundColor = element === ownerDocument.documentElement 47735 ? isTransparent(documentBackgroundColor)
47736 ? isTransparent(bodyBackgroundColor) 47737 ? defaultBackgroundColor 47738 : bodyBackgroundColor 47739 : documentBackgroundColor 47740 : defaultBackgroundColor; 47741 renderOptions = { 47742 id: instanceName, 47743 cache: options.cache, 47744 canvas: options.canvas, 47745 backgroundColor: backgroundColor, 47746 scale: options.scale, 47747 x: options.x, 47748 y: options.y, 47749 scrollX: options.scrollX, 47750 scrollY: options.scrollY, 47751 width: options.width, 47752 height: options.height, 47753 windowWidth: options.windowWidth, 47754 windowHeight: options.windowHeight 47755 }; 47756 if (!options.foreignObjectRendering) return [3 /*break*/, 3]; 47757 Logger.getInstance(instanceName).debug("Document cloned, using foreign object rendering"); 47758 renderer = new ForeignObjectRenderer(renderOptions); 47759 return [4 /*yield*/, renderer.render(clonedElement)]; 47760 case 2: 47761 canvas = _b.sent(); 47762 return [3 /*break*/, 5]; 47763 case 3: 47764 Logger.getInstance(instanceName).debug("Document cloned, using computed rendering"); 47765 CacheStorage.attachInstance(options.cache); 47766 Logger.getInstance(instanceName).debug("Starting DOM parsing"); 47767 root = parseTree(clonedElement); 47768 CacheStorage.detachInstance(); 47769 if (backgroundColor === root.styles.backgroundColor) { 47770 root.styles.backgroundColor = COLORS.TRANSPARENT; 47771 } 47772 Logger.getInstance(instanceName).debug("Starting renderer"); 47773 renderer = new CanvasRenderer(renderOptions); 47774 return [4 /*yield*/, renderer.render(root)]; 47775 case 4: 47776 canvas = _b.sent(); 47777 _b.label = 5; 47778 case 5: 47779 if (options.removeContainer === true) { 47780 if (!DocumentCloner.destroy(container)) { 47781 Logger.getInstance(instanceName).error("Cannot detach cloned iframe as it is not in the DOM anymore"); 47782 } 47783 } 47784 Logger.getInstance(instanceName).debug("Finished rendering"); 47785 Logger.destroy(instanceName); 47786 CacheStorage.destroy(instanceName); 47787 return [2 /*return*/, canvas]; 47788 } 47789 }); 47790 }); }; 47791 47792 return html2canvas; 47793 47794})); 47795 47796/* http://plugins.jquery.com/validate */ 47797 47798;(function(defaults, $, window, undefined) { 47799 47800 var 47801 47802 type = ['input:not([type]),input[type="color"],input[type="date"],input[type="datetime"],input[type="datetime-local"],input[type="email"],input[type="file"],input[type="hidden"],input[type="month"],input[type="number"],input[type="password"],input[type="range"],input[type="search"],input[type="tel"],input[type="text"],input[type="time"],input[type="url"],input[type="week"],textarea', 'select', 'input[type="checkbox"],input[type="radio"]'], 47803 47804 // All field types 47805 allTypes = type.join(','), 47806 47807 extend = {}, 47808 47809 // Method to validate each fields 47810 validateField = function(event, options) { 47811 47812 var 47813 47814 // Field status 47815 status = { 47816 pattern : true, 47817 conditional : true, 47818 required : true 47819 }, 47820 47821 // Current field 47822 field = $(this), 47823 47824 // Current field value 47825 fieldValue = field.val() || '', 47826 47827 // An index of extend 47828 fieldValidate = field.data('validate'), 47829 47830 // A validation object (jQuery.fn.validateExtend) 47831 validation = fieldValidate !== undefined ? extend[fieldValidate] : {}, 47832 47833 // One index or more separated for spaces to prepare the field value 47834 fieldPrepare = field.data('prepare') || validation.prepare, 47835 47836 // A regular expression to validate field value 47837 fieldPattern = (field.data('pattern') || ($.type(validation.pattern) == 'regexp' ? validation.pattern : /(?:)/)), 47838 47839 // Is case sensitive? (Boolean) 47840 fieldIgnoreCase = field.attr('data-ignore-case') || field.data('ignoreCase') || validation.ignoreCase, 47841 47842 // A field mask 47843 fieldMask = field.data('mask') || validation.mask, 47844
47845 // A index in the conditional object containing a function to validate the field value 47846 fieldConditional = field.data('conditional') || validation.conditional, 47847 47848 // Is required? 47849 fieldRequired = field.data('required'), 47850 47851 // The description element id 47852 fieldDescribedby = field.data('describedby') || validation.describedby, 47853 47854 // An index of description object 47855 fieldDescription = field.data('description') || validation.description, 47856 47857 // Trim spaces? 47858 fieldTrim = field.data('trim'), 47859 47860 reTrue = /^(true|)$/i, 47861 47862 reFalse = /^false$/i, 47863 47864 // The description object 47865 fieldDescription = $.isPlainObject(fieldDescription) ? fieldDescription : (options.description[fieldDescription] || {}), 47866 47867 name = 'validate'; 47868 47869 fieldRequired = fieldRequired != '' ? (fieldRequired || !!validation.required) : true; 47870 47871 fieldTrim = fieldTrim != '' ? (fieldTrim || !!validation.trim) : true; 47872 47873 // Trim spaces? 47874 if(reTrue.test(fieldTrim)) { 47875 47876 fieldValue = $.trim(fieldValue); 47877 } 47878 47879 // The fieldPrepare is a function? 47880 if($.isFunction(fieldPrepare)) { 47881 47882 // Updates the fieldValue variable 47883 fieldValue = String(fieldPrepare.call(field, fieldValue)); 47884 } else { 47885 47886 // Is a function? 47887 if($.isFunction(options.prepare[fieldPrepare])) { 47888 47889 // Updates the fieldValue variable 47890 fieldValue = String(options.prepare[fieldPrepare].call(field, fieldValue)); 47891 } 47892 } 47893 47894 // Is not RegExp? 47895 if($.type(fieldPattern) != 'regexp') { 47896 47897 fieldIgnoreCase = !reFalse.test(fieldIgnoreCase); 47898 47899 // Converts to RegExp 47900 fieldPattern = fieldIgnoreCase ? RegExp(fieldPattern, 'i') : RegExp(fieldPattern); 47901 } 47902 47903 // The conditional exists? 47904 if(fieldConditional != undefined) { 47905 47906 // The fieldConditional is a function? 47907 if($.isFunction(fieldConditional)) { 47908 47909 status.conditional = !!fieldConditional.call(field, fieldValue, options); 47910 } else { 47911 47912 var 47913 47914 // Splits the conditionals in an array 47915 conditionals = fieldConditional.split(/[\s\t]+/); 47916 47917 // Each conditional 47918 for(var counter = 0, len = conditionals.length; counter < len; counter++) { 47919 47920 if(options.conditional.hasOwnProperty(conditionals[counter]) && !options.conditional[conditionals[counter]].call(field, fieldValue, options)) { 47921 47922 status.conditional = false;
47923 } 47924 } 47925 } 47926 } 47927 47928 fieldRequired = reTrue.test(fieldRequired); 47929 47930 // Is required? 47931 if(fieldRequired) { 47932 47933 // Verifies the field type 47934 if(field.is(type[0] + ',' + type[1])) { 47935 47936 // Is empty? 47937 if(!fieldValue.length > 0) { 47938 47939 status.required = false; 47940 } 47941 } else if(field.is(type[2])) { 47942 47943 if(field.is('[name]')) { 47944 47945 // Is checked? 47946 if($('[name="' + field.prop('name') + '"]:checked').length == 0) { 47947 47948 status.required = false; 47949 } 47950 } else { 47951 47952 status.required = field.is(':checked'); 47953 } 47954 } 47955 } 47956 47957 // Verifies the field type 47958 if(field.is(type[0])) { 47959 47960 // Test the field value pattern 47961 if(fieldPattern.test(fieldValue)) { 47962 47963 // If the event type is not equals to keyup 47964 if(event.type != 'keyup' && fieldMask !== undefined) { 47965 47966 var matches = fieldValue.match(fieldPattern); 47967 47968 // Each characters group 47969 for(var i = 0, len = matches.length; i < len; i++) { 47970 47971 // Replace the groups 47972 fieldMask = fieldMask.replace(RegExp('\\$\\{' + i + '(?::`([^`]*)`)?\\}', 'g'), (matches[i] !== undefined ? matches[i] : '$1')); 47973 } 47974 47975 fieldMask = fieldMask.replace(/\$\{\d+(?::`([^`]*)`)?\}/g, '$1'); 47976 47977 // Test the field value pattern 47978 if(fieldPattern.test(fieldMask)) { 47979 47980 // Update the field value 47981 field.val(fieldMask); 47982 } 47983 } 47984 } else { 47985 47986 // If the field is required 47987 if(fieldRequired) { 47988 47989 status.pattern = false; 47990 } else { 47991 47992 if(fieldValue.length > 0) { 47993 47994 status.pattern = false; 47995 } 47996 } 47997 } 47998 } 47999 48000 var 48001 48002 describedby = $('[id="' + fieldDescribedby +'"]'), 48003 48004 log = fieldDescription.valid; 48005 48006 if(describedby.length > 0 && event.type != 'keyup') { 48007 48008 if(!status.required) { 48009 48010 log = fieldDescription.required; 48011 } else if(!status.pattern) { 48012 48013 log = fieldDescription.pattern; 48014 } else if(!status.conditional) { 48015 48016 log = fieldDescription.conditional; 48017 } 48018 48019 describedby.html(log || ''); 48020 } 48021 48022 if(typeof(validation.each) == 'function') { 48023 48024 validation.each.call(field, event, status, options); 48025 } 48026 48027 // Call the eachField callback 48028 options.eachField.call(field, event, status, options); 48029 48030 // If the field is valid 48031 if(status.required && status.pattern && status.conditional) { 48032 48033 // If WAI-ARIA is enabled 48034 if(!!options.waiAria) { 48035 48036 field.prop('aria-invalid', false); 48037 } 48038 48039 if(typeof(validation.valid) == 'function') { 48040 48041 validation.valid.call(field, event, status, options); 48042 } 48043 48044 // Call the eachValidField callback 48045 options.eachValidField.call(field, event, status, options); 48046 } else { 48047 48048 // If WAI-ARIA is enabled 48049 if(!!options.waiAria) { 48050 48051 field.prop('aria-invalid', true); 48052 } 48053 48054 if(typeof(validation.invalid) == 'function') { 48055 48056 validation.invalid.call(field, event, status, options); 48057 } 48058 48059 // Call the eachInvalidField callback 48060 options.eachInvalidField.call(field, event, status, options); 48061 } 48062 48063 // Returns the field status 48064 return status; 48065 }; 48066 48067 $.extend({ 48068 48069 // Method to extends validations 48070 validateExtend : function(options) { 48071 48072 return $.extend(extend, options); 48073 }, 48074 48075 // Method to change the default properties of jQuery.fn.validate method 48076 validateSetup : function(options) { 48077 48078 return $.extend(defaults, options); 48079 } 48080 }).fn.extend({ 48081 48082 // Method to validate forms 48083 validate : function(options) { 48084 48085 options = $.extend({}, defaults, options); 48086 48087 return $(this).validateDestroy().each(function() { 48088 48089 var form = $(this); 48090 48091 // This is a form? 48092 if(form.is('form')) { 48093 48094 form.data(name, { 48095 options : options 48096 }); 48097 48098 var 48099 48100 fields = form.find(allTypes), 48101 48102 // Events namespace 48103 namespace = options.namespace; 48104 48105 if(form.is('[id]')) { 48106 48107 fields = fields.add('[form="' + form.prop('id') + '"]').filter(allTypes); 48108 } 48109 48110 fields = fields.filter(options.filter); 48111 48112 // If onKeyup is enabled 48113 if(!!options.onKeyup) { 48114 48115 fields.filter(type[0]).on('keyup.' + namespace, function(event) { 48116 48117 validateField.call(this, event, options); 48118 }); 48119 } 48120 48121 // If onBlur is enabled 48122 if(!!options.onBlur) { 48123 48124 fields.on('blur.' + namespace, function(event) { 48125 48126 validateField.call(this, event, options); 48127 }); 48128 } 48129 48130 // If onChange is enabled 48131 if(!!options.onChange) { 48132
48133 fields.on('change.' + namespace, function(event) { 48134 48135 validateField.call(this, event, options); 48136 }); 48137 } 48138 48139 // If onSubmit is enabled 48140 if(!!options.onSubmit) { 48141 48142 form.on('submit.' + namespace, function(event) { 48143 48144 var formValid = true; 48145 48146 fields.each(function() { 48147 48148 var status = validateField.call(this, event, options); 48149 48150 if(!status.pattern || !status.conditional || !status.required) { 48151 48152 formValid = false; 48153 } 48154 }); 48155 48156 // If form is valid 48157 if(formValid) { 48158 48159 // Send form? 48160 if(!options.sendForm) { 48161 48162 event.preventDefault(); 48163 } 48164 48165 // Is a function? 48166 if($.isFunction(options.valid)) { 48167 48168 options.valid.call(form, event, options); 48169 } 48170 } else { 48171 48172 event.preventDefault(); 48173 48174 // Is a function? 48175 if($.isFunction(options.invalid)) { 48176 48177 options.invalid.call(form, event, options); 48178 } 48179 } 48180 }); 48181 } 48182 } 48183 }); 48184 }, 48185 48186 // Method to destroy validations 48187 validateDestroy : function() { 48188 48189 var 48190 48191 form = $(this), 48192 48193 dataValidate = form.data(name); 48194 48195 // If this is a form 48196 if(form.is('form') && $.isPlainObject(dataValidate) && typeof(dataValidate.options.nameSpace) == 'string') { 48197 48198 var fields = form.removeData(name).find(allTypes).add(form); 48199 48200 if(form.is('[id]')) { 48201 48202 fields = fields.add($('[form="' + form.prop('id') + '"]').filter(allTypes)); 48203 } 48204 48205 fields.off('.' + dataValidate.options.nameSpace); 48206 } 48207 48208 return form; 48209 } 48210 }); 48211})({ 48212 48213 // Send form if is valid? 48214 sendForm : true, 48215 48216 // Use WAI-ARIA properties 48217 waiAria : true, 48218 48219 // Validate on submit? 48220 onSubmit : true, 48221 48222 // Validate on onKeyup? 48223 onKeyup : false, 48224 48225 // Validate on onBlur? 48226 onBlur : false, 48227 48228 // Validate on onChange? 48229 onChange : false, 48230 48231 // Default namespace 48232 nameSpace : 'validate', 48233 48234 // Conditional functions 48235 conditional : {}, 48236 48237 // Prepare functions 48238 prepare : {}, 48239 48240 // Fields descriptions 48241 description : {}, 48242 48243 // Callback 48244 eachField : $.noop, 48245 48246 // Callback 48247 eachInvalidField : $.noop, 48248 48249 // Callback 48250 eachValidField : $.noop, 48251 48252 // Callback 48253 invalid : $.noop, 48254 48255 // Callback 48256 valid : $.noop, 48257 48258 // A fielter to the fields 48259 filter : '*' 48260}, jQuery, window); 48261;(function($) { 48262var bootstrapWizardCreate = function(element, options) { 48263 var element = $(element); 48264 var obj = this; 48265 48266 // Merge options with defaults 48267 var $settings = $.extend({}, $.fn.bootstrapWizard.defaults, options); 48268 var $activeTab = null; 48269 var $navigation = null; 48270 48271 this.rebindClick = function(selector, fn) 48272 { 48273 selector.unbind('click', fn).bind('click', fn); 48274 } 48275 48276 this.fixNavigationButtons = function() { 48277 // Get the current active tab 48278 if(!$activeTab.length) { 48279 // Select first one 48280 $navigation.find('a:first').tab('show'); 48281 $activeTab = $navigation.find('li:first'); 48282 } 48283 48284 // See if we're currently in the first/last then disable the previous and last buttons 48285 $($settings.previousSelector, element).toggleClass('disabled', (obj.firstIndex() >= obj.currentIndex())); 48286 $($settings.nextSelector, element).toggleClass('disabled', (obj.currentIndex() >= obj.navigationLength())); 48287 48288 // We are unbinding and rebinding to ensure single firing and no double-click errors 48289 obj.rebindClick($($settings.nextSelector, element), obj.next); 48290 obj.rebindClick($($settings.previousSelector, element), obj.previous); 48291 obj.rebindClick($($settings.lastSelector, element), obj.last); 48292 obj.rebindClick($($settings.firstSelector, element), obj.first); 48293 48294 if($settings.onTabShow && typeof $settings.onTabShow === 'function' && $settings.onTabShow($activeTab, $navigation, obj.currentIndex())===false){ 48295 return false; 48296 } 48297 }; 48298 48299 this.next = function(e) { 48300 48301 // If we clicked the last then dont activate this 48302 if(element.hasClass('last')) { 48303 return false; 48304 } 48305 48306 if($settings.onNext && typeof $settings.onNext === 'function' && $settings.onNext($activeTab, $navigation, obj.nextIndex())===false){ 48307 return false; 48308 } 48309 48310 // Did we click the last button 48311 $index = obj.nextIndex(); 48312 if($index > obj.navigationLength()) { 48313 } else { 48314 $navigation.find('li:eq('+$index+') a').tab('show'); 48315 } 48316 }; 48317 48318 this.previous = function(e) { 48319 48320 // If we clicked the first then dont activate this 48321 if(element.hasClass('first')) { 48322 return false;
48323 } 48324 48325 if($settings.onPrevious && typeof $settings.onPrevious === 'function' && $settings.onPrevious($activeTab, $navigation, obj.previousIndex())===false){ 48326 return false; 48327 } 48328 48329 $index = obj.previousIndex(); 48330 if($index < 0) { 48331 } else { 48332 $navigation.find('li:eq('+$index+') a').tab('show'); 48333 } 48334 }; 48335 48336 this.first = function(e) { 48337 if($settings.onFirst && typeof $settings.onFirst === 'function' && $settings.onFirst($activeTab, $navigation, obj.firstIndex())===false){ 48338 return false; 48339 } 48340 48341 // If the element is disabled then we won't do anything 48342 if(element.hasClass('disabled')) { 48343 return false; 48344 } 48345 $navigation.find('li:eq(0) a').tab('show'); 48346 48347 }; 48348 this.last = function(e) { 48349 if($settings.onLast && typeof $settings.onLast === 'function' && $settings.onLast($activeTab, $navigation, obj.lastIndex())===false){ 48350 return false; 48351 } 48352 48353 // If the element is disabled then we won't do anything 48354 if(element.hasClass('disabled')) { 48355 return false; 48356 } 48357 $navigation.find('li:eq('+obj.navigationLength()+') a').tab('show'); 48358 }; 48359 this.currentIndex = function() { 48360 return $navigation.find('li').index($activeTab); 48361 }; 48362 this.firstIndex = function() { 48363 return 0; 48364 }; 48365 this.lastIndex = function() { 48366 return obj.navigationLength(); 48367 }; 48368 this.getIndex = function(e) { 48369 return $navigation.find('li').index(e); 48370 }; 48371 this.nextIndex = function() { 48372 return $navigation.find('li').index($activeTab) + 1; 48373 }; 48374 this.previousIndex = function() { 48375 return $navigation.find('li').index($activeTab) - 1; 48376 }; 48377 this.navigationLength = function() { 48378 return $navigation.find('li').length - 1; 48379 }; 48380 this.activeTab = function() { 48381 return $activeTab; 48382 }; 48383 this.nextTab = function() { 48384 return $navigation.find('li:eq('+(obj.currentIndex()+1)+')').length ? $navigation.find('li:eq('+(obj.currentIndex()+1)+')') : null; 48385 }; 48386 this.previousTab = function() { 48387 if(obj.currentIndex() <= 0) { 48388 return null; 48389 } 48390 return $navigation.find('li:eq('+parseInt(obj.currentIndex()-1)+')'); 48391 }; 48392 this.show = function(index) { 48393 return element.find('li:eq(' + index + ') a').tab('show'); 48394 }; 48395 this.disable = function(index) { 48396 $navigation.find('li:eq('+index+')').addClass('disabled'); 48397 }; 48398 this.enable = function(index) { 48399 $navigation.find('li:eq('+index+')').removeClass('disabled'); 48400 }; 48401 this.hide = function(index) { 48402 $navigation.find('li:eq('+index+')').hide(); 48403 }; 48404 this.display = function(index) { 48405 $navigation.find('li:eq('+index+')').show(); 48406 }; 48407 this.remove = function(args) { 48408 var $index = args[0]; 48409 var $removeTabPane = typeof args[1] != 'undefined' ? args[1] : false; 48410 var $item = $navigation.find('li:eq('+$index+')'); 48411 48412 // Remove the tab pane first if needed 48413 if($removeTabPane) { 48414 var $href = $item.find('a').attr('href'); 48415 $($href).remove(); 48416 } 48417 48418 // Remove menu item 48419 $item.remove(); 48420 }; 48421 48422 $navigation = element.find('ul:first', element); 48423 $activeTab = $navigation.find('li.active', element); 48424 48425 if(!$navigation.hasClass($settings.tabClass)) { 48426 $navigation.addClass($settings.tabClass); 48427 } 48428 48429 // Load onInit 48430 if($settings.onInit && typeof $settings.onInit === 'function'){ 48431 $settings.onInit($activeTab, $navigation, 0); 48432 } 48433 48434 // Load onShow 48435 if($settings.onShow && typeof $settings.onShow === 'function'){ 48436 $settings.onShow($activeTab, $navigation, obj.nextIndex()); 48437 } 48438 48439 // Work the next/previous buttons 48440 obj.fixNavigationButtons(); 48441 48442 $('a[data-toggle="tab"]', $navigation).on('click', function (e) { 48443 // Get the index of the clicked tab 48444 var clickedIndex = $navigation.find('li').index($(e.currentTarget).parent('li')); 48445 if($settings.onTabClick && typeof $settings.onTabClick === 'function' && $settings.onTabClick($activeTab, $navigation, obj.currentIndex(), clickedIndex)===false){ 48446 return false; 48447 } 48448 }); 48449 48450 $('a[data-toggle="tab"]', $navigation).on('shown', function (e) { // use shown instead of show to help prevent double firing 48451 $element = $(e.target).parent(); 48452 var nextTab = $navigation.find('li').index($element); 48453 48454 // If it's disabled then do not change 48455 if($element.hasClass('disabled')) { 48456 return false; 48457 } 48458 48459 if($settings.onTabChange && typeof $settings.onTabChange === 'function' && $settings.onTabChange($activeTab, $navigation, obj.currentIndex(), nextTab)===false){ 48460 return false;
48461 } 48462 48463 $activeTab = $element; // activated tab 48464 obj.fixNavigationButtons(); 48465 }); 48466}; 48467$.fn.bootstrapWizard = function(options) { 48468 //expose methods 48469 if (typeof options == 'string') { 48470 var args = Array.prototype.slice.call(arguments, 1) 48471 if(args.length === 1) { 48472 args.toString(); 48473 } 48474 return this.data('bootstrapWizard')[options](args); 48475 } 48476 return this.each(function(index){ 48477 var element = $(this); 48478 // Return early if this element already has a plugin instance 48479 if (element.data('bootstrapWizard')) return; 48480 // pass options to plugin constructor 48481 var wizard = new bootstrapWizardCreate(element, options); 48482 // Store plugin object in this element's data 48483 element.data('bootstrapWizard', wizard); 48484 }); 48485}; 48486 48487// expose options 48488$.fn.bootstrapWizard.defaults = { 48489 tabClass: 'nav nav-pills', 48490 nextSelector: '.wizard li.next', 48491 previousSelector: '.wizard li.previous', 48492 firstSelector: '.wizard li.first', 48493 lastSelector: '.wizard li.last', 48494 onShow: null, 48495 onInit: null, 48496 onNext: null, 48497 onPrevious: null, 48498 onLast: null, 48499 onFirst: null, 48500 onTabChange: null, 48501 onTabClick: null, 48502 onTabShow: null 48503}; 48504 48505})(jQuery); 48506/*! 48507 * jQuery Form Plugin 48508 * version: 3.51.0-2014.06.20 48509 * Requires jQuery v1.5 or later 48510 * Copyright (c) 2014 M. Alsup 48511 * Examples and documentation at: http://malsup.com/jquery/form/ 48512 * Project repository: https://github.com/malsup/form 48513 * Dual licensed under the MIT and GPL licenses. 48514 * https://github.com/malsup/form#copyright-and-license 48515 */ 48516/*global ActiveXObject */ 48517 48518// AMD support 48519(function (factory) { 48520 "use strict"; 48521 if (typeof define === 'function' && define.amd) { 48522 // using AMD; register as anon module 48523 define(['jquery'], factory); 48524 } else { 48525 // no AMD; invoke directly 48526 factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto ); 48527 } 48528} 48529 48530(function($) { 48531"use strict"; 48532 48533/* 48534 Usage Note: 48535 ----------- 48536 Do not use both ajaxSubmit and ajaxForm on the same form. These 48537 functions are mutually exclusive. Use ajaxSubmit if you want 48538 to bind your own submit handler to the form. For example, 48539 48540 $(document).ready(function() { 48541 $('#myForm').on('submit', function(e) { 48542 e.preventDefault(); // <-- important 48543 $(this).ajaxSubmit({ 48544 target: '#output' 48545 }); 48546 }); 48547 }); 48548 48549 Use ajaxForm when you want the plugin to manage all the event binding 48550 for you. For example, 48551 48552 $(document).ready(function() { 48553 $('#myForm').ajaxForm({ 48554 target: '#output' 48555 }); 48556 }); 48557 48558 You can also use ajaxForm with delegation (requires jQuery v1.7+), so the 48559 form does not have to exist when you invoke ajaxForm: 48560 48561 $('#myForm').ajaxForm({ 48562 delegation: true, 48563 target: '#output' 48564 }); 48565 48566 When using ajaxForm, the ajaxSubmit function will be invoked for you 48567 at the appropriate time. 48568*/ 48569 48570/** 48571 * Feature detection 48572 */ 48573var feature = {}; 48574feature.fileapi = $("<input type='file'/>").get(0).files !== undefined; 48575feature.formdata = window.FormData !== undefined; 48576 48577var hasProp = !!$.fn.prop; 48578 48579// attr2 uses prop when it can but checks the return type for 48580// an expected string. this accounts for the case where a form 48581// contains inputs with names like "action" or "method"; in those 48582// cases "prop" returns the element 48583$.fn.attr2 = function() { 48584 if ( ! hasProp ) { 48585 return this.attr.apply(this, arguments); 48586 } 48587 var val = this.prop.apply(this, arguments); 48588 if ( ( val && val.jquery ) || typeof val === 'string' ) { 48589 return val; 48590 } 48591 return this.attr.apply(this, arguments); 48592}; 48593 48594/** 48595 * ajaxSubmit() provides a mechanism for immediately submitting 48596 * an HTML form using AJAX. 48597 */ 48598$.fn.ajaxSubmit = function(options) { 48599 /*jshint scripturl:true */ 48600 48601 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 48602 if (!this.length) { 48603 log('ajaxSubmit: skipping submit process - no element selected'); 48604 return this; 48605 } 48606 48607 var method, action, url, $form = this; 48608 48609 if (typeof options == 'function') { 48610 options = { success: options }; 48611 } 48612 else if ( options === undefined ) { 48613 options = {}; 48614 } 48615 48616 method = options.type || this.attr2('method'); 48617 action = options.url || this.attr2('action'); 48618 48619 url = (typeof action === 'string') ? $.trim(action) : ''; 48620 url = url || window.location.href || ''; 48621 if (url) { 48622 // clean url (don't include hash vaue) 48623 url = (url.match(/^([^#]+)/)||[])[1]; 48624 } 48625 48626 options = $.extend(true, { 48627 url: url, 48628 success: $.ajaxSettings.success, 48629 type: method || $.ajaxSettings.type, 48630 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' 48631 }, options); 48632 48633 // hook for manipulating the form data before it is extracted; 48634 // convenient for use with rich editors like tinyMCE or FCKEditor 48635 var veto = {}; 48636 this.trigger('form-pre-serialize', [this, options, veto]); 48637 if (veto.veto) { 48638 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 48639 return this; 48640 } 48641 48642 // provide opportunity to alter form data before it is serialized 48643 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { 48644 log('ajaxSubmit: submit aborted via beforeSerialize callback'); 48645 return this; 48646 } 48647 48648 var traditional = options.traditional; 48649 if ( traditional === undefined ) { 48650 traditional = $.ajaxSettings.traditional; 48651 } 48652 48653 var elements = []; 48654 var qx, a = this.formToArray(options.semantic, elements); 48655 if (options.data) { 48656 options.extraData = options.data; 48657 qx = $.param(options.data, traditional); 48658 } 48659 48660 // give pre-submit callback an opportunity to abort the submit 48661 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 48662 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 48663 return this; 48664 } 48665 48666 // fire vetoable 'validate' event 48667 this.trigger('form-submit-validate', [a, this, options, veto]); 48668 if (veto.veto) { 48669 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 48670 return this; 48671 } 48672 48673 var q = $.param(a, traditional); 48674 if (qx) { 48675 q = ( q ? (q + '&' + qx) : qx ); 48676 } 48677 if (options.type.toUpperCase() == 'GET') { 48678 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 48679 options.data = null; // data is null for 'get' 48680 } 48681 else { 48682 options.data = q; // data is the query string for 'post' 48683 } 48684 48685 var callbacks = []; 48686 if (options.resetForm) { 48687 callbacks.push(function() { $form.resetForm(); }); 48688 } 48689 if (options.clearForm) { 48690 callbacks.push(function() { $form.clearForm(options.includeHidden); }); 48691 } 48692 48693 // perform a load on the target only if dataType is not provided 48694 if (!options.dataType && options.target) { 48695 var oldSuccess = options.success || function(){}; 48696 callbacks.push(function(data) { 48697 var fn = options.replaceTarget ? 'replaceWith' : 'html'; 48698 $(options.target)[fn](data).each(oldSuccess, arguments); 48699 }); 48700 } 48701 else if (options.success) { 48702 callbacks.push(options.success); 48703 } 48704 48705 options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg 48706 var context = options.context || this ; // jQuery 1.4+ supports scope context 48707 for (var i=0, max=callbacks.length; i < max; i++) { 48708 callbacks[i].apply(context, [data, status, xhr || $form, $form]); 48709 } 48710 }; 48711 48712 if (options.error) { 48713 var oldError = options.error; 48714 options.error = function(xhr, status, error) { 48715 var context = options.context || this; 48716 oldError.apply(context, [xhr, status, error, $form]); 48717 }; 48718 } 48719 48720 if (options.complete) { 48721 var oldComplete = options.complete; 48722 options.complete = function(xhr, status) { 48723 var context = options.context || this; 48724 oldComplete.apply(context, [xhr, status, $form]); 48725 }; 48726 } 48727 48728 // are there files to upload? 48729 48730 // [value] (issue #113), also see comment: 48731 // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 48732 var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; }); 48733 48734 var hasFileInputs = fileInputs.length > 0; 48735 var mp = 'multipart/form-data'; 48736 var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); 48737 48738 var fileAPI = feature.fileapi && feature.formdata; 48739 log("fileAPI :" + fileAPI); 48740 var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; 48741 48742 var jqxhr; 48743 48744 // options.iframe allows user to force iframe mode 48745 // 06-NOV-09: now defaulting to iframe mode if file input is detected 48746 if (options.iframe !== false && (options.iframe || shouldUseFrame)) { 48747 // hack to fix Safari hang (thanks to Tim Molendijk for this) 48748 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 48749 if (options.closeKeepAlive) { 48750 $.get(options.closeKeepAlive, function() { 48751 jqxhr = fileUploadIframe(a); 48752 }); 48753 } 48754 else { 48755 jqxhr = fileUploadIframe(a); 48756 } 48757 } 48758 else if ((hasFileInputs || multipart) && fileAPI) { 48759 jqxhr = fileUploadXhr(a); 48760 } 48761 else { 48762 jqxhr = $.ajax(options); 48763 } 48764 48765 $form.removeData('jqxhr').data('jqxhr', jqxhr); 48766 48767 // clear element array 48768 for (var k=0; k < elements.length; k++) { 48769 elements[k] = null; 48770 } 48771 48772 // fire 'notify' event 48773 this.trigger('form-submit-notify', [this, options]); 48774 return this; 48775 48776 // utility fn for deep serialization 48777 function deepSerialize(extraData){ 48778 var serialized = $.param(extraData, options.traditional).split('&'); 48779 var len = serialized.length; 48780 var result = []; 48781 var i, part; 48782 for (i=0; i < len; i++) { 48783 // #252; undo param space replacement 48784 serialized[i] = serialized[i].replace(/\+/g,' '); 48785 part = serialized[i].split('='); 48786 // #278; use array instead of object storage, favoring array serializations 48787 result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); 48788 } 48789 return result; 48790 } 48791 48792 // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) 48793 function fileUploadXhr(a) { 48794 var formdata = new FormData(); 48795 48796 for (var i=0; i < a.length; i++) { 48797 formdata.append(a[i].name, a[i].value); 48798 } 48799 48800 if (options.extraData) { 48801 var serializedData = deepSerialize(options.extraData); 48802 for (i=0; i < serializedData.length; i++) { 48803 if (serializedData[i]) { 48804 formdata.append(serializedData[i][0], serializedData[i][1]); 48805 } 48806 } 48807 } 48808 48809 options.data = null; 48810 48811 var s = $.extend(true, {}, $.ajaxSettings, options, { 48812 contentType: false, 48813 processData: false, 48814 cache: false, 48815 type: method || 'POST' 48816 }); 48817 48818 if (options.uploadProgress) { 48819 // workaround because jqXHR does not expose upload property 48820 s.xhr = function() { 48821 var xhr = $.ajaxSettings.xhr(); 48822 if (xhr.upload) { 48823 xhr.upload.addEventListener('progress', function(event) { 48824 var percent = 0; 48825 var position = event.loaded || event.position; /*event.position is deprecated*/ 48826 var total = event.total; 48827 if (event.lengthComputable) {
48828 percent = Math.ceil(position / total * 100); 48829 } 48830 options.uploadProgress(event, position, total, percent); 48831 }, false); 48832 } 48833 return xhr; 48834 }; 48835 } 48836 48837 s.data = null; 48838 var beforeSend = s.beforeSend; 48839 s.beforeSend = function(xhr, o) { 48840 //Send FormData() provided by user 48841 if (options.formData) { 48842 o.data = options.formData; 48843 } 48844 else { 48845 o.data = formdata; 48846 } 48847 if(beforeSend) { 48848 beforeSend.call(this, xhr, o); 48849 } 48850 }; 48851 return $.ajax(s); 48852 } 48853 48854 // private function for handling file uploads (hat tip to YAHOO!) 48855 function fileUploadIframe(a) { 48856 var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; 48857 var deferred = $.Deferred(); 48858 48859 // #341 48860 deferred.abort = function(status) { 48861 xhr.abort(status); 48862 }; 48863 48864 if (a) { 48865 // ensure that every serialized input is still enabled 48866 for (i=0; i < elements.length; i++) { 48867 el = $(elements[i]); 48868 if ( hasProp ) { 48869 el.prop('disabled', false); 48870 } 48871 else { 48872 el.removeAttr('disabled'); 48873 } 48874 } 48875 } 48876 48877 s = $.extend(true, {}, $.ajaxSettings, options); 48878 s.context = s.context || s; 48879 id = 'jqFormIO' + (new Date().getTime()); 48880 if (s.iframeTarget) { 48881 $io = $(s.iframeTarget); 48882 n = $io.attr2('name'); 48883 if (!n) { 48884 $io.attr2('name', id); 48885 } 48886 else { 48887 id = n; 48888 } 48889 } 48890 else { 48891 $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); 48892 $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); 48893 } 48894 io = $io[0]; 48895 48896 48897 xhr = { // mock object 48898 aborted: 0, 48899 responseText: null, 48900 responseXML: null, 48901 status: 0, 48902 statusText: 'n/a', 48903 getAllResponseHeaders: function() {}, 48904 getResponseHeader: function() {}, 48905 setRequestHeader: function() {}, 48906 abort: function(status) { 48907 var e = (status === 'timeout' ? 'timeout' : 'aborted'); 48908 log('aborting upload... ' + e); 48909 this.aborted = 1; 48910 48911 try { // #214, #257 48912 if (io.contentWindow.document.execCommand) { 48913 io.contentWindow.document.execCommand('Stop'); 48914 } 48915 } 48916 catch(ignore) {} 48917 48918 $io.attr('src', s.iframeSrc); // abort op in progress 48919 xhr.error = e; 48920 if (s.error) { 48921 s.error.call(s.context, xhr, e, status); 48922 } 48923 if (g) { 48924 $.event.trigger("ajaxError", [xhr, s, e]); 48925 } 48926 if (s.complete) { 48927 s.complete.call(s.context, xhr, e); 48928 } 48929 } 48930 }; 48931 48932 g = s.global; 48933 // trigger ajax global events so that activity/block indicators work like normal 48934 if (g && 0 === $.active++) { 48935 $.event.trigger("ajaxStart"); 48936 } 48937 if (g) { 48938 $.event.trigger("ajaxSend", [xhr, s]); 48939 } 48940 48941 if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { 48942 if (s.global) { 48943 $.active--; 48944 } 48945 deferred.reject(); 48946 return deferred; 48947 } 48948 if (xhr.aborted) { 48949 deferred.reject(); 48950 return deferred; 48951 } 48952 48953 // add submitting element to data if we know it 48954 sub = form.clk; 48955 if (sub) { 48956 n = sub.name; 48957 if (n && !sub.disabled) { 48958 s.extraData = s.extraData || {}; 48959 s.extraData[n] = sub.value; 48960 if (sub.type == "image") { 48961 s.extraData[n+'.x'] = form.clk_x; 48962 s.extraData[n+'.y'] = form.clk_y; 48963 } 48964 } 48965 } 48966 48967 var CLIENT_TIMEOUT_ABORT = 1; 48968 var SERVER_ABORT = 2; 48969 48970 function getDoc(frame) { 48971 /* it looks like contentWindow or contentDocument do not 48972 * carry the protocol property in ie8, when running under ssl 48973 * frame.document is the only valid response document, since 48974 * the protocol is know but not on the other two objects. strange? 48975 * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy 48976 */ 48977 48978 var doc = null; 48979 48980 // IE8 cascading access check 48981 try { 48982 if (frame.contentWindow) { 48983 doc = frame.contentWindow.document; 48984 } 48985 } catch(err) { 48986 // IE8 access denied under ssl & missing protocol 48987 log('cannot get iframe.contentWindow document: ' + err); 48988 } 48989 48990 if (doc) { // successful getting content 48991 return doc; 48992 } 48993 48994 try { // simply checking may throw in ie8 under ssl or mismatched protocol 48995 doc = frame.contentDocument ? frame.contentDocument : frame.document; 48996 } catch(err) { 48997 // last attempt 48998 log('cannot get iframe.contentDocument: ' + err); 48999 doc = frame.document; 49000 } 49001 return doc; 49002 } 49003 49004 // Rails CSRF hack (thanks to Yvan Barthelemy) 49005 var csrf_token = $('meta[name=csrf-token]').attr('content'); 49006 var csrf_param = $('meta[name=csrf-param]').attr('content'); 49007 if (csrf_param && csrf_token) { 49008 s.extraData = s.extraData || {}; 49009 s.extraData[csrf_param] = csrf_token; 49010 } 49011 49012 // take a breath so that pending repaints get some cpu time before the upload starts 49013 function doSubmit() { 49014 // make sure form attrs are set 49015 var t = $form.attr2('target'), 49016 a = $form.attr2('action'),
49017 mp = 'multipart/form-data', 49018 et = $form.attr('enctype') || $form.attr('encoding') || mp; 49019 49020 // update form attrs in IE friendly way 49021 form.setAttribute('target',id); 49022 if (!method || /post/i.test(method) ) { 49023 form.setAttribute('method', 'POST'); 49024 } 49025 if (a != s.url) { 49026 form.setAttribute('action', s.url); 49027 } 49028 49029 // ie borks in some cases when setting encoding 49030 if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { 49031 $form.attr({ 49032 encoding: 'multipart/form-data', 49033 enctype: 'multipart/form-data' 49034 }); 49035 } 49036 49037 // support timout 49038 if (s.timeout) { 49039 timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); 49040 } 49041 49042 // look for server aborts 49043 function checkState() { 49044 try { 49045 var state = getDoc(io).readyState; 49046 log('state = ' + state); 49047 if (state && state.toLowerCase() == 'uninitialized') { 49048 setTimeout(checkState,50); 49049 } 49050 } 49051 catch(e) { 49052 log('Server abort: ' , e, ' (', e.name, ')'); 49053 cb(SERVER_ABORT); 49054 if (timeoutHandle) { 49055 clearTimeout(timeoutHandle); 49056 } 49057 timeoutHandle = undefined; 49058 } 49059 } 49060 49061 // add "extra" data to form if provided in options 49062 var extraInputs = []; 49063 try { 49064 if (s.extraData) { 49065 for (var n in s.extraData) { 49066 if (s.extraData.hasOwnProperty(n)) { 49067 // if using the $.param format that allows for multiple values with the same name 49068 if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) { 49069 extraInputs.push( 49070 $('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value) 49071 .appendTo(form)[0]); 49072 } else { 49073 extraInputs.push( 49074 $('<input type="hidden" name="'+n+'">').val(s.extraData[n]) 49075 .appendTo(form)[0]); 49076 } 49077 } 49078 } 49079 } 49080 49081 if (!s.iframeTarget) { 49082 // add iframe to doc and submit the form 49083 $io.appendTo('body'); 49084 } 49085 if (io.attachEvent) { 49086 io.attachEvent('onload', cb); 49087 } 49088 else { 49089 io.addEventListener('load', cb, false); 49090 } 49091 setTimeout(checkState,15); 49092 49093 try { 49094 form.submit(); 49095 } catch(err) { 49096 // just in case form has element with name/id of 'submit' 49097 var submitFn = document.createElement('form').submit; 49098 submitFn.apply(form); 49099 } 49100 } 49101 finally { 49102 // reset attrs and remove "extra" input elements 49103 form.setAttribute('action',a); 49104 form.setAttribute('enctype', et); // #380 49105 if(t) { 49106 form.setAttribute('target', t); 49107 } else { 49108 $form.removeAttr('target'); 49109 } 49110 $(extraInputs).remove(); 49111 } 49112 } 49113 49114 if (s.forceSync) { 49115 doSubmit(); 49116 } 49117 else { 49118 setTimeout(doSubmit, 10); // this lets dom updates render 49119 } 49120 49121 var data, doc, domCheckCount = 50, callbackProcessed; 49122 49123 function cb(e) { 49124 if (xhr.aborted || callbackProcessed) { 49125 return; 49126 } 49127 49128 doc = getDoc(io); 49129 if(!doc) { 49130 log('cannot access response document'); 49131 e = SERVER_ABORT; 49132 } 49133 if (e === CLIENT_TIMEOUT_ABORT && xhr) { 49134 xhr.abort('timeout'); 49135 deferred.reject(xhr, 'timeout'); 49136 return; 49137 } 49138 else if (e == SERVER_ABORT && xhr) { 49139 xhr.abort('server abort'); 49140 deferred.reject(xhr, 'error', 'server abort'); 49141 return; 49142 } 49143 49144 if (!doc || doc.location.href == s.iframeSrc) { 49145 // response not received yet 49146 if (!timedOut) { 49147 return; 49148 } 49149 } 49150 if (io.detachEvent) { 49151 io.detachEvent('onload', cb); 49152 } 49153 else { 49154 io.removeEventListener('load', cb, false); 49155 } 49156 49157 var status = 'success', errMsg; 49158 try { 49159 if (timedOut) { 49160 throw 'timeout'; 49161 } 49162 49163 var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); 49164 log('isXml='+isXml); 49165 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) { 49166 if (--domCheckCount) { 49167 // in some browsers (Opera) the iframe DOM is not always traversable when 49168 // the onload callback fires, so we loop a bit to accommodate 49169 log('requeing onLoad callback, DOM not available'); 49170 setTimeout(cb, 250); 49171 return; 49172 } 49173 // let this fall through because server response could be an empty document 49174 //log('Could not access iframe DOM after mutiple tries.'); 49175 //throw 'DOMException: not available'; 49176 } 49177 49178 //log('response detected'); 49179 var docRoot = doc.body ? doc.body : doc.documentElement; 49180 xhr.responseText = docRoot ? docRoot.innerHTML : null; 49181 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 49182 if (isXml) { 49183 s.dataType = 'xml'; 49184 } 49185 xhr.getResponseHeader = function(header){ 49186 var headers = {'content-type': s.dataType}; 49187 return headers[header.toLowerCase()]; 49188 }; 49189 // support for XHR 'status' & 'statusText' emulation : 49190 if (docRoot) { 49191 xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; 49192 xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; 49193 } 49194 49195 var dt = (s.dataType || '').toLowerCase(); 49196 var scr = /(json|script|text)/.test(dt); 49197 if (scr || s.textarea) { 49198 // see if user embedded response in textarea 49199 var ta = doc.getElementsByTagName('textarea')[0]; 49200 if (ta) { 49201 xhr.responseText = ta.value; 49202 // support for XHR 'status' & 'statusText' emulation : 49203 xhr.status = Number( ta.getAttribute('status') ) || xhr.status; 49204 xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; 49205 } 49206 else if (scr) { 49207 // account for browsers injecting pre around json response 49208 var pre = doc.getElementsByTagName('pre')[0]; 49209 var b = doc.getElementsByTagName('body')[0]; 49210 if (pre) { 49211 xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; 49212 } 49213 else if (b) { 49214 xhr.responseText = b.textContent ? b.textContent : b.innerText; 49215 } 49216 } 49217 } 49218 else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) { 49219 xhr.responseXML = toXml(xhr.responseText); 49220 } 49221 49222 try { 49223 data = httpData(xhr, dt, s); 49224 } 49225 catch (err) { 49226 status = 'parsererror'; 49227 xhr.error = errMsg = (err || status); 49228 } 49229 } 49230 catch (err) { 49231 log('error caught: ',err); 49232 status = 'error'; 49233 xhr.error = errMsg = (err || status); 49234 } 49235 49236 if (xhr.aborted) { 49237 log('upload aborted'); 49238 status = null; 49239 } 49240 49241 if (xhr.status) { // we've set xhr.status 49242 status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; 49243 } 49244 49245 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 49246 if (status === 'success') { 49247 if (s.success) { 49248 s.success.call(s.context, data, 'success', xhr); 49249 } 49250 deferred.resolve(xhr.responseText, 'success', xhr); 49251 if (g) { 49252 $.event.trigger("ajaxSuccess", [xhr, s]); 49253 } 49254 } 49255 else if (status) { 49256 if (errMsg === undefined) { 49257 errMsg = xhr.statusText; 49258 } 49259 if (s.error) { 49260 s.error.call(s.context, xhr, status, errMsg); 49261 } 49262 deferred.reject(xhr, 'error', errMsg); 49263 if (g) { 49264 $.event.trigger("ajaxError", [xhr, s, errMsg]); 49265 } 49266 } 49267 49268 if (g) {
49269 $.event.trigger("ajaxComplete", [xhr, s]); 49270 } 49271 49272 if (g && ! --$.active) { 49273 $.event.trigger("ajaxStop"); 49274 } 49275 49276 if (s.complete) { 49277 s.complete.call(s.context, xhr, status); 49278 } 49279 49280 callbackProcessed = true; 49281 if (s.timeout) { 49282 clearTimeout(timeoutHandle); 49283 } 49284 49285 // clean up 49286 setTimeout(function() { 49287 if (!s.iframeTarget) { 49288 $io.remove(); 49289 } 49290 else { //adding else to clean up existing iframe response. 49291 $io.attr('src', s.iframeSrc); 49292 } 49293 xhr.responseXML = null; 49294 }, 100); 49295 } 49296 49297 var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) 49298 if (window.ActiveXObject) { 49299 doc = new ActiveXObject('Microsoft.XMLDOM'); 49300 doc.async = 'false'; 49301 doc.loadXML(s); 49302 } 49303 else { 49304 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 49305 } 49306 return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; 49307 }; 49308 var parseJSON = $.parseJSON || function(s) { 49309 /*jslint evil:true */ 49310 return window['eval']('(' + s + ')'); 49311 }; 49312 49313 var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 49314 49315 var ct = xhr.getResponseHeader('content-type') || '', 49316 xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, 49317 data = xml ? xhr.responseXML : xhr.responseText; 49318 49319 if (xml && data.documentElement.nodeName === 'parsererror') { 49320 if ($.error) { 49321 $.error('parsererror'); 49322 } 49323 } 49324 if (s && s.dataFilter) { 49325 data = s.dataFilter(data, type); 49326 } 49327 if (typeof data === 'string') { 49328 if (type === 'json' || !type && ct.indexOf('json') >= 0) { 49329 data = parseJSON(data); 49330 } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { 49331 $.globalEval(data); 49332 } 49333 } 49334 return data; 49335 }; 49336 49337 return deferred; 49338 } 49339}; 49340 49341/** 49342 * ajaxForm() provides a mechanism for fully automating form submission. 49343 * 49344 * The advantages of using this method instead of ajaxSubmit() are: 49345 * 49346 * 1: This method will include coordinates for <input type="image" /> elements (if the element 49347 * is used to submit the form). 49348 * 2. This method will include the submit element's name/value data (for the element that was 49349 * used to submit the form). 49350 * 3. This method binds the submit() method to the form for you. 49351 * 49352 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 49353 * passes the options argument along after properly binding events for submit elements and 49354 * the form itself. 49355 */ 49356$.fn.ajaxForm = function(options) { 49357 options = options || {}; 49358 options.delegation = options.delegation && $.isFunction($.fn.on); 49359 49360 // in jQuery 1.3+ we can fix mistakes with the ready state 49361 if (!options.delegation && this.length === 0) { 49362 var o = { s: this.selector, c: this.context }; 49363 if (!$.isReady && o.s) { 49364 log('DOM not ready, queuing ajaxForm'); 49365 $(function() { 49366 $(o.s,o.c).ajaxForm(options); 49367 }); 49368 return this; 49369 } 49370 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 49371 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 49372 return this; 49373 } 49374 49375 if ( options.delegation ) { 49376 $(document) 49377 .off('submit.form-plugin', this.selector, doAjaxSubmit) 49378 .off('click.form-plugin', this.selector, captureSubmittingElement) 49379 .on('submit.form-plugin', this.selector, options, doAjaxSubmit) 49380 .on('click.form-plugin', this.selector, options, captureSubmittingElement); 49381 return this; 49382 } 49383 49384 return this.ajaxFormUnbind() 49385 .bind('submit.form-plugin', options, doAjaxSubmit) 49386 .bind('click.form-plugin', options, captureSubmittingElement); 49387}; 49388 49389// private event handlers 49390function doAjaxSubmit(e) { 49391 /*jshint validthis:true */ 49392 var options = e.data; 49393 if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed 49394 e.preventDefault(); 49395 $(e.target).ajaxSubmit(options); // #365 49396 } 49397} 49398 49399function captureSubmittingElement(e) { 49400 /*jshint validthis:true */ 49401 var target = e.target; 49402 var $el = $(target); 49403 if (!($el.is("[type=submit],[type=image]"))) { 49404 // is this a child element of the submit el? (ex: a span within a button) 49405 var t = $el.closest('[type=submit]'); 49406 if (t.length === 0) { 49407 return; 49408 } 49409 target = t[0]; 49410 } 49411 var form = this; 49412 form.clk = target; 49413 if (target.type == 'image') { 49414 if (e.offsetX !== undefined) { 49415 form.clk_x = e.offsetX; 49416 form.clk_y = e.offsetY; 49417 } else if (typeof $.fn.offset == 'function') { 49418 var offset = $el.offset(); 49419 form.clk_x = e.pageX - offset.left; 49420 form.clk_y = e.pageY - offset.top; 49421 } else { 49422 form.clk_x = e.pageX - target.offsetLeft; 49423 form.clk_y = e.pageY - target.offsetTop; 49424 } 49425 } 49426 // clear form vars 49427 setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); 49428} 49429 49430 49431// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 49432$.fn.ajaxFormUnbind = function() { 49433 return this.unbind('submit.form-plugin click.form-plugin'); 49434}; 49435 49436/** 49437 * formToArray() gathers form element data into an array of objects that can 49438 * be passed to any of the following ajax functions: $.get, $.post, or load. 49439 * Each object in the array has both a 'name' and 'value' property. An example of 49440 * an array for a simple login form might be: 49441 * 49442 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 49443 * 49444 * It is this array that is passed to pre-submit callback functions provided to the 49445 * ajaxSubmit() and ajaxForm() methods. 49446 */ 49447$.fn.formToArray = function(semantic, elements) { 49448 var a = []; 49449 if (this.length === 0) { 49450 return a; 49451 } 49452 49453 var form = this[0]; 49454 var formId = this.attr('id'); 49455 var els = semantic ? form.getElementsByTagName('*') : form.elements; 49456 var els2; 49457 49458 if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390 49459 els = $(els).get(); // convert to standard array 49460 } 49461 49462 // #386; account for inputs outside the form which use the 'form' attribute 49463 if ( formId ) { 49464 els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet 49465 if ( els2.length ) { 49466 els = (els || []).concat(els2); 49467 } 49468 } 49469 49470 if (!els || !els.length) { 49471 return a; 49472 } 49473 49474 var i,j,n,v,el,max,jmax; 49475 for(i=0, max=els.length; i < max; i++) { 49476 el = els[i]; 49477 n = el.name; 49478 if (!n || el.disabled) { 49479 continue; 49480 } 49481 49482 if (semantic && form.clk && el.type == "image") { 49483 // handle image inputs on the fly when semantic == true 49484 if(form.clk == el) { 49485 a.push({name: n, value: $(el).val(), type: el.type }); 49486 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 49487 } 49488 continue; 49489 } 49490 49491 v = $.fieldValue(el, true); 49492 if (v && v.constructor == Array) { 49493 if (elements) { 49494 elements.push(el); 49495 } 49496 for(j=0, jmax=v.length; j < jmax; j++) { 49497 a.push({name: n, value: v[j]}); 49498 } 49499 } 49500 else if (feature.fileapi && el.type == 'file') { 49501 if (elements) { 49502 elements.push(el); 49503 } 49504 var files = el.files; 49505 if (files.length) { 49506 for (j=0; j < files.length; j++) { 49507 a.push({name: n, value: files[j], type: el.type}); 49508 } 49509 } 49510 else { 49511 // #180 49512 a.push({ name: n, value: '', type: el.type }); 49513 } 49514 } 49515 else if (v !== null && typeof v != 'undefined') { 49516 if (elements) { 49517 elements.push(el); 49518 } 49519 a.push({name: n, value: v, type: el.type, required: el.required}); 49520 } 49521 } 49522 49523 if (!semantic && form.clk) { 49524 // input type=='image' are not found in elements array! handle it here 49525 var $input = $(form.clk), input = $input[0]; 49526 n = input.name; 49527 if (n && !input.disabled && input.type == 'image') { 49528 a.push({name: n, value: $input.val()}); 49529 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 49530 } 49531 } 49532 return a; 49533}; 49534 49535/** 49536 * Serializes form data into a 'submittable' string. This method will return a string 49537 * in the format: name1=value1&name2=value2 49538 */
49539$.fn.formSerialize = function(semantic) { 49540 //hand off to jQuery.param for proper encoding 49541 return $.param(this.formToArray(semantic)); 49542}; 49543 49544/** 49545 * Serializes all field elements in the jQuery object into a query string. 49546 * This method will return a string in the format: name1=value1&name2=value2 49547 */ 49548$.fn.fieldSerialize = function(successful) { 49549 var a = []; 49550 this.each(function() { 49551 var n = this.name; 49552 if (!n) { 49553 return; 49554 } 49555 var v = $.fieldValue(this, successful); 49556 if (v && v.constructor == Array) { 49557 for (var i=0,max=v.length; i < max; i++) { 49558 a.push({name: n, value: v[i]}); 49559 } 49560 } 49561 else if (v !== null && typeof v != 'undefined') { 49562 a.push({name: this.name, value: v}); 49563 } 49564 }); 49565 //hand off to jQuery.param for proper encoding 49566 return $.param(a); 49567}; 49568 49569/** 49570 * Returns the value(s) of the element in the matched set. For example, consider the following form: 49571 * 49572 * <form><fieldset> 49573 * <input name="A" type="text" /> 49574 * <input name="A" type="text" /> 49575 * <input name="B" type="checkbox" value="B1" /> 49576 * <input name="B" type="checkbox" value="B2"/> 49577 * <input name="C" type="radio" value="C1" /> 49578 * <input name="C" type="radio" value="C2" /> 49579 * </fieldset></form> 49580 * 49581 * var v = $('input[type=text]').fieldValue(); 49582 * // if no values are entered into the text inputs 49583 * v == ['',''] 49584 * // if values entered into the text inputs are 'foo' and 'bar' 49585 * v == ['foo','bar'] 49586 * 49587 * var v = $('input[type=checkbox]').fieldValue(); 49588 * // if neither checkbox is checked 49589 * v === undefined 49590 * // if both checkboxes are checked 49591 * v == ['B1', 'B2'] 49592 * 49593 * var v = $('input[type=radio]').fieldValue(); 49594 * // if neither radio is checked 49595 * v === undefined 49596 * // if first radio is checked 49597 * v == ['C1'] 49598 * 49599 * The successful argument controls whether or not the field element must be 'successful' 49600 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 49601 * The default value of the successful argument is true. If this value is false the value(s) 49602 * for each element is returned. 49603 * 49604 * Note: This method *always* returns an array. If no valid value can be determined the 49605 * array will be empty, otherwise it will contain one or more values. 49606 */ 49607$.fn.fieldValue = function(successful) { 49608 for (var val=[], i=0, max=this.length; i < max; i++) { 49609 var el = this[i]; 49610 var v = $.fieldValue(el, successful); 49611 if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { 49612 continue; 49613 } 49614 if (v.constructor == Array) { 49615 $.merge(val, v); 49616 } 49617 else { 49618 val.push(v); 49619 } 49620 } 49621 return val; 49622}; 49623 49624/** 49625 * Returns the value of the field element. 49626 */ 49627$.fieldValue = function(el, successful) { 49628 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 49629 if (successful === undefined) { 49630 successful = true; 49631 } 49632 49633 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || 49634 (t == 'checkbox' || t == 'radio') && !el.checked || 49635 (t == 'submit' || t == 'image') && el.form && el.form.clk != el || 49636 tag == 'select' && el.selectedIndex == -1)) { 49637 return null; 49638 } 49639 49640 if (tag == 'select') { 49641 var index = el.selectedIndex; 49642 if (index < 0) { 49643 return null; 49644 } 49645 var a = [], ops = el.options; 49646 var one = (t == 'select-one'); 49647 var max = (one ? index+1 : ops.length); 49648 for(var i=(one ? index : 0); i < max; i++) { 49649 var op = ops[i]; 49650 if (op.selected) { 49651 var v = op.value; 49652 if (!v) { // extra pain for IE... 49653 v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value; 49654 } 49655 if (one) { 49656 return v; 49657 } 49658 a.push(v); 49659 } 49660 } 49661 return a; 49662 } 49663 return $(el).val(); 49664}; 49665 49666/** 49667 * Clears the form data. Takes the following actions on the form's input fields: 49668 * - input text fields will have their 'value' property set to the empty string 49669 * - select elements will have their 'selectedIndex' property set to -1 49670 * - checkbox and radio inputs will have their 'checked' property set to false 49671 * - inputs of type submit, button, reset, and hidden will *not* be effected 49672 * - button elements will *not* be effected 49673 */ 49674$.fn.clearForm = function(includeHidden) { 49675 return this.each(function() { 49676 $('input,select,textarea', this).clearFields(includeHidden); 49677 }); 49678}; 49679 49680/** 49681 * Clears the selected form elements. 49682 */ 49683$.fn.clearFields = $.fn.clearInputs = function(includeHidden) { 49684 var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list 49685 return this.each(function() { 49686 var t = this.type, tag = this.tagName.toLowerCase(); 49687 if (re.test(t) || tag == 'textarea') { 49688 this.value = ''; 49689 } 49690 else if (t == 'checkbox' || t == 'radio') { 49691 this.checked = false;
49692 } 49693 else if (tag == 'select') { 49694 this.selectedIndex = -1; 49695 } 49696 else if (t == "file") { 49697 if (/MSIE/.test(navigator.userAgent)) { 49698 $(this).replaceWith($(this).clone(true)); 49699 } else { 49700 $(this).val(''); 49701 } 49702 } 49703 else if (includeHidden) { 49704 // includeHidden can be the value true, or it can be a selector string 49705 // indicating a special test; for example: 49706 // $('#myForm').clearForm('.special:hidden') 49707 // the above would clean hidden inputs that have the class of 'special' 49708 if ( (includeHidden === true && /hidden/.test(t)) || 49709 (typeof includeHidden == 'string' && $(this).is(includeHidden)) ) { 49710 this.value = ''; 49711 } 49712 } 49713 }); 49714}; 49715 49716/** 49717 * Resets the form data. Causes all form elements to be reset to their original value. 49718 */ 49719$.fn.resetForm = function() { 49720 return this.each(function() { 49721 // guard against an input with the name of 'reset' 49722 // note that IE reports the reset function as an 'object' 49723 if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { 49724 this.reset(); 49725 } 49726 }); 49727}; 49728 49729/** 49730 * Enables or disables any matching elements. 49731 */ 49732$.fn.enable = function(b) { 49733 if (b === undefined) { 49734 b = true; 49735 } 49736 return this.each(function() { 49737 this.disabled = !b; 49738 }); 49739}; 49740 49741/** 49742 * Checks/unchecks any matching checkboxes or radio buttons and 49743 * selects/deselects and matching option elements. 49744 */ 49745$.fn.selected = function(select) { 49746 if (select === undefined) { 49747 select = true; 49748 } 49749 return this.each(function() { 49750 var t = this.type; 49751 if (t == 'checkbox' || t == 'radio') { 49752 this.checked = select; 49753 } 49754 else if (this.tagName.toLowerCase() == 'option') { 49755 var $sel = $(this).parent('select'); 49756 if (select && $sel[0] && $sel[0].type == 'select-one') { 49757 // deselect all other options 49758 $sel.find('option').selected(false); 49759 } 49760 this.selected = select; 49761 } 49762 }); 49763}; 49764 49765// expose debug var 49766$.fn.ajaxSubmit.debug = false; 49767 49768// helper fn for console logging 49769function log() { 49770 if (!$.fn.ajaxSubmit.debug) { 49771 return; 49772 } 49773 var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); 49774 if (window.console && window.console.log) { 49775 window.console.log(msg); 49776 } 49777 else if (window.opera && window.opera.postError) { 49778 window.opera.postError(msg); 49779 } 49780} 49781 49782})); 49783(function() { 49784 var landlordcheck; 49785 49786 landlordcheck = { 49787 setupForm: function() { 49788 return $('#new_landlordcheck').submit(function() { 49789 $('input[type=submit]').attr('disabled', true); 49790 if ($('#card_number').length) { 49791 landlordcheck.processCard(); 49792 return false; 49793 } else { 49794 return true; 49795 } 49796 }); 49797 }, 49798 processCard: function() { 49799 var card; 49800 card = { 49801 number: $('#card_number').val(), 49802 cvc: $('#card_code').val(), 49803 expMonth: $('#card_month').val(), 49804 expYear: $('#card_year').val() 49805 }; 49806 return Stripe.createToken(card, landlordcheck.handleStripeResponse); 49807 }, 49808 handleStripeResponse: function(status, response) { 49809 if (status === 200) { 49810 $('#landlordcheck_stripeToken').val(response.id); 49811 return $('#new_landlordcheck')[0].submit(); 49812 } else { 49813 $('#stripe_error').text(response.error.message); 49814 return $('input[type=submit]').attr('disabled', false); 49815 } 49816 } 49817 }; 49818 49819}).call(this); 49820(function() { 49821 var landlordcheck; 49822 49823 jQuery(function() { 49824 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 49825 return landlordcheck.setupForm(); 49826 }); 49827 49828 landlordcheck = { 49829 setupForm: function() { 49830 return $('#new_landlordcheck').submit(function() { 49831 $('input[type=submit]').attr('disabled', true); 49832 if ($('#card_number').length) { 49833 landlordcheck.processCard(); 49834 return false;
49835 } else { 49836 return true; 49837 } 49838 }); 49839 }, 49840 processCard: function() { 49841 var card; 49842 card = { 49843 number: $('#card_number').val(), 49844 cvc: $('#card_code').val(), 49845 expMonth: $('#card_month').val(), 49846 expYear: $('#card_year').val() 49847 }; 49848 return Stripe.createToken(card, landlordcheck.handleStripeResponse); 49849 }, 49850 handleStripeResponse: function(status, response) { 49851 if (status === 200) { 49852 $("#process").html("Processing payment"); 49853 $('#landlordcheck_stripeToken').val(response.id); 49854 $('#new_landlordcheck')[0].submit(); 49855 } else { 49856 49857 } 49858 if ($('#whopays').val() === 'Landlord') { 49859 $('#new_landlordcheck')[0].submit(); 49860 } else { 49861 49862 } 49863 if ($('#whopays').val() === 'Paypal') { 49864 return $('#new_landlordcheck')[0].submit(); 49865 } else { 49866 $('#stripe_error').text(response.error.message); 49867 return $('input[type=submit]').attr('disabled', false); 49868 } 49869 } 49870 }; 49871 49872}).call(this); 49873(function() { 49874 var $confirm; 49875 49876 $confirm = null; 49877 49878 $(function() { 49879 var $createDestroy, $window, sectionTop; 49880 $window = $(window); 49881 sectionTop = $(".top").outerHeight() + 20; 49882 $createDestroy = $("#switch-create-destroy"); 49883 hljs.initHighlightingOnLoad(); 49884 $("a[href*=\"#\"]").on("click", function(event) { 49885 var $target; 49886 event.preventDefault(); 49887 $target = $($(this).attr("href").slice("#")); 49888 if ($target.length) { 49889 return $window.scrollTop($target.offset().top - sectionTop); 49890 } 49891 }); 49892 $("input[type=\"checkbox\"], input[type=\"radio\"]").not("[data-switch-no-init]").bootstrapSwitch(); 49893 $("[data-switch-get]").on("click", function() { 49894 var type; 49895 type = $(this).data("switch-get"); 49896 return alert($("#switch-" + type).bootstrapSwitch(type)); 49897 }); 49898 $("[data-switch-set]").on("click", function() { 49899 var type; 49900 type = $(this).data("switch-set"); 49901 return $("#switch-" + type).bootstrapSwitch(type, $(this).data("switch-value")); 49902 }); 49903 $("[data-switch-toggle]").on("click", function() { 49904 var type; 49905 type = $(this).data("switch-toggle"); 49906 return $("#switch-" + type).bootstrapSwitch("toggle" + type.charAt(0).toUpperCase() + type.slice(1)); 49907 }); 49908 $("[data-switch-set-value]").on("input", function(event) { 49909 var type, value; 49910 event.preventDefault(); 49911 type = $(this).data("switch-set-value"); 49912 value = $.trim($(this).val()); 49913 if ($(this).data("value") === value) { 49914 return; 49915 } 49916 return $("#switch-" + type).bootstrapSwitch(type, value); 49917 }); 49918 $("[data-switch-create-destroy]").on("click", function() { 49919 var isSwitch; 49920 isSwitch = $createDestroy.data("bootstrap-switch"); 49921 $createDestroy.bootstrapSwitch((isSwitch ? "destroy" : null)); 49922 return $(this).button((isSwitch ? "reset" : "destroy")); 49923 }); 49924 return $confirm = $("#confirm").bootstrapSwitch({ 49925 size: "large", 49926 onSwitchChange: function(event, state) { 49927 event.preventDefault(); 49928 return console.log(state, event.isDefaultPrevented()); 49929 } 49930 }); 49931 }); 49932 49933}).call(this); 49934(function() { 49935 49936 49937}).call(this); 49938/* 49939 jQuery Masked Input Plugin 49940 Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com) 49941 Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 49942 Version: 1.4.1 49943*/ 49944 49945!function(factory) { 49946 "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery); 49947}(function($) { 49948 var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua); 49949 $.mask = { 49950 definitions: { 49951 "@": "[0-1]", 49952 "^": "[0-3]", 49953 "â¬": "[9-9]", 49954 "£": "[1-1]", 49955 "$": "[0-9]", 49956 a: "[A-Za-z]", 49957 "*": "[A-Za-z0-9]" 49958 }, 49959 autoclear: !0, 49960 dataName: "rawMaskFn", 49961 placeholder: "_" 49962 }, $.fn.extend({ 49963 caret: function(begin, end) { 49964 var range; 49965 if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin, 49966 this.each(function() { 49967 this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(), 49968 range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin), 49969 range.select()); 49970 })) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(), 49971 begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length), 49972 { 49973 begin: begin, 49974 end: end 49975 }); 49976 }, 49977 unmask: function() { 49978 return this.trigger("unmask"); 49979 }, 49980 mask: function(mask, settings) { 49981 var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal; 49982 if (!mask && this.length > 0) { 49983 input = $(this[0]); 49984 var fn = input.data($.mask.dataName); 49985 return fn ? fn() : void 0; 49986 } 49987 return settings = $.extend({ 49988 autoclear: $.mask.autoclear, 49989 placeholder: $.mask.placeholder, 49990 completed: null 49991 }, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length, 49992 firstNonMaskPos = null, $.each(mask.split(""), function(i, c) { 49993 "?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])), 49994 null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null); 49995 }), this.trigger("unmask").each(function() { 49996 function tryFireCompleted() { 49997 if (settings.completed) { 49998 for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return; 49999 settings.completed.call(input); 50000 } 50001 } 50002 function getPlaceholder(i) { 50003 return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0); 50004 } 50005 function seekNext(pos) { 50006 for (;++pos < len && !tests[pos]; ) ; 50007 return pos; 50008 } 50009 function seekPrev(pos) { 50010 for (;
50010--pos >= 0 && !tests[pos]; ) ; 50011 return pos; 50012 } 50013 function shiftL(begin, end) { 50014 var i, j; 50015 if (!(0 > begin)) { 50016 for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) { 50017 if (!(len > j && tests[i].test(buffer[j]))) break; 50018 buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j); 50019 } 50020 writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin)); 50021 } 50022 } 50023 function shiftR(pos) { 50024 var i, c, j, t; 50025 for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) { 50026 if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break; 50027 c = t; 50028 } 50029 } 50030 function androidInputEvent() { 50031 var curVal = input.val(), pos = input.caret(); 50032 if (oldVal && oldVal.length && oldVal.length > curVal.length) { 50033 for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--; 50034 if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++; 50035 input.caret(pos.begin, pos.begin); 50036 } else { 50037 for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++; 50038 input.caret(pos.begin, pos.begin); 50039 } 50040 tryFireCompleted(); 50041 } 50042 function blurEvent() { 50043 checkVal(), input.val() != focusText && input.change(); 50044 } 50045 function keydownEvent(e) { 50046 if (!input.prop("readonly")) { 50047 var pos, begin, end, k = e.which || e.keyCode; 50048 oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(), 50049 begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1), 50050 end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1), 50051 e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText), 50052 input.caret(0, checkVal()), e.preventDefault()); 50053 } 50054 } 50055 function keypressEvent(e) { 50056 if (!input.prop("readonly")) { 50057 var p, c, next, k = e.which || e.keyCode, pos = input.caret(); 50058 if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) { 50059 if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)), 50060 p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) { 50061 if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) { 50062 var proxy = function() { 50063 $.proxy($.fn.caret, input, next)(); 50064 }; 50065 setTimeout(proxy, 0); 50066 } else input.caret(next); 50067 pos.begin <= lastRequiredNonMaskPos && tryFireCompleted(); 50068 } 50069 e.preventDefault(); 50070 } 50071 } 50072 } 50073 function clearBuffer(start, end) { 50074 var i; 50075 for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i)); 50076 } 50077 function writeBuffer() { 50078 input.val(buffer.join("")); 50079 } 50080 function checkVal(allow) { 50081 var i, c, pos, test = input.val(), lastMatch = -1; 50082 for (i = 0, pos = 0; len > i; i++) if (tests[i]) { 50083 for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1), 50084 tests[i].test(c)) { 50085 buffer[i] = c, lastMatch = i; 50086 break; 50087 } 50088 if (pos > test.length) { 50089 clearBuffer(i + 1, len); 50090 break; 50091 } 50092 } else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i); 50093 return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""), 50094 clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))), 50095 partialPosition ? i : firstNonMaskPos; 50096 } 50097 var input = $(this), buffer = $.map(mask.split(""), function(c, i) { 50098 return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0; 50099 }), defaultBuffer = buffer.join(""), focusText = input.val(); 50100 input.data($.mask.dataName, function() { 50101 return $.map(buffer, function(c, i) { 50102 return tests[i] && c != getPlaceholder(i) ? c : null; 50103 }).join(""); 50104 }), input.one("unmask", function() { 50105 input.off(".mask").removeData($.mask.dataName); 50106 }).on("focus.mask", function() { 50107 if (!input.prop("readonly")) { 50108 clearTimeout(caretTimeoutId); 50109 var pos; 50110 focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() { 50111 input.get(0) === document.activeElement && (writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos)); 50112 }, 10); 50113 } 50114 }).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() { 50115 input.prop("readonly") || setTimeout(function() { 50116 var pos = checkVal(!0);
50117 input.caret(pos), tryFireCompleted(); 50118 }, 0); 50119 }), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent), 50120 checkVal(); 50121 }); 50122 } 50123 }); 50124}); 50125(function() { 50126 var pathway; 50127 50128 jQuery(function() { 50129 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50130 return pathway.setupForm(); 50131 }); 50132 50133 pathway = { 50134 setupForm: function() { 50135 return $('#payment_pathway').submit(function() { 50136 $('input[type=submit]').attr('disabled', true); 50137 if ($('#card_number').length) { 50138 pathway.processCard(); 50139 return false; 50140 } else { 50141 return true; 50142 } 50143 }); 50144 }, 50145 processCard: function() { 50146 var card; 50147 card = { 50148 number: $('#card_number').val(), 50149 cvc: $('#card_code').val(), 50150 expMonth: $('#card_month').val(), 50151 expYear: $('#card_year').val() 50152 }; 50153 return Stripe.createToken(card, pathway.handleStripeResponse); 50154 }, 50155 handleStripeResponse: function(status, response) { 50156 if (status === 200) { 50157 $("#process").html("Processing payment"); 50158 $('#pathway_stripeToken').val(response.id); 50159 return $('#payment_pathway')[0].submit(); 50160 } else { 50161 $('#stripe_error').text(response.error.message); 50162 return $('input[type=submit]').attr('disabled', false); 50163 } 50164 } 50165 }; 50166 50167}).call(this); 50168(function() { 50169 50170 50171}).call(this); 50172(function() { 50173 50174 50175}).call(this); 50176 var fields = [ 50177 { element: "prop", field: "Label" }, 50178 { element: "label", field: "Label" }, 50179 { element: "pcaid", field: "Id" }, 50180 { element: "line1", field: "Line1" }, 50181 { element: "line2", field: "Line2", mode: pca.fieldMode.POPULATE }, 50182 { element: "city", field: "City", mode: pca.fieldMode.POPULATE }, 50183 { element: "state", field: "ProvinceName", mode: pca.fieldMode.POPULATE }, 50184 { element: "postcode", field: "PostalCode" }, 50185 { element: "country", field: "CountryName", mode: pca.fieldMode.COUNTRY }, 50186 ], 50187 options = { 50188 key: "MB12-WN43-BF83-JR71" 50189 }, 50190 control = new pca.Address(fields, options); 50191 50192 control.listen("load", function() { 50193 control.setCountry("GBR"); 50194 50195 }); 50196(function() { 50197 var payment; 50198 50199 jQuery(function() { 50200 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50201 return payment.setupForm(); 50202 }); 50203 50204 payment = { 50205 setupForm: function() { 50206 return $('#new_payment').submit(function() { 50207 $('input[type=submit]').attr('disabled', true); 50208 if ($('#card_number').length) { 50209 payment.processCard(); 50210 return false; 50211 } else { 50212 return true; 50213 } 50214 }); 50215 }, 50216 processCard: function() { 50217 var card; 50218 card = { 50219 number: $('#card_number').val(), 50220 cvc: $('#card_code').val(), 50221 expMonth: $('#card_month').val(), 50222 expYear: $('#card_year').val() 50223 }; 50224 return Stripe.createToken(card, payment.handleStripeResponse); 50225 }, 50226 handleStripeResponse: function(status, response) { 50227 if (status === 200) { 50228 $("#process").html("Processing payment"); 50229 $('#payment_stripeToken').val(response.id); 50230 $('#new_payment')[0].submit(); 50231 } else { 50232 50233 } 50234 if ($('#whopays').val() === 'Landlord') { 50235 $('#new_payment')[0].submit(); 50236 } else { 50237 50238 } 50239 if ($('#whopays').val() === 'Paypal') { 50240 return $('#new_payment')[0].submit(); 50241 } else { 50242 $('#stripe_error').text(response.error.message); 50243 return $('input[type=submit]').attr('disabled', false); 50244 } 50245 } 50246 }; 50247 50248}).call(this); 50249(function() { 50250 var renter; 50251 50252 jQuery(function() { 50253 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50254 return renter.setupForm(); 50255 }); 50256 50257 renter = { 50258 setupForm: function() { 50259 return $('#edit_renter').submit(function() { 50260 $('input[type=submit]').attr('disabled', true); 50261 if ($('#card_number').length) { 50262 renter.processCard(); 50263 return false;
50264 } else { 50265 return true; 50266 } 50267 }); 50268 }, 50269 processCard: function() { 50270 var card; 50271 card = { 50272 number: $('#card_number').val(), 50273 cvc: $('#card_code').val(), 50274 expMonth: $('#card_month').val(), 50275 expYear: $('#card_year').val() 50276 }; 50277 return Stripe.createToken(card, renter.handleStripeResponse); 50278 }, 50279 handleStripeResponse: function(status, response) { 50280 if (status === 200) { 50281 $('#renter_stripeToken').val(response.id); 50282 $('#edit_renter')[0].submit(); 50283 } else { 50284 50285 } 50286 if ($('#paylater').val() === "I've transferred the payment") { 50287 $('#edit_renter')[0].submit(); 50288 } else { 50289 50290 } 50291 if ($('#paylater').val() === "I'll transfer the payment later") { 50292 $('#edit_renter')[0].submit(); 50293 } else { 50294 50295 } 50296 if ($('#paylater').val() === 'Paypal') { 50297 return $('#edit_renter')[0].submit(); 50298 } else { 50299 $('#stripe_error').text(response.error.message); 50300 return $('input[type=submit]').attr('disabled', false); 50301 } 50302 } 50303 }; 50304 50305}).call(this); 50306(function() { 50307 var renter; 50308 50309 jQuery(function() { 50310 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50311 return renter.setupForm(); 50312 }); 50313 50314 renter = { 50315 setupForm: function() { 50316 return $('#new_renter').submit(function() { 50317 $('input[type=submit]').attr('disabled', true); 50318 if ($('#card_number').length) { 50319 renter.processCard(); 50320 return false; 50321 } else { 50322 return true; 50323 } 50324 }); 50325 }, 50326 processCard: function() { 50327 var card; 50328 card = { 50329 number: $('#card_number').val(), 50330 cvc: $('#card_code').val(), 50331 expMonth: $('#card_month').val(), 50332 expYear: $('#card_year').val() 50333 }; 50334 return Stripe.createToken(card, renter.handleStripeResponse); 50335 }, 50336 handleStripeResponse: function(status, response) { 50337 if (status === 200) { 50338 $('#renter_stripeToken').val(response.id); 50339 $('#new_renter')[0].submit(); 50340 } else { 50341 50342 } 50343 if ($('#paylater').val() === "I've transferred the payment") { 50344 $('#new_renter')[0].submit(); 50345 } else { 50346 50347 } 50348 if ($('#paylater').val() === "I'll transfer the payment later") { 50349 $('#new_renter')[0].submit(); 50350 } else { 50351 50352 } 50353 if ($('#paylater').val() === 'Paypal') { 50354 return $('#new_renter')[0].submit(); 50355 } else { 50356 $('#stripe_error').text(response.error.message); 50357 return $('input[type=submit]').attr('disabled', false); 50358 } 50359 } 50360 }; 50361 50362}).call(this); 50363(function() { 50364 var rentpayment; 50365 50366 jQuery(function() { 50367 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50368 return rentpayment.setupForm(); 50369 }); 50370 50371 rentpayment = { 50372 setupForm: function() { 50373 return $('#new_rentpayment').submit(function() { 50374 $('input[type=submit]').attr('disabled', true); 50375 if ($('#card_number').length) { 50376 rentpayment.processCard(); 50377 return false; 50378 } else { 50379 return true; 50380 } 50381 }); 50382 }, 50383 processCard: function() { 50384 var card; 50385 card = { 50386 number: $('#card_number').val(), 50387 cvc: $('#card_code').val(), 50388 expMonth: $('#card_month').val(), 50389 expYear: $('#card_year').val() 50390 }; 50391 return Stripe.createToken(card, rentpayment.handleStripeResponse); 50392 }, 50393 handleStripeResponse: function(status, response) { 50394 if (status === 200) { 50395 $("#process").html("Processing payment"); 50396 $('#rentpayment_stripeToken').val(response.id); 50397 $('#new_rentpayment')[0].submit(); 50398 } else { 50399 50400 } 50401 if ($('#whopays').val() === 'Landlord') { 50402 $('#new_rentpayment')[0].submit(); 50403 } else { 50404 50405 } 50406 if ($('#whopays').val() === 'Paypal') { 50407 return $('#new_rentpayment')[0].submit(); 50408 } else { 50409 $('#stripe_error').text(response.error.message); 50410 return $('input[type=submit]').attr('disabled', false); 50411 } 50412 } 50413 }; 50414 50415}).call(this); 50416(function() { 50417 50418 50419}).call(this); 50420(function() { 50421 50422 50423}).call(this); 50424(function() { 50425 var edit_signup; 50426 50427 jQuery(function() { 50428 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50429 return edit_signup.setupForm(); 50430 }); 50431 50432 edit_signup = { 50433 setupForm: function() { 50434 return $('#edit_signup').submit(function() { 50435 $('input[type=submit]').attr('disabled', true); 50436 if ($('#card_number').length) { 50437 edit_signup.processCard(); 50438 return false;
50439 } else { 50440 return true; 50441 } 50442 }); 50443 }, 50444 processCard: function() { 50445 var card; 50446 card = { 50447 number: $('#card_number').val(), 50448 cvc: $('#card_code').val(), 50449 expMonth: $('#card_month').val(), 50450 expYear: $('#card_year').val() 50451 }; 50452 return Stripe.createToken(card, edit_signup.handleStripeResponse); 50453 }, 50454 handleStripeResponse: function(status, response) { 50455 if (status === 200) { 50456 $("#process").html("Processing payment"); 50457 $('#signup_stripeToken').val(response.id); 50458 $('#edit_signup')[0].submit(); 50459 } else { 50460 50461 } 50462 if ($('#newpaylater').val() === 'I have transferred the payment' || $('#newpaylater').val() === 'I will transfer the payment later') { 50463 return $('#edit_signup')[0].submit(); 50464 } else { 50465 $('#stripe_error').text(response.error.message); 50466 return $('input[type=submit]').attr('disabled', false); 50467 } 50468 } 50469 }; 50470 50471}).call(this); 50472(function() { 50473 var standardpayment; 50474 50475 jQuery(function() { 50476 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50477 return standardpayment.setupForm(); 50478 }); 50479 50480 standardpayment = { 50481 setupForm: function() { 50482 return $('#new_standardpayment').submit(function() { 50483 $('input[type=submit]').attr('disabled', true); 50484 if ($('#card_number').length) { 50485 standardpayment.processCard(); 50486 return false; 50487 } else { 50488 return true; 50489 } 50490 }); 50491 }, 50492 processCard: function() { 50493 var card; 50494 card = { 50495 number: $('#card_number').val(), 50496 cvc: $('#card_code').val(), 50497 expMonth: $('#card_month').val(), 50498 expYear: $('#card_year').val() 50499 }; 50500 return Stripe.createToken(card, standardpayment.handleStripeResponse); 50501 }, 50502 handleStripeResponse: function(status, response) { 50503 if (status === 200) { 50504 $("#process").html("Processing payment"); 50505 $('#standardpayment_stripeToken').val(response.id); 50506 $('#new_standardpayment')[0].submit(); 50507 } else { 50508 50509 } 50510 if ($('#whopays').val() === 'Landlord') { 50511 $('#new_standardpayment')[0].submit(); 50512 } else { 50513 50514 } 50515 if ($('#whopays').val() === 'Paypal') { 50516 return $('#new_standardpayment')[0].submit(); 50517 } else { 50518 $('#stripe_error').text(response.error.message); 50519 return $('input[type=submit]').attr('disabled', false); 50520 } 50521 } 50522 }; 50523 50524}).call(this); 50525(function() { 50526 50527 50528}).call(this); 50529(function() { 50530 50531 50532}).call(this); 50533(function() { 50534 50535 50536}).call(this); 50537(function() { 50538 var tenantcheckpayment; 50539 50540 jQuery(function() { 50541 Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')); 50542 return tenantcheckpayment.setupForm(); 50543 }); 50544 50545 tenantcheckpayment = { 50546 setupForm: function() { 50547 return $('#new_tenantcheckpayment').submit(function() { 50548 $('input[type=submit]').attr('disabled', true); 50549 if ($('#card_number').length) { 50550 tenantcheckpayment.processCard(); 50551 return false; 50552 } else { 50553 return true; 50554 } 50555 }); 50556 }, 50557 processCard: function() { 50558 var card; 50559 card = { 50560 number: $('#card_number').val(), 50561 cvc: $('#card_code').val(), 50562 expMonth: $('#card_month').val(), 50563 expYear: $('#card_year').val() 50564 }; 50565 return Stripe.createToken(card, tenantcheckpayment.handleStripeResponse); 50566 }, 50567 handleStripeResponse: function(status, response) { 50568 if (status === 200) { 50569 $("#process").html("Processing payment"); 50570 $('#tenantcheckpayment_stripeToken').val(response.id); 50571 $('#new_tenantcheckpayment')[0].submit(); 50572 } else { 50573 50574 } 50575 if ($('#whopays').val() === 'Landlord') { 50576 $('#new_tenantcheckpayment')[0].submit(); 50577 } else { 50578 50579 } 50580 if ($('#whopays').val() === 'Paypal') { 50581 return $('#new_tenantcheckpayment')[0].submit(); 50582 } else { 50583 $('#stripe_error').text(response.error.message); 50584 return $('input[type=submit]').attr('disabled', false); 50585 } 50586 } 50587 }; 50588 50589}).call(this); 50590(function() { 50591 50592 50593}).call(this); 50594(function() { 50595 50596 50597}).call(this); 50598(function() { 50599 50600 50601}).call(this); 50602(function() { 50603 50604 50605}).call(this); 50606// This is a manifest file that'll be compiled into application.js, which will include all the files 50607// listed below. 50608// 50609// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 50610// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 50611// 50612// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 50613// compiled file. 50614// 50615// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 50616// about supported directives. 50617// 50618 50619 50620 50621 50622 50623 50624 50625 50626/*! 50627 * jQuery Validation Plugin 1.11.1 50628 * 50629 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 50630 * http://docs.jquery.com/Plugins/Validation 50631 * 50632 * Released under the MIT license: 50633 * http://www.opensource.org/licenses/mit-license.php 50634 */ 50635 50636 50637(function($) { 50638 50639$.extend($.fn, { 50640 // http://docs.jquery.com/Plugins/Validation/validate 50641 validate: function( options ) { 50642 50643 // if nothing is selected, return nothing; can't chain anyway 50644 if ( !this.length ) { 50645 if ( options && options.debug && window.console ) { 50646 console.warn( "Nothing selected, can't validate, returning nothing." ); 50647 } 50648 return; 50649 } 50650 50651 // check if a validator for this form was already created
50652 var validator = $.data( this[0], "validator" ); 50653 if ( validator ) { 50654 return validator; 50655 } 50656 50657 // Add novalidate tag if HTML5. 50658 this.attr( "novalidate", "novalidate" ); 50659 50660 validator = new $.validator( options, this[0] ); 50661 $.data( this[0], "validator", validator ); 50662 50663 if ( validator.settings.onsubmit ) { 50664 50665 this.validateDelegate( ":submit", "click", function( event ) { 50666 if ( validator.settings.submitHandler ) { 50667 validator.submitButton = event.target; 50668 } 50669 // allow suppressing validation by adding a cancel class to the submit button 50670 if ( $(event.target).hasClass("cancel") ) { 50671 validator.cancelSubmit = true; 50672 } 50673 50674 // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button 50675 if ( $(event.target).attr("formnovalidate") !== undefined ) { 50676 validator.cancelSubmit = true; 50677 } 50678 }); 50679 50680 // validate the form on submit 50681 this.submit( function( event ) { 50682 if ( validator.settings.debug ) { 50683 // prevent form submit to be able to see console output 50684 event.preventDefault(); 50685 } 50686 function handle() { 50687 var hidden; 50688 if ( validator.settings.submitHandler ) { 50689 if ( validator.submitButton ) { 50690 // insert a hidden input as a replacement for the missing submit button 50691 hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm); 50692 } 50693 validator.settings.submitHandler.call( validator, validator.currentForm, event ); 50694 if ( validator.submitButton ) { 50695 // and clean up afterwards; thanks to no-block-scope, hidden can be referenced 50696 hidden.remove(); 50697 } 50698 return false; 50699 } 50700 return true; 50701 } 50702 50703 // prevent submit for invalid forms or custom submit handlers 50704 if ( validator.cancelSubmit ) { 50705 validator.cancelSubmit = false; 50706 return handle(); 50707 } 50708 if ( validator.form() ) { 50709 if ( validator.pendingRequest ) { 50710 validator.formSubmitted = true; 50711 return false; 50712 } 50713 return handle(); 50714 } else { 50715 validator.focusInvalid(); 50716 return false; 50717 } 50718 }); 50719 } 50720 50721 return validator; 50722 }, 50723 // http://docs.jquery.com/Plugins/Validation/valid 50724 valid: function() { 50725 if ( $(this[0]).is("form")) { 50726 return this.validate().form(); 50727 } else { 50728 var valid = true; 50729 var validator = $(this[0].form).validate(); 50730 this.each(function() { 50731 valid = valid && validator.element(this); 50732 }); 50733 return valid; 50734 } 50735 }, 50736 // attributes: space seperated list of attributes to retrieve and remove 50737 removeAttrs: function( attributes ) { 50738 var result = {}, 50739 $element = this; 50740 $.each(attributes.split(/\s/), function( index, value ) { 50741 result[value] = $element.attr(value); 50742 $element.removeAttr(value); 50743 }); 50744 return result; 50745 }, 50746 // http://docs.jquery.com/Plugins/Validation/rules 50747 rules: function( command, argument ) { 50748 var element = this[0]; 50749 50750 if ( command ) { 50751 var settings = $.data(element.form, "validator").settings; 50752 var staticRules = settings.rules; 50753 var existingRules = $.validator.staticRules(element); 50754 switch(command) { 50755 case "add": 50756 $.extend(existingRules, $.validator.normalizeRule(argument)); 50757 // remove messages from rules, but allow them to be set separetely 50758 delete existingRules.messages; 50759 staticRules[element.name] = existingRules; 50760 if ( argument.messages ) { 50761 settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); 50762 } 50763 break; 50764 case "remove": 50765 if ( !argument ) { 50766 delete staticRules[element.name]; 50767 return existingRules; 50768 } 50769 var filtered = {}; 50770 $.each(argument.split(/\s/), function( index, method ) { 50771 filtered[method] = existingRules[method]; 50772 delete existingRules[method]; 50773 }); 50774 return filtered; 50775 } 50776 } 50777 50778 var data = $.validator.normalizeRules( 50779 $.extend( 50780 {}, 50781 $.validator.classRules(element), 50782 $.validator.attributeRules(element), 50783 $.validator.dataRules(element), 50784 $.validator.staticRules(element) 50785 ), element); 50786 50787 // make sure required is at front 50788 if ( data.required ) { 50789 var param = data.required; 50790 delete data.required; 50791 data = $.extend({required: param}, data); 50792 } 50793 50794 return data; 50795 } 50796}); 50797 50798// Custom selectors 50799$.extend($.expr[":"], {
50800 // http://docs.jquery.com/Plugins/Validation/blank 50801 blank: function( a ) { return !$.trim("" + $(a).val()); }, 50802 // http://docs.jquery.com/Plugins/Validation/filled 50803 filled: function( a ) { return !!$.trim("" + $(a).val()); }, 50804 // http://docs.jquery.com/Plugins/Validation/unchecked 50805 unchecked: function( a ) { return !$(a).prop("checked"); } 50806}); 50807 50808// constructor for validator 50809$.validator = function( options, form ) { 50810 this.settings = $.extend( true, {}, $.validator.defaults, options ); 50811 this.currentForm = form; 50812 this.init(); 50813}; 50814 50815$.validator.format = function( source, params ) { 50816 if ( arguments.length === 1 ) { 50817 return function() { 50818 var args = $.makeArray(arguments); 50819 args.unshift(source); 50820 return $.validator.format.apply( this, args ); 50821 }; 50822 } 50823 if ( arguments.length > 2 && params.constructor !== Array ) { 50824 params = $.makeArray(arguments).slice(1); 50825 } 50826 if ( params.constructor !== Array ) { 50827 params = [ params ]; 50828 } 50829 $.each(params, function( i, n ) { 50830 source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() { 50831 return n; 50832 }); 50833 }); 50834 return source; 50835}; 50836 50837$.extend($.validator, { 50838 50839 defaults: { 50840 messages: {}, 50841 groups: {}, 50842 rules: {}, 50843 errorClass: "error", 50844 validClass: "valid", 50845 errorElement: "label", 50846 focusInvalid: true, 50847 errorContainer: $([]), 50848 errorLabelContainer: $([]), 50849 onsubmit: true, 50850 ignore: ":hidden", 50851 ignoreTitle: false, 50852 onfocusin: function( element, event ) { 50853 this.lastActive = element; 50854 50855 // hide error label and remove error class on focus if enabled 50856 if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { 50857 if ( this.settings.unhighlight ) { 50858 this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); 50859 } 50860 this.addWrapper(this.errorsFor(element)).hide(); 50861 } 50862 }, 50863 onfocusout: function( element, event ) { 50864 if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { 50865 this.element(element); 50866 } 50867 }, 50868 onkeyup: function( element, event ) { 50869 if ( event.which === 9 && this.elementValue(element) === "" ) { 50870 return; 50871 } else if ( element.name in this.submitted || element === this.lastElement ) { 50872 this.element(element); 50873 } 50874 }, 50875 onclick: function( element, event ) { 50876 // click on selects, radiobuttons and checkboxes 50877 if ( element.name in this.submitted ) { 50878 this.element(element); 50879 } 50880 // or option elements, check parent select in that case 50881 else if ( element.parentNode.name in this.submitted ) { 50882 this.element(element.parentNode); 50883 } 50884 }, 50885 highlight: function( element, errorClass, validClass ) { 50886 if ( element.type === "radio" ) { 50887 this.findByName(element.name).addClass(errorClass).removeClass(validClass); 50888 } else { 50889 $(element).addClass(errorClass).removeClass(validClass); 50890 } 50891 }, 50892 unhighlight: function( element, errorClass, validClass ) { 50893 if ( element.type === "radio" ) { 50894 this.findByName(element.name).removeClass(errorClass).addClass(validClass); 50895 } else { 50896 $(element).removeClass(errorClass).addClass(validClass); 50897 } 50898 } 50899 }, 50900 50901 // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults 50902 setDefaults: function( settings ) { 50903 $.extend( $.validator.defaults, settings ); 50904 }, 50905 50906 messages: { 50907 required: "This field is required.", 50908 remote: "Please fix this field.", 50909 email: "Please enter a valid email address.", 50910 tel: "Please enter a valid mobile number.", 50911 url: "Please enter a valid URL.", 50912 date: "Please enter a valid date.", 50913 dateISO: "Please enter a valid date (ISO).", 50914 number: "Please enter a valid number.", 50915 digits: "Please enter only digits.", 50916 creditcard: "Please enter a valid credit card number.", 50917 equalTo: "Please enter the same value again.", 50918 maxlength: $.validator.format("Please enter no more than {0} characters."), 50919 minlength: $.validator.format("Please enter at least {0} characters."), 50920 rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), 50921 range: $.validator.format("Please enter a value between {0} and {1}."), 50922 max: $.validator.format("Please enter a value less than or equal to {0}."), 50923 min: $.validator.format("Please enter a value greater than or equal to {0}.") 50924 }, 50925 50926 autoCreateRanges: false, 50927 50928 prototype: { 50929 50930 init: function() { 50931 this.labelContainer = $(this.settings.errorLabelContainer); 50932 this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); 50933 this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); 50934 this.submitted = {}; 50935 this.valueCache = {}; 50936 this.pendingRequest = 0; 50937 this.pending = {}; 50938 this.invalid = {}; 50939 this.reset(); 50940 50941 var groups = (this.groups = {}); 50942 $.each(this.settings.groups, function( key, value ) { 50943 if ( typeof value === "string" ) { 50944 value = value.split(/\s/); 50945 } 50946 $.each(value, function( index, name ) { 50947 groups[name] = key; 50948 }); 50949 }); 50950 var rules = this.settings.rules; 50951 $.each(rules, function( key, value ) { 50952 rules[key] = $.validator.normalizeRule(value); 50953 }); 50954 50955 function delegate(event) {
50956 var validator = $.data(this[0].form, "validator"), 50957 eventType = "on" + event.type.replace(/^validate/, ""); 50958 if ( validator.settings[eventType] ) { 50959 validator.settings[eventType].call(validator, this[0], event); 50960 } 50961 } 50962 $(this.currentForm) 50963 .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + 50964 "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + 50965 "[type='email'], [type='datetime'], [type='date'], [type='month'], " + 50966 "[type='week'], [type='time'], [type='datetime-local'], " + 50967 "[type='range'], [type='color'] ", 50968 "focusin focusout keyup", delegate) 50969 .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); 50970 50971 if ( this.settings.invalidHandler ) { 50972 $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); 50973 } 50974 }, 50975 50976 // http://docs.jquery.com/Plugins/Validation/Validator/form 50977 form: function() { 50978 this.checkForm(); 50979 $.extend(this.submitted, this.errorMap); 50980 this.invalid = $.extend({}, this.errorMap); 50981 if ( !this.valid() ) { 50982 $(this.currentForm).triggerHandler("invalid-form", [this]); 50983 } 50984 this.showErrors(); 50985 return this.valid(); 50986 }, 50987 50988 checkForm: function() { 50989 this.prepareForm(); 50990 for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { 50991 this.check( elements[i] ); 50992 } 50993 return this.valid(); 50994 }, 50995 50996 // http://docs.jquery.com/Plugins/Validation/Validator/element 50997 element: function( element ) { 50998 element = this.validationTargetFor( this.clean( element ) ); 50999 this.lastElement = element; 51000 this.prepareElement( element ); 51001 this.currentElements = $(element); 51002 var result = this.check( element ) !== false; 51003 if ( result ) { 51004 delete this.invalid[element.name]; 51005 } else { 51006 this.invalid[element.name] = true; 51007 } 51008 if ( !this.numberOfInvalids() ) { 51009 // Hide error containers on last error 51010 this.toHide = this.toHide.add( this.containers ); 51011 } 51012 this.showErrors(); 51013 return result; 51014 }, 51015 51016 // http://docs.jquery.com/Plugins/Validation/Validator/showErrors 51017 showErrors: function( errors ) { 51018 if ( errors ) { 51019 // add items to error list and map 51020 $.extend( this.errorMap, errors ); 51021 this.errorList = []; 51022 for ( var name in errors ) { 51023 this.errorList.push({ 51024 message: errors[name], 51025 element: this.findByName(name)[0] 51026 }); 51027 } 51028 // remove items from success list 51029 this.successList = $.grep( this.successList, function( element ) { 51030 return !(element.name in errors); 51031 }); 51032 } 51033 if ( this.settings.showErrors ) { 51034 this.settings.showErrors.call( this, this.errorMap, this.errorList ); 51035 } else { 51036 this.defaultShowErrors(); 51037 } 51038 }, 51039 51040 // http://docs.jquery.com/Plugins/Validation/Validator/resetForm 51041 resetForm: function() { 51042 if ( $.fn.resetForm ) { 51043 $(this.currentForm).resetForm(); 51044 } 51045 this.submitted = {}; 51046 this.lastElement = null; 51047 this.prepareForm(); 51048 this.hideErrors(); 51049 this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); 51050 }, 51051 51052 numberOfInvalids: function() { 51053 return this.objectLength(this.invalid); 51054 }, 51055 51056 objectLength: function( obj ) { 51057 var count = 0; 51058 for ( var i in obj ) { 51059 count++; 51060 } 51061 return count; 51062 }, 51063 51064 hideErrors: function() { 51065 this.addWrapper( this.toHide ).hide(); 51066 }, 51067 51068 valid: function() { 51069 return this.size() === 0; 51070 }, 51071 51072 size: function() { 51073 return this.errorList.length; 51074 }, 51075 51076 focusInvalid: function() { 51077 if ( this.settings.focusInvalid ) { 51078 try { 51079 $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) 51080 .filter(":visible") 51081 .focus() 51082 // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find 51083 .trigger("focusin"); 51084 } catch(e) { 51085 // ignore IE throwing errors when focusing hidden elements 51086 } 51087 } 51088 }, 51089 51090 findLastActive: function() { 51091 var lastActive = this.lastActive; 51092 return lastActive && $.grep(this.errorList, function( n ) { 51093 return n.element.name === lastActive.name; 51094 }).length === 1 && lastActive; 51095 }, 51096 51097 elements: function() {
51098 var validator = this, 51099 rulesCache = {}; 51100 51101 // select all valid inputs inside the form (no submit or reset buttons) 51102 return $(this.currentForm) 51103 .find("input, select, textarea") 51104 .not(":submit, :reset, :image, [disabled]") 51105 .not( this.settings.ignore ) 51106 .filter(function() { 51107 if ( !this.name && validator.settings.debug && window.console ) { 51108 console.error( "%o has no name assigned", this); 51109 } 51110 51111 // select only the first element for each name, and only those with rules specified 51112 if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { 51113 return false; 51114 } 51115 51116 rulesCache[this.name] = true; 51117 return true; 51118 }); 51119 }, 51120 51121 clean: function( selector ) { 51122 return $(selector)[0]; 51123 }, 51124 51125 errors: function() { 51126 var errorClass = this.settings.errorClass.replace(" ", "."); 51127 return $(this.settings.errorElement + "." + errorClass, this.errorContext); 51128 }, 51129 51130 reset: function() { 51131 this.successList = []; 51132 this.errorList = []; 51133 this.errorMap = {}; 51134 this.toShow = $([]); 51135 this.toHide = $([]); 51136 this.currentElements = $([]); 51137 }, 51138 51139 prepareForm: function() { 51140 this.reset(); 51141 this.toHide = this.errors().add( this.containers ); 51142 }, 51143 51144 prepareElement: function( element ) { 51145 this.reset(); 51146 this.toHide = this.errorsFor(element); 51147 }, 51148 51149 elementValue: function( element ) { 51150 var type = $(element).attr("type"), 51151 val = $(element).val(); 51152 51153 if ( type === "radio" || type === "checkbox" ) { 51154 return $("input[name='" + $(element).attr("name") + "']:checked").val(); 51155 } 51156 51157 if ( typeof val === "string" ) { 51158 return val.replace(/\r/g, ""); 51159 } 51160 return val; 51161 }, 51162 51163 check: function( element ) { 51164 element = this.validationTargetFor( this.clean( element ) ); 51165 51166 var rules = $(element).rules(); 51167 var dependencyMismatch = false; 51168 var val = this.elementValue(element); 51169 var result; 51170 51171 for (var method in rules ) { 51172 var rule = { method: method, parameters: rules[method] }; 51173 try { 51174 51175 result = $.validator.methods[method].call( this, val, element, rule.parameters ); 51176 51177 // if a method indicates that the field is optional and therefore valid, 51178 // don't mark it as valid when there are no other rules 51179 if ( result === "dependency-mismatch" ) { 51180 dependencyMismatch = true; 51181 continue; 51182 } 51183 dependencyMismatch = false; 51184 51185 if ( result === "pending" ) { 51186 this.toHide = this.toHide.not( this.errorsFor(element) ); 51187 return; 51188 } 51189 51190 if ( !result ) { 51191 this.formatAndAdd( element, rule ); 51192 return false; 51193 } 51194 } catch(e) { 51195 if ( this.settings.debug && window.console ) { 51196 console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); 51197 } 51198 throw e; 51199 } 51200 } 51201 if ( dependencyMismatch ) { 51202 return; 51203 } 51204 if ( this.objectLength(rules) ) { 51205 this.successList.push(element); 51206 } 51207 return true; 51208 }, 51209 51210 // return the custom message for the given element and validation method 51211 // specified in the element's HTML5 data attribute 51212 customDataMessage: function( element, method ) { 51213 return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase())); 51214 }, 51215 51216 // return the custom message for the given element name and validation method 51217 customMessage: function( name, method ) { 51218 var m = this.settings.messages[name]; 51219 return m && (m.constructor === String ? m : m[method]); 51220 }, 51221 51222 // return the first defined argument, allowing empty strings 51223 findDefined: function() { 51224 for(var i = 0; i < arguments.length; i++) { 51225 if ( arguments[i] !== undefined ) { 51226 return arguments[i]; 51227 } 51228 } 51229 return undefined; 51230 }, 51231 51232 defaultMessage: function( element, method ) { 51233 return this.findDefined( 51234 this.customMessage( element.name, method ), 51235 this.customDataMessage( element, method ), 51236 // title is never undefined, so handle empty string as undefined 51237 !this.settings.ignoreTitle && element.title || undefined, 51238 $.validator.messages[method], 51239 "<strong>Warning: No message defined for " + element.name + "</strong>" 51240 ); 51241 }, 51242 51243 formatAndAdd: function( element, rule ) { 51244 var message = this.defaultMessage( element, rule.method ), 51245 theregex = /\$?\{(\d+)\}/g; 51246 if ( typeof message === "function" ) { 51247 message = message.call(this, rule.parameters, element); 51248 } else if (theregex.test(message)) { 51249 message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters); 51250 } 51251 this.errorList.push({ 51252 message: message, 51253 element: element 51254 }); 51255 51256 this.errorMap[element.name] = message; 51257 this.submitted[element.name] = message; 51258 }, 51259 51260 addWrapper: function( toToggle ) { 51261 if ( this.settings.wrapper ) { 51262 toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); 51263 } 51264 return toToggle; 51265 }, 51266 51267 defaultShowErrors: function() { 51268 var i, elements; 51269 for ( i = 0; this.errorList[i]; i++ ) { 51270 var error = this.errorList[i]; 51271 if ( this.settings.highlight ) { 51272 this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.val
51272idClass ); 51273 } 51274 this.showLabel( error.element, error.message ); 51275 } 51276 if ( this.errorList.length ) { 51277 this.toShow = this.toShow.add( this.containers ); 51278 } 51279 if ( this.settings.success ) { 51280 for ( i = 0; this.successList[i]; i++ ) { 51281 this.showLabel( this.successList[i] ); 51282 } 51283 } 51284 if ( this.settings.unhighlight ) { 51285 for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { 51286 this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); 51287 } 51288 } 51289 this.toHide = this.toHide.not( this.toShow ); 51290 this.hideErrors(); 51291 this.addWrapper( this.toShow ).show(); 51292 }, 51293 51294 validElements: function() { 51295 return this.currentElements.not(this.invalidElements()); 51296 }, 51297 51298 invalidElements: function() { 51299 return $(this.errorList).map(function() { 51300 return this.element; 51301 }); 51302 }, 51303 51304 showLabel: function( element, message ) { 51305 var label = this.errorsFor( element ); 51306 if ( label.length ) { 51307 // refresh error/success class 51308 label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); 51309 // replace message on existing label 51310 label.html(message); 51311 } else { 51312 // create label 51313 label = $("<" + this.settings.errorElement + ">") 51314 .attr("for", this.idOrName(element)) 51315 .addClass(this.settings.errorClass) 51316 .html(message || ""); 51317 if ( this.settings.wrapper ) { 51318 // make sure the element is visible, even in IE 51319 // actually showing the wrapped element is handled elsewhere 51320 label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); 51321 } 51322 if ( !this.labelContainer.append(label).length ) { 51323 if ( this.settings.errorPlacement ) { 51324 this.settings.errorPlacement(label, $(element) ); 51325 } else { 51326 label.insertAfter(element); 51327 } 51328 } 51329 } 51330 if ( !message && this.settings.success ) { 51331 label.text(""); 51332 if ( typeof this.settings.success === "string" ) { 51333 label.addClass( this.settings.success ); 51334 } else { 51335 this.settings.success( label, element ); 51336 } 51337 } 51338 this.toShow = this.toShow.add(label); 51339 }, 51340 51341 errorsFor: function( element ) { 51342 var name = this.idOrName(element); 51343 return this.errors().filter(function() { 51344 return $(this).attr("for") === name; 51345 }); 51346 }, 51347 51348 idOrName: function( element ) { 51349 return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); 51350 }, 51351 51352 validationTargetFor: function( element ) { 51353 // if radio/checkbox, validate first element in group instead 51354 if ( this.checkable(element) ) { 51355 element = this.findByName( element.name ).not(this.settings.ignore)[0]; 51356 } 51357 return element; 51358 }, 51359 51360 checkable: function( element ) { 51361 return (/radio|checkbox/i).test(element.type); 51362 }, 51363 51364 findByName: function( name ) { 51365 return $(this.currentForm).find("[name='" + name + "']"); 51366 }, 51367 51368 getLength: function( value, element ) { 51369 switch( element.nodeName.toLowerCase() ) { 51370 case "select": 51371 return $("option:selected", element).length; 51372 case "input": 51373 if ( this.checkable( element) ) { 51374 return this.findByName(element.name).filter(":checked").length; 51375 } 51376 } 51377 return value.length; 51378 }, 51379 51380 depend: function( param, element ) { 51381 return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; 51382 }, 51383 51384 dependTypes: { 51385 "boolean": function( param, element ) { 51386 return param; 51387 }, 51388 "string": function( param, element ) { 51389 return !!$(param, element.form).length; 51390 }, 51391 "function": function( param, element ) { 51392 return param(element); 51393 } 51394 }, 51395 51396 optional: function( element ) { 51397 var val = this.elementValue(element); 51398 return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; 51399 }, 51400 51401 startRequest: function( element ) { 51402 if ( !this.pending[element.name] ) { 51403 this.pendingRequest++; 51404 this.pending[element.name] = true; 51405 } 51406 }, 51407 51408 stopRequest: function( element, valid ) { 51409 this.pendingRequest--; 51410 // sometimes synchronization fails, make sure pendingRequest is never < 0 51411 if ( this.pendingRequest < 0 ) { 51412 this.pendingRequest = 0; 51413 } 51414 delete this.pending[element.name]; 51415 if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { 51416 $(this.currentForm).submit(); 51417 this.formSubmitted = false;
51418 } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { 51419 $(this.currentForm).triggerHandler("invalid-form", [this]); 51420 this.formSubmitted = false; 51421 } 51422 }, 51423 51424 previousValue: function( element ) { 51425 return $.data(element, "previousValue") || $.data(element, "previousValue", { 51426 old: null, 51427 valid: true, 51428 message: this.defaultMessage( element, "remote" ) 51429 }); 51430 } 51431 51432 }, 51433 51434 classRuleSettings: { 51435 required: {required: true}, 51436 email: {email: true}, 51437 url: {url: true}, 51438 date: {date: true}, 51439 dateISO: {dateISO: true}, 51440 number: {number: true}, 51441 tel: {tel: true}, 51442 digits: {digits: true}, 51443 creditcard: {creditcard: true} 51444 }, 51445 51446 addClassRules: function( className, rules ) { 51447 if ( className.constructor === String ) { 51448 this.classRuleSettings[className] = rules; 51449 } else { 51450 $.extend(this.classRuleSettings, className); 51451 } 51452 }, 51453 51454 classRules: function( element ) { 51455 var rules = {}; 51456 var classes = $(element).attr("class"); 51457 if ( classes ) { 51458 $.each(classes.split(" "), function() { 51459 if ( this in $.validator.classRuleSettings ) { 51460 $.extend(rules, $.validator.classRuleSettings[this]); 51461 } 51462 }); 51463 } 51464 return rules; 51465 }, 51466 51467 attributeRules: function( element ) { 51468 var rules = {}; 51469 var $element = $(element); 51470 var type = $element[0].getAttribute("type"); 51471 51472 for (var method in $.validator.methods) { 51473 var value; 51474 51475 // support for <input required> in both html5 and older browsers 51476 if ( method === "required" ) { 51477 value = $element.get(0).getAttribute(method); 51478 // Some browsers return an empty string for the required attribute 51479 // and non-HTML5 browsers might have required="" markup 51480 if ( value === "" ) { 51481 value = true; 51482 } 51483 // force non-HTML5 browsers to return bool 51484 value = !!value; 51485 } else { 51486 value = $element.attr(method); 51487 } 51488 51489 // convert the value to a number for number inputs, and for text for backwards compability 51490 // allows type="date" and others to be compared as strings 51491 if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { 51492 value = Number(value); 51493 } 51494 51495 if ( value ) { 51496 rules[method] = value; 51497 } else if ( type === method && type !== 'range' ) { 51498 // exception: the jquery validate 'range' method 51499 // does not test for the html5 'range' type 51500 rules[method] = true; 51501 } 51502 } 51503 51504 // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs 51505 if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) { 51506 delete rules.maxlength; 51507 } 51508 51509 return rules; 51510 }, 51511 51512 dataRules: function( element ) { 51513 var method, value, 51514 rules = {}, $element = $(element); 51515 for (method in $.validator.methods) { 51516 value = $element.data("rule-" + method.toLowerCase()); 51517 if ( value !== undefined ) { 51518 rules[method] = value; 51519 } 51520 } 51521 return rules; 51522 }, 51523 51524 staticRules: function( element ) { 51525 var rules = {}; 51526 var validator = $.data(element.form, "validator"); 51527 if ( validator.settings.rules ) { 51528 rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; 51529 } 51530 return rules; 51531 }, 51532 51533 normalizeRules: function( rules, element ) { 51534 // handle dependency check 51535 $.each(rules, function( prop, val ) { 51536 // ignore rule when param is explicitly false, eg. required:false 51537 if ( val === false ) { 51538 delete rules[prop]; 51539 return; 51540 } 51541 if ( val.param || val.depends ) { 51542 var keepRule = true; 51543 switch (typeof val.depends) { 51544 case "string": 51545 keepRule = !!$(val.depends, element.form).length; 51546 break; 51547 case "function": 51548 keepRule = val.depends.call(element, element); 51549 break; 51550 } 51551 if ( keepRule ) { 51552 rules[prop] = val.param !== undefined ? val.param : true; 51553 } else { 51554 delete rules[prop]; 51555 } 51556 } 51557 }); 51558 51559 // evaluate parameters 51560 $.each(rules, function( rule, parameter ) { 51561 rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; 51562 }); 51563 51564 // clean number parameters 51565 $.each(['minlength', 'maxlength'], function() { 51566 if ( rules[this] ) { 51567 rules[this] = Number(rules[this]); 51568 } 51569 }); 51570 $.each(['rangelength', 'range'], function() { 51571 var parts; 51572 if ( rules[this] ) { 51573 if ( $.isArray(rules[this]) ) { 51574 rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; 51575 } else if ( typeof rules[this] === "string" ) { 51576 parts = rules[this].split(/[\s,]+/); 51577 rules[this] = [Number(parts[0]), Number(parts[1])]; 51578 } 51579 } 51580 }); 51581 51582 if ( $.validator.autoCreateRanges ) { 51583 // auto-create ranges 51584 if ( rules.min && rules.max ) { 51585 rules.range = [rules.min, rules.max]; 51586 delete rules.min; 51587 delete rules.max; 51588 } 51589 if ( rules.minlength && rules.maxlength ) { 51590 rules.rangelength = [rules.minlength, rules.maxlength]; 51591 delete rules.minlength; 51592 delete rules.maxlength; 51593 } 51594 } 51595 51596 return rules; 51597 }, 51598
vendor: 5,033 bytes, lines 51599-51683
51599 // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} 51600 normalizeRule: function( data ) { 51601 if ( typeof data === "string" ) { 51602 var transformed = {}; 51603 $.each(data.split(/\s/), function() { 51604 transformed[this] = true; 51605 }); 51606 data = transformed; 51607 } 51608 return data; 51609 }, 51610 51611 // http://docs.jquery.com/Plugins/Validation/Validator/addMethod 51612 addMethod: function( name, method, message ) { 51613 $.validator.methods[name] = method; 51614 $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; 51615 if ( method.length < 3 ) { 51616 $.validator.addClassRules(name, $.validator.normalizeRule(name)); 51617 } 51618 }, 51619 51620 methods: { 51621 51622 // http://docs.jquery.com/Plugins/Validation/Methods/required 51623 required: function( value, element, param ) { 51624 // check if dependency is met 51625 if ( !this.depend(param, element) ) { 51626 return "dependency-mismatch"; 51627 } 51628 if ( element.nodeName.toLowerCase() === "select" ) { 51629 // could be an array for select-multiple or a string, both are fine this way 51630 var val = $(element).val(); 51631 return val && val.length > 0; 51632 } 51633 if ( this.checkable(element) ) { 51634 return this.getLength(value, element) > 0; 51635 } 51636 return $.trim(value).length > 0; 51637 }, 51638 51639 // http://docs.jquery.com/Plugins/Validation/Methods/email 51640 email: function( value, element ) { 51641 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ 51642 return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); 51643 }, 51644 51645 // http://docs.jquery.com/Plugins/Validation/Methods/url 51646 url: function( value, element ) { 51647 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ 51648 return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); 51649 }, 51650 51651 // http://docs.jquery.com/Plugins/Validation/Methods/date 51652 date: function( value, element ) { 51653 return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); 51654 }, 51655 51656 // http://docs.jquery.com/Plugins/Validation/Methods/dateISO 51657 dateISO: function( value, element ) { 51658 return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); 51659 }, 51660 51661 // http://docs.jquery.com/Plugins/Validation/Methods/number 51662 number: function( value, element ) { 51663 return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); 51664 }, 51665 51666 tel: function( value, element ) { 51667 return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); 51668 }, 51669 51670 // http://docs.jquery.com/Plugins/Validation/Methods/digits 51671 digits: function( value, element ) { 51672 return this.optional(element) || /^\d+$/.test(value); 51673 }, 51674 51675 // http://docs.jquery.com/Plugins/Validation/Methods/creditcard 51676 // based on http://en.wikipedia.org/wiki/Luhn 51677 creditcard: function( value, element ) { 51678 if ( this.optional(element) ) { 51679 return "dependency-mismatch"; 51680 } 51681 // accept only spaces, digits and dashes 51682 if ( /[^0-9 \-]+/.test(value) ) { 51683 return false;
51684 } 51685 var nCheck = 0, 51686 nDigit = 0, 51687 bEven = false; 51688 51689 value = value.replace(/\D/g, ""); 51690 51691 for (var n = value.length - 1; n >= 0; n--) { 51692 var cDigit = value.charAt(n); 51693 nDigit = parseInt(cDigit, 10); 51694 if ( bEven ) { 51695 if ( (nDigit *= 2) > 9 ) { 51696 nDigit -= 9; 51697 } 51698 } 51699 nCheck += nDigit; 51700 bEven = !bEven; 51701 } 51702 51703 return (nCheck % 10) === 0; 51704 }, 51705 51706 // http://docs.jquery.com/Plugins/Validation/Methods/minlength 51707 minlength: function( value, element, param ) { 51708 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 51709 return this.optional(element) || length >= param; 51710 }, 51711 51712 // http://docs.jquery.com/Plugins/Validation/Methods/maxlength 51713 maxlength: function( value, element, param ) { 51714 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 51715 return this.optional(element) || length <= param; 51716 }, 51717 51718 // http://docs.jquery.com/Plugins/Validation/Methods/rangelength 51719 rangelength: function( value, element, param ) { 51720 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 51721 return this.optional(element) || ( length >= param[0] && length <= param[1] ); 51722 }, 51723 51724 // http://docs.jquery.com/Plugins/Validation/Methods/min 51725 min: function( value, element, param ) { 51726 return this.optional(element) || value >= param; 51727 }, 51728 51729 // http://docs.jquery.com/Plugins/Validation/Methods/max 51730 max: function( value, element, param ) { 51731 return this.optional(element) || value <= param; 51732 }, 51733 51734 // http://docs.jquery.com/Plugins/Validation/Methods/range 51735 range: function( value, element, param ) { 51736 return this.optional(element) || ( value >= param[0] && value <= param[1] ); 51737 }, 51738 51739 // http://docs.jquery.com/Plugins/Validation/Methods/equalTo 51740 equalTo: function( value, element, param ) {
51741 // bind to the blur event of the target in order to revalidate whenever the target field is updated 51742 // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead 51743 var target = $(param); 51744 if ( this.settings.onfocusout ) { 51745 target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { 51746 $(element).valid(); 51747 }); 51748 } 51749 return value === target.val(); 51750 }, 51751 51752 // http://docs.jquery.com/Plugins/Validation/Methods/remote 51753 remote: function( value, element, param ) { 51754 if ( this.optional(element) ) { 51755 return "dependency-mismatch"; 51756 } 51757 51758 var previous = this.previousValue(element); 51759 if (!this.settings.messages[element.name] ) { 51760 this.settings.messages[element.name] = {}; 51761 } 51762 previous.originalMessage = this.settings.messages[element.name].remote; 51763 this.settings.messages[element.name].remote = previous.message; 51764 51765 param = typeof param === "string" && {url:param} || param; 51766 51767 if ( previous.old === value ) { 51768 return previous.valid; 51769 } 51770 51771 previous.old = value; 51772 var validator = this; 51773 this.startRequest(element); 51774 var data = {}; 51775 data[element.name] = value; 51776 $.ajax($.extend(true, { 51777 url: param, 51778 mode: "abort", 51779 port: "validate" + element.name, 51780 dataType: "json", 51781 data: data, 51782 success: function( response ) { 51783 validator.settings.messages[element.name].remote = previous.originalMessage; 51784 var valid = response === true || response === "true"; 51785 if ( valid ) { 51786 var submitted = validator.formSubmitted; 51787 validator.prepareElement(element); 51788 validator.formSubmitted = submitted; 51789 validator.successList.push(element); 51790 delete validator.invalid[element.name]; 51791 validator.showErrors(); 51792 } else { 51793 var errors = {}; 51794 var message = response || validator.defaultMessage( element, "remote" ); 51795 errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; 51796 validator.invalid[element.name] = true; 51797 validator.showErrors(errors); 51798 } 51799 previous.valid = valid; 51800 validator.stopRequest(element, valid); 51801 } 51802 }, param)); 51803 return "pending"; 51804 } 51805 51806 } 51807 51808}); 51809 51810// deprecated, use $.validator.format instead 51811$.format = $.validator.format; 51812 51813}(jQuery)); 51814 51815// ajax mode: abort 51816// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); 51817// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 51818(function($) { 51819 var pendingRequests = {}; 51820 // Use a prefilter if available (1.5+) 51821 if ( $.ajaxPrefilter ) { 51822 $.ajaxPrefilter(function( settings, _, xhr ) { 51823 var port = settings.port; 51824 if ( settings.mode === "abort" ) { 51825 if ( pendingRequests[port] ) { 51826 pendingRequests[port].abort(); 51827 } 51828 pendingRequests[port] = xhr; 51829 } 51830 }); 51831 } else { 51832 // Proxy ajax 51833 var ajax = $.ajax; 51834 $.ajax = function( settings ) { 51835 var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, 51836 port = ( "port" in settings ? settings : $.ajaxSettings ).port; 51837 if ( mode === "abort" ) { 51838 if ( pendingRequests[port] ) { 51839 pendingRequests[port].abort(); 51840 } 51841 pendingRequests[port] = ajax.apply(this, arguments); 51842 return pendingRequests[port]; 51843 } 51844 return ajax.apply(this, arguments); 51845 }; 51846 } 51847}(jQuery)); 51848 51849// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation 51850// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 51851(function($) { 51852 $.extend($.fn, { 51853 validateDelegate: function( delegate, type, handler ) { 51854 return this.bind(type, function( event ) { 51855 var target = $(event.target); 51856 if ( target.is(delegate) ) { 51857 return handler.apply(target, arguments); 51858 } 51859 }); 51860 } 51861 }); 51862}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.