vendor: 6,796 bytes, lines 1-260
1/*! 2 * jQuery JavaScript Library v3.7.0 3 * https://jquery.com/ 4 * 5 * Copyright OpenJS Foundation and other contributors 6 * Released under the MIT license 7 * https://jquery.org/license 8 * 9 * Date: 2023-05-11T18:29Z 10 */ 11( function( global, factory ) { 12 13 "use strict"; 14 15 if ( typeof module === "object" && typeof module.exports === "object" ) { 16 17 // For CommonJS and CommonJS-like environments where a proper `window` 18 // is present, execute the factory and get jQuery. 19 // For environments that do not have a `window` with a `document` 20 // (such as Node.js), expose a factory as module.exports. 21 // This accentuates the need for the creation of a real `window`. 22 // e.g. var jQuery = require("jquery")(window); 23 // See ticket trac-14549 for more info. 24 module.exports = global.document ? 25 factory( global, true ) : 26 function( w ) { 27 if ( !w.document ) { 28 throw new Error( "jQuery requires a window with a document" ); 29 } 30 return factory( w ); 31 }; 32 } else { 33 factory( global ); 34 } 35 36// Pass this if window is not defined yet 37} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 38 39// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 40// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 41// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 42// enough that all such attempts are guarded in a try block. 43"use strict"; 44 45var arr = []; 46 47var getProto = Object.getPrototypeOf; 48 49var slice = arr.slice; 50 51var flat = arr.flat ? function( array ) { 52 return arr.flat.call( array ); 53} : function( array ) { 54 return arr.concat.apply( [], array ); 55}; 56 57 58var push = arr.push; 59 60var indexOf = arr.indexOf; 61 62var class2type = {}; 63 64var toString = class2type.toString; 65 66var hasOwn = class2type.hasOwnProperty; 67 68var fnToString = hasOwn.toString; 69 70var ObjectFunctionString = fnToString.call( Object ); 71 72var support = {}; 73 74var isFunction = function isFunction( obj ) { 75 76 // Support: Chrome <=57, Firefox <=52 77 // In some browsers, typeof returns "function" for HTML <object> elements 78 // (i.e., `typeof document.createElement( "object" ) === "function"`). 79 // We don't want to classify *any* DOM node as a function. 80 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 81 // Plus for old WebKit, typeof returns "function" for HTML collections 82 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 83 return typeof obj === "function" && typeof obj.nodeType !== "number" && 84 typeof obj.item !== "function"; 85 }; 86 87 88var isWindow = function isWindow( obj ) { 89 return obj != null && obj === obj.window; 90 }; 91 92 93var document = window.document; 94 95 96 97 var preservedScriptAttributes = { 98 type: true, 99 src: true, 100 nonce: true, 101 noModule: true 102 }; 103 104 function DOMEval( code, node, doc ) { 105 doc = doc || document; 106 107 var i, val, 108 script = doc.createElement( "script" ); 109 110 script.text = code; 111 if ( node ) { 112 for ( i in preservedScriptAttributes ) { 113 114 // Support: Firefox 64+, Edge 18+ 115 // Some browsers don't support the "nonce" property on scripts. 116 // On the other hand, just using `getAttribute` is not enough as 117 // the `nonce` attribute is reset to an empty string whenever it 118 // becomes browsing-context connected. 119 // See https://github.com/whatwg/html/issues/2369 120 // See https://html.spec.whatwg.org/#nonce-attributes 121 // The `node.getAttribute` check was added for the sake of 122 // `jQuery.globalEval` so that it can fake a nonce-containing node 123 // via an object. 124 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 125 if ( val ) { 126 script.setAttribute( i, val ); 127 } 128 } 129 } 130 doc.head.appendChild( script ).parentNode.removeChild( script ); 131 } 132 133 134function toType( obj ) { 135 if ( obj == null ) { 136 return obj + ""; 137 } 138 139 // Support: Android <=2.3 only (functionish RegExp) 140 return typeof obj === "object" || typeof obj === "function" ? 141 class2type[ toString.call( obj ) ] || "object" : 142 typeof obj; 143} 144/* global Symbol */ 145// Defining this global in .eslintrc.json would create a danger of using the global 146// unguarded in another place, it seems safer to define global only for this module 147 148 149 150var version = "3.7.0", 151 152 rhtmlSuffix = /HTML$/i, 153 154 // Define a local copy of jQuery 155 jQuery = function( selector, context ) { 156 157 // The jQuery object is actually just the init constructor 'enhanced' 158 // Need init if jQuery is called (just allow error to be thrown if not included) 159 return new jQuery.fn.init( selector, context ); 160 }; 161 162jQuery.fn = jQuery.prototype = { 163 164 // The current version of jQuery being used 165 jquery: version, 166 167 constructor: jQuery, 168 169 // The default length of a jQuery object is 0 170 length: 0, 171 172 toArray: function() { 173 return slice.call( this ); 174 }, 175 176 // Get the Nth element in the matched element set OR 177 // Get the whole matched element set as a clean array 178 get: function( num ) { 179 180 // Return all the elements in a clean array 181 if ( num == null ) { 182 return slice.call( this ); 183 } 184 185 // Return just the one element from the set 186 return num < 0 ? this[ num + this.length ] : this[ num ]; 187 }, 188 189 // Take an array of elements and push it onto the stack 190 // (returning the new matched element set) 191 pushStack: function( elems ) { 192 193 // Build a new jQuery matched element set 194 var ret = jQuery.merge( this.constructor(), elems ); 195 196 // Add the old object onto the stack (as a reference) 197 ret.prevObject = this; 198 199 // Return the newly-formed element set 200 return ret; 201 }, 202 203 // Execute a callback for every element in the matched set. 204 each: function( callback ) { 205 return jQuery.each( this, callback ); 206 }, 207 208 map: function( callback ) { 209 return this.pushStack( jQuery.map( this, function( elem, i ) { 210 return callback.call( elem, i, elem ); 211 } ) ); 212 }, 213 214 slice: function() { 215 return this.pushStack( slice.apply( this, arguments ) ); 216 }, 217 218 first: function() { 219 return this.eq( 0 ); 220 }, 221 222 last: function() { 223 return this.eq( -1 ); 224 }, 225 226 even: function() { 227 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 228 return ( i + 1 ) % 2; 229 } ) ); 230 }, 231 232 odd: function() { 233 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 234 return i % 2; 235 } ) ); 236 }, 237 238 eq: function( i ) { 239 var len = this.length, 240 j = +i + ( i < 0 ? len : 0 ); 241 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 242 }, 243 244 end: function() { 245 return this.prevObject || this.constructor(); 246 }, 247 248 // For internal use only. 249 // Behaves like an Array's method, not like a jQuery method. 250 push: push, 251 sort: arr.sort, 252 splice: arr.splice 253}; 254 255jQuery.extend = jQuery.fn.extend = function() { 256 var options, name, src, copy, copyIsArray, clone, 257 target = arguments[ 0 ] || {}, 258 i = 1, 259 length = arguments.length, 260 deep = false;
vendor: 80,589 bytes, lines 261-3218
261 262 // Handle a deep copy situation 263 if ( typeof target === "boolean" ) { 264 deep = target; 265 266 // Skip the boolean and the target 267 target = arguments[ i ] || {}; 268 i++; 269 } 270 271 // Handle case when target is a string or something (possible in deep copy) 272 if ( typeof target !== "object" && !isFunction( target ) ) { 273 target = {}; 274 } 275 276 // Extend jQuery itself if only one argument is passed 277 if ( i === length ) { 278 target = this; 279 i--; 280 } 281 282 for ( ; i < length; i++ ) { 283 284 // Only deal with non-null/undefined values 285 if ( ( options = arguments[ i ] ) != null ) { 286 287 // Extend the base object 288 for ( name in options ) { 289 copy = options[ name ]; 290 291 // Prevent Object.prototype pollution 292 // Prevent never-ending loop 293 if ( name === "__proto__" || target === copy ) { 294 continue; 295 } 296 297 // Recurse if we're merging plain objects or arrays 298 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 299 ( copyIsArray = Array.isArray( copy ) ) ) ) { 300 src = target[ name ]; 301 302 // Ensure proper type for the source value 303 if ( copyIsArray && !Array.isArray( src ) ) { 304 clone = []; 305 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 306 clone = {}; 307 } else { 308 clone = src; 309 } 310 copyIsArray = false; 311 312 // Never move original objects, clone them 313 target[ name ] = jQuery.extend( deep, clone, copy ); 314 315 // Don't bring in undefined values 316 } else if ( copy !== undefined ) { 317 target[ name ] = copy; 318 } 319 } 320 } 321 } 322 323 // Return the modified object 324 return target; 325}; 326 327jQuery.extend( { 328 329 // Unique for each copy of jQuery on the page 330 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 331 332 // Assume jQuery is ready without the ready module 333 isReady: true, 334 335 error: function( msg ) { 336 throw new Error( msg ); 337 }, 338 339 noop: function() {}, 340 341 isPlainObject: function( obj ) { 342 var proto, Ctor; 343 344 // Detect obvious negatives 345 // Use toString instead of jQuery.type to catch host objects 346 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 347 return false; 348 } 349 350 proto = getProto( obj ); 351 352 // Objects with no prototype (e.g., `Object.create( null )`) are plain 353 if ( !proto ) { 354 return true; 355 } 356 357 // Objects with prototype are plain iff they were constructed by a global Object function 358 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 359 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 360 }, 361 362 isEmptyObject: function( obj ) { 363 var name; 364 365 for ( name in obj ) { 366 return false; 367 } 368 return true; 369 }, 370 371 // Evaluates a script in a provided context; falls back to the global one 372 // if not specified. 373 globalEval: function( code, options, doc ) { 374 DOMEval( code, { nonce: options && options.nonce }, doc ); 375 }, 376 377 each: function( obj, callback ) { 378 var length, i = 0; 379 380 if ( isArrayLike( obj ) ) { 381 length = obj.length; 382 for ( ; i < length; i++ ) { 383 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 384 break; 385 } 386 } 387 } else { 388 for ( i in obj ) { 389 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 390 break; 391 } 392 } 393 } 394 395 return obj; 396 }, 397 398 399 // Retrieve the text value of an array of DOM nodes 400 text: function( elem ) { 401 var node, 402 ret = "", 403 i = 0, 404 nodeType = elem.nodeType; 405 406 if ( !nodeType ) { 407 408 // If no nodeType, this is expected to be an array 409 while ( ( node = elem[ i++ ] ) ) { 410 411 // Do not traverse comment nodes 412 ret += jQuery.text( node ); 413 } 414 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 415 return elem.textContent; 416 } else if ( nodeType === 3 || nodeType === 4 ) { 417 return elem.nodeValue; 418 } 419 420 // Do not include comment or processing instruction nodes 421 422 return ret; 423 }, 424 425 // results is for internal usage only 426 makeArray: function( arr, results ) { 427 var ret = results || []; 428 429 if ( arr != null ) { 430 if ( isArrayLike( Object( arr ) ) ) { 431 jQuery.merge( ret, 432 typeof arr === "string" ? 433 [ arr ] : arr 434 ); 435 } else { 436 push.call( ret, arr ); 437 } 438 } 439 440 return ret; 441 }, 442 443 inArray: function( elem, arr, i ) { 444 return arr == null ? -1 : indexOf.call( arr, elem, i ); 445 }, 446 447 isXMLDoc: function( elem ) { 448 var namespace = elem && elem.namespaceURI, 449 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 450 451 // Assume HTML when documentElement doesn't yet exist, such as inside 452 // document fragments. 453 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 454 }, 455 456 // Support: Android <=4.0 only, PhantomJS 1 only 457 // push.apply(_, arraylike) throws on ancient WebKit 458 merge: function( first, second ) { 459 var len = +second.length, 460 j = 0, 461 i = first.length; 462 463 for ( ; j < len; j++ ) { 464 first[ i++ ] = second[ j ]; 465 } 466 467 first.length = i; 468 469 return first; 470 }, 471 472 grep: function( elems, callback, invert ) { 473 var callbackInverse, 474 matches = [], 475 i = 0, 476 length = elems.length, 477 callbackExpect = !invert; 478 479 // Go through the array, only saving the items 480 // that pass the validator function 481 for ( ; i < length; i++ ) { 482 callbackInverse = !callback( elems[ i ], i ); 483 if ( callbackInverse !== callbackExpect ) { 484 matches.push( elems[ i ] ); 485 } 486 } 487 488 return matches; 489 }, 490 491 // arg is for internal usage only 492 map: function( elems, callback, arg ) { 493 var length, value, 494 i = 0, 495 ret = []; 496 497 // Go through the array, translating each of the items to their new values 498 if ( isArrayLike( elems ) ) { 499 length = elems.length; 500 for ( ; i < length; i++ ) { 501 value = callback( elems[ i ], i, arg ); 502 503 if ( value != null ) { 504 ret.push( value ); 505 } 506 } 507 508 // Go through every key on the object, 509 } else { 510 for ( i in elems ) { 511 value = callback( elems[ i ], i, arg ); 512 513 if ( value != null ) { 514 ret.push( value ); 515 } 516 } 517 } 518 519 // Flatten any nested arrays 520 return flat( ret ); 521 }, 522 523 // A global GUID counter for objects 524 guid: 1, 525 526 // jQuery.support is not used in Core but other projects attach their 527 // properties to it so it needs to exist. 528 support: support 529} ); 530 531if ( typeof Symbol === "function" ) { 532 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 533} 534 535// Populate the class2type map 536jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 537 function( _i, name ) { 538 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 539 } ); 540 541function isArrayLike( obj ) { 542 543 // Support: real iOS 8.2 only (not reproducible in simulator) 544 // `in` check used to prevent JIT error (gh-2145) 545 // hasOwn isn't used here due to false negatives 546 // regarding Nodelist length in IE 547 var length = !!obj && "length" in obj && obj.length, 548 type = toType( obj ); 549 550 if ( isFunction( obj ) || isWindow( obj ) ) { 551 return false; 552 } 553 554 return type === "array" || length === 0 || 555 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 556} 557 558 559function nodeName( elem, name ) { 560 561 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 562 563} 564var pop = arr.pop; 565 566 567var sort = arr.sort; 568 569 570var splice = arr.splice; 571 572 573var whitespace = "[\\x20\\t\\r\\n\\f]"; 574 575 576var rtrimCSS = new RegExp( 577 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 578 "g" 579); 580 581 582 583 584// Note: an element does not contain itself 585jQuery.contains = function( a, b ) { 586 var bup = b && b.parentNode; 587 588 return a === bup || !!( bup && bup.nodeType === 1 && ( 589 590 // Support: IE 9 - 11+ 591 // IE doesn't have `contains` on SVG. 592 a.contains ? 593 a.contains( bup ) : 594 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 595 ) ); 596}; 597 598 599 600 601// CSS string/identifier serialization 602// https://drafts.csswg.org/cssom/#common-serializing-idioms 603var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 604 605function fcssescape( ch, asCodePoint ) { 606 if ( asCodePoint ) { 607 608 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 609 if ( ch === "\0" ) { 610 return "\uFFFD"; 611 } 612 613 // Control characters and (dependent upon position) numbers get escaped as code points 614 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 615 } 616 617 // Other potentially-special ASCII characters get backslash-escaped 618 return "\\" + ch; 619} 620 621jQuery.escapeSelector = function( sel ) { 622 return ( sel + "" ).replace( rcssescape, fcssescape ); 623}; 624 625 626 627 628var preferredDoc = document, 629 pushNative = push; 630 631( function() { 632 633var i, 634 Expr, 635 outermostContext, 636 sortInput, 637 hasDuplicate, 638 push = pushNative, 639 640 // Local document vars 641 document, 642 documentElement, 643 documentIsHTML, 644 rbuggyQSA, 645 matches, 646 647 // Instance-specific data 648 expando = jQuery.expando, 649 dirruns = 0, 650 done = 0, 651 classCache = createCache(), 652 tokenCache = createCache(), 653 compilerCache = createCache(), 654 nonnativeSelectorCache = createCache(), 655 sortOrder = function( a, b ) { 656 if ( a === b ) { 657 hasDuplicate = true; 658 } 659 return 0; 660 }, 661 662 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 663 "loop|multiple|open|readonly|required|scoped", 664 665 // Regular expressions 666 667 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 668 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 669 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 670 671 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 672 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 673 674 // Operator (capture 2) 675 "*([*^$|!~]?=)" + whitespace + 676 677 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 678 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 679 whitespace + "*\\]", 680 681 pseudos = ":(" + identifier + ")(?:\\((" + 682 683 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 684 // 1. quoted (capture 3; capture 4 or capture 5) 685 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 686 687 // 2. simple (capture 6) 688 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 689 690 // 3. anything else (capture 2) 691 ".*" + 692 ")\\)|)", 693 694 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 695 rwhitespace = new RegExp( whitespace + "+", "g" ), 696 697 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 698 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 699 whitespace + "*" ), 700 rdescend = new RegExp( whitespace + "|>" ), 701 702 rpseudo = new RegExp( pseudos ), 703 ridentifier = new RegExp( "^" + identifier + "$" ), 704 705 matchExpr = { 706 ID: new RegExp( "^#(" + identifier + ")" ), 707 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 708 TAG: new RegExp( "^(" + identifier + "|[*])" ), 709 ATTR: new RegExp( "^" + attributes ), 710 PSEUDO: new RegExp( "^" + pseudos ), 711 CHILD: new RegExp( 712 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 713 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 714 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 715 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 716 717 // For use in libraries implementing .is() 718 // We use this for POS matching in `select` 719 needsContext: new RegExp( "^" + whitespace + 720 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 721 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 722 }, 723 724 rinputs = /^(?:input|select|textarea|button)$/i, 725 rheader = /^h\d$/i, 726 727 // Easily-parseable/retrievable ID or TAG or CLASS selectors 728 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 729 730 rsibling = /[+~]/, 731 732 // CSS escapes 733 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 734 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 735 "?|\\\\([^\\r\\n\\f])", "g" ), 736 funescape = function( escape, nonHex ) { 737 var high = "0x" + escape.slice( 1 ) - 0x10000; 738 739 if ( nonHex ) { 740 741 // Strip the backslash prefix from a non-hex escape sequence 742 return nonHex; 743 } 744 745 // Replace a hexadecimal escape sequence with the encoded Unicode code point 746 // Support: IE <=11+ 747 // For values outside the Basic Multilingual Plane (BMP), manually construct a 748 // surrogate pair 749 return high < 0 ? 750 String.fromCharCode( high + 0x10000 ) : 751 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 752 }, 753 754 // Used for iframes; see `setDocument`. 755 // Support: IE 9 - 11+, Edge 12 - 18+ 756 // Removing the function wrapper causes a "Permission Denied" 757 // error in IE/Edge. 758 unloadHandler = function() { 759 setDocument(); 760 }, 761 762 inDisabledFieldset = addCombinator( 763 function( elem ) { 764 return elem.disabled === true && nodeName( elem, "fieldset" ); 765 }, 766 { dir: "parentNode", next: "legend" } 767 ); 768 769// Support: IE <=9 only 770// Accessing document.activeElement can throw unexpectedly 771// https://bugs.jquery.com/ticket/13393 772function safeActiveElement() { 773 try { 774 return document.activeElement; 775 } catch ( err ) { } 776} 777 778// Optimize for push.apply( _, NodeList ) 779try { 780 push.apply( 781 ( arr = slice.call( preferredDoc.childNodes ) ), 782 preferredDoc.childNodes 783 ); 784 785 // Support: Android <=4.0 786 // Detect silently failing push.apply 787 // eslint-disable-next-line no-unused-expressions 788 arr[ preferredDoc.childNodes.length ].nodeType; 789} catch ( e ) { 790 push = { 791 apply: function( target, els ) { 792 pushNative.apply( target, slice.call( els ) ); 793 }, 794 call: function( target ) { 795 pushNative.apply( target, slice.call( arguments, 1 ) ); 796 } 797 }; 798} 799 800function find( selector, context, results, seed ) { 801 var m, i, elem, nid, match, groups, newSelector, 802 newContext = context && context.ownerDocument, 803 804 // nodeType defaults to 9, since context defaults to document 805 nodeType = context ? context.nodeType : 9; 806 807 results = results || []; 808 809 // Return early from calls with invalid selector or context 810 if ( typeof selector !== "string" || !selector || 811 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 812 813 return results; 814 } 815 816 // Try to shortcut find operations (as opposed to filters) in HTML documents 817 if ( !seed ) { 818 setDocument( context ); 819 context = context || document; 820 821 if ( documentIsHTML ) { 822 823 // If the selector is sufficiently simple, try using a "get*By*" DOM method 824 // (excepting DocumentFragment context, where the methods don't exist) 825 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 826 827 // ID selector 828 if ( ( m = match[ 1 ] ) ) { 829 830 // Document context 831 if ( nodeType === 9 ) { 832 if ( ( elem = context.getElementById( m ) ) ) { 833 834 // Support: IE 9 only 835 // getElementById can match elements by name instead of ID 836 if ( elem.id === m ) { 837 push.call( results, elem ); 838 return results; 839 } 840 } else { 841 return results; 842 } 843 844 // Element context 845 } else { 846 847 // Support: IE 9 only 848 // getElementById can match elements by name instead of ID 849 if ( newContext && ( elem = newContext.getElementById( m ) ) && 850 find.contains( context, elem ) && 851 elem.id === m ) { 852 853 push.call( results, elem ); 854 return results; 855 } 856 } 857 858 // Type selector 859 } else if ( match[ 2 ] ) { 860 push.apply( results, context.getElementsByTagName( selector ) ); 861 return results; 862 863 // Class selector 864 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 865 push.apply( results, context.getElementsByClassName( m ) ); 866 return results; 867 } 868 } 869 870 // Take advantage of querySelectorAll 871 if ( !nonnativeSelectorCache[ selector + " " ] && 872 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 873 874 newSelector = selector; 875 newContext = context; 876 877 // qSA considers elements outside a scoping root when evaluating child or 878 // descendant combinators, which is not what we want. 879 // In such cases, we work around the behavior by prefixing every selector in the 880 // list with an ID selector referencing the scope context. 881 // The technique has to be used as well when a leading combinator is used 882 // as such selectors are not recognized by querySelectorAll. 883 // Thanks to Andrew Dupont for this technique. 884 if ( nodeType === 1 && 885 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 886 887 // Expand context for sibling selectors 888 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 889 context; 890 891 // We can use :scope instead of the ID hack if the browser 892 // supports it & if we're not changing the context. 893 // Support: IE 11+, Edge 17 - 18+ 894 // IE/Edge sometimes throw a "Permission denied" error when 895 // strict-comparing two documents; shallow comparisons work. 896 // eslint-disable-next-line eqeqeq 897 if ( newContext != context || !support.scope ) { 898 899 // Capture the context ID, setting it first if necessary 900 if ( ( nid = context.getAttribute( "id" ) ) ) { 901 nid = jQuery.escapeSelector( nid ); 902 } else { 903 context.setAttribute( "id", ( nid = expando ) ); 904 } 905 } 906 907 // Prefix every selector in the list 908 groups = tokenize( selector ); 909 i = groups.length; 910 while ( i-- ) { 911 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 912 toSelector( groups[ i ] ); 913 } 914 newSelector = groups.join( "," ); 915 } 916 917 try { 918 push.apply( results, 919 newContext.querySelectorAll( newSelector ) 920 ); 921 return results; 922 } catch ( qsaError ) { 923 nonnativeSelectorCache( selector, true ); 924 } finally { 925 if ( nid === expando ) { 926 context.removeAttribute( "id" ); 927 } 928 } 929 } 930 } 931 } 932 933 // All others 934 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 935} 936 937/** 938 * Create key-value caches of limited size 939 * @returns {function(string, object)} Returns the Object data after storing it on itself with 940 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 941 * deleting the oldest entry 942 */ 943function createCache() { 944 var keys = []; 945 946 function cache( key, value ) { 947 948 // Use (key + " ") to avoid collision with native prototype properties 949 // (see https://github.com/jquery/sizzle/issues/157) 950 if ( keys.push( key + " " ) > Expr.cacheLength ) { 951 952 // Only keep the most recent entries 953 delete cache[ keys.shift() ]; 954 } 955 return ( cache[ key + " " ] = value ); 956 } 957 return cache; 958} 959 960/** 961 * Mark a function for special use by jQuery selector module 962 * @param {Function} fn The function to mark 963 */ 964function markFunction( fn ) { 965 fn[ expando ] = true; 966 return fn; 967} 968 969/** 970 * Support testing using an element 971 * @param {Function} fn Passed the created element and returns a boolean result 972 */ 973function assert( fn ) { 974 var el = document.createElement( "fieldset" ); 975 976 try { 977 return !!fn( el ); 978 } catch ( e ) { 979 return false; 980 } finally { 981 982 // Remove from its parent by default 983 if ( el.parentNode ) { 984 el.parentNode.removeChild( el ); 985 } 986 987 // release memory in IE 988 el = null; 989 } 990} 991 992/** 993 * Returns a function to use in pseudos for input types 994 * @param {String} type 995 */ 996function createInputPseudo( type ) { 997 return function( elem ) { 998 return nodeName( elem, "input" ) && elem.type === type; 999 }; 1000} 1001 1002/** 1003 * Returns a function to use in pseudos for buttons 1004 * @param {String} type 1005 */ 1006function createButtonPseudo( type ) { 1007 return function( elem ) { 1008 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 1009 elem.type === type; 1010 }; 1011} 1012 1013/** 1014 * Returns a function to use in pseudos for :enabled/:disabled 1015 * @param {Boolean} disabled true for :disabled; false for :enabled 1016 */ 1017function createDisabledPseudo( disabled ) { 1018 1019 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1020 return function( elem ) { 1021 1022 // Only certain elements can match :enabled or :disabled 1023 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1024 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1025 if ( "form" in elem ) { 1026 1027 // Check for inherited disabledness on relevant non-disabled elements: 1028 // * listed form-associated elements in a disabled fieldset 1029 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1030 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1031 // * option elements in a disabled optgroup 1032 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1033 // All such elements have a "form" property. 1034 if ( elem.parentNode && elem.disabled === false ) { 1035 1036 // Option elements defer to a parent optgroup if present 1037 if ( "label" in elem ) { 1038 if ( "label" in elem.parentNode ) { 1039 return elem.parentNode.disabled === disabled; 1040 } else { 1041 return elem.disabled === disabled; 1042 } 1043 } 1044 1045 // Support: IE 6 - 11+ 1046 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1047 return elem.isDisabled === disabled || 1048 1049 // Where there is no isDisabled, check manually 1050 elem.isDisabled !== !disabled && 1051 inDisabledFieldset( elem ) === disabled; 1052 } 1053 1054 return elem.disabled === disabled; 1055 1056 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1057 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1058 // even exist on them, let alone have a boolean value. 1059 } else if ( "label" in elem ) { 1060 return elem.disabled === disabled; 1061 } 1062 1063 // Remaining elements are neither :enabled nor :disabled 1064 return false; 1065 }; 1066} 1067 1068/** 1069 * Returns a function to use in pseudos for positionals 1070 * @param {Function} fn 1071 */ 1072function createPositionalPseudo( fn ) { 1073 return markFunction( function( argument ) { 1074 argument = +argument; 1075 return markFunction( function( seed, matches ) { 1076 var j, 1077 matchIndexes = fn( [], seed.length, argument ), 1078 i = matchIndexes.length; 1079 1080 // Match elements found at the specified indexes 1081 while ( i-- ) { 1082 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1083 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1084 } 1085 } 1086 } ); 1087 } ); 1088} 1089 1090/** 1091 * Checks a node for validity as a jQuery selector context 1092 * @param {Element|Object=} context 1093 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1094 */ 1095function testContext( context ) { 1096 return context && typeof context.getElementsByTagName !== "undefined" && context; 1097} 1098 1099/** 1100 * Sets document-related variables once based on the current document 1101 * @param {Element|Object} [node] An element or document object to use to set the document 1102 * @returns {Object} Returns the current document 1103 */ 1104function setDocument( node ) { 1105 var subWindow, 1106 doc = node ? node.ownerDocument || node : preferredDoc; 1107 1108 // Return early if doc is invalid or already selected 1109 // Support: IE 11+, Edge 17 - 18+ 1110 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1111 // two documents; shallow comparisons work. 1112 // eslint-disable-next-line eqeqeq 1113 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1114 return document; 1115 } 1116 1117 // Update global variables 1118 document = doc; 1119 documentElement = document.documentElement; 1120 documentIsHTML = !jQuery.isXMLDoc( document ); 1121 1122 // Support: iOS 7 only, IE 9 - 11+ 1123 // Older browsers didn't support unprefixed `matches`. 1124 matches = documentElement.matches || 1125 documentElement.webkitMatchesSelector || 1126 documentElement.msMatchesSelector; 1127 1128 // Support: IE 9 - 11+, Edge 12 - 18+ 1129 // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936) 1130 // Support: IE 11+, Edge 17 - 18+ 1131 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1132 // two documents; shallow comparisons work. 1133 // eslint-disable-next-line eqeqeq 1134 if ( preferredDoc != document && 1135 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1136 1137 // Support: IE 9 - 11+, Edge 12 - 18+ 1138 subWindow.addEventListener( "unload", unloadHandler ); 1139 } 1140 1141 // Support: IE <10 1142 // Check if getElementById returns elements by name 1143 // The broken getElementById methods don't pick up programmatically-set names, 1144 // so use a roundabout getElementsByName test 1145 support.getById = assert( function( el ) { 1146 documentElement.appendChild( el ).id = jQuery.expando; 1147 return !document.getElementsByName || 1148 !document.getElementsByName( jQuery.expando ).length; 1149 } ); 1150 1151 // Support: IE 9 only 1152 // Check to see if it's possible to do matchesSelector 1153 // on a disconnected node. 1154 support.disconnectedMatch = assert( function( el ) { 1155 return matches.call( el, "*" ); 1156 } ); 1157 1158 // Support: IE 9 - 11+, Edge 12 - 18+ 1159 // IE/Edge don't support the :scope pseudo-class. 1160 support.scope = assert( function() { 1161 return document.querySelectorAll( ":scope" ); 1162 } ); 1163 1164 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 1165 // Make sure the `:has()` argument is parsed unforgivingly. 1166 // We include `*` in the test to detect buggy implementations that are 1167 // _selectively_ forgiving (specifically when the list includes at least 1168 // one valid selector). 1169 // Note that we treat complete lack of support for `:has()` as if it were 1170 // spec-compliant support, which is fine because use of `:has()` in such 1171 // environments will fail in the qSA path and fall back to jQuery traversal 1172 // anyway. 1173 support.cssHas = assert( function() { 1174 try { 1175 document.querySelector( ":has(*,:jqfake)" ); 1176 return false; 1177 } catch ( e ) { 1178 return true; 1179 } 1180 } ); 1181 1182 // ID filter and find 1183 if ( support.getById ) { 1184 Expr.filter.ID = function( id ) { 1185 var attrId = id.replace( runescape, funescape ); 1186 return function( elem ) { 1187 return elem.getAttribute( "id" ) === attrId; 1188 }; 1189 }; 1190 Expr.find.ID = function( id, context ) { 1191 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1192 var elem = context.getElementById( id ); 1193 return elem ? [ elem ] : []; 1194 } 1195 }; 1196 } else { 1197 Expr.filter.ID = function( id ) { 1198 var attrId = id.replace( runescape, funescape ); 1199 return function( elem ) { 1200 var node = typeof elem.getAttributeNode !== "undefined" && 1201 elem.getAttributeNode( "id" ); 1202 return node && node.value === attrId; 1203 }; 1204 }; 1205 1206 // Support: IE 6 - 7 only 1207 // getElementById is not reliable as a find shortcut 1208 Expr.find.ID = function( id, context ) { 1209 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1210 var node, i, elems, 1211 elem = context.getElementById( id ); 1212 1213 if ( elem ) { 1214 1215 // Verify the id attribute 1216 node = elem.getAttributeNode( "id" ); 1217 if ( node && node.value === id ) { 1218 return [ elem ]; 1219 } 1220 1221 // Fall back on getElementsByName 1222 elems = context.getElementsByName( id ); 1223 i = 0; 1224 while ( ( elem = elems[ i++ ] ) ) { 1225 node = elem.getAttributeNode( "id" ); 1226 if ( node && node.value === id ) { 1227 return [ elem ]; 1228 } 1229 } 1230 } 1231 1232 return []; 1233 } 1234 }; 1235 } 1236 1237 // Tag 1238 Expr.find.TAG = function( tag, context ) { 1239 if ( typeof context.getElementsByTagName !== "undefined" ) { 1240 return context.getElementsByTagName( tag ); 1241 1242 // DocumentFragment nodes don't have gEBTN 1243 } else { 1244 return context.querySelectorAll( tag ); 1245 } 1246 }; 1247 1248 // Class 1249 Expr.find.CLASS = function( className, context ) { 1250 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1251 return context.getElementsByClassName( className ); 1252 } 1253 }; 1254 1255 /* QSA/matchesSelector 1256 ---------------------------------------------------------------------- */ 1257 1258 // QSA and matchesSelector support 1259 1260 rbuggyQSA = []; 1261 1262 // Build QSA regex 1263 // Regex strategy adopted from Diego Perini 1264 assert( function( el ) { 1265 1266 var input; 1267 1268 documentElement.appendChild( el ).innerHTML = 1269 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 1270 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 1271 "<option selected=''></option></select>"; 1272 1273 // Support: iOS <=7 - 8 only 1274 // Boolean attributes and "value" are not treated correctly in some XML documents 1275 if ( !el.querySelectorAll( "[selected]" ).length ) { 1276 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1277 } 1278 1279 // Support: iOS <=7 - 8 only 1280 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1281 rbuggyQSA.push( "~=" ); 1282 } 1283 1284 // Support: iOS 8 only 1285 // https://bugs.webkit.org/show_bug.cgi?id=136851 1286 // In-page `selector#id sibling-combinator selector` fails 1287 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1288 rbuggyQSA.push( ".#.+[+~]" ); 1289 } 1290 1291 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1292 // In some of the document kinds, these selectors wouldn't work natively. 1293 // This is probably OK but for backwards compatibility we want to maintain 1294 // handling them through jQuery traversal in jQuery 3.x. 1295 if ( !el.querySelectorAll( ":checked" ).length ) { 1296 rbuggyQSA.push( ":checked" ); 1297 } 1298 1299 // Support: Windows 8 Native Apps 1300 // The type and name attributes are restricted during .innerHTML assignment 1301 input = document.createElement( "input" ); 1302 input.setAttribute( "type", "hidden" ); 1303 el.appendChild( input ).setAttribute( "name", "D" ); 1304 1305 // Support: IE 9 - 11+ 1306 // IE's :disabled selector does not pick up the children of disabled fieldsets 1307 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1308 // In some of the document kinds, these selectors wouldn't work natively. 1309 // This is probably OK but for backwards compatibility we want to maintain 1310 // handling them through jQuery traversal in jQuery 3.x. 1311 documentElement.appendChild( el ).disabled = true; 1312 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1313 rbuggyQSA.push( ":enabled", ":disabled" ); 1314 } 1315 1316 // Support: IE 11+, Edge 15 - 18+ 1317 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1318 // Adding a temporary attribute to the document before the selection works 1319 // around the issue. 1320 // Interestingly, IE 10 & older don't seem to have the issue. 1321 input = document.createElement( "input" ); 1322 input.setAttribute( "name", "" ); 1323 el.appendChild( input ); 1324 if ( !el.querySelectorAll( "[name='']" ).length ) { 1325 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1326 whitespace + "*(?:''|\"\")" ); 1327 } 1328 } ); 1329 1330 if ( !support.cssHas ) { 1331 1332 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1333 // Our regular `try-catch` mechanism fails to detect natively-unsupported 1334 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 1335 // in browsers that parse the `:has()` argument as a forgiving selector list. 1336 // https://drafts.csswg.org/selectors/#relational now requires the argument 1337 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 1338 rbuggyQSA.push( ":has" ); 1339 } 1340 1341 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1342 1343 /* Sorting 1344 ---------------------------------------------------------------------- */ 1345 1346 // Document order sorting 1347 sortOrder = function( a, b ) { 1348 1349 // Flag for duplicate removal 1350 if ( a === b ) { 1351 hasDuplicate = true; 1352 return 0; 1353 } 1354 1355 // Sort on method existence if only one input has compareDocumentPosition 1356 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1357 if ( compare ) { 1358 return compare; 1359 } 1360 1361 // Calculate position if both inputs belong to the same document 1362 // Support: IE 11+, Edge 17 - 18+ 1363 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1364 // two documents; shallow comparisons work. 1365 // eslint-disable-next-line eqeqeq 1366 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1367 a.compareDocumentPosition( b ) : 1368 1369 // Otherwise we know they are disconnected 1370 1; 1371 1372 // Disconnected nodes 1373 if ( compare & 1 || 1374 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1375 1376 // Choose the first element that is related to our preferred document 1377 // Support: IE 11+, Edge 17 - 18+ 1378 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1379 // two documents; shallow comparisons work. 1380 // eslint-disable-next-line eqeqeq 1381 if ( a === document || a.ownerDocument == preferredDoc && 1382 find.contains( preferredDoc, a ) ) { 1383 return -1; 1384 } 1385 1386 // Support: IE 11+, Edge 17 - 18+ 1387 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1388 // two documents; shallow comparisons work. 1389 // eslint-disable-next-line eqeqeq 1390 if ( b === document || b.ownerDocument == preferredDoc && 1391 find.contains( preferredDoc, b ) ) { 1392 return 1; 1393 } 1394 1395 // Maintain original order 1396 return sortInput ? 1397 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1398 0; 1399 } 1400 1401 return compare & 4 ? -1 : 1; 1402 }; 1403 1404 return document; 1405} 1406 1407find.matches = function( expr, elements ) { 1408 return find( expr, null, null, elements ); 1409}; 1410 1411find.matchesSelector = function( elem, expr ) { 1412 setDocument( elem ); 1413 1414 if ( documentIsHTML && 1415 !nonnativeSelectorCache[ expr + " " ] && 1416 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1417 1418 try { 1419 var ret = matches.call( elem, expr ); 1420 1421 // IE 9's matchesSelector returns false on disconnected nodes 1422 if ( ret || support.disconnectedMatch || 1423 1424 // As well, disconnected nodes are said to be in a document 1425 // fragment in IE 9 1426 elem.document && elem.document.nodeType !== 11 ) { 1427 return ret; 1428 } 1429 } catch ( e ) { 1430 nonnativeSelectorCache( expr, true ); 1431 } 1432 } 1433 1434 return find( expr, document, null, [ elem ] ).length > 0; 1435}; 1436 1437find.contains = function( context, elem ) { 1438 1439 // Set document vars if needed 1440 // Support: IE 11+, Edge 17 - 18+ 1441 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1442 // two documents; shallow comparisons work. 1443 // eslint-disable-next-line eqeqeq 1444 if ( ( context.ownerDocument || context ) != document ) { 1445 setDocument( context ); 1446 } 1447 return jQuery.contains( context, elem ); 1448}; 1449 1450 1451find.attr = function( elem, name ) { 1452 1453 // Set document vars if needed 1454 // Support: IE 11+, Edge 17 - 18+ 1455 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1456 // two documents; shallow comparisons work. 1457 // eslint-disable-next-line eqeqeq 1458 if ( ( elem.ownerDocument || elem ) != document ) { 1459 setDocument( elem ); 1460 } 1461 1462 var fn = Expr.attrHandle[ name.toLowerCase() ], 1463 1464 // Don't get fooled by Object.prototype properties (see trac-13807) 1465 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1466 fn( elem, name, !documentIsHTML ) : 1467 undefined; 1468 1469 if ( val !== undefined ) { 1470 return val; 1471 } 1472 1473 return elem.getAttribute( name ); 1474}; 1475 1476find.error = function( msg ) { 1477 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1478}; 1479 1480/** 1481 * Document sorting and removing duplicates 1482 * @param {ArrayLike} results 1483 */ 1484jQuery.uniqueSort = function( results ) { 1485 var elem, 1486 duplicates = [], 1487 j = 0, 1488 i = 0; 1489 1490 // Unless we *know* we can detect duplicates, assume their presence 1491 // 1492 // Support: Android <=4.0+ 1493 // Testing for detecting duplicates is unpredictable so instead assume we can't 1494 // depend on duplicate detection in all browsers without a stable sort. 1495 hasDuplicate = !support.sortStable; 1496 sortInput = !support.sortStable && slice.call( results, 0 ); 1497 sort.call( results, sortOrder ); 1498 1499 if ( hasDuplicate ) { 1500 while ( ( elem = results[ i++ ] ) ) { 1501 if ( elem === results[ i ] ) { 1502 j = duplicates.push( i ); 1503 } 1504 } 1505 while ( j-- ) { 1506 splice.call( results, duplicates[ j ], 1 ); 1507 } 1508 } 1509 1510 // Clear input after sorting to release objects 1511 // See https://github.com/jquery/sizzle/pull/225 1512 sortInput = null; 1513 1514 return results; 1515}; 1516 1517jQuery.fn.uniqueSort = function() { 1518 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 1519}; 1520 1521Expr = jQuery.expr = { 1522 1523 // Can be adjusted by the user 1524 cacheLength: 50, 1525 1526 createPseudo: markFunction, 1527 1528 match: matchExpr, 1529 1530 attrHandle: {}, 1531 1532 find: {}, 1533 1534 relative: { 1535 ">": { dir: "parentNode", first: true }, 1536 " ": { dir: "parentNode" }, 1537 "+": { dir: "previousSibling", first: true }, 1538 "~": { dir: "previousSibling" } 1539 }, 1540 1541 preFilter: { 1542 ATTR: function( match ) { 1543 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1544 1545 // Move the given value to match[3] whether quoted or unquoted 1546 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 1547 .replace( runescape, funescape ); 1548 1549 if ( match[ 2 ] === "~=" ) { 1550 match[ 3 ] = " " + match[ 3 ] + " "; 1551 } 1552 1553 return match.slice( 0, 4 ); 1554 }, 1555 1556 CHILD: function( match ) { 1557 1558 /* matches from matchExpr["CHILD"] 1559 1 type (only|nth|...) 1560 2 what (child|of-type) 1561 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1562 4 xn-component of xn+y argument ([+-]?\d*n|) 1563 5 sign of xn-component 1564 6 x of xn-component 1565 7 sign of y-component 1566 8 y of y-component 1567 */ 1568 match[ 1 ] = match[ 1 ].toLowerCase(); 1569 1570 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1571 1572 // nth-* requires argument 1573 if ( !match[ 3 ] ) { 1574 find.error( match[ 0 ] ); 1575 } 1576 1577 // numeric x and y parameters for Expr.filter.CHILD 1578 // remember that false/true cast respectively to 0/1 1579 match[ 4 ] = +( match[ 4 ] ? 1580 match[ 5 ] + ( match[ 6 ] || 1 ) : 1581 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 1582 ); 1583 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1584 1585 // other types prohibit arguments 1586 } else if ( match[ 3 ] ) { 1587 find.error( match[ 0 ] ); 1588 } 1589 1590 return match; 1591 }, 1592 1593 PSEUDO: function( match ) { 1594 var excess, 1595 unquoted = !match[ 6 ] && match[ 2 ]; 1596 1597 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 1598 return null; 1599 } 1600 1601 // Accept quoted arguments as-is 1602 if ( match[ 3 ] ) { 1603 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1604 1605 // Strip excess characters from unquoted arguments 1606 } else if ( unquoted && rpseudo.test( unquoted ) && 1607 1608 // Get excess from tokenize (recursively) 1609 ( excess = tokenize( unquoted, true ) ) && 1610 1611 // advance to the next closing parenthesis 1612 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1613 1614 // excess is a negative index 1615 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1616 match[ 2 ] = unquoted.slice( 0, excess ); 1617 } 1618 1619 // Return only captures needed by the pseudo filter method (type and argument) 1620 return match.slice( 0, 3 ); 1621 } 1622 }, 1623 1624 filter: { 1625 1626 TAG: function( nodeNameSelector ) { 1627 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1628 return nodeNameSelector === "*" ? 1629 function() { 1630 return true; 1631 } : 1632 function( elem ) { 1633 return nodeName( elem, expectedNodeName ); 1634 }; 1635 }, 1636 1637 CLASS: function( className ) { 1638 var pattern = classCache[ className + " " ]; 1639 1640 return pattern || 1641 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 1642 "(" + whitespace + "|$)" ) ) && 1643 classCache( className, function( elem ) { 1644 return pattern.test( 1645 typeof elem.className === "string" && elem.className || 1646 typeof elem.getAttribute !== "undefined" && 1647 elem.getAttribute( "class" ) || 1648 "" 1649 ); 1650 } ); 1651 }, 1652 1653 ATTR: function( name, operator, check ) { 1654 return function( elem ) { 1655 var result = find.attr( elem, name ); 1656 1657 if ( result == null ) { 1658 return operator === "!="; 1659 } 1660 if ( !operator ) { 1661 return true; 1662 } 1663 1664 result += ""; 1665 1666 if ( operator === "=" ) { 1667 return result === check; 1668 } 1669 if ( operator === "!=" ) { 1670 return result !== check; 1671 } 1672 if ( operator === "^=" ) { 1673 return check && result.indexOf( check ) === 0; 1674 } 1675 if ( operator === "*=" ) { 1676 return check && result.indexOf( check ) > -1; 1677 } 1678 if ( operator === "$=" ) { 1679 return check && result.slice( -check.length ) === check; 1680 } 1681 if ( operator === "~=" ) { 1682 return ( " " + result.replace( rwhitespace, " " ) + " " ) 1683 .indexOf( check ) > -1; 1684 } 1685 if ( operator === "|=" ) { 1686 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 1687 } 1688 1689 return false; 1690 }; 1691 }, 1692 1693 CHILD: function( type, what, _argument, first, last ) { 1694 var simple = type.slice( 0, 3 ) !== "nth", 1695 forward = type.slice( -4 ) !== "last", 1696 ofType = what === "of-type"; 1697 1698 return first === 1 && last === 0 ? 1699 1700 // Shortcut for :nth-*(n) 1701 function( elem ) { 1702 return !!elem.parentNode; 1703 } : 1704 1705 function( elem, _context, xml ) { 1706 var cache, outerCache, node, nodeIndex, start, 1707 dir = simple !== forward ? "nextSibling" : "previousSibling", 1708 parent = elem.parentNode, 1709 name = ofType && elem.nodeName.toLowerCase(), 1710 useCache = !xml && !ofType, 1711 diff = false; 1712 1713 if ( parent ) { 1714 1715 // :(first|last|only)-(child|of-type) 1716 if ( simple ) { 1717 while ( dir ) { 1718 node = elem; 1719 while ( ( node = node[ dir ] ) ) { 1720 if ( ofType ? 1721 nodeName( node, name ) : 1722 node.nodeType === 1 ) { 1723 1724 return false; 1725 } 1726 } 1727 1728 // Reverse direction for :only-* (if we haven't yet done so) 1729 start = dir = type === "only" && !start && "nextSibling"; 1730 } 1731 return true; 1732 } 1733 1734 start = [ forward ? parent.firstChild : parent.lastChild ]; 1735 1736 // non-xml :nth-child(...) stores cache data on `parent` 1737 if ( forward && useCache ) { 1738 1739 // Seek `elem` from a previously-cached index 1740 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 1741 cache = outerCache[ type ] || []; 1742 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1743 diff = nodeIndex && cache[ 2 ]; 1744 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1745 1746 while ( ( node = ++nodeIndex && node && node[ dir ] || 1747 1748 // Fallback to seeking `elem` from the start 1749 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1750 1751 // When found, cache indexes on `parent` and break 1752 if ( node.nodeType === 1 && ++diff && node === elem ) { 1753 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 1754 break; 1755 } 1756 } 1757 1758 } else { 1759 1760 // Use previously-cached element index if available 1761 if ( useCache ) { 1762 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 1763 cache = outerCache[ type ] || []; 1764 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1765 diff = nodeIndex; 1766 } 1767 1768 // xml :nth-child(...) 1769 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1770 if ( diff === false ) { 1771 1772 // Use the same loop as above to seek `elem` from the start 1773 while ( ( node = ++nodeIndex && node && node[ dir ] || 1774 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1775 1776 if ( ( ofType ? 1777 nodeName( node, name ) : 1778 node.nodeType === 1 ) && 1779 ++diff ) { 1780 1781 // Cache the index of each encountered element 1782 if ( useCache ) { 1783 outerCache = node[ expando ] || 1784 ( node[ expando ] = {} ); 1785 outerCache[ type ] = [ dirruns, diff ]; 1786 } 1787 1788 if ( node === elem ) { 1789 break; 1790 } 1791 } 1792 } 1793 } 1794 } 1795 1796 // Incorporate the offset, then check against cycle size 1797 diff -= last; 1798 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1799 } 1800 }; 1801 }, 1802 1803 PSEUDO: function( pseudo, argument ) { 1804 1805 // pseudo-class names are case-insensitive 1806 // https://www.w3.org/TR/selectors/#pseudo-classes 1807 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1808 // Remember that setFilters inherits from pseudos 1809 var args, 1810 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1811 find.error( "unsupported pseudo: " + pseudo ); 1812 1813 // The user may use createPseudo to indicate that 1814 // arguments are needed to create the filter function 1815 // just as jQuery does 1816 if ( fn[ expando ] ) { 1817 return fn( argument ); 1818 } 1819 1820 // But maintain support for old signatures 1821 if ( fn.length > 1 ) { 1822 args = [ pseudo, pseudo, "", argument ]; 1823 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1824 markFunction( function( seed, matches ) { 1825 var idx, 1826 matched = fn( seed, argument ), 1827 i = matched.length; 1828 while ( i-- ) { 1829 idx = indexOf.call( seed, matched[ i ] ); 1830 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 1831 } 1832 } ) : 1833 function( elem ) { 1834 return fn( elem, 0, args ); 1835 }; 1836 } 1837 1838 return fn; 1839 } 1840 }, 1841 1842 pseudos: { 1843 1844 // Potentially complex pseudos 1845 not: markFunction( function( selector ) { 1846 1847 // Trim the selector passed to compile 1848 // to avoid treating leading and trailing 1849 // spaces as combinators 1850 var input = [], 1851 results = [], 1852 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 1853 1854 return matcher[ expando ] ? 1855 markFunction( function( seed, matches, _context, xml ) { 1856 var elem, 1857 unmatched = matcher( seed, null, xml, [] ), 1858 i = seed.length; 1859 1860 // Match elements unmatched by `matcher` 1861 while ( i-- ) { 1862 if ( ( elem = unmatched[ i ] ) ) { 1863 seed[ i ] = !( matches[ i ] = elem ); 1864 } 1865 } 1866 } ) : 1867 function( elem, _context, xml ) { 1868 input[ 0 ] = elem; 1869 matcher( input, null, xml, results ); 1870 1871 // Don't keep the element 1872 // (see https://github.com/jquery/sizzle/issues/299) 1873 input[ 0 ] = null; 1874 return !results.pop(); 1875 }; 1876 } ), 1877 1878 has: markFunction( function( selector ) { 1879 return function( elem ) { 1880 return find( selector, elem ).length > 0; 1881 }; 1882 } ), 1883 1884 contains: markFunction( function( text ) { 1885 text = text.replace( runescape, funescape ); 1886 return function( elem ) { 1887 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 1888 }; 1889 } ), 1890 1891 // "Whether an element is represented by a :lang() selector 1892 // is based solely on the element's language value 1893 // being equal to the identifier C, 1894 // or beginning with the identifier C immediately followed by "-". 1895 // The matching of C against the element's language value is performed case-insensitively. 1896 // The identifier C does not have to be a valid language name." 1897 // https://www.w3.org/TR/selectors/#lang-pseudo 1898 lang: markFunction( function( lang ) { 1899 1900 // lang value must be a valid identifier 1901 if ( !ridentifier.test( lang || "" ) ) { 1902 find.error( "unsupported lang: " + lang ); 1903 } 1904 lang = lang.replace( runescape, funescape ).toLowerCase(); 1905 return function( elem ) { 1906 var elemLang; 1907 do { 1908 if ( ( elemLang = documentIsHTML ? 1909 elem.lang : 1910 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 1911 1912 elemLang = elemLang.toLowerCase(); 1913 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1914 } 1915 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 1916 return false; 1917 }; 1918 } ), 1919 1920 // Miscellaneous 1921 target: function( elem ) { 1922 var hash = window.location && window.location.hash; 1923 return hash && hash.slice( 1 ) === elem.id; 1924 }, 1925 1926 root: function( elem ) { 1927 return elem === documentElement; 1928 }, 1929 1930 focus: function( elem ) { 1931 return elem === safeActiveElement() && 1932 document.hasFocus() && 1933 !!( elem.type || elem.href || ~elem.tabIndex ); 1934 }, 1935 1936 // Boolean properties 1937 enabled: createDisabledPseudo( false ), 1938 disabled: createDisabledPseudo( true ), 1939 1940 checked: function( elem ) { 1941 1942 // In CSS3, :checked should return both checked and selected elements 1943 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1944 return ( nodeName( elem, "input" ) && !!elem.checked ) || 1945 ( nodeName( elem, "option" ) && !!elem.selected ); 1946 }, 1947 1948 selected: function( elem ) { 1949 1950 // Support: IE <=11+ 1951 // Accessing the selectedIndex property 1952 // forces the browser to treat the default option as 1953 // selected when in an optgroup. 1954 if ( elem.parentNode ) { 1955 // eslint-disable-next-line no-unused-expressions 1956 elem.parentNode.selectedIndex; 1957 } 1958 1959 return elem.selected === true; 1960 }, 1961 1962 // Contents 1963 empty: function( elem ) { 1964 1965 // https://www.w3.org/TR/selectors/#empty-pseudo 1966 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 1967 // but not by others (comment: 8; processing instruction: 7; etc.) 1968 // nodeType < 6 works because attributes (2) do not appear as children 1969 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1970 if ( elem.nodeType < 6 ) { 1971 return false; 1972 } 1973 } 1974 return true; 1975 }, 1976 1977 parent: function( elem ) { 1978 return !Expr.pseudos.empty( elem ); 1979 }, 1980 1981 // Element/input types 1982 header: function( elem ) { 1983 return rheader.test( elem.nodeName ); 1984 }, 1985 1986 input: function( elem ) { 1987 return rinputs.test( elem.nodeName ); 1988 }, 1989 1990 button: function( elem ) { 1991 return nodeName( elem, "input" ) && elem.type === "button" || 1992 nodeName( elem, "button" ); 1993 }, 1994 1995 text: function( elem ) { 1996 var attr; 1997 return nodeName( elem, "input" ) && elem.type === "text" && 1998 1999 // Support: IE <10 only 2000 // New HTML5 attribute values (e.g., "search") appear 2001 // with elem.type === "text" 2002 ( ( attr = elem.getAttribute( "type" ) ) == null || 2003 attr.toLowerCase() === "text" ); 2004 }, 2005 2006 // Position-in-collection 2007 first: createPositionalPseudo( function() { 2008 return [ 0 ]; 2009 } ), 2010 2011 last: createPositionalPseudo( function( _matchIndexes, length ) { 2012 return [ length - 1 ]; 2013 } ), 2014 2015 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 2016 return [ argument < 0 ? argument + length : argument ]; 2017 } ), 2018 2019 even: createPositionalPseudo( function( matchIndexes, length ) { 2020 var i = 0; 2021 for ( ; i < length; i += 2 ) { 2022 matchIndexes.push( i ); 2023 } 2024 return matchIndexes; 2025 } ), 2026 2027 odd: createPositionalPseudo( function( matchIndexes, length ) { 2028 var i = 1; 2029 for ( ; i < length; i += 2 ) { 2030 matchIndexes.push( i ); 2031 } 2032 return matchIndexes; 2033 } ), 2034 2035 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2036 var i; 2037 2038 if ( argument < 0 ) { 2039 i = argument + length; 2040 } else if ( argument > length ) { 2041 i = length; 2042 } else { 2043 i = argument; 2044 } 2045 2046 for ( ; --i >= 0; ) { 2047 matchIndexes.push( i ); 2048 } 2049 return matchIndexes; 2050 } ), 2051 2052 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2053 var i = argument < 0 ? argument + length : argument; 2054 for ( ; ++i < length; ) { 2055 matchIndexes.push( i ); 2056 } 2057 return matchIndexes; 2058 } ) 2059 } 2060}; 2061 2062Expr.pseudos.nth = Expr.pseudos.eq; 2063 2064// Add button/input type pseudos 2065for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2066 Expr.pseudos[ i ] = createInputPseudo( i ); 2067} 2068for ( i in { submit: true, reset: true } ) { 2069 Expr.pseudos[ i ] = createButtonPseudo( i ); 2070} 2071 2072// Easy API for creating new setFilters 2073function setFilters() {} 2074setFilters.prototype = Expr.filters = Expr.pseudos; 2075Expr.setFilters = new setFilters(); 2076 2077function tokenize( selector, parseOnly ) { 2078 var matched, match, tokens, type, 2079 soFar, groups, preFilters, 2080 cached = tokenCache[ selector + " " ]; 2081 2082 if ( cached ) { 2083 return parseOnly ? 0 : cached.slice( 0 ); 2084 } 2085 2086 soFar = selector; 2087 groups = []; 2088 preFilters = Expr.preFilter; 2089 2090 while ( soFar ) { 2091 2092 // Comma and first run 2093 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2094 if ( match ) { 2095 2096 // Don't consume trailing commas as valid 2097 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2098 } 2099 groups.push( ( tokens = [] ) ); 2100 } 2101 2102 matched = false; 2103 2104 // Combinators 2105 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 2106 matched = match.shift(); 2107 tokens.push( { 2108 value: matched, 2109 2110 // Cast descendant combinators to space 2111 type: match[ 0 ].replace( rtrimCSS, " " ) 2112 } ); 2113 soFar = soFar.slice( matched.length ); 2114 } 2115 2116 // Filters 2117 for ( type in Expr.filter ) { 2118 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2119 ( match = preFilters[ type ]( match ) ) ) ) { 2120 matched = match.shift(); 2121 tokens.push( { 2122 value: matched, 2123 type: type, 2124 matches: match 2125 } ); 2126 soFar = soFar.slice( matched.length ); 2127 } 2128 } 2129 2130 if ( !matched ) { 2131 break; 2132 } 2133 } 2134 2135 // Return the length of the invalid excess 2136 // if we're just parsing 2137 // Otherwise, throw an error or return tokens 2138 if ( parseOnly ) { 2139 return soFar.length; 2140 } 2141 2142 return soFar ? 2143 find.error( selector ) : 2144 2145 // Cache the tokens 2146 tokenCache( selector, groups ).slice( 0 ); 2147} 2148 2149function toSelector( tokens ) { 2150 var i = 0, 2151 len = tokens.length, 2152 selector = ""; 2153 for ( ; i < len; i++ ) { 2154 selector += tokens[ i ].value; 2155 } 2156 return selector; 2157} 2158 2159function addCombinator( matcher, combinator, base ) { 2160 var dir = combinator.dir, 2161 skip = combinator.next, 2162 key = skip || dir, 2163 checkNonElements = base && key === "parentNode", 2164 doneName = done++; 2165 2166 return combinator.first ? 2167 2168 // Check against closest ancestor/preceding element 2169 function( elem, context, xml ) { 2170 while ( ( elem = elem[ dir ] ) ) { 2171 if ( elem.nodeType === 1 || checkNonElements ) { 2172 return matcher( elem, context, xml ); 2173 } 2174 } 2175 return false; 2176 } : 2177 2178 // Check against all ancestor/preceding elements 2179 function( elem, context, xml ) { 2180 var oldCache, outerCache, 2181 newCache = [ dirruns, doneName ]; 2182 2183 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2184 if ( xml ) { 2185 while ( ( elem = elem[ dir ] ) ) { 2186 if ( elem.nodeType === 1 || checkNonElements ) { 2187 if ( matcher( elem, context, xml ) ) { 2188 return true; 2189 } 2190 } 2191 } 2192 } else { 2193 while ( ( elem = elem[ dir ] ) ) { 2194 if ( elem.nodeType === 1 || checkNonElements ) { 2195 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2196 2197 if ( skip && nodeName( elem, skip ) ) { 2198 elem = elem[ dir ] || elem; 2199 } else if ( ( oldCache = outerCache[ key ] ) && 2200 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2201 2202 // Assign to newCache so results back-propagate to previous elements 2203 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2204 } else { 2205 2206 // Reuse newcache so results back-propagate to previous elements 2207 outerCache[ key ] = newCache; 2208 2209 // A match means we're done; a fail means we have to keep checking 2210 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2211 return true; 2212 } 2213 } 2214 } 2215 } 2216 } 2217 return false; 2218 }; 2219} 2220 2221function elementMatcher( matchers ) { 2222 return matchers.length > 1 ? 2223 function( elem, context, xml ) { 2224 var i = matchers.length; 2225 while ( i-- ) { 2226 if ( !matchers[ i ]( elem, context, xml ) ) { 2227 return false; 2228 } 2229 } 2230 return true; 2231 } : 2232 matchers[ 0 ]; 2233} 2234 2235function multipleContexts( selector, contexts, results ) { 2236 var i = 0, 2237 len = contexts.length; 2238 for ( ; i < len; i++ ) { 2239 find( selector, contexts[ i ], results ); 2240 } 2241 return results; 2242} 2243 2244function condense( unmatched, map, filter, context, xml ) { 2245 var elem, 2246 newUnmatched = [], 2247 i = 0, 2248 len = unmatched.length, 2249 mapped = map != null; 2250 2251 for ( ; i < len; i++ ) { 2252 if ( ( elem = unmatched[ i ] ) ) { 2253 if ( !filter || filter( elem, context, xml ) ) { 2254 newUnmatched.push( elem ); 2255 if ( mapped ) { 2256 map.push( i ); 2257 } 2258 } 2259 } 2260 } 2261 2262 return newUnmatched; 2263} 2264 2265function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2266 if ( postFilter && !postFilter[ expando ] ) { 2267 postFilter = setMatcher( postFilter ); 2268 } 2269 if ( postFinder && !postFinder[ expando ] ) { 2270 postFinder = setMatcher( postFinder, postSelector ); 2271 } 2272 return markFunction( function( seed, results, context, xml ) { 2273 var temp, i, elem, matcherOut, 2274 preMap = [], 2275 postMap = [], 2276 preexisting = results.length, 2277 2278 // Get initial elements from seed or context 2279 elems = seed || 2280 multipleContexts( selector || "*", 2281 context.nodeType ? [ context ] : context, [] ), 2282 2283 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2284 matcherIn = preFilter && ( seed || !selector ) ? 2285 condense( elems, preMap, preFilter, context, xml ) : 2286 elems; 2287 2288 if ( matcher ) { 2289 2290 // If we have a postFinder, or filtered seed, or non-seed postFilter 2291 // or preexisting results, 2292 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2293 2294 // ...intermediate processing is necessary 2295 [] : 2296 2297 // ...otherwise use results directly 2298 results; 2299 2300 // Find primary matches 2301 matcher( matcherIn, matcherOut, context, xml ); 2302 } else { 2303 matcherOut = matcherIn; 2304 } 2305 2306 // Apply postFilter 2307 if ( postFilter ) { 2308 temp = condense( matcherOut, postMap ); 2309 postFilter( temp, [], context, xml ); 2310 2311 // Un-match failing elements by moving them back to matcherIn 2312 i = temp.length; 2313 while ( i-- ) { 2314 if ( ( elem = temp[ i ] ) ) { 2315 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2316 } 2317 } 2318 } 2319 2320 if ( seed ) { 2321 if ( postFinder || preFilter ) { 2322 if ( postFinder ) { 2323 2324 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2325 temp = []; 2326 i = matcherOut.length; 2327 while ( i-- ) { 2328 if ( ( elem = matcherOut[ i ] ) ) { 2329 2330 // Restore matcherIn since elem is not yet a final match 2331 temp.push( ( matcherIn[ i ] = elem ) ); 2332 } 2333 } 2334 postFinder( null, ( matcherOut = [] ), temp, xml ); 2335 } 2336 2337 // Move matched elements from seed to results to keep them synchronized 2338 i = matcherOut.length; 2339 while ( i-- ) { 2340 if ( ( elem = matcherOut[ i ] ) && 2341 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 2342 2343 seed[ temp ] = !( results[ temp ] = elem ); 2344 } 2345 } 2346 } 2347 2348 // Add elements to results, through postFinder if defined 2349 } else { 2350 matcherOut = condense( 2351 matcherOut === results ? 2352 matcherOut.splice( preexisting, matcherOut.length ) : 2353 matcherOut 2354 ); 2355 if ( postFinder ) { 2356 postFinder( null, results, matcherOut, xml ); 2357 } else { 2358 push.apply( results, matcherOut ); 2359 } 2360 } 2361 } ); 2362} 2363 2364function matcherFromTokens( tokens ) { 2365 var checkContext, matcher, j, 2366 len = tokens.length, 2367 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2368 implicitRelative = leadingRelative || Expr.relative[ " " ], 2369 i = leadingRelative ? 1 : 0, 2370 2371 // The foundational matcher ensures that elements are reachable from top-level context(s) 2372 matchContext = addCombinator( function( elem ) { 2373 return elem === checkContext; 2374 }, implicitRelative, true ), 2375 matchAnyContext = addCombinator( function( elem ) { 2376 return indexOf.call( checkContext, elem ) > -1; 2377 }, implicitRelative, true ), 2378 matchers = [ function( elem, context, xml ) { 2379 2380 // Support: IE 11+, Edge 17 - 18+ 2381 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2382 // two documents; shallow comparisons work. 2383 // eslint-disable-next-line eqeqeq 2384 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 2385 ( checkContext = context ).nodeType ? 2386 matchContext( elem, context, xml ) : 2387 matchAnyContext( elem, context, xml ) ); 2388 2389 // Avoid hanging onto element 2390 // (see https://github.com/jquery/sizzle/issues/299) 2391 checkContext = null; 2392 return ret; 2393 } ]; 2394 2395 for ( ; i < len; i++ ) { 2396 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2397 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2398 } else { 2399 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2400 2401 // Return special upon seeing a positional matcher 2402 if ( matcher[ expando ] ) { 2403 2404 // Find the next relative operator (if any) for proper handling 2405 j = ++i; 2406 for ( ; j < len; j++ ) { 2407 if ( Expr.relative[ tokens[ j ].type ] ) { 2408 break; 2409 } 2410 } 2411 return setMatcher( 2412 i > 1 && elementMatcher( matchers ), 2413 i > 1 && toSelector( 2414 2415 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2416 tokens.slice( 0, i - 1 ) 2417 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2418 ).replace( rtrimCSS, "$1" ), 2419 matcher, 2420 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2421 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2422 j < len && toSelector( tokens ) 2423 ); 2424 } 2425 matchers.push( matcher ); 2426 } 2427 } 2428 2429 return elementMatcher( matchers ); 2430} 2431 2432function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2433 var bySet = setMatchers.length > 0, 2434 byElement = elementMatchers.length > 0, 2435 superMatcher = function( seed, context, xml, results, outermost ) { 2436 var elem, j, matcher, 2437 matchedCount = 0, 2438 i = "0", 2439 unmatched = seed && [], 2440 setMatched = [], 2441 contextBackup = outermostContext, 2442 2443 // We must always have either seed elements or outermost context 2444 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 2445 2446 // Use integer dirruns iff this is the outermost matcher 2447 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2448 len = elems.length; 2449 2450 if ( outermost ) { 2451 2452 // Support: IE 11+, Edge 17 - 18+ 2453 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2454 // two documents; shallow comparisons work. 2455 // eslint-disable-next-line eqeqeq 2456 outermostContext = context == document || context || outermost; 2457 } 2458 2459 // Add elements passing elementMatchers directly to results 2460 // Support: iOS <=7 - 9 only 2461 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 2462 // elements by id. (see trac-14142) 2463 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2464 if ( byElement && elem ) { 2465 j = 0; 2466 2467 // Support: IE 11+, Edge 17 - 18+ 2468 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2469 // two documents; shallow comparisons work. 2470 // eslint-disable-next-line eqeqeq 2471 if ( !context && elem.ownerDocument != document ) { 2472 setDocument( elem ); 2473 xml = !documentIsHTML; 2474 } 2475 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2476 if ( matcher( elem, context || document, xml ) ) { 2477 push.call( results, elem ); 2478 break; 2479 } 2480 } 2481 if ( outermost ) { 2482 dirruns = dirrunsUnique; 2483 } 2484 } 2485 2486 // Track unmatched elements for set filters 2487 if ( bySet ) { 2488 2489 // They will have gone through all possible matchers 2490 if ( ( elem = !matcher && elem ) ) { 2491 matchedCount--; 2492 } 2493 2494 // Lengthen the array for every element, matched or not 2495 if ( seed ) { 2496 unmatched.push( elem ); 2497 } 2498 } 2499 } 2500 2501 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2502 // makes the latter nonnegative. 2503 matchedCount += i; 2504 2505 // Apply set filters to unmatched elements 2506 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2507 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2508 // no element matchers and no seed. 2509 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2510 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2511 // numerically zero. 2512 if ( bySet && i !== matchedCount ) { 2513 j = 0; 2514 while ( ( matcher = setMatchers[ j++ ] ) ) { 2515 matcher( unmatched, setMatched, context, xml ); 2516 } 2517 2518 if ( seed ) { 2519 2520 // Reintegrate element matches to eliminate the need for sorting 2521 if ( matchedCount > 0 ) { 2522 while ( i-- ) { 2523 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2524 setMatched[ i ] = pop.call( results ); 2525 } 2526 } 2527 } 2528 2529 // Discard index placeholder values to get only actual matches 2530 setMatched = condense( setMatched ); 2531 } 2532 2533 // Add matches to results 2534 push.apply( results, setMatched ); 2535 2536 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2537 if ( outermost && !seed && setMatched.length > 0 && 2538 ( matchedCount + setMatchers.length ) > 1 ) { 2539 2540 jQuery.uniqueSort( results ); 2541 } 2542 } 2543 2544 // Override manipulation of globals by nested matchers 2545 if ( outermost ) { 2546 dirruns = dirrunsUnique; 2547 outermostContext = contextBackup; 2548 } 2549 2550 return unmatched; 2551 }; 2552 2553 return bySet ? 2554 markFunction( superMatcher ) : 2555 superMatcher; 2556} 2557 2558function compile( selector, match /* Internal Use Only */ ) { 2559 var i, 2560 setMatchers = [], 2561 elementMatchers = [], 2562 cached = compilerCache[ selector + " " ]; 2563 2564 if ( !cached ) { 2565 2566 // Generate a function of recursive functions that can be used to check each element 2567 if ( !match ) { 2568 match = tokenize( selector ); 2569 } 2570 i = match.length; 2571 while ( i-- ) { 2572 cached = matcherFromTokens( match[ i ] ); 2573 if ( cached[ expando ] ) { 2574 setMatchers.push( cached ); 2575 } else { 2576 elementMatchers.push( cached ); 2577 } 2578 } 2579 2580 // Cache the compiled function 2581 cached = compilerCache( selector, 2582 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2583 2584 // Save selector and tokenization 2585 cached.selector = selector; 2586 } 2587 return cached; 2588} 2589 2590/** 2591 * A low-level selection function that works with jQuery's compiled 2592 * selector functions 2593 * @param {String|Function} selector A selector or a pre-compiled 2594 * selector function built with jQuery selector compile 2595 * @param {Element} context 2596 * @param {Array} [results] 2597 * @param {Array} [seed] A set of elements to match against 2598 */ 2599function select( selector, context, results, seed ) { 2600 var i, tokens, token, type, find, 2601 compiled = typeof selector === "function" && selector, 2602 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2603 2604 results = results || []; 2605 2606 // Try to minimize operations if there is only one selector in the list and no seed 2607 // (the latter of which guarantees us context) 2608 if ( match.length === 1 ) { 2609 2610 // Reduce context if the leading compound selector is an ID 2611 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2612 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2613 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2614 2615 context = ( Expr.find.ID( 2616 token.matches[ 0 ].replace( runescape, funescape ), 2617 context 2618 ) || [] )[ 0 ]; 2619 if ( !context ) { 2620 return results; 2621 2622 // Precompiled matchers will still verify ancestry, so step up a level 2623 } else if ( compiled ) { 2624 context = context.parentNode; 2625 } 2626 2627 selector = selector.slice( tokens.shift().value.length ); 2628 } 2629 2630 // Fetch a seed set for right-to-left matching 2631 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 2632 while ( i-- ) { 2633 token = tokens[ i ]; 2634 2635 // Abort if we hit a combinator 2636 if ( Expr.relative[ ( type = token.type ) ] ) { 2637 break; 2638 } 2639 if ( ( find = Expr.find[ type ] ) ) { 2640 2641 // Search, expanding context for leading sibling combinators 2642 if ( ( seed = find( 2643 token.matches[ 0 ].replace( runescape, funescape ), 2644 rsibling.test( tokens[ 0 ].type ) && 2645 testContext( context.parentNode ) || context 2646 ) ) ) { 2647 2648 // If seed is empty or no tokens remain, we can return early 2649 tokens.splice( i, 1 ); 2650 selector = seed.length && toSelector( tokens ); 2651 if ( !selector ) { 2652 push.apply( results, seed ); 2653 return results; 2654 } 2655 2656 break; 2657 } 2658 } 2659 } 2660 } 2661 2662 // Compile and execute a filtering function if one is not provided 2663 // Provide `match` to avoid retokenization if we modified the selector above 2664 ( compiled || compile( selector, match ) )( 2665 seed, 2666 context, 2667 !documentIsHTML, 2668 results, 2669 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2670 ); 2671 return results; 2672} 2673 2674// One-time assignments 2675 2676// Support: Android <=4.0 - 4.1+ 2677// Sort stability 2678support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2679 2680// Initialize against the default document 2681setDocument(); 2682 2683// Support: Android <=4.0 - 4.1+ 2684// Detached nodes confoundingly follow *each other* 2685support.sortDetached = assert( function( el ) { 2686 2687 // Should return 1, but returns 4 (following) 2688 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2689} ); 2690 2691jQuery.find = find; 2692 2693// Deprecated 2694jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2695jQuery.unique = jQuery.uniqueSort; 2696 2697// These have always been private, but they used to be documented 2698// as part of Sizzle so let's maintain them in the 3.x line 2699// for backwards compatibility purposes. 2700find.compile = compile; 2701find.select = select; 2702find.setDocument = setDocument; 2703 2704find.escape = jQuery.escapeSelector; 2705find.getText = jQuery.text; 2706find.isXML = jQuery.isXMLDoc; 2707find.selectors = jQuery.expr; 2708find.support = jQuery.support; 2709find.uniqueSort = jQuery.uniqueSort; 2710 2711 /* eslint-enable */ 2712 2713} )(); 2714 2715 2716var dir = function( elem, dir, until ) { 2717 var matched = [], 2718 truncate = until !== undefined; 2719 2720 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2721 if ( elem.nodeType === 1 ) { 2722 if ( truncate && jQuery( elem ).is( until ) ) { 2723 break; 2724 } 2725 matched.push( elem ); 2726 } 2727 } 2728 return matched; 2729}; 2730 2731 2732var siblings = function( n, elem ) { 2733 var matched = []; 2734 2735 for ( ; n; n = n.nextSibling ) { 2736 if ( n.nodeType === 1 && n !== elem ) { 2737 matched.push( n ); 2738 } 2739 } 2740 2741 return matched; 2742}; 2743 2744 2745var rneedsContext = jQuery.expr.match.needsContext; 2746 2747var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2748 2749 2750 2751// Implement the identical functionality for filter and not 2752function winnow( elements, qualifier, not ) { 2753 if ( isFunction( qualifier ) ) { 2754 return jQuery.grep( elements, function( elem, i ) { 2755 return !!qualifier.call( elem, i, elem ) !== not; 2756 } ); 2757 } 2758 2759 // Single element 2760 if ( qualifier.nodeType ) { 2761 return jQuery.grep( elements, function( elem ) { 2762 return ( elem === qualifier ) !== not; 2763 } ); 2764 } 2765 2766 // Arraylike of elements (jQuery, arguments, Array) 2767 if ( typeof qualifier !== "string" ) { 2768 return jQuery.grep( elements, function( elem ) { 2769 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2770 } ); 2771 } 2772 2773 // Filtered directly for both simple and complex selectors 2774 return jQuery.filter( qualifier, elements, not ); 2775} 2776 2777jQuery.filter = function( expr, elems, not ) { 2778 var elem = elems[ 0 ]; 2779 2780 if ( not ) { 2781 expr = ":not(" + expr + ")"; 2782 } 2783 2784 if ( elems.length === 1 && elem.nodeType === 1 ) { 2785 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2786 } 2787 2788 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2789 return elem.nodeType === 1; 2790 } ) ); 2791}; 2792 2793jQuery.fn.extend( { 2794 find: function( selector ) { 2795 var i, ret, 2796 len = this.length, 2797 self = this; 2798 2799 if ( typeof selector !== "string" ) { 2800 return this.pushStack( jQuery( selector ).filter( function() { 2801 for ( i = 0; i < len; i++ ) { 2802 if ( jQuery.contains( self[ i ], this ) ) { 2803 return true; 2804 } 2805 } 2806 } ) ); 2807 } 2808 2809 ret = this.pushStack( [] ); 2810 2811 for ( i = 0; i < len; i++ ) { 2812 jQuery.find( selector, self[ i ], ret ); 2813 } 2814 2815 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2816 }, 2817 filter: function( selector ) { 2818 return this.pushStack( winnow( this, selector || [], false ) ); 2819 }, 2820 not: function( selector ) { 2821 return this.pushStack( winnow( this, selector || [], true ) ); 2822 }, 2823 is: function( selector ) { 2824 return !!winnow( 2825 this, 2826 2827 // If this is a positional/relative selector, check membership in the returned set 2828 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2829 typeof selector === "string" && rneedsContext.test( selector ) ? 2830 jQuery( selector ) : 2831 selector || [], 2832 false 2833 ).length; 2834 } 2835} ); 2836 2837 2838// Initialize a jQuery object 2839 2840 2841// A central reference to the root jQuery(document) 2842var rootjQuery, 2843 2844 // A simple way to check for HTML strings 2845 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 2846 // Strict HTML recognition (trac-11290: must start with <) 2847 // Shortcut simple #id case for speed 2848 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2849 2850 init = jQuery.fn.init = function( selector, context, root ) { 2851 var match, elem; 2852 2853 // HANDLE: $(""), $(null), $(undefined), $(false) 2854 if ( !selector ) { 2855 return this; 2856 } 2857 2858 // Method init() accepts an alternate rootjQuery 2859 // so migrate can support jQuery.sub (gh-2101) 2860 root = root || rootjQuery; 2861 2862 // Handle HTML strings 2863 if ( typeof selector === "string" ) { 2864 if ( selector[ 0 ] === "<" && 2865 selector[ selector.length - 1 ] === ">" && 2866 selector.length >= 3 ) { 2867 2868 // Assume that strings that start and end with <> are HTML and skip the regex check 2869 match = [ null, selector, null ]; 2870 2871 } else { 2872 match = rquickExpr.exec( selector ); 2873 } 2874 2875 // Match html or make sure no context is specified for #id 2876 if ( match && ( match[ 1 ] || !context ) ) { 2877 2878 // HANDLE: $(html) -> $(array) 2879 if ( match[ 1 ] ) { 2880 context = context instanceof jQuery ? context[ 0 ] : context; 2881 2882 // Option to run scripts is true for back-compat 2883 // Intentionally let the error be thrown if parseHTML is not present 2884 jQuery.merge( this, jQuery.parseHTML( 2885 match[ 1 ], 2886 context && context.nodeType ? context.ownerDocument || context : document, 2887 true 2888 ) ); 2889 2890 // HANDLE: $(html, props) 2891 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2892 for ( match in context ) { 2893 2894 // Properties of context are called as methods if possible 2895 if ( isFunction( this[ match ] ) ) { 2896 this[ match ]( context[ match ] ); 2897 2898 // ...and otherwise set as attributes 2899 } else { 2900 this.attr( match, context[ match ] ); 2901 } 2902 } 2903 } 2904 2905 return this; 2906 2907 // HANDLE: $(#id) 2908 } else { 2909 elem = document.getElementById( match[ 2 ] ); 2910 2911 if ( elem ) { 2912 2913 // Inject the element directly into the jQuery object 2914 this[ 0 ] = elem; 2915 this.length = 1; 2916 } 2917 return this; 2918 } 2919 2920 // HANDLE: $(expr, $(...)) 2921 } else if ( !context || context.jquery ) { 2922 return ( context || root ).find( selector ); 2923 2924 // HANDLE: $(expr, context) 2925 // (which is just equivalent to: $(context).find(expr) 2926 } else { 2927 return this.constructor( context ).find( selector ); 2928 } 2929 2930 // HANDLE: $(DOMElement) 2931 } else if ( selector.nodeType ) { 2932 this[ 0 ] = selector; 2933 this.length = 1; 2934 return this; 2935 2936 // HANDLE: $(function) 2937 // Shortcut for document ready 2938 } else if ( isFunction( selector ) ) { 2939 return root.ready !== undefined ? 2940 root.ready( selector ) : 2941 2942 // Execute immediately if ready is not present 2943 selector( jQuery ); 2944 } 2945 2946 return jQuery.makeArray( selector, this ); 2947 }; 2948 2949// Give the init function the jQuery prototype for later instantiation 2950init.prototype = jQuery.fn; 2951 2952// Initialize central reference 2953rootjQuery = jQuery( document ); 2954 2955 2956var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2957 2958 // Methods guaranteed to produce a unique set when starting from a unique set 2959 guaranteedUnique = { 2960 children: true, 2961 contents: true, 2962 next: true, 2963 prev: true 2964 }; 2965 2966jQuery.fn.extend( { 2967 has: function( target ) { 2968 var targets = jQuery( target, this ), 2969 l = targets.length; 2970 2971 return this.filter( function() { 2972 var i = 0; 2973 for ( ; i < l; i++ ) { 2974 if ( jQuery.contains( this, targets[ i ] ) ) { 2975 return true; 2976 } 2977 } 2978 } ); 2979 }, 2980 2981 closest: function( selectors, context ) { 2982 var cur, 2983 i = 0, 2984 l = this.length, 2985 matched = [], 2986 targets = typeof selectors !== "string" && jQuery( selectors ); 2987 2988 // Positional selectors never match, since there's no _selection_ context 2989 if ( !rneedsContext.test( selectors ) ) { 2990 for ( ; i < l; i++ ) { 2991 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 2992 2993 // Always skip document fragments 2994 if ( cur.nodeType < 11 && ( targets ? 2995 targets.index( cur ) > -1 : 2996 2997 // Don't pass non-elements to jQuery#find 2998 cur.nodeType === 1 && 2999 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3000 3001 matched.push( cur ); 3002 break; 3003 } 3004 } 3005 } 3006 } 3007 3008 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3009 }, 3010 3011 // Determine the position of an element within the set 3012 index: function( elem ) { 3013 3014 // No argument, return index in parent 3015 if ( !elem ) { 3016 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3017 } 3018 3019 // Index in selector 3020 if ( typeof elem === "string" ) { 3021 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3022 } 3023 3024 // Locate the position of the desired element 3025 return indexOf.call( this, 3026 3027 // If it receives a jQuery object, the first element is used 3028 elem.jquery ? elem[ 0 ] : elem 3029 ); 3030 }, 3031 3032 add: function( selector, context ) { 3033 return this.pushStack( 3034 jQuery.uniqueSort( 3035 jQuery.merge( this.get(), jQuery( selector, context ) ) 3036 ) 3037 ); 3038 }, 3039 3040 addBack: function( selector ) { 3041 return this.add( selector == null ? 3042 this.prevObject : this.prevObject.filter( selector ) 3043 ); 3044 } 3045} ); 3046 3047function sibling( cur, dir ) { 3048 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3049 return cur; 3050} 3051 3052jQuery.each( { 3053 parent: function( elem ) { 3054 var parent = elem.parentNode; 3055 return parent && parent.nodeType !== 11 ? parent : null; 3056 }, 3057 parents: function( elem ) { 3058 return dir( elem, "parentNode" ); 3059 }, 3060 parentsUntil: function( elem, _i, until ) { 3061 return dir( elem, "parentNode", until ); 3062 }, 3063 next: function( elem ) { 3064 return sibling( elem, "nextSibling" ); 3065 }, 3066 prev: function( elem ) { 3067 return sibling( elem, "previousSibling" ); 3068 }, 3069 nextAll: function( elem ) { 3070 return dir( elem, "nextSibling" ); 3071 }, 3072 prevAll: function( elem ) { 3073 return dir( elem, "previousSibling" ); 3074 }, 3075 nextUntil: function( elem, _i, until ) { 3076 return dir( elem, "nextSibling", until ); 3077 }, 3078 prevUntil: function( elem, _i, until ) { 3079 return dir( elem, "previousSibling", until ); 3080 }, 3081 siblings: function( elem ) { 3082 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3083 }, 3084 children: function( elem ) { 3085 return siblings( elem.firstChild ); 3086 }, 3087 contents: function( elem ) { 3088 if ( elem.contentDocument != null && 3089 3090 // Support: IE 11+ 3091 // <object> elements with no `data` attribute has an object 3092 // `contentDocument` with a `null` prototype. 3093 getProto( elem.contentDocument ) ) { 3094 3095 return elem.contentDocument; 3096 } 3097 3098 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3099 // Treat the template element as a regular one in browsers that 3100 // don't support it. 3101 if ( nodeName( elem, "template" ) ) { 3102 elem = elem.content || elem; 3103 } 3104 3105 return jQuery.merge( [], elem.childNodes ); 3106 } 3107}, function( name, fn ) { 3108 jQuery.fn[ name ] = function( until, selector ) { 3109 var matched = jQuery.map( this, fn, until ); 3110 3111 if ( name.slice( -5 ) !== "Until" ) { 3112 selector = until; 3113 } 3114 3115 if ( selector && typeof selector === "string" ) { 3116 matched = jQuery.filter( selector, matched ); 3117 } 3118 3119 if ( this.length > 1 ) { 3120 3121 // Remove duplicates 3122 if ( !guaranteedUnique[ name ] ) { 3123 jQuery.uniqueSort( matched ); 3124 } 3125 3126 // Reverse order for parents* and prev-derivatives 3127 if ( rparentsprev.test( name ) ) { 3128 matched.reverse(); 3129 } 3130 } 3131 3132 return this.pushStack( matched ); 3133 }; 3134} ); 3135var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3136 3137 3138 3139// Convert String-formatted options into Object-formatted ones 3140function createOptions( options ) { 3141 var object = {}; 3142 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3143 object[ flag ] = true; 3144 } ); 3145 return object; 3146} 3147 3148/* 3149 * Create a callback list using the following parameters: 3150 * 3151 * options: an optional list of space-separated options that will change how 3152 * the callback list behaves or a more traditional option object 3153 * 3154 * By default a callback list will act like an event callback list and can be 3155 * "fired" multiple times. 3156 * 3157 * Possible options: 3158 * 3159 * once: will ensure the callback list can only be fired once (like a Deferred) 3160 * 3161 * memory: will keep track of previous values and will call any callback added 3162 * after the list has been fired right away with the latest "memorized" 3163 * values (like a Deferred) 3164 * 3165 * unique: will ensure a callback can only be added once (no duplicate in the list) 3166 * 3167 * stopOnFalse: interrupt callings when a callback returns false 3168 * 3169 */ 3170jQuery.Callbacks = function( options ) { 3171 3172 // Convert options from String-formatted to Object-formatted if needed 3173 // (we check in cache first) 3174 options = typeof options === "string" ? 3175 createOptions( options ) : 3176 jQuery.extend( {}, options ); 3177 3178 var // Flag to know if list is currently firing 3179 firing, 3180 3181 // Last fire value for non-forgettable lists 3182 memory, 3183 3184 // Flag to know if list was already fired 3185 fired, 3186 3187 // Flag to prevent firing 3188 locked, 3189 3190 // Actual callback list 3191 list = [], 3192 3193 // Queue of execution data for repeatable lists 3194 queue = [], 3195 3196 // Index of currently firing callback (modified by add/remove as needed) 3197 firingIndex = -1, 3198 3199 // Fire callbacks 3200 fire = function() { 3201 3202 // Enforce single-firing 3203 locked = locked || options.once; 3204 3205 // Execute callbacks for all pending executions, 3206 // respecting firingIndex overrides and runtime changes 3207 fired = firing = true; 3208 for ( ; queue.length; firingIndex = -1 ) { 3209 memory = queue.shift(); 3210 while ( ++firingIndex < list.length ) { 3211 3212 // Run callback and check for early termination 3213 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3214 options.stopOnFalse ) { 3215 3216 // Jump to end and forget the data so .add doesn't re-fire 3217 firingIndex = list.length; 3218 memory = false;
vendor: 4,918 bytes, lines 3219-3428
3219 } 3220 } 3221 } 3222 3223 // Forget the data if we're done with it 3224 if ( !options.memory ) { 3225 memory = false; 3226 } 3227 3228 firing = false; 3229 3230 // Clean up if we're done firing for good 3231 if ( locked ) { 3232 3233 // Keep an empty list if we have data for future add calls 3234 if ( memory ) { 3235 list = []; 3236 3237 // Otherwise, this object is spent 3238 } else { 3239 list = ""; 3240 } 3241 } 3242 }, 3243 3244 // Actual Callbacks object 3245 self = { 3246 3247 // Add a callback or a collection of callbacks to the list 3248 add: function() { 3249 if ( list ) { 3250 3251 // If we have memory from a past run, we should fire after adding 3252 if ( memory && !firing ) { 3253 firingIndex = list.length - 1; 3254 queue.push( memory ); 3255 } 3256 3257 ( function add( args ) { 3258 jQuery.each( args, function( _, arg ) { 3259 if ( isFunction( arg ) ) { 3260 if ( !options.unique || !self.has( arg ) ) { 3261 list.push( arg ); 3262 } 3263 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3264 3265 // Inspect recursively 3266 add( arg ); 3267 } 3268 } ); 3269 } )( arguments ); 3270 3271 if ( memory && !firing ) { 3272 fire(); 3273 } 3274 } 3275 return this; 3276 }, 3277 3278 // Remove a callback from the list 3279 remove: function() { 3280 jQuery.each( arguments, function( _, arg ) { 3281 var index; 3282 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3283 list.splice( index, 1 ); 3284 3285 // Handle firing indexes 3286 if ( index <= firingIndex ) { 3287 firingIndex--; 3288 } 3289 } 3290 } ); 3291 return this; 3292 }, 3293 3294 // Check if a given callback is in the list. 3295 // If no argument is given, return whether or not list has callbacks attached. 3296 has: function( fn ) { 3297 return fn ? 3298 jQuery.inArray( fn, list ) > -1 : 3299 list.length > 0; 3300 }, 3301 3302 // Remove all callbacks from the list 3303 empty: function() { 3304 if ( list ) { 3305 list = []; 3306 } 3307 return this; 3308 }, 3309 3310 // Disable .fire and .add 3311 // Abort any current/pending executions 3312 // Clear all callbacks and values 3313 disable: function() { 3314 locked = queue = []; 3315 list = memory = ""; 3316 return this; 3317 }, 3318 disabled: function() { 3319 return !list; 3320 }, 3321 3322 // Disable .fire 3323 // Also disable .add unless we have memory (since it would have no effect) 3324 // Abort any pending executions 3325 lock: function() { 3326 locked = queue = []; 3327 if ( !memory && !firing ) { 3328 list = memory = ""; 3329 } 3330 return this; 3331 }, 3332 locked: function() { 3333 return !!locked; 3334 }, 3335 3336 // Call all callbacks with the given context and arguments 3337 fireWith: function( context, args ) { 3338 if ( !locked ) { 3339 args = args || []; 3340 args = [ context, args.slice ? args.slice() : args ]; 3341 queue.push( args ); 3342 if ( !firing ) { 3343 fire(); 3344 } 3345 } 3346 return this; 3347 }, 3348 3349 // Call all the callbacks with the given arguments 3350 fire: function() { 3351 self.fireWith( this, arguments ); 3352 return this; 3353 }, 3354 3355 // To know if the callbacks have already been called at least once 3356 fired: function() { 3357 return !!fired; 3358 } 3359 }; 3360 3361 return self; 3362}; 3363 3364 3365function Identity( v ) { 3366 return v; 3367} 3368function Thrower( ex ) { 3369 throw ex; 3370} 3371 3372function adoptValue( value, resolve, reject, noValue ) { 3373 var method; 3374 3375 try { 3376 3377 // Check for promise aspect first to privilege synchronous behavior 3378 if ( value && isFunction( ( method = value.promise ) ) ) { 3379 method.call( value ).done( resolve ).fail( reject ); 3380 3381 // Other thenables 3382 } else if ( value && isFunction( ( method = value.then ) ) ) { 3383 method.call( value, resolve, reject ); 3384 3385 // Other non-thenables 3386 } else { 3387 3388 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3389 // * false: [ value ].slice( 0 ) => resolve( value ) 3390 // * true: [ value ].slice( 1 ) => resolve() 3391 resolve.apply( undefined, [ value ].slice( noValue ) ); 3392 } 3393 3394 // For Promises/A+, convert exceptions into rejections 3395 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3396 // Deferred#then to conditionally suppress rejection. 3397 } catch ( value ) { 3398 3399 // Support: Android 4.0 only 3400 // Strict mode functions invoked without .call/.apply get global-object context 3401 reject.apply( undefined, [ value ] ); 3402 } 3403} 3404 3405jQuery.extend( { 3406 3407 Deferred: function( func ) { 3408 var tuples = [ 3409 3410 // action, add listener, callbacks, 3411 // ... .then handlers, argument index, [final state] 3412 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3413 jQuery.Callbacks( "memory" ), 2 ], 3414 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3415 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3416 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3417 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3418 ], 3419 state = "pending", 3420 promise = { 3421 state: function() { 3422 return state; 3423 }, 3424 always: function() { 3425 deferred.done( arguments ).fail( arguments ); 3426 return this; 3427 }, 3428 "catch": function( fn ) {
vendor: 28,472 bytes, lines 3429-4540
3429 return promise.then( null, fn ); 3430 }, 3431 3432 // Keep pipe for back-compat 3433 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3434 var fns = arguments; 3435 3436 return jQuery.Deferred( function( newDefer ) { 3437 jQuery.each( tuples, function( _i, tuple ) { 3438 3439 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3440 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3441 3442 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3443 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3444 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3445 deferred[ tuple[ 1 ] ]( function() { 3446 var returned = fn && fn.apply( this, arguments ); 3447 if ( returned && isFunction( returned.promise ) ) { 3448 returned.promise() 3449 .progress( newDefer.notify ) 3450 .done( newDefer.resolve ) 3451 .fail( newDefer.reject ); 3452 } else { 3453 newDefer[ tuple[ 0 ] + "With" ]( 3454 this, 3455 fn ? [ returned ] : arguments 3456 ); 3457 } 3458 } ); 3459 } ); 3460 fns = null; 3461 } ).promise(); 3462 }, 3463 then: function( onFulfilled, onRejected, onProgress ) { 3464 var maxDepth = 0; 3465 function resolve( depth, deferred, handler, special ) { 3466 return function() { 3467 var that = this, 3468 args = arguments, 3469 mightThrow = function() { 3470 var returned, then; 3471 3472 // Support: Promises/A+ section 2.3.3.3.3 3473 // https://promisesaplus.com/#point-59 3474 // Ignore double-resolution attempts 3475 if ( depth < maxDepth ) { 3476 return; 3477 } 3478 3479 returned = handler.apply( that, args ); 3480 3481 // Support: Promises/A+ section 2.3.1 3482 // https://promisesaplus.com/#point-48 3483 if ( returned === deferred.promise() ) { 3484 throw new TypeError( "Thenable self-resolution" ); 3485 } 3486 3487 // Support: Promises/A+ sections 2.3.3.1, 3.5 3488 // https://promisesaplus.com/#point-54 3489 // https://promisesaplus.com/#point-75 3490 // Retrieve `then` only once 3491 then = returned && 3492 3493 // Support: Promises/A+ section 2.3.4 3494 // https://promisesaplus.com/#point-64 3495 // Only check objects and functions for thenability 3496 ( typeof returned === "object" || 3497 typeof returned === "function" ) && 3498 returned.then; 3499 3500 // Handle a returned thenable 3501 if ( isFunction( then ) ) { 3502 3503 // Special processors (notify) just wait for resolution 3504 if ( special ) { 3505 then.call( 3506 returned, 3507 resolve( maxDepth, deferred, Identity, special ), 3508 resolve( maxDepth, deferred, Thrower, special ) 3509 ); 3510 3511 // Normal processors (resolve) also hook into progress 3512 } else { 3513 3514 // ...and disregard older resolution values 3515 maxDepth++; 3516 3517 then.call( 3518 returned, 3519 resolve( maxDepth, deferred, Identity, special ), 3520 resolve( maxDepth, deferred, Thrower, special ), 3521 resolve( maxDepth, deferred, Identity, 3522 deferred.notifyWith ) 3523 ); 3524 } 3525 3526 // Handle all other returned values 3527 } else { 3528 3529 // Only substitute handlers pass on context 3530 // and multiple values (non-spec behavior) 3531 if ( handler !== Identity ) { 3532 that = undefined; 3533 args = [ returned ]; 3534 } 3535 3536 // Process the value(s) 3537 // Default process is resolve 3538 ( special || deferred.resolveWith )( that, args ); 3539 } 3540 }, 3541 3542 // Only normal processors (resolve) catch and reject exceptions 3543 process = special ? 3544 mightThrow : 3545 function() { 3546 try { 3547 mightThrow(); 3548 } catch ( e ) { 3549 3550 if ( jQuery.Deferred.exceptionHook ) { 3551 jQuery.Deferred.exceptionHook( e, 3552 process.error ); 3553 } 3554 3555 // Support: Promises/A+ section 2.3.3.3.4.1 3556 // https://promisesaplus.com/#point-61 3557 // Ignore post-resolution exceptions 3558 if ( depth + 1 >= maxDepth ) { 3559 3560 // Only substitute handlers pass on context 3561 // and multiple values (non-spec behavior) 3562 if ( handler !== Thrower ) { 3563 that = undefined; 3564 args = [ e ]; 3565 } 3566 3567 deferred.rejectWith( that, args ); 3568 } 3569 } 3570 }; 3571 3572 // Support: Promises/A+ section 2.3.3.3.1 3573 // https://promisesaplus.com/#point-57 3574 // Re-resolve promises immediately to dodge false rejection from 3575 // subsequent errors 3576 if ( depth ) { 3577 process(); 3578 } else { 3579 3580 // Call an optional hook to record the error, in case of exception 3581 // since it's otherwise lost when execution goes async 3582 if ( jQuery.Deferred.getErrorHook ) { 3583 process.error = jQuery.Deferred.getErrorHook(); 3584 3585 // The deprecated alias of the above. While the name suggests 3586 // returning the stack, not an error instance, jQuery just passes 3587 // it directly to `console.warn` so both will work; an instance 3588 // just better cooperates with source maps. 3589 } else if ( jQuery.Deferred.getStackHook ) { 3590 process.error = jQuery.Deferred.getStackHook(); 3591 } 3592 window.setTimeout( process ); 3593 } 3594 }; 3595 } 3596 3597 return jQuery.Deferred( function( newDefer ) { 3598 3599 // progress_handlers.add( ... ) 3600 tuples[ 0 ][ 3 ].add( 3601 resolve( 3602 0, 3603 newDefer, 3604 isFunction( onProgress ) ? 3605 onProgress : 3606 Identity, 3607 newDefer.notifyWith 3608 ) 3609 ); 3610 3611 // fulfilled_handlers.add( ... ) 3612 tuples[ 1 ][ 3 ].add( 3613 resolve( 3614 0, 3615 newDefer, 3616 isFunction( onFulfilled ) ? 3617 onFulfilled : 3618 Identity 3619 ) 3620 ); 3621 3622 // rejected_handlers.add( ... ) 3623 tuples[ 2 ][ 3 ].add( 3624 resolve( 3625 0, 3626 newDefer, 3627 isFunction( onRejected ) ? 3628 onRejected : 3629 Thrower 3630 ) 3631 ); 3632 } ).promise(); 3633 }, 3634 3635 // Get a promise for this deferred 3636 // If obj is provided, the promise aspect is added to the object 3637 promise: function( obj ) { 3638 return obj != null ? jQuery.extend( obj, promise ) : promise; 3639 } 3640 }, 3641 deferred = {}; 3642 3643 // Add list-specific methods 3644 jQuery.each( tuples, function( i, tuple ) { 3645 var list = tuple[ 2 ], 3646 stateString = tuple[ 5 ]; 3647 3648 // promise.progress = list.add 3649 // promise.done = list.add 3650 // promise.fail = list.add 3651 promise[ tuple[ 1 ] ] = list.add; 3652 3653 // Handle state 3654 if ( stateString ) { 3655 list.add( 3656 function() { 3657 3658 // state = "resolved" (i.e., fulfilled) 3659 // state = "rejected" 3660 state = stateString; 3661 }, 3662 3663 // rejected_callbacks.disable 3664 // fulfilled_callbacks.disable 3665 tuples[ 3 - i ][ 2 ].disable, 3666 3667 // rejected_handlers.disable 3668 // fulfilled_handlers.disable 3669 tuples[ 3 - i ][ 3 ].disable, 3670 3671 // progress_callbacks.lock 3672 tuples[ 0 ][ 2 ].lock, 3673 3674 // progress_handlers.lock 3675 tuples[ 0 ][ 3 ].lock 3676 ); 3677 } 3678 3679 // progress_handlers.fire 3680 // fulfilled_handlers.fire 3681 // rejected_handlers.fire 3682 list.add( tuple[ 3 ].fire ); 3683 3684 // deferred.notify = function() { deferred.notifyWith(...) } 3685 // deferred.resolve = function() { deferred.resolveWith(...) } 3686 // deferred.reject = function() { deferred.rejectWith(...) } 3687 deferred[ tuple[ 0 ] ] = function() { 3688 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3689 return this; 3690 }; 3691 3692 // deferred.notifyWith = list.fireWith 3693 // deferred.resolveWith = list.fireWith 3694 // deferred.rejectWith = list.fireWith 3695 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3696 } ); 3697 3698 // Make the deferred a promise 3699 promise.promise( deferred ); 3700 3701 // Call given func if any 3702 if ( func ) { 3703 func.call( deferred, deferred ); 3704 } 3705 3706 // All done! 3707 return deferred; 3708 }, 3709 3710 // Deferred helper 3711 when: function( singleValue ) { 3712 var 3713 3714 // count of uncompleted subordinates 3715 remaining = arguments.length, 3716 3717 // count of unprocessed arguments 3718 i = remaining, 3719 3720 // subordinate fulfillment data 3721 resolveContexts = Array( i ), 3722 resolveValues = slice.call( arguments ), 3723 3724 // the primary Deferred 3725 primary = jQuery.Deferred(), 3726 3727 // subordinate callback factory 3728 updateFunc = function( i ) { 3729 return function( value ) { 3730 resolveContexts[ i ] = this; 3731 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3732 if ( !( --remaining ) ) { 3733 primary.resolveWith( resolveContexts, resolveValues ); 3734 } 3735 }; 3736 }; 3737 3738 // Single- and empty arguments are adopted like Promise.resolve 3739 if ( remaining <= 1 ) { 3740 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 3741 !remaining ); 3742 3743 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3744 if ( primary.state() === "pending" || 3745 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3746 3747 return primary.then(); 3748 } 3749 } 3750 3751 // Multiple arguments are aggregated like Promise.all array elements 3752 while ( i-- ) { 3753 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 3754 } 3755 3756 return primary.promise(); 3757 } 3758} ); 3759 3760 3761// These usually indicate a programmer mistake during development, 3762// warn about them ASAP rather than swallowing them by default. 3763var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3764 3765// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 3766// captured before the async barrier to get the original error cause 3767// which may otherwise be hidden. 3768jQuery.Deferred.exceptionHook = function( error, asyncError ) { 3769 3770 // Support: IE 8 - 9 only 3771 // Console exists when dev tools are open, which can happen at any time 3772 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3773 window.console.warn( "jQuery.Deferred exception: " + error.message, 3774 error.stack, asyncError ); 3775 } 3776}; 3777 3778 3779 3780 3781jQuery.readyException = function( error ) { 3782 window.setTimeout( function() { 3783 throw error; 3784 } ); 3785}; 3786 3787 3788 3789 3790// The deferred used on DOM ready 3791var readyList = jQuery.Deferred(); 3792 3793jQuery.fn.ready = function( fn ) { 3794 3795 readyList 3796 .then( fn ) 3797 3798 // Wrap jQuery.readyException in a function so that the lookup 3799 // happens at the time of error handling instead of callback 3800 // registration. 3801 .catch( function( error ) { 3802 jQuery.readyException( error ); 3803 } ); 3804 3805 return this; 3806}; 3807 3808jQuery.extend( { 3809 3810 // Is the DOM ready to be used? Set to true once it occurs. 3811 isReady: false, 3812 3813 // A counter to track how many items to wait for before 3814 // the ready event fires. See trac-6781 3815 readyWait: 1, 3816 3817 // Handle when the DOM is ready 3818 ready: function( wait ) { 3819 3820 // Abort if there are pending holds or we're already ready 3821 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3822 return; 3823 } 3824 3825 // Remember that the DOM is ready 3826 jQuery.isReady = true; 3827 3828 // If a normal DOM Ready event fired, decrement, and wait if need be 3829 if ( wait !== true && --jQuery.readyWait > 0 ) { 3830 return; 3831 } 3832 3833 // If there are functions bound, to execute 3834 readyList.resolveWith( document, [ jQuery ] ); 3835 } 3836} ); 3837 3838jQuery.ready.then = readyList.then; 3839 3840// The ready event handler and self cleanup method 3841function completed() { 3842 document.removeEventListener( "DOMContentLoaded", completed ); 3843 window.removeEventListener( "load", completed ); 3844 jQuery.ready(); 3845} 3846 3847// Catch cases where $(document).ready() is called 3848// after the browser event has already occurred. 3849// Support: IE <=9 - 10 only 3850// Older IE sometimes signals "interactive" too soon 3851if ( document.readyState === "complete" || 3852 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3853 3854 // Handle it asynchronously to allow scripts the opportunity to delay ready 3855 window.setTimeout( jQuery.ready ); 3856 3857} else { 3858 3859 // Use the handy event callback 3860 document.addEventListener( "DOMContentLoaded", completed ); 3861 3862 // A fallback to window.onload, that will always work 3863 window.addEventListener( "load", completed ); 3864} 3865 3866 3867 3868 3869// Multifunctional method to get and set values of a collection 3870// The value/s can optionally be executed if it's a function 3871var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3872 var i = 0, 3873 len = elems.length, 3874 bulk = key == null; 3875 3876 // Sets many values 3877 if ( toType( key ) === "object" ) { 3878 chainable = true; 3879 for ( i in key ) { 3880 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3881 } 3882 3883 // Sets one value 3884 } else if ( value !== undefined ) { 3885 chainable = true; 3886 3887 if ( !isFunction( value ) ) { 3888 raw = true; 3889 } 3890 3891 if ( bulk ) { 3892 3893 // Bulk operations run against the entire set 3894 if ( raw ) { 3895 fn.call( elems, value ); 3896 fn = null; 3897 3898 // ...except when executing function values 3899 } else { 3900 bulk = fn; 3901 fn = function( elem, _key, value ) { 3902 return bulk.call( jQuery( elem ), value ); 3903 }; 3904 } 3905 } 3906 3907 if ( fn ) { 3908 for ( ; i < len; i++ ) { 3909 fn( 3910 elems[ i ], key, raw ? 3911 value : 3912 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 3913 ); 3914 } 3915 } 3916 } 3917 3918 if ( chainable ) { 3919 return elems; 3920 } 3921 3922 // Gets 3923 if ( bulk ) { 3924 return fn.call( elems ); 3925 } 3926 3927 return len ? fn( elems[ 0 ], key ) : emptyGet; 3928}; 3929 3930 3931// Matches dashed string for camelizing 3932var rmsPrefix = /^-ms-/, 3933 rdashAlpha = /-([a-z])/g; 3934 3935// Used by camelCase as callback to replace() 3936function fcamelCase( _all, letter ) { 3937 return letter.toUpperCase(); 3938} 3939 3940// Convert dashed to camelCase; used by the css and data modules 3941// Support: IE <=9 - 11, Edge 12 - 15 3942// Microsoft forgot to hump their vendor prefix (trac-9572) 3943function camelCase( string ) { 3944 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 3945} 3946var acceptData = function( owner ) { 3947 3948 // Accepts only: 3949 // - Node 3950 // - Node.ELEMENT_NODE 3951 // - Node.DOCUMENT_NODE 3952 // - Object 3953 // - Any 3954 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 3955}; 3956 3957 3958 3959 3960function Data() { 3961 this.expando = jQuery.expando + Data.uid++; 3962} 3963 3964Data.uid = 1; 3965 3966Data.prototype = { 3967 3968 cache: function( owner ) { 3969 3970 // Check if the owner object already has a cache 3971 var value = owner[ this.expando ]; 3972 3973 // If not, create one 3974 if ( !value ) { 3975 value = {}; 3976 3977 // We can accept data for non-element nodes in modern browsers, 3978 // but we should not, see trac-8335. 3979 // Always return an empty object. 3980 if ( acceptData( owner ) ) { 3981 3982 // If it is a node unlikely to be stringify-ed or looped over 3983 // use plain assignment 3984 if ( owner.nodeType ) { 3985 owner[ this.expando ] = value; 3986 3987 // Otherwise secure it in a non-enumerable property 3988 // configurable must be true to allow the property to be 3989 // deleted when data is removed 3990 } else { 3991 Object.defineProperty( owner, this.expando, { 3992 value: value, 3993 configurable: true 3994 } ); 3995 } 3996 } 3997 } 3998 3999 return value; 4000 }, 4001 set: function( owner, data, value ) { 4002 var prop, 4003 cache = this.cache( owner ); 4004 4005 // Handle: [ owner, key, value ] args 4006 // Always use camelCase key (gh-2257) 4007 if ( typeof data === "string" ) { 4008 cache[ camelCase( data ) ] = value; 4009 4010 // Handle: [ owner, { properties } ] args 4011 } else { 4012 4013 // Copy the properties one-by-one to the cache object 4014 for ( prop in data ) { 4015 cache[ camelCase( prop ) ] = data[ prop ]; 4016 } 4017 } 4018 return cache; 4019 }, 4020 get: function( owner, key ) { 4021 return key === undefined ? 4022 this.cache( owner ) : 4023 4024 // Always use camelCase key (gh-2257) 4025 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4026 }, 4027 access: function( owner, key, value ) { 4028 4029 // In cases where either: 4030 // 4031 // 1. No key was specified 4032 // 2. A string key was specified, but no value provided 4033 // 4034 // Take the "read" path and allow the get method to determine 4035 // which value to return, respectively either: 4036 // 4037 // 1. The entire cache object 4038 // 2. The data stored at the key 4039 // 4040 if ( key === undefined || 4041 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4042 4043 return this.get( owner, key ); 4044 } 4045 4046 // When the key is not a string, or both a key and value 4047 // are specified, set or extend (existing objects) with either: 4048 // 4049 // 1. An object of properties 4050 // 2. A key and value 4051 // 4052 this.set( owner, key, value ); 4053 4054 // Since the "set" path can have two possible entry points 4055 // return the expected data based on which path was taken[*] 4056 return value !== undefined ? value : key; 4057 }, 4058 remove: function( owner, key ) { 4059 var i, 4060 cache = owner[ this.expando ]; 4061 4062 if ( cache === undefined ) { 4063 return; 4064 } 4065 4066 if ( key !== undefined ) { 4067 4068 // Support array or space separated string of keys 4069 if ( Array.isArray( key ) ) { 4070 4071 // If key is an array of keys... 4072 // We always set camelCase keys, so remove that. 4073 key = key.map( camelCase ); 4074 } else { 4075 key = camelCase( key ); 4076 4077 // If a key with the spaces exists, use it. 4078 // Otherwise, create an array by matching non-whitespace 4079 key = key in cache ? 4080 [ key ] : 4081 ( key.match( rnothtmlwhite ) || [] ); 4082 } 4083 4084 i = key.length; 4085 4086 while ( i-- ) { 4087 delete cache[ key[ i ] ]; 4088 } 4089 } 4090 4091 // Remove the expando if there's no more data 4092 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4093 4094 // Support: Chrome <=35 - 45 4095 // Webkit & Blink performance suffers when deleting properties 4096 // from DOM nodes, so set to undefined instead 4097 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4098 if ( owner.nodeType ) { 4099 owner[ this.expando ] = undefined; 4100 } else { 4101 delete owner[ this.expando ]; 4102 } 4103 } 4104 }, 4105 hasData: function( owner ) { 4106 var cache = owner[ this.expando ]; 4107 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4108 } 4109}; 4110var dataPriv = new Data(); 4111 4112var dataUser = new Data(); 4113 4114 4115 4116// Implementation Summary 4117// 4118// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4119// 2. Improve the module's maintainability by reducing the storage 4120// paths to a single mechanism. 4121// 3. Use the same single mechanism to support "private" and "user" data. 4122// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4123// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4124// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4125 4126var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4127 rmultiDash = /[A-Z]/g; 4128 4129function getData( data ) { 4130 if ( data === "true" ) { 4131 return true; 4132 } 4133 4134 if ( data === "false" ) { 4135 return false; 4136 } 4137 4138 if ( data === "null" ) { 4139 return null; 4140 } 4141 4142 // Only convert to a number if it doesn't change the string 4143 if ( data === +data + "" ) { 4144 return +data; 4145 } 4146 4147 if ( rbrace.test( data ) ) { 4148 return JSON.parse( data ); 4149 } 4150 4151 return data; 4152} 4153 4154function dataAttr( elem, key, data ) { 4155 var name; 4156 4157 // If nothing was found internally, try to fetch any 4158 // data from the HTML5 data-* attribute 4159 if ( data === undefined && elem.nodeType === 1 ) { 4160 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4161 data = elem.getAttribute( name ); 4162 4163 if ( typeof data === "string" ) { 4164 try { 4165 data = getData( data ); 4166 } catch ( e ) {} 4167 4168 // Make sure we set the data so it isn't changed later 4169 dataUser.set( elem, key, data ); 4170 } else { 4171 data = undefined; 4172 } 4173 } 4174 return data; 4175} 4176 4177jQuery.extend( { 4178 hasData: function( elem ) { 4179 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4180 }, 4181 4182 data: function( elem, name, data ) { 4183 return dataUser.access( elem, name, data ); 4184 }, 4185 4186 removeData: function( elem, name ) { 4187 dataUser.remove( elem, name ); 4188 }, 4189 4190 // TODO: Now that all calls to _data and _removeData have been replaced 4191 // with direct calls to dataPriv methods, these can be deprecated. 4192 _data: function( elem, name, data ) { 4193 return dataPriv.access( elem, name, data ); 4194 }, 4195 4196 _removeData: function( elem, name ) { 4197 dataPriv.remove( elem, name ); 4198 } 4199} ); 4200 4201jQuery.fn.extend( { 4202 data: function( key, value ) { 4203 var i, name, data, 4204 elem = this[ 0 ], 4205 attrs = elem && elem.attributes; 4206 4207 // Gets all values 4208 if ( key === undefined ) { 4209 if ( this.length ) { 4210 data = dataUser.get( elem ); 4211 4212 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4213 i = attrs.length; 4214 while ( i-- ) { 4215 4216 // Support: IE 11 only 4217 // The attrs elements can be null (trac-14894) 4218 if ( attrs[ i ] ) { 4219 name = attrs[ i ].name; 4220 if ( name.indexOf( "data-" ) === 0 ) { 4221 name = camelCase( name.slice( 5 ) ); 4222 dataAttr( elem, name, data[ name ] ); 4223 } 4224 } 4225 } 4226 dataPriv.set( elem, "hasDataAttrs", true ); 4227 } 4228 } 4229 4230 return data; 4231 } 4232 4233 // Sets multiple values 4234 if ( typeof key === "object" ) { 4235 return this.each( function() { 4236 dataUser.set( this, key ); 4237 } ); 4238 } 4239 4240 return access( this, function( value ) { 4241 var data; 4242 4243 // The calling jQuery object (element matches) is not empty 4244 // (and therefore has an element appears at this[ 0 ]) and the 4245 // `value` parameter was not undefined. An empty jQuery object 4246 // will result in `undefined` for elem = this[ 0 ] which will 4247 // throw an exception if an attempt to read a data cache is made. 4248 if ( elem && value === undefined ) { 4249 4250 // Attempt to get data from the cache 4251 // The key will always be camelCased in Data 4252 data = dataUser.get( elem, key ); 4253 if ( data !== undefined ) { 4254 return data; 4255 } 4256 4257 // Attempt to "discover" the data in 4258 // HTML5 custom data-* attrs 4259 data = dataAttr( elem, key ); 4260 if ( data !== undefined ) { 4261 return data; 4262 } 4263 4264 // We tried really hard, but the data doesn't exist. 4265 return; 4266 } 4267 4268 // Set the data... 4269 this.each( function() { 4270 4271 // We always store the camelCased key 4272 dataUser.set( this, key, value ); 4273 } ); 4274 }, null, value, arguments.length > 1, null, true ); 4275 }, 4276 4277 removeData: function( key ) { 4278 return this.each( function() { 4279 dataUser.remove( this, key ); 4280 } ); 4281 } 4282} ); 4283 4284 4285jQuery.extend( { 4286 queue: function( elem, type, data ) { 4287 var queue; 4288 4289 if ( elem ) { 4290 type = ( type || "fx" ) + "queue"; 4291 queue = dataPriv.get( elem, type ); 4292 4293 // Speed up dequeue by getting out quickly if this is just a lookup 4294 if ( data ) { 4295 if ( !queue || Array.isArray( data ) ) { 4296 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4297 } else { 4298 queue.push( data ); 4299 } 4300 } 4301 return queue || []; 4302 } 4303 }, 4304 4305 dequeue: function( elem, type ) { 4306 type = type || "fx"; 4307 4308 var queue = jQuery.queue( elem, type ), 4309 startLength = queue.length, 4310 fn = queue.shift(), 4311 hooks = jQuery._queueHooks( elem, type ), 4312 next = function() { 4313 jQuery.dequeue( elem, type ); 4314 }; 4315 4316 // If the fx queue is dequeued, always remove the progress sentinel 4317 if ( fn === "inprogress" ) { 4318 fn = queue.shift(); 4319 startLength--; 4320 } 4321 4322 if ( fn ) { 4323 4324 // Add a progress sentinel to prevent the fx queue from being 4325 // automatically dequeued 4326 if ( type === "fx" ) { 4327 queue.unshift( "inprogress" ); 4328 } 4329 4330 // Clear up the last queue stop function 4331 delete hooks.stop; 4332 fn.call( elem, next, hooks ); 4333 } 4334 4335 if ( !startLength && hooks ) { 4336 hooks.empty.fire(); 4337 } 4338 }, 4339 4340 // Not public - generate a queueHooks object, or return the current one 4341 _queueHooks: function( elem, type ) { 4342 var key = type + "queueHooks"; 4343 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4344 empty: jQuery.Callbacks( "once memory" ).add( function() { 4345 dataPriv.remove( elem, [ type + "queue", key ] ); 4346 } ) 4347 } ); 4348 } 4349} ); 4350 4351jQuery.fn.extend( { 4352 queue: function( type, data ) { 4353 var setter = 2; 4354 4355 if ( typeof type !== "string" ) { 4356 data = type; 4357 type = "fx"; 4358 setter--; 4359 } 4360 4361 if ( arguments.length < setter ) { 4362 return jQuery.queue( this[ 0 ], type ); 4363 } 4364 4365 return data === undefined ? 4366 this : 4367 this.each( function() { 4368 var queue = jQuery.queue( this, type, data ); 4369 4370 // Ensure a hooks for this queue 4371 jQuery._queueHooks( this, type ); 4372 4373 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4374 jQuery.dequeue( this, type ); 4375 } 4376 } ); 4377 }, 4378 dequeue: function( type ) { 4379 return this.each( function() { 4380 jQuery.dequeue( this, type ); 4381 } ); 4382 }, 4383 clearQueue: function( type ) { 4384 return this.queue( type || "fx", [] ); 4385 }, 4386 4387 // Get a promise resolved when queues of a certain type 4388 // are emptied (fx is the type by default) 4389 promise: function( type, obj ) { 4390 var tmp, 4391 count = 1, 4392 defer = jQuery.Deferred(), 4393 elements = this, 4394 i = this.length, 4395 resolve = function() { 4396 if ( !( --count ) ) { 4397 defer.resolveWith( elements, [ elements ] ); 4398 } 4399 }; 4400 4401 if ( typeof type !== "string" ) { 4402 obj = type; 4403 type = undefined; 4404 } 4405 type = type || "fx"; 4406 4407 while ( i-- ) { 4408 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4409 if ( tmp && tmp.empty ) { 4410 count++; 4411 tmp.empty.add( resolve ); 4412 } 4413 } 4414 resolve(); 4415 return defer.promise( obj ); 4416 } 4417} ); 4418var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4419 4420var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4421 4422 4423var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4424 4425var documentElement = document.documentElement; 4426 4427 4428 4429 var isAttached = function( elem ) { 4430 return jQuery.contains( elem.ownerDocument, elem ); 4431 }, 4432 composed = { composed: true }; 4433 4434 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4435 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4436 // Support: iOS 10.0-10.2 only 4437 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4438 // leading to errors. We need to check for `getRootNode`. 4439 if ( documentElement.getRootNode ) { 4440 isAttached = function( elem ) { 4441 return jQuery.contains( elem.ownerDocument, elem ) || 4442 elem.getRootNode( composed ) === elem.ownerDocument; 4443 }; 4444 } 4445var isHiddenWithinTree = function( elem, el ) { 4446 4447 // isHiddenWithinTree might be called from jQuery#filter function; 4448 // in that case, element will be second argument 4449 elem = el || elem; 4450 4451 // Inline style trumps all 4452 return elem.style.display === "none" || 4453 elem.style.display === "" && 4454 4455 // Otherwise, check computed style 4456 // Support: Firefox <=43 - 45 4457 // Disconnected elements can have computed display: none, so first confirm that elem is 4458 // in the document. 4459 isAttached( elem ) && 4460 4461 jQuery.css( elem, "display" ) === "none"; 4462 }; 4463 4464 4465 4466function adjustCSS( elem, prop, valueParts, tween ) { 4467 var adjusted, scale, 4468 maxIterations = 20, 4469 currentValue = tween ? 4470 function() { 4471 return tween.cur(); 4472 } : 4473 function() { 4474 return jQuery.css( elem, prop, "" ); 4475 }, 4476 initial = currentValue(), 4477 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4478 4479 // Starting value computation is required for potential unit mismatches 4480 initialInUnit = elem.nodeType && 4481 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4482 rcssNum.exec( jQuery.css( elem, prop ) ); 4483 4484 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4485 4486 // Support: Firefox <=54 4487 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4488 initial = initial / 2; 4489 4490 // Trust units reported by jQuery.css 4491 unit = unit || initialInUnit[ 3 ]; 4492 4493 // Iteratively approximate from a nonzero starting point 4494 initialInUnit = +initial || 1; 4495 4496 while ( maxIterations-- ) { 4497 4498 // Evaluate and update our best guess (doubling guesses that zero out). 4499 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4500 jQuery.style( elem, prop, initialInUnit + unit ); 4501 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4502 maxIterations = 0; 4503 } 4504 initialInUnit = initialInUnit / scale; 4505 4506 } 4507 4508 initialInUnit = initialInUnit * 2; 4509 jQuery.style( elem, prop, initialInUnit + unit ); 4510 4511 // Make sure we update the tween properties later on 4512 valueParts = valueParts || []; 4513 } 4514 4515 if ( valueParts ) { 4516 initialInUnit = +initialInUnit || +initial || 0; 4517 4518 // Apply relative offset (+=/-=) if specified 4519 adjusted = valueParts[ 1 ] ? 4520 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4521 +valueParts[ 2 ]; 4522 if ( tween ) { 4523 tween.unit = unit; 4524 tween.start = initialInUnit; 4525 tween.end = adjusted; 4526 } 4527 } 4528 return adjusted; 4529} 4530 4531 4532var defaultDisplayMap = {}; 4533 4534function getDefaultDisplay( elem ) { 4535 var temp, 4536 doc = elem.ownerDocument, 4537 nodeName = elem.nodeName, 4538 display = defaultDisplayMap[ nodeName ]; 4539 4540 if ( display ) {
vendor: 2,317 bytes, lines 4541-4639
4541 return display; 4542 } 4543 4544 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4545 display = jQuery.css( temp, "display" ); 4546 4547 temp.parentNode.removeChild( temp ); 4548 4549 if ( display === "none" ) { 4550 display = "block"; 4551 } 4552 defaultDisplayMap[ nodeName ] = display; 4553 4554 return display; 4555} 4556 4557function showHide( elements, show ) { 4558 var display, elem, 4559 values = [], 4560 index = 0, 4561 length = elements.length; 4562 4563 // Determine new display value for elements that need to change 4564 for ( ; index < length; index++ ) { 4565 elem = elements[ index ]; 4566 if ( !elem.style ) { 4567 continue; 4568 } 4569 4570 display = elem.style.display; 4571 if ( show ) { 4572 4573 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4574 // check is required in this first loop unless we have a nonempty display value (either 4575 // inline or about-to-be-restored) 4576 if ( display === "none" ) { 4577 values[ index ] = dataPriv.get( elem, "display" ) || null; 4578 if ( !values[ index ] ) { 4579 elem.style.display = ""; 4580 } 4581 } 4582 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4583 values[ index ] = getDefaultDisplay( elem ); 4584 } 4585 } else { 4586 if ( display !== "none" ) { 4587 values[ index ] = "none"; 4588 4589 // Remember what we're overwriting 4590 dataPriv.set( elem, "display", display ); 4591 } 4592 } 4593 } 4594 4595 // Set the display of the elements in a second loop to avoid constant reflow 4596 for ( index = 0; index < length; index++ ) { 4597 if ( values[ index ] != null ) { 4598 elements[ index ].style.display = values[ index ]; 4599 } 4600 } 4601 4602 return elements; 4603} 4604 4605jQuery.fn.extend( { 4606 show: function() { 4607 return showHide( this, true ); 4608 }, 4609 hide: function() { 4610 return showHide( this ); 4611 }, 4612 toggle: function( state ) { 4613 if ( typeof state === "boolean" ) { 4614 return state ? this.show() : this.hide(); 4615 } 4616 4617 return this.each( function() { 4618 if ( isHiddenWithinTree( this ) ) { 4619 jQuery( this ).show(); 4620 } else { 4621 jQuery( this ).hide(); 4622 } 4623 } ); 4624 } 4625} ); 4626var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4627 4628var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4629 4630var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4631 4632 4633 4634( function() { 4635 var fragment = document.createDocumentFragment(), 4636 div = fragment.appendChild( document.createElement( "div" ) ), 4637 input = document.createElement( "input" ); 4638 4639 // Support: Android 4.0 - 4.3 only
vendor: 10,092 bytes, lines 4640-5024
4640 // Check state lost if the name is set (trac-11217) 4641 // Support: Windows Web Apps (WWA) 4642 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4643 input.setAttribute( "type", "radio" ); 4644 input.setAttribute( "checked", "checked" ); 4645 input.setAttribute( "name", "t" ); 4646 4647 div.appendChild( input ); 4648 4649 // Support: Android <=4.1 only 4650 // Older WebKit doesn't clone checked state correctly in fragments 4651 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4652 4653 // Support: IE <=11 only 4654 // Make sure textarea (and checkbox) defaultValue is properly cloned 4655 div.innerHTML = "<textarea>x</textarea>"; 4656 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4657 4658 // Support: IE <=9 only 4659 // IE <=9 replaces <option> tags with their contents when inserted outside of 4660 // the select element. 4661 div.innerHTML = "<option></option>"; 4662 support.option = !!div.lastChild; 4663} )(); 4664 4665 4666// We have to close these tags to support XHTML (trac-13200) 4667var wrapMap = { 4668 4669 // XHTML parsers do not magically insert elements in the 4670 // same way that tag soup parsers do. So we cannot shorten 4671 // this by omitting <tbody> or other required elements. 4672 thead: [ 1, "<table>", "</table>" ], 4673 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4674 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4675 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4676 4677 _default: [ 0, "", "" ] 4678}; 4679 4680wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4681wrapMap.th = wrapMap.td; 4682 4683// Support: IE <=9 only 4684if ( !support.option ) { 4685 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4686} 4687 4688 4689function getAll( context, tag ) { 4690 4691 // Support: IE <=9 - 11 only 4692 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 4693 var ret; 4694 4695 if ( typeof context.getElementsByTagName !== "undefined" ) { 4696 ret = context.getElementsByTagName( tag || "*" ); 4697 4698 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4699 ret = context.querySelectorAll( tag || "*" ); 4700 4701 } else { 4702 ret = []; 4703 } 4704 4705 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4706 return jQuery.merge( [ context ], ret ); 4707 } 4708 4709 return ret; 4710} 4711 4712 4713// Mark scripts as having already been evaluated 4714function setGlobalEval( elems, refElements ) { 4715 var i = 0, 4716 l = elems.length; 4717 4718 for ( ; i < l; i++ ) { 4719 dataPriv.set( 4720 elems[ i ], 4721 "globalEval", 4722 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4723 ); 4724 } 4725} 4726 4727 4728var rhtml = /<|&#?\w+;/; 4729 4730function buildFragment( elems, context, scripts, selection, ignored ) { 4731 var elem, tmp, tag, wrap, attached, j, 4732 fragment = context.createDocumentFragment(), 4733 nodes = [], 4734 i = 0, 4735 l = elems.length; 4736 4737 for ( ; i < l; i++ ) { 4738 elem = elems[ i ]; 4739 4740 if ( elem || elem === 0 ) { 4741 4742 // Add nodes directly 4743 if ( toType( elem ) === "object" ) { 4744 4745 // Support: Android <=4.0 only, PhantomJS 1 only 4746 // push.apply(_, arraylike) throws on ancient WebKit 4747 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4748 4749 // Convert non-html into a text node 4750 } else if ( !rhtml.test( elem ) ) { 4751 nodes.push( context.createTextNode( elem ) ); 4752 4753 // Convert html into DOM nodes 4754 } else { 4755 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4756 4757 // Deserialize a standard representation 4758 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4759 wrap = wrapMap[ tag ] || wrapMap._default; 4760 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4761 4762 // Descend through wrappers to the right content 4763 j = wrap[ 0 ]; 4764 while ( j-- ) { 4765 tmp = tmp.lastChild; 4766 } 4767 4768 // Support: Android <=4.0 only, PhantomJS 1 only 4769 // push.apply(_, arraylike) throws on ancient WebKit 4770 jQuery.merge( nodes, tmp.childNodes ); 4771 4772 // Remember the top-level container 4773 tmp = fragment.firstChild; 4774 4775 // Ensure the created nodes are orphaned (trac-12392) 4776 tmp.textContent = ""; 4777 } 4778 } 4779 } 4780 4781 // Remove wrapper from fragment 4782 fragment.textContent = ""; 4783 4784 i = 0; 4785 while ( ( elem = nodes[ i++ ] ) ) { 4786 4787 // Skip elements already in the context collection (trac-4087) 4788 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4789 if ( ignored ) { 4790 ignored.push( elem ); 4791 } 4792 continue; 4793 } 4794 4795 attached = isAttached( elem ); 4796 4797 // Append to fragment 4798 tmp = getAll( fragment.appendChild( elem ), "script" ); 4799 4800 // Preserve script evaluation history 4801 if ( attached ) { 4802 setGlobalEval( tmp ); 4803 } 4804 4805 // Capture executables 4806 if ( scripts ) { 4807 j = 0; 4808 while ( ( elem = tmp[ j++ ] ) ) { 4809 if ( rscriptType.test( elem.type || "" ) ) { 4810 scripts.push( elem ); 4811 } 4812 } 4813 } 4814 } 4815 4816 return fragment; 4817} 4818 4819 4820var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4821 4822function returnTrue() { 4823 return true; 4824} 4825 4826function returnFalse() { 4827 return false; 4828} 4829 4830function on( elem, types, selector, data, fn, one ) { 4831 var origFn, type; 4832 4833 // Types can be a map of types/handlers 4834 if ( typeof types === "object" ) { 4835 4836 // ( types-Object, selector, data ) 4837 if ( typeof selector !== "string" ) { 4838 4839 // ( types-Object, data ) 4840 data = data || selector; 4841 selector = undefined; 4842 } 4843 for ( type in types ) { 4844 on( elem, type, selector, data, types[ type ], one ); 4845 } 4846 return elem; 4847 } 4848 4849 if ( data == null && fn == null ) { 4850 4851 // ( types, fn ) 4852 fn = selector; 4853 data = selector = undefined; 4854 } else if ( fn == null ) { 4855 if ( typeof selector === "string" ) { 4856 4857 // ( types, selector, fn ) 4858 fn = data; 4859 data = undefined; 4860 } else { 4861 4862 // ( types, data, fn ) 4863 fn = data; 4864 data = selector; 4865 selector = undefined; 4866 } 4867 } 4868 if ( fn === false ) { 4869 fn = returnFalse; 4870 } else if ( !fn ) { 4871 return elem; 4872 } 4873 4874 if ( one === 1 ) { 4875 origFn = fn; 4876 fn = function( event ) { 4877 4878 // Can use an empty set, since event contains the info 4879 jQuery().off( event ); 4880 return origFn.apply( this, arguments ); 4881 }; 4882 4883 // Use same guid so caller can remove using origFn 4884 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4885 } 4886 return elem.each( function() { 4887 jQuery.event.add( this, types, fn, data, selector ); 4888 } ); 4889} 4890 4891/* 4892 * Helper functions for managing events -- not part of the public interface. 4893 * Props to Dean Edwards' addEvent library for many of the ideas. 4894 */ 4895jQuery.event = { 4896 4897 global: {}, 4898 4899 add: function( elem, types, handler, data, selector ) { 4900 4901 var handleObjIn, eventHandle, tmp, 4902 events, t, handleObj, 4903 special, handlers, type, namespaces, origType, 4904 elemData = dataPriv.get( elem ); 4905 4906 // Only attach events to objects that accept data 4907 if ( !acceptData( elem ) ) { 4908 return; 4909 } 4910 4911 // Caller can pass in an object of custom data in lieu of the handler 4912 if ( handler.handler ) { 4913 handleObjIn = handler; 4914 handler = handleObjIn.handler; 4915 selector = handleObjIn.selector; 4916 } 4917 4918 // Ensure that invalid selectors throw exceptions at attach time 4919 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 4920 if ( selector ) { 4921 jQuery.find.matchesSelector( documentElement, selector ); 4922 } 4923 4924 // Make sure that the handler has a unique ID, used to find/remove it later 4925 if ( !handler.guid ) { 4926 handler.guid = jQuery.guid++; 4927 } 4928 4929 // Init the element's event structure and main handler, if this is the first 4930 if ( !( events = elemData.events ) ) { 4931 events = elemData.events = Object.create( null ); 4932 } 4933 if ( !( eventHandle = elemData.handle ) ) { 4934 eventHandle = elemData.handle = function( e ) { 4935 4936 // Discard the second event of a jQuery.event.trigger() and 4937 // when an event is called after a page has unloaded 4938 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 4939 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 4940 }; 4941 } 4942 4943 // Handle multiple events separated by a space 4944 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 4945 t = types.length; 4946 while ( t-- ) { 4947 tmp = rtypenamespace.exec( types[ t ] ) || []; 4948 type = origType = tmp[ 1 ]; 4949 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4950 4951 // There *must* be a type, no attaching namespace-only handlers 4952 if ( !type ) { 4953 continue; 4954 } 4955 4956 // If event changes its type, use the special event handlers for the changed type 4957 special = jQuery.event.special[ type ] || {}; 4958 4959 // If selector defined, determine special event api type, otherwise given type 4960 type = ( selector ? special.delegateType : special.bindType ) || type; 4961 4962 // Update special based on newly reset type 4963 special = jQuery.event.special[ type ] || {}; 4964 4965 // handleObj is passed to all event handlers 4966 handleObj = jQuery.extend( { 4967 type: type, 4968 origType: origType, 4969 data: data, 4970 handler: handler, 4971 guid: handler.guid, 4972 selector: selector, 4973 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 4974 namespace: namespaces.join( "." ) 4975 }, handleObjIn ); 4976 4977 // Init the event handler queue if we're the first 4978 if ( !( handlers = events[ type ] ) ) { 4979 handlers = events[ type ] = []; 4980 handlers.delegateCount = 0; 4981 4982 // Only use addEventListener if the special events handler returns false 4983 if ( !special.setup || 4984 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 4985 4986 if ( elem.addEventListener ) { 4987 elem.addEventListener( type, eventHandle ); 4988 } 4989 } 4990 } 4991 4992 if ( special.add ) { 4993 special.add.call( elem, handleObj ); 4994 4995 if ( !handleObj.handler.guid ) { 4996 handleObj.handler.guid = handler.guid; 4997 } 4998 } 4999 5000 // Add to the element's handler list, delegates in front 5001 if ( selector ) { 5002 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5003 } else { 5004 handlers.push( handleObj ); 5005 } 5006 5007 // Keep track of which events have ever been used, for event optimization 5008 jQuery.event.global[ type ] = true; 5009 } 5010 5011 }, 5012 5013 // Detach an event or set of events from an element 5014 remove: function( elem, types, handler, selector, mappedTypes ) { 5015 5016 var j, origCount, tmp, 5017 events, t, handleObj, 5018 special, handlers, type, namespaces, origType, 5019 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5020 5021 if ( !elemData || !( events = elemData.events ) ) { 5022 return; 5023 } 5024
vendor: 4,197 bytes, lines 5025-5163
5025 // Once for each type.namespace in types; type may be omitted 5026 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5027 t = types.length; 5028 while ( t-- ) { 5029 tmp = rtypenamespace.exec( types[ t ] ) || []; 5030 type = origType = tmp[ 1 ]; 5031 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5032 5033 // Unbind all events (on this namespace, if provided) for the element 5034 if ( !type ) { 5035 for ( type in events ) { 5036 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5037 } 5038 continue; 5039 } 5040 5041 special = jQuery.event.special[ type ] || {}; 5042 type = ( selector ? special.delegateType : special.bindType ) || type; 5043 handlers = events[ type ] || []; 5044 tmp = tmp[ 2 ] && 5045 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5046 5047 // Remove matching events 5048 origCount = j = handlers.length; 5049 while ( j-- ) { 5050 handleObj = handlers[ j ]; 5051 5052 if ( ( mappedTypes || origType === handleObj.origType ) && 5053 ( !handler || handler.guid === handleObj.guid ) && 5054 ( !tmp || tmp.test( handleObj.namespace ) ) && 5055 ( !selector || selector === handleObj.selector || 5056 selector === "**" && handleObj.selector ) ) { 5057 handlers.splice( j, 1 ); 5058 5059 if ( handleObj.selector ) { 5060 handlers.delegateCount--; 5061 } 5062 if ( special.remove ) { 5063 special.remove.call( elem, handleObj ); 5064 } 5065 } 5066 } 5067 5068 // Remove generic event handler if we removed something and no more handlers exist 5069 // (avoids potential for endless recursion during removal of special event handlers) 5070 if ( origCount && !handlers.length ) { 5071 if ( !special.teardown || 5072 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5073 5074 jQuery.removeEvent( elem, type, elemData.handle ); 5075 } 5076 5077 delete events[ type ]; 5078 } 5079 } 5080 5081 // Remove data and the expando if it's no longer used 5082 if ( jQuery.isEmptyObject( events ) ) { 5083 dataPriv.remove( elem, "handle events" ); 5084 } 5085 }, 5086 5087 dispatch: function( nativeEvent ) { 5088 5089 var i, j, ret, matched, handleObj, handlerQueue, 5090 args = new Array( arguments.length ), 5091 5092 // Make a writable jQuery.Event from the native event object 5093 event = jQuery.event.fix( nativeEvent ), 5094 5095 handlers = ( 5096 dataPriv.get( this, "events" ) || Object.create( null ) 5097 )[ event.type ] || [], 5098 special = jQuery.event.special[ event.type ] || {}; 5099 5100 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5101 args[ 0 ] = event; 5102 5103 for ( i = 1; i < arguments.length; i++ ) { 5104 args[ i ] = arguments[ i ]; 5105 } 5106 5107 event.delegateTarget = this; 5108 5109 // Call the preDispatch hook for the mapped type, and let it bail if desired 5110 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5111 return; 5112 } 5113 5114 // Determine handlers 5115 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5116 5117 // Run delegates first; they may want to stop propagation beneath us 5118 i = 0; 5119 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5120 event.currentTarget = matched.elem; 5121 5122 j = 0; 5123 while ( ( handleObj = matched.handlers[ j++ ] ) && 5124 !event.isImmediatePropagationStopped() ) { 5125 5126 // If the event is namespaced, then each handler is only invoked if it is 5127 // specially universal or its namespaces are a superset of the event's. 5128 if ( !event.rnamespace || handleObj.namespace === false || 5129 event.rnamespace.test( handleObj.namespace ) ) { 5130 5131 event.handleObj = handleObj; 5132 event.data = handleObj.data; 5133 5134 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5135 handleObj.handler ).apply( matched.elem, args ); 5136 5137 if ( ret !== undefined ) { 5138 if ( ( event.result = ret ) === false ) { 5139 event.preventDefault(); 5140 event.stopPropagation(); 5141 } 5142 } 5143 } 5144 } 5145 } 5146 5147 // Call the postDispatch hook for the mapped type 5148 if ( special.postDispatch ) { 5149 special.postDispatch.call( this, event ); 5150 } 5151 5152 return event.result; 5153 }, 5154 5155 handlers: function( event, handlers ) { 5156 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5157 handlerQueue = [], 5158 delegateCount = handlers.delegateCount, 5159 cur = event.target; 5160 5161 // Find delegate handlers 5162 if ( delegateCount && 5163
vendor: 25,415 bytes, lines 5164-6040
5164 // Support: IE <=9 5165 // Black-hole SVG <use> instance trees (trac-13180) 5166 cur.nodeType && 5167 5168 // Support: Firefox <=42 5169 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5170 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5171 // Support: IE 11 only 5172 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5173 !( event.type === "click" && event.button >= 1 ) ) { 5174 5175 for ( ; cur !== this; cur = cur.parentNode || this ) { 5176 5177 // Don't check non-elements (trac-13208) 5178 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5179 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5180 matchedHandlers = []; 5181 matchedSelectors = {}; 5182 for ( i = 0; i < delegateCount; i++ ) { 5183 handleObj = handlers[ i ]; 5184 5185 // Don't conflict with Object.prototype properties (trac-13203) 5186 sel = handleObj.selector + " "; 5187 5188 if ( matchedSelectors[ sel ] === undefined ) { 5189 matchedSelectors[ sel ] = handleObj.needsContext ? 5190 jQuery( sel, this ).index( cur ) > -1 : 5191 jQuery.find( sel, this, null, [ cur ] ).length; 5192 } 5193 if ( matchedSelectors[ sel ] ) { 5194 matchedHandlers.push( handleObj ); 5195 } 5196 } 5197 if ( matchedHandlers.length ) { 5198 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5199 } 5200 } 5201 } 5202 } 5203 5204 // Add the remaining (directly-bound) handlers 5205 cur = this; 5206 if ( delegateCount < handlers.length ) { 5207 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5208 } 5209 5210 return handlerQueue; 5211 }, 5212 5213 addProp: function( name, hook ) { 5214 Object.defineProperty( jQuery.Event.prototype, name, { 5215 enumerable: true, 5216 configurable: true, 5217 5218 get: isFunction( hook ) ? 5219 function() { 5220 if ( this.originalEvent ) { 5221 return hook( this.originalEvent ); 5222 } 5223 } : 5224 function() { 5225 if ( this.originalEvent ) { 5226 return this.originalEvent[ name ]; 5227 } 5228 }, 5229 5230 set: function( value ) { 5231 Object.defineProperty( this, name, { 5232 enumerable: true, 5233 configurable: true, 5234 writable: true, 5235 value: value 5236 } ); 5237 } 5238 } ); 5239 }, 5240 5241 fix: function( originalEvent ) { 5242 return originalEvent[ jQuery.expando ] ? 5243 originalEvent : 5244 new jQuery.Event( originalEvent ); 5245 }, 5246 5247 special: { 5248 load: { 5249 5250 // Prevent triggered image.load events from bubbling to window.load 5251 noBubble: true 5252 }, 5253 click: { 5254 5255 // Utilize native event to ensure correct state for checkable inputs 5256 setup: function( data ) { 5257 5258 // For mutual compressibility with _default, replace `this` access with a local var. 5259 // `|| data` is dead code meant only to preserve the variable through minification. 5260 var el = this || data; 5261 5262 // Claim the first handler 5263 if ( rcheckableType.test( el.type ) && 5264 el.click && nodeName( el, "input" ) ) { 5265 5266 // dataPriv.set( el, "click", ... ) 5267 leverageNative( el, "click", true ); 5268 } 5269 5270 // Return false to allow normal processing in the caller 5271 return false; 5272 }, 5273 trigger: function( data ) { 5274 5275 // For mutual compressibility with _default, replace `this` access with a local var. 5276 // `|| data` is dead code meant only to preserve the variable through minification. 5277 var el = this || data; 5278 5279 // Force setup before triggering a click 5280 if ( rcheckableType.test( el.type ) && 5281 el.click && nodeName( el, "input" ) ) { 5282 5283 leverageNative( el, "click" ); 5284 } 5285 5286 // Return non-false to allow normal event-path propagation 5287 return true; 5288 }, 5289 5290 // For cross-browser consistency, suppress native .click() on links 5291 // Also prevent it if we're currently inside a leveraged native-event stack 5292 _default: function( event ) { 5293 var target = event.target; 5294 return rcheckableType.test( target.type ) && 5295 target.click && nodeName( target, "input" ) && 5296 dataPriv.get( target, "click" ) || 5297 nodeName( target, "a" ); 5298 } 5299 }, 5300 5301 beforeunload: { 5302 postDispatch: function( event ) { 5303 5304 // Support: Firefox 20+ 5305 // Firefox doesn't alert if the returnValue field is not set. 5306 if ( event.result !== undefined && event.originalEvent ) { 5307 event.originalEvent.returnValue = event.result; 5308 } 5309 } 5310 } 5311 } 5312}; 5313 5314// Ensure the presence of an event listener that handles manually-triggered 5315// synthetic events by interrupting progress until reinvoked in response to 5316// *native* events that it fires directly, ensuring that state changes have 5317// already occurred before other listeners are invoked. 5318function leverageNative( el, type, isSetup ) { 5319 5320 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 5321 if ( !isSetup ) { 5322 if ( dataPriv.get( el, type ) === undefined ) { 5323 jQuery.event.add( el, type, returnTrue ); 5324 } 5325 return; 5326 } 5327 5328 // Register the controller as a special universal handler for all event namespaces 5329 dataPriv.set( el, type, false ); 5330 jQuery.event.add( el, type, { 5331 namespace: false, 5332 handler: function( event ) { 5333 var result, 5334 saved = dataPriv.get( this, type ); 5335 5336 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5337 5338 // Interrupt processing of the outer synthetic .trigger()ed event 5339 if ( !saved ) { 5340 5341 // Store arguments for use when handling the inner native event 5342 // There will always be at least one argument (an event object), so this array 5343 // will not be confused with a leftover capture object. 5344 saved = slice.call( arguments ); 5345 dataPriv.set( this, type, saved ); 5346 5347 // Trigger the native event and capture its result 5348 this[ type ](); 5349 result = dataPriv.get( this, type ); 5350 dataPriv.set( this, type, false ); 5351 5352 if ( saved !== result ) { 5353 5354 // Cancel the outer synthetic event 5355 event.stopImmediatePropagation(); 5356 event.preventDefault(); 5357 5358 return result; 5359 } 5360 5361 // If this is an inner synthetic event for an event with a bubbling surrogate 5362 // (focus or blur), assume that the surrogate already propagated from triggering 5363 // the native event and prevent that from happening again here. 5364 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5365 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5366 // less bad than duplication. 5367 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5368 event.stopPropagation(); 5369 } 5370 5371 // If this is a native event triggered above, everything is now in order 5372 // Fire an inner synthetic event with the original arguments 5373 } else if ( saved ) { 5374 5375 // ...and capture the result 5376 dataPriv.set( this, type, jQuery.event.trigger( 5377 saved[ 0 ], 5378 saved.slice( 1 ), 5379 this 5380 ) ); 5381 5382 // Abort handling of the native event by all jQuery handlers while allowing 5383 // native handlers on the same element to run. On target, this is achieved 5384 // by stopping immediate propagation just on the jQuery event. However, 5385 // the native event is re-wrapped by a jQuery one on each level of the 5386 // propagation so the only way to stop it for jQuery is to stop it for 5387 // everyone via native `stopPropagation()`. This is not a problem for 5388 // focus/blur which don't bubble, but it does also stop click on checkboxes 5389 // and radios. We accept this limitation. 5390 event.stopPropagation(); 5391 event.isImmediatePropagationStopped = returnTrue; 5392 } 5393 } 5394 } ); 5395} 5396 5397jQuery.removeEvent = function( elem, type, handle ) { 5398 5399 // This "if" is needed for plain objects 5400 if ( elem.removeEventListener ) { 5401 elem.removeEventListener( type, handle ); 5402 } 5403}; 5404 5405jQuery.Event = function( src, props ) { 5406 5407 // Allow instantiation without the 'new' keyword 5408 if ( !( this instanceof jQuery.Event ) ) { 5409 return new jQuery.Event( src, props ); 5410 } 5411 5412 // Event object 5413 if ( src && src.type ) { 5414 this.originalEvent = src; 5415 this.type = src.type; 5416 5417 // Events bubbling up the document may have been marked as prevented 5418 // by a handler lower down the tree; reflect the correct value. 5419 this.isDefaultPrevented = src.defaultPrevented || 5420 src.defaultPrevented === undefined && 5421 5422 // Support: Android <=2.3 only 5423 src.returnValue === false ? 5424 returnTrue : 5425 returnFalse; 5426 5427 // Create target properties 5428 // Support: Safari <=6 - 7 only 5429 // Target should not be a text node (trac-504, trac-13143) 5430 this.target = ( src.target && src.target.nodeType === 3 ) ? 5431 src.target.parentNode : 5432 src.target; 5433 5434 this.currentTarget = src.currentTarget; 5435 this.relatedTarget = src.relatedTarget; 5436 5437 // Event type 5438 } else { 5439 this.type = src; 5440 } 5441 5442 // Put explicitly provided properties onto the event object 5443 if ( props ) { 5444 jQuery.extend( this, props ); 5445 } 5446 5447 // Create a timestamp if incoming event doesn't have one 5448 this.timeStamp = src && src.timeStamp || Date.now(); 5449 5450 // Mark it as fixed 5451 this[ jQuery.expando ] = true; 5452}; 5453 5454// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5455// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5456jQuery.Event.prototype = { 5457 constructor: jQuery.Event, 5458 isDefaultPrevented: returnFalse, 5459 isPropagationStopped: returnFalse, 5460 isImmediatePropagationStopped: returnFalse, 5461 isSimulated: false, 5462 5463 preventDefault: function() { 5464 var e = this.originalEvent; 5465 5466 this.isDefaultPrevented = returnTrue; 5467 5468 if ( e && !this.isSimulated ) { 5469 e.preventDefault(); 5470 } 5471 }, 5472 stopPropagation: function() { 5473 var e = this.originalEvent; 5474 5475 this.isPropagationStopped = returnTrue; 5476 5477 if ( e && !this.isSimulated ) { 5478 e.stopPropagation(); 5479 } 5480 }, 5481 stopImmediatePropagation: function() { 5482 var e = this.originalEvent; 5483 5484 this.isImmediatePropagationStopped = returnTrue; 5485 5486 if ( e && !this.isSimulated ) { 5487 e.stopImmediatePropagation(); 5488 } 5489 5490 this.stopPropagation(); 5491 } 5492}; 5493 5494// Includes all common event props including KeyEvent and MouseEvent specific props 5495jQuery.each( { 5496 altKey: true, 5497 bubbles: true, 5498 cancelable: true, 5499 changedTouches: true, 5500 ctrlKey: true, 5501 detail: true, 5502 eventPhase: true, 5503 metaKey: true, 5504 pageX: true, 5505 pageY: true, 5506 shiftKey: true, 5507 view: true, 5508 "char": true, 5509 code: true, 5510 charCode: true, 5511 key: true, 5512 keyCode: true, 5513 button: true, 5514 buttons: true, 5515 clientX: true, 5516 clientY: true, 5517 offsetX: true, 5518 offsetY: true, 5519 pointerId: true, 5520 pointerType: true, 5521 screenX: true, 5522 screenY: true, 5523 targetTouches: true, 5524 toElement: true, 5525 touches: true, 5526 which: true 5527}, jQuery.event.addProp ); 5528 5529jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5530 5531 function focusMappedHandler( nativeEvent ) { 5532 if ( document.documentMode ) { 5533 5534 // Support: IE 11+ 5535 // Attach a single focusin/focusout handler on the document while someone wants 5536 // focus/blur. This is because the former are synchronous in IE while the latter 5537 // are async. In other browsers, all those handlers are invoked synchronously. 5538 5539 // `handle` from private data would already wrap the event, but we need 5540 // to change the `type` here. 5541 var handle = dataPriv.get( this, "handle" ), 5542 event = jQuery.event.fix( nativeEvent ); 5543 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 5544 event.isSimulated = true; 5545 5546 // First, handle focusin/focusout 5547 handle( nativeEvent ); 5548 5549 // ...then, handle focus/blur 5550 // 5551 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 5552 // invoking the handler at the lower level. 5553 if ( event.target === event.currentTarget ) { 5554 5555 // The setup part calls `leverageNative`, which, in turn, calls 5556 // `jQuery.event.add`, so event handle will already have been set 5557 // by this point. 5558 handle( event ); 5559 } 5560 } else { 5561 5562 // For non-IE browsers, attach a single capturing handler on the document 5563 // while someone wants focusin/focusout. 5564 jQuery.event.simulate( delegateType, nativeEvent.target, 5565 jQuery.event.fix( nativeEvent ) ); 5566 } 5567 } 5568 5569 jQuery.event.special[ type ] = { 5570 5571 // Utilize native event if possible so blur/focus sequence is correct 5572 setup: function() { 5573 5574 var attaches; 5575 5576 // Claim the first handler 5577 // dataPriv.set( this, "focus", ... ) 5578 // dataPriv.set( this, "blur", ... ) 5579 leverageNative( this, type, true ); 5580 5581 if ( document.documentMode ) { 5582 5583 // Support: IE 9 - 11+ 5584 // We use the same native handler for focusin & focus (and focusout & blur) 5585 // so we need to coordinate setup & teardown parts between those events. 5586 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5587 attaches = dataPriv.get( this, delegateType ); 5588 if ( !attaches ) { 5589 this.addEventListener( delegateType, focusMappedHandler ); 5590 } 5591 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 5592 } else { 5593 5594 // Return false to allow normal processing in the caller 5595 return false; 5596 } 5597 }, 5598 trigger: function() { 5599 5600 // Force setup before trigger 5601 leverageNative( this, type ); 5602 5603 // Return non-false to allow normal event-path propagation 5604 return true; 5605 }, 5606 5607 teardown: function() { 5608 var attaches; 5609 5610 if ( document.documentMode ) { 5611 attaches = dataPriv.get( this, delegateType ) - 1; 5612 if ( !attaches ) { 5613 this.removeEventListener( delegateType, focusMappedHandler ); 5614 dataPriv.remove( this, delegateType ); 5615 } else { 5616 dataPriv.set( this, delegateType, attaches ); 5617 } 5618 } else { 5619 5620 // Return false to indicate standard teardown should be applied 5621 return false; 5622 } 5623 }, 5624 5625 // Suppress native focus or blur if we're currently inside 5626 // a leveraged native-event stack 5627 _default: function( event ) { 5628 return dataPriv.get( event.target, type ); 5629 }, 5630 5631 delegateType: delegateType 5632 }; 5633 5634 // Support: Firefox <=44 5635 // Firefox doesn't have focus(in | out) events 5636 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5637 // 5638 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 5639 // focus(in | out) events fire after focus & blur events, 5640 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5641 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 5642 // 5643 // Support: IE 9 - 11+ 5644 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 5645 // attach a single handler for both events in IE. 5646 jQuery.event.special[ delegateType ] = { 5647 setup: function() { 5648 5649 // Handle: regular nodes (via `this.ownerDocument`), window 5650 // (via `this.document`) & document (via `this`). 5651 var doc = this.ownerDocument || this.document || this, 5652 dataHolder = document.documentMode ? this : doc, 5653 attaches = dataPriv.get( dataHolder, delegateType ); 5654 5655 // Support: IE 9 - 11+ 5656 // We use the same native handler for focusin & focus (and focusout & blur) 5657 // so we need to coordinate setup & teardown parts between those events. 5658 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5659 if ( !attaches ) { 5660 if ( document.documentMode ) { 5661 this.addEventListener( delegateType, focusMappedHandler ); 5662 } else { 5663 doc.addEventListener( type, focusMappedHandler, true ); 5664 } 5665 } 5666 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 5667 }, 5668 teardown: function() { 5669 var doc = this.ownerDocument || this.document || this, 5670 dataHolder = document.documentMode ? this : doc, 5671 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 5672 5673 if ( !attaches ) { 5674 if ( document.documentMode ) { 5675 this.removeEventListener( delegateType, focusMappedHandler ); 5676 } else { 5677 doc.removeEventListener( type, focusMappedHandler, true ); 5678 } 5679 dataPriv.remove( dataHolder, delegateType ); 5680 } else { 5681 dataPriv.set( dataHolder, delegateType, attaches ); 5682 } 5683 } 5684 }; 5685} ); 5686 5687// Create mouseenter/leave events using mouseover/out and event-time checks 5688// so that event delegation works in jQuery. 5689// Do the same for pointerenter/pointerleave and pointerover/pointerout 5690// 5691// Support: Safari 7 only 5692// Safari sends mouseenter too often; see: 5693// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5694// for the description of the bug (it existed in older Chrome versions as well). 5695jQuery.each( { 5696 mouseenter: "mouseover", 5697 mouseleave: "mouseout", 5698 pointerenter: "pointerover", 5699 pointerleave: "pointerout" 5700}, function( orig, fix ) { 5701 jQuery.event.special[ orig ] = { 5702 delegateType: fix, 5703 bindType: fix, 5704 5705 handle: function( event ) { 5706 var ret, 5707 target = this, 5708 related = event.relatedTarget, 5709 handleObj = event.handleObj; 5710 5711 // For mouseenter/leave call the handler if related is outside the target. 5712 // NB: No relatedTarget if the mouse left/entered the browser window 5713 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5714 event.type = handleObj.origType; 5715 ret = handleObj.handler.apply( this, arguments ); 5716 event.type = fix; 5717 } 5718 return ret; 5719 } 5720 }; 5721} ); 5722 5723jQuery.fn.extend( { 5724 5725 on: function( types, selector, data, fn ) { 5726 return on( this, types, selector, data, fn ); 5727 }, 5728 one: function( types, selector, data, fn ) { 5729 return on( this, types, selector, data, fn, 1 ); 5730 }, 5731 off: function( types, selector, fn ) { 5732 var handleObj, type; 5733 if ( types && types.preventDefault && types.handleObj ) { 5734 5735 // ( event ) dispatched jQuery.Event 5736 handleObj = types.handleObj; 5737 jQuery( types.delegateTarget ).off( 5738 handleObj.namespace ? 5739 handleObj.origType + "." + handleObj.namespace : 5740 handleObj.origType, 5741 handleObj.selector, 5742 handleObj.handler 5743 ); 5744 return this; 5745 } 5746 if ( typeof types === "object" ) { 5747 5748 // ( types-object [, selector] ) 5749 for ( type in types ) { 5750 this.off( type, selector, types[ type ] ); 5751 } 5752 return this; 5753 } 5754 if ( selector === false || typeof selector === "function" ) { 5755 5756 // ( types [, fn] ) 5757 fn = selector; 5758 selector = undefined; 5759 } 5760 if ( fn === false ) { 5761 fn = returnFalse; 5762 } 5763 return this.each( function() { 5764 jQuery.event.remove( this, types, fn, selector ); 5765 } ); 5766 } 5767} ); 5768 5769 5770var 5771 5772 // Support: IE <=10 - 11, Edge 12 - 13 only 5773 // In IE/Edge using regex groups here causes severe slowdowns. 5774 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5775 rnoInnerhtml = /<script|<style|<link/i, 5776 5777 // checked="checked" or checked 5778 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5779 5780 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 5781 5782// Prefer a tbody over its parent table for containing new rows 5783function manipulationTarget( elem, content ) { 5784 if ( nodeName( elem, "table" ) && 5785 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5786 5787 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5788 } 5789 5790 return elem; 5791} 5792 5793// Replace/restore the type attribute of script elements for safe DOM manipulation 5794function disableScript( elem ) { 5795 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5796 return elem; 5797} 5798function restoreScript( elem ) { 5799 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5800 elem.type = elem.type.slice( 5 ); 5801 } else { 5802 elem.removeAttribute( "type" ); 5803 } 5804 5805 return elem; 5806} 5807 5808function cloneCopyEvent( src, dest ) { 5809 var i, l, type, pdataOld, udataOld, udataCur, events; 5810 5811 if ( dest.nodeType !== 1 ) { 5812 return; 5813 } 5814 5815 // 1. Copy private data: events, handlers, etc. 5816 if ( dataPriv.hasData( src ) ) { 5817 pdataOld = dataPriv.get( src ); 5818 events = pdataOld.events; 5819 5820 if ( events ) { 5821 dataPriv.remove( dest, "handle events" ); 5822 5823 for ( type in events ) { 5824 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5825 jQuery.event.add( dest, type, events[ type ][ i ] ); 5826 } 5827 } 5828 } 5829 } 5830 5831 // 2. Copy user data 5832 if ( dataUser.hasData( src ) ) { 5833 udataOld = dataUser.access( src ); 5834 udataCur = jQuery.extend( {}, udataOld ); 5835 5836 dataUser.set( dest, udataCur ); 5837 } 5838} 5839 5840// Fix IE bugs, see support tests 5841function fixInput( src, dest ) { 5842 var nodeName = dest.nodeName.toLowerCase(); 5843 5844 // Fails to persist the checked state of a cloned checkbox or radio button. 5845 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5846 dest.checked = src.checked; 5847 5848 // Fails to return the selected option to the default selected state when cloning options 5849 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5850 dest.defaultValue = src.defaultValue; 5851 } 5852} 5853 5854function domManip( collection, args, callback, ignored ) { 5855 5856 // Flatten any nested arrays 5857 args = flat( args ); 5858 5859 var fragment, first, scripts, hasScripts, node, doc, 5860 i = 0, 5861 l = collection.length, 5862 iNoClone = l - 1, 5863 value = args[ 0 ], 5864 valueIsFunction = isFunction( value ); 5865 5866 // We can't cloneNode fragments that contain checked, in WebKit 5867 if ( valueIsFunction || 5868 ( l > 1 && typeof value === "string" && 5869 !support.checkClone && rchecked.test( value ) ) ) { 5870 return collection.each( function( index ) { 5871 var self = collection.eq( index ); 5872 if ( valueIsFunction ) { 5873 args[ 0 ] = value.call( this, index, self.html() ); 5874 } 5875 domManip( self, args, callback, ignored ); 5876 } ); 5877 } 5878 5879 if ( l ) { 5880 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5881 first = fragment.firstChild; 5882 5883 if ( fragment.childNodes.length === 1 ) { 5884 fragment = first; 5885 } 5886 5887 // Require either new content or an interest in ignored elements to invoke the callback 5888 if ( first || ignored ) { 5889 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5890 hasScripts = scripts.length; 5891 5892 // Use the original fragment for the last item 5893 // instead of the first because it can end up 5894 // being emptied incorrectly in certain situations (trac-8070). 5895 for ( ; i < l; i++ ) { 5896 node = fragment; 5897 5898 if ( i !== iNoClone ) { 5899 node = jQuery.clone( node, true, true ); 5900 5901 // Keep references to cloned scripts for later restoration 5902 if ( hasScripts ) { 5903 5904 // Support: Android <=4.0 only, PhantomJS 1 only 5905 // push.apply(_, arraylike) throws on ancient WebKit 5906 jQuery.merge( scripts, getAll( node, "script" ) ); 5907 } 5908 } 5909 5910 callback.call( collection[ i ], node, i ); 5911 } 5912 5913 if ( hasScripts ) { 5914 doc = scripts[ scripts.length - 1 ].ownerDocument; 5915 5916 // Reenable scripts 5917 jQuery.map( scripts, restoreScript ); 5918 5919 // Evaluate executable scripts on first document insertion 5920 for ( i = 0; i < hasScripts; i++ ) { 5921 node = scripts[ i ]; 5922 if ( rscriptType.test( node.type || "" ) && 5923 !dataPriv.access( node, "globalEval" ) && 5924 jQuery.contains( doc, node ) ) { 5925 5926 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 5927 5928 // Optional AJAX dependency, but won't run scripts if not present 5929 if ( jQuery._evalUrl && !node.noModule ) { 5930 jQuery._evalUrl( node.src, { 5931 nonce: node.nonce || node.getAttribute( "nonce" ) 5932 }, doc ); 5933 } 5934 } else { 5935 5936 // Unwrap a CDATA section containing script contents. This shouldn't be 5937 // needed as in XML documents they're already not visible when 5938 // inspecting element contents and in HTML documents they have no 5939 // meaning but we're preserving that logic for backwards compatibility. 5940 // This will be removed completely in 4.0. See gh-4904. 5941 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 5942 } 5943 } 5944 } 5945 } 5946 } 5947 } 5948 5949 return collection; 5950} 5951 5952function remove( elem, selector, keepData ) { 5953 var node, 5954 nodes = selector ? jQuery.filter( selector, elem ) : elem, 5955 i = 0; 5956 5957 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 5958 if ( !keepData && node.nodeType === 1 ) { 5959 jQuery.cleanData( getAll( node ) ); 5960 } 5961 5962 if ( node.parentNode ) { 5963 if ( keepData && isAttached( node ) ) { 5964 setGlobalEval( getAll( node, "script" ) ); 5965 } 5966 node.parentNode.removeChild( node ); 5967 } 5968 } 5969 5970 return elem; 5971} 5972 5973jQuery.extend( { 5974 htmlPrefilter: function( html ) { 5975 return html; 5976 }, 5977 5978 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 5979 var i, l, srcElements, destElements, 5980 clone = elem.cloneNode( true ), 5981 inPage = isAttached( elem ); 5982 5983 // Fix IE cloning issues 5984 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 5985 !jQuery.isXMLDoc( elem ) ) { 5986 5987 // We eschew jQuery#find here for performance reasons: 5988 // https://jsperf.com/getall-vs-sizzle/2 5989 destElements = getAll( clone ); 5990 srcElements = getAll( elem ); 5991 5992 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5993 fixInput( srcElements[ i ], destElements[ i ] ); 5994 } 5995 } 5996 5997 // Copy the events from the original to the clone 5998 if ( dataAndEvents ) { 5999 if ( deepDataAndEvents ) { 6000 srcElements = srcElements || getAll( elem ); 6001 destElements = destElements || getAll( clone ); 6002 6003 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6004 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6005 } 6006 } else { 6007 cloneCopyEvent( elem, clone ); 6008 } 6009 } 6010 6011 // Preserve script evaluation history 6012 destElements = getAll( clone, "script" ); 6013 if ( destElements.length > 0 ) { 6014 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6015 } 6016 6017 // Return the cloned set 6018 return clone; 6019 }, 6020 6021 cleanData: function( elems ) { 6022 var data, elem, type, 6023 special = jQuery.event.special, 6024 i = 0; 6025 6026 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6027 if ( acceptData( elem ) ) { 6028 if ( ( data = elem[ dataPriv.expando ] ) ) { 6029 if ( data.events ) { 6030 for ( type in data.events ) { 6031 if ( special[ type ] ) { 6032 jQuery.event.remove( elem, type ); 6033 6034 // This is a shortcut to avoid jQuery.event.remove's overhead 6035 } else { 6036 jQuery.removeEvent( elem, type, data.handle ); 6037 } 6038 } 6039 } 6040
vendor: 1,119 bytes, lines 6041-6085
6041 // Support: Chrome <=35 - 45+ 6042 // Assign undefined instead of using delete, see Data#remove 6043 elem[ dataPriv.expando ] = undefined; 6044 } 6045 if ( elem[ dataUser.expando ] ) { 6046 6047 // Support: Chrome <=35 - 45+ 6048 // Assign undefined instead of using delete, see Data#remove 6049 elem[ dataUser.expando ] = undefined; 6050 } 6051 } 6052 } 6053 } 6054} ); 6055 6056jQuery.fn.extend( { 6057 detach: function( selector ) { 6058 return remove( this, selector, true ); 6059 }, 6060 6061 remove: function( selector ) { 6062 return remove( this, selector ); 6063 }, 6064 6065 text: function( value ) { 6066 return access( this, function( value ) { 6067 return value === undefined ? 6068 jQuery.text( this ) : 6069 this.empty().each( function() { 6070 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6071 this.textContent = value; 6072 } 6073 } ); 6074 }, null, value, arguments.length ); 6075 }, 6076 6077 append: function() { 6078 return domManip( this, arguments, function( elem ) { 6079 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6080 var target = manipulationTarget( this, elem ); 6081 target.appendChild( elem ); 6082 } 6083 } ); 6084 }, 6085
vendor: 21,524 bytes, lines 6086-6823
6086 prepend: function() { 6087 return domManip( this, arguments, function( elem ) { 6088 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6089 var target = manipulationTarget( this, elem ); 6090 target.insertBefore( elem, target.firstChild ); 6091 } 6092 } ); 6093 }, 6094 6095 before: function() { 6096 return domManip( this, arguments, function( elem ) { 6097 if ( this.parentNode ) { 6098 this.parentNode.insertBefore( elem, this ); 6099 } 6100 } ); 6101 }, 6102 6103 after: function() { 6104 return domManip( this, arguments, function( elem ) { 6105 if ( this.parentNode ) { 6106 this.parentNode.insertBefore( elem, this.nextSibling ); 6107 } 6108 } ); 6109 }, 6110 6111 empty: function() { 6112 var elem, 6113 i = 0; 6114 6115 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6116 if ( elem.nodeType === 1 ) { 6117 6118 // Prevent memory leaks 6119 jQuery.cleanData( getAll( elem, false ) ); 6120 6121 // Remove any remaining nodes 6122 elem.textContent = ""; 6123 } 6124 } 6125 6126 return this; 6127 }, 6128 6129 clone: function( dataAndEvents, deepDataAndEvents ) { 6130 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6131 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6132 6133 return this.map( function() { 6134 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6135 } ); 6136 }, 6137 6138 html: function( value ) { 6139 return access( this, function( value ) { 6140 var elem = this[ 0 ] || {}, 6141 i = 0, 6142 l = this.length; 6143 6144 if ( value === undefined && elem.nodeType === 1 ) { 6145 return elem.innerHTML; 6146 } 6147 6148 // See if we can take a shortcut and just use innerHTML 6149 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6150 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6151 6152 value = jQuery.htmlPrefilter( value ); 6153 6154 try { 6155 for ( ; i < l; i++ ) { 6156 elem = this[ i ] || {}; 6157 6158 // Remove element nodes and prevent memory leaks 6159 if ( elem.nodeType === 1 ) { 6160 jQuery.cleanData( getAll( elem, false ) ); 6161 elem.innerHTML = value; 6162 } 6163 } 6164 6165 elem = 0; 6166 6167 // If using innerHTML throws an exception, use the fallback method 6168 } catch ( e ) {} 6169 } 6170 6171 if ( elem ) { 6172 this.empty().append( value ); 6173 } 6174 }, null, value, arguments.length ); 6175 }, 6176 6177 replaceWith: function() { 6178 var ignored = []; 6179 6180 // Make the changes, replacing each non-ignored context element with the new content 6181 return domManip( this, arguments, function( elem ) { 6182 var parent = this.parentNode; 6183 6184 if ( jQuery.inArray( this, ignored ) < 0 ) { 6185 jQuery.cleanData( getAll( this ) ); 6186 if ( parent ) { 6187 parent.replaceChild( elem, this ); 6188 } 6189 } 6190 6191 // Force callback invocation 6192 }, ignored ); 6193 } 6194} ); 6195 6196jQuery.each( { 6197 appendTo: "append", 6198 prependTo: "prepend", 6199 insertBefore: "before", 6200 insertAfter: "after", 6201 replaceAll: "replaceWith" 6202}, function( name, original ) { 6203 jQuery.fn[ name ] = function( selector ) { 6204 var elems, 6205 ret = [], 6206 insert = jQuery( selector ), 6207 last = insert.length - 1, 6208 i = 0; 6209 6210 for ( ; i <= last; i++ ) { 6211 elems = i === last ? this : this.clone( true ); 6212 jQuery( insert[ i ] )[ original ]( elems ); 6213 6214 // Support: Android <=4.0 only, PhantomJS 1 only 6215 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6216 push.apply( ret, elems.get() ); 6217 } 6218 6219 return this.pushStack( ret ); 6220 }; 6221} ); 6222var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6223 6224var rcustomProp = /^--/; 6225 6226 6227var getStyles = function( elem ) { 6228 6229 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6230 // IE throws on elements created in popups 6231 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6232 var view = elem.ownerDocument.defaultView; 6233 6234 if ( !view || !view.opener ) { 6235 view = window; 6236 } 6237 6238 return view.getComputedStyle( elem ); 6239 }; 6240 6241var swap = function( elem, options, callback ) { 6242 var ret, name, 6243 old = {}; 6244 6245 // Remember the old values, and insert the new ones 6246 for ( name in options ) { 6247 old[ name ] = elem.style[ name ]; 6248 elem.style[ name ] = options[ name ]; 6249 } 6250 6251 ret = callback.call( elem ); 6252 6253 // Revert the old values 6254 for ( name in options ) { 6255 elem.style[ name ] = old[ name ]; 6256 } 6257 6258 return ret; 6259}; 6260 6261 6262var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6263 6264 6265 6266( function() { 6267 6268 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6269 // so they're executed at the same time to save the second computation. 6270 function computeStyleTests() { 6271 6272 // This is a singleton, we need to execute it only once 6273 if ( !div ) { 6274 return; 6275 } 6276 6277 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6278 "margin-top:1px;padding:0;border:0"; 6279 div.style.cssText = 6280 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6281 "margin:auto;border:1px;padding:1px;" + 6282 "width:60%;top:1%"; 6283 documentElement.appendChild( container ).appendChild( div ); 6284 6285 var divStyle = window.getComputedStyle( div ); 6286 pixelPositionVal = divStyle.top !== "1%"; 6287 6288 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6289 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6290 6291 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6292 // Some styles come back with percentage values, even though they shouldn't 6293 div.style.right = "60%"; 6294 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6295 6296 // Support: IE 9 - 11 only 6297 // Detect misreporting of content dimensions for box-sizing:border-box elements 6298 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6299 6300 // Support: IE 9 only 6301 // Detect overflow:scroll screwiness (gh-3699) 6302 // Support: Chrome <=64 6303 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6304 div.style.position = "absolute"; 6305 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6306 6307 documentElement.removeChild( container ); 6308 6309 // Nullify the div so it wouldn't be stored in the memory and 6310 // it will also be a sign that checks already performed 6311 div = null; 6312 } 6313 6314 function roundPixelMeasures( measure ) { 6315 return Math.round( parseFloat( measure ) ); 6316 } 6317 6318 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6319 reliableTrDimensionsVal, reliableMarginLeftVal, 6320 container = document.createElement( "div" ), 6321 div = document.createElement( "div" ); 6322 6323 // Finish early in limited (non-browser) environments 6324 if ( !div.style ) { 6325 return; 6326 } 6327 6328 // Support: IE <=9 - 11 only 6329 // Style of cloned element affects source element cloned (trac-8908) 6330 div.style.backgroundClip = "content-box"; 6331 div.cloneNode( true ).style.backgroundClip = ""; 6332 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6333 6334 jQuery.extend( support, { 6335 boxSizingReliable: function() { 6336 computeStyleTests(); 6337 return boxSizingReliableVal; 6338 }, 6339 pixelBoxStyles: function() { 6340 computeStyleTests(); 6341 return pixelBoxStylesVal; 6342 }, 6343 pixelPosition: function() { 6344 computeStyleTests(); 6345 return pixelPositionVal; 6346 }, 6347 reliableMarginLeft: function() { 6348 computeStyleTests(); 6349 return reliableMarginLeftVal; 6350 }, 6351 scrollboxSize: function() { 6352 computeStyleTests(); 6353 return scrollboxSizeVal; 6354 }, 6355 6356 // Support: IE 9 - 11+, Edge 15 - 18+ 6357 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6358 // set in CSS while `offset*` properties report correct values. 6359 // Behavior in IE 9 is more subtle than in newer versions & it passes 6360 // some versions of this test; make sure not to make it pass there! 6361 // 6362 // Support: Firefox 70+ 6363 // Only Firefox includes border widths 6364 // in computed dimensions. (gh-4529) 6365 reliableTrDimensions: function() { 6366 var table, tr, trChild, trStyle; 6367 if ( reliableTrDimensionsVal == null ) { 6368 table = document.createElement( "table" ); 6369 tr = document.createElement( "tr" ); 6370 trChild = document.createElement( "div" ); 6371 6372 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6373 tr.style.cssText = "border:1px solid"; 6374 6375 // Support: Chrome 86+ 6376 // Height set through cssText does not get applied. 6377 // Computed height then comes back as 0. 6378 tr.style.height = "1px"; 6379 trChild.style.height = "9px"; 6380 6381 // Support: Android 8 Chrome 86+ 6382 // In our bodyBackground.html iframe, 6383 // display for all div elements is set to "inline", 6384 // which causes a problem only in Android 8 Chrome 86. 6385 // Ensuring the div is display: block 6386 // gets around this issue. 6387 trChild.style.display = "block"; 6388 6389 documentElement 6390 .appendChild( table ) 6391 .appendChild( tr ) 6392 .appendChild( trChild ); 6393 6394 trStyle = window.getComputedStyle( tr ); 6395 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6396 parseInt( trStyle.borderTopWidth, 10 ) + 6397 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6398 6399 documentElement.removeChild( table ); 6400 } 6401 return reliableTrDimensionsVal; 6402 } 6403 } ); 6404} )(); 6405 6406 6407function curCSS( elem, name, computed ) { 6408 var width, minWidth, maxWidth, ret, 6409 isCustomProp = rcustomProp.test( name ), 6410 6411 // Support: Firefox 51+ 6412 // Retrieving style before computed somehow 6413 // fixes an issue with getting wrong values 6414 // on detached elements 6415 style = elem.style; 6416 6417 computed = computed || getStyles( elem ); 6418 6419 // getPropertyValue is needed for: 6420 // .css('filter') (IE 9 only, trac-12537) 6421 // .css('--customProperty) (gh-3144) 6422 if ( computed ) { 6423 6424 // Support: IE <=9 - 11+ 6425 // IE only supports `"float"` in `getPropertyValue`; in computed styles 6426 // it's only available as `"cssFloat"`. We no longer modify properties 6427 // sent to `.css()` apart from camelCasing, so we need to check both. 6428 // Normally, this would create difference in behavior: if 6429 // `getPropertyValue` returns an empty string, the value returned 6430 // by `.css()` would be `undefined`. This is usually the case for 6431 // disconnected elements. However, in IE even disconnected elements 6432 // with no styles return `"none"` for `getPropertyValue( "float" )` 6433 ret = computed.getPropertyValue( name ) || computed[ name ]; 6434 6435 if ( isCustomProp && ret ) { 6436 6437 // Support: Firefox 105+, Chrome <=105+ 6438 // Spec requires trimming whitespace for custom properties (gh-4926). 6439 // Firefox only trims leading whitespace. Chrome just collapses 6440 // both leading & trailing whitespace to a single space. 6441 // 6442 // Fall back to `undefined` if empty string returned. 6443 // This collapses a missing definition with property defined 6444 // and set to an empty string but there's no standard API 6445 // allowing us to differentiate them without a performance penalty 6446 // and returning `undefined` aligns with older jQuery. 6447 // 6448 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6449 // as whitespace while CSS does not, but this is not a problem 6450 // because CSS preprocessing replaces them with U+000A LINE FEED 6451 // (which *is* CSS whitespace) 6452 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6453 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 6454 } 6455 6456 if ( ret === "" && !isAttached( elem ) ) { 6457 ret = jQuery.style( elem, name ); 6458 } 6459 6460 // A tribute to the "awesome hack by Dean Edwards" 6461 // Android Browser returns percentage for some values, 6462 // but width seems to be reliably pixels. 6463 // This is against the CSSOM draft spec: 6464 // https://drafts.csswg.org/cssom/#resolved-values 6465 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6466 6467 // Remember the original values 6468 width = style.width; 6469 minWidth = style.minWidth; 6470 maxWidth = style.maxWidth; 6471 6472 // Put in the new values to get a computed value out 6473 style.minWidth = style.maxWidth = style.width = ret; 6474 ret = computed.width; 6475 6476 // Revert the changed values 6477 style.width = width; 6478 style.minWidth = minWidth; 6479 style.maxWidth = maxWidth; 6480 } 6481 } 6482 6483 return ret !== undefined ? 6484 6485 // Support: IE <=9 - 11 only 6486 // IE returns zIndex value as an integer. 6487 ret + "" : 6488 ret; 6489} 6490 6491 6492function addGetHookIf( conditionFn, hookFn ) { 6493 6494 // Define the hook, we'll check on the first run if it's really needed. 6495 return { 6496 get: function() { 6497 if ( conditionFn() ) { 6498 6499 // Hook not needed (or it's not possible to use it due 6500 // to missing dependency), remove it. 6501 delete this.get; 6502 return; 6503 } 6504 6505 // Hook needed; redefine it so that the support test is not executed again. 6506 return ( this.get = hookFn ).apply( this, arguments ); 6507 } 6508 }; 6509} 6510 6511 6512var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6513 emptyStyle = document.createElement( "div" ).style, 6514 vendorProps = {}; 6515 6516// Return a vendor-prefixed property or undefined 6517function vendorPropName( name ) { 6518 6519 // Check for vendor prefixed names 6520 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6521 i = cssPrefixes.length; 6522 6523 while ( i-- ) { 6524 name = cssPrefixes[ i ] + capName; 6525 if ( name in emptyStyle ) { 6526 return name; 6527 } 6528 } 6529} 6530 6531// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6532function finalPropName( name ) { 6533 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6534 6535 if ( final ) { 6536 return final; 6537 } 6538 if ( name in emptyStyle ) { 6539 return name; 6540 } 6541 return vendorProps[ name ] = vendorPropName( name ) || name; 6542} 6543 6544 6545var 6546 6547 // Swappable if display is none or starts with table 6548 // except "table", "table-cell", or "table-caption" 6549 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6550 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6551 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6552 cssNormalTransform = { 6553 letterSpacing: "0", 6554 fontWeight: "400" 6555 }; 6556 6557function setPositiveNumber( _elem, value, subtract ) { 6558 6559 // Any relative (+/-) values have already been 6560 // normalized at this point 6561 var matches = rcssNum.exec( value ); 6562 return matches ? 6563 6564 // Guard against undefined "subtract", e.g., when used as in cssHooks 6565 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6566 value; 6567} 6568 6569function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6570 var i = dimension === "width" ? 1 : 0, 6571 extra = 0, 6572 delta = 0, 6573 marginDelta = 0; 6574 6575 // Adjustment may not be necessary 6576 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6577 return 0; 6578 } 6579 6580 for ( ; i < 4; i += 2 ) { 6581 6582 // Both box models exclude margin 6583 // Count margin delta separately to only add it after scroll gutter adjustment. 6584 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 6585 if ( box === "margin" ) { 6586 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6587 } 6588 6589 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6590 if ( !isBorderBox ) { 6591 6592 // Add padding 6593 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6594 6595 // For "border" or "margin", add border 6596 if ( box !== "padding" ) { 6597 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6598 6599 // But still keep track of it otherwise 6600 } else { 6601 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6602 } 6603 6604 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6605 // "padding" or "margin" 6606 } else { 6607 6608 // For "content", subtract padding 6609 if ( box === "content" ) { 6610 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6611 } 6612 6613 // For "content" or "padding", subtract border 6614 if ( box !== "margin" ) { 6615 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6616 } 6617 } 6618 } 6619 6620 // Account for positive content-box scroll gutter when requested by providing computedVal 6621 if ( !isBorderBox && computedVal >= 0 ) { 6622 6623 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6624 // Assuming integer scroll gutter, subtract the rest and round down 6625 delta += Math.max( 0, Math.ceil( 6626 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6627 computedVal - 6628 delta - 6629 extra - 6630 0.5 6631 6632 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6633 // Use an explicit zero to avoid NaN (gh-3964) 6634 ) ) || 0; 6635 } 6636 6637 return delta + marginDelta; 6638} 6639 6640function getWidthOrHeight( elem, dimension, extra ) { 6641 6642 // Start with computed style 6643 var styles = getStyles( elem ), 6644 6645 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6646 // Fake content-box until we know it's needed to know the true value. 6647 boxSizingNeeded = !support.boxSizingReliable() || extra, 6648 isBorderBox = boxSizingNeeded && 6649 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6650 valueIsBorderBox = isBorderBox, 6651 6652 val = curCSS( elem, dimension, styles ), 6653 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6654 6655 // Support: Firefox <=54 6656 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6657 if ( rnumnonpx.test( val ) ) { 6658 if ( !extra ) { 6659 return val; 6660 } 6661 val = "auto"; 6662 } 6663 6664 6665 // Support: IE 9 - 11 only 6666 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6667 // In those cases, the computed value can be trusted to be border-box. 6668 if ( ( !support.boxSizingReliable() && isBorderBox || 6669 6670 // Support: IE 10 - 11+, Edge 15 - 18+ 6671 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6672 // set in CSS while `offset*` properties report correct values. 6673 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6674 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6675 6676 // Fall back to offsetWidth/offsetHeight when value is "auto" 6677 // This happens for inline elements with no explicit setting (gh-3571) 6678 val === "auto" || 6679 6680 // Support: Android <=4.1 - 4.3 only 6681 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6682 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6683 6684 // Make sure the element is visible & connected 6685 elem.getClientRects().length ) { 6686 6687 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6688 6689 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6690 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6691 // retrieved value as a content box dimension. 6692 valueIsBorderBox = offsetProp in elem; 6693 if ( valueIsBorderBox ) { 6694 val = elem[ offsetProp ]; 6695 } 6696 } 6697 6698 // Normalize "" and auto 6699 val = parseFloat( val ) || 0; 6700 6701 // Adjust for the element's box model 6702 return ( val + 6703 boxModelAdjustment( 6704 elem, 6705 dimension, 6706 extra || ( isBorderBox ? "border" : "content" ), 6707 valueIsBorderBox, 6708 styles, 6709 6710 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6711 val 6712 ) 6713 ) + "px"; 6714} 6715 6716jQuery.extend( { 6717 6718 // Add in style property hooks for overriding the default 6719 // behavior of getting and setting a style property 6720 cssHooks: { 6721 opacity: { 6722 get: function( elem, computed ) { 6723 if ( computed ) { 6724 6725 // We should always get a number back from opacity 6726 var ret = curCSS( elem, "opacity" ); 6727 return ret === "" ? "1" : ret; 6728 } 6729 } 6730 } 6731 }, 6732 6733 // Don't automatically add "px" to these possibly-unitless properties 6734 cssNumber: { 6735 animationIterationCount: true, 6736 aspectRatio: true, 6737 borderImageSlice: true, 6738 columnCount: true, 6739 flexGrow: true, 6740 flexShrink: true, 6741 fontWeight: true, 6742 gridArea: true, 6743 gridColumn: true, 6744 gridColumnEnd: true, 6745 gridColumnStart: true, 6746 gridRow: true, 6747 gridRowEnd: true, 6748 gridRowStart: true, 6749 lineHeight: true, 6750 opacity: true, 6751 order: true, 6752 orphans: true, 6753 scale: true, 6754 widows: true, 6755 zIndex: true, 6756 zoom: true, 6757 6758 // SVG-related 6759 fillOpacity: true, 6760 floodOpacity: true, 6761 stopOpacity: true, 6762 strokeMiterlimit: true, 6763 strokeOpacity: true 6764 }, 6765 6766 // Add in properties whose names you wish to fix before 6767 // setting or getting the value 6768 cssProps: {}, 6769 6770 // Get and set the style property on a DOM Node 6771 style: function( elem, name, value, extra ) { 6772 6773 // Don't set styles on text and comment nodes 6774 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6775 return; 6776 } 6777 6778 // Make sure that we're working with the right name 6779 var ret, type, hooks, 6780 origName = camelCase( name ), 6781 isCustomProp = rcustomProp.test( name ), 6782 style = elem.style; 6783 6784 // Make sure that we're working with the right name. We don't 6785 // want to query the value if it is a CSS custom property 6786 // since they are user-defined. 6787 if ( !isCustomProp ) { 6788 name = finalPropName( origName ); 6789 } 6790 6791 // Gets hook for the prefixed version, then unprefixed version 6792 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6793 6794 // Check if we're setting a value 6795 if ( value !== undefined ) { 6796 type = typeof value; 6797 6798 // Convert "+=" or "-=" to relative numbers (trac-7345) 6799 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6800 value = adjustCSS( elem, name, ret ); 6801 6802 // Fixes bug trac-9237 6803 type = "number"; 6804 } 6805 6806 // Make sure that null and NaN values aren't set (trac-7116) 6807 if ( value == null || value !== value ) { 6808 return; 6809 } 6810 6811 // If a number was passed in, add the unit (except for certain CSS properties) 6812 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6813 // "px" to a few hardcoded values. 6814 if ( type === "number" && !isCustomProp ) { 6815 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6816 } 6817 6818 // background-* props affect original clone's values 6819 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6820 style[ name ] = "inherit"; 6821 } 6822 6823 // If a hook was provided, use that value, otherwise just set the specified value
vendor: 16,052 bytes, lines 6824-7428
6824 if ( !hooks || !( "set" in hooks ) || 6825 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6826 6827 if ( isCustomProp ) { 6828 style.setProperty( name, value ); 6829 } else { 6830 style[ name ] = value; 6831 } 6832 } 6833 6834 } else { 6835 6836 // If a hook was provided get the non-computed value from there 6837 if ( hooks && "get" in hooks && 6838 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6839 6840 return ret; 6841 } 6842 6843 // Otherwise just get the value from the style object 6844 return style[ name ]; 6845 } 6846 }, 6847 6848 css: function( elem, name, extra, styles ) { 6849 var val, num, hooks, 6850 origName = camelCase( name ), 6851 isCustomProp = rcustomProp.test( name ); 6852 6853 // Make sure that we're working with the right name. We don't 6854 // want to modify the value if it is a CSS custom property 6855 // since they are user-defined. 6856 if ( !isCustomProp ) { 6857 name = finalPropName( origName ); 6858 } 6859 6860 // Try prefixed name followed by the unprefixed name 6861 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6862 6863 // If a hook was provided get the computed value from there 6864 if ( hooks && "get" in hooks ) { 6865 val = hooks.get( elem, true, extra ); 6866 } 6867 6868 // Otherwise, if a way to get the computed value exists, use that 6869 if ( val === undefined ) { 6870 val = curCSS( elem, name, styles ); 6871 } 6872 6873 // Convert "normal" to computed value 6874 if ( val === "normal" && name in cssNormalTransform ) { 6875 val = cssNormalTransform[ name ]; 6876 } 6877 6878 // Make numeric if forced or a qualifier was provided and val looks numeric 6879 if ( extra === "" || extra ) { 6880 num = parseFloat( val ); 6881 return extra === true || isFinite( num ) ? num || 0 : val; 6882 } 6883 6884 return val; 6885 } 6886} ); 6887 6888jQuery.each( [ "height", "width" ], function( _i, dimension ) { 6889 jQuery.cssHooks[ dimension ] = { 6890 get: function( elem, computed, extra ) { 6891 if ( computed ) { 6892 6893 // Certain elements can have dimension info if we invisibly show them 6894 // but it must have a current display style that would benefit 6895 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6896 6897 // Support: Safari 8+ 6898 // Table columns in Safari have non-zero offsetWidth & zero 6899 // getBoundingClientRect().width unless display is changed. 6900 // Support: IE <=11 only 6901 // Running getBoundingClientRect on a disconnected node 6902 // in IE throws an error. 6903 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 6904 swap( elem, cssShow, function() { 6905 return getWidthOrHeight( elem, dimension, extra ); 6906 } ) : 6907 getWidthOrHeight( elem, dimension, extra ); 6908 } 6909 }, 6910 6911 set: function( elem, value, extra ) { 6912 var matches, 6913 styles = getStyles( elem ), 6914 6915 // Only read styles.position if the test has a chance to fail 6916 // to avoid forcing a reflow. 6917 scrollboxSizeBuggy = !support.scrollboxSize() && 6918 styles.position === "absolute", 6919 6920 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 6921 boxSizingNeeded = scrollboxSizeBuggy || extra, 6922 isBorderBox = boxSizingNeeded && 6923 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6924 subtract = extra ? 6925 boxModelAdjustment( 6926 elem, 6927 dimension, 6928 extra, 6929 isBorderBox, 6930 styles 6931 ) : 6932 0; 6933 6934 // Account for unreliable border-box dimensions by comparing offset* to computed and 6935 // faking a content-box to get border and padding (gh-3699) 6936 if ( isBorderBox && scrollboxSizeBuggy ) { 6937 subtract -= Math.ceil( 6938 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6939 parseFloat( styles[ dimension ] ) - 6940 boxModelAdjustment( elem, dimension, "border", false, styles ) - 6941 0.5 6942 ); 6943 } 6944 6945 // Convert to pixels if value adjustment is needed 6946 if ( subtract && ( matches = rcssNum.exec( value ) ) && 6947 ( matches[ 3 ] || "px" ) !== "px" ) { 6948 6949 elem.style[ dimension ] = value; 6950 value = jQuery.css( elem, dimension ); 6951 } 6952 6953 return setPositiveNumber( elem, value, subtract ); 6954 } 6955 }; 6956} ); 6957 6958jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 6959 function( elem, computed ) { 6960 if ( computed ) { 6961 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 6962 elem.getBoundingClientRect().left - 6963 swap( elem, { marginLeft: 0 }, function() { 6964 return elem.getBoundingClientRect().left; 6965 } ) 6966 ) + "px"; 6967 } 6968 } 6969); 6970 6971// These hooks are used by animate to expand properties 6972jQuery.each( { 6973 margin: "", 6974 padding: "", 6975 border: "Width" 6976}, function( prefix, suffix ) { 6977 jQuery.cssHooks[ prefix + suffix ] = { 6978 expand: function( value ) { 6979 var i = 0, 6980 expanded = {}, 6981 6982 // Assumes a single number if not a string 6983 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 6984 6985 for ( ; i < 4; i++ ) { 6986 expanded[ prefix + cssExpand[ i ] + suffix ] = 6987 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6988 } 6989 6990 return expanded; 6991 } 6992 }; 6993 6994 if ( prefix !== "margin" ) { 6995 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 6996 } 6997} ); 6998 6999jQuery.fn.extend( { 7000 css: function( name, value ) { 7001 return access( this, function( elem, name, value ) { 7002 var styles, len, 7003 map = {}, 7004 i = 0; 7005 7006 if ( Array.isArray( name ) ) { 7007 styles = getStyles( elem ); 7008 len = name.length; 7009 7010 for ( ; i < len; i++ ) { 7011 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7012 } 7013 7014 return map; 7015 } 7016 7017 return value !== undefined ? 7018 jQuery.style( elem, name, value ) : 7019 jQuery.css( elem, name ); 7020 }, name, value, arguments.length > 1 ); 7021 } 7022} ); 7023 7024 7025function Tween( elem, options, prop, end, easing ) { 7026 return new Tween.prototype.init( elem, options, prop, end, easing ); 7027} 7028jQuery.Tween = Tween; 7029 7030Tween.prototype = { 7031 constructor: Tween, 7032 init: function( elem, options, prop, end, easing, unit ) { 7033 this.elem = elem; 7034 this.prop = prop; 7035 this.easing = easing || jQuery.easing._default; 7036 this.options = options; 7037 this.start = this.now = this.cur(); 7038 this.end = end; 7039 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7040 }, 7041 cur: function() { 7042 var hooks = Tween.propHooks[ this.prop ]; 7043 7044 return hooks && hooks.get ? 7045 hooks.get( this ) : 7046 Tween.propHooks._default.get( this ); 7047 }, 7048 run: function( percent ) { 7049 var eased, 7050 hooks = Tween.propHooks[ this.prop ]; 7051 7052 if ( this.options.duration ) { 7053 this.pos = eased = jQuery.easing[ this.easing ]( 7054 percent, this.options.duration * percent, 0, 1, this.options.duration 7055 ); 7056 } else { 7057 this.pos = eased = percent; 7058 } 7059 this.now = ( this.end - this.start ) * eased + this.start; 7060 7061 if ( this.options.step ) { 7062 this.options.step.call( this.elem, this.now, this ); 7063 } 7064 7065 if ( hooks && hooks.set ) { 7066 hooks.set( this ); 7067 } else { 7068 Tween.propHooks._default.set( this ); 7069 } 7070 return this; 7071 } 7072}; 7073 7074Tween.prototype.init.prototype = Tween.prototype; 7075 7076Tween.propHooks = { 7077 _default: { 7078 get: function( tween ) { 7079 var result; 7080 7081 // Use a property on the element directly when it is not a DOM element, 7082 // or when there is no matching style property that exists. 7083 if ( tween.elem.nodeType !== 1 || 7084 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7085 return tween.elem[ tween.prop ]; 7086 } 7087 7088 // Passing an empty string as a 3rd parameter to .css will automatically 7089 // attempt a parseFloat and fallback to a string if the parse fails. 7090 // Simple values such as "10px" are parsed to Float; 7091 // complex values such as "rotate(1rad)" are returned as-is. 7092 result = jQuery.css( tween.elem, tween.prop, "" ); 7093 7094 // Empty strings, null, undefined and "auto" are converted to 0. 7095 return !result || result === "auto" ? 0 : result; 7096 }, 7097 set: function( tween ) { 7098 7099 // Use step hook for back compat. 7100 // Use cssHook if its there. 7101 // Use .style if available and use plain properties where available. 7102 if ( jQuery.fx.step[ tween.prop ] ) { 7103 jQuery.fx.step[ tween.prop ]( tween ); 7104 } else if ( tween.elem.nodeType === 1 && ( 7105 jQuery.cssHooks[ tween.prop ] || 7106 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7107 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7108 } else { 7109 tween.elem[ tween.prop ] = tween.now; 7110 } 7111 } 7112 } 7113}; 7114 7115// Support: IE <=9 only 7116// Panic based approach to setting things on disconnected nodes 7117Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7118 set: function( tween ) { 7119 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7120 tween.elem[ tween.prop ] = tween.now; 7121 } 7122 } 7123}; 7124 7125jQuery.easing = { 7126 linear: function( p ) { 7127 return p; 7128 }, 7129 swing: function( p ) { 7130 return 0.5 - Math.cos( p * Math.PI ) / 2; 7131 }, 7132 _default: "swing" 7133}; 7134 7135jQuery.fx = Tween.prototype.init; 7136 7137// Back compat <1.8 extension point 7138jQuery.fx.step = {}; 7139 7140 7141 7142 7143var 7144 fxNow, inProgress, 7145 rfxtypes = /^(?:toggle|show|hide)$/, 7146 rrun = /queueHooks$/; 7147 7148function schedule() { 7149 if ( inProgress ) { 7150 if ( document.hidden === false && window.requestAnimationFrame ) { 7151 window.requestAnimationFrame( schedule ); 7152 } else { 7153 window.setTimeout( schedule, jQuery.fx.interval ); 7154 } 7155 7156 jQuery.fx.tick(); 7157 } 7158} 7159 7160// Animations created synchronously will run synchronously 7161function createFxNow() { 7162 window.setTimeout( function() { 7163 fxNow = undefined; 7164 } ); 7165 return ( fxNow = Date.now() ); 7166} 7167 7168// Generate parameters to create a standard animation 7169function genFx( type, includeWidth ) { 7170 var which, 7171 i = 0, 7172 attrs = { height: type }; 7173 7174 // If we include width, step value is 1 to do all cssExpand values, 7175 // otherwise step value is 2 to skip over Left and Right 7176 includeWidth = includeWidth ? 1 : 0; 7177 for ( ; i < 4; i += 2 - includeWidth ) { 7178 which = cssExpand[ i ]; 7179 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7180 } 7181 7182 if ( includeWidth ) { 7183 attrs.opacity = attrs.width = type; 7184 } 7185 7186 return attrs; 7187} 7188 7189function createTween( value, prop, animation ) { 7190 var tween, 7191 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7192 index = 0, 7193 length = collection.length; 7194 for ( ; index < length; index++ ) { 7195 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7196 7197 // We're done with this property 7198 return tween; 7199 } 7200 } 7201} 7202 7203function defaultPrefilter( elem, props, opts ) { 7204 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7205 isBox = "width" in props || "height" in props, 7206 anim = this, 7207 orig = {}, 7208 style = elem.style, 7209 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7210 dataShow = dataPriv.get( elem, "fxshow" ); 7211 7212 // Queue-skipping animations hijack the fx hooks 7213 if ( !opts.queue ) { 7214 hooks = jQuery._queueHooks( elem, "fx" ); 7215 if ( hooks.unqueued == null ) { 7216 hooks.unqueued = 0; 7217 oldfire = hooks.empty.fire; 7218 hooks.empty.fire = function() { 7219 if ( !hooks.unqueued ) { 7220 oldfire(); 7221 } 7222 }; 7223 } 7224 hooks.unqueued++; 7225 7226 anim.always( function() { 7227 7228 // Ensure the complete handler is called before this completes 7229 anim.always( function() { 7230 hooks.unqueued--; 7231 if ( !jQuery.queue( elem, "fx" ).length ) { 7232 hooks.empty.fire(); 7233 } 7234 } ); 7235 } ); 7236 } 7237 7238 // Detect show/hide animations 7239 for ( prop in props ) { 7240 value = props[ prop ]; 7241 if ( rfxtypes.test( value ) ) { 7242 delete props[ prop ]; 7243 toggle = toggle || value === "toggle"; 7244 if ( value === ( hidden ? "hide" : "show" ) ) { 7245 7246 // Pretend to be hidden if this is a "show" and 7247 // there is still data from a stopped show/hide 7248 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7249 hidden = true; 7250 7251 // Ignore all other no-op show/hide data 7252 } else { 7253 continue; 7254 } 7255 } 7256 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7257 } 7258 } 7259 7260 // Bail out if this is a no-op like .hide().hide() 7261 propTween = !jQuery.isEmptyObject( props ); 7262 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7263 return; 7264 } 7265 7266 // Restrict "overflow" and "display" styles during box animations 7267 if ( isBox && elem.nodeType === 1 ) { 7268 7269 // Support: IE <=9 - 11, Edge 12 - 15 7270 // Record all 3 overflow attributes because IE does not infer the shorthand 7271 // from identically-valued overflowX and overflowY and Edge just mirrors 7272 // the overflowX value there. 7273 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7274 7275 // Identify a display type, preferring old show/hide data over the CSS cascade 7276 restoreDisplay = dataShow && dataShow.display; 7277 if ( restoreDisplay == null ) { 7278 restoreDisplay = dataPriv.get( elem, "display" ); 7279 } 7280 display = jQuery.css( elem, "display" ); 7281 if ( display === "none" ) { 7282 if ( restoreDisplay ) { 7283 display = restoreDisplay; 7284 } else { 7285 7286 // Get nonempty value(s) by temporarily forcing visibility 7287 showHide( [ elem ], true ); 7288 restoreDisplay = elem.style.display || restoreDisplay; 7289 display = jQuery.css( elem, "display" ); 7290 showHide( [ elem ] ); 7291 } 7292 } 7293 7294 // Animate inline elements as inline-block 7295 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7296 if ( jQuery.css( elem, "float" ) === "none" ) { 7297 7298 // Restore the original display value at the end of pure show/hide animations 7299 if ( !propTween ) { 7300 anim.done( function() { 7301 style.display = restoreDisplay; 7302 } ); 7303 if ( restoreDisplay == null ) { 7304 display = style.display; 7305 restoreDisplay = display === "none" ? "" : display; 7306 } 7307 } 7308 style.display = "inline-block"; 7309 } 7310 } 7311 } 7312 7313 if ( opts.overflow ) { 7314 style.overflow = "hidden"; 7315 anim.always( function() { 7316 style.overflow = opts.overflow[ 0 ]; 7317 style.overflowX = opts.overflow[ 1 ]; 7318 style.overflowY = opts.overflow[ 2 ]; 7319 } ); 7320 } 7321 7322 // Implement show/hide animations 7323 propTween = false; 7324 for ( prop in orig ) { 7325 7326 // General show/hide setup for this element animation 7327 if ( !propTween ) { 7328 if ( dataShow ) { 7329 if ( "hidden" in dataShow ) { 7330 hidden = dataShow.hidden; 7331 } 7332 } else { 7333 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7334 } 7335 7336 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7337 if ( toggle ) { 7338 dataShow.hidden = !hidden; 7339 } 7340 7341 // Show elements before animating them 7342 if ( hidden ) { 7343 showHide( [ elem ], true ); 7344 } 7345 7346 /* eslint-disable no-loop-func */ 7347 7348 anim.done( function() { 7349 7350 /* eslint-enable no-loop-func */ 7351 7352 // The final step of a "hide" animation is actually hiding the element 7353 if ( !hidden ) { 7354 showHide( [ elem ] ); 7355 } 7356 dataPriv.remove( elem, "fxshow" ); 7357 for ( prop in orig ) { 7358 jQuery.style( elem, prop, orig[ prop ] ); 7359 } 7360 } ); 7361 } 7362 7363 // Per-property setup 7364 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7365 if ( !( prop in dataShow ) ) { 7366 dataShow[ prop ] = propTween.start; 7367 if ( hidden ) { 7368 propTween.end = propTween.start; 7369 propTween.start = 0; 7370 } 7371 } 7372 } 7373} 7374 7375function propFilter( props, specialEasing ) { 7376 var index, name, easing, value, hooks; 7377 7378 // camelCase, specialEasing and expand cssHook pass 7379 for ( index in props ) { 7380 name = camelCase( index ); 7381 easing = specialEasing[ name ]; 7382 value = props[ index ]; 7383 if ( Array.isArray( value ) ) { 7384 easing = value[ 1 ]; 7385 value = props[ index ] = value[ 0 ]; 7386 } 7387 7388 if ( index !== name ) { 7389 props[ name ] = value; 7390 delete props[ index ]; 7391 } 7392 7393 hooks = jQuery.cssHooks[ name ]; 7394 if ( hooks && "expand" in hooks ) { 7395 value = hooks.expand( value ); 7396 delete props[ name ]; 7397 7398 // Not quite $.extend, this won't overwrite existing keys. 7399 // Reusing 'index' because we have the correct "name" 7400 for ( index in value ) { 7401 if ( !( index in props ) ) { 7402 props[ index ] = value[ index ]; 7403 specialEasing[ index ] = easing; 7404 } 7405 } 7406 } else { 7407 specialEasing[ name ] = easing; 7408 } 7409 } 7410} 7411 7412function Animation( elem, properties, options ) { 7413 var result, 7414 stopped, 7415 index = 0, 7416 length = Animation.prefilters.length, 7417 deferred = jQuery.Deferred().always( function() { 7418 7419 // Don't match elem in the :animated selector 7420 delete tick.elem; 7421 } ), 7422 tick = function() { 7423 if ( stopped ) { 7424 return false; 7425 } 7426 var currentTime = fxNow || createFxNow(), 7427 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7428
vendor: 9,542 bytes, lines 7429-7819
7429 // Support: Android 2.3 only 7430 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7431 temp = remaining / animation.duration || 0, 7432 percent = 1 - temp, 7433 index = 0, 7434 length = animation.tweens.length; 7435 7436 for ( ; index < length; index++ ) { 7437 animation.tweens[ index ].run( percent ); 7438 } 7439 7440 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7441 7442 // If there's more to do, yield 7443 if ( percent < 1 && length ) { 7444 return remaining; 7445 } 7446 7447 // If this was an empty animation, synthesize a final progress notification 7448 if ( !length ) { 7449 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7450 } 7451 7452 // Resolve the animation and report its conclusion 7453 deferred.resolveWith( elem, [ animation ] ); 7454 return false; 7455 }, 7456 animation = deferred.promise( { 7457 elem: elem, 7458 props: jQuery.extend( {}, properties ), 7459 opts: jQuery.extend( true, { 7460 specialEasing: {}, 7461 easing: jQuery.easing._default 7462 }, options ), 7463 originalProperties: properties, 7464 originalOptions: options, 7465 startTime: fxNow || createFxNow(), 7466 duration: options.duration, 7467 tweens: [], 7468 createTween: function( prop, end ) { 7469 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7470 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7471 animation.tweens.push( tween ); 7472 return tween; 7473 }, 7474 stop: function( gotoEnd ) { 7475 var index = 0, 7476 7477 // If we are going to the end, we want to run all the tweens 7478 // otherwise we skip this part 7479 length = gotoEnd ? animation.tweens.length : 0; 7480 if ( stopped ) { 7481 return this; 7482 } 7483 stopped = true; 7484 for ( ; index < length; index++ ) { 7485 animation.tweens[ index ].run( 1 ); 7486 } 7487 7488 // Resolve when we played the last frame; otherwise, reject 7489 if ( gotoEnd ) { 7490 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7491 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7492 } else { 7493 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7494 } 7495 return this; 7496 } 7497 } ), 7498 props = animation.props; 7499 7500 propFilter( props, animation.opts.specialEasing ); 7501 7502 for ( ; index < length; index++ ) { 7503 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7504 if ( result ) { 7505 if ( isFunction( result.stop ) ) { 7506 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7507 result.stop.bind( result ); 7508 } 7509 return result; 7510 } 7511 } 7512 7513 jQuery.map( props, createTween, animation ); 7514 7515 if ( isFunction( animation.opts.start ) ) { 7516 animation.opts.start.call( elem, animation ); 7517 } 7518 7519 // Attach callbacks from options 7520 animation 7521 .progress( animation.opts.progress ) 7522 .done( animation.opts.done, animation.opts.complete ) 7523 .fail( animation.opts.fail ) 7524 .always( animation.opts.always ); 7525 7526 jQuery.fx.timer( 7527 jQuery.extend( tick, { 7528 elem: elem, 7529 anim: animation, 7530 queue: animation.opts.queue 7531 } ) 7532 ); 7533 7534 return animation; 7535} 7536 7537jQuery.Animation = jQuery.extend( Animation, { 7538 7539 tweeners: { 7540 "*": [ function( prop, value ) { 7541 var tween = this.createTween( prop, value ); 7542 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7543 return tween; 7544 } ] 7545 }, 7546 7547 tweener: function( props, callback ) { 7548 if ( isFunction( props ) ) { 7549 callback = props; 7550 props = [ "*" ]; 7551 } else { 7552 props = props.match( rnothtmlwhite ); 7553 } 7554 7555 var prop, 7556 index = 0, 7557 length = props.length; 7558 7559 for ( ; index < length; index++ ) { 7560 prop = props[ index ]; 7561 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7562 Animation.tweeners[ prop ].unshift( callback ); 7563 } 7564 }, 7565 7566 prefilters: [ defaultPrefilter ], 7567 7568 prefilter: function( callback, prepend ) { 7569 if ( prepend ) { 7570 Animation.prefilters.unshift( callback ); 7571 } else { 7572 Animation.prefilters.push( callback ); 7573 } 7574 } 7575} ); 7576 7577jQuery.speed = function( speed, easing, fn ) { 7578 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7579 complete: fn || !fn && easing || 7580 isFunction( speed ) && speed, 7581 duration: speed, 7582 easing: fn && easing || easing && !isFunction( easing ) && easing 7583 }; 7584 7585 // Go to the end state if fx are off 7586 if ( jQuery.fx.off ) { 7587 opt.duration = 0; 7588 7589 } else { 7590 if ( typeof opt.duration !== "number" ) { 7591 if ( opt.duration in jQuery.fx.speeds ) { 7592 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7593 7594 } else { 7595 opt.duration = jQuery.fx.speeds._default; 7596 } 7597 } 7598 } 7599 7600 // Normalize opt.queue - true/undefined/null -> "fx" 7601 if ( opt.queue == null || opt.queue === true ) { 7602 opt.queue = "fx"; 7603 } 7604 7605 // Queueing 7606 opt.old = opt.complete; 7607 7608 opt.complete = function() { 7609 if ( isFunction( opt.old ) ) { 7610 opt.old.call( this ); 7611 } 7612 7613 if ( opt.queue ) { 7614 jQuery.dequeue( this, opt.queue ); 7615 } 7616 }; 7617 7618 return opt; 7619}; 7620 7621jQuery.fn.extend( { 7622 fadeTo: function( speed, to, easing, callback ) { 7623 7624 // Show any hidden elements after setting opacity to 0 7625 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7626 7627 // Animate to the value specified 7628 .end().animate( { opacity: to }, speed, easing, callback ); 7629 }, 7630 animate: function( prop, speed, easing, callback ) { 7631 var empty = jQuery.isEmptyObject( prop ), 7632 optall = jQuery.speed( speed, easing, callback ), 7633 doAnimation = function() { 7634 7635 // Operate on a copy of prop so per-property easing won't be lost 7636 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7637 7638 // Empty animations, or finishing resolves immediately 7639 if ( empty || dataPriv.get( this, "finish" ) ) { 7640 anim.stop( true ); 7641 } 7642 }; 7643 7644 doAnimation.finish = doAnimation; 7645 7646 return empty || optall.queue === false ? 7647 this.each( doAnimation ) : 7648 this.queue( optall.queue, doAnimation ); 7649 }, 7650 stop: function( type, clearQueue, gotoEnd ) { 7651 var stopQueue = function( hooks ) { 7652 var stop = hooks.stop; 7653 delete hooks.stop; 7654 stop( gotoEnd ); 7655 }; 7656 7657 if ( typeof type !== "string" ) { 7658 gotoEnd = clearQueue; 7659 clearQueue = type; 7660 type = undefined; 7661 } 7662 if ( clearQueue ) { 7663 this.queue( type || "fx", [] ); 7664 } 7665 7666 return this.each( function() { 7667 var dequeue = true, 7668 index = type != null && type + "queueHooks", 7669 timers = jQuery.timers, 7670 data = dataPriv.get( this ); 7671 7672 if ( index ) { 7673 if ( data[ index ] && data[ index ].stop ) { 7674 stopQueue( data[ index ] ); 7675 } 7676 } else { 7677 for ( index in data ) { 7678 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7679 stopQueue( data[ index ] ); 7680 } 7681 } 7682 } 7683 7684 for ( index = timers.length; index--; ) { 7685 if ( timers[ index ].elem === this && 7686 ( type == null || timers[ index ].queue === type ) ) { 7687 7688 timers[ index ].anim.stop( gotoEnd ); 7689 dequeue = false; 7690 timers.splice( index, 1 ); 7691 } 7692 } 7693 7694 // Start the next in the queue if the last step wasn't forced. 7695 // Timers currently will call their complete callbacks, which 7696 // will dequeue but only if they were gotoEnd. 7697 if ( dequeue || !gotoEnd ) { 7698 jQuery.dequeue( this, type ); 7699 } 7700 } ); 7701 }, 7702 finish: function( type ) { 7703 if ( type !== false ) { 7704 type = type || "fx"; 7705 } 7706 return this.each( function() { 7707 var index, 7708 data = dataPriv.get( this ), 7709 queue = data[ type + "queue" ], 7710 hooks = data[ type + "queueHooks" ], 7711 timers = jQuery.timers, 7712 length = queue ? queue.length : 0; 7713 7714 // Enable finishing flag on private data 7715 data.finish = true; 7716 7717 // Empty the queue first 7718 jQuery.queue( this, type, [] ); 7719 7720 if ( hooks && hooks.stop ) { 7721 hooks.stop.call( this, true ); 7722 } 7723 7724 // Look for any active animations, and finish them 7725 for ( index = timers.length; index--; ) { 7726 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7727 timers[ index ].anim.stop( true ); 7728 timers.splice( index, 1 ); 7729 } 7730 } 7731 7732 // Look for any animations in the old queue and finish them 7733 for ( index = 0; index < length; index++ ) { 7734 if ( queue[ index ] && queue[ index ].finish ) { 7735 queue[ index ].finish.call( this ); 7736 } 7737 } 7738 7739 // Turn off finishing flag 7740 delete data.finish; 7741 } ); 7742 } 7743} ); 7744 7745jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7746 var cssFn = jQuery.fn[ name ]; 7747 jQuery.fn[ name ] = function( speed, easing, callback ) { 7748 return speed == null || typeof speed === "boolean" ? 7749 cssFn.apply( this, arguments ) : 7750 this.animate( genFx( name, true ), speed, easing, callback ); 7751 }; 7752} ); 7753 7754// Generate shortcuts for custom animations 7755jQuery.each( { 7756 slideDown: genFx( "show" ), 7757 slideUp: genFx( "hide" ), 7758 slideToggle: genFx( "toggle" ), 7759 fadeIn: { opacity: "show" }, 7760 fadeOut: { opacity: "hide" }, 7761 fadeToggle: { opacity: "toggle" } 7762}, function( name, props ) { 7763 jQuery.fn[ name ] = function( speed, easing, callback ) { 7764 return this.animate( props, speed, easing, callback ); 7765 }; 7766} ); 7767 7768jQuery.timers = []; 7769jQuery.fx.tick = function() { 7770 var timer, 7771 i = 0, 7772 timers = jQuery.timers; 7773 7774 fxNow = Date.now(); 7775 7776 for ( ; i < timers.length; i++ ) { 7777 timer = timers[ i ]; 7778 7779 // Run the timer and safely remove it when done (allowing for external removal) 7780 if ( !timer() && timers[ i ] === timer ) { 7781 timers.splice( i--, 1 ); 7782 } 7783 } 7784 7785 if ( !timers.length ) { 7786 jQuery.fx.stop(); 7787 } 7788 fxNow = undefined; 7789}; 7790 7791jQuery.fx.timer = function( timer ) { 7792 jQuery.timers.push( timer ); 7793 jQuery.fx.start(); 7794}; 7795 7796jQuery.fx.interval = 13; 7797jQuery.fx.start = function() { 7798 if ( inProgress ) { 7799 return; 7800 } 7801 7802 inProgress = true; 7803 schedule(); 7804}; 7805 7806jQuery.fx.stop = function() { 7807 inProgress = null; 7808}; 7809 7810jQuery.fx.speeds = { 7811 slow: 600, 7812 fast: 200, 7813 7814 // Default speed 7815 _default: 400 7816}; 7817 7818 7819// Based off of the plugin by Clint Helfers, with permission.
vendor: 5,177 bytes, lines 7820-8040
7820jQuery.fn.delay = function( time, type ) { 7821 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7822 type = type || "fx"; 7823 7824 return this.queue( type, function( next, hooks ) { 7825 var timeout = window.setTimeout( next, time ); 7826 hooks.stop = function() { 7827 window.clearTimeout( timeout ); 7828 }; 7829 } ); 7830}; 7831 7832 7833( function() { 7834 var input = document.createElement( "input" ), 7835 select = document.createElement( "select" ), 7836 opt = select.appendChild( document.createElement( "option" ) ); 7837 7838 input.type = "checkbox"; 7839 7840 // Support: Android <=4.3 only 7841 // Default value for a checkbox should be "on" 7842 support.checkOn = input.value !== ""; 7843 7844 // Support: IE <=11 only 7845 // Must access selectedIndex to make default options select 7846 support.optSelected = opt.selected; 7847 7848 // Support: IE <=11 only 7849 // An input loses its value after becoming a radio 7850 input = document.createElement( "input" ); 7851 input.value = "t"; 7852 input.type = "radio"; 7853 support.radioValue = input.value === "t"; 7854} )(); 7855 7856 7857var boolHook, 7858 attrHandle = jQuery.expr.attrHandle; 7859 7860jQuery.fn.extend( { 7861 attr: function( name, value ) { 7862 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7863 }, 7864 7865 removeAttr: function( name ) { 7866 return this.each( function() { 7867 jQuery.removeAttr( this, name ); 7868 } ); 7869 } 7870} ); 7871 7872jQuery.extend( { 7873 attr: function( elem, name, value ) { 7874 var ret, hooks, 7875 nType = elem.nodeType; 7876 7877 // Don't get/set attributes on text, comment and attribute nodes 7878 if ( nType === 3 || nType === 8 || nType === 2 ) { 7879 return; 7880 } 7881 7882 // Fallback to prop when attributes are not supported 7883 if ( typeof elem.getAttribute === "undefined" ) { 7884 return jQuery.prop( elem, name, value ); 7885 } 7886 7887 // Attribute hooks are determined by the lowercase version 7888 // Grab necessary hook if one is defined 7889 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7890 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7891 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7892 } 7893 7894 if ( value !== undefined ) { 7895 if ( value === null ) { 7896 jQuery.removeAttr( elem, name ); 7897 return; 7898 } 7899 7900 if ( hooks && "set" in hooks && 7901 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7902 return ret; 7903 } 7904 7905 elem.setAttribute( name, value + "" ); 7906 return value; 7907 } 7908 7909 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7910 return ret; 7911 } 7912 7913 ret = jQuery.find.attr( elem, name ); 7914 7915 // Non-existent attributes return null, we normalize to undefined 7916 return ret == null ? undefined : ret; 7917 }, 7918 7919 attrHooks: { 7920 type: { 7921 set: function( elem, value ) { 7922 if ( !support.radioValue && value === "radio" && 7923 nodeName( elem, "input" ) ) { 7924 var val = elem.value; 7925 elem.setAttribute( "type", value ); 7926 if ( val ) { 7927 elem.value = val; 7928 } 7929 return value; 7930 } 7931 } 7932 } 7933 }, 7934 7935 removeAttr: function( elem, value ) { 7936 var name, 7937 i = 0, 7938 7939 // Attribute names can contain non-HTML whitespace characters 7940 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 7941 attrNames = value && value.match( rnothtmlwhite ); 7942 7943 if ( attrNames && elem.nodeType === 1 ) { 7944 while ( ( name = attrNames[ i++ ] ) ) { 7945 elem.removeAttribute( name ); 7946 } 7947 } 7948 } 7949} ); 7950 7951// Hooks for boolean attributes 7952boolHook = { 7953 set: function( elem, value, name ) { 7954 if ( value === false ) { 7955 7956 // Remove boolean attributes when set to false 7957 jQuery.removeAttr( elem, name ); 7958 } else { 7959 elem.setAttribute( name, name ); 7960 } 7961 return name; 7962 } 7963}; 7964 7965jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 7966 var getter = attrHandle[ name ] || jQuery.find.attr; 7967 7968 attrHandle[ name ] = function( elem, name, isXML ) { 7969 var ret, handle, 7970 lowercaseName = name.toLowerCase(); 7971 7972 if ( !isXML ) { 7973 7974 // Avoid an infinite loop by temporarily removing this function from the getter 7975 handle = attrHandle[ lowercaseName ]; 7976 attrHandle[ lowercaseName ] = ret; 7977 ret = getter( elem, name, isXML ) != null ? 7978 lowercaseName : 7979 null; 7980 attrHandle[ lowercaseName ] = handle; 7981 } 7982 return ret; 7983 }; 7984} ); 7985 7986 7987 7988 7989var rfocusable = /^(?:input|select|textarea|button)$/i, 7990 rclickable = /^(?:a|area)$/i; 7991 7992jQuery.fn.extend( { 7993 prop: function( name, value ) { 7994 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 7995 }, 7996 7997 removeProp: function( name ) { 7998 return this.each( function() { 7999 delete this[ jQuery.propFix[ name ] || name ]; 8000 } ); 8001 } 8002} ); 8003 8004jQuery.extend( { 8005 prop: function( elem, name, value ) { 8006 var ret, hooks, 8007 nType = elem.nodeType; 8008 8009 // Don't get/set properties on text, comment and attribute nodes 8010 if ( nType === 3 || nType === 8 || nType === 2 ) { 8011 return; 8012 } 8013 8014 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8015 8016 // Fix name and attach hooks 8017 name = jQuery.propFix[ name ] || name; 8018 hooks = jQuery.propHooks[ name ]; 8019 } 8020 8021 if ( value !== undefined ) { 8022 if ( hooks && "set" in hooks && 8023 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8024 return ret; 8025 } 8026 8027 return ( elem[ name ] = value ); 8028 } 8029 8030 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8031 return ret; 8032 } 8033 8034 return elem[ name ]; 8035 }, 8036 8037 propHooks: { 8038 tabIndex: { 8039 get: function( elem ) { 8040
vendor: 6,126 bytes, lines 8041-8300
8041 // Support: IE <=9 - 11 only 8042 // elem.tabIndex doesn't always return the 8043 // correct value when it hasn't been explicitly set 8044 // Use proper attribute retrieval (trac-12072) 8045 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8046 8047 if ( tabindex ) { 8048 return parseInt( tabindex, 10 ); 8049 } 8050 8051 if ( 8052 rfocusable.test( elem.nodeName ) || 8053 rclickable.test( elem.nodeName ) && 8054 elem.href 8055 ) { 8056 return 0; 8057 } 8058 8059 return -1; 8060 } 8061 } 8062 }, 8063 8064 propFix: { 8065 "for": "htmlFor", 8066 "class": "className" 8067 } 8068} ); 8069 8070// Support: IE <=11 only 8071// Accessing the selectedIndex property 8072// forces the browser to respect setting selected 8073// on the option 8074// The getter ensures a default option is selected 8075// when in an optgroup 8076// eslint rule "no-unused-expressions" is disabled for this code 8077// since it considers such accessions noop 8078if ( !support.optSelected ) { 8079 jQuery.propHooks.selected = { 8080 get: function( elem ) { 8081 8082 /* eslint no-unused-expressions: "off" */ 8083 8084 var parent = elem.parentNode; 8085 if ( parent && parent.parentNode ) { 8086 parent.parentNode.selectedIndex; 8087 } 8088 return null; 8089 }, 8090 set: function( elem ) { 8091 8092 /* eslint no-unused-expressions: "off" */ 8093 8094 var parent = elem.parentNode; 8095 if ( parent ) { 8096 parent.selectedIndex; 8097 8098 if ( parent.parentNode ) { 8099 parent.parentNode.selectedIndex; 8100 } 8101 } 8102 } 8103 }; 8104} 8105 8106jQuery.each( [ 8107 "tabIndex", 8108 "readOnly", 8109 "maxLength", 8110 "cellSpacing", 8111 "cellPadding", 8112 "rowSpan", 8113 "colSpan", 8114 "useMap", 8115 "frameBorder", 8116 "contentEditable" 8117], function() { 8118 jQuery.propFix[ this.toLowerCase() ] = this; 8119} ); 8120 8121 8122 8123 8124 // Strip and collapse whitespace according to HTML spec 8125 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8126 function stripAndCollapse( value ) { 8127 var tokens = value.match( rnothtmlwhite ) || []; 8128 return tokens.join( " " ); 8129 } 8130 8131 8132function getClass( elem ) { 8133 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8134} 8135 8136function classesToArray( value ) { 8137 if ( Array.isArray( value ) ) { 8138 return value; 8139 } 8140 if ( typeof value === "string" ) { 8141 return value.match( rnothtmlwhite ) || []; 8142 } 8143 return []; 8144} 8145 8146jQuery.fn.extend( { 8147 addClass: function( value ) { 8148 var classNames, cur, curValue, className, i, finalValue; 8149 8150 if ( isFunction( value ) ) { 8151 return this.each( function( j ) { 8152 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8153 } ); 8154 } 8155 8156 classNames = classesToArray( value ); 8157 8158 if ( classNames.length ) { 8159 return this.each( function() { 8160 curValue = getClass( this ); 8161 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8162 8163 if ( cur ) { 8164 for ( i = 0; i < classNames.length; i++ ) { 8165 className = classNames[ i ]; 8166 if ( cur.indexOf( " " + className + " " ) < 0 ) { 8167 cur += className + " "; 8168 } 8169 } 8170 8171 // Only assign if different to avoid unneeded rendering. 8172 finalValue = stripAndCollapse( cur ); 8173 if ( curValue !== finalValue ) { 8174 this.setAttribute( "class", finalValue ); 8175 } 8176 } 8177 } ); 8178 } 8179 8180 return this; 8181 }, 8182 8183 removeClass: function( value ) { 8184 var classNames, cur, curValue, className, i, finalValue; 8185 8186 if ( isFunction( value ) ) { 8187 return this.each( function( j ) { 8188 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8189 } ); 8190 } 8191 8192 if ( !arguments.length ) { 8193 return this.attr( "class", "" ); 8194 } 8195 8196 classNames = classesToArray( value ); 8197 8198 if ( classNames.length ) { 8199 return this.each( function() { 8200 curValue = getClass( this ); 8201 8202 // This expression is here for better compressibility (see addClass) 8203 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8204 8205 if ( cur ) { 8206 for ( i = 0; i < classNames.length; i++ ) { 8207 className = classNames[ i ]; 8208 8209 // Remove *all* instances 8210 while ( cur.indexOf( " " + className + " " ) > -1 ) { 8211 cur = cur.replace( " " + className + " ", " " ); 8212 } 8213 } 8214 8215 // Only assign if different to avoid unneeded rendering. 8216 finalValue = stripAndCollapse( cur ); 8217 if ( curValue !== finalValue ) { 8218 this.setAttribute( "class", finalValue ); 8219 } 8220 } 8221 } ); 8222 } 8223 8224 return this; 8225 }, 8226 8227 toggleClass: function( value, stateVal ) { 8228 var classNames, className, i, self, 8229 type = typeof value, 8230 isValidValue = type === "string" || Array.isArray( value ); 8231 8232 if ( isFunction( value ) ) { 8233 return this.each( function( i ) { 8234 jQuery( this ).toggleClass( 8235 value.call( this, i, getClass( this ), stateVal ), 8236 stateVal 8237 ); 8238 } ); 8239 } 8240 8241 if ( typeof stateVal === "boolean" && isValidValue ) { 8242 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8243 } 8244 8245 classNames = classesToArray( value ); 8246 8247 return this.each( function() { 8248 if ( isValidValue ) { 8249 8250 // Toggle individual class names 8251 self = jQuery( this ); 8252 8253 for ( i = 0; i < classNames.length; i++ ) { 8254 className = classNames[ i ]; 8255 8256 // Check each className given, space separated list 8257 if ( self.hasClass( className ) ) { 8258 self.removeClass( className ); 8259 } else { 8260 self.addClass( className ); 8261 } 8262 } 8263 8264 // Toggle whole class name 8265 } else if ( value === undefined || type === "boolean" ) { 8266 className = getClass( this ); 8267 if ( className ) { 8268 8269 // Store className if set 8270 dataPriv.set( this, "__className__", className ); 8271 } 8272 8273 // If the element has a class name or if we're passed `false`, 8274 // then remove the whole classname (if there was one, the above saved it). 8275 // Otherwise bring back whatever was previously saved (if anything), 8276 // falling back to the empty string if nothing was stored. 8277 if ( this.setAttribute ) { 8278 this.setAttribute( "class", 8279 className || value === false ? 8280 "" : 8281 dataPriv.get( this, "__className__" ) || "" 8282 ); 8283 } 8284 } 8285 } ); 8286 }, 8287 8288 hasClass: function( selector ) { 8289 var className, elem, 8290 i = 0; 8291 8292 className = " " + selector + " "; 8293 while ( ( elem = this[ i++ ] ) ) { 8294 if ( elem.nodeType === 1 && 8295 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8296 return true; 8297 } 8298 } 8299 8300 return false;
vendor: 1,385 bytes, lines 8301-8370
8301 } 8302} ); 8303 8304 8305 8306 8307var rreturn = /\r/g; 8308 8309jQuery.fn.extend( { 8310 val: function( value ) { 8311 var hooks, ret, valueIsFunction, 8312 elem = this[ 0 ]; 8313 8314 if ( !arguments.length ) { 8315 if ( elem ) { 8316 hooks = jQuery.valHooks[ elem.type ] || 8317 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8318 8319 if ( hooks && 8320 "get" in hooks && 8321 ( ret = hooks.get( elem, "value" ) ) !== undefined 8322 ) { 8323 return ret; 8324 } 8325 8326 ret = elem.value; 8327 8328 // Handle most common string cases 8329 if ( typeof ret === "string" ) { 8330 return ret.replace( rreturn, "" ); 8331 } 8332 8333 // Handle cases where value is null/undef or number 8334 return ret == null ? "" : ret; 8335 } 8336 8337 return; 8338 } 8339 8340 valueIsFunction = isFunction( value ); 8341 8342 return this.each( function( i ) { 8343 var val; 8344 8345 if ( this.nodeType !== 1 ) { 8346 return; 8347 } 8348 8349 if ( valueIsFunction ) { 8350 val = value.call( this, i, jQuery( this ).val() ); 8351 } else { 8352 val = value; 8353 } 8354 8355 // Treat null/undefined as ""; convert numbers to string 8356 if ( val == null ) { 8357 val = ""; 8358 8359 } else if ( typeof val === "number" ) { 8360 val += ""; 8361 8362 } else if ( Array.isArray( val ) ) { 8363 val = jQuery.map( val, function( value ) { 8364 return value == null ? "" : value + ""; 8365 } ); 8366 } 8367 8368 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8369 8370 // If set returns undefined, fall back to normal setting
vendor: 4,458 bytes, lines 8371-8556
8371 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8372 this.value = val; 8373 } 8374 } ); 8375 } 8376} ); 8377 8378jQuery.extend( { 8379 valHooks: { 8380 option: { 8381 get: function( elem ) { 8382 8383 var val = jQuery.find.attr( elem, "value" ); 8384 return val != null ? 8385 val : 8386 8387 // Support: IE <=10 - 11 only 8388 // option.text throws exceptions (trac-14686, trac-14858) 8389 // Strip and collapse whitespace 8390 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8391 stripAndCollapse( jQuery.text( elem ) ); 8392 } 8393 }, 8394 select: { 8395 get: function( elem ) { 8396 var value, option, i, 8397 options = elem.options, 8398 index = elem.selectedIndex, 8399 one = elem.type === "select-one", 8400 values = one ? null : [], 8401 max = one ? index + 1 : options.length; 8402 8403 if ( index < 0 ) { 8404 i = max; 8405 8406 } else { 8407 i = one ? index : 0; 8408 } 8409 8410 // Loop through all the selected options 8411 for ( ; i < max; i++ ) { 8412 option = options[ i ]; 8413 8414 // Support: IE <=9 only 8415 // IE8-9 doesn't update selected after form reset (trac-2551) 8416 if ( ( option.selected || i === index ) && 8417 8418 // Don't return options that are disabled or in a disabled optgroup 8419 !option.disabled && 8420 ( !option.parentNode.disabled || 8421 !nodeName( option.parentNode, "optgroup" ) ) ) { 8422 8423 // Get the specific value for the option 8424 value = jQuery( option ).val(); 8425 8426 // We don't need an array for one selects 8427 if ( one ) { 8428 return value; 8429 } 8430 8431 // Multi-Selects return an array 8432 values.push( value ); 8433 } 8434 } 8435 8436 return values; 8437 }, 8438 8439 set: function( elem, value ) { 8440 var optionSet, option, 8441 options = elem.options, 8442 values = jQuery.makeArray( value ), 8443 i = options.length; 8444 8445 while ( i-- ) { 8446 option = options[ i ]; 8447 8448 /* eslint-disable no-cond-assign */ 8449 8450 if ( option.selected = 8451 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8452 ) { 8453 optionSet = true; 8454 } 8455 8456 /* eslint-enable no-cond-assign */ 8457 } 8458 8459 // Force browsers to behave consistently when non-matching value is set 8460 if ( !optionSet ) { 8461 elem.selectedIndex = -1; 8462 } 8463 return values; 8464 } 8465 } 8466 } 8467} ); 8468 8469// Radios and checkboxes getter/setter 8470jQuery.each( [ "radio", "checkbox" ], function() { 8471 jQuery.valHooks[ this ] = { 8472 set: function( elem, value ) { 8473 if ( Array.isArray( value ) ) { 8474 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8475 } 8476 } 8477 }; 8478 if ( !support.checkOn ) { 8479 jQuery.valHooks[ this ].get = function( elem ) { 8480 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8481 }; 8482 } 8483} ); 8484 8485 8486 8487 8488// Return jQuery for attributes-only inclusion 8489var location = window.location; 8490 8491var nonce = { guid: Date.now() }; 8492 8493var rquery = ( /\?/ ); 8494 8495 8496 8497// Cross-browser xml parsing 8498jQuery.parseXML = function( data ) { 8499 var xml, parserErrorElem; 8500 if ( !data || typeof data !== "string" ) { 8501 return null; 8502 } 8503 8504 // Support: IE 9 - 11 only 8505 // IE throws on parseFromString with invalid input. 8506 try { 8507 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8508 } catch ( e ) {} 8509 8510 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8511 if ( !xml || parserErrorElem ) { 8512 jQuery.error( "Invalid XML: " + ( 8513 parserErrorElem ? 8514 jQuery.map( parserErrorElem.childNodes, function( el ) { 8515 return el.textContent; 8516 } ).join( "\n" ) : 8517 data 8518 ) ); 8519 } 8520 return xml; 8521}; 8522 8523 8524var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8525 stopPropagationCallback = function( e ) { 8526 e.stopPropagation(); 8527 }; 8528 8529jQuery.extend( jQuery.event, { 8530 8531 trigger: function( event, data, elem, onlyHandlers ) { 8532 8533 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8534 eventPath = [ elem || document ], 8535 type = hasOwn.call( event, "type" ) ? event.type : event, 8536 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8537 8538 cur = lastElement = tmp = elem = elem || document; 8539 8540 // Don't do events on text and comment nodes 8541 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8542 return; 8543 } 8544 8545 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8546 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8547 return; 8548 } 8549 8550 if ( type.indexOf( "." ) > -1 ) { 8551 8552 // Namespaced trigger; create a regexp to match event type in handle() 8553 namespaces = type.split( "." ); 8554 type = namespaces.shift(); 8555 namespaces.sort(); 8556 }
vendor: 6,524 bytes, lines 8557-8806
8557 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8558 8559 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8560 event = event[ jQuery.expando ] ? 8561 event : 8562 new jQuery.Event( type, typeof event === "object" && event ); 8563 8564 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8565 event.isTrigger = onlyHandlers ? 2 : 3; 8566 event.namespace = namespaces.join( "." ); 8567 event.rnamespace = event.namespace ? 8568 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8569 null; 8570 8571 // Clean up the event in case it is being reused 8572 event.result = undefined; 8573 if ( !event.target ) { 8574 event.target = elem; 8575 } 8576 8577 // Clone any incoming data and prepend the event, creating the handler arg list 8578 data = data == null ? 8579 [ event ] : 8580 jQuery.makeArray( data, [ event ] ); 8581 8582 // Allow special events to draw outside the lines 8583 special = jQuery.event.special[ type ] || {}; 8584 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8585 return; 8586 } 8587 8588 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8589 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8590 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8591 8592 bubbleType = special.delegateType || type; 8593 if ( !rfocusMorph.test( bubbleType + type ) ) { 8594 cur = cur.parentNode; 8595 } 8596 for ( ; cur; cur = cur.parentNode ) { 8597 eventPath.push( cur ); 8598 tmp = cur; 8599 } 8600 8601 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8602 if ( tmp === ( elem.ownerDocument || document ) ) { 8603 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8604 } 8605 } 8606 8607 // Fire handlers on the event path 8608 i = 0; 8609 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8610 lastElement = cur; 8611 event.type = i > 1 ? 8612 bubbleType : 8613 special.bindType || type; 8614 8615 // jQuery handler 8616 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8617 dataPriv.get( cur, "handle" ); 8618 if ( handle ) { 8619 handle.apply( cur, data ); 8620 } 8621 8622 // Native handler 8623 handle = ontype && cur[ ontype ]; 8624 if ( handle && handle.apply && acceptData( cur ) ) { 8625 event.result = handle.apply( cur, data ); 8626 if ( event.result === false ) { 8627 event.preventDefault(); 8628 } 8629 } 8630 } 8631 event.type = type; 8632 8633 // If nobody prevented the default action, do it now 8634 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8635 8636 if ( ( !special._default || 8637 special._default.apply( eventPath.pop(), data ) === false ) && 8638 acceptData( elem ) ) { 8639 8640 // Call a native DOM method on the target with the same name as the event. 8641 // Don't do default actions on window, that's where global variables be (trac-6170) 8642 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8643 8644 // Don't re-trigger an onFOO event when we call its FOO() method 8645 tmp = elem[ ontype ]; 8646 8647 if ( tmp ) { 8648 elem[ ontype ] = null; 8649 } 8650 8651 // Prevent re-triggering of the same event, since we already bubbled it above 8652 jQuery.event.triggered = type; 8653 8654 if ( event.isPropagationStopped() ) { 8655 lastElement.addEventListener( type, stopPropagationCallback ); 8656 } 8657 8658 elem[ type ](); 8659 8660 if ( event.isPropagationStopped() ) { 8661 lastElement.removeEventListener( type, stopPropagationCallback ); 8662 } 8663 8664 jQuery.event.triggered = undefined; 8665 8666 if ( tmp ) { 8667 elem[ ontype ] = tmp; 8668 } 8669 } 8670 } 8671 } 8672 8673 return event.result; 8674 }, 8675 8676 // Piggyback on a donor event to simulate a different one 8677 // Used only for `focus(in | out)` events 8678 simulate: function( type, elem, event ) { 8679 var e = jQuery.extend( 8680 new jQuery.Event(), 8681 event, 8682 { 8683 type: type, 8684 isSimulated: true 8685 } 8686 ); 8687 8688 jQuery.event.trigger( e, null, elem ); 8689 } 8690 8691} ); 8692 8693jQuery.fn.extend( { 8694 8695 trigger: function( type, data ) { 8696 return this.each( function() { 8697 jQuery.event.trigger( type, data, this ); 8698 } ); 8699 }, 8700 triggerHandler: function( type, data ) { 8701 var elem = this[ 0 ]; 8702 if ( elem ) { 8703 return jQuery.event.trigger( type, data, elem, true ); 8704 } 8705 } 8706} ); 8707 8708 8709var 8710 rbracket = /\[\]$/, 8711 rCRLF = /\r?\n/g, 8712 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8713 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8714 8715function buildParams( prefix, obj, traditional, add ) { 8716 var name; 8717 8718 if ( Array.isArray( obj ) ) { 8719 8720 // Serialize array item. 8721 jQuery.each( obj, function( i, v ) { 8722 if ( traditional || rbracket.test( prefix ) ) { 8723 8724 // Treat each array item as a scalar. 8725 add( prefix, v ); 8726 8727 } else { 8728 8729 // Item is non-scalar (array or object), encode its numeric index. 8730 buildParams( 8731 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8732 v, 8733 traditional, 8734 add 8735 ); 8736 } 8737 } ); 8738 8739 } else if ( !traditional && toType( obj ) === "object" ) { 8740 8741 // Serialize object item. 8742 for ( name in obj ) { 8743 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8744 } 8745 8746 } else { 8747 8748 // Serialize scalar item. 8749 add( prefix, obj ); 8750 } 8751} 8752 8753// Serialize an array of form elements or a set of 8754// key/values into a query string 8755jQuery.param = function( a, traditional ) { 8756 var prefix, 8757 s = [], 8758 add = function( key, valueOrFunction ) { 8759 8760 // If value is a function, invoke it and use its return value 8761 var value = isFunction( valueOrFunction ) ? 8762 valueOrFunction() : 8763 valueOrFunction; 8764 8765 s[ s.length ] = encodeURIComponent( key ) + "=" + 8766 encodeURIComponent( value == null ? "" : value ); 8767 }; 8768 8769 if ( a == null ) { 8770 return ""; 8771 } 8772 8773 // If an array was passed in, assume that it is an array of form elements. 8774 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8775 8776 // Serialize the form elements 8777 jQuery.each( a, function() { 8778 add( this.name, this.value ); 8779 } ); 8780 8781 } else { 8782 8783 // If traditional, encode the "old" way (the way 1.3.2 or older 8784 // did it), otherwise encode params recursively. 8785 for ( prefix in a ) { 8786 buildParams( prefix, a[ prefix ], traditional, add ); 8787 } 8788 } 8789 8790 // Return the resulting serialization 8791 return s.join( "&" ); 8792}; 8793 8794jQuery.fn.extend( { 8795 serialize: function() { 8796 return jQuery.param( this.serializeArray() ); 8797 }, 8798 serializeArray: function() { 8799 return this.map( function() { 8800 8801 // Can add propHook for "elements" to filter or add form elements 8802 var elements = jQuery.prop( this, "elements" ); 8803 return elements ? jQuery.makeArray( elements ) : this; 8804 } ).filter( function() { 8805 var type = this.type; 8806
vendor: 32,437 bytes, lines 8807-10060
8807 // Use .is( ":disabled" ) so that fieldset[disabled] works 8808 return this.name && !jQuery( this ).is( ":disabled" ) && 8809 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8810 ( this.checked || !rcheckableType.test( type ) ); 8811 } ).map( function( _i, elem ) { 8812 var val = jQuery( this ).val(); 8813 8814 if ( val == null ) { 8815 return null; 8816 } 8817 8818 if ( Array.isArray( val ) ) { 8819 return jQuery.map( val, function( val ) { 8820 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8821 } ); 8822 } 8823 8824 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8825 } ).get(); 8826 } 8827} ); 8828 8829 8830var 8831 r20 = /%20/g, 8832 rhash = /#.*$/, 8833 rantiCache = /([?&])_=[^&]*/, 8834 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8835 8836 // trac-7653, trac-8125, trac-8152: local protocol detection 8837 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8838 rnoContent = /^(?:GET|HEAD)$/, 8839 rprotocol = /^\/\//, 8840 8841 /* Prefilters 8842 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8843 * 2) These are called: 8844 * - BEFORE asking for a transport 8845 * - AFTER param serialization (s.data is a string if s.processData is true) 8846 * 3) key is the dataType 8847 * 4) the catchall symbol "*" can be used 8848 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8849 */ 8850 prefilters = {}, 8851 8852 /* Transports bindings 8853 * 1) key is the dataType 8854 * 2) the catchall symbol "*" can be used 8855 * 3) selection will start with transport dataType and THEN go to "*" if needed 8856 */ 8857 transports = {}, 8858 8859 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 8860 allTypes = "*/".concat( "*" ), 8861 8862 // Anchor tag for parsing the document origin 8863 originAnchor = document.createElement( "a" ); 8864 8865originAnchor.href = location.href; 8866 8867// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8868function addToPrefiltersOrTransports( structure ) { 8869 8870 // dataTypeExpression is optional and defaults to "*" 8871 return function( dataTypeExpression, func ) { 8872 8873 if ( typeof dataTypeExpression !== "string" ) { 8874 func = dataTypeExpression; 8875 dataTypeExpression = "*"; 8876 } 8877 8878 var dataType, 8879 i = 0, 8880 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8881 8882 if ( isFunction( func ) ) { 8883 8884 // For each dataType in the dataTypeExpression 8885 while ( ( dataType = dataTypes[ i++ ] ) ) { 8886 8887 // Prepend if requested 8888 if ( dataType[ 0 ] === "+" ) { 8889 dataType = dataType.slice( 1 ) || "*"; 8890 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8891 8892 // Otherwise append 8893 } else { 8894 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8895 } 8896 } 8897 } 8898 }; 8899} 8900 8901// Base inspection function for prefilters and transports 8902function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8903 8904 var inspected = {}, 8905 seekingTransport = ( structure === transports ); 8906 8907 function inspect( dataType ) { 8908 var selected; 8909 inspected[ dataType ] = true; 8910 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8911 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8912 if ( typeof dataTypeOrTransport === "string" && 8913 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8914 8915 options.dataTypes.unshift( dataTypeOrTransport ); 8916 inspect( dataTypeOrTransport ); 8917 return false; 8918 } else if ( seekingTransport ) { 8919 return !( selected = dataTypeOrTransport ); 8920 } 8921 } ); 8922 return selected; 8923 } 8924 8925 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8926} 8927 8928// A special extend for ajax options 8929// that takes "flat" options (not to be deep extended) 8930// Fixes trac-9887 8931function ajaxExtend( target, src ) { 8932 var key, deep, 8933 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8934 8935 for ( key in src ) { 8936 if ( src[ key ] !== undefined ) { 8937 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8938 } 8939 } 8940 if ( deep ) { 8941 jQuery.extend( true, target, deep ); 8942 } 8943 8944 return target; 8945} 8946 8947/* Handles responses to an ajax request: 8948 * - finds the right dataType (mediates between content-type and expected dataType) 8949 * - returns the corresponding response 8950 */ 8951function ajaxHandleResponses( s, jqXHR, responses ) { 8952 8953 var ct, type, finalDataType, firstDataType, 8954 contents = s.contents, 8955 dataTypes = s.dataTypes; 8956 8957 // Remove auto dataType and get content-type in the process 8958 while ( dataTypes[ 0 ] === "*" ) { 8959 dataTypes.shift(); 8960 if ( ct === undefined ) { 8961 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 8962 } 8963 } 8964 8965 // Check if we're dealing with a known content-type 8966 if ( ct ) { 8967 for ( type in contents ) { 8968 if ( contents[ type ] && contents[ type ].test( ct ) ) { 8969 dataTypes.unshift( type ); 8970 break; 8971 } 8972 } 8973 } 8974 8975 // Check to see if we have a response for the expected dataType 8976 if ( dataTypes[ 0 ] in responses ) { 8977 finalDataType = dataTypes[ 0 ]; 8978 } else { 8979 8980 // Try convertible dataTypes 8981 for ( type in responses ) { 8982 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 8983 finalDataType = type; 8984 break; 8985 } 8986 if ( !firstDataType ) { 8987 firstDataType = type; 8988 } 8989 } 8990 8991 // Or just use first one 8992 finalDataType = finalDataType || firstDataType; 8993 } 8994 8995 // If we found a dataType 8996 // We add the dataType to the list if needed 8997 // and return the corresponding response 8998 if ( finalDataType ) { 8999 if ( finalDataType !== dataTypes[ 0 ] ) { 9000 dataTypes.unshift( finalDataType ); 9001 } 9002 return responses[ finalDataType ]; 9003 } 9004} 9005 9006/* Chain conversions given the request and the original response 9007 * Also sets the responseXXX fields on the jqXHR instance 9008 */ 9009function ajaxConvert( s, response, jqXHR, isSuccess ) { 9010 var conv2, current, conv, tmp, prev, 9011 converters = {}, 9012 9013 // Work with a copy of dataTypes in case we need to modify it for conversion 9014 dataTypes = s.dataTypes.slice(); 9015 9016 // Create converters map with lowercased keys 9017 if ( dataTypes[ 1 ] ) { 9018 for ( conv in s.converters ) { 9019 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9020 } 9021 } 9022 9023 current = dataTypes.shift(); 9024 9025 // Convert to each sequential dataType 9026 while ( current ) { 9027 9028 if ( s.responseFields[ current ] ) { 9029 jqXHR[ s.responseFields[ current ] ] = response; 9030 } 9031 9032 // Apply the dataFilter if provided 9033 if ( !prev && isSuccess && s.dataFilter ) { 9034 response = s.dataFilter( response, s.dataType ); 9035 } 9036 9037 prev = current; 9038 current = dataTypes.shift(); 9039 9040 if ( current ) { 9041 9042 // There's only work to do if current dataType is non-auto 9043 if ( current === "*" ) { 9044 9045 current = prev; 9046 9047 // Convert response if prev dataType is non-auto and differs from current 9048 } else if ( prev !== "*" && prev !== current ) { 9049 9050 // Seek a direct converter 9051 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9052 9053 // If none found, seek a pair 9054 if ( !conv ) { 9055 for ( conv2 in converters ) { 9056 9057 // If conv2 outputs current 9058 tmp = conv2.split( " " ); 9059 if ( tmp[ 1 ] === current ) { 9060 9061 // If prev can be converted to accepted input 9062 conv = converters[ prev + " " + tmp[ 0 ] ] || 9063 converters[ "* " + tmp[ 0 ] ]; 9064 if ( conv ) { 9065 9066 // Condense equivalence converters 9067 if ( conv === true ) { 9068 conv = converters[ conv2 ]; 9069 9070 // Otherwise, insert the intermediate dataType 9071 } else if ( converters[ conv2 ] !== true ) { 9072 current = tmp[ 0 ]; 9073 dataTypes.unshift( tmp[ 1 ] ); 9074 } 9075 break; 9076 } 9077 } 9078 } 9079 } 9080 9081 // Apply converter (if not an equivalence) 9082 if ( conv !== true ) { 9083 9084 // Unless errors are allowed to bubble, catch and return them 9085 if ( conv && s.throws ) { 9086 response = conv( response ); 9087 } else { 9088 try { 9089 response = conv( response ); 9090 } catch ( e ) { 9091 return { 9092 state: "parsererror", 9093 error: conv ? e : "No conversion from " + prev + " to " + current 9094 }; 9095 } 9096 } 9097 } 9098 } 9099 } 9100 } 9101 9102 return { state: "success", data: response }; 9103} 9104 9105jQuery.extend( { 9106 9107 // Counter for holding the number of active queries 9108 active: 0, 9109 9110 // Last-Modified header cache for next request 9111 lastModified: {}, 9112 etag: {}, 9113 9114 ajaxSettings: { 9115 url: location.href, 9116 type: "GET", 9117 isLocal: rlocalProtocol.test( location.protocol ), 9118 global: true, 9119 processData: true, 9120 async: true, 9121 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9122 9123 /* 9124 timeout: 0, 9125 data: null, 9126 dataType: null, 9127 username: null, 9128 password: null, 9129 cache: null, 9130 throws: false, 9131 traditional: false, 9132 headers: {}, 9133 */ 9134 9135 accepts: { 9136 "*": allTypes, 9137 text: "text/plain", 9138 html: "text/html", 9139 xml: "application/xml, text/xml", 9140 json: "application/json, text/javascript" 9141 }, 9142 9143 contents: { 9144 xml: /\bxml\b/, 9145 html: /\bhtml/, 9146 json: /\bjson\b/ 9147 }, 9148 9149 responseFields: { 9150 xml: "responseXML", 9151 text: "responseText", 9152 json: "responseJSON" 9153 }, 9154 9155 // Data converters 9156 // Keys separate source (or catchall "*") and destination types with a single space 9157 converters: { 9158 9159 // Convert anything to text 9160 "* text": String, 9161 9162 // Text to html (true = no transformation) 9163 "text html": true, 9164 9165 // Evaluate text as a json expression 9166 "text json": JSON.parse, 9167 9168 // Parse text as xml 9169 "text xml": jQuery.parseXML 9170 }, 9171 9172 // For options that shouldn't be deep extended: 9173 // you can add your own custom options here if 9174 // and when you create one that shouldn't be 9175 // deep extended (see ajaxExtend) 9176 flatOptions: { 9177 url: true, 9178 context: true 9179 } 9180 }, 9181 9182 // Creates a full fledged settings object into target 9183 // with both ajaxSettings and settings fields. 9184 // If target is omitted, writes into ajaxSettings. 9185 ajaxSetup: function( target, settings ) { 9186 return settings ? 9187 9188 // Building a settings object 9189 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9190 9191 // Extending ajaxSettings 9192 ajaxExtend( jQuery.ajaxSettings, target ); 9193 }, 9194 9195 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9196 ajaxTransport: addToPrefiltersOrTransports( transports ), 9197 9198 // Main method 9199 ajax: function( url, options ) { 9200 9201 // If url is an object, simulate pre-1.5 signature 9202 if ( typeof url === "object" ) { 9203 options = url; 9204 url = undefined; 9205 } 9206 9207 // Force options to be an object 9208 options = options || {}; 9209 9210 var transport, 9211 9212 // URL without anti-cache param 9213 cacheURL, 9214 9215 // Response headers 9216 responseHeadersString, 9217 responseHeaders, 9218 9219 // timeout handle 9220 timeoutTimer, 9221 9222 // Url cleanup var 9223 urlAnchor, 9224 9225 // Request state (becomes false upon send and true upon completion) 9226 completed, 9227 9228 // To know if global events are to be dispatched 9229 fireGlobals, 9230 9231 // Loop variable 9232 i, 9233 9234 // uncached part of the url 9235 uncached, 9236 9237 // Create the final options object 9238 s = jQuery.ajaxSetup( {}, options ), 9239 9240 // Callbacks context 9241 callbackContext = s.context || s, 9242 9243 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9244 globalEventContext = s.context && 9245 ( callbackContext.nodeType || callbackContext.jquery ) ? 9246 jQuery( callbackContext ) : 9247 jQuery.event, 9248 9249 // Deferreds 9250 deferred = jQuery.Deferred(), 9251 completeDeferred = jQuery.Callbacks( "once memory" ), 9252 9253 // Status-dependent callbacks 9254 statusCode = s.statusCode || {}, 9255 9256 // Headers (they are sent all at once) 9257 requestHeaders = {}, 9258 requestHeadersNames = {}, 9259 9260 // Default abort message 9261 strAbort = "canceled", 9262 9263 // Fake xhr 9264 jqXHR = { 9265 readyState: 0, 9266 9267 // Builds headers hashtable if needed 9268 getResponseHeader: function( key ) { 9269 var match; 9270 if ( completed ) { 9271 if ( !responseHeaders ) { 9272 responseHeaders = {}; 9273 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9274 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9275 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9276 .concat( match[ 2 ] ); 9277 } 9278 } 9279 match = responseHeaders[ key.toLowerCase() + " " ]; 9280 } 9281 return match == null ? null : match.join( ", " ); 9282 }, 9283 9284 // Raw string 9285 getAllResponseHeaders: function() { 9286 return completed ? responseHeadersString : null; 9287 }, 9288 9289 // Caches the header 9290 setRequestHeader: function( name, value ) { 9291 if ( completed == null ) { 9292 name = requestHeadersNames[ name.toLowerCase() ] = 9293 requestHeadersNames[ name.toLowerCase() ] || name; 9294 requestHeaders[ name ] = value; 9295 } 9296 return this; 9297 }, 9298 9299 // Overrides response content-type header 9300 overrideMimeType: function( type ) { 9301 if ( completed == null ) { 9302 s.mimeType = type; 9303 } 9304 return this; 9305 }, 9306 9307 // Status-dependent callbacks 9308 statusCode: function( map ) { 9309 var code; 9310 if ( map ) { 9311 if ( completed ) { 9312 9313 // Execute the appropriate callbacks 9314 jqXHR.always( map[ jqXHR.status ] ); 9315 } else { 9316 9317 // Lazy-add the new callbacks in a way that preserves old ones 9318 for ( code in map ) { 9319 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9320 } 9321 } 9322 } 9323 return this; 9324 }, 9325 9326 // Cancel the request 9327 abort: function( statusText ) { 9328 var finalText = statusText || strAbort; 9329 if ( transport ) { 9330 transport.abort( finalText ); 9331 } 9332 done( 0, finalText ); 9333 return this; 9334 } 9335 }; 9336 9337 // Attach deferreds 9338 deferred.promise( jqXHR ); 9339 9340 // Add protocol if not provided (prefilters might expect it) 9341 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9342 // We also use the url parameter if available 9343 s.url = ( ( url || s.url || location.href ) + "" ) 9344 .replace( rprotocol, location.protocol + "//" ); 9345 9346 // Alias method option to type as per ticket trac-12004 9347 s.type = options.method || options.type || s.method || s.type; 9348 9349 // Extract dataTypes list 9350 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9351 9352 // A cross-domain request is in order when the origin doesn't match the current origin. 9353 if ( s.crossDomain == null ) { 9354 urlAnchor = document.createElement( "a" ); 9355 9356 // Support: IE <=8 - 11, Edge 12 - 15 9357 // IE throws exception on accessing the href property if url is malformed, 9358 // e.g. http://example.com:80x/ 9359 try { 9360 urlAnchor.href = s.url; 9361 9362 // Support: IE <=8 - 11 only 9363 // Anchor's host property isn't correctly set when s.url is relative 9364 urlAnchor.href = urlAnchor.href; 9365 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9366 urlAnchor.protocol + "//" + urlAnchor.host; 9367 } catch ( e ) { 9368 9369 // If there is an error parsing the URL, assume it is crossDomain, 9370 // it can be rejected by the transport if it is invalid 9371 s.crossDomain = true; 9372 } 9373 } 9374 9375 // Convert data if not already a string 9376 if ( s.data && s.processData && typeof s.data !== "string" ) { 9377 s.data = jQuery.param( s.data, s.traditional ); 9378 } 9379 9380 // Apply prefilters 9381 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9382 9383 // If request was aborted inside a prefilter, stop there 9384 if ( completed ) { 9385 return jqXHR; 9386 } 9387 9388 // We can fire global events as of now if asked to 9389 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9390 fireGlobals = jQuery.event && s.global; 9391 9392 // Watch for a new set of requests 9393 if ( fireGlobals && jQuery.active++ === 0 ) { 9394 jQuery.event.trigger( "ajaxStart" ); 9395 } 9396 9397 // Uppercase the type 9398 s.type = s.type.toUpperCase(); 9399 9400 // Determine if request has content 9401 s.hasContent = !rnoContent.test( s.type ); 9402 9403 // Save the URL in case we're toying with the If-Modified-Since 9404 // and/or If-None-Match header later on 9405 // Remove hash to simplify url manipulation 9406 cacheURL = s.url.replace( rhash, "" ); 9407 9408 // More options handling for requests with no content 9409 if ( !s.hasContent ) { 9410 9411 // Remember the hash so we can put it back 9412 uncached = s.url.slice( cacheURL.length ); 9413 9414 // If data is available and should be processed, append data to url 9415 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9416 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9417 9418 // trac-9682: remove data so that it's not used in an eventual retry 9419 delete s.data; 9420 } 9421 9422 // Add or update anti-cache param if needed 9423 if ( s.cache === false ) { 9424 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9425 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9426 uncached; 9427 } 9428 9429 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9430 s.url = cacheURL + uncached; 9431 9432 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9433 } else if ( s.data && s.processData && 9434 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9435 s.data = s.data.replace( r20, "+" ); 9436 } 9437 9438 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9439 if ( s.ifModified ) { 9440 if ( jQuery.lastModified[ cacheURL ] ) { 9441 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9442 } 9443 if ( jQuery.etag[ cacheURL ] ) { 9444 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9445 } 9446 } 9447 9448 // Set the correct header, if data is being sent 9449 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9450 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9451 } 9452 9453 // Set the Accepts header for the server, depending on the dataType 9454 jqXHR.setRequestHeader( 9455 "Accept", 9456 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9457 s.accepts[ s.dataTypes[ 0 ] ] + 9458 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9459 s.accepts[ "*" ] 9460 ); 9461 9462 // Check for headers option 9463 for ( i in s.headers ) { 9464 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9465 } 9466 9467 // Allow custom headers/mimetypes and early abort 9468 if ( s.beforeSend && 9469 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9470 9471 // Abort if not done already and return 9472 return jqXHR.abort(); 9473 } 9474 9475 // Aborting is no longer a cancellation 9476 strAbort = "abort"; 9477 9478 // Install callbacks on deferreds 9479 completeDeferred.add( s.complete ); 9480 jqXHR.done( s.success ); 9481 jqXHR.fail( s.error ); 9482 9483 // Get transport 9484 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9485 9486 // If no transport, we auto-abort 9487 if ( !transport ) { 9488 done( -1, "No Transport" ); 9489 } else { 9490 jqXHR.readyState = 1; 9491 9492 // Send global event 9493 if ( fireGlobals ) { 9494 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9495 } 9496 9497 // If request was aborted inside ajaxSend, stop there 9498 if ( completed ) { 9499 return jqXHR; 9500 } 9501 9502 // Timeout 9503 if ( s.async && s.timeout > 0 ) { 9504 timeoutTimer = window.setTimeout( function() { 9505 jqXHR.abort( "timeout" ); 9506 }, s.timeout ); 9507 } 9508 9509 try { 9510 completed = false; 9511 transport.send( requestHeaders, done ); 9512 } catch ( e ) { 9513 9514 // Rethrow post-completion exceptions 9515 if ( completed ) { 9516 throw e; 9517 } 9518 9519 // Propagate others as results 9520 done( -1, e ); 9521 } 9522 } 9523 9524 // Callback for when everything is done 9525 function done( status, nativeStatusText, responses, headers ) { 9526 var isSuccess, success, error, response, modified, 9527 statusText = nativeStatusText; 9528 9529 // Ignore repeat invocations 9530 if ( completed ) { 9531 return; 9532 } 9533 9534 completed = true; 9535 9536 // Clear timeout if it exists 9537 if ( timeoutTimer ) { 9538 window.clearTimeout( timeoutTimer ); 9539 } 9540 9541 // Dereference transport for early garbage collection 9542 // (no matter how long the jqXHR object will be used) 9543 transport = undefined; 9544 9545 // Cache response headers 9546 responseHeadersString = headers || ""; 9547 9548 // Set readyState 9549 jqXHR.readyState = status > 0 ? 4 : 0; 9550 9551 // Determine if successful 9552 isSuccess = status >= 200 && status < 300 || status === 304; 9553 9554 // Get response data 9555 if ( responses ) { 9556 response = ajaxHandleResponses( s, jqXHR, responses ); 9557 } 9558 9559 // Use a noop converter for missing script but not if jsonp 9560 if ( !isSuccess && 9561 jQuery.inArray( "script", s.dataTypes ) > -1 && 9562 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9563 s.converters[ "text script" ] = function() {}; 9564 } 9565 9566 // Convert no matter what (that way responseXXX fields are always set) 9567 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9568 9569 // If successful, handle type chaining 9570 if ( isSuccess ) { 9571 9572 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9573 if ( s.ifModified ) { 9574 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9575 if ( modified ) { 9576 jQuery.lastModified[ cacheURL ] = modified; 9577 } 9578 modified = jqXHR.getResponseHeader( "etag" ); 9579 if ( modified ) { 9580 jQuery.etag[ cacheURL ] = modified; 9581 } 9582 } 9583 9584 // if no content 9585 if ( status === 204 || s.type === "HEAD" ) { 9586 statusText = "nocontent"; 9587 9588 // if not modified 9589 } else if ( status === 304 ) { 9590 statusText = "notmodified"; 9591 9592 // If we have data, let's convert it 9593 } else { 9594 statusText = response.state; 9595 success = response.data; 9596 error = response.error; 9597 isSuccess = !error; 9598 } 9599 } else { 9600 9601 // Extract error from statusText and normalize for non-aborts 9602 error = statusText; 9603 if ( status || !statusText ) { 9604 statusText = "error"; 9605 if ( status < 0 ) { 9606 status = 0; 9607 } 9608 } 9609 } 9610 9611 // Set data for the fake xhr object 9612 jqXHR.status = status; 9613 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9614 9615 // Success/Error 9616 if ( isSuccess ) { 9617 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9618 } else { 9619 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9620 } 9621 9622 // Status-dependent callbacks 9623 jqXHR.statusCode( statusCode ); 9624 statusCode = undefined; 9625 9626 if ( fireGlobals ) { 9627 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9628 [ jqXHR, s, isSuccess ? success : error ] ); 9629 } 9630 9631 // Complete 9632 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9633 9634 if ( fireGlobals ) { 9635 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9636 9637 // Handle the global AJAX counter 9638 if ( !( --jQuery.active ) ) { 9639 jQuery.event.trigger( "ajaxStop" ); 9640 } 9641 } 9642 } 9643 9644 return jqXHR; 9645 }, 9646 9647 getJSON: function( url, data, callback ) { 9648 return jQuery.get( url, data, callback, "json" ); 9649 }, 9650 9651 getScript: function( url, callback ) { 9652 return jQuery.get( url, undefined, callback, "script" ); 9653 } 9654} ); 9655 9656jQuery.each( [ "get", "post" ], function( _i, method ) { 9657 jQuery[ method ] = function( url, data, callback, type ) { 9658 9659 // Shift arguments if data argument was omitted 9660 if ( isFunction( data ) ) { 9661 type = type || callback; 9662 callback = data; 9663 data = undefined; 9664 } 9665 9666 // The url can be an options object (which then must have .url) 9667 return jQuery.ajax( jQuery.extend( { 9668 url: url, 9669 type: method, 9670 dataType: type, 9671 data: data, 9672 success: callback 9673 }, jQuery.isPlainObject( url ) && url ) ); 9674 }; 9675} ); 9676 9677jQuery.ajaxPrefilter( function( s ) { 9678 var i; 9679 for ( i in s.headers ) { 9680 if ( i.toLowerCase() === "content-type" ) { 9681 s.contentType = s.headers[ i ] || ""; 9682 } 9683 } 9684} ); 9685 9686 9687jQuery._evalUrl = function( url, options, doc ) { 9688 return jQuery.ajax( { 9689 url: url, 9690 9691 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9692 type: "GET", 9693 dataType: "script", 9694 cache: true, 9695 async: false, 9696 global: false, 9697 9698 // Only evaluate the response if it is successful (gh-4126) 9699 // dataFilter is not invoked for failure responses, so using it instead 9700 // of the default converter is kludgy but it works. 9701 converters: { 9702 "text script": function() {} 9703 }, 9704 dataFilter: function( response ) { 9705 jQuery.globalEval( response, options, doc ); 9706 } 9707 } ); 9708}; 9709 9710 9711jQuery.fn.extend( { 9712 wrapAll: function( html ) { 9713 var wrap; 9714 9715 if ( this[ 0 ] ) { 9716 if ( isFunction( html ) ) { 9717 html = html.call( this[ 0 ] ); 9718 } 9719 9720 // The elements to wrap the target around 9721 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9722 9723 if ( this[ 0 ].parentNode ) { 9724 wrap.insertBefore( this[ 0 ] ); 9725 } 9726 9727 wrap.map( function() { 9728 var elem = this; 9729 9730 while ( elem.firstElementChild ) { 9731 elem = elem.firstElementChild; 9732 } 9733 9734 return elem; 9735 } ).append( this ); 9736 } 9737 9738 return this; 9739 }, 9740 9741 wrapInner: function( html ) { 9742 if ( isFunction( html ) ) { 9743 return this.each( function( i ) { 9744 jQuery( this ).wrapInner( html.call( this, i ) ); 9745 } ); 9746 } 9747 9748 return this.each( function() { 9749 var self = jQuery( this ), 9750 contents = self.contents(); 9751 9752 if ( contents.length ) { 9753 contents.wrapAll( html ); 9754 9755 } else { 9756 self.append( html ); 9757 } 9758 } ); 9759 }, 9760 9761 wrap: function( html ) { 9762 var htmlIsFunction = isFunction( html ); 9763 9764 return this.each( function( i ) { 9765 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9766 } ); 9767 }, 9768 9769 unwrap: function( selector ) { 9770 this.parent( selector ).not( "body" ).each( function() { 9771 jQuery( this ).replaceWith( this.childNodes ); 9772 } ); 9773 return this; 9774 } 9775} ); 9776 9777 9778jQuery.expr.pseudos.hidden = function( elem ) { 9779 return !jQuery.expr.pseudos.visible( elem ); 9780}; 9781jQuery.expr.pseudos.visible = function( elem ) { 9782 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9783}; 9784 9785 9786 9787 9788jQuery.ajaxSettings.xhr = function() { 9789 try { 9790 return new window.XMLHttpRequest(); 9791 } catch ( e ) {} 9792}; 9793 9794var xhrSuccessStatus = { 9795 9796 // File protocol always yields status code 0, assume 200 9797 0: 200, 9798 9799 // Support: IE <=9 only 9800 // trac-1450: sometimes IE returns 1223 when it should be 204 9801 1223: 204 9802 }, 9803 xhrSupported = jQuery.ajaxSettings.xhr(); 9804 9805support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9806support.ajax = xhrSupported = !!xhrSupported; 9807 9808jQuery.ajaxTransport( function( options ) { 9809 var callback, errorCallback; 9810 9811 // Cross domain only allowed if supported through XMLHttpRequest 9812 if ( support.cors || xhrSupported && !options.crossDomain ) { 9813 return { 9814 send: function( headers, complete ) { 9815 var i, 9816 xhr = options.xhr(); 9817 9818 xhr.open( 9819 options.type, 9820 options.url, 9821 options.async, 9822 options.username, 9823 options.password 9824 ); 9825 9826 // Apply custom fields if provided 9827 if ( options.xhrFields ) { 9828 for ( i in options.xhrFields ) { 9829 xhr[ i ] = options.xhrFields[ i ]; 9830 } 9831 } 9832 9833 // Override mime type if needed 9834 if ( options.mimeType && xhr.overrideMimeType ) { 9835 xhr.overrideMimeType( options.mimeType ); 9836 } 9837 9838 // X-Requested-With header 9839 // For cross-domain requests, seeing as conditions for a preflight are 9840 // akin to a jigsaw puzzle, we simply never set it to be sure. 9841 // (it can always be set on a per-request basis or even using ajaxSetup) 9842 // For same-domain requests, won't change header if already provided. 9843 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9844 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9845 } 9846 9847 // Set headers 9848 for ( i in headers ) { 9849 xhr.setRequestHeader( i, headers[ i ] ); 9850 } 9851 9852 // Callback 9853 callback = function( type ) { 9854 return function() { 9855 if ( callback ) { 9856 callback = errorCallback = xhr.onload = 9857 xhr.onerror = xhr.onabort = xhr.ontimeout = 9858 xhr.onreadystatechange = null; 9859 9860 if ( type === "abort" ) { 9861 xhr.abort(); 9862 } else if ( type === "error" ) { 9863 9864 // Support: IE <=9 only 9865 // On a manual native abort, IE9 throws 9866 // errors on any property access that is not readyState 9867 if ( typeof xhr.status !== "number" ) { 9868 complete( 0, "error" ); 9869 } else { 9870 complete( 9871 9872 // File: protocol always yields status 0; see trac-8605, trac-14207 9873 xhr.status, 9874 xhr.statusText 9875 ); 9876 } 9877 } else { 9878 complete( 9879 xhrSuccessStatus[ xhr.status ] || xhr.status, 9880 xhr.statusText, 9881 9882 // Support: IE <=9 only 9883 // IE9 has no XHR2 but throws on binary (trac-11426) 9884 // For XHR2 non-text, let the caller handle it (gh-2498) 9885 ( xhr.responseType || "text" ) !== "text" || 9886 typeof xhr.responseText !== "string" ? 9887 { binary: xhr.response } : 9888 { text: xhr.responseText }, 9889 xhr.getAllResponseHeaders() 9890 ); 9891 } 9892 } 9893 }; 9894 }; 9895 9896 // Listen to events 9897 xhr.onload = callback(); 9898 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 9899 9900 // Support: IE 9 only 9901 // Use onreadystatechange to replace onabort 9902 // to handle uncaught aborts 9903 if ( xhr.onabort !== undefined ) { 9904 xhr.onabort = errorCallback; 9905 } else { 9906 xhr.onreadystatechange = function() { 9907 9908 // Check readyState before timeout as it changes 9909 if ( xhr.readyState === 4 ) { 9910 9911 // Allow onerror to be called first, 9912 // but that will not handle a native abort 9913 // Also, save errorCallback to a variable 9914 // as xhr.onerror cannot be accessed 9915 window.setTimeout( function() { 9916 if ( callback ) { 9917 errorCallback(); 9918 } 9919 } ); 9920 } 9921 }; 9922 } 9923 9924 // Create the abort callback 9925 callback = callback( "abort" ); 9926 9927 try { 9928 9929 // Do send the request (this may raise an exception) 9930 xhr.send( options.hasContent && options.data || null ); 9931 } catch ( e ) { 9932 9933 // trac-14683: Only rethrow if this hasn't been notified as an error yet 9934 if ( callback ) { 9935 throw e; 9936 } 9937 } 9938 }, 9939 9940 abort: function() { 9941 if ( callback ) { 9942 callback(); 9943 } 9944 } 9945 }; 9946 } 9947} ); 9948 9949 9950 9951 9952// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 9953jQuery.ajaxPrefilter( function( s ) { 9954 if ( s.crossDomain ) { 9955 s.contents.script = false; 9956 } 9957} ); 9958 9959// Install script dataType 9960jQuery.ajaxSetup( { 9961 accepts: { 9962 script: "text/javascript, application/javascript, " + 9963 "application/ecmascript, application/x-ecmascript" 9964 }, 9965 contents: { 9966 script: /\b(?:java|ecma)script\b/ 9967 }, 9968 converters: { 9969 "text script": function( text ) { 9970 jQuery.globalEval( text ); 9971 return text; 9972 } 9973 } 9974} ); 9975 9976// Handle cache's special case and crossDomain 9977jQuery.ajaxPrefilter( "script", function( s ) { 9978 if ( s.cache === undefined ) { 9979 s.cache = false; 9980 } 9981 if ( s.crossDomain ) { 9982 s.type = "GET"; 9983 } 9984} ); 9985 9986// Bind script tag hack transport 9987jQuery.ajaxTransport( "script", function( s ) { 9988 9989 // This transport only deals with cross domain or forced-by-attrs requests 9990 if ( s.crossDomain || s.scriptAttrs ) { 9991 var script, callback; 9992 return { 9993 send: function( _, complete ) { 9994 script = jQuery( "<script>" ) 9995 .attr( s.scriptAttrs || {} ) 9996 .prop( { charset: s.scriptCharset, src: s.url } ) 9997 .on( "load error", callback = function( evt ) { 9998 script.remove(); 9999 callback = null; 10000 if ( evt ) { 10001 complete( evt.type === "error" ? 404 : 200, evt.type ); 10002 } 10003 } ); 10004 10005 // Use native DOM manipulation to avoid our domManip AJAX trickery 10006 document.head.appendChild( script[ 0 ] ); 10007 }, 10008 abort: function() { 10009 if ( callback ) { 10010 callback(); 10011 } 10012 } 10013 }; 10014 } 10015} ); 10016 10017 10018 10019 10020var oldCallbacks = [], 10021 rjsonp = /(=)\?(?=&|$)|\?\?/; 10022 10023// Default jsonp settings 10024jQuery.ajaxSetup( { 10025 jsonp: "callback", 10026 jsonpCallback: function() { 10027 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10028 this[ callback ] = true; 10029 return callback; 10030 } 10031} ); 10032 10033// Detect, normalize options and install callbacks for jsonp requests 10034jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10035 10036 var callbackName, overwritten, responseContainer, 10037 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10038 "url" : 10039 typeof s.data === "string" && 10040 ( s.contentType || "" ) 10041 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10042 rjsonp.test( s.data ) && "data" 10043 ); 10044 10045 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10046 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10047 10048 // Get callback name, remembering preexisting value associated with it 10049 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10050 s.jsonpCallback() : 10051 s.jsonpCallback; 10052 10053 // Insert callback into url or form data 10054 if ( jsonProp ) { 10055 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10056 } else if ( s.jsonp !== false ) { 10057 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10058 } 10059 10060 // Use data converter to retrieve json after script execution
vendor: 8,362 bytes, lines 10061-10372
10061 s.converters[ "script json" ] = function() { 10062 if ( !responseContainer ) { 10063 jQuery.error( callbackName + " was not called" ); 10064 } 10065 return responseContainer[ 0 ]; 10066 }; 10067 10068 // Force json dataType 10069 s.dataTypes[ 0 ] = "json"; 10070 10071 // Install callback 10072 overwritten = window[ callbackName ]; 10073 window[ callbackName ] = function() { 10074 responseContainer = arguments; 10075 }; 10076 10077 // Clean-up function (fires after converters) 10078 jqXHR.always( function() { 10079 10080 // If previous value didn't exist - remove it 10081 if ( overwritten === undefined ) { 10082 jQuery( window ).removeProp( callbackName ); 10083 10084 // Otherwise restore preexisting value 10085 } else { 10086 window[ callbackName ] = overwritten; 10087 } 10088 10089 // Save back as free 10090 if ( s[ callbackName ] ) { 10091 10092 // Make sure that re-using the options doesn't screw things around 10093 s.jsonpCallback = originalSettings.jsonpCallback; 10094 10095 // Save the callback name for future use 10096 oldCallbacks.push( callbackName ); 10097 } 10098 10099 // Call if it was a function and we have a response 10100 if ( responseContainer && isFunction( overwritten ) ) { 10101 overwritten( responseContainer[ 0 ] ); 10102 } 10103 10104 responseContainer = overwritten = undefined; 10105 } ); 10106 10107 // Delegate to script 10108 return "script"; 10109 } 10110} ); 10111 10112 10113 10114 10115// Support: Safari 8 only 10116// In Safari 8 documents created via document.implementation.createHTMLDocument 10117// collapse sibling forms: the second one becomes a child of the first one. 10118// Because of that, this security measure has to be disabled in Safari 8. 10119// https://bugs.webkit.org/show_bug.cgi?id=137337 10120support.createHTMLDocument = ( function() { 10121 var body = document.implementation.createHTMLDocument( "" ).body; 10122 body.innerHTML = "<form></form><form></form>"; 10123 return body.childNodes.length === 2; 10124} )(); 10125 10126 10127// Argument "data" should be string of html 10128// context (optional): If specified, the fragment will be created in this context, 10129// defaults to document 10130// keepScripts (optional): If true, will include scripts passed in the html string 10131jQuery.parseHTML = function( data, context, keepScripts ) { 10132 if ( typeof data !== "string" ) { 10133 return []; 10134 } 10135 if ( typeof context === "boolean" ) { 10136 keepScripts = context; 10137 context = false; 10138 } 10139 10140 var base, parsed, scripts; 10141 10142 if ( !context ) { 10143 10144 // Stop scripts or inline event handlers from being executed immediately 10145 // by using document.implementation 10146 if ( support.createHTMLDocument ) { 10147 context = document.implementation.createHTMLDocument( "" ); 10148 10149 // Set the base href for the created document 10150 // so any parsed elements with URLs 10151 // are based on the document's URL (gh-2965) 10152 base = context.createElement( "base" ); 10153 base.href = document.location.href; 10154 context.head.appendChild( base ); 10155 } else { 10156 context = document; 10157 } 10158 } 10159 10160 parsed = rsingleTag.exec( data ); 10161 scripts = !keepScripts && []; 10162 10163 // Single tag 10164 if ( parsed ) { 10165 return [ context.createElement( parsed[ 1 ] ) ]; 10166 } 10167 10168 parsed = buildFragment( [ data ], context, scripts ); 10169 10170 if ( scripts && scripts.length ) { 10171 jQuery( scripts ).remove(); 10172 } 10173 10174 return jQuery.merge( [], parsed.childNodes ); 10175}; 10176 10177 10178/** 10179 * Load a url into a page 10180 */ 10181jQuery.fn.load = function( url, params, callback ) { 10182 var selector, type, response, 10183 self = this, 10184 off = url.indexOf( " " ); 10185 10186 if ( off > -1 ) { 10187 selector = stripAndCollapse( url.slice( off ) ); 10188 url = url.slice( 0, off ); 10189 } 10190 10191 // If it's a function 10192 if ( isFunction( params ) ) { 10193 10194 // We assume that it's the callback 10195 callback = params; 10196 params = undefined; 10197 10198 // Otherwise, build a param string 10199 } else if ( params && typeof params === "object" ) { 10200 type = "POST"; 10201 } 10202 10203 // If we have elements to modify, make the request 10204 if ( self.length > 0 ) { 10205 jQuery.ajax( { 10206 url: url, 10207 10208 // If "type" variable is undefined, then "GET" method will be used. 10209 // Make value of this field explicit since 10210 // user can override it through ajaxSetup method 10211 type: type || "GET", 10212 dataType: "html", 10213 data: params 10214 } ).done( function( responseText ) { 10215 10216 // Save response for use in complete callback 10217 response = arguments; 10218 10219 self.html( selector ? 10220 10221 // If a selector was specified, locate the right elements in a dummy div 10222 // Exclude scripts to avoid IE 'Permission Denied' errors 10223 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10224 10225 // Otherwise use the full result 10226 responseText ); 10227 10228 // If the request succeeds, this function gets "data", "status", "jqXHR" 10229 // but they are ignored because response was set above. 10230 // If it fails, this function gets "jqXHR", "status", "error" 10231 } ).always( callback && function( jqXHR, status ) { 10232 self.each( function() { 10233 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10234 } ); 10235 } ); 10236 } 10237 10238 return this; 10239}; 10240 10241 10242 10243 10244jQuery.expr.pseudos.animated = function( elem ) { 10245 return jQuery.grep( jQuery.timers, function( fn ) { 10246 return elem === fn.elem; 10247 } ).length; 10248}; 10249 10250 10251 10252 10253jQuery.offset = { 10254 setOffset: function( elem, options, i ) { 10255 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10256 position = jQuery.css( elem, "position" ), 10257 curElem = jQuery( elem ), 10258 props = {}; 10259 10260 // Set position first, in-case top/left are set even on static elem 10261 if ( position === "static" ) { 10262 elem.style.position = "relative"; 10263 } 10264 10265 curOffset = curElem.offset(); 10266 curCSSTop = jQuery.css( elem, "top" ); 10267 curCSSLeft = jQuery.css( elem, "left" ); 10268 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10269 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10270 10271 // Need to be able to calculate position if either 10272 // top or left is auto and position is either absolute or fixed 10273 if ( calculatePosition ) { 10274 curPosition = curElem.position(); 10275 curTop = curPosition.top; 10276 curLeft = curPosition.left; 10277 10278 } else { 10279 curTop = parseFloat( curCSSTop ) || 0; 10280 curLeft = parseFloat( curCSSLeft ) || 0; 10281 } 10282 10283 if ( isFunction( options ) ) { 10284 10285 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10286 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10287 } 10288 10289 if ( options.top != null ) { 10290 props.top = ( options.top - curOffset.top ) + curTop; 10291 } 10292 if ( options.left != null ) { 10293 props.left = ( options.left - curOffset.left ) + curLeft; 10294 } 10295 10296 if ( "using" in options ) { 10297 options.using.call( elem, props ); 10298 10299 } else { 10300 curElem.css( props ); 10301 } 10302 } 10303}; 10304 10305jQuery.fn.extend( { 10306 10307 // offset() relates an element's border box to the document origin 10308 offset: function( options ) { 10309 10310 // Preserve chaining for setter 10311 if ( arguments.length ) { 10312 return options === undefined ? 10313 this : 10314 this.each( function( i ) { 10315 jQuery.offset.setOffset( this, options, i ); 10316 } ); 10317 } 10318 10319 var rect, win, 10320 elem = this[ 0 ]; 10321 10322 if ( !elem ) { 10323 return; 10324 } 10325 10326 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10327 // Support: IE <=11 only 10328 // Running getBoundingClientRect on a 10329 // disconnected node in IE throws an error 10330 if ( !elem.getClientRects().length ) { 10331 return { top: 0, left: 0 }; 10332 } 10333 10334 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10335 rect = elem.getBoundingClientRect(); 10336 win = elem.ownerDocument.defaultView; 10337 return { 10338 top: rect.top + win.pageYOffset, 10339 left: rect.left + win.pageXOffset 10340 }; 10341 }, 10342 10343 // position() relates an element's margin box to its offset parent's padding box 10344 // This corresponds to the behavior of CSS absolute positioning 10345 position: function() { 10346 if ( !this[ 0 ] ) { 10347 return; 10348 } 10349 10350 var offsetParent, offset, doc, 10351 elem = this[ 0 ], 10352 parentOffset = { top: 0, left: 0 }; 10353 10354 // position:fixed elements are offset from the viewport, which itself always has zero offset 10355 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10356 10357 // Assume position:fixed implies availability of getBoundingClientRect 10358 offset = elem.getBoundingClientRect(); 10359 10360 } else { 10361 offset = this.offset(); 10362 10363 // Account for the *real* offset parent, which can be the document or its root element 10364 // when a statically positioned element is identified 10365 doc = elem.ownerDocument; 10366 offsetParent = elem.offsetParent || doc.documentElement; 10367 while ( offsetParent && 10368 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10369 jQuery.css( offsetParent, "position" ) === "static" ) { 10370 10371 offsetParent = offsetParent.parentNode; 10372 }
vendor: 9,494 bytes, lines 10373-10704
10373 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10374 10375 // Incorporate borders into its offset, since they are outside its content origin 10376 parentOffset = jQuery( offsetParent ).offset(); 10377 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10378 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10379 } 10380 } 10381 10382 // Subtract parent offsets and element margins 10383 return { 10384 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10385 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10386 }; 10387 }, 10388 10389 // This method will return documentElement in the following cases: 10390 // 1) For the element inside the iframe without offsetParent, this method will return 10391 // documentElement of the parent window 10392 // 2) For the hidden or detached element 10393 // 3) For body or html element, i.e. in case of the html node - it will return itself 10394 // 10395 // but those exceptions were never presented as a real life use-cases 10396 // and might be considered as more preferable results. 10397 // 10398 // This logic, however, is not guaranteed and can change at any point in the future 10399 offsetParent: function() { 10400 return this.map( function() { 10401 var offsetParent = this.offsetParent; 10402 10403 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10404 offsetParent = offsetParent.offsetParent; 10405 } 10406 10407 return offsetParent || documentElement; 10408 } ); 10409 } 10410} ); 10411 10412// Create scrollLeft and scrollTop methods 10413jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10414 var top = "pageYOffset" === prop; 10415 10416 jQuery.fn[ method ] = function( val ) { 10417 return access( this, function( elem, method, val ) { 10418 10419 // Coalesce documents and windows 10420 var win; 10421 if ( isWindow( elem ) ) { 10422 win = elem; 10423 } else if ( elem.nodeType === 9 ) { 10424 win = elem.defaultView; 10425 } 10426 10427 if ( val === undefined ) { 10428 return win ? win[ prop ] : elem[ method ]; 10429 } 10430 10431 if ( win ) { 10432 win.scrollTo( 10433 !top ? val : win.pageXOffset, 10434 top ? val : win.pageYOffset 10435 ); 10436 10437 } else { 10438 elem[ method ] = val; 10439 } 10440 }, method, val, arguments.length ); 10441 }; 10442} ); 10443 10444// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10445// Add the top/left cssHooks using jQuery.fn.position 10446// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10447// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10448// getComputedStyle returns percent when specified for top/left/bottom/right; 10449// rather than make the css module depend on the offset module, just check for it here 10450jQuery.each( [ "top", "left" ], function( _i, prop ) { 10451 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10452 function( elem, computed ) { 10453 if ( computed ) { 10454 computed = curCSS( elem, prop ); 10455 10456 // If curCSS returns percentage, fallback to offset 10457 return rnumnonpx.test( computed ) ? 10458 jQuery( elem ).position()[ prop ] + "px" : 10459 computed; 10460 } 10461 } 10462 ); 10463} ); 10464 10465 10466// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10467jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10468 jQuery.each( { 10469 padding: "inner" + name, 10470 content: type, 10471 "": "outer" + name 10472 }, function( defaultExtra, funcName ) { 10473 10474 // Margin is only for outerHeight, outerWidth 10475 jQuery.fn[ funcName ] = function( margin, value ) { 10476 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10477 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10478 10479 return access( this, function( elem, type, value ) { 10480 var doc; 10481 10482 if ( isWindow( elem ) ) { 10483 10484 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10485 return funcName.indexOf( "outer" ) === 0 ? 10486 elem[ "inner" + name ] : 10487 elem.document.documentElement[ "client" + name ]; 10488 } 10489 10490 // Get document width or height 10491 if ( elem.nodeType === 9 ) { 10492 doc = elem.documentElement; 10493 10494 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10495 // whichever is greatest 10496 return Math.max( 10497 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10498 elem.body[ "offset" + name ], doc[ "offset" + name ], 10499 doc[ "client" + name ] 10500 ); 10501 } 10502 10503 return value === undefined ? 10504 10505 // Get width or height on the element, requesting but not forcing parseFloat 10506 jQuery.css( elem, type, extra ) : 10507 10508 // Set width or height on the element 10509 jQuery.style( elem, type, value, extra ); 10510 }, type, chainable ? margin : undefined, chainable ); 10511 }; 10512 } ); 10513} ); 10514 10515 10516jQuery.each( [ 10517 "ajaxStart", 10518 "ajaxStop", 10519 "ajaxComplete", 10520 "ajaxError", 10521 "ajaxSuccess", 10522 "ajaxSend" 10523], function( _i, type ) { 10524 jQuery.fn[ type ] = function( fn ) { 10525 return this.on( type, fn ); 10526 }; 10527} ); 10528 10529 10530 10531 10532jQuery.fn.extend( { 10533 10534 bind: function( types, data, fn ) { 10535 return this.on( types, null, data, fn ); 10536 }, 10537 unbind: function( types, fn ) { 10538 return this.off( types, null, fn ); 10539 }, 10540 10541 delegate: function( selector, types, data, fn ) { 10542 return this.on( types, selector, data, fn ); 10543 }, 10544 undelegate: function( selector, types, fn ) { 10545 10546 // ( namespace ) or ( selector, types [, fn] ) 10547 return arguments.length === 1 ? 10548 this.off( selector, "**" ) : 10549 this.off( types, selector || "**", fn ); 10550 }, 10551 10552 hover: function( fnOver, fnOut ) { 10553 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10554 } 10555} ); 10556 10557jQuery.each( 10558 ( "blur focus focusin focusout resize scroll click dblclick " + 10559 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10560 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10561 function( _i, name ) { 10562 10563 // Handle event binding 10564 jQuery.fn[ name ] = function( data, fn ) { 10565 return arguments.length > 0 ? 10566 this.on( name, null, data, fn ) : 10567 this.trigger( name ); 10568 }; 10569 } 10570); 10571 10572 10573 10574 10575// Support: Android <=4.0 only 10576// Make sure we trim BOM and NBSP 10577// Require that the "whitespace run" starts from a non-whitespace 10578// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10579var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10580 10581// Bind a function to a context, optionally partially applying any 10582// arguments. 10583// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10584// However, it is not slated for removal any time soon 10585jQuery.proxy = function( fn, context ) { 10586 var tmp, args, proxy; 10587 10588 if ( typeof context === "string" ) { 10589 tmp = fn[ context ]; 10590 context = fn; 10591 fn = tmp; 10592 } 10593 10594 // Quick check to determine if target is callable, in the spec 10595 // this throws a TypeError, but we will just return undefined. 10596 if ( !isFunction( fn ) ) { 10597 return undefined; 10598 } 10599 10600 // Simulated bind 10601 args = slice.call( arguments, 2 ); 10602 proxy = function() { 10603 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10604 }; 10605 10606 // Set the guid of unique handler to the same of original handler, so it can be removed 10607 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10608 10609 return proxy; 10610}; 10611 10612jQuery.holdReady = function( hold ) { 10613 if ( hold ) { 10614 jQuery.readyWait++; 10615 } else { 10616 jQuery.ready( true ); 10617 } 10618}; 10619jQuery.isArray = Array.isArray; 10620jQuery.parseJSON = JSON.parse; 10621jQuery.nodeName = nodeName; 10622jQuery.isFunction = isFunction; 10623jQuery.isWindow = isWindow; 10624jQuery.camelCase = camelCase; 10625jQuery.type = toType; 10626 10627jQuery.now = Date.now; 10628 10629jQuery.isNumeric = function( obj ) { 10630 10631 // As of jQuery 3.0, isNumeric is limited to 10632 // strings and numbers (primitives or objects) 10633 // that can be coerced to finite numbers (gh-2662) 10634 var type = jQuery.type( obj ); 10635 return ( type === "number" || type === "string" ) && 10636 10637 // parseFloat NaNs numeric-cast false positives ("") 10638 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10639 // subtraction forces infinities to NaN 10640 !isNaN( obj - parseFloat( obj ) ); 10641}; 10642 10643jQuery.trim = function( text ) { 10644 return text == null ? 10645 "" : 10646 ( text + "" ).replace( rtrim, "$1" ); 10647}; 10648 10649 10650 10651// Register as a named AMD module, since jQuery can be concatenated with other 10652// files that may use define, but not via a proper concatenation script that 10653// understands anonymous AMD modules. A named AMD is safest and most robust 10654// way to register. Lowercase jquery is used because AMD module names are 10655// derived from file names, and jQuery is normally delivered in a lowercase 10656// file name. Do this after creating the global so that if an AMD module wants 10657// to call noConflict to hide this version of jQuery, it will work. 10658 10659// Note that for maximum portability, libraries that are not jQuery should 10660// declare themselves as anonymous modules, and avoid setting a global if an 10661// AMD loader is present. jQuery is a special case. For more information, see 10662// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10663 10664if ( typeof define === "function" && define.amd ) { 10665 define( "jquery", [], function() { 10666 return jQuery; 10667 } ); 10668} 10669 10670 10671 10672 10673var 10674 10675 // Map over jQuery in case of overwrite 10676 _jQuery = window.jQuery, 10677 10678 // Map over the $ in case of overwrite 10679 _$ = window.$; 10680 10681jQuery.noConflict = function( deep ) { 10682 if ( window.$ === jQuery ) { 10683 window.$ = _$; 10684 } 10685 10686 if ( deep && window.jQuery === jQuery ) { 10687 window.jQuery = _jQuery; 10688 } 10689 10690 return jQuery; 10691}; 10692 10693// Expose jQuery and $ identifiers, even in AMD 10694// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10695// and CommonJS for browser emulators (trac-13566) 10696if ( typeof noGlobal === "undefined" ) { 10697 window.jQuery = window.$ = jQuery; 10698} 10699 10700 10701 10702 10703return jQuery; 10704} );
10705// Included only in the minified build, via Uglify2 10706// Only turn warnings off if not already overridden 10707if ( typeof jQuery.migrateMute === "undefined" ) { 10708 jQuery.migrateMute = true; 10709}; 10710/*! 10711 * jQuery Migrate - v3.5.2 - 2024-07-17T22:31Z 10712 * Copyright OpenJS Foundation and other contributors 10713 */ 10714( function( factory ) { 10715 "use strict"; 10716 10717 if ( typeof define === "function" && define.amd ) { 10718 10719 // AMD. Register as an anonymous module. 10720 define( [ "jquery" ], function( jQuery ) { 10721 return factory( jQuery, window ); 10722 } ); 10723 } else if ( typeof module === "object" && module.exports ) { 10724 10725 // Node/CommonJS 10726 // eslint-disable-next-line no-undef 10727 module.exports = factory( require( "jquery" ), window ); 10728 } else { 10729 10730 // Browser globals 10731 factory( jQuery, window ); 10732 } 10733} )( function( jQuery, window ) { 10734"use strict"; 10735 10736jQuery.migrateVersion = "3.5.2"; 10737 10738// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2 10739function compareVersions( v1, v2 ) { 10740 var i, 10741 rVersionParts = /^(\d+)\.(\d+)\.(\d+)/, 10742 v1p = rVersionParts.exec( v1 ) || [ ], 10743 v2p = rVersionParts.exec( v2 ) || [ ]; 10744 10745 for ( i = 1; i <= 3; i++ ) { 10746 if ( +v1p[ i ] > +v2p[ i ] ) { 10747 return 1; 10748 } 10749 if ( +v1p[ i ] < +v2p[ i ] ) { 10750 return -1; 10751 } 10752 } 10753 return 0; 10754} 10755 10756function jQueryVersionSince( version ) { 10757 return compareVersions( jQuery.fn.jquery, version ) >= 0; 10758} 10759 10760// A map from disabled patch codes to `true`. This should really 10761// be a `Set` but those are unsupported in IE. 10762var disabledPatches = Object.create( null ); 10763 10764// Don't apply patches for specified codes. Helpful for code bases 10765// where some Migrate warnings have been addressed and it's desirable 10766// to avoid needless patches or false positives. 10767jQuery.migrateDisablePatches = function() { 10768 var i; 10769 for ( i = 0; i < arguments.length; i++ ) { 10770 disabledPatches[ arguments[ i ] ] = true; 10771 } 10772}; 10773 10774// Allow enabling patches disabled via `jQuery.migrateDisablePatches`. 10775// Helpful if you want to disable a patch only for some code that won't 10776// be updated soon to be able to focus on other warnings - and enable it 10777// immediately after such a call: 10778// ```js 10779// jQuery.migrateDisablePatches( "workaroundA" ); 10780// elem.pluginViolatingWarningA( "pluginMethod" ); 10781// jQuery.migrateEnablePatches( "workaroundA" ); 10782// ``` 10783jQuery.migrateEnablePatches = function() { 10784 var i; 10785 for ( i = 0; i < arguments.length; i++ ) { 10786 delete disabledPatches[ arguments[ i ] ]; 10787 } 10788}; 10789 10790jQuery.migrateIsPatchEnabled = function( patchCode ) { 10791 return !disabledPatches[ patchCode ]; 10792}; 10793 10794( function() { 10795 10796// Support: IE9 only 10797// IE9 only creates console object when dev tools are first opened 10798// IE9 console is a host object, callable but doesn't have .apply() 10799if ( !window.console || !window.console.log ) { 10800 return; 10801} 10802 10803// Need jQuery 3.x-4.x and no older Migrate loaded 10804if ( !jQuery || !jQueryVersionSince( "3.0.0" ) || 10805 jQueryVersionSince( "5.0.0" ) ) { 10806 window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" ); 10807} 10808if ( jQuery.migrateWarnings ) { 10809 window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" ); 10810} 10811 10812// Show a message on the console so devs know we're active 10813window.console.log( "JQMIGRATE: Migrate is installed" + 10814 ( jQuery.migrateMute ? "" : " with logging active" ) + 10815 ", version " + jQuery.migrateVersion ); 10816 10817} )(); 10818 10819var warnedAbout = {}; 10820 10821// By default each warning is only reported once. 10822jQuery.migrateDeduplicateWarnings = true; 10823 10824// List of warnings already given; public read only 10825jQuery.migrateWarnings = []; 10826 10827// Set to false to disable traces that appear with warnings 10828if ( jQuery.migrateTrace === undefined ) { 10829 jQuery.migrateTrace = true; 10830} 10831 10832// Forget any warnings we've already given; public 10833jQuery.migrateReset = function() { 10834 warnedAbout = {}; 10835 jQuery.migrateWarnings.length = 0; 10836}; 10837 10838function migrateWarn( code, msg ) { 10839 var console = window.console; 10840 if ( jQuery.migrateIsPatchEnabled( code ) && 10841 ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) ) { 10842 warnedAbout[ msg ] = true; 10843 jQuery.migrateWarnings.push( msg + " [" + code + "]" ); 10844 if ( console && console.warn && !jQuery.migrateMute ) { 10845 console.warn( "JQMIGRATE: " + msg ); 10846 if ( jQuery.migrateTrace && console.trace ) { 10847 console.trace(); 10848 } 10849 } 10850 } 10851} 10852 10853function migrateWarnProp( obj, prop, value, code, msg ) { 10854 Object.defineProperty( obj, prop, { 10855 configurable: true, 10856 enumerable: true, 10857 get: function() { 10858 migrateWarn( code, msg ); 10859 return value; 10860 }, 10861 set: function( newValue ) { 10862 migrateWarn( code, msg ); 10863 value = newValue; 10864 } 10865 } ); 10866} 10867 10868function migrateWarnFuncInternal( obj, prop, newFunc, code, msg ) { 10869 var finalFunc, 10870 origFunc = obj[ prop ]; 10871 10872 obj[ prop ] = function() { 10873 10874 // If `msg` not provided, do not warn; more sophisticated warnings 10875 // logic is most likely embedded in `newFunc`, in that case here 10876 // we just care about the logic choosing the proper implementation 10877 // based on whether the patch is disabled or not. 10878 if ( msg ) { 10879 migrateWarn( code, msg ); 10880 } 10881 10882 // Since patches can be disabled & enabled dynamically, we 10883 // need to decide which implementation to run on each invocation. 10884 finalFunc = jQuery.migrateIsPatchEnabled( code ) ? 10885 newFunc : 10886
10887 // The function may not have existed originally so we need a fallback. 10888 ( origFunc || jQuery.noop ); 10889 10890 return finalFunc.apply( this, arguments ); 10891 }; 10892} 10893 10894function migratePatchAndWarnFunc( obj, prop, newFunc, code, msg ) { 10895 if ( !msg ) { 10896 throw new Error( "No warning message provided" ); 10897 } 10898 return migrateWarnFuncInternal( obj, prop, newFunc, code, msg ); 10899} 10900 10901function migratePatchFunc( obj, prop, newFunc, code ) { 10902 return migrateWarnFuncInternal( obj, prop, newFunc, code ); 10903} 10904 10905if ( window.document.compatMode === "BackCompat" ) { 10906 10907 // jQuery has never supported or tested Quirks Mode 10908 migrateWarn( "quirks", "jQuery is not compatible with Quirks Mode" ); 10909} 10910 10911var findProp, 10912 class2type = {}, 10913 oldInit = jQuery.fn.init, 10914 oldFind = jQuery.find, 10915 10916 rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, 10917 rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g, 10918 10919 // Require that the "whitespace run" starts from a non-whitespace 10920 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10921 rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10922 10923migratePatchFunc( jQuery.fn, "init", function( arg1 ) { 10924 var args = Array.prototype.slice.call( arguments ); 10925 10926 if ( jQuery.migrateIsPatchEnabled( "selector-empty-id" ) && 10927 typeof arg1 === "string" && arg1 === "#" ) { 10928 10929 // JQuery( "#" ) is a bogus ID selector, but it returned an empty set 10930 // before jQuery 3.0 10931 migrateWarn( "selector-empty-id", "jQuery( '#' ) is not a valid selector" ); 10932 args[ 0 ] = []; 10933 } 10934 10935 return oldInit.apply( this, args ); 10936}, "selector-empty-id" ); 10937 10938// This is already done in Core but the above patch will lose this assignment 10939// so we need to redo it. It doesn't matter whether the patch is enabled or not 10940// as the method is always going to be a Migrate-created wrapper. 10941jQuery.fn.init.prototype = jQuery.fn; 10942 10943migratePatchFunc( jQuery, "find", function( selector ) { 10944 var args = Array.prototype.slice.call( arguments ); 10945 10946 // Support: PhantomJS 1.x 10947 // String#match fails to match when used with a //g RegExp, only on some strings 10948 if ( typeof selector === "string" && rattrHashTest.test( selector ) ) { 10949 10950 // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0 10951 // First see if qS thinks it's a valid selector, if so avoid a false positive 10952 try { 10953 window.document.querySelector( selector ); 10954 } catch ( err1 ) { 10955 10956 // Didn't *look* valid to qSA, warn and try quoting what we think is the value 10957 selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) { 10958 return "[" + attr + op + "\"" + value + "\"]"; 10959 } ); 10960 10961 // If the regexp *may* have created an invalid selector, don't update it 10962 // Note that there may be false alarms if selector uses jQuery extensions 10963 try { 10964 window.document.querySelector( selector ); 10965 migrateWarn( "selector-hash", 10966 "Attribute selector with '#' must be quoted: " + args[ 0 ] ); 10967 args[ 0 ] = selector; 10968 } catch ( err2 ) { 10969 migrateWarn( "selector-hash", 10970 "Attribute selector with '#' was not fixed: " + args[ 0 ] ); 10971 } 10972 } 10973 } 10974 10975 return oldFind.apply( this, args ); 10976}, "selector-hash" ); 10977 10978// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML) 10979for ( findProp in oldFind ) { 10980 if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) { 10981 jQuery.find[ findProp ] = oldFind[ findProp ]; 10982 } 10983} 10984 10985// The number of elements contained in the matched element set 10986migratePatchAndWarnFunc( jQuery.fn, "size", function() { 10987 return this.length; 10988}, "size", 10989"jQuery.fn.size() is deprecated and removed; use the .length property" ); 10990 10991migratePatchAndWarnFunc( jQuery, "parseJSON", function() { 10992 return JSON.parse.apply( null, arguments ); 10993}, "parseJSON", 10994"jQuery.parseJSON is deprecated; use JSON.parse" ); 10995 10996migratePatchAndWarnFunc( jQuery, "holdReady", jQuery.holdReady, 10997 "holdReady", "jQuery.holdReady is deprecated" ); 10998 10999migratePatchAndWarnFunc( jQuery, "unique", jQuery.uniqueSort, 11000 "unique", "jQuery.unique is deprecated; use jQuery.uniqueSort" ); 11001 11002// Now jQuery.expr.pseudos is the standard incantation 11003migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, "expr-pre-pseudos", 11004 "jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" ); 11005migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, "expr-pre-pseudos", 11006 "jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" ); 11007 11008// Prior to jQuery 3.1.1 there were internal refs so we don't warn there 11009if ( jQueryVersionSince( "3.1.1" ) ) { 11010 migratePatchAndWarnFunc( jQuery, "trim", function( text ) { 11011 return text == null ? 11012 "" :
11013 ( text + "" ).replace( rtrim, "$1" ); 11014 }, "trim", 11015 "jQuery.trim is deprecated; use String.prototype.trim" ); 11016} 11017 11018// Prior to jQuery 3.2 there were internal refs so we don't warn there 11019if ( jQueryVersionSince( "3.2.0" ) ) { 11020 migratePatchAndWarnFunc( jQuery, "nodeName", function( elem, name ) { 11021 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 11022 }, "nodeName", 11023 "jQuery.nodeName is deprecated" ); 11024 11025 migratePatchAndWarnFunc( jQuery, "isArray", Array.isArray, "isArray", 11026 "jQuery.isArray is deprecated; use Array.isArray" 11027 ); 11028} 11029 11030if ( jQueryVersionSince( "3.3.0" ) ) { 11031 11032 migratePatchAndWarnFunc( jQuery, "isNumeric", 11033 function( obj ) { 11034 11035 // As of jQuery 3.0, isNumeric is limited to 11036 // strings and numbers (primitives or objects) 11037 // that can be coerced to finite numbers (gh-2662) 11038 var type = typeof obj; 11039 return ( type === "number" || type === "string" ) && 11040 11041 // parseFloat NaNs numeric-cast false positives ("") 11042 // ...but misinterprets leading-number strings, e.g. hex literals ("0x...") 11043 // subtraction forces infinities to NaN 11044 !isNaN( obj - parseFloat( obj ) ); 11045 }, "isNumeric", 11046 "jQuery.isNumeric() is deprecated" 11047 ); 11048 11049 // Populate the class2type map 11050 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol". 11051 split( " " ), 11052 function( _, name ) { 11053 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 11054 } ); 11055 11056 migratePatchAndWarnFunc( jQuery, "type", function( obj ) { 11057 if ( obj == null ) { 11058 return obj + ""; 11059 } 11060 11061 // Support: Android <=2.3 only (functionish RegExp) 11062 return typeof obj === "object" || typeof obj === "function" ? 11063 class2type[ Object.prototype.toString.call( obj ) ] || "object" : 11064 typeof obj; 11065 }, "type", 11066 "jQuery.type is deprecated" ); 11067 11068 migratePatchAndWarnFunc( jQuery, "isFunction", 11069 function( obj ) { 11070 return typeof obj === "function"; 11071 }, "isFunction", 11072 "jQuery.isFunction() is deprecated" ); 11073 11074 migratePatchAndWarnFunc( jQuery, "isWindow", 11075 function( obj ) { 11076 return obj != null && obj === obj.window; 11077 }, "isWindow", 11078 "jQuery.isWindow() is deprecated" 11079 ); 11080} 11081 11082// Support jQuery slim which excludes the ajax module 11083if ( jQuery.ajax ) { 11084 11085var oldAjax = jQuery.ajax, 11086 rjsonp = /(=)\?(?=&|$)|\?\?/; 11087 11088migratePatchFunc( jQuery, "ajax", function() { 11089 var jQXHR = oldAjax.apply( this, arguments ); 11090 11091 // Be sure we got a jQXHR (e.g., not sync) 11092 if ( jQXHR.promise ) { 11093 migratePatchAndWarnFunc( jQXHR, "success", jQXHR.done, "jqXHR-methods", 11094 "jQXHR.success is deprecated and removed" ); 11095 migratePatchAndWarnFunc( jQXHR, "error", jQXHR.fail, "jqXHR-methods", 11096 "jQXHR.error is deprecated and removed" ); 11097 migratePatchAndWarnFunc( jQXHR, "complete", jQXHR.always, "jqXHR-methods", 11098 "jQXHR.complete is deprecated and removed" ); 11099 } 11100 11101 return jQXHR; 11102}, "jqXHR-methods" ); 11103 11104// Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion 11105// behavior is gone in jQuery 4.0 and as it has security implications, we don't 11106// want to restore the legacy behavior. 11107if ( !jQueryVersionSince( "4.0.0" ) ) { 11108 11109 // Register this prefilter before the jQuery one. Otherwise, a promoted 11110 // request is transformed into one with the script dataType and we can't 11111 // catch it anymore. 11112 jQuery.ajaxPrefilter( "+json", function( s ) { 11113 11114 // Warn if JSON-to-JSONP auto-promotion happens. 11115 if ( s.jsonp !== false && ( rjsonp.test( s.url ) || 11116 typeof s.data === "string" && 11117 ( s.contentType || "" ) 11118 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 11119 rjsonp.test( s.data ) 11120 ) ) { 11121 migrateWarn( "jsonp-promotion", "JSON-to-JSONP auto-promotion is deprecated" ); 11122 } 11123 } ); 11124} 11125 11126} 11127 11128var oldRemoveAttr = jQuery.fn.removeAttr, 11129 oldToggleClass = jQuery.fn.toggleClass, 11130 rbooleans = /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i, 11131 rmatchNonSpace = /\S+/g; 11132 11133migratePatchFunc( jQuery.fn, "removeAttr", function( name ) { 11134 var self = this, 11135 patchNeeded = false; 11136 11137 jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) { 11138 if ( rbooleans.test( attr ) ) { 11139 11140 // Only warn if at least a single node had the property set to 11141 // something else than `false`. Otherwise, this Migrate patch 11142 // doesn't influence the behavior and there's no need to set or warn. 11143 self.each( function() { 11144 if ( jQuery( this ).prop( attr ) !== false ) { 11145 patchNeeded = true; 11146 return false;
11147 } 11148 } ); 11149 } 11150 11151 if ( patchNeeded ) { 11152 migrateWarn( "removeAttr-bool", 11153 "jQuery.fn.removeAttr no longer sets boolean properties: " + attr ); 11154 self.prop( attr, false ); 11155 } 11156 } ); 11157 11158 return oldRemoveAttr.apply( this, arguments ); 11159}, "removeAttr-bool" ); 11160 11161migratePatchFunc( jQuery.fn, "toggleClass", function( state ) { 11162 11163 // Only deprecating no-args or single boolean arg 11164 if ( state !== undefined && typeof state !== "boolean" ) { 11165 11166 return oldToggleClass.apply( this, arguments ); 11167 } 11168 11169 migrateWarn( "toggleClass-bool", "jQuery.fn.toggleClass( boolean ) is deprecated" ); 11170 11171 // Toggle entire class name of each element 11172 return this.each( function() { 11173 var className = this.getAttribute && this.getAttribute( "class" ) || ""; 11174 11175 if ( className ) { 11176 jQuery.data( this, "__className__", className ); 11177 } 11178 11179 // If the element has a class name or if we're passed `false`, 11180 // then remove the whole classname (if there was one, the above saved it). 11181 // Otherwise bring back whatever was previously saved (if anything), 11182 // falling back to the empty string if nothing was stored. 11183 if ( this.setAttribute ) { 11184 this.setAttribute( "class", 11185 className || state === false ? 11186 "" : 11187 jQuery.data( this, "__className__" ) || "" 11188 ); 11189 } 11190 } ); 11191}, "toggleClass-bool" ); 11192 11193function camelCase( string ) { 11194 return string.replace( /-([a-z])/g, function( _, letter ) { 11195 return letter.toUpperCase(); 11196 } ); 11197} 11198 11199var origFnCss, internalCssNumber, 11200 internalSwapCall = false, 11201 ralphaStart = /^[a-z]/, 11202 11203 // The regex visualized: 11204 // 11205 // /----------\ 11206 // | | /-------\ 11207 // | / Top \ | | | 11208 // /--- Border ---+-| Right |-+---+- Width -+---\ 11209 // | | Bottom | | 11210 // | \ Left / | 11211 // | | 11212 // | /----------\ | 11213 // | /-------------\ | | |- END 11214 // | | | | / Top \ | | 11215 // | | / Margin \ | | | Right | | | 11216 // |---------+-| |-+---+-| Bottom |-+----| 11217 // | \ Padding / \ Left / | 11218 // BEGIN -| | 11219 // | /---------\ | 11220 // | | | | 11221 // | | / Min \ | / Width \ | 11222 // \--------------+-| |-+---| |---/ 11223 // \ Max / \ Height / 11224 rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/; 11225 11226// If this version of jQuery has .swap(), don't false-alarm on internal uses 11227if ( jQuery.swap ) { 11228 jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) { 11229 var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get; 11230 11231 if ( oldHook ) { 11232 jQuery.cssHooks[ name ].get = function() { 11233 var ret; 11234 11235 internalSwapCall = true; 11236 ret = oldHook.apply( this, arguments ); 11237 internalSwapCall = false; 11238 return ret; 11239 }; 11240 } 11241 } ); 11242} 11243 11244migratePatchFunc( jQuery, "swap", function( elem, options, callback, args ) { 11245 var ret, name, 11246 old = {}; 11247 11248 if ( !internalSwapCall ) { 11249 migrateWarn( "swap", "jQuery.swap() is undocumented and deprecated" ); 11250 } 11251 11252 // Remember the old values, and insert the new ones 11253 for ( name in options ) { 11254 old[ name ] = elem.style[ name ]; 11255 elem.style[ name ] = options[ name ]; 11256 } 11257 11258 ret = callback.apply( elem, args || [] ); 11259 11260 // Revert the old values 11261 for ( name in options ) { 11262 elem.style[ name ] = old[ name ]; 11263 } 11264 11265 return ret; 11266}, "swap" ); 11267 11268if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) { 11269 jQuery.cssProps = new Proxy( jQuery.cssProps || {}, { 11270 set: function() { 11271 migrateWarn( "cssProps", "jQuery.cssProps is deprecated" ); 11272 return Reflect.set.apply( this, arguments ); 11273 } 11274 } ); 11275} 11276 11277// In jQuery >=4 where jQuery.cssNumber is missing fill it with the latest 3.x version: 11278// https://github.com/jquery/jquery/blob/3.7.1/src/css.js#L216-L246 11279// This way, number values for the CSS properties below won't start triggering 11280// Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438). 11281if ( jQueryVersionSince( "4.0.0" ) ) { 11282 11283 // We need to keep this as a local variable as we need it internally 11284 // in a `jQuery.fn.css` patch and this usage shouldn't warn. 11285 internalCssNumber = { 11286 animationIterationCount: true, 11287 aspectRatio: true, 11288 borderImageSlice: true, 11289 columnCount: true, 11290 flexGrow: true, 11291 flexShrink: true, 11292 fontWeight: true, 11293 gridArea: true, 11294 gridColumn: true, 11295 gridColumnEnd: true, 11296 gridColumnStart: true, 11297 gridRow: true, 11298 gridRowEnd: true, 11299 gridRowStart: true, 11300 lineHeight: true, 11301 opacity: true, 11302 order: true, 11303 orphans: true, 11304 scale: true, 11305 widows: true, 11306 zIndex: true, 11307 zoom: true, 11308 11309 // SVG-related 11310 fillOpacity: true, 11311 floodOpacity: true, 11312 stopOpacity: true, 11313 strokeMiterlimit: true, 11314 strokeOpacity: true 11315 }; 11316 11317 if ( typeof Proxy !== "undefined" ) { 11318 jQuery.cssNumber = new Proxy( internalCssNumber, { 11319 get: function() { 11320 migrateWarn( "css-number", "jQuery.cssNumber is deprecated" ); 11321 return Reflect.get.apply( this, arguments ); 11322 },
11323 set: function() { 11324 migrateWarn( "css-number", "jQuery.cssNumber is deprecated" ); 11325 return Reflect.set.apply( this, arguments ); 11326 } 11327 } ); 11328 } else { 11329 11330 // Support: IE 9-11+ 11331 // IE doesn't support proxies, but we still want to restore the legacy 11332 // jQuery.cssNumber there. 11333 jQuery.cssNumber = internalCssNumber; 11334 } 11335} else { 11336 11337 // Make `internalCssNumber` defined for jQuery <4 as well as it's needed 11338 // in the `jQuery.fn.css` patch below. 11339 internalCssNumber = jQuery.cssNumber; 11340} 11341 11342function isAutoPx( prop ) { 11343 11344 // The first test is used to ensure that: 11345 // 1. The prop starts with a lowercase letter (as we uppercase it for the second regex). 11346 // 2. The prop is not empty. 11347 return ralphaStart.test( prop ) && 11348 rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) ); 11349} 11350 11351origFnCss = jQuery.fn.css; 11352 11353migratePatchFunc( jQuery.fn, "css", function( name, value ) { 11354 var camelName, 11355 origThis = this; 11356 11357 if ( name && typeof name === "object" && !Array.isArray( name ) ) { 11358 jQuery.each( name, function( n, v ) { 11359 jQuery.fn.css.call( origThis, n, v ); 11360 } ); 11361 return this; 11362 } 11363 11364 if ( typeof value === "number" ) { 11365 camelName = camelCase( name ); 11366 11367 // Use `internalCssNumber` to avoid triggering our warnings in this 11368 // internal check. 11369 if ( !isAutoPx( camelName ) && !internalCssNumber[ camelName ] ) { 11370 migrateWarn( "css-number", 11371 "Number-typed values are deprecated for jQuery.fn.css( \"" + 11372 name + "\", value )" ); 11373 } 11374 } 11375 11376 return origFnCss.apply( this, arguments ); 11377}, "css-number" ); 11378 11379var origData = jQuery.data; 11380 11381migratePatchFunc( jQuery, "data", function( elem, name, value ) { 11382 var curData, sameKeys, key; 11383 11384 // Name can be an object, and each entry in the object is meant to be set as data 11385 if ( name && typeof name === "object" && arguments.length === 2 ) { 11386 11387 curData = jQuery.hasData( elem ) && origData.call( this, elem ); 11388 sameKeys = {}; 11389 for ( key in name ) { 11390 if ( key !== camelCase( key ) ) { 11391 migrateWarn( "data-camelCase", 11392 "jQuery.data() always sets/gets camelCased names: " + key ); 11393 curData[ key ] = name[ key ]; 11394 } else { 11395 sameKeys[ key ] = name[ key ]; 11396 } 11397 } 11398 11399 origData.call( this, elem, sameKeys ); 11400 11401 return name; 11402 } 11403 11404 // If the name is transformed, look for the un-transformed name in the data object 11405 if ( name && typeof name === "string" && name !== camelCase( name ) ) { 11406 11407 curData = jQuery.hasData( elem ) && origData.call( this, elem ); 11408 if ( curData && name in curData ) { 11409 migrateWarn( "data-camelCase", 11410 "jQuery.data() always sets/gets camelCased names: " + name ); 11411 if ( arguments.length > 2 ) { 11412 curData[ name ] = value; 11413 } 11414 return curData[ name ]; 11415 } 11416 } 11417 11418 return origData.apply( this, arguments ); 11419}, "data-camelCase" ); 11420 11421// Support jQuery slim which excludes the effects module 11422if ( jQuery.fx ) { 11423 11424var intervalValue, intervalMsg, 11425 oldTweenRun = jQuery.Tween.prototype.run, 11426 linearEasing = function( pct ) { 11427 return pct; 11428 }; 11429 11430migratePatchFunc( jQuery.Tween.prototype, "run", function( ) { 11431 if ( jQuery.easing[ this.easing ].length > 1 ) { 11432 migrateWarn( 11433 "easing-one-arg", 11434 "'jQuery.easing." + this.easing.toString() + "' should use only one argument" 11435 ); 11436 11437 jQuery.easing[ this.easing ] = linearEasing; 11438 } 11439 11440 oldTweenRun.apply( this, arguments ); 11441}, "easing-one-arg" ); 11442 11443intervalValue = jQuery.fx.interval; 11444intervalMsg = "jQuery.fx.interval is deprecated"; 11445 11446// Support: IE9, Android <=4.4 11447// Avoid false positives on browsers that lack rAF 11448// Don't warn if document is hidden, jQuery uses setTimeout (#292) 11449if ( window.requestAnimationFrame ) { 11450 Object.defineProperty( jQuery.fx, "interval", { 11451 configurable: true, 11452 enumerable: true, 11453 get: function() { 11454 if ( !window.document.hidden ) { 11455 migrateWarn( "fx-interval", intervalMsg ); 11456 } 11457 11458 // Only fallback to the default if patch is enabled 11459 if ( !jQuery.migrateIsPatchEnabled( "fx-interval" ) ) { 11460 return intervalValue; 11461 } 11462 return intervalValue === undefined ? 13 : intervalValue; 11463 }, 11464 set: function( newValue ) { 11465 migrateWarn( "fx-interval", intervalMsg ); 11466 intervalValue = newValue; 11467 } 11468 } ); 11469} 11470 11471} 11472 11473var oldLoad = jQuery.fn.load, 11474 oldEventAdd = jQuery.event.add, 11475 originalFix = jQuery.event.fix; 11476 11477jQuery.event.props = []; 11478jQuery.event.fixHooks = {}; 11479 11480migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
11481 "event-old-patch", 11482 "jQuery.event.props.concat() is deprecated and removed" ); 11483 11484migratePatchFunc( jQuery.event, "fix", function( originalEvent ) { 11485 var event, 11486 type = originalEvent.type, 11487 fixHook = this.fixHooks[ type ], 11488 props = jQuery.event.props; 11489 11490 if ( props.length ) { 11491 migrateWarn( "event-old-patch", 11492 "jQuery.event.props are deprecated and removed: " + props.join() ); 11493 while ( props.length ) { 11494 jQuery.event.addProp( props.pop() ); 11495 } 11496 } 11497 11498 if ( fixHook && !fixHook._migrated_ ) { 11499 fixHook._migrated_ = true; 11500 migrateWarn( "event-old-patch", 11501 "jQuery.event.fixHooks are deprecated and removed: " + type ); 11502 if ( ( props = fixHook.props ) && props.length ) { 11503 while ( props.length ) { 11504 jQuery.event.addProp( props.pop() ); 11505 } 11506 } 11507 } 11508 11509 event = originalFix.call( this, originalEvent ); 11510 11511 return fixHook && fixHook.filter ? 11512 fixHook.filter( event, originalEvent ) : 11513 event; 11514}, "event-old-patch" ); 11515 11516migratePatchFunc( jQuery.event, "add", function( elem, types ) { 11517 11518 // This misses the multiple-types case but that seems awfully rare 11519 if ( elem === window && types === "load" && window.document.readyState === "complete" ) { 11520 migrateWarn( "load-after-event", 11521 "jQuery(window).on('load'...) called after load event occurred" ); 11522 } 11523 return oldEventAdd.apply( this, arguments ); 11524}, "load-after-event" ); 11525 11526jQuery.each( [ "load", "unload", "error" ], function( _, name ) { 11527 11528 migratePatchFunc( jQuery.fn, name, function() { 11529 var args = Array.prototype.slice.call( arguments, 0 ); 11530 11531 // If this is an ajax load() the first arg should be the string URL; 11532 // technically this could also be the "Anything" arg of the event .load() 11533 // which just goes to show why this dumb signature has been deprecated! 11534 // jQuery custom builds that exclude the Ajax module justifiably die here. 11535 if ( name === "load" && typeof args[ 0 ] === "string" ) { 11536 return oldLoad.apply( this, args ); 11537 } 11538 11539 migrateWarn( "shorthand-removed-v3", 11540 "jQuery.fn." + name + "() is deprecated" ); 11541 11542 args.splice( 0, 0, name ); 11543 if ( arguments.length ) { 11544 return this.on.apply( this, args ); 11545 } 11546 11547 // Use .triggerHandler here because: 11548 // - load and unload events don't need to bubble, only applied to window or image 11549 // - error event should not bubble to window, although it does pre-1.7 11550 // See http://bugs.jquery.com/ticket/11820 11551 this.triggerHandler.apply( this, args ); 11552 return this; 11553 }, "shorthand-removed-v3" ); 11554 11555} ); 11556 11557jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 11558 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 11559 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 11560function( _i, name ) { 11561 11562 // Handle event binding 11563 migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) { 11564 return arguments.length > 0 ? 11565 this.on( name, null, data, fn ) : 11566 this.trigger( name ); 11567 }, 11568 "shorthand-deprecated-v3", 11569 "jQuery.fn." + name + "() event shorthand is deprecated" ); 11570} ); 11571 11572// Trigger "ready" event only once, on document ready 11573jQuery( function() { 11574 jQuery( window.document ).triggerHandler( "ready" ); 11575} ); 11576 11577jQuery.event.special.ready = { 11578 setup: function() { 11579 if ( this === window.document ) { 11580 migrateWarn( "ready-event", "'ready' event is deprecated" ); 11581 } 11582 } 11583}; 11584 11585migratePatchAndWarnFunc( jQuery.fn, "bind", function( types, data, fn ) { 11586 return this.on( types, null, data, fn ); 11587}, "pre-on-methods", "jQuery.fn.bind() is deprecated" ); 11588migratePatchAndWarnFunc( jQuery.fn, "unbind", function( types, fn ) { 11589 return this.off( types, null, fn ); 11590}, "pre-on-methods", "jQuery.fn.unbind() is deprecated" ); 11591migratePatchAndWarnFunc( jQuery.fn, "delegate", function( selector, types, data, fn ) { 11592 return this.on( types, selector, data, fn ); 11593}, "pre-on-methods", "jQuery.fn.delegate() is deprecated" ); 11594migratePatchAndWarnFunc( jQuery.fn, "undelegate", function( selector, types, fn ) { 11595 return arguments.length === 1 ? 11596 this.off( selector, "**" ) : 11597 this.off( types, selector || "**", fn ); 11598}, "pre-on-methods", "jQuery.fn.undelegate() is deprecated" ); 11599migratePatchAndWarnFunc( jQuery.fn, "hover", function( fnOver, fnOut ) { 11600 return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver ); 11601}, "pre-on-methods", "jQuery.fn.hover() is deprecated" ); 11602 11603var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 11604 makeMarkup = function( html ) { 11605 var doc = window.document.implementation.createHTMLDocument( "" ); 11606 doc.body.innerHTML = html; 11607 return doc.body && doc.body.innerHTML; 11608 }, 11609 warnIfChanged = function( html ) { 11610 var changed = html.replace( rxhtmlTag, "<$1></$2>" ); 11611 if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) { 11612 migrateWarn( "self-closed-tags", 11613 "HTML tags must be properly nested and closed: " + html ); 11614 } 11615 }; 11616 11617/**
11618 * Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead. 11619 * @deprecated 11620 */ 11621migratePatchAndWarnFunc( jQuery, "UNSAFE_restoreLegacyHtmlPrefilter", function() { 11622 jQuery.migrateEnablePatches( "self-closed-tags" ); 11623}, "legacy-self-closed-tags", 11624"jQuery.UNSAFE_restoreLegacyHtmlPrefilter deprecated; use " + 11625 "`jQuery.migrateEnablePatches( \"self-closed-tags\" )`" ); 11626 11627migratePatchFunc( jQuery, "htmlPrefilter", function( html ) { 11628 warnIfChanged( html ); 11629 return html.replace( rxhtmlTag, "<$1></$2>" ); 11630}, "self-closed-tags" ); 11631 11632// This patch needs to be disabled by default as it re-introduces 11633// security issues (CVE-2020-11022, CVE-2020-11023). 11634jQuery.migrateDisablePatches( "self-closed-tags" ); 11635 11636var origOffset = jQuery.fn.offset; 11637 11638migratePatchFunc( jQuery.fn, "offset", function() { 11639 var elem = this[ 0 ]; 11640 11641 if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) { 11642 migrateWarn( "offset-valid-elem", "jQuery.fn.offset() requires a valid DOM element" ); 11643 return arguments.length ? this : undefined; 11644 } 11645 11646 return origOffset.apply( this, arguments ); 11647}, "offset-valid-elem" ); 11648 11649// Support jQuery slim which excludes the ajax module 11650// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional` 11651// so it doesn't make sense for the slim build. 11652if ( jQuery.ajax ) { 11653 11654var origParam = jQuery.param; 11655 11656migratePatchFunc( jQuery, "param", function( data, traditional ) { 11657 var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 11658 11659 if ( traditional === undefined && ajaxTraditional ) { 11660 11661 migrateWarn( "param-ajax-traditional", 11662 "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" ); 11663 traditional = ajaxTraditional; 11664 } 11665 11666 return origParam.call( this, data, traditional ); 11667}, "param-ajax-traditional" ); 11668 11669} 11670 11671migratePatchAndWarnFunc( jQuery.fn, "andSelf", jQuery.fn.addBack, "andSelf", 11672 "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" ); 11673 11674// Support jQuery slim which excludes the deferred module in jQuery 4.0+ 11675if ( jQuery.Deferred ) { 11676 11677var oldDeferred = jQuery.Deferred, 11678 tuples = [ 11679 11680 // Action, add listener, callbacks, .then handlers, final state 11681 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 11682 jQuery.Callbacks( "once memory" ), "resolved" ], 11683 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 11684 jQuery.Callbacks( "once memory" ), "rejected" ], 11685 [ "notify", "progress", jQuery.Callbacks( "memory" ), 11686 jQuery.Callbacks( "memory" ) ] 11687 ]; 11688 11689migratePatchFunc( jQuery, "Deferred", function( func ) { 11690 var deferred = oldDeferred(), 11691 promise = deferred.promise(); 11692 11693 function newDeferredPipe( /* fnDone, fnFail, fnProgress */ ) { 11694 var fns = arguments; 11695 11696 return jQuery.Deferred( function( newDefer ) { 11697 jQuery.each( tuples, function( i, tuple ) { 11698 var fn = typeof fns[ i ] === "function" && fns[ i ]; 11699 11700 // Deferred.done(function() { bind to newDefer or newDefer.resolve }) 11701 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 11702 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 11703 deferred[ tuple[ 1 ] ]( function() { 11704 var returned = fn && fn.apply( this, arguments ); 11705 if ( returned && typeof returned.promise === "function" ) { 11706 returned.promise() 11707 .done( newDefer.resolve ) 11708 .fail( newDefer.reject ) 11709 .progress( newDefer.notify ); 11710 } else { 11711 newDefer[ tuple[ 0 ] + "With" ]( 11712 this === promise ? newDefer.promise() : this, 11713 fn ? [ returned ] : arguments 11714 ); 11715 } 11716 } ); 11717 } ); 11718 fns = null; 11719 } ).promise(); 11720 } 11721 11722 migratePatchAndWarnFunc( deferred, "pipe", newDeferredPipe, "deferred-pipe", 11723 "deferred.pipe() is deprecated" ); 11724 migratePatchAndWarnFunc( promise, "pipe", newDeferredPipe, "deferred-pipe", 11725 "deferred.pipe() is deprecated" ); 11726 11727 if ( func ) { 11728 func.call( deferred, deferred ); 11729 } 11730 11731 return deferred; 11732}, "deferred-pipe" ); 11733 11734// Preserve handler of uncaught exceptions in promise chains 11735jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook; 11736 11737} 11738 11739return jQuery; 11740} ); 11741/* jshint node: true */ 11742 11743/** 11744 * Unobtrusive scripting adapter for jQuery 11745 * https://github.com/rails/jquery-ujs 11746 * 11747 * Requires jQuery 1.8.0 or later. 11748 * 11749 * Released under the MIT license 11750 * 11751 */ 11752 11753(function() { 11754 'use strict'; 11755 11756 var jqueryUjsInit = function($, undefined) { 11757 11758 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 11759 // by detecting and raising an error when it happens. 11760 if ( $.rails !== undefined ) { 11761 $.error('jquery-ujs has already been loaded!'); 11762 } 11763 11764 // Shorthand to make it a little easier to call public rails functions from within rails.js 11765 var rails; 11766 var $document = $(document); 11767 11768 $.rails = rails = { 11769 // Link elements bound by jquery-ujs 11770 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', 11771 11772 // Button elements bound by jquery-ujs 11773 buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)', 11774 11775 // Select elements bound by jquery-ujs 11776 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 11777 11778 // Form elements bound by jquery-ujs 11779 formSubmitSelector: 'form:not([data-turbo=true])', 11780 11781 // Form input elements bound by jquery-ujs 11782 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])', 11783 11784 // Form input elements disabled during form submission 11785 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', 11786 11787 // Form input elements re-enabled after form submission 11788 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', 11789 11790 // Form required input elements 11791 requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])', 11792 11793 // Form file input elements 11794 fileInputSelector: 'input[name][type=file]:not([disabled])', 11795 11796 // Link onClick disable selector with possible reenable after remote submission 11797 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 11798 11799 // Button onClick disable selector with possible reenable after remote submission 11800 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 11801 11802 // Up-to-date Cross-Site Request Forgery token 11803 csrfToken: function() { 11804 return $('meta[name=csrf-token]').attr('content'); 11805 }, 11806 11807 // URL param that must contain the CSRF token
11808 csrfParam: function() { 11809 return $('meta[name=csrf-param]').attr('content'); 11810 }, 11811 11812 // Make sure that every Ajax request sends the CSRF token 11813 CSRFProtection: function(xhr) { 11814 var token = rails.csrfToken(); 11815 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 11816 }, 11817 11818 // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) 11819 refreshCSRFTokens: function(){ 11820 $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); 11821 }, 11822 11823 // Triggers an event on an element and returns false if the event result is false 11824 fire: function(obj, name, data) { 11825 var event = $.Event(name); 11826 obj.trigger(event, data); 11827 return event.result !== false; 11828 }, 11829 11830 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 11831 confirm: function(message) { 11832 return confirm(message); 11833 }, 11834 11835 // Default ajax function, may be overridden with custom function in $.rails.ajax 11836 ajax: function(options) { 11837 return $.ajax(options); 11838 }, 11839 11840 // Default way to get an element's href. May be overridden at $.rails.href. 11841 href: function(element) { 11842 return element[0].href; 11843 }, 11844 11845 // Checks "data-remote" if true to handle the request through a XHR request. 11846 isRemote: function(element) { 11847 return element.data('remote') !== undefined && element.data('remote') !== false; 11848 }, 11849 11850 // Submits "remote" forms and links with ajax 11851 handleRemote: function(element) { 11852 var method, url, data, withCredentials, dataType, options; 11853 11854 if (rails.fire(element, 'ajax:before')) { 11855 withCredentials = element.data('with-credentials') || null; 11856 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 11857 11858 if (element.is('form')) { 11859 method = element.data('ujs:submit-button-formmethod') || element.attr('method'); 11860 url = element.data('ujs:submit-button-formaction') || element.attr('action'); 11861 data = $(element[0]).serializeArray(); 11862 // memoized value from clicked submit button 11863 var button = element.data('ujs:submit-button'); 11864 if (button) { 11865 data.push(button); 11866 element.data('ujs:submit-button', null); 11867 } 11868 element.data('ujs:submit-button-formmethod', null); 11869 element.data('ujs:submit-button-formaction', null); 11870 } else if (element.is(rails.inputChangeSelector)) { 11871 method = element.data('method'); 11872 url = element.data('url'); 11873 data = element.serialize(); 11874 if (element.data('params')) data = data + '&' + element.data('params'); 11875 } else if (element.is(rails.buttonClickSelector)) { 11876 method = element.data('method') || 'get'; 11877 url = element.data('url'); 11878 data = element.serialize(); 11879 if (element.data('params')) data = data + '&' + element.data('params'); 11880 } else { 11881 method = element.data('method'); 11882 url = rails.href(element); 11883 data = element.data('params') || null; 11884 } 11885 11886 options = { 11887 type: method || 'GET', data: data, dataType: dataType, 11888 // stopping the "ajax:beforeSend" event will cancel the ajax request 11889 beforeSend: function(xhr, settings) { 11890 if (settings.dataType === undefined) { 11891 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 11892 } 11893 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) { 11894 element.trigger('ajax:send', xhr); 11895 } else { 11896 return false; 11897 } 11898 }, 11899 success: function(data, status, xhr) { 11900 element.trigger('ajax:success', [data, status, xhr]); 11901 }, 11902 complete: function(xhr, status) { 11903 element.trigger('ajax:complete', [xhr, status]); 11904 }, 11905 error: function(xhr, status, error) { 11906 element.trigger('ajax:error', [xhr, status, error]); 11907 }, 11908 crossDomain: rails.isCrossDomain(url) 11909 }; 11910 11911 // There is no withCredentials for IE6-8 when 11912 // "Enable native XMLHTTP support" is disabled 11913 if (withCredentials) { 11914 options.xhrFields = { 11915 withCredentials: withCredentials 11916 }; 11917 } 11918 11919 // Only pass url to `ajax` options if not blank 11920 if (url) { options.url = url; } 11921 11922 return rails.ajax(options); 11923 } else { 11924 return false;
11925 } 11926 }, 11927 11928 // Determines if the request is a cross domain request. 11929 isCrossDomain: function(url) { 11930 var originAnchor = document.createElement('a'); 11931 originAnchor.href = location.href; 11932 var urlAnchor = document.createElement('a'); 11933 11934 try { 11935 urlAnchor.href = url; 11936 // This is a workaround to a IE bug. 11937 urlAnchor.href = urlAnchor.href; 11938 11939 // If URL protocol is false or is a string containing a single colon 11940 // *and* host are false, assume it is not a cross-domain request 11941 // (should only be the case for IE7 and IE compatibility mode). 11942 // Otherwise, evaluate protocol and host of the URL against the origin 11943 // protocol and host. 11944 return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || 11945 (originAnchor.protocol + '//' + originAnchor.host === 11946 urlAnchor.protocol + '//' + urlAnchor.host)); 11947 } catch (e) { 11948 // If there is an error parsing the URL, assume it is crossDomain. 11949 return true; 11950 } 11951 }, 11952 11953 // Handles "data-method" on links such as: 11954 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 11955 handleMethod: function(link) { 11956 var href = rails.href(link), 11957 method = link.data('method'), 11958 target = link.attr('target'), 11959 csrfToken = rails.csrfToken(), 11960 csrfParam = rails.csrfParam(), 11961 form = $('<form method="post" action="' + href + '"></form>'), 11962 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 11963 11964 if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) { 11965 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 11966 } 11967 11968 if (target) { form.attr('target', target); } 11969 11970 form.hide().append(metadataInput).appendTo('body'); 11971 form.submit(); 11972 }, 11973 11974 // Helper function that returns form elements that match the specified CSS selector 11975 // If form is actually a "form" element this will return associated elements outside the from that have 11976 // the html form attribute set 11977 formElements: function(form, selector) { 11978 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 11979 }, 11980 11981 /* Disables form elements: 11982 - Caches element value in 'ujs:enable-with' data store 11983 - Replaces element text with value of 'data-disable-with' attribute 11984 - Sets disabled property to true 11985 */ 11986 disableFormElements: function(form) { 11987 rails.formElements(form, rails.disableSelector).each(function() { 11988 rails.disableFormElement($(this)); 11989 }); 11990 }, 11991 11992 disableFormElement: function(element) { 11993 var method, replacement; 11994 11995 method = element.is('button') ? 'html' : 'val'; 11996 replacement = element.data('disable-with'); 11997 11998 if (replacement !== undefined) { 11999 element.data('ujs:enable-with', element[method]()); 12000 element[method](replacement); 12001 } 12002 12003 element.prop('disabled', true); 12004 element.data('ujs:disabled', true); 12005 }, 12006 12007 /* Re-enables disabled form elements: 12008 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 12009 - Sets disabled property to false 12010 */ 12011 enableFormElements: function(form) { 12012 rails.formElements(form, rails.enableSelector).each(function() { 12013 rails.enableFormElement($(this)); 12014 }); 12015 }, 12016 12017 enableFormElement: function(element) { 12018 var method = element.is('button') ? 'html' : 'val'; 12019 if (element.data('ujs:enable-with') !== undefined) { 12020 element[method](element.data('ujs:enable-with')); 12021 element.removeData('ujs:enable-with'); // clean up cache 12022 } 12023 element.prop('disabled', false); 12024 element.removeData('ujs:disabled'); 12025 }, 12026 12027 /* For 'data-confirm' attribute: 12028 - Fires `confirm` event 12029 - Shows the confirmation dialog 12030 - Fires the `confirm:complete` event 12031 12032 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 12033 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 12034 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
12035 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 12036 */ 12037 allowAction: function(element) { 12038 var message = element.data('confirm'), 12039 answer = false, callback; 12040 if (!message) { return true; } 12041 12042 if (rails.fire(element, 'confirm')) { 12043 try { 12044 answer = rails.confirm(message); 12045 } catch (e) { 12046 (console.error || console.log).call(console, e.stack || e); 12047 } 12048 callback = rails.fire(element, 'confirm:complete', [answer]); 12049 } 12050 return answer && callback; 12051 }, 12052 12053 // Helper function which checks for blank inputs in a form that match the specified CSS selector 12054 blankInputs: function(form, specifiedSelector, nonBlank) { 12055 var foundInputs = $(), 12056 input, 12057 valueToCheck, 12058 radiosForNameWithNoneSelected, 12059 radioName, 12060 selector = specifiedSelector || 'input,textarea', 12061 requiredInputs = form.find(selector), 12062 checkedRadioButtonNames = {}; 12063 12064 requiredInputs.each(function() { 12065 input = $(this); 12066 if (input.is('input[type=radio]')) { 12067 12068 // Don't count unchecked required radio as blank if other radio with same name is checked, 12069 // regardless of whether same-name radio input has required attribute or not. The spec 12070 // states https://www.w3.org/TR/html5/forms.html#the-required-attribute 12071 radioName = input.attr('name'); 12072 12073 // Skip if we've already seen the radio with this name. 12074 if (!checkedRadioButtonNames[radioName]) { 12075 12076 // If none checked 12077 if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) { 12078 radiosForNameWithNoneSelected = form.find( 12079 'input[type=radio][name="' + radioName + '"]'); 12080 foundInputs = foundInputs.add(radiosForNameWithNoneSelected); 12081 } 12082 12083 // We only need to check each name once. 12084 checkedRadioButtonNames[radioName] = radioName; 12085 } 12086 } else { 12087 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val(); 12088 if (valueToCheck === nonBlank) { 12089 foundInputs = foundInputs.add(input); 12090 } 12091 } 12092 }); 12093 return foundInputs.length ? foundInputs : false; 12094 }, 12095 12096 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 12097 nonBlankInputs: function(form, specifiedSelector) { 12098 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 12099 }, 12100 12101 // Helper function, needed to provide consistent behavior in IE 12102 stopEverything: function(e) { 12103 $(e.target).trigger('ujs:everythingStopped'); 12104 e.stopImmediatePropagation(); 12105 return false; 12106 }, 12107 12108 // Replace element's html with the 'data-disable-with' after storing original html 12109 // and prevent clicking on it 12110 disableElement: function(element) { 12111 var replacement = element.data('disable-with'); 12112 12113 if (replacement !== undefined) { 12114 element.data('ujs:enable-with', element.html()); // store enabled state 12115 element.html(replacement); 12116 } 12117 12118 element.on('click.railsDisable', function(e) { // prevent further clicking 12119 return rails.stopEverything(e); 12120 }); 12121 element.data('ujs:disabled', true); 12122 }, 12123 12124 // Restore element to its original state which was disabled by 'disableElement' above 12125 enableElement: function(element) { 12126 if (element.data('ujs:enable-with') !== undefined) { 12127 element.html(element.data('ujs:enable-with')); // set to old enabled state 12128 element.removeData('ujs:enable-with'); // clean up cache 12129 } 12130 element.off('click.railsDisable'); // enable element 12131 element.removeData('ujs:disabled'); 12132 } 12133 }; 12134 12135 if (rails.fire($document, 'rails:attachBindings')) { 12136 12137 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 12138 12139 // This event works the same as the load event, except that it fires every 12140 // time the page is loaded. 12141 // 12142 // See https://github.com/rails/jquery-ujs/issues/357 12143 // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching 12144 $(window).on('pageshow.rails', function () { 12145 $($.rails.enableSelector).each(function () { 12146 var element = $(this); 12147 12148 if (element.data('ujs:disabled')) { 12149 $.rails.enableFormElement(element); 12150 } 12151 }); 12152 12153 $($.rails.linkDisableSelector).each(function () { 12154 var element = $(this); 12155 12156 if (element.data('ujs:disabled')) { 12157 $.rails.enableElement(element); 12158 } 12159 }); 12160 }); 12161 12162 $document.on('ajax:complete', rails.linkDisableSelector, function() { 12163 rails.enableElement($(this)); 12164 }); 12165 12166 $document.on('ajax:complete', rails.buttonDisableSelector, function() { 12167 rails.enableFormElement($(this)); 12168 }); 12169 12170 $document.on('click.rails', rails.linkClickSelector, function(e) { 12171 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 12172 if (!rails.allowAction(link)) return rails.stopEverything(e); 12173 12174 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 12175 12176 if (rails.isRemote(link)) { 12177 if (metaClick && (!method || method === 'GET') && !data) { return true; } 12178 12179 var handleRemote = rails.handleRemote(link); 12180 // Response from rails.handleRemote() will either be false or a deferred object promise. 12181 if (handleRemote === false) { 12182 rails.enableElement(link); 12183 } else { 12184 handleRemote.fail( function() { rails.enableElement(link); } ); 12185 } 12186 return false;
12187 12188 } else if (method) { 12189 rails.handleMethod(link); 12190 return false; 12191 } 12192 }); 12193 12194 $document.on('click.rails', rails.buttonClickSelector, function(e) { 12195 var button = $(this); 12196 12197 if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); 12198 12199 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 12200 12201 var handleRemote = rails.handleRemote(button); 12202 // Response from rails.handleRemote() will either be false or a deferred object promise. 12203 if (handleRemote === false) { 12204 rails.enableFormElement(button); 12205 } else { 12206 handleRemote.fail( function() { rails.enableFormElement(button); } ); 12207 } 12208 return false; 12209 }); 12210 12211 $document.on('change.rails', rails.inputChangeSelector, function(e) { 12212 var link = $(this); 12213 if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); 12214 12215 rails.handleRemote(link); 12216 return false; 12217 }); 12218 12219 $document.on('submit.rails', rails.formSubmitSelector, function(e) { 12220 var form = $(this), 12221 remote = rails.isRemote(form), 12222 blankRequiredInputs, 12223 nonBlankFileInputs; 12224 12225 if (!rails.allowAction(form)) return rails.stopEverything(e); 12226 12227 // Skip other logic when required values are missing or file upload is present 12228 if (form.attr('novalidate') === undefined) { 12229 if (form.data('ujs:formnovalidate-button') === undefined) { 12230 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); 12231 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 12232 return rails.stopEverything(e); 12233 } 12234 } else { 12235 // Clear the formnovalidate in case the next button click is not on a formnovalidate button 12236 // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain 12237 form.data('ujs:formnovalidate-button', undefined); 12238 } 12239 } 12240 12241 if (remote) { 12242 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 12243 if (nonBlankFileInputs) { 12244 // Slight timeout so that the submit button gets properly serialized 12245 // (make it easy for event handler to serialize form without disabled values) 12246 setTimeout(function(){ rails.disableFormElements(form); }, 13); 12247 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 12248 12249 // Re-enable form elements if event bindings return false (canceling normal form submission) 12250 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 12251 12252 return aborted; 12253 } 12254 12255 rails.handleRemote(form); 12256 return false; 12257 12258 } else { 12259 // Slight timeout so that the submit button gets properly serialized 12260 setTimeout(function(){ rails.disableFormElements(form); }, 13); 12261 } 12262 }); 12263 12264 $document.on('click.rails', rails.formInputClickSelector, function(event) { 12265 var button = $(this); 12266 12267 if (!rails.allowAction(button)) return rails.stopEverything(event); 12268 12269 // Register the pressed submit button 12270 var name = button.attr('name'), 12271 data = name ? {name:name, value:button.val()} : null; 12272 12273 var form = button.closest('form'); 12274 if (form.length === 0) { 12275 form = $('#' + button.attr('form')); 12276 } 12277 form.data('ujs:submit-button', data); 12278 12279 // Save attributes from button 12280 form.data('ujs:formnovalidate-button', button.attr('formnovalidate')); 12281 form.data('ujs:submit-button-formaction', button.attr('formaction')); 12282 form.data('ujs:submit-button-formmethod', button.attr('formmethod')); 12283 }); 12284 12285 $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { 12286 if (this === event.target) rails.disableFormElements($(this)); 12287 }); 12288 12289 $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { 12290 if (this === event.target) rails.enableFormElements($(this)); 12291 }); 12292 12293 $(function(){ 12294 rails.refreshCSRFTokens(); 12295 }); 12296 } 12297 12298 }; 12299 12300 if (window.jQuery) { 12301 jqueryUjsInit(jQuery); 12302 } else if (typeof exports === 'object' && typeof module === 'object') { 12303 module.exports = jqueryUjsInit; 12304 } 12305})(); 12306/*! 12307 * JavaScript Cookie v2.2.0 12308 * https://github.com/js-cookie/js-cookie 12309 * 12310 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 12311 * Released under the MIT license 12312 */ 12313;(function (factory) { 12314 var registeredInModuleLoader = false;
12315 if (typeof define === 'function' && define.amd) { 12316 define(factory); 12317 registeredInModuleLoader = true; 12318 } 12319 if (typeof exports === 'object') { 12320 module.exports = factory(); 12321 registeredInModuleLoader = true; 12322 } 12323 if (!registeredInModuleLoader) { 12324 var OldCookies = window.Cookies; 12325 var api = window.Cookies = factory(); 12326 api.noConflict = function () { 12327 window.Cookies = OldCookies; 12328 return api; 12329 }; 12330 } 12331}(function () { 12332 function extend () { 12333 var i = 0; 12334 var result = {}; 12335 for (; i < arguments.length; i++) { 12336 var attributes = arguments[ i ]; 12337 for (var key in attributes) { 12338 result[key] = attributes[key]; 12339 } 12340 } 12341 return result; 12342 } 12343 12344 function init (converter) { 12345 function api (key, value, attributes) { 12346 var result; 12347 if (typeof document === 'undefined') { 12348 return; 12349 } 12350 12351 // Write 12352 12353 if (arguments.length > 1) { 12354 attributes = extend({ 12355 path: '/' 12356 }, api.defaults, attributes); 12357 12358 if (typeof attributes.expires === 'number') { 12359 var expires = new Date(); 12360 expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); 12361 attributes.expires = expires; 12362 } 12363 12364 // We're using "expires" because "max-age" is not supported by IE 12365 attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; 12366 12367 try { 12368 result = JSON.stringify(value); 12369 if (/^[\{\[]/.test(result)) { 12370 value = result; 12371 } 12372 } catch (e) {} 12373 12374 if (!converter.write) { 12375 value = encodeURIComponent(String(value)) 12376 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 12377 } else { 12378 value = converter.write(value, key); 12379 } 12380 12381 key = encodeURIComponent(String(key)); 12382 key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); 12383 key = key.replace(/[\(\)]/g, escape); 12384 12385 var stringifiedAttributes = ''; 12386 12387 for (var attributeName in attributes) { 12388 if (!attributes[attributeName]) { 12389 continue; 12390 } 12391 stringifiedAttributes += '; ' + attributeName; 12392 if (attributes[attributeName] === true) { 12393 continue; 12394 } 12395 stringifiedAttributes += '=' + attributes[attributeName]; 12396 } 12397 return (document.cookie = key + '=' + value + stringifiedAttributes); 12398 } 12399 12400 // Read 12401 12402 if (!key) { 12403 result = {}; 12404 } 12405 12406 // To prevent the for loop in the first place assign an empty array 12407 // in case there are no cookies at all. Also prevents odd result when 12408 // calling "get()" 12409 var cookies = document.cookie ? document.cookie.split('; ') : []; 12410 var rdecode = /(%[0-9A-Z]{2})+/g; 12411 var i = 0; 12412 12413 for (; i < cookies.length; i++) { 12414 var parts = cookies[i].split('='); 12415 var cookie = parts.slice(1).join('='); 12416 12417 if (!this.json && cookie.charAt(0) === '"') { 12418 cookie = cookie.slice(1, -1); 12419 } 12420 12421 try { 12422 var name = parts[0].replace(rdecode, decodeURIComponent); 12423 cookie = converter.read ? 12424 converter.read(cookie, name) : converter(cookie, name) || 12425 cookie.replace(rdecode, decodeURIComponent); 12426 12427 if (this.json) { 12428 try { 12429 cookie = JSON.parse(cookie); 12430 } catch (e) {} 12431 } 12432 12433 if (key === name) { 12434 result = cookie; 12435 break; 12436 } 12437 12438 if (!key) { 12439 result[name] = cookie; 12440 } 12441 } catch (e) {} 12442 } 12443 12444 return result; 12445 } 12446 12447 api.set = api; 12448 api.get = function (key) { 12449 return api.call(api, key); 12450 }; 12451 api.getJSON = function () { 12452 return api.apply({ 12453 json: true 12454 }, [].slice.call(arguments)); 12455 }; 12456 api.defaults = {}; 12457 12458 api.remove = function (key, attributes) { 12459 api(key, '', extend(attributes, { 12460 expires: -1 12461 })); 12462 }; 12463 12464 api.withConverter = init; 12465 12466 return api; 12467 } 12468 12469 return init(function () {}); 12470})); 12471/*! 12472 * jQuery Form Plugin 12473 * version: 3.09 (16-APR-2012) 12474 * @requires jQuery v1.3.2 or later 12475 * 12476 * Examples and documentation at: http://malsup.com/jquery/form/ 12477 * Project repository: https://github.com/malsup/form 12478 * Dual licensed under the MIT and GPL licenses: 12479 * http://malsup.github.com/mit-license.txt 12480 * http://malsup.github.com/gpl-license-v2.txt 12481 */ 12482/*global ActiveXObject alert */ 12483;(function($) { 12484"use strict"; 12485 12486/* 12487 Usage Note: 12488 ----------- 12489 Do not use both ajaxSubmit and ajaxForm on the same form. These 12490 functions are mutually exclusive. Use ajaxSubmit if you want 12491 to bind your own submit handler to the form. For example, 12492 12493 $(document).ready(function() { 12494 $('#myForm').on('submit', function(e) { 12495 e.preventDefault(); // <-- important 12496 $(this).ajaxSubmit({ 12497 target: '#output' 12498 }); 12499 }); 12500 }); 12501 12502 Use ajaxForm when you want the plugin to manage all the event binding 12503 for you. For example, 12504 12505 $(document).ready(function() { 12506 $('#myForm').ajaxForm({ 12507 target: '#output' 12508 }); 12509 }); 12510 12511 You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
12512 form does not have to exist when you invoke ajaxForm: 12513 12514 $('#myForm').ajaxForm({ 12515 delegation: true, 12516 target: '#output' 12517 }); 12518 12519 When using ajaxForm, the ajaxSubmit function will be invoked for you 12520 at the appropriate time. 12521*/ 12522 12523/** 12524 * Feature detection 12525 */ 12526var feature = {}; 12527feature.fileapi = $("<input type='file'/>").get(0).files !== undefined; 12528feature.formdata = window.FormData !== undefined; 12529 12530/** 12531 * ajaxSubmit() provides a mechanism for immediately submitting 12532 * an HTML form using AJAX. 12533 */ 12534$.fn.ajaxSubmit = function(options) { 12535 /*jshint scripturl:true */ 12536 12537 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 12538 if (!this.length) { 12539 log('ajaxSubmit: skipping submit process - no element selected'); 12540 return this; 12541 } 12542 12543 var method, action, url, $form = this; 12544 12545 if (typeof options == 'function') { 12546 options = { success: options }; 12547 } 12548 12549 method = this.attr('method'); 12550 action = this.attr('action'); 12551 url = (typeof action === 'string') ? $.trim(action) : ''; 12552 url = url || window.location.href || ''; 12553 if (url) { 12554 // clean url (don't include hash vaue) 12555 url = (url.match(/^([^#]+)/)||[])[1]; 12556 } 12557 12558 options = $.extend(true, { 12559 url: url, 12560 success: $.ajaxSettings.success, 12561 type: method || 'GET', 12562 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' 12563 }, options); 12564 12565 // hook for manipulating the form data before it is extracted; 12566 // convenient for use with rich editors like tinyMCE or FCKEditor 12567 var veto = {}; 12568 this.trigger('form-pre-serialize', [this, options, veto]); 12569 if (veto.veto) { 12570 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 12571 return this; 12572 } 12573 12574 // provide opportunity to alter form data before it is serialized 12575 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { 12576 log('ajaxSubmit: submit aborted via beforeSerialize callback'); 12577 return this; 12578 } 12579 12580 var traditional = options.traditional; 12581 if ( traditional === undefined ) { 12582 traditional = $.ajaxSettings.traditional; 12583 } 12584 12585 var elements = []; 12586 var qx, a = this.formToArray(options.semantic, elements); 12587 if (options.data) { 12588 options.extraData = options.data; 12589 qx = $.param(options.data, traditional); 12590 } 12591 12592 // give pre-submit callback an opportunity to abort the submit 12593 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 12594 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 12595 return this; 12596 } 12597 12598 // fire vetoable 'validate' event 12599 this.trigger('form-submit-validate', [a, this, options, veto]); 12600 if (veto.veto) { 12601 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 12602 return this; 12603 } 12604 12605 var q = $.param(a, traditional); 12606 if (qx) { 12607 q = ( q ? (q + '&' + qx) : qx ); 12608 } 12609 if (options.type.toUpperCase() == 'GET') { 12610 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 12611 options.data = null; // data is null for 'get' 12612 } 12613 else { 12614 options.data = q; // data is the query string for 'post' 12615 } 12616 12617 var callbacks = []; 12618 if (options.resetForm) { 12619 callbacks.push(function() { $form.resetForm(); }); 12620 } 12621 if (options.clearForm) { 12622 callbacks.push(function() { $form.clearForm(options.includeHidden); }); 12623 } 12624 12625 // perform a load on the target only if dataType is not provided 12626 if (!options.dataType && options.target) { 12627 var oldSuccess = options.success || function(){}; 12628 callbacks.push(function(data) { 12629 var fn = options.replaceTarget ? 'replaceWith' : 'html'; 12630 $(options.target)[fn](data).each(oldSuccess, arguments); 12631 }); 12632 } 12633 else if (options.success) { 12634 callbacks.push(options.success); 12635 } 12636 12637 options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg 12638 var context = options.context || options; // jQuery 1.4+ supports scope context 12639 for (var i=0, max=callbacks.length; i < max; i++) { 12640 callbacks[i].apply(context, [data, status, xhr || $form, $form]); 12641 } 12642 }; 12643 12644 // are there files to upload? 12645 var fileInputs = $('input:file:enabled[value]', this); // [value] (issue #113) 12646 var hasFileInputs = fileInputs.length > 0; 12647 var mp = 'multipart/form-data'; 12648 var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); 12649 12650 var fileAPI = feature.fileapi && feature.formdata; 12651 log("fileAPI :" + fileAPI); 12652 var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; 12653 12654 // options.iframe allows user to force iframe mode 12655 // 06-NOV-09: now defaulting to iframe mode if file input is detected 12656 if (options.iframe !== false && (options.iframe || shouldUseFrame)) { 12657 // hack to fix Safari hang (thanks to Tim Molendijk for this) 12658 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 12659 if (options.closeKeepAlive) { 12660 $.get(options.closeKeepAlive, function() { 12661 fileUploadIframe(a); 12662 }); 12663 } 12664 else { 12665 fileUploadIframe(a); 12666 } 12667 } 12668 else if ((hasFileInputs || multipart) && fileAPI) { 12669 fileUploadXhr(a); 12670 } 12671 else { 12672 $.ajax(options); 12673 } 12674 12675 // clear element array 12676 for (var k=0; k < elements.length; k++) 12677 elements[k] = null; 12678 12679 // fire 'notify' event 12680 this.trigger('form-submit-notify', [this, options]); 12681 return this; 12682 12683 // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) 12684 function fileUploadXhr(a) { 12685 var formdata = new FormData(); 12686 12687 for (var i=0; i < a.length; i++) { 12688 formdata.append(a[i].name, a[i].value); 12689 } 12690 12691 if (options.extraData) { 12692 for (var p in options.extraData) 12693 if (options.extraData.hasOwnProperty(p)) 12694 formdata.append(p, options.extraData[p]); 12695 } 12696 12697 options.data = null; 12698 12699 var s = $.extend(true, {}, $.ajaxSettings, options, { 12700 contentType: false, 12701 processData: false, 12702 cache: false, 12703 type: 'POST' 12704 }); 12705 12706 if (options.uploadProgress) { 12707 // workaround because jqXHR does not expose upload property 12708 s.xhr = function() { 12709 var xhr = jQuery.ajaxSettings.xhr(); 12710 if (xhr.upload) { 12711 xhr.upload.onprogress = function(event) { 12712 var percent = 0; 12713 var position = event.loaded || event.position; /*event.position is deprecated*/ 12714 var total = event.total; 12715 if (event.lengthComputable) {
12716 percent = Math.ceil(position / total * 100); 12717 } 12718 options.uploadProgress(event, position, total, percent); 12719 }; 12720 } 12721 return xhr; 12722 }; 12723 } 12724 12725 s.data = null; 12726 var beforeSend = s.beforeSend; 12727 s.beforeSend = function(xhr, o) { 12728 o.data = formdata; 12729 if(beforeSend) 12730 beforeSend.call(o, xhr, options); 12731 }; 12732 $.ajax(s); 12733 } 12734 12735 // private function for handling file uploads (hat tip to YAHOO!) 12736 function fileUploadIframe(a) { 12737 var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; 12738 var useProp = !!$.fn.prop; 12739 12740 if ($(':input[name=submit],:input[id=submit]', form).length) { 12741 // if there is an input with a name or id of 'submit' then we won't be 12742 // able to invoke the submit fn on the form (at least not x-browser) 12743 alert('Error: Form elements must not have name or id of "submit".'); 12744 return; 12745 } 12746 12747 if (a) { 12748 // ensure that every serialized input is still enabled 12749 for (i=0; i < elements.length; i++) { 12750 el = $(elements[i]); 12751 if ( useProp ) 12752 el.prop('disabled', false); 12753 else 12754 el.removeAttr('disabled'); 12755 } 12756 } 12757 12758 s = $.extend(true, {}, $.ajaxSettings, options); 12759 s.context = s.context || s; 12760 id = 'jqFormIO' + (new Date().getTime()); 12761 if (s.iframeTarget) { 12762 $io = $(s.iframeTarget); 12763 n = $io.attr('name'); 12764 if (!n) 12765 $io.attr('name', id); 12766 else 12767 id = n; 12768 } 12769 else { 12770 $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); 12771 $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); 12772 } 12773 io = $io[0]; 12774 12775 12776 xhr = { // mock object 12777 aborted: 0, 12778 responseText: null, 12779 responseXML: null, 12780 status: 0, 12781 statusText: 'n/a', 12782 getAllResponseHeaders: function() {}, 12783 getResponseHeader: function() {}, 12784 setRequestHeader: function() {}, 12785 abort: function(status) { 12786 var e = (status === 'timeout' ? 'timeout' : 'aborted'); 12787 log('aborting upload... ' + e); 12788 this.aborted = 1; 12789 $io.attr('src', s.iframeSrc); // abort op in progress 12790 xhr.error = e; 12791 if (s.error) 12792 s.error.call(s.context, xhr, e, status); 12793 if (g) 12794 $.event.trigger("ajaxError", [xhr, s, e]); 12795 if (s.complete) 12796 s.complete.call(s.context, xhr, e); 12797 } 12798 }; 12799 12800 g = s.global; 12801 // trigger ajax global events so that activity/block indicators work like normal 12802 if (g && 0 === $.active++) { 12803 $.event.trigger("ajaxStart"); 12804 } 12805 if (g) { 12806 $.event.trigger("ajaxSend", [xhr, s]); 12807 } 12808 12809 if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { 12810 if (s.global) { 12811 $.active--; 12812 } 12813 return; 12814 } 12815 if (xhr.aborted) { 12816 return; 12817 } 12818 12819 // add submitting element to data if we know it 12820 sub = form.clk; 12821 if (sub) { 12822 n = sub.name; 12823 if (n && !sub.disabled) { 12824 s.extraData = s.extraData || {}; 12825 s.extraData[n] = sub.value; 12826 if (sub.type == "image") { 12827 s.extraData[n+'.x'] = form.clk_x; 12828 s.extraData[n+'.y'] = form.clk_y; 12829 } 12830 } 12831 } 12832 12833 var CLIENT_TIMEOUT_ABORT = 1; 12834 var SERVER_ABORT = 2; 12835 12836 function getDoc(frame) { 12837 var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document; 12838 return doc; 12839 } 12840 12841 // Rails CSRF hack (thanks to Yvan Barthelemy) 12842 var csrf_token = $('meta[name=csrf-token]').attr('content'); 12843 var csrf_param = $('meta[name=csrf-param]').attr('content'); 12844 if (csrf_param && csrf_token) { 12845 s.extraData = s.extraData || {}; 12846 s.extraData[csrf_param] = csrf_token; 12847 } 12848 12849 // take a breath so that pending repaints get some cpu time before the upload starts 12850 function doSubmit() { 12851 // make sure form attrs are set 12852 var t = $form.attr('target'), a = $form.attr('action'); 12853 12854 // update form attrs in IE friendly way 12855 form.setAttribute('target',id);
12856 if (!method) { 12857 form.setAttribute('method', 'POST'); 12858 } 12859 if (a != s.url) { 12860 form.setAttribute('action', s.url); 12861 } 12862 12863 // ie borks in some cases when setting encoding 12864 if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { 12865 $form.attr({ 12866 encoding: 'multipart/form-data', 12867 enctype: 'multipart/form-data' 12868 }); 12869 } 12870 12871 // support timout 12872 if (s.timeout) { 12873 timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); 12874 } 12875 12876 // look for server aborts 12877 function checkState() { 12878 try { 12879 var state = getDoc(io).readyState; 12880 log('state = ' + state); 12881 if (state && state.toLowerCase() == 'uninitialized') 12882 setTimeout(checkState,50); 12883 } 12884 catch(e) { 12885 log('Server abort: ' , e, ' (', e.name, ')'); 12886 cb(SERVER_ABORT); 12887 if (timeoutHandle) 12888 clearTimeout(timeoutHandle); 12889 timeoutHandle = undefined; 12890 } 12891 } 12892 12893 // add "extra" data to form if provided in options 12894 var extraInputs = []; 12895 try { 12896 if (s.extraData) { 12897 for (var n in s.extraData) { 12898 if (s.extraData.hasOwnProperty(n)) { 12899 extraInputs.push( 12900 $('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n]) 12901 .appendTo(form)[0]); 12902 } 12903 } 12904 } 12905 12906 if (!s.iframeTarget) { 12907 // add iframe to doc and submit the form 12908 $io.appendTo('body'); 12909 if (io.attachEvent) 12910 io.attachEvent('onload', cb); 12911 else 12912 io.addEventListener('load', cb, false); 12913 } 12914 setTimeout(checkState,15); 12915 form.submit(); 12916 } 12917 finally { 12918 // reset attrs and remove "extra" input elements 12919 form.setAttribute('action',a); 12920 if(t) { 12921 form.setAttribute('target', t); 12922 } else { 12923 $form.removeAttr('target'); 12924 } 12925 $(extraInputs).remove(); 12926 } 12927 } 12928 12929 if (s.forceSync) { 12930 doSubmit(); 12931 } 12932 else { 12933 setTimeout(doSubmit, 10); // this lets dom updates render 12934 } 12935 12936 var data, doc, domCheckCount = 50, callbackProcessed; 12937 12938 function cb(e) { 12939 if (xhr.aborted || callbackProcessed) { 12940 return; 12941 } 12942 try { 12943 doc = getDoc(io); 12944 } 12945 catch(ex) { 12946 log('cannot access response document: ', ex); 12947 e = SERVER_ABORT; 12948 } 12949 if (e === CLIENT_TIMEOUT_ABORT && xhr) { 12950 xhr.abort('timeout'); 12951 return; 12952 } 12953 else if (e == SERVER_ABORT && xhr) { 12954 xhr.abort('server abort'); 12955 return; 12956 } 12957 12958 if (!doc || doc.location.href == s.iframeSrc) { 12959 // response not received yet 12960 if (!timedOut) 12961 return; 12962 } 12963 if (io.detachEvent) 12964 io.detachEvent('onload', cb); 12965 else 12966 io.removeEventListener('load', cb, false); 12967 12968 var status = 'success', errMsg; 12969 try { 12970 if (timedOut) { 12971 throw 'timeout'; 12972 } 12973 12974 var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); 12975 log('isXml='+isXml); 12976 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) { 12977 if (--domCheckCount) { 12978 // in some browsers (Opera) the iframe DOM is not always traversable when 12979 // the onload callback fires, so we loop a bit to accommodate 12980 log('requeing onLoad callback, DOM not available'); 12981 setTimeout(cb, 250); 12982 return; 12983 } 12984 // let this fall through because server response could be an empty document 12985 //log('Could not access iframe DOM after mutiple tries.'); 12986 //throw 'DOMException: not available'; 12987 } 12988 12989 //log('response detected'); 12990 var docRoot = doc.body ? doc.body : doc.documentElement; 12991 xhr.responseText = docRoot ? docRoot.innerHTML : null; 12992 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 12993 if (isXml) 12994 s.dataType = 'xml'; 12995 xhr.getResponseHeader = function(header){ 12996 var headers = {'content-type': s.dataType}; 12997 return headers[header]; 12998 }; 12999 // support for XHR 'status' & 'statusText' emulation : 13000 if (docRoot) { 13001 xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; 13002 xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; 13003 } 13004 13005 var dt = (s.dataType || '').toLowerCase(); 13006 var scr = /(json|script|text)/.test(dt); 13007 if (scr || s.textarea) { 13008 // see if user embedded response in textarea 13009 var ta = doc.getElementsByTagName('textarea')[0]; 13010 if (ta) { 13011 xhr.responseText = ta.value; 13012 // support for XHR 'status' & 'statusText' emulation : 13013 xhr.status = Number( ta.getAttribute('status') ) || xhr.status; 13014 xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; 13015 } 13016 else if (scr) { 13017 // account for browsers injecting pre around json response 13018 var pre = doc.getElementsByTagName('pre')[0]; 13019 var b = doc.getElementsByTagName('body')[0]; 13020 if (pre) { 13021 xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; 13022 } 13023 else if (b) { 13024 xhr.responseText = b.textContent ? b.textContent : b.innerText; 13025 } 13026 } 13027 } 13028 else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) { 13029 xhr.responseXML = toXml(xhr.responseText); 13030 } 13031 13032 try { 13033 data = httpData(xhr, dt, s); 13034 } 13035 catch (e) { 13036 status = 'parsererror'; 13037 xhr.error = errMsg = (e || status); 13038 } 13039 } 13040 catch (e) { 13041 log('error caught: ',e); 13042 status = 'error'; 13043 xhr.error = errMsg = (e || status); 13044 } 13045 13046 if (xhr.aborted) { 13047 log('upload aborted'); 13048 status = null; 13049 } 13050 13051 if (xhr.status) { // we've set xhr.status 13052 status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; 13053 } 13054 13055 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 13056 if (status === 'success') { 13057 if (s.success) 13058 s.success.call(s.context, data, 'success', xhr); 13059 if (g) 13060 $.event.trigger("ajaxSuccess", [xhr, s]); 13061 } 13062 else if (status) { 13063 if (errMsg === undefined) 13064 errMsg = xhr.statusText; 13065 if (s.error) 13066 s.error.call(s.context, xhr, status, errMsg); 13067 if (g) 13068 $.event.trigger("ajaxError", [xhr, s, errMsg]); 13069 } 13070 13071 if (g)
13072 $.event.trigger("ajaxComplete", [xhr, s]); 13073 13074 if (g && ! --$.active) { 13075 $.event.trigger("ajaxStop"); 13076 } 13077 13078 if (s.complete) 13079 s.complete.call(s.context, xhr, status); 13080 13081 callbackProcessed = true; 13082 if (s.timeout) 13083 clearTimeout(timeoutHandle); 13084 13085 // clean up 13086 setTimeout(function() { 13087 if (!s.iframeTarget) 13088 $io.remove(); 13089 xhr.responseXML = null; 13090 }, 100); 13091 } 13092 13093 var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) 13094 if (window.ActiveXObject) { 13095 doc = new ActiveXObject('Microsoft.XMLDOM'); 13096 doc.async = 'false'; 13097 doc.loadXML(s); 13098 } 13099 else { 13100 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 13101 } 13102 return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; 13103 }; 13104 var parseJSON = $.parseJSON || function(s) { 13105 /*jslint evil:true */ 13106 return window['eval']('(' + s + ')'); 13107 }; 13108 13109 var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 13110 13111 var ct = xhr.getResponseHeader('content-type') || '', 13112 xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, 13113 data = xml ? xhr.responseXML : xhr.responseText; 13114 13115 if (xml && data.documentElement.nodeName === 'parsererror') { 13116 if ($.error) 13117 $.error('parsererror'); 13118 } 13119 if (s && s.dataFilter) { 13120 data = s.dataFilter(data, type); 13121 } 13122 if (typeof data === 'string') { 13123 if (type === 'json' || !type && ct.indexOf('json') >= 0) { 13124 data = parseJSON(data); 13125 } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { 13126 $.globalEval(data); 13127 } 13128 } 13129 return data; 13130 }; 13131 } 13132}; 13133 13134/** 13135 * ajaxForm() provides a mechanism for fully automating form submission. 13136 * 13137 * The advantages of using this method instead of ajaxSubmit() are: 13138 * 13139 * 1: This method will include coordinates for <input type="image" /> elements (if the element 13140 * is used to submit the form). 13141 * 2. This method will include the submit element's name/value data (for the element that was 13142 * used to submit the form). 13143 * 3. This method binds the submit() method to the form for you. 13144 * 13145 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 13146 * passes the options argument along after properly binding events for submit elements and 13147 * the form itself. 13148 */ 13149$.fn.ajaxForm = function(options) { 13150 options = options || {}; 13151 options.delegation = options.delegation && $.isFunction($.fn.on); 13152 13153 // in jQuery 1.3+ we can fix mistakes with the ready state 13154 if (!options.delegation && this.length === 0) { 13155 var o = { s: this.selector, c: this.context }; 13156 if (!$.isReady && o.s) { 13157 log('DOM not ready, queuing ajaxForm'); 13158 $(function() { 13159 $(o.s,o.c).ajaxForm(options); 13160 }); 13161 return this; 13162 } 13163 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 13164 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 13165 return this; 13166 } 13167 13168 if ( options.delegation ) { 13169 $(document) 13170 .off('submit.form-plugin', this.selector, doAjaxSubmit) 13171 .off('click.form-plugin', this.selector, captureSubmittingElement) 13172 .on('submit.form-plugin', this.selector, options, doAjaxSubmit) 13173 .on('click.form-plugin', this.selector, options, captureSubmittingElement); 13174 return this; 13175 } 13176 13177 return this.ajaxFormUnbind() 13178 .bind('submit.form-plugin', options, doAjaxSubmit) 13179 .bind('click.form-plugin', options, captureSubmittingElement); 13180}; 13181 13182// private event handlers 13183function doAjaxSubmit(e) { 13184 /*jshint validthis:true */ 13185 var options = e.data; 13186 if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed 13187 e.preventDefault(); 13188 $(this).ajaxSubmit(options); 13189 } 13190} 13191 13192function captureSubmittingElement(e) { 13193 /*jshint validthis:true */ 13194 var target = e.target; 13195 var $el = $(target); 13196 if (!($el.is(":submit,input:image"))) { 13197 // is this a child element of the submit el? (ex: a span within a button) 13198 var t = $el.closest(':submit'); 13199 if (t.length === 0) { 13200 return; 13201 } 13202 target = t[0]; 13203 } 13204 var form = this; 13205 form.clk = target; 13206 if (target.type == 'image') { 13207 if (e.offsetX !== undefined) { 13208 form.clk_x = e.offsetX; 13209 form.clk_y = e.offsetY; 13210 } else if (typeof $.fn.offset == 'function') { 13211 var offset = $el.offset(); 13212 form.clk_x = e.pageX - offset.left; 13213 form.clk_y = e.pageY - offset.top; 13214 } else { 13215 form.clk_x = e.pageX - target.offsetLeft; 13216 form.clk_y = e.pageY - target.offsetTop; 13217 } 13218 } 13219 // clear form vars 13220 setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); 13221} 13222 13223 13224// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 13225$.fn.ajaxFormUnbind = function() { 13226 return this.unbind('submit.form-plugin click.form-plugin'); 13227}; 13228 13229/** 13230 * formToArray() gathers form element data into an array of objects that can 13231 * be passed to any of the following ajax functions: $.get, $.post, or load. 13232 * Each object in the array has both a 'name' and 'value' property. An example of 13233 * an array for a simple login form might be: 13234 * 13235 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 13236 * 13237 * It is this array that is passed to pre-submit callback functions provided to the 13238 * ajaxSubmit() and ajaxForm() methods. 13239 */ 13240$.fn.formToArray = function(semantic, elements) { 13241 var a = []; 13242 if (this.length === 0) { 13243 return a; 13244 } 13245 13246 var form = this[0]; 13247 var els = semantic ? form.getElementsByTagName('*') : form.elements; 13248 if (!els) { 13249 return a; 13250 } 13251 13252 var i,j,n,v,el,max,jmax; 13253 for(i=0, max=els.length; i < max; i++) { 13254 el = els[i]; 13255 n = el.name; 13256 if (!n) { 13257 continue; 13258 } 13259 13260 if (semantic && form.clk && el.type == "image") { 13261 // handle image inputs on the fly when semantic == true 13262 if(!el.disabled && form.clk == el) { 13263 a.push({name: n, value: $(el).val(), type: el.type }); 13264 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 13265 } 13266 continue; 13267 } 13268 13269 v = $.fieldValue(el, true); 13270 if (v && v.constructor == Array) { 13271 if (elements) 13272 elements.push(el); 13273 for(j=0, jmax=v.length; j < jmax; j++) { 13274 a.push({name: n, value: v[j]}); 13275 } 13276 } 13277 else if (feature.fileapi && el.type == 'file' && !el.disabled) { 13278 if (elements) 13279 elements.push(el); 13280 var files = el.files; 13281 if (files.length) { 13282 for (j=0; j < files.length; j++) { 13283 a.push({name: n, value: files[j], type: el.type}); 13284 } 13285 } 13286 else { 13287 // #180 13288 a.push({ name: n, value: '', type: el.type }); 13289 } 13290 } 13291 else if (v !== null && typeof v != 'undefined') { 13292 if (elements) 13293 elements.push(el); 13294 a.push({name: n, value: v, type: el.type, required: el.required}); 13295 } 13296 } 13297 13298 if (!semantic && form.clk) { 13299 // input type=='image' are not found in elements array! handle it here 13300 var $input = $(form.clk), input = $input[0]; 13301 n = input.name; 13302 if (n && !input.disabled && input.type == 'image') { 13303 a.push({name: n, value: $input.val()}); 13304 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 13305 } 13306 } 13307 return a; 13308}; 13309 13310/** 13311 * Serializes form data into a 'submittable' string. This method will return a string 13312 * in the format: name1=value1&name2=value2 13313 */
13314$.fn.formSerialize = function(semantic) { 13315 //hand off to jQuery.param for proper encoding 13316 return $.param(this.formToArray(semantic)); 13317}; 13318 13319/** 13320 * Serializes all field elements in the jQuery object into a query string. 13321 * This method will return a string in the format: name1=value1&name2=value2 13322 */ 13323$.fn.fieldSerialize = function(successful) { 13324 var a = []; 13325 this.each(function() { 13326 var n = this.name; 13327 if (!n) { 13328 return; 13329 } 13330 var v = $.fieldValue(this, successful); 13331 if (v && v.constructor == Array) { 13332 for (var i=0,max=v.length; i < max; i++) { 13333 a.push({name: n, value: v[i]}); 13334 } 13335 } 13336 else if (v !== null && typeof v != 'undefined') { 13337 a.push({name: this.name, value: v}); 13338 } 13339 }); 13340 //hand off to jQuery.param for proper encoding 13341 return $.param(a); 13342}; 13343 13344/** 13345 * Returns the value(s) of the element in the matched set. For example, consider the following form: 13346 * 13347 * <form><fieldset> 13348 * <input name="A" type="text" /> 13349 * <input name="A" type="text" /> 13350 * <input name="B" type="checkbox" value="B1" /> 13351 * <input name="B" type="checkbox" value="B2"/> 13352 * <input name="C" type="radio" value="C1" /> 13353 * <input name="C" type="radio" value="C2" /> 13354 * </fieldset></form> 13355 * 13356 * var v = $(':text').fieldValue(); 13357 * // if no values are entered into the text inputs 13358 * v == ['',''] 13359 * // if values entered into the text inputs are 'foo' and 'bar' 13360 * v == ['foo','bar'] 13361 * 13362 * var v = $(':checkbox').fieldValue(); 13363 * // if neither checkbox is checked 13364 * v === undefined 13365 * // if both checkboxes are checked 13366 * v == ['B1', 'B2'] 13367 * 13368 * var v = $(':radio').fieldValue(); 13369 * // if neither radio is checked 13370 * v === undefined 13371 * // if first radio is checked 13372 * v == ['C1'] 13373 * 13374 * The successful argument controls whether or not the field element must be 'successful' 13375 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 13376 * The default value of the successful argument is true. If this value is false the value(s) 13377 * for each element is returned. 13378 * 13379 * Note: This method *always* returns an array. If no valid value can be determined the 13380 * array will be empty, otherwise it will contain one or more values. 13381 */ 13382$.fn.fieldValue = function(successful) { 13383 for (var val=[], i=0, max=this.length; i < max; i++) { 13384 var el = this[i]; 13385 var v = $.fieldValue(el, successful); 13386 if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { 13387 continue; 13388 } 13389 if (v.constructor == Array) 13390 $.merge(val, v); 13391 else 13392 val.push(v); 13393 } 13394 return val; 13395}; 13396 13397/** 13398 * Returns the value of the field element. 13399 */ 13400$.fieldValue = function(el, successful) { 13401 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 13402 if (successful === undefined) { 13403 successful = true; 13404 } 13405 13406 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || 13407 (t == 'checkbox' || t == 'radio') && !el.checked || 13408 (t == 'submit' || t == 'image') && el.form && el.form.clk != el || 13409 tag == 'select' && el.selectedIndex == -1)) { 13410 return null; 13411 } 13412 13413 if (tag == 'select') { 13414 var index = el.selectedIndex; 13415 if (index < 0) { 13416 return null; 13417 } 13418 var a = [], ops = el.options; 13419 var one = (t == 'select-one'); 13420 var max = (one ? index+1 : ops.length); 13421 for(var i=(one ? index : 0); i < max; i++) { 13422 var op = ops[i]; 13423 if (op.selected) { 13424 var v = op.value; 13425 if (!v) { // extra pain for IE... 13426 v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; 13427 } 13428 if (one) { 13429 return v; 13430 } 13431 a.push(v); 13432 } 13433 } 13434 return a; 13435 } 13436 return $(el).val(); 13437}; 13438 13439/** 13440 * Clears the form data. Takes the following actions on the form's input fields: 13441 * - input text fields will have their 'value' property set to the empty string 13442 * - select elements will have their 'selectedIndex' property set to -1 13443 * - checkbox and radio inputs will have their 'checked' property set to false 13444 * - inputs of type submit, button, reset, and hidden will *not* be effected 13445 * - button elements will *not* be effected 13446 */ 13447$.fn.clearForm = function(includeHidden) { 13448 return this.each(function() { 13449 $('input,select,textarea', this).clearFields(includeHidden); 13450 }); 13451}; 13452 13453/** 13454 * Clears the selected form elements. 13455 */ 13456$.fn.clearFields = $.fn.clearInputs = function(includeHidden) { 13457 var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list 13458 return this.each(function() { 13459 var t = this.type, tag = this.tagName.toLowerCase(); 13460 if (re.test(t) || tag == 'textarea') { 13461 this.value = ''; 13462 } 13463 else if (t == 'checkbox' || t == 'radio') { 13464 this.checked = false;
13465 } 13466 else if (tag == 'select') { 13467 this.selectedIndex = -1; 13468 } 13469 else if (includeHidden) { 13470 // includeHidden can be the valud true, or it can be a selector string 13471 // indicating a special test; for example: 13472 // $('#myForm').clearForm('.special:hidden') 13473 // the above would clean hidden inputs that have the class of 'special' 13474 if ( (includeHidden === true && /hidden/.test(t)) || 13475 (typeof includeHidden == 'string' && $(this).is(includeHidden)) ) 13476 this.value = ''; 13477 } 13478 }); 13479}; 13480 13481/** 13482 * Resets the form data. Causes all form elements to be reset to their original value. 13483 */ 13484$.fn.resetForm = function() { 13485 return this.each(function() { 13486 // guard against an input with the name of 'reset' 13487 // note that IE reports the reset function as an 'object' 13488 if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { 13489 this.reset(); 13490 } 13491 }); 13492}; 13493 13494/** 13495 * Enables or disables any matching elements. 13496 */ 13497$.fn.enable = function(b) { 13498 if (b === undefined) { 13499 b = true; 13500 } 13501 return this.each(function() { 13502 this.disabled = !b; 13503 }); 13504}; 13505 13506/** 13507 * Checks/unchecks any matching checkboxes or radio buttons and 13508 * selects/deselects and matching option elements. 13509 */ 13510$.fn.selected = function(select) { 13511 if (select === undefined) { 13512 select = true; 13513 } 13514 return this.each(function() { 13515 var t = this.type; 13516 if (t == 'checkbox' || t == 'radio') { 13517 this.checked = select; 13518 } 13519 else if (this.tagName.toLowerCase() == 'option') { 13520 var $sel = $(this).parent('select'); 13521 if (select && $sel[0] && $sel[0].type == 'select-one') { 13522 // deselect all other options 13523 $sel.find('option').selected(false); 13524 } 13525 this.selected = select; 13526 } 13527 }); 13528}; 13529 13530// expose debug var 13531$.fn.ajaxSubmit.debug = false; 13532 13533// helper fn for console logging 13534function log() { 13535 if (!$.fn.ajaxSubmit.debug) 13536 return; 13537 var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); 13538 if (window.console && window.console.log) { 13539 window.console.log(msg); 13540 } 13541 else if (window.opera && window.opera.postError) { 13542 window.opera.postError(msg); 13543 } 13544} 13545 13546})(jQuery); 13547/*! 13548 * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016 13549 * @version 1.3.4 13550 * 13551 * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format. 13552 * @see http://php.net/manual/en/function.date.php 13553 * 13554 * For more JQuery plugins visit http://plugins.krajee.com 13555 * For more Yii related demos visit http://demos.krajee.com 13556 */var DateFormatter;!function(){"use strict";var t,e,r,n,a,u,i;u=864e5,i=3600,t=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},e=function(t,r,n){var a=n||"0",u=t.toString();return u.length<r?e(a+u,r):u},r=function(t){var e,n;for(t=t||{},e=1;e<arguments.length;e++)if(n=arguments[e])for(var a in n)n.hasOwnProperty(a)&&("object"==typeof n[a]?r(t[a],n[a]):t[a]=n[a]);return t},n=function(t,e){for(var r=0;r<e.length;r++)if(e[r].toLowerCase()===t.toLowerCase())return r;return-1},a={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,r={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&r[e]?r[e]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},DateFormatter=function(t){var e=this,n=r(a,t);e.dateSettings=n.dateSettings,e.separators=n.separators,e.validParts=n.validParts,e.intParts=n.intParts,e.tzParts=n.tzParts,e.tzClip=n.tzClip},DateFormatter.prototype={constructor:DateFormatter,getMonth:function(t){var e,r=this;return e=n(t,r.dateSettings.monthsShort)+1,0===e&&(e=n(t,r.dateSettings.months)+1),e},parseDate:function(e,r){var n,a,u,i,s,o,c,f,l,h,d=this,g=!1,m=!1,p=d.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===r)return u=parseInt(e),u?new Date(1e3*u):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}
vendor: 4,365 bytes, line 13556
13556if(n=r.match(d.validParts),!n||0===n.length)throw new Error("Invalid date format definition.");for(a=e.replace(d.separators,"\x00").split("\x00"),u=0;u<a.length;u++)switch(i=a[u],s=parseInt(i),n[u]){case"y":case"Y":if(!s)return null;l=i.length,y.year=2===l?parseInt((70>s?"20":"19")+i):s,g=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(o=d.getMonth(i),!(o>0))return null;y.month=o}else{if(!(s>=1&&12>=s))return null;y.month=s}g=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;y.day=s,g=!0;break;case"g":case"h":if(c=n.indexOf("a")>-1?n.indexOf("a"):n.indexOf("A")>-1?n.indexOf("A"):-1,h=a[c],c>-1)f=t(h,p.meridiem[0])?0:t(h,p.meridiem[1])?12:-1,s>=1&&12>=s&&f>-1?y.hour=s+f-1:s>=0&&23>=s&&(y.hour=s);else{if(!(s>=0&&23>=s))return null;y.hour=s}m=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;y.hour=s,m=!0;break;case"i":if(!(s>=0&&59>=s))return null;y.min=s,m=!0;break;case"s":if(!(s>=0&&59>=s))return null;y.sec=s,m=!0}if(g===!0&&y.year&&y.month&&y.day)y.date=new Date(y.year,y.month-1,y.day,y.hour,y.min,y.sec,0);else{if(m!==!0)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,e){if("string"!=typeof t)return t;var r,n,a,u,i,s,o=this,c=t.replace(o.separators,"\x00").split("\x00"),f=/^[djmn]/g,l=e.match(o.validParts),h=new Date,d=0;if(!f.test(l[0]))return t;for(a=0;a<c.length;a++){if(d=2,i=c[a],s=parseInt(i.substr(0,2)),isNaN(s))return null;switch(a){case 0:"m"===l[0]||"n"===l[0]?h.setMonth(s-1):h.setDate(s);break;case 1:"m"===l[0]||"n"===l[0]?h.setDate(s):h.setMonth(s-1);break;case 2:if(n=h.getFullYear(),r=i.length,d=4>r?r:4,n=parseInt(4>r?n.toString().substr(0,4-r)+i:i.substr(0,4)),!n)return null;h.setFullYear(n);break;case 3:h.setHours(s);break;case 4:h.setMinutes(s);break;case 5:h.setSeconds(s)}u=i.substr(d),u.length>0&&c.splice(a+1,0,u)}return h},parseFormat:function(t,r){var n,a=this,s=a.dateSettings,o=/\\?(.?)/gi,c=function(t,e){return n[t]?n[t]():e};return n={d:function(){return e(n.j(),2)},D:function(){return s.daysShort[n.w()]},j:function(){return r.getDate()},l:function(){return s.days[n.w()]},N:function(){return n.w()||7},w:function(){return r.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/u)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),r=new Date(t.getFullYear(),0,4);return e(1+Math.round((t-r)/u/7),2)},F:function(){return s.months[r.getMonth()]},m:function(){return e(n.n(),2)},M:function(){return s.monthsShort[r.getMonth()]},n:function(){return r.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4===0&&t%100!==0||t%400===0?1:0},o:function(){var t=n.n(),e=n.W(),r=n.Y();return r+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return r.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return n.A().toLowerCase()},A:function(){var t=n.G()<12?0:1;return s.meridiem[t]},B:function(){var t=r.getUTCHours()*i,n=60*r.getUTCMinutes(),a=r.getUTCSeconds();return e(Math.floor((t+n+a+i)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return r.getHours()},h:function(){return e(n.g(),2)},H:function(){return e(n.G(),2)},i:function(){return e(r.getMinutes(),2)},s:function(){return e(r.getSeconds(),2)},u:function(){return e(1e3*r.getMilliseconds(),6)},e:function(){var t=/\((.*)\)/.exec(String(r))[1];return t||"Coordinated Universal Time"},I:function(){var t=new Date(n.Y(),0),e=Date.UTC(n.Y(),0),r=new Date(n.Y(),6),a=Date.UTC(n.Y(),6);return t-e!==r-a?1:0},O:function(){var t=r.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+e(100*Math.floor(n/60)+n%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){var t=(String(r).match(a.tzParts)||[""]).pop().replace(a.tzClip,"");return t||"UTC"},Z:function(){return 60*-r.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(o,c)},r:function(){return"D, d M Y H:i:s O".replace(o,c)},U:function(){return r.getTime()/1e3||0}},c(t,t)},formatDate:function(t,e){var r,n,a,u,i,s=this,o="",c="\\";if("string"==typeof t&&(t=s.parseDate(t,e),!t))return null;if(t instanceof Date){for(a=e.length,r=0;a>r;r++)i=e.charAt(r),"S"!==i&&i!==c&&(r>0&&e.charAt(r-1)===c?o+=i:(u=s.parseFormat(i,t),r!==a-1&&s.intParts.test(i)&&"S"===e.charAt(r+1)&&(n=parseInt(u)||0,u+=s.dateSettings.ordinal(n)),o+=u));return o}return""}}}();
vendor: 3,950 bytes, lines 13556-13644
13556/** 13557 * @preserve jQuery DateTimePicker 13558 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ 13559 * @author Chupurnov Valeriy (<[email protected]>) 13560 */ 13561 13562/** 13563 * @param {jQuery} $ 13564 */ 13565var datetimepickerFactory = function ($) { 13566 'use strict'; 13567 13568 var default_options = { 13569 i18n: { 13570 ar: { // Arabic 13571 months: [ 13572 "ÙØ§ÙÙÙ Ø§ÙØ«Ø§ÙÙ", "شباط", "آذار", "ÙÙØ³Ø§Ù", "٠اÙÙ", "ØØ²ÙراÙ", "ØªÙ ÙØ²", "آب", "Ø£ÙÙÙÙ", "تشرÙÙ Ø§ÙØ£ÙÙ", "تشرÙÙ Ø§ÙØ«Ø§ÙÙ", "ÙØ§ÙÙÙ Ø§ÙØ£ÙÙ" 13573 ], 13574 dayOfWeekShort: [ 13575 "Ù", "Ø«", "ع", "Ø®", "ج", "س", "Ø" 13576 ], 13577 dayOfWeek: ["Ø§ÙØ£ØØ¯", "Ø§ÙØ§Ø«ÙÙÙ", "Ø§ÙØ«Ùاثاء", "Ø§ÙØ£Ø±Ø¨Ø¹Ø§Ø¡", "Ø§ÙØ®Ù ÙØ³", "Ø§ÙØ¬Ù عة", "Ø§ÙØ³Ø¨Øª", "Ø§ÙØ£ØØ¯"] 13578 }, 13579 ro: { // Romanian 13580 months: [ 13581 "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" 13582 ], 13583 dayOfWeekShort: [ 13584 "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ" 13585 ], 13586 dayOfWeek: ["DuminicÄ", "Luni", "MarÅ£i", "Miercuri", "Joi", "Vineri", "SâmbÄtÄ"] 13587 }, 13588 id: { // Indonesian 13589 months: [ 13590 "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" 13591 ], 13592 dayOfWeekShort: [ 13593 "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" 13594 ], 13595 dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"] 13596 }, 13597 is: { // Icelandic 13598 months: [ 13599 "Janúar", "Febrúar", "Mars", "AprÃl", "MaÃ", "JúnÃ", "JúlÃ", "Ãgúst", "September", "Október", "Nóvember", "Desember" 13600 ], 13601 dayOfWeekShort: [ 13602 "Sun", "Mán", "Ãrið", "Mið", "Fim", "Fös", "Lau" 13603 ], 13604 dayOfWeek: ["Sunnudagur", "Mánudagur", "Ãriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"] 13605 }, 13606 bg: { // Bulgarian 13607 months: [ 13608 "ЯнÑаÑи", "ФевÑÑаÑи", "ÐаÑÑ", "ÐпÑил", "Ðай", "Юни", "Юли", "ÐвгÑÑÑ", "СепÑемвÑи", "ÐкÑомвÑи", "ÐоемвÑи", "ÐекемвÑи" 13609 ], 13610 dayOfWeekShort: [ 13611 "Ðд", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 13612 ], 13613 dayOfWeek: ["ÐеделÑ", "Ðонеделник", "ÐÑоÑник", "СÑÑда", "ЧеÑвÑÑÑÑк", "ÐеÑÑк", "СÑбоÑа"] 13614 }, 13615 fa: { // Persian/Farsi 13616 months: [ 13617 'ÙØ±ÙردÛÙ', 'Ø§Ø±Ø¯ÛØ¨Ùشت', 'خرداد', 'ØªÛØ±', '٠رداد', 'Ø´ÙØ±ÛÙØ±', 'Ù ÙØ±', 'آباÙ', 'آذر', 'دÛ', 'بÙÙ Ù', 'اسÙÙØ¯' 13618 ], 13619 dayOfWeekShort: [ 13620 'ÛÚ©Ø´ÙØ¨Ù', 'Ø¯ÙØ´ÙبÙ', 'Ø³Ù Ø´ÙØ¨Ù', 'ÚÙØ§Ø±Ø´ÙبÙ', 'Ù¾ÙØ¬Ø´ÙبÙ', 'ج٠عÙ', 'Ø´ÙØ¨Ù' 13621 ], 13622 dayOfWeek: ["ÛÚ©âØ´ÙØ¨Ù", "Ø¯ÙØ´ÙبÙ", "سÙâØ´ÙØ¨Ù", "ÚÙØ§Ø±Ø´ÙبÙ", "Ù¾ÙØ¬âØ´ÙØ¨Ù", "ج٠عÙ", "Ø´ÙØ¨Ù", "ÛÚ©âØ´ÙØ¨Ù"] 13623 }, 13624 ru: { // Russian 13625 months: [ 13626 'ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ' 13627 ], 13628 dayOfWeekShort: [ 13629 "ÐÑ", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 13630 ], 13631 dayOfWeek: ["ÐоÑкÑеÑенÑе", "ÐонеделÑник", "ÐÑоÑник", "СÑеда", "ЧеÑвеÑг", "ÐÑÑниÑа", "СÑббоÑа"] 13632 }, 13633 uk: { // Ukrainian 13634 months: [ 13635 'СÑÑенÑ', 'ÐÑÑий', 'ÐеÑезенÑ', 'ÐвÑÑенÑ', 'ТÑавенÑ', 'ЧеÑвенÑ', 'ÐипенÑ', 'СеÑпенÑ', 'ÐеÑеÑенÑ', 'ÐовÑенÑ', 'ÐиÑÑопад', 'ÐÑÑденÑ' 13636 ], 13637 dayOfWeekShort: [ 13638 "Ðдл", "Ðнд", "ÐÑÑ", "СÑд", "ЧÑв", "ÐÑн", "СбÑ" 13639 ], 13640 dayOfWeek: ["ÐедÑлÑ", "ÐонедÑлок", "ÐÑвÑоÑок", "СеÑеда", "ЧеÑвеÑ", "Ð'ÑÑниÑÑ", "СÑбоÑа"] 13641 }, 13642 en: { // English 13643 months: [ 13644 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
vendor: 18,361 bytes, lines 13644-14069
13644November", "December" 13645 ], 13646 dayOfWeekShort: [ 13647 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 13648 ], 13649 dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 13650 }, 13651 el: { // Îλληνικά 13652 months: [ 13653 "ÎÎ±Î½Î¿Ï Î¬ÏιοÏ", "ΦεβÏÎ¿Ï Î¬ÏιοÏ", "ÎάÏÏιοÏ", "ÎÏÏίλιοÏ", "ÎάιοÏ", "ÎοÏνιοÏ", "ÎοÏλιοÏ", "ÎÏÎ³Î¿Ï ÏÏοÏ", "ΣεÏÏÎμβÏιοÏ", "ÎκÏÏβÏιοÏ", "ÎοÎμβÏιοÏ", "ÎεκÎμβÏιοÏ" 13654 ], 13655 dayOfWeekShort: [ 13656 "ÎÏ Ï", "ÎÎµÏ ", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ" 13657 ], 13658 dayOfWeek: ["ÎÏ Ïιακή", "ÎÎµÏ ÏÎÏα", "ΤÏίÏη", "ΤεÏάÏÏη", "Î ÎμÏÏη", "ΠαÏαÏÎºÎµÏ Î®", "ΣάββαÏο"] 13659 }, 13660 de: { // German 13661 months: [ 13662 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' 13663 ], 13664 dayOfWeekShort: [ 13665 "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" 13666 ], 13667 dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] 13668 }, 13669 nl: { // Dutch 13670 months: [ 13671 "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" 13672 ], 13673 dayOfWeekShort: [ 13674 "zo", "ma", "di", "wo", "do", "vr", "za" 13675 ], 13676 dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] 13677 }, 13678 tr: { // Turkish 13679 months: [ 13680 "Ocak", "Åubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "AÄustos", "Eylül", "Ekim", "Kasım", "Aralık" 13681 ], 13682 dayOfWeekShort: [ 13683 "Paz", "Pts", "Sal", "Ãar", "Per", "Cum", "Cts" 13684 ], 13685 dayOfWeek: ["Pazar", "Pazartesi", "Salı", "ÃarÅamba", "PerÅembe", "Cuma", "Cumartesi"] 13686 }, 13687 fr: { //French 13688 months: [ 13689 "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" 13690 ], 13691 dayOfWeekShort: [ 13692 "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" 13693 ], 13694 dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] 13695 }, 13696 es: { // Spanish 13697 months: [ 13698 "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" 13699 ], 13700 dayOfWeekShort: [ 13701 "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" 13702 ], 13703 dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"] 13704 }, 13705 th: { // Thai 13706 months: [ 13707 'มà¸à¸£à¸²à¸à¸¡', 'à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹', 'มีà¸à¸²à¸à¸¡', 'à¹à¸¡à¸©à¸²à¸¢à¸', 'à¸à¸¤à¸©à¸ าà¸à¸¡', 'มิà¸à¸¸à¸à¸²à¸¢à¸', 'à¸à¸£à¸à¸à¸²à¸à¸¡', 'สิà¸à¸«à¸²à¸à¸¡', 'à¸à¸±à¸à¸¢à¸²à¸¢à¸', 'à¸à¸¸à¸¥à¸²à¸à¸¡', 'à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸', 'à¸à¸±à¸à¸§à¸²à¸à¸¡' 13708 ], 13709 dayOfWeekShort: [ 13710 'à¸à¸².', 'à¸.', 'à¸.', 'à¸.', 'à¸à¸¤.', 'ศ.', 'ส.' 13711 ], 13712 dayOfWeek: ["à¸à¸²à¸à¸´à¸à¸¢à¹", "à¸à¸±à¸à¸à¸£à¹", "à¸à¸±à¸à¸à¸²à¸£", "à¸à¸¸à¸", "à¸à¸¤à¸«à¸±à¸ª", "ศุà¸à¸£à¹", "à¹à¸ªà¸²à¸£à¹", "à¸à¸²à¸à¸´à¸à¸¢à¹"] 13713 }, 13714 pl: { // Polish 13715 months: [ 13716 "styczeÅ", "luty", "marzec", "kwiecieÅ", "maj", "czerwiec", "lipiec", "sierpieÅ", "wrzesieÅ", "październik", "listopad", "grudzieÅ" 13717 ], 13718 dayOfWeekShort: [ 13719 "nd", "pn", "wt", "År", "cz", "pt", "sb" 13720 ], 13721 dayOfWeek: ["niedziela", "poniedziaÅek", "wtorek", "Åroda", "czwartek", "piÄ tek", "sobota"] 13722 }, 13723 pt: { // Portuguese 13724 months: [ 13725 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 13726 ], 13727 dayOfWeekShort: [ 13728 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" 13729 ], 13730 dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] 13731 }, 13732 ch: { // Simplified Chinese 13733 months: [ 13734 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 13735 ], 13736 dayOfWeekShort: [ 13737 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 13738 ] 13739 }, 13740 se: { // Swedish 13741 months: [ 13742 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" 13743 ], 13744 dayOfWeekShort: [ 13745 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 13746 ] 13747 }, 13748 km: { // Khmer (áá¶áá¶ááááá) 13749 months: [ 13750 "áááá¶â", "áá»áááá", "áá·áá¶â", "áááá¶â", "á§ááá¶â", "áá·áá»áá¶â", "áááááá¶â", "áá¸á á¶â", "ááááá¶â", "áá»áá¶â", "áá·á ááá·áá¶", "áááá¼â" 13751 ], 13752 dayOfWeekShort: ["á¢á¶áá·â", "á ááááâ", "á¢áááá¶áâ", "áá»áâ", "áááá ââ", "áá»áááâ", "áá áá"], 13753 dayOfWeek: ["á¢á¶áá·áááâ", "á ááááâ", "á¢áááá¶áâ", "áá»áâ", "áááá ááááá·áâ", "áá»áááâ", "áá áá"] 13754 }, 13755 kr: { // Korean 13756 months: [ 13757 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 13758 ], 13759 dayOfWeekShort: [ 13760 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 13761 ], 13762 dayOfWeek: ["ì¼ìì¼", "ììì¼", "íìì¼", "ììì¼", "목ìì¼", "ê¸ìì¼", "í ìì¼"] 13763 }, 13764 it: { // Italian 13765 months: [ 13766 "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" 13767 ], 13768 dayOfWeekShort: [ 13769 "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" 13770 ], 13771 dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] 13772 }, 13773 da: { // Dansk 13774 months: [ 13775 "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December" 13776 ], 13777 dayOfWeekShort: [ 13778 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 13779 ], 13780 dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"] 13781 }, 13782 no: { // Norwegian 13783 months: [ 13784 "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" 13785 ], 13786 dayOfWeekShort: [ 13787 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 13788 ], 13789 dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'] 13790 }, 13791 ja: { // Japanese 13792 months: [ 13793 "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ" 13794 ], 13795 dayOfWeekShort: [ 13796 "æ¥", "æ", "ç«", "æ°´", "æ¨", "é", "å" 13797 ], 13798 dayOfWeek: ["æ¥æ", "ææ", "ç«æ", "æ°´æ", "æ¨æ", "éæ", "åæ"] 13799 }, 13800 vi: { // Vietnamese 13801 months: [ 13802 "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" 13803 ], 13804 dayOfWeekShort: [ 13805 "CN", "T2", "T3", "T4", "T5", "T6", "T7" 13806 ], 13807 dayOfWeek: ["Chá»§ nháºt", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ nÄm", "Thứ sáu", "Thứ bảy"] 13808 }, 13809 sl: { // SlovenÅ¡Äina 13810 months: [ 13811 "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" 13812 ], 13813 dayOfWeekShort: [ 13814 "Ned", "Pon", "Tor", "Sre", "Äet", "Pet", "Sob" 13815 ], 13816 dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Äetrtek", "Petek", "Sobota"] 13817 }, 13818 cs: { // ÄeÅ¡tina 13819 months: [ 13820 "Leden", "Ãnor", "BÅezen", "Duben", "KvÄten", "Äerven", "Äervenec", "Srpen", "ZáÅÃ", "ÅÃjen", "Listopad", "Prosinec" 13821 ], 13822 dayOfWeekShort: [ 13823 "Ne", "Po", "Ãt", "St", "Ät", "Pá", "So" 13824 ] 13825 }, 13826 hu: { // Hungarian 13827 months: [ 13828 "Január", "Február", "Március", "Ãprilis", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" 13829 ], 13830 dayOfWeekShort: [ 13831 "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" 13832 ], 13833 dayOfWeek: ["vasárnap", "hétfÅ", "kedd", "szerda", "csütörtök", "péntek", "szombat"] 13834 }, 13835 az: { //Azerbaijanian (Azeri) 13836 months: [ 13837 "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" 13838 ], 13839 dayOfWeekShort: [ 13840 "B", "Be", "Ãa", "Ã", "Ca", "C", "Å" 13841 ], 13842 dayOfWeek: ["Bazar", "Bazar ertÉsi", "ÃÉrÅÉnbÉ axÅamı", "ÃÉrÅÉnbÉ", "CümÉ axÅamı", "CümÉ", "ÅÉnbÉ"] 13843 }, 13844 bs: { //Bosanski 13845 months: [ 13846 "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" 13847 ], 13848 dayOfWeekShort: [ 13849 "Ned", "Pon", "Uto", "Sri", "Äet", "Pet", "Sub" 13850 ], 13851 dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Äetvrtak", "Petak", "Subota"] 13852 }, 13853 ca: { //Català 13854 months: [ 13855 "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" 13856 ], 13857 dayOfWeekShort: [ 13858 "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" 13859 ], 13860 dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"] 13861 }, 13862 'en-GB': { //English (British) 13863 months: [ 13864 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" 13865 ], 13866 dayOfWeekShort: [ 13867 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 13868 ], 13869 dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 13870 }, 13871 et: { //"Eesti" 13872 months: [ 13873 "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" 13874 ], 13875 dayOfWeekShort: [ 13876 "P", "E", "T", "K", "N", "R", "L" 13877 ], 13878 dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"] 13879 }, 13880 eu: { //Euskara 13881 months: [ 13882 "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" 13883 ], 13884 dayOfWeekShort: [ 13885 "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." 13886 ], 13887 dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata'] 13888 }, 13889 fi: { //Finnish (Suomi) 13890 months: [ 13891 "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" 13892 ], 13893 dayOfWeekShort: [ 13894 "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" 13895 ], 13896 dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"] 13897 }, 13898 gl: { //Galego 13899 months: [ 13900 "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" 13901 ], 13902 dayOfWeekShort: [ 13903 "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" 13904 ], 13905 dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"] 13906 }, 13907 hr: { //Hrvatski 13908 months: [ 13909 "SijeÄanj", "VeljaÄa", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" 13910 ], 13911 dayOfWeekShort: [ 13912 "Ned", "Pon", "Uto", "Sri", "Äet", "Pet", "Sub" 13913 ], 13914 dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Äetvrtak", "Petak", "Subota"] 13915 }, 13916 ko: { //Korean (íêµì´) 13917 months: [ 13918 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 13919 ], 13920 dayOfWeekShort: [ 13921 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 13922 ], 13923 dayOfWeek: ["ì¼ìì¼", "ììì¼", "íìì¼", "ììì¼", "목ìì¼", "ê¸ìì¼", "í ìì¼"] 13924 }, 13925 lt: { //Lithuanian (lietuvių) 13926 months: [ 13927 "Sausio", "Vasario", "Kovo", "Balandžio", "GegužÄs", "Birželio", "Liepos", "RugpjÅ«Äio", "RugsÄjo", "Spalio", "LapkriÄio", "Gruodžio" 13928 ], 13929 dayOfWeekShort: [ 13930 "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Å eÅ¡" 13931 ], 13932 dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "TreÄiadienis", "Ketvirtadienis", "Penktadienis", "Å eÅ¡tadienis"] 13933 }, 13934 lv: { //Latvian (LatvieÅ¡u) 13935 months: [ 13936 "JanvÄris", "FebruÄris", "Marts", "AprÄ«lis ", "Maijs", "JÅ«nijs", "JÅ«lijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" 13937 ], 13938 dayOfWeekShort: [ 13939 "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" 13940 ], 13941 dayOfWeek: ["SvÄtdiena", "Pirmdiena", "Otrdiena", "TreÅ¡diena", "Ceturtdiena", "Piektdiena", "Sestdiena"] 13942 }, 13943 mk: { //Macedonian (ÐакедонÑки) 13944 months: [ 13945 "ÑанÑаÑи", "ÑевÑÑаÑи", "маÑÑ", "апÑил", "маÑ", "ÑÑни", "ÑÑли", "авгÑÑÑ", "ÑепÑемвÑи", "окÑомвÑи", "ноемвÑи", "декемвÑи" 13946 ], 13947 dayOfWeekShort: [ 13948 "нед", "пон", "вÑо", "ÑÑе", "ÑеÑ", "пеÑ", "Ñаб" 13949 ], 13950 dayOfWeek: ["Ðедела", "Ðонеделник", "ÐÑоÑник", "СÑеда", "ЧеÑвÑÑок", "ÐеÑок", "СабоÑа"] 13951 }, 13952 mn: { //Mongolian (Ðонгол) 13953 months: [ 13954 "1-Ñ ÑаÑ", "2-Ñ ÑаÑ", "3-Ñ ÑаÑ", "4-Ñ ÑаÑ", "5-Ñ ÑаÑ", "6-Ñ ÑаÑ", "7-Ñ ÑаÑ", "8-Ñ ÑаÑ", "9-Ñ ÑаÑ", "10-Ñ ÑаÑ", "11-Ñ ÑаÑ", "12-Ñ ÑаÑ" 13955 ], 13956 dayOfWeekShort: [ 13957 "Ðав", "ÐÑг", "ÐÑ Ð°", "ÐÒ¯Ñ", "ÐÑн", "ÐÑм", "ÐÑм" 13958 ], 13959 dayOfWeek: ["Ðаваа", "ÐÑгмаÑ", "ÐÑ Ð°Ð³Ð²Ð°", "ÐÒ¯ÑÑв", "ÐааÑан", "ÐÑмба", "ÐÑм"] 13960 }, 13961 'pt-BR': { //Português(Brasil) 13962 months: [ 13963 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 13964 ], 13965 dayOfWeekShort: [ 13966 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" 13967 ], 13968 dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] 13969 }, 13970 sk: { //SlovenÄina 13971 months: [ 13972 "Január", "Február", "Marec", "AprÃl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" 13973 ], 13974 dayOfWeekShort: [ 13975 "Ne", "Po", "Ut", "St", "Å t", "Pi", "So" 13976 ], 13977 dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Å tvrtok", "Piatok", "Sobota"] 13978 }, 13979 sq: { //Albanian (Shqip) 13980 months: [ 13981 "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor" 13982 ], 13983 dayOfWeekShort: [ 13984 "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu" 13985 ], 13986 dayOfWeek: ["E Diel", "E Hënë", "E MartÄ", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"] 13987 }, 13988 'sr-YU': { //Serbian (Srpski) 13989 months: [ 13990 "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" 13991 ], 13992 dayOfWeekShort: [ 13993 "Ned", "Pon", "Uto", "Sre", "Äet", "Pet", "Sub" 13994 ], 13995 dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Äetvrtak", "Petak", "Subota"] 13996 }, 13997 sr: { //Serbian Cyrillic (СÑпÑки) 13998 months: [ 13999 "ÑанÑаÑ", "ÑебÑÑаÑ", "маÑÑ", "апÑил", "маÑ", "ÑÑн", "ÑÑл", "авгÑÑÑ", "ÑепÑембаÑ", "окÑобаÑ", "новембаÑ", "деÑембаÑ" 14000 ], 14001 dayOfWeekShort: [ 14002 "нед", "пон", "ÑÑо", "ÑÑе", "ÑеÑ", "пеÑ", "ÑÑб" 14003 ], 14004 dayOfWeek: ["ÐедеÑа","ÐонедеÑак", "УÑоÑак", "СÑеда", "ЧеÑвÑÑак", "ÐеÑак", "СÑбоÑа"] 14005 }, 14006 sv: { //Svenska 14007 months: [ 14008 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" 14009 ], 14010 dayOfWeekShort: [ 14011 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 14012 ], 14013 dayOfWeek: ["Söndag", "MÃ¥ndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"] 14014 }, 14015 'zh-TW': { //Traditional Chinese (ç¹é«ä¸æ) 14016 months: [ 14017 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 14018 ], 14019 dayOfWeekShort: [ 14020 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 14021 ], 14022 dayOfWeek: ["æææ¥", "ææä¸", "ææäº", "ææä¸", "ææå", "ææäº", "ææå "] 14023 }, 14024 zh: { //Simplified Chinese (ç®ä½ä¸æ) 14025 months: [ 14026 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 14027 ], 14028 dayOfWeekShort: [ 14029 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 14030 ], 14031 dayOfWeek: ["æææ¥", "ææä¸", "ææäº", "ææä¸", "ææå", "ææäº", "ææå "] 14032 }, 14033 ug:{ // Uyghur(ئÛÙØºÛرÚÛ) 14034 months: [ 14035 "1-ئاÙ","2-ئاÙ","3-ئاÙ","4-ئاÙ","5-ئاÙ","6-ئاÙ","7-ئاÙ","8-ئاÙ","9-ئاÙ","10-ئاÙ","11-ئاÙ","12-ئاÙ" 14036 ], 14037 dayOfWeek: [ 14038 "ÙÛÙØ´ÛÙØ¨Û", "Ø¯ÛØ´ÛÙØ¨Û","سÛÙØ´ÛÙØ¨Û","ÚØ§Ø±Ø´ÛÙØ¨Û","Ù¾ÛÙØ´ÛÙØ¨Û","جÛÙ Û","Ø´ÛÙØ¨Û" 14039 ] 14040 }, 14041 he: { //Hebrew (×¢×ר×ת) 14042 months: [ 14043 '×× ××ר', 'פ×ר××ר', '×רץ', '×פר××', '×××', '××× ×', '××××', '××××ס×', 'ספ×××ר', '×××§×××ר', '× ××××ר', '×צ××ר' 14044 ], 14045 dayOfWeekShort: [ 14046 '×\'', '×\'', '×\'', '×\'', '×\'', '×\'', 'ש×ת' 14047 ], 14048 dayOfWeek: ["ר×ש××", "×©× ×", "ש××ש×", "ר×××¢×", "×××ש×", "ש×ש×", "ש×ת", "ר×ש××"] 14049 }, 14050 hy: { // Armenian 14051 months: [ 14052 "ÕÕ¸ÖÕ¶Õ¾Õ¡Ö", "ÕÕ¥Õ¿ÖÕ¾Õ¡Ö", "ÕÕ¡ÖÕ¿", "Ô±ÕºÖÕ«Õ¬", "ÕÕ¡ÕµÕ«Õ½", "ÕÕ¸ÖÕ¶Õ«Õ½", "ÕÕ¸ÖÕ¬Õ«Õ½", "ÕÕ£Õ¸Õ½Õ¿Õ¸Õ½", "ÕÕ¥ÕºÕ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸ÕµÕ¥Õ´Õ¢Õ¥Ö", "Ô´Õ¥Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö" 14053 ], 14054 dayOfWeekShort: [ 14055 "Ô¿Õ«", "ÔµÖÕ¯", "ÔµÖÖ", "ÕÕ¸Ö", "ÕÕ¶Õ£", "ÕÖÖÕ¢", "ÕÕ¢Õ©" 14056 ], 14057 dayOfWeek: ["Ô¿Õ«ÖÕ¡Õ¯Õ«", "ÔµÖÕ¯Õ¸ÖÕ·Õ¡Õ¢Õ©Õ«", "ÔµÖÕ¥ÖÕ·Õ¡Õ¢Õ©Õ«", "ÕÕ¸ÖÕ¥ÖÕ·Õ¡Õ¢Õ©Õ«", "ÕÕ«Õ¶Õ£Õ·Õ¡Õ¢Õ©Õ«", "ÕÖÖÕ¢Õ¡Õ©", "ÕÕ¡Õ¢Õ¡Õ©"] 14058 }, 14059 kg: { // Kyrgyz 14060 months: [ 14061 'Ò®ÑÑүн айÑ', 'ÐиÑдин айÑ', 'Ðалган ÐÑÑан', 'ЧÑн ÐÑÑан', 'ÐÑгÑ', 'ÐÑлжа', 'Теке', 'ÐÐ°Ñ Ðона', 'ÐÑк Ðона', 'ТогÑздÑн айÑ', 'ÐеÑинин айÑ', 'ÐеÑÑин айÑ' 14062 ], 14063 dayOfWeekShort: [ 14064 "Ðек", "Ðүй", "Шей", "ШаÑ", "Ðей", "ÐÑм", "ÐÑе" 14065 ], 14066 dayOfWeek: [ 14067 "ÐекÑемб", "ÐүйÑөмб", "ШейÑемб", "ШаÑÑемб", "ÐейÑемби", "ÐÑма", "ÐÑенб" 14068 ] 14069 },
vendor: 48,905 bytes, lines 14070-15502
14070 rm: { // Romansh 14071 months: [ 14072 "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December" 14073 ], 14074 dayOfWeekShort: [ 14075 "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So" 14076 ], 14077 dayOfWeek: [ 14078 "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda" 14079 ] 14080 }, 14081 ka: { // Georgian 14082 months: [ 14083 'áááááá á', 'ááááá áááá', 'ááá á¢á', 'ááá ááá', 'áááá¡á', 'ááááá¡á', 'ááááá¡á', 'ááááá¡á¢á', 'á¡áá¥á¢ááááá á', 'áá¥á¢ááááá á', 'ááááááá á', 'áááááááá á' 14084 ], 14085 dayOfWeekShort: [ 14086 "áá", "áá á¨", "á¡ááá¨", "ááá®", "á®á£á", "ááá ", "á¨áá" 14087 ], 14088 dayOfWeek: ["áááá á", "áá á¨ááááá", "á¡ááá¨ááááá", "ááá®á¨ááááá", "á®á£áá¨ááááá", "ááá áá¡áááá", "á¨ááááá"] 14089 } 14090 }, 14091 14092 ownerDocument: document, 14093 contentWindow: window, 14094 14095 value: '', 14096 rtl: false, 14097 14098 format: 'Y/m/d H:i', 14099 formatTime: 'H:i', 14100 formatDate: 'Y/m/d', 14101 14102 startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', 14103 step: 60, 14104 monthChangeSpinner: true, 14105 14106 closeOnDateSelect: false, 14107 closeOnTimeSelect: true, 14108 closeOnWithoutClick: true, 14109 closeOnInputClick: true, 14110 openOnFocus: true, 14111 14112 timepicker: true, 14113 datepicker: true, 14114 weeks: false, 14115 14116 defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') 14117 defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') 14118 14119 minDate: false, 14120 maxDate: false, 14121 minTime: false, 14122 maxTime: false, 14123 minDateTime: false, 14124 maxDateTime: false, 14125 14126 allowTimes: [], 14127 opened: false, 14128 initTime: true, 14129 inline: false, 14130 theme: '', 14131 touchMovedThreshold: 5, 14132 14133 onSelectDate: function () {}, 14134 onSelectTime: function () {}, 14135 onChangeMonth: function () {}, 14136 onGetWeekOfYear: function () {}, 14137 onChangeYear: function () {}, 14138 onChangeDateTime: function () {}, 14139 onShow: function () {}, 14140 onClose: function () {}, 14141 onGenerate: function () {}, 14142 14143 withoutCopyright: true, 14144 inverseButton: false, 14145 hours12: false, 14146 next: 'xdsoft_next', 14147 prev : 'xdsoft_prev', 14148 dayOfWeekStart: 0, 14149 parentID: 'body', 14150 timeHeightInTimePicker: 25, 14151 timepickerScrollbar: true, 14152 todayButton: true, 14153 prevButton: true, 14154 nextButton: true, 14155 defaultSelect: true, 14156 14157 scrollMonth: true, 14158 scrollTime: true, 14159 scrollInput: true, 14160 14161 lazyInit: false, 14162 mask: false, 14163 validateOnBlur: true, 14164 allowBlank: true, 14165 yearStart: 1950, 14166 yearEnd: 2050, 14167 monthStart: 0, 14168 monthEnd: 11, 14169 style: '', 14170 id: '', 14171 fixed: false, 14172 roundTime: 'round', // ceil, floor 14173 className: '', 14174 weekends: [], 14175 highlightedDates: [], 14176 highlightedPeriods: [], 14177 allowDates : [], 14178 allowDateRe : null, 14179 disabledDates : [], 14180 disabledWeekDays: [], 14181 yearOffset: 0, 14182 beforeShowDay: null, 14183 14184 enterLikeTab: true, 14185 showApplyButton: false, 14186 insideParent: false, 14187 }; 14188 14189 var dateHelper = null, 14190 defaultDateHelper = null, 14191 globalLocaleDefault = 'en', 14192 globalLocale = 'en'; 14193 14194 var dateFormatterOptionsDefault = { 14195 meridiem: ['AM', 'PM'] 14196 }; 14197 14198 var initDateFormatter = function(){ 14199 var locale = default_options.i18n[globalLocale], 14200 opts = { 14201 days: locale.dayOfWeek, 14202 daysShort: locale.dayOfWeekShort, 14203 months: locale.months, 14204 monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }) 14205 }; 14206 14207 if (typeof DateFormatter === 'function') { 14208 dateHelper = defaultDateHelper = new DateFormatter({ 14209 dateSettings: $.extend({}, dateFormatterOptionsDefault, opts) 14210 }); 14211 } 14212 }; 14213 14214 var dateFormatters = { 14215 moment: { 14216 default_options:{ 14217 format: 'YYYY/MM/DD HH:mm', 14218 formatDate: 'YYYY/MM/DD', 14219 formatTime: 'HH:mm', 14220 }, 14221 formatter: { 14222 parseDate: function (date, format) { 14223 if(isFormatStandard(format)){ 14224 return defaultDateHelper.parseDate(date, format); 14225 } 14226 var d = moment(date, format); 14227 return d.isValid() ? d.toDate() : false; 14228 }, 14229 14230 formatDate: function (date, format) { 14231 if(isFormatStandard(format)){ 14232 return defaultDateHelper.formatDate(date, format); 14233 } 14234 return moment(date).format(format); 14235 }, 14236 14237 formatMask: function(format){ 14238 return format 14239 .replace(/Y{4}/g, '9999') 14240 .replace(/Y{2}/g, '99') 14241 .replace(/M{2}/g, '19') 14242 .replace(/D{2}/g, '39') 14243 .replace(/H{2}/g, '29') 14244 .replace(/m{2}/g, '59') 14245 .replace(/s{2}/g, '59'); 14246 }, 14247 } 14248 } 14249 } 14250 14251 // for locale settings 14252 $.datetimepicker = { 14253 setLocale: function(locale){ 14254 var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault; 14255 if (globalLocale !== newLocale) { 14256 globalLocale = newLocale; 14257 // reinit date formatter 14258 initDateFormatter(); 14259 } 14260 }, 14261 14262 setDateFormatter: function(dateFormatter) { 14263 if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){ 14264 var df = dateFormatters[dateFormatter]; 14265 $.extend(default_options, df.default_options); 14266 dateHelper = df.formatter; 14267 } 14268 else { 14269 dateHelper = dateFormatter; 14270 } 14271 }, 14272 }; 14273 14274 var standardFormats = { 14275 RFC_2822: 'D, d M Y H:i:s O', 14276 ATOM: 'Y-m-d\TH:i:sP', 14277 ISO_8601: 'Y-m-d\TH:i:sO', 14278 RFC_822: 'D, d M y H:i:s O', 14279 RFC_850: 'l, d-M-y H:i:s T', 14280 RFC_1036: 'D, d M y H:i:s O', 14281 RFC_1123: 'D, d M Y H:i:s O', 14282 RSS: 'D, d M Y H:i:s O', 14283 W3C: 'Y-m-d\TH:i:sP' 14284 } 14285 14286 var isFormatStandard = function(format){ 14287 return Object.values(standardFormats).indexOf(format) === -1 ? false : true; 14288 } 14289 14290 $.extend($.datetimepicker, standardFormats); 14291 14292 // first init date formatter 14293 initDateFormatter(); 14294 14295 // fix for ie8 14296 if (!window.getComputedStyle) { 14297 window.getComputedStyle = function (el) { 14298 this.el = el; 14299 this.getPropertyValue = function (prop) { 14300 var re = /(-([a-z]))/g; 14301 if (prop === 'float') { 14302 prop = 'styleFloat'; 14303 } 14304 if (re.test(prop)) { 14305 prop = prop.replace(re, function (a, b, c) { 14306 return c.toUpperCase(); 14307 }); 14308 } 14309 return el.currentStyle[prop] || null; 14310 }; 14311 return this; 14312 }; 14313 } 14314 if (!Array.prototype.indexOf) { 14315 Array.prototype.indexOf = function (obj, start) { 14316 var i, j; 14317 for (i = (start || 0), j = this.length; i < j; i += 1) { 14318 if (this[i] === obj) { return i; } 14319 } 14320 return -1; 14321 }; 14322 } 14323 14324 Date.prototype.countDaysInMonth = function () { 14325 return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); 14326 }; 14327 14328 $.fn.xdsoftScroller = function (options, percent) { 14329 return this.each(function () { 14330 var timeboxparent = $(this), 14331 pointerEventToXY = function (e) { 14332 var out = {x: 0, y: 0}, 14333 touch; 14334 if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { 14335 touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 14336 out.x = touch.clientX; 14337 out.y = touch.clientY; 14338 } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { 14339 out.x = e.clientX; 14340 out.y = e.clientY; 14341 } 14342 return out; 14343 }, 14344 timebox, 14345 parentHeight, 14346 height, 14347 scrollbar, 14348 scroller, 14349 maximumOffset = 100, 14350 start = false, 14351 startY = 0, 14352 startTop = 0, 14353 h1 = 0, 14354 touchStart = false, 14355 startTopScroll = 0, 14356 calcOffset = function () {}; 14357 14358 if (percent === 'hide') { 14359 timeboxparent.find('.xdsoft_scrollbar').hide(); 14360 return; 14361 } 14362 14363 if (!$(this).hasClass('xdsoft_scroller_box')) { 14364 timebox = timeboxparent.children().eq(0); 14365 parentHeight = timeboxparent[0].clientHeight; 14366 height = timebox[0].offsetHeight; 14367 scrollbar = $('<div class="xdsoft_scrollbar"></div>'); 14368 scroller = $('<div class="xdsoft_scroller"></div>'); 14369 scrollbar.append(scroller); 14370 14371 timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); 14372 calcOffset = function calcOffset(event) { 14373 var offset = pointerEventToXY(event).y - startY + startTopScroll; 14374 if (offset < 0) { 14375 offset = 0; 14376 } 14377 if (offset + scroller[0].offsetHeight > h1) { 14378 offset = h1 - scroller[0].offsetHeight; 14379 } 14380 timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); 14381 }; 14382 14383 scroller 14384 .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { 14385 if (!parentHeight) { 14386 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 14387 } 14388 14389 startY = pointerEventToXY(event).y; 14390 startTopScroll = parseInt(scroller.css('margin-top'), 10); 14391 h1 = scrollbar[0].offsetHeight; 14392 14393 if (event.type === 'mousedown' || event.type === 'touchstart') { 14394 if (options.ownerDocument) { 14395 $(options.ownerDocument.body).addClass('xdsoft_noselect'); 14396 } 14397 $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() { 14398 $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee) 14399 .off('mousemove.xdsoft_scroller', calcOffset) 14400 .removeClass('xdsoft_noselect'); 14401 }); 14402 $(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset); 14403 } else { 14404 touchStart = true; 14405 event.stopPropagation(); 14406 event.preventDefault(); 14407 } 14408 }) 14409 .on('touchmove', function (event) { 14410 if (touchStart) { 14411 event.preventDefault(); 14412 calcOffset(event); 14413 } 14414 }) 14415 .on('touchend touchcancel', function () { 14416 touchStart = false; 14417 startTopScroll = 0; 14418 }); 14419 14420 timeboxparent 14421 .on('scroll_element.xdsoft_scroller', function (event, percentage) { 14422 if (!parentHeight) { 14423 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); 14424 } 14425 percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; 14426 14427 scroller.css('margin-top', maximumOffset * percentage); 14428 14429 setTimeout(function () { 14430 timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10)); 14431 }, 10); 14432 }) 14433 .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { 14434 var percent, sh; 14435 parentHeight = timeboxparent[0].clientHeight; 14436 height = timebox[0].offsetHeight; 14437 percent = parentHeight / height; 14438 sh = percent * scrollbar[0].offsetHeight; 14439 if (percent > 1) { 14440 scroller.hide(); 14441 } else { 14442 scroller.show(); 14443 scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); 14444 maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; 14445 if (noTriggerScroll !== true) { 14446 timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]); 14447 } 14448 } 14449 }); 14450 14451 timeboxparent.on('mousewheel', function (event) { 14452 var top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 14453 14454 top = top - (event.deltaY * 20); 14455 if (top < 0) { 14456 top = 0; 14457 } 14458 14459 timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); 14460 event.stopPropagation(); 14461 return false; 14462 }); 14463 14464 timeboxparent.on('touchstart', function (event) { 14465 start = pointerEventToXY(event); 14466 startTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); 14467 }); 14468 14469 timeboxparent.on('touchmove', function (event) { 14470 if (start) { 14471 event.preventDefault(); 14472 var coord = pointerEventToXY(event); 14473 timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); 14474 } 14475 }); 14476 14477 timeboxparent.on('touchend touchcancel', function () { 14478 start = false; 14479 startTop = 0; 14480 }); 14481 } 14482 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 14483 }); 14484 }; 14485 14486 $.fn.datetimepicker = function (opt, opt2) { 14487 var result = this, 14488 KEY0 = 48, 14489 KEY9 = 57, 14490 _KEY0 = 96, 14491 _KEY9 = 105, 14492 CTRLKEY = 17, 14493 CMDKEY = 91, 14494 DEL = 46, 14495 ENTER = 13, 14496 ESC = 27, 14497 BACKSPACE = 8, 14498 ARROWLEFT = 37, 14499 ARROWUP = 38, 14500 ARROWRIGHT = 39, 14501 ARROWDOWN = 40, 14502 TAB = 9, 14503 F5 = 116, 14504 AKEY = 65, 14505 CKEY = 67, 14506 VKEY = 86, 14507 ZKEY = 90, 14508 YKEY = 89, 14509 ctrlDown = false, 14510 cmdDown = false, 14511 options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), 14512 14513 lazyInitTimer = 0, 14514 createDateTimePicker, 14515 destroyDateTimePicker, 14516 14517 lazyInit = function (input) { 14518 input 14519 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() { 14520 if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { 14521 return; 14522 } 14523 clearTimeout(lazyInitTimer); 14524 lazyInitTimer = setTimeout(function () { 14525 14526 if (!input.data('xdsoft_datetimepicker')) { 14527 createDateTimePicker(input); 14528 } 14529 input 14530 .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback) 14531 .trigger('open.xdsoft'); 14532 }, 100); 14533 }); 14534 }; 14535 14536 createDateTimePicker = function (input) { 14537 var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'), 14538 xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), 14539 datepicker = $('<div class="xdsoft_datepicker active"></div>'), 14540 month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' + 14541 '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' + 14542 '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' + 14543 '<button type="button" class="xdsoft_next"></button></div>'), 14544 calendar = $('<div class="xdsoft_calendar"></div>'), 14545 timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'), 14546 timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), 14547 timebox = $('<div class="xdsoft_time_variant"></div>'), 14548 applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'), 14549 14550 monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), 14551 yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'), 14552 triggerAfterOpen = false, 14553 XDSoft_datetime, 14554 14555 xchangeTimer, 14556 timerclick, 14557 current_time_index, 14558 setPos, 14559 timer = 0, 14560 _xdsoft_datetime, 14561 forEachAncestorOf; 14562 14563 if (options.id) { 14564 datetimepicker.attr('id', options.id); 14565 } 14566 if (options.style) { 14567 datetimepicker.attr('style', options.style); 14568 } 14569 if (options.weeks) { 14570 datetimepicker.addClass('xdsoft_showweeks'); 14571 } 14572 if (options.rtl) { 14573 datetimepicker.addClass('xdsoft_rtl'); 14574 } 14575 14576 datetimepicker.addClass('xdsoft_' + options.theme); 14577 datetimepicker.addClass(options.className); 14578 14579 month_picker 14580 .find('.xdsoft_month span') 14581 .after(monthselect); 14582 month_picker 14583 .find('.xdsoft_year span') 14584 .after(yearselect); 14585 14586 month_picker 14587 .find('.xdsoft_month,.xdsoft_year') 14588 .on('touchstart mousedown.xdsoft', function (event) { 14589 var select = $(this).find('.xdsoft_select').eq(0), 14590 val = 0, 14591 top = 0, 14592 visible = select.is(':visible'), 14593 items, 14594 i; 14595 14596 month_picker 14597 .find('.xdsoft_select') 14598 .hide(); 14599 if (_xdsoft_datetime.currentTime) { 14600 val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); 14601 } 14602 14603 select[visible ? 'hide' : 'show'](); 14604 for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { 14605 if (items.eq(i).data('value') === val) { 14606 break; 14607 } else { 14608 top += items[0].offsetHeight; 14609 } 14610 } 14611 14612 select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight))); 14613 event.stopPropagation(); 14614 return false; 14615 }); 14616 14617 var handleTouchMoved = function (event) { 14618 var evt = event.originalEvent; 14619 var touchPosition = evt.touches ? evt.touches[0] : evt; 14620 this.touchStartPosition = this.touchStartPosition || touchPosition; 14621 var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX); 14622 var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY); 14623 var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement); 14624 if(distance > options.touchMovedThreshold) { 14625 this.touchMoved = true; 14626 } 14627 } 14628 14629 month_picker 14630 .find('.xdsoft_select') 14631 .xdsoftScroller(options) 14632 .on('touchstart mousedown.xdsoft', function (event) { 14633 var evt = event.originalEvent; 14634 this.touchMoved = false; 14635 this.touchStartPosition = evt.touches ? evt.touches[0] : evt; 14636 event.stopPropagation(); 14637 event.preventDefault(); 14638 }) 14639 .on('touchmove', '.xdsoft_option', handleTouchMoved) 14640 .on('touchend mousedown.xdsoft', '.xdsoft_option', function () { 14641 if (!this.touchMoved) { 14642 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 14643 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 14644 } 14645 14646 var year = _xdsoft_datetime.currentTime.getFullYear(); 14647 if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { 14648 _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); 14649 } 14650 14651 $(this).parent().parent().hide(); 14652 14653 datetimepicker.trigger('xchange.xdsoft'); 14654 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 14655 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 14656 } 14657 14658 if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { 14659 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 14660 } 14661 } 14662 }); 14663 14664 datetimepicker.getValue = function () { 14665 return _xdsoft_datetime.getCurrentTime(); 14666 }; 14667 14668 datetimepicker.setOptions = function (_options) { 14669 var highlightedDates = {}; 14670 14671 options = $.extend(true, {}, options, _options); 14672 14673 if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { 14674 options.allowTimes = $.extend(true, [], _options.allowTimes); 14675 } 14676 14677 if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) { 14678 options.weekends = $.extend(true, [], _options.weekends); 14679 } 14680 14681 if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) { 14682 options.allowDates = $.extend(true, [], _options.allowDates); 14683 } 14684 14685 if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") { 14686 options.allowDateRe = new RegExp(_options.allowDateRe); 14687 } 14688 14689 if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { 14690 $.each(_options.highlightedDates, function (index, value) { 14691 var splitData = $.map(value.split(','), $.trim), 14692 exDesc, 14693 hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style 14694 keyDate = dateHelper.formatDate(hDate.date, options.formatDate); 14695 if (highlightedDates[keyDate] !== undefined) { 14696 exDesc = highlightedDates[keyDate].desc; 14697 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 14698 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 14699 } 14700 } else { 14701 highlightedDates[keyDate] = hDate; 14702 } 14703 }); 14704 14705 options.highlightedDates = $.extend(true, [], highlightedDates); 14706 } 14707 14708 if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { 14709 highlightedDates = $.extend(true, [], options.highlightedDates); 14710 $.each(_options.highlightedPeriods, function (index, value) { 14711 var dateTest, // start date 14712 dateEnd, 14713 desc, 14714 hDate, 14715 keyDate, 14716 exDesc, 14717 style; 14718 if ($.isArray(value)) { 14719 dateTest = value[0]; 14720 dateEnd = value[1]; 14721 desc = value[2]; 14722 style = value[3]; 14723 } 14724 else { 14725 var splitData = $.map(value.split(','), $.trim); 14726 dateTest = dateHelper.parseDate(splitData[0], options.formatDate); 14727 dateEnd = dateHelper.parseDate(splitData[1], options.formatDate); 14728 desc = splitData[2]; 14729 style = splitData[3]; 14730 } 14731 14732 while (dateTest <= dateEnd) { 14733 hDate = new HighlightedDate(dateTest, desc, style); 14734 keyDate = dateHelper.formatDate(dateTest, options.formatDate); 14735 dateTest.setDate(dateTest.getDate() + 1); 14736 if (highlightedDates[keyDate] !== undefined) { 14737 exDesc = highlightedDates[keyDate].desc; 14738 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 14739 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 14740 } 14741 } else { 14742 highlightedDates[keyDate] = hDate; 14743 } 14744 } 14745 }); 14746 14747 options.highlightedDates = $.extend(true, [], highlightedDates); 14748 } 14749 14750 if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { 14751 options.disabledDates = $.extend(true, [], _options.disabledDates); 14752 } 14753 14754 if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { 14755 options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); 14756 } 14757 14758 if ((options.open || options.opened) && (!options.inline)) { 14759 input.trigger('open.xdsoft'); 14760 } 14761 14762 if (options.inline) { 14763 triggerAfterOpen = true; 14764 datetimepicker.addClass('xdsoft_inline'); 14765 input.after(datetimepicker).hide(); 14766 } 14767 14768 if (options.inverseButton) { 14769 options.next = 'xdsoft_prev'; 14770 options.prev = 'xdsoft_next'; 14771 } 14772 14773 if (options.datepicker) { 14774 datepicker.addClass('active'); 14775 } else { 14776 datepicker.removeClass('active'); 14777 } 14778 14779 if (options.timepicker) { 14780 timepicker.addClass('active'); 14781 } else { 14782 timepicker.removeClass('active'); 14783 } 14784 14785 if (options.value) { 14786 _xdsoft_datetime.setCurrentTime(options.value); 14787 if (input && input.val) { 14788 input.val(_xdsoft_datetime.str); 14789 } 14790 } 14791 14792 if (isNaN(options.dayOfWeekStart)) { 14793 options.dayOfWeekStart = 0; 14794 } else { 14795 options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; 14796 } 14797 14798 if (!options.timepickerScrollbar) { 14799 timeboxparent.xdsoftScroller(options, 'hide'); 14800 } 14801 14802 if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { 14803 options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate); 14804 } 14805 14806 if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) { 14807 options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate); 14808 } 14809 14810 if (options.minDateTime && /^\+(.*)$/.test(options.minDateTime)) { 14811 options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate); 14812 } 14813 14814 if (options.maxDateTime && /^\+(.*)$/.test(options.maxDateTime)) { 14815 options.maxDateTime = _xdsoft_datetime.strToDateTime(options.maxDateTime).dateFormat(options.formatDate); 14816 } 14817 14818 applyButton.toggle(options.showApplyButton); 14819 14820 month_picker 14821 .find('.xdsoft_today_button') 14822 .css('visibility', !options.todayButton ? 'hidden' : 'visible'); 14823 14824 month_picker 14825 .find('.' + options.prev) 14826 .css('visibility', !options.prevButton ? 'hidden' : 'visible'); 14827 14828 month_picker 14829 .find('.' + options.next) 14830 .css('visibility', !options.nextButton ? 'hidden' : 'visible'); 14831 14832 setMask(options); 14833 14834 if (options.validateOnBlur) { 14835 input 14836 .off('blur.xdsoft') 14837 .on('blur.xdsoft', function () { 14838 if (options.allowBlank && (!$.trim($(this).val()).length || 14839 (typeof options.mask === "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { 14840 $(this).val(null); 14841 datetimepicker.data('xdsoft_datetime').empty(); 14842 } else { 14843 var d = dateHelper.parseDate($(this).val(), options.format); 14844 if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time 14845 $(this).val(dateHelper.formatDate(d, options.format)); 14846 } else { 14847 var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), 14848 splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); 14849 14850 // parse the numbers as 0312 => 03:12 14851 if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { 14852 $(this).val([splittedHours, splittedMinutes].map(function (item) { 14853 return item > 9 ? item : '0' + item; 14854 }).join(':')); 14855 } else { 14856 $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format)); 14857 } 14858 } 14859 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 14860 } 14861 14862 datetimepicker.trigger('changedatetime.xdsoft'); 14863 datetimepicker.trigger('close.xdsoft'); 14864 }); 14865 } 14866 options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; 14867 14868 datetimepicker 14869 .trigger('xchange.xdsoft') 14870 .trigger('afterOpen.xdsoft'); 14871 }; 14872 14873 datetimepicker 14874 .data('options', options) 14875 .on('touchstart mousedown.xdsoft', function (event) { 14876 event.stopPropagation(); 14877 event.preventDefault(); 14878 yearselect.hide(); 14879 monthselect.hide(); 14880 return false; 14881 }); 14882 14883 //scroll_element = timepicker.find('.xdsoft_time_box'); 14884 timeboxparent.append(timebox); 14885 timeboxparent.xdsoftScroller(options); 14886 14887 datetimepicker.on('afterOpen.xdsoft', function () { 14888 timeboxparent.xdsoftScroller(options); 14889 }); 14890 14891 datetimepicker 14892 .append(datepicker) 14893 .append(timepicker); 14894 14895 if (options.withoutCopyright !== true) { 14896 datetimepicker 14897 .append(xdsoft_copyright); 14898 } 14899 14900 datepicker 14901 .append(month_picker) 14902 .append(calendar) 14903 .append(applyButton); 14904 14905 if (options.insideParent) { 14906 $(input).parent().append(datetimepicker); 14907 } else { 14908 $(options.parentID).append(datetimepicker); 14909 } 14910 14911 XDSoft_datetime = function () { 14912 var _this = this; 14913 _this.now = function (norecursion) { 14914 var d = new Date(), 14915 date, 14916 time; 14917 14918 if (!norecursion && options.defaultDate) { 14919 date = _this.strToDateTime(options.defaultDate); 14920 d.setFullYear(date.getFullYear()); 14921 d.setMonth(date.getMonth()); 14922 d.setDate(date.getDate()); 14923 } 14924 14925 d.setFullYear(d.getFullYear()); 14926 14927 if (!norecursion && options.defaultTime) { 14928 time = _this.strtotime(options.defaultTime); 14929 d.setHours(time.getHours()); 14930 d.setMinutes(time.getMinutes()); 14931 d.setSeconds(time.getSeconds()); 14932 d.setMilliseconds(time.getMilliseconds()); 14933 } 14934 return d; 14935 }; 14936 14937 _this.isValidDate = function (d) { 14938 if (Object.prototype.toString.call(d) !== "[object Date]") { 14939 return false; 14940 } 14941 return !isNaN(d.getTime()); 14942 }; 14943 14944 _this.setCurrentTime = function (dTime, requireValidDate) { 14945 if (typeof dTime === 'string') { 14946 _this.currentTime = _this.strToDateTime(dTime); 14947 } 14948 else if (_this.isValidDate(dTime)) { 14949 _this.currentTime = dTime; 14950 } 14951 else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) { 14952 _this.currentTime = null; 14953 } 14954 else { 14955 _this.currentTime = _this.now(); 14956 } 14957 14958 datetimepicker.trigger('xchange.xdsoft'); 14959 }; 14960 14961 _this.empty = function () { 14962 _this.currentTime = null; 14963 }; 14964 14965 _this.getCurrentTime = function () { 14966 return _this.currentTime; 14967 }; 14968 14969 _this.nextMonth = function () { 14970 14971 if (_this.currentTime === undefined || _this.currentTime === null) { 14972 _this.currentTime = _this.now(); 14973 } 14974 14975 var month = _this.currentTime.getMonth() + 1, 14976 year; 14977 if (month === 12) { 14978 _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); 14979 month = 0; 14980 } 14981 14982 year = _this.currentTime.getFullYear(); 14983 14984 _this.currentTime.setDate( 14985 Math.min( 14986 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 14987 _this.currentTime.getDate() 14988 ) 14989 ); 14990 _this.currentTime.setMonth(month); 14991 14992 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 14993 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 14994 } 14995 14996 if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { 14997 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 14998 } 14999 15000 datetimepicker.trigger('xchange.xdsoft'); 15001 return month; 15002 }; 15003 15004 _this.prevMonth = function () { 15005 15006 if (_this.currentTime === undefined || _this.currentTime === null) { 15007 _this.currentTime = _this.now(); 15008 } 15009 15010 var month = _this.currentTime.getMonth() - 1; 15011 if (month === -1) { 15012 _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); 15013 month = 11; 15014 } 15015 _this.currentTime.setDate( 15016 Math.min( 15017 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 15018 _this.currentTime.getDate() 15019 ) 15020 ); 15021 _this.currentTime.setMonth(month); 15022 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 15023 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 15024 } 15025 datetimepicker.trigger('xchange.xdsoft'); 15026 return month; 15027 }; 15028 15029 _this.getWeekOfYear = function (datetime) { 15030 if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) { 15031 var week = options.onGetWeekOfYear.call(datetimepicker, datetime); 15032 if (typeof week !== 'undefined') { 15033 return week; 15034 } 15035 } 15036 var onejan = new Date(datetime.getFullYear(), 0, 1); 15037 15038 //First week of the year is th one with the first Thursday according to ISO8601 15039 if (onejan.getDay() !== 4) { 15040 onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7)); 15041 } 15042 15043 return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); 15044 }; 15045 15046 _this.strToDateTime = function (sDateTime) { 15047 var tmpDate = [], timeOffset, currentTime; 15048 15049 if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { 15050 return sDateTime; 15051 } 15052 15053 tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime); 15054 15055 if (tmpDate) { 15056 tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate); 15057 } 15058 15059 if (tmpDate && tmpDate[2]) { 15060 timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; 15061 currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); 15062 } else { 15063 currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now(); 15064 } 15065 15066 if (!_this.isValidDate(currentTime)) { 15067 currentTime = _this.now(); 15068 } 15069 15070 return currentTime; 15071 }; 15072 15073 _this.strToDate = function (sDate) { 15074 if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { 15075 return sDate; 15076 } 15077 15078 var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true); 15079 if (!_this.isValidDate(currentTime)) { 15080 currentTime = _this.now(true); 15081 } 15082 return currentTime; 15083 }; 15084 15085 _this.strtotime = function (sTime) { 15086 if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { 15087 return sTime; 15088 } 15089 var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true); 15090 if (!_this.isValidDate(currentTime)) { 15091 currentTime = _this.now(true); 15092 } 15093 return currentTime; 15094 }; 15095 15096 _this.str = function () { 15097 var format = options.format; 15098 if (options.yearOffset) { 15099 format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset); 15100 format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4)); 15101 } 15102 return dateHelper.formatDate(_this.currentTime, format); 15103 }; 15104 _this.currentTime = this.now(); 15105 }; 15106 15107 _xdsoft_datetime = new XDSoft_datetime(); 15108 15109 applyButton.on('touchend click', function (e) {//pathbrite 15110 e.preventDefault(); 15111 datetimepicker.data('changed', true); 15112 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 15113 input.val(_xdsoft_datetime.str()); 15114 datetimepicker.trigger('close.xdsoft'); 15115 }); 15116 month_picker 15117 .find('.xdsoft_today_button') 15118 .on('touchend mousedown.xdsoft', function () { 15119 datetimepicker.data('changed', true); 15120 _xdsoft_datetime.setCurrentTime(0, true); 15121 datetimepicker.trigger('afterOpen.xdsoft'); 15122 }).on('dblclick.xdsoft', function () { 15123 var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; 15124 currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); 15125 minDate = _xdsoft_datetime.strToDate(options.minDate); 15126 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 15127 if (currentDate < minDate) { 15128 return; 15129 } 15130 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 15131 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); 15132 if (currentDate > maxDate) { 15133 return; 15134 } 15135 input.val(_xdsoft_datetime.str()); 15136 input.trigger('change'); 15137 datetimepicker.trigger('close.xdsoft'); 15138 }); 15139 month_picker 15140 .find('.xdsoft_prev,.xdsoft_next') 15141 .on('touchend mousedown.xdsoft', function () { 15142 var $this = $(this), 15143 timer = 0, 15144 stop = false; 15145 15146 (function arguments_callee1(v) { 15147 if ($this.hasClass(options.next)) { 15148 _xdsoft_datetime.nextMonth(); 15149 } else if ($this.hasClass(options.prev)) { 15150 _xdsoft_datetime.prevMonth(); 15151 } 15152 if (options.monthChangeSpinner) { 15153 if (!stop) { 15154 timer = setTimeout(arguments_callee1, v || 100); 15155 } 15156 } 15157 }(500)); 15158 15159 $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() { 15160 clearTimeout(timer); 15161 stop = true; 15162 $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2); 15163 }); 15164 }); 15165 15166 timepicker 15167 .find('.xdsoft_prev,.xdsoft_next') 15168 .on('touchend mousedown.xdsoft', function () { 15169 var $this = $(this), 15170 timer = 0, 15171 stop = false, 15172 period = 110; 15173 (function arguments_callee4(v) { 15174 var pheight = timeboxparent[0].clientHeight, 15175 height = timebox[0].offsetHeight, 15176 top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 15177 if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) { 15178 timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); 15179 } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { 15180 timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); 15181 } 15182 /** 15183 * Fixed bug: 15184 * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list. 15185 * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this 15186 * would cause a bug when you use jquery.css method. 15187 * Let's say: * { transition: all .5s ease; } 15188 * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button, 15189 * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the 15190 * next/prev button. 15191 * 15192 * What we should do: 15193 * Replace timebox.css('marginTop') with timebox[0].style.marginTop. 15194 */ 15195 timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]); 15196 period = (period > 10) ? 10 : period - 10; 15197 if (!stop) { 15198 timer = setTimeout(arguments_callee4, v || period); 15199 } 15200 }(500)); 15201 $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() { 15202 clearTimeout(timer); 15203 stop = true; 15204 $([options.ownerDocument.body, options.contentWindow]) 15205 .off('touchend mouseup.xdsoft', arguments_callee5); 15206 }); 15207 }); 15208 15209 xchangeTimer = 0; 15210 // base handler - generating a calendar and timepicker 15211 datetimepicker 15212 .on('xchange.xdsoft', function (event) { 15213 clearTimeout(xchangeTimer); 15214 xchangeTimer = setTimeout(function () { 15215 15216 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 15217 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 15218 } 15219 15220 var table = '', 15221 start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), 15222 i = 0, 15223 j, 15224 today = _xdsoft_datetime.now(), 15225 maxDate = false, 15226 minDate = false, 15227 minDateTime = false, 15228 maxDateTime = false, 15229 hDate, 15230 day, 15231 d, 15232 y, 15233 m, 15234 w, 15235 classes = [], 15236 customDateSettings, 15237 newRow = true, 15238 time = '', 15239 h, 15240 line_time, 15241 description; 15242 15243 while (start.getDay() !== options.dayOfWeekStart) { 15244 start.setDate(start.getDate() - 1); 15245 } 15246 15247 table += '<table><thead><tr>'; 15248 15249 if (options.weeks) { 15250 table += '<th></th>'; 15251 } 15252 15253 for (j = 0; j < 7; j += 1) { 15254 table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>'; 15255 } 15256 15257 table += '</tr></thead>'; 15258 table += '<tbody>'; 15259 15260 if (options.maxDate !== false) { 15261 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 15262 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); 15263 } 15264 15265 if (options.minDate !== false) { 15266 minDate = _xdsoft_datetime.strToDate(options.minDate); 15267 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 15268 } 15269 15270 if (options.minDateTime !== false) { 15271 minDateTime = _xdsoft_datetime.strToDate(options.minDateTime); 15272 minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds()); 15273 } 15274 15275 if (options.maxDateTime !== false) { 15276 maxDateTime = _xdsoft_datetime.strToDate(options.maxDateTime); 15277 maxDateTime = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), maxDateTime.getHours(), maxDateTime.getMinutes(), maxDateTime.getSeconds()); 15278 } 15279 15280 var maxDateTimeDay; 15281 if (maxDateTime !== false) { 15282 maxDateTimeDay = ((maxDateTime.getFullYear() * 12) + maxDateTime.getMonth()) * 31 + maxDateTime.getDate(); 15283 } 15284 15285 while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { 15286 classes = []; 15287 i += 1; 15288 15289 day = start.getDay(); 15290 d = start.getDate(); 15291 y = start.getFullYear(); 15292 m = start.getMonth(); 15293 w = _xdsoft_datetime.getWeekOfYear(start); 15294 description = ''; 15295 15296 classes.push('xdsoft_date'); 15297 15298 if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) { 15299 customDateSettings = options.beforeShowDay.call(datetimepicker, start); 15300 } else { 15301 customDateSettings = null; 15302 } 15303 15304 if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){ 15305 if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){ 15306 classes.push('xdsoft_disabled'); 15307 } 15308 } 15309 15310 if(options.allowDates && options.allowDates.length>0){ 15311 if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){ 15312 classes.push('xdsoft_disabled'); 15313 } 15314 } 15315 15316 var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate(); 15317 if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime) || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) { 15318 classes.push('xdsoft_disabled'); 15319 } 15320 15321 if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { 15322 classes.push('xdsoft_disabled'); 15323 } 15324 15325 if (options.disabledWeekDays.indexOf(day) !== -1) { 15326 classes.push('xdsoft_disabled'); 15327 } 15328 15329 if (input.is('[disabled]')) { 15330 classes.push('xdsoft_disabled'); 15331 } 15332 15333 if (customDateSettings && customDateSettings[1] !== "") { 15334 classes.push(customDateSettings[1]); 15335 } 15336 15337 if (_xdsoft_datetime.currentTime.getMonth() !== m) { 15338 classes.push('xdsoft_other_month'); 15339 } 15340 15341 if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { 15342 classes.push('xdsoft_current'); 15343 } 15344 15345 if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { 15346 classes.push('xdsoft_today'); 15347 } 15348 15349 if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { 15350 classes.push('xdsoft_weekend'); 15351 } 15352 15353 if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) { 15354 hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)]; 15355 classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); 15356 description = hDate.desc === undefined ? '' : hDate.desc; 15357 } 15358 15359 if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { 15360 classes.push(options.beforeShowDay(start)); 15361 } 15362 15363 if (newRow) { 15364 table += '<tr>'; 15365 newRow = false; 15366 if (options.weeks) { 15367 table += '<th>' + w + '</th>'; 15368 } 15369 } 15370 15371 table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + 15372 '<div>' + d + '</div>' + 15373 '</td>'; 15374 15375 if (start.getDay() === options.dayOfWeekStartPrev) { 15376 table += '</tr>'; 15377 newRow = true; 15378 } 15379 15380 start.setDate(d + 1); 15381 } 15382 table += '</tbody></table>'; 15383 15384 calendar.html(table); 15385 15386 month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]); 15387 month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset); 15388 15389 // generate timebox 15390 time = ''; 15391 h = ''; 15392 m = ''; 15393 15394 var minTimeMinutesOfDay = 0; 15395 if (options.minTime !== false) { 15396 var t = _xdsoft_datetime.strtotime(options.minTime); 15397 minTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes(); 15398 } 15399 var maxTimeMinutesOfDay = 24 * 60; 15400 if (options.maxTime !== false) { 15401 var t = _xdsoft_datetime.strtotime(options.maxTime); 15402 maxTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes(); 15403 } 15404 15405 if (options.minDateTime !== false) { 15406 var t = _xdsoft_datetime.strToDateTime(options.minDateTime); 15407 var currentDayIsMinDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate); 15408 if (currentDayIsMinDateTimeDay) { 15409 var m = 60 * t.getHours() + t.getMinutes(); 15410 if (m > minTimeMinutesOfDay) minTimeMinutesOfDay = m; 15411 } 15412 } 15413 15414 if (options.maxDateTime !== false) { 15415 var t = _xdsoft_datetime.strToDateTime(options.maxDateTime); 15416 var currentDayIsMaxDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate); 15417 if (currentDayIsMaxDateTimeDay) { 15418 var m = 60 * t.getHours() + t.getMinutes(); 15419 if (m < maxTimeMinutesOfDay) maxTimeMinutesOfDay = m; 15420 } 15421 } 15422 15423 line_time = function line_time(h, m) { 15424 var now = _xdsoft_datetime.now(), current_time, 15425 isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length; 15426 now.setHours(h); 15427 h = parseInt(now.getHours(), 10); 15428 now.setMinutes(m); 15429 m = parseInt(now.getMinutes(), 10); 15430 classes = []; 15431 var currentMinutesOfDay = 60 * h + m; 15432 if (input.is('[disabled]') || (currentMinutesOfDay >= maxTimeMinutesOfDay) || (currentMinutesOfDay < minTimeMinutesOfDay)) { 15433 classes.push('xdsoft_disabled'); 15434 } 15435 15436 current_time = new Date(_xdsoft_datetime.currentTime); 15437 current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); 15438 15439 if (!isALlowTimesInit) { 15440 current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); 15441 } 15442 15443 if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) { 15444 if (options.defaultSelect || datetimepicker.data('changed')) { 15445 classes.push('xdsoft_current'); 15446 } else if (options.initTime) { 15447 classes.push('xdsoft_init_time'); 15448 } 15449 } 15450 if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { 15451 classes.push('xdsoft_today'); 15452 } 15453 time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>'; 15454 }; 15455 15456 if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) { 15457 for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { 15458 for (j = 0; j < 60; j += options.step) { 15459 var currentMinutesOfDay = i * 60 + j; 15460 if (currentMinutesOfDay < minTimeMinutesOfDay) continue; 15461 if (currentMinutesOfDay >= maxTimeMinutesOfDay) continue; 15462 h = (i < 10 ? '0' : '') + i; 15463 m = (j < 10 ? '0' : '') + j; 15464 line_time(h, m); 15465 } 15466 } 15467 } else { 15468 for (i = 0; i < options.allowTimes.length; i += 1) { 15469 h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); 15470 m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); 15471 line_time(h, m); 15472 } 15473 } 15474 15475 timebox.html(time); 15476 15477 opt = ''; 15478 15479 for (i = parseInt(options.yearStart, 10); i <= parseInt(options.yearEnd, 10); i += 1) { 15480 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + (i + options.yearOffset) + '</div>'; 15481 } 15482 yearselect.children().eq(0) 15483 .html(opt); 15484 15485 for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { 15486 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>'; 15487 } 15488 monthselect.children().eq(0).html(opt); 15489 $(datetimepicker) 15490 .trigger('generate.xdsoft'); 15491 }, 10); 15492 event.stopPropagation(); 15493 }) 15494 .on('afterOpen.xdsoft', function () { 15495 if (options.timepicker) { 15496 var classType, pheight, height, top; 15497 if (timebox.find('.xdsoft_current').length) { 15498 classType = '.xdsoft_current'; 15499 } else if (timebox.find('.xdsoft_init_time').length) { 15500 classType = '.xdsoft_init_time'; 15501 } 15502 if (classType) {
vendor: 1,734 bytes, lines 15503-15549
15503 pheight = timeboxparent[0].clientHeight; 15504 height = timebox[0].offsetHeight; 15505 top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; 15506 if ((height - pheight) < top) { 15507 top = height - pheight; 15508 } 15509 timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); 15510 } else { 15511 timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); 15512 } 15513 } 15514 }); 15515 15516 timerclick = 0; 15517 calendar 15518 .on('touchend click.xdsoft', 'td', function (xdevent) { 15519 xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap 15520 timerclick += 1; 15521 var $this = $(this), 15522 currentTime = _xdsoft_datetime.currentTime; 15523 15524 if (currentTime === undefined || currentTime === null) { 15525 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 15526 currentTime = _xdsoft_datetime.currentTime; 15527 } 15528 15529 if ($this.hasClass('xdsoft_disabled')) { 15530 return false; 15531 } 15532 15533 currentTime.setDate(1); 15534 currentTime.setFullYear($this.data('year')); 15535 currentTime.setMonth($this.data('month')); 15536 currentTime.setDate($this.data('date')); 15537 15538 datetimepicker.trigger('select.xdsoft', [currentTime]); 15539 15540 input.val(_xdsoft_datetime.str()); 15541 15542 if (options.onSelectDate && $.isFunction(options.onSelectDate)) { 15543 options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 15544 } 15545 15546 datetimepicker.data('changed', true); 15547 datetimepicker.trigger('xchange.xdsoft'); 15548 datetimepicker.trigger('changedatetime.xdsoft'); 15549 if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !
vendor: 22,189 bytes, lines 15549-16234
15549options.timepicker))) && !options.inline) { 15550 datetimepicker.trigger('close.xdsoft'); 15551 } 15552 setTimeout(function () { 15553 timerclick = 0; 15554 }, 200); 15555 }); 15556 15557 timebox 15558 .on('touchstart', 'div', function (xdevent) { 15559 this.touchMoved = false; 15560 }) 15561 .on('touchmove', 'div', handleTouchMoved) 15562 .on('touchend click.xdsoft', 'div', function (xdevent) { 15563 if (!this.touchMoved) { 15564 xdevent.stopPropagation(); 15565 var $this = $(this), 15566 currentTime = _xdsoft_datetime.currentTime; 15567 15568 if (currentTime === undefined || currentTime === null) { 15569 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 15570 currentTime = _xdsoft_datetime.currentTime; 15571 } 15572 15573 if ($this.hasClass('xdsoft_disabled')) { 15574 return false; 15575 } 15576 currentTime.setHours($this.data('hour')); 15577 currentTime.setMinutes($this.data('minute')); 15578 datetimepicker.trigger('select.xdsoft', [currentTime]); 15579 15580 datetimepicker.data('input').val(_xdsoft_datetime.str()); 15581 15582 if (options.onSelectTime && $.isFunction(options.onSelectTime)) { 15583 options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 15584 } 15585 datetimepicker.data('changed', true); 15586 datetimepicker.trigger('xchange.xdsoft'); 15587 datetimepicker.trigger('changedatetime.xdsoft'); 15588 if (options.inline !== true && options.closeOnTimeSelect === true) { 15589 datetimepicker.trigger('close.xdsoft'); 15590 } 15591 } 15592 }); 15593 15594 datepicker 15595 .on('mousewheel.xdsoft', function (event) { 15596 if (!options.scrollMonth) { 15597 return true; 15598 } 15599 if (event.deltaY < 0) { 15600 _xdsoft_datetime.nextMonth(); 15601 } else { 15602 _xdsoft_datetime.prevMonth(); 15603 } 15604 return false; 15605 }); 15606 15607 input 15608 .on('mousewheel.xdsoft', function (event) { 15609 if (!options.scrollInput) { 15610 return true; 15611 } 15612 if (!options.datepicker && options.timepicker) { 15613 current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; 15614 if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { 15615 current_time_index += event.deltaY; 15616 } 15617 if (timebox.children().eq(current_time_index).length) { 15618 timebox.children().eq(current_time_index).trigger('mousedown'); 15619 } 15620 return false; 15621 } 15622 if (options.datepicker && !options.timepicker) { 15623 datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); 15624 if (input.val) { 15625 input.val(_xdsoft_datetime.str()); 15626 } 15627 datetimepicker.trigger('changedatetime.xdsoft'); 15628 return false; 15629 } 15630 }); 15631 15632 datetimepicker 15633 .on('changedatetime.xdsoft', function (event) { 15634 if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) { 15635 var $input = datetimepicker.data('input'); 15636 options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); 15637 delete options.value; 15638 $input.trigger('change'); 15639 } 15640 }) 15641 .on('generate.xdsoft', function () { 15642 if (options.onGenerate && $.isFunction(options.onGenerate)) { 15643 options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 15644 } 15645 if (triggerAfterOpen) { 15646 datetimepicker.trigger('afterOpen.xdsoft'); 15647 triggerAfterOpen = false; 15648 } 15649 }) 15650 .on('click.xdsoft', function (xdevent) { 15651 xdevent.stopPropagation(); 15652 }); 15653 15654 current_time_index = 0; 15655 15656 /** 15657 * Runs the callback for each of the specified node's ancestors. 15658 * 15659 * Return FALSE from the callback to stop ascending. 15660 * 15661 * @param {DOMNode} node 15662 * @param {Function} callback 15663 * @returns {undefined} 15664 */ 15665 forEachAncestorOf = function (node, callback) { 15666 do { 15667 node = node.parentNode; 15668 15669 if (!node || callback(node) === false) { 15670 break; 15671 } 15672 } while (node.nodeName !== 'HTML'); 15673 }; 15674 15675 /** 15676 * Sets the position of the picker. 15677 * 15678 * @returns {undefined} 15679 */ 15680 setPos = function () { 15681 var dateInputOffset, 15682 dateInputElem, 15683 verticalPosition, 15684 left, 15685 position, 15686 datetimepickerElem, 15687 dateInputHasFixedAncestor, 15688 $dateInput, 15689 windowWidth, 15690 verticalAnchorEdge, 15691 datetimepickerCss, 15692 windowHeight, 15693 windowScrollTop; 15694 15695 $dateInput = datetimepicker.data('input'); 15696 dateInputOffset = $dateInput.offset(); 15697 dateInputElem = $dateInput[0]; 15698 15699 verticalAnchorEdge = 'top'; 15700 verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1; 15701 left = dateInputOffset.left; 15702 position = "absolute"; 15703 15704 windowWidth = $(options.contentWindow).width(); 15705 windowHeight = $(options.contentWindow).height(); 15706 windowScrollTop = $(options.contentWindow).scrollTop(); 15707 15708 if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) { 15709 var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth; 15710 left = left - diff; 15711 } 15712 15713 if ($dateInput.parent().css('direction') === 'rtl') { 15714 left -= (datetimepicker.outerWidth() - $dateInput.outerWidth()); 15715 } 15716 15717 if (options.fixed) { 15718 verticalPosition -= windowScrollTop; 15719 left -= $(options.contentWindow).scrollLeft(); 15720 position = "fixed"; 15721 } else { 15722 dateInputHasFixedAncestor = false; 15723 15724 forEachAncestorOf(dateInputElem, function (ancestorNode) { 15725 if (ancestorNode === null) { 15726 return false; 15727 } 15728 15729 if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { 15730 dateInputHasFixedAncestor = true; 15731 return false; 15732 } 15733 }); 15734 15735 if (dateInputHasFixedAncestor && !options.insideParent) { 15736 position = 'fixed'; 15737 15738 //If the picker won't fit entirely within the viewport then display it above the date input. 15739 if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) { 15740 verticalAnchorEdge = 'bottom'; 15741 verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top; 15742 } else { 15743 verticalPosition -= windowScrollTop; 15744 } 15745 } else { 15746 if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) { 15747 verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1; 15748 } 15749 } 15750 15751 if (verticalPosition < 0) { 15752 verticalPosition = 0; 15753 } 15754 15755 if (left + dateInputElem.offsetWidth > windowWidth) { 15756 left = windowWidth - dateInputElem.offsetWidth; 15757 } 15758 } 15759 15760 datetimepickerElem = datetimepicker[0]; 15761 15762 forEachAncestorOf(datetimepickerElem, function (ancestorNode) { 15763 var ancestorNodePosition; 15764 15765 ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position'); 15766 15767 if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) { 15768 left = left - ((windowWidth - ancestorNode.offsetWidth) / 2); 15769 return false; 15770 } 15771 }); 15772 15773 datetimepickerCss = { 15774 position: position, 15775 left: options.insideParent ? dateInputElem.offsetLeft : left, 15776 top: '', //Initialize to prevent previous values interfering with new ones. 15777 bottom: '' //Initialize to prevent previous values interfering with new ones. 15778 }; 15779 15780 if (options.insideParent) { 15781 datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight; 15782 } else { 15783 datetimepickerCss[verticalAnchorEdge] = verticalPosition; 15784 } 15785 15786 datetimepicker.css(datetimepickerCss); 15787 }; 15788 15789 datetimepicker 15790 .on('open.xdsoft', function (event) { 15791 var onShow = true; 15792 if (options.onShow && $.isFunction(options.onShow)) { 15793 onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 15794 } 15795 if (onShow !== false) { 15796 datetimepicker.show(); 15797 setPos(); 15798 $(options.contentWindow) 15799 .off('resize.xdsoft', setPos) 15800 .on('resize.xdsoft', setPos); 15801 15802 if (options.closeOnWithoutClick) { 15803 $([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() { 15804 datetimepicker.trigger('close.xdsoft'); 15805 $([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6); 15806 }); 15807 } 15808 } 15809 }) 15810 .on('close.xdsoft', function (event) { 15811 var onClose = true; 15812 month_picker 15813 .find('.xdsoft_month,.xdsoft_year') 15814 .find('.xdsoft_select') 15815 .hide(); 15816 if (options.onClose && $.isFunction(options.onClose)) { 15817 onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 15818 } 15819 if (onClose !== false && !options.opened && !options.inline) { 15820 datetimepicker.hide(); 15821 } 15822 event.stopPropagation(); 15823 }) 15824 .on('toggle.xdsoft', function () { 15825 if (datetimepicker.is(':visible')) { 15826 datetimepicker.trigger('close.xdsoft'); 15827 } else { 15828 datetimepicker.trigger('open.xdsoft'); 15829 } 15830 }) 15831 .data('input', input); 15832 15833 timer = 0; 15834 15835 datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); 15836 datetimepicker.setOptions(options); 15837 15838 function getCurrentValue() { 15839 var ct = false, time; 15840 15841 if (options.startDate) { 15842 ct = _xdsoft_datetime.strToDate(options.startDate); 15843 } else { 15844 ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); 15845 if (ct) { 15846 ct = _xdsoft_datetime.strToDateTime(ct); 15847 if (options.yearOffset) { 15848 ct = new Date(ct.getFullYear() - options.yearOffset, ct.getMonth(), ct.getDate(), ct.getHours(), ct.getMinutes(), ct.getSeconds(), ct.getMilliseconds()); 15849 } 15850 } else if (options.defaultDate) { 15851 ct = _xdsoft_datetime.strToDateTime(options.defaultDate); 15852 if (options.defaultTime) { 15853 time = _xdsoft_datetime.strtotime(options.defaultTime); 15854 ct.setHours(time.getHours()); 15855 ct.setMinutes(time.getMinutes()); 15856 } 15857 } 15858 } 15859 15860 if (ct && _xdsoft_datetime.isValidDate(ct)) { 15861 datetimepicker.data('changed', true); 15862 } else { 15863 ct = ''; 15864 } 15865 15866 return ct || 0; 15867 } 15868 15869 function setMask(options) { 15870 15871 var isValidValue = function (mask, value) { 15872 var reg = mask 15873 .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') 15874 .replace(/_/g, '{digit+}') 15875 .replace(/([0-9]{1})/g, '{digit$1}') 15876 .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') 15877 .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); 15878 return (new RegExp(reg)).test(value); 15879 }, 15880 getCaretPos = function (input) { 15881 try { 15882 if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) { 15883 var range = options.ownerDocument.selection.createRange(); 15884 return range.getBookmark().charCodeAt(2) - 2; 15885 } 15886 if (input.setSelectionRange) { 15887 return input.selectionStart; 15888 } 15889 } catch (e) { 15890 return 0; 15891 } 15892 }, 15893 setCaretPos = function (node, pos) { 15894 node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node; 15895 if (!node) { 15896 return false; 15897 } 15898 if (node.createTextRange) { 15899 var textRange = node.createTextRange(); 15900 textRange.collapse(true); 15901 textRange.moveEnd('character', pos); 15902 textRange.moveStart('character', pos); 15903 textRange.select(); 15904 return true; 15905 } 15906 if (node.setSelectionRange) { 15907 node.setSelectionRange(pos, pos); 15908 return true; 15909 } 15910 return false; 15911 }; 15912 15913 if(options.mask) { 15914 input.off('keydown.xdsoft'); 15915 } 15916 15917 if (options.mask === true) { 15918 if (dateHelper.formatMask) { 15919 options.mask = dateHelper.formatMask(options.format) 15920 } else { 15921 options.mask = options.format 15922 .replace(/Y/g, '9999') 15923 .replace(/F/g, '9999') 15924 .replace(/m/g, '19') 15925 .replace(/d/g, '39') 15926 .replace(/H/g, '29') 15927 .replace(/i/g, '59') 15928 .replace(/s/g, '59'); 15929 } 15930 } 15931 15932 if ($.type(options.mask) === 'string') { 15933 if (!isValidValue(options.mask, input.val())) { 15934 input.val(options.mask.replace(/[0-9]/g, '_')); 15935 setCaretPos(input[0], 0); 15936 } 15937 15938 input.on('paste.xdsoft', function (event) { 15939 // couple options here 15940 // 1. return false - tell them they can't paste 15941 // 2. insert over current characters - minimal validation 15942 // 3. full fledged parsing and validation 15943 // let's go option 2 for now 15944 15945 // fires multiple times for some reason 15946 15947 // https://stackoverflow.com/a/30496488/1366033 15948 var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData, 15949 pastedData = clipboardData.getData('text'), 15950 val = this.value, 15951 pos = this.selectionStart 15952 15953 var valueBeforeCursor = val.substr(0, pos); 15954 var valueAfterPaste = val.substr(pos + pastedData.length); 15955 15956 val = valueBeforeCursor + pastedData + valueAfterPaste; 15957 pos += pastedData.length; 15958 15959 if (isValidValue(options.mask, val)) { 15960 this.value = val; 15961 setCaretPos(this, pos); 15962 } else if ($.trim(val) === '') { 15963 this.value = options.mask.replace(/[0-9]/g, '_'); 15964 } else { 15965 input.trigger('error_input.xdsoft'); 15966 } 15967 15968 event.preventDefault(); 15969 return false; 15970 }); 15971 15972 input.on('keydown.xdsoft', function (event) { 15973 var val = this.value, 15974 key = event.which, 15975 pos = this.selectionStart, 15976 selEnd = this.selectionEnd, 15977 hasSel = pos !== selEnd, 15978 digit; 15979 15980 // only alow these characters 15981 if (((key >= KEY0 && key <= KEY9) || 15982 (key >= _KEY0 && key <= _KEY9)) || 15983 (key === BACKSPACE || key === DEL)) { 15984 15985 // get char to insert which is new character or placeholder ('_') 15986 digit = (key === BACKSPACE || key === DEL) ? '_' : 15987 String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key); 15988 15989 // we're deleting something, we're not at the start, and have normal cursor, move back one 15990 // if we have a selection length, cursor actually sits behind deletable char, not in front 15991 if (key === BACKSPACE && pos && !hasSel) { 15992 pos -= 1; 15993 } 15994 15995 // don't stop on a separator, continue whatever direction you were going 15996 // value char - keep incrementing position while on separator char and we still have room 15997 // del char - keep decrementing position while on separator char and we still have room 15998 while (true) { 15999 var maskValueAtCurPos = options.mask.substr(pos, 1); 16000 var posShorterThanMaskLength = pos < options.mask.length; 16001 var posGreaterThanZero = pos > 0; 16002 var notNumberOrPlaceholder = /[^0-9_]/; 16003 var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos); 16004 var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero 16005 16006 // if we hit a real char, stay where we are 16007 if (!continueMovingPosition) break; 16008 16009 // hitting backspace in a selection, you can possibly go back any further - go forward 16010 pos += (key === BACKSPACE && !hasSel) ? -1 : 1; 16011 16012 } 16013 16014 if (event.metaKey) { // cmd has been pressed 16015 pos = 0; 16016 hasSel = true; 16017 } 16018 16019 if (hasSel) { 16020 // pos might have moved so re-calc length 16021 var selLength = selEnd - pos 16022 16023 // if we have a selection length we will wipe out entire selection and replace with default template for that range 16024 var defaultBlank = options.mask.replace(/[0-9]/g, '_'); 16025 var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength); 16026 var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty 16027 16028 var valueBeforeSel = val.substr(0, pos); 16029 var insertChars = digit + selReplacementRemainder; 16030 var charsAfterSelection = val.substr(pos + selLength); 16031 16032 val = valueBeforeSel + insertChars + charsAfterSelection 16033 16034 } else { 16035 var valueBeforeCursor = val.substr(0, pos); 16036 var insertChar = digit; 16037 var valueAfterNextChar = val.substr(pos + 1); 16038 16039 val = valueBeforeCursor + insertChar + valueAfterNextChar 16040 } 16041 16042 if ($.trim(val) === '') { 16043 // if empty, set to default 16044 val = defaultBlank 16045 } else { 16046 // if at the last character don't need to do anything 16047 if (pos === options.mask.length) { 16048 event.preventDefault(); 16049 return false; 16050 } 16051 } 16052 16053 // resume cursor location 16054 pos += (key === BACKSPACE) ? 0 : 1; 16055 // don't stop on a separator, continue whatever direction you were going 16056 while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { 16057 pos += (key === BACKSPACE) ? 0 : 1; 16058 } 16059 16060 if (isValidValue(options.mask, val)) { 16061 this.value = val; 16062 setCaretPos(this, pos); 16063 } else if ($.trim(val) === '') { 16064 this.value = options.mask.replace(/[0-9]/g, '_'); 16065 } else { 16066 input.trigger('error_input.xdsoft'); 16067 } 16068 } else { 16069 if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { 16070 return true; 16071 } 16072 } 16073 16074 event.preventDefault(); 16075 return false; 16076 }); 16077 } 16078 } 16079 16080 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 16081 16082 input 16083 .data('xdsoft_datetimepicker', datetimepicker) 16084 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () { 16085 if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { 16086 return; 16087 } 16088 if (!options.openOnFocus) { 16089 return; 16090 } 16091 clearTimeout(timer); 16092 timer = setTimeout(function () { 16093 if (input.is(':disabled')) { 16094 return; 16095 } 16096 16097 triggerAfterOpen = true; 16098 _xdsoft_datetime.setCurrentTime(getCurrentValue(), true); 16099 if(options.mask) { 16100 setMask(options); 16101 } 16102 datetimepicker.trigger('open.xdsoft'); 16103 }, 100); 16104 }) 16105 .on('keydown.xdsoft', function (event) { 16106 var elementSelector, 16107 key = event.which; 16108 if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { 16109 elementSelector = $("input:visible,textarea:visible,button:visible,a:visible"); 16110 datetimepicker.trigger('close.xdsoft'); 16111 elementSelector.eq(elementSelector.index(this) + 1).focus(); 16112 return false; 16113 } 16114 if ([TAB].indexOf(key) !== -1) { 16115 datetimepicker.trigger('close.xdsoft'); 16116 return true; 16117 } 16118 }) 16119 .on('blur.xdsoft', function () { 16120 datetimepicker.trigger('close.xdsoft'); 16121 }); 16122 }; 16123 destroyDateTimePicker = function (input) { 16124 var datetimepicker = input.data('xdsoft_datetimepicker'); 16125 if (datetimepicker) { 16126 datetimepicker.data('xdsoft_datetime', null); 16127 datetimepicker.remove(); 16128 input 16129 .data('xdsoft_datetimepicker', null) 16130 .off('.xdsoft'); 16131 $(options.contentWindow).off('resize.xdsoft'); 16132 $([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart'); 16133 if (input.unmousewheel) { 16134 input.unmousewheel(); 16135 } 16136 } 16137 }; 16138 $(options.ownerDocument) 16139 .off('keydown.xdsoftctrl keyup.xdsoftctrl') 16140 .off('keydown.xdsoftcmd keyup.xdsoftcmd') 16141 .on('keydown.xdsoftctrl', function (e) { 16142 if (e.keyCode === CTRLKEY) { 16143 ctrlDown = true; 16144 } 16145 }) 16146 .on('keyup.xdsoftctrl', function (e) { 16147 if (e.keyCode === CTRLKEY) { 16148 ctrlDown = false; 16149 } 16150 }) 16151 .on('keydown.xdsoftcmd', function (e) { 16152 if (e.keyCode === CMDKEY) { 16153 cmdDown = true; 16154 } 16155 }) 16156 .on('keyup.xdsoftcmd', function (e) { 16157 if (e.keyCode === CMDKEY) { 16158 cmdDown = false; 16159 } 16160 }); 16161 16162 this.each(function () { 16163 var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; 16164 if (datetimepicker) { 16165 if ($.type(opt) === 'string') { 16166 switch (opt) { 16167 case 'show': 16168 $(this).select().focus(); 16169 datetimepicker.trigger('open.xdsoft'); 16170 break; 16171 case 'hide': 16172 datetimepicker.trigger('close.xdsoft'); 16173 break; 16174 case 'toggle': 16175 datetimepicker.trigger('toggle.xdsoft'); 16176 break; 16177 case 'destroy': 16178 destroyDateTimePicker($(this)); 16179 break; 16180 case 'reset': 16181 this.value = this.defaultValue; 16182 if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) { 16183 datetimepicker.data('changed', false); 16184 } 16185 datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); 16186 break; 16187 case 'validate': 16188 $input = datetimepicker.data('input'); 16189 $input.trigger('blur.xdsoft'); 16190 break; 16191 default: 16192 if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) { 16193 result = datetimepicker[opt](opt2); 16194 } 16195 } 16196 } else { 16197 datetimepicker 16198 .setOptions(opt); 16199 } 16200 return 0; 16201 } 16202 if ($.type(opt) !== 'string') { 16203 if (!options.lazyInit || options.open || options.inline) { 16204 createDateTimePicker($(this)); 16205 } else { 16206 lazyInit($(this)); 16207 } 16208 } 16209 }); 16210 16211 return result; 16212 }; 16213 16214 $.fn.datetimepicker.defaults = default_options; 16215 16216 function HighlightedDate(date, desc, style) { 16217 "use strict"; 16218 this.date = date; 16219 this.desc = desc; 16220 this.style = style; 16221 } 16222}; 16223;(function (factory) { 16224 if ( typeof define === 'function' && define.amd ) { 16225 // AMD. Register as an anonymous module. 16226 define(['jquery', 'jquery-mousewheel'], factory); 16227 } else if (typeof exports === 'object') { 16228 // Node/CommonJS style for Browserify 16229 module.exports = factory(require('jquery'));; 16230 } else { 16231 // Browser globals 16232 factory(jQuery); 16233 } 16234}
vendor: 8,295 bytes, lines 16234-16457
16234(datetimepickerFactory)); 16235 16236 16237/*! 16238 * jQuery Mousewheel 3.1.13 16239 * 16240 * Copyright jQuery Foundation and other contributors 16241 * Released under the MIT license 16242 * http://jquery.org/license 16243 */ 16244 16245(function (factory) { 16246 if ( typeof define === 'function' && define.amd ) { 16247 // AMD. Register as an anonymous module. 16248 define(['jquery'], factory); 16249 } else if (typeof exports === 'object') { 16250 // Node/CommonJS style for Browserify 16251 module.exports = factory; 16252 } else { 16253 // Browser globals 16254 factory(jQuery); 16255 } 16256}(function ($) { 16257 16258 var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], 16259 toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? 16260 ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], 16261 slice = Array.prototype.slice, 16262 nullLowestDeltaTimeout, lowestDelta; 16263 16264 if ( $.event.fixHooks ) { 16265 for ( var i = toFix.length; i; ) { 16266 $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 16267 } 16268 } 16269 16270 var special = $.event.special.mousewheel = { 16271 version: '3.1.12', 16272 16273 setup: function() { 16274 if ( this.addEventListener ) { 16275 for ( var i = toBind.length; i; ) { 16276 this.addEventListener( toBind[--i], handler, false ); 16277 } 16278 } else { 16279 this.onmousewheel = handler; 16280 } 16281 // Store the line height and page height for this particular element 16282 $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); 16283 $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); 16284 }, 16285 16286 teardown: function() { 16287 if ( this.removeEventListener ) { 16288 for ( var i = toBind.length; i; ) { 16289 this.removeEventListener( toBind[--i], handler, false ); 16290 } 16291 } else { 16292 this.onmousewheel = null; 16293 } 16294 // Clean up the data we added to the element 16295 $.removeData(this, 'mousewheel-line-height'); 16296 $.removeData(this, 'mousewheel-page-height'); 16297 }, 16298 16299 getLineHeight: function(elem) { 16300 var $elem = $(elem), 16301 $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); 16302 if (!$parent.length) { 16303 $parent = $('body'); 16304 } 16305 return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; 16306 }, 16307 16308 getPageHeight: function(elem) { 16309 return $(elem).height(); 16310 }, 16311 16312 settings: { 16313 adjustOldDeltas: true, // see shouldAdjustOldDeltas() below 16314 normalizeOffset: true // calls getBoundingClientRect for each event 16315 } 16316 }; 16317 16318 $.fn.extend({ 16319 mousewheel: function(fn) { 16320 return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); 16321 }, 16322 16323 unmousewheel: function(fn) { 16324 return this.unbind('mousewheel', fn); 16325 } 16326 }); 16327 16328 16329 function handler(event) { 16330 var orgEvent = event || window.event, 16331 args = slice.call(arguments, 1), 16332 delta = 0, 16333 deltaX = 0, 16334 deltaY = 0, 16335 absDelta = 0, 16336 offsetX = 0, 16337 offsetY = 0; 16338 event = $.event.fix(orgEvent); 16339 event.type = 'mousewheel'; 16340 16341 // Old school scrollwheel delta 16342 if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } 16343 if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } 16344 if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } 16345 if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } 16346 16347 // Firefox < 17 horizontal scrolling related to DOMMouseScroll event 16348 if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 16349 deltaX = deltaY * -1; 16350 deltaY = 0; 16351 } 16352 16353 // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy 16354 delta = deltaY === 0 ? deltaX : deltaY; 16355 16356 // New school wheel delta (wheel event) 16357 if ( 'deltaY' in orgEvent ) { 16358 deltaY = orgEvent.deltaY * -1; 16359 delta = deltaY; 16360 } 16361 if ( 'deltaX' in orgEvent ) { 16362 deltaX = orgEvent.deltaX; 16363 if ( deltaY === 0 ) { delta = deltaX * -1; } 16364 } 16365 16366 // No change actually happened, no reason to go any further 16367 if ( deltaY === 0 && deltaX === 0 ) { return; } 16368 16369 // Need to convert lines and pages to pixels if we aren't already in pixels 16370 // There are three delta modes: 16371 // * deltaMode 0 is by pixels, nothing to do 16372 // * deltaMode 1 is by lines 16373 // * deltaMode 2 is by pages 16374 if ( orgEvent.deltaMode === 1 ) { 16375 var lineHeight = $.data(this, 'mousewheel-line-height'); 16376 delta *= lineHeight; 16377 deltaY *= lineHeight; 16378 deltaX *= lineHeight; 16379 } else if ( orgEvent.deltaMode === 2 ) { 16380 var pageHeight = $.data(this, 'mousewheel-page-height'); 16381 delta *= pageHeight; 16382 deltaY *= pageHeight; 16383 deltaX *= pageHeight; 16384 } 16385 16386 // Store lowest absolute delta to normalize the delta values 16387 absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); 16388 16389 if ( !lowestDelta || absDelta < lowestDelta ) { 16390 lowestDelta = absDelta; 16391 16392 // Adjust older deltas if necessary 16393 if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 16394 lowestDelta /= 40; 16395 } 16396 } 16397 16398 // Adjust older deltas if necessary 16399 if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 16400 // Divide all the things by 40! 16401 delta /= 40; 16402 deltaX /= 40; 16403 deltaY /= 40; 16404 } 16405 16406 // Get a whole, normalized value for the deltas 16407 delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); 16408 deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); 16409 deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); 16410 16411 // Normalise offsetX and offsetY properties 16412 if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { 16413 var boundingRect = this.getBoundingClientRect(); 16414 offsetX = event.clientX - boundingRect.left; 16415 offsetY = event.clientY - boundingRect.top; 16416 } 16417 16418 // Add information to the event object 16419 event.deltaX = deltaX; 16420 event.deltaY = deltaY; 16421 event.deltaFactor = lowestDelta; 16422 event.offsetX = offsetX; 16423 event.offsetY = offsetY; 16424 // Go ahead and set deltaMode to 0 since we converted to pixels 16425 // Although this is a little odd since we overwrite the deltaX/Y 16426 // properties with normalized deltas. 16427 event.deltaMode = 0; 16428 16429 // Add event and delta to the front of the arguments 16430 args.unshift(event, delta, deltaX, deltaY); 16431 16432 // Clearout lowestDelta after sometime to better 16433 // handle multiple device types that give different 16434 // a different lowestDelta 16435 // Ex: trackpad = 3 and mouse wheel = 120 16436 if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } 16437 nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); 16438 16439 return ($.event.dispatch || $.event.handle).apply(this, args); 16440 } 16441 16442 function nullLowestDelta() { 16443 lowestDelta = null; 16444 } 16445 16446 function shouldAdjustOldDeltas(orgEvent, absDelta) { 16447 // If this is an older event and the delta is divisable by 120, 16448 // then we are assuming that the browser is treating this as an 16449 // older mouse wheel event and that we should divide the deltas 16450 // by 40 to try and get a more usable deltaFactor. 16451 // Side note, this actually impacts the reported scroll distance 16452 // in older browsers and can cause scrolling to be slower than native. 16453 // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. 16454 return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; 16455 } 16456 16457}));
vendor: 116,632 bytes, lines 16458-20095
16458;(function (root, factory) { 16459 if (typeof exports === "object") { 16460 // CommonJS 16461 module.exports = exports = factory(); 16462 } 16463 else if (typeof define === "function" && define.amd) { 16464 // AMD 16465 define([], factory); 16466 } 16467 else { 16468 // Global (browser) 16469 root.CryptoJS = factory(); 16470 } 16471}(this, function () { 16472 16473 /*globals window, global, require*/ 16474 16475 /** 16476 * CryptoJS core components. 16477 */ 16478 var CryptoJS = CryptoJS || (function (Math, undefined) { 16479 16480 var crypto; 16481 16482 // Native crypto from window (Browser) 16483 if (typeof window !== 'undefined' && window.crypto) { 16484 crypto = window.crypto; 16485 } 16486 16487 // Native crypto in web worker (Browser) 16488 if (typeof self !== 'undefined' && self.crypto) { 16489 crypto = self.crypto; 16490 } 16491 16492 // Native crypto from worker 16493 if (typeof globalThis !== 'undefined' && globalThis.crypto) { 16494 crypto = globalThis.crypto; 16495 } 16496 16497 // Native (experimental IE 11) crypto from window (Browser) 16498 if (!crypto && typeof window !== 'undefined' && window.msCrypto) { 16499 crypto = window.msCrypto; 16500 } 16501 16502 // Native crypto from global (NodeJS) 16503 if (!crypto && typeof global !== 'undefined' && global.crypto) { 16504 crypto = global.crypto; 16505 } 16506 16507 // Native crypto import via require (NodeJS) 16508 if (!crypto && typeof require === 'function') { 16509 try { 16510 crypto = require('crypto'); 16511 } catch (err) {} 16512 } 16513 16514 /* 16515 * Cryptographically secure pseudorandom number generator 16516 * 16517 * As Math.random() is cryptographically not safe to use 16518 */ 16519 var cryptoSecureRandomInt = function () { 16520 if (crypto) { 16521 // Use getRandomValues method (Browser) 16522 if (typeof crypto.getRandomValues === 'function') { 16523 try { 16524 return crypto.getRandomValues(new Uint32Array(1))[0]; 16525 } catch (err) {} 16526 } 16527 16528 // Use randomBytes method (NodeJS) 16529 if (typeof crypto.randomBytes === 'function') { 16530 try { 16531 return crypto.randomBytes(4).readInt32LE(); 16532 } catch (err) {} 16533 } 16534 } 16535 16536 throw new Error('Native crypto module could not be used to get secure random number.'); 16537 }; 16538 16539 /* 16540 * Local polyfill of Object.create 16541 16542 */ 16543 var create = Object.create || (function () { 16544 function F() {} 16545 16546 return function (obj) { 16547 var subtype; 16548 16549 F.prototype = obj; 16550 16551 subtype = new F(); 16552 16553 F.prototype = null; 16554 16555 return subtype; 16556 }; 16557 }()); 16558 16559 /** 16560 * CryptoJS namespace. 16561 */ 16562 var C = {}; 16563 16564 /** 16565 * Library namespace. 16566 */ 16567 var C_lib = C.lib = {}; 16568 16569 /** 16570 * Base object for prototypal inheritance. 16571 */ 16572 var Base = C_lib.Base = (function () { 16573 16574 16575 return { 16576 /** 16577 * Creates a new object that inherits from this object. 16578 * 16579 * @param {Object} overrides Properties to copy into the new object. 16580 * 16581 * @return {Object} The new object. 16582 * 16583 * @static 16584 * 16585 * @example 16586 * 16587 * var MyType = CryptoJS.lib.Base.extend({ 16588 * field: 'value', 16589 * 16590 * method: function () { 16591 * } 16592 * }); 16593 */ 16594 extend: function (overrides) { 16595 // Spawn 16596 var subtype = create(this); 16597 16598 // Augment 16599 if (overrides) { 16600 subtype.mixIn(overrides); 16601 } 16602 16603 // Create default initializer 16604 if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { 16605 subtype.init = function () { 16606 subtype.$super.init.apply(this, arguments); 16607 }; 16608 } 16609 16610 // Initializer's prototype is the subtype object 16611 subtype.init.prototype = subtype; 16612 16613 // Reference supertype 16614 subtype.$super = this; 16615 16616 return subtype; 16617 }, 16618 16619 /** 16620 * Extends this object and runs the init method. 16621 * Arguments to create() will be passed to init(). 16622 * 16623 * @return {Object} The new object. 16624 * 16625 * @static 16626 * 16627 * @example 16628 * 16629 * var instance = MyType.create(); 16630 */ 16631 create: function () { 16632 var instance = this.extend(); 16633 instance.init.apply(instance, arguments); 16634 16635 return instance; 16636 }, 16637 16638 /** 16639 * Initializes a newly created object. 16640 * Override this method to add some logic when your objects are created. 16641 * 16642 * @example 16643 * 16644 * var MyType = CryptoJS.lib.Base.extend({ 16645 * init: function () { 16646 * // ... 16647 * } 16648 * }); 16649 */ 16650 init: function () { 16651 }, 16652 16653 /** 16654 * Copies properties into this object. 16655 * 16656 * @param {Object} properties The properties to mix in. 16657 * 16658 * @example 16659 * 16660 * MyType.mixIn({ 16661 * field: 'value' 16662 * }); 16663 */ 16664 mixIn: function (properties) { 16665 for (var propertyName in properties) { 16666 if (properties.hasOwnProperty(propertyName)) { 16667 this[propertyName] = properties[propertyName]; 16668 } 16669 } 16670 16671 // IE won't copy toString using the loop above 16672 if (properties.hasOwnProperty('toString')) { 16673 this.toString = properties.toString; 16674 } 16675 }, 16676 16677 /** 16678 * Creates a copy of this object. 16679 * 16680 * @return {Object} The clone. 16681 * 16682 * @example 16683 * 16684 * var clone = instance.clone(); 16685 */ 16686 clone: function () { 16687 return this.init.prototype.extend(this); 16688 } 16689 }; 16690 }()); 16691 16692 /** 16693 * An array of 32-bit words. 16694 * 16695 * @property {Array} words The array of 32-bit words. 16696 * @property {number} sigBytes The number of significant bytes in this word array. 16697 */ 16698 var WordArray = C_lib.WordArray = Base.extend({ 16699 /** 16700 * Initializes a newly created word array. 16701 * 16702 * @param {Array} words (Optional) An array of 32-bit words. 16703 * @param {number} sigBytes (Optional) The number of significant bytes in the words. 16704 * 16705 * @example 16706 * 16707 * var wordArray = CryptoJS.lib.WordArray.create(); 16708 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); 16709 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); 16710 */ 16711 init: function (words, sigBytes) { 16712 words = this.words = words || []; 16713 16714 if (sigBytes != undefined) { 16715 this.sigBytes = sigBytes; 16716 } else { 16717 this.sigBytes = words.length * 4; 16718 } 16719 }, 16720 16721 /** 16722 * Converts this word array to a string. 16723 * 16724 * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex 16725 * 16726 * @return {string} The stringified word array. 16727 * 16728 * @example 16729 * 16730 * var string = wordArray + ''; 16731 * var string = wordArray.toString(); 16732 * var string = wordArray.toString(CryptoJS.enc.Utf8); 16733 */ 16734 toString: function (encoder) { 16735 return (encoder || Hex).stringify(this); 16736 }, 16737 16738 /** 16739 * Concatenates a word array to this word array. 16740 * 16741 * @param {WordArray} wordArray The word array to append. 16742 * 16743 * @return {WordArray} This word array. 16744 * 16745 * @example 16746 * 16747 * wordArray1.concat(wordArray2); 16748 */ 16749 concat: function (wordArray) { 16750 // Shortcuts 16751 var thisWords = this.words; 16752 var thatWords = wordArray.words; 16753 var thisSigBytes = this.sigBytes; 16754 var thatSigBytes = wordArray.sigBytes; 16755 16756 // Clamp excess bits 16757 this.clamp(); 16758 16759 // Concat 16760 if (thisSigBytes % 4) { 16761 // Copy one byte at a time 16762 for (var i = 0; i < thatSigBytes; i++) { 16763 var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 16764 thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); 16765 } 16766 } else { 16767 // Copy one word at a time 16768 for (var j = 0; j < thatSigBytes; j += 4) { 16769 thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; 16770 } 16771 } 16772 this.sigBytes += thatSigBytes; 16773 16774 // Chainable 16775 return this; 16776 }, 16777 16778 /** 16779 * Removes insignificant bits. 16780 * 16781 * @example 16782 * 16783 * wordArray.clamp(); 16784 */ 16785 clamp: function () { 16786 // Shortcuts 16787 var words = this.words; 16788 var sigBytes = this.sigBytes; 16789 16790 // Clamp 16791 words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); 16792 words.length = Math.ceil(sigBytes / 4); 16793 }, 16794 16795 /** 16796 * Creates a copy of this word array. 16797 * 16798 * @return {WordArray} The clone. 16799 * 16800 * @example 16801 * 16802 * var clone = wordArray.clone(); 16803 */ 16804 clone: function () { 16805 var clone = Base.clone.call(this); 16806 clone.words = this.words.slice(0); 16807 16808 return clone; 16809 }, 16810 16811 /** 16812 * Creates a word array filled with random bytes. 16813 * 16814 * @param {number} nBytes The number of random bytes to generate. 16815 * 16816 * @return {WordArray} The random word array. 16817 * 16818 * @static 16819 * 16820 * @example 16821 * 16822 * var wordArray = CryptoJS.lib.WordArray.random(16); 16823 */ 16824 random: function (nBytes) { 16825 var words = []; 16826 16827 for (var i = 0; i < nBytes; i += 4) { 16828 words.push(cryptoSecureRandomInt()); 16829 } 16830 16831 return new WordArray.init(words, nBytes); 16832 } 16833 }); 16834 16835 /** 16836 * Encoder namespace. 16837 */ 16838 var C_enc = C.enc = {}; 16839 16840 /** 16841 * Hex encoding strategy. 16842 */ 16843 var Hex = C_enc.Hex = { 16844 /** 16845 * Converts a word array to a hex string. 16846 * 16847 * @param {WordArray} wordArray The word array. 16848 * 16849 * @return {string} The hex string. 16850 * 16851 * @static 16852 * 16853 * @example 16854 * 16855 * var hexString = CryptoJS.enc.Hex.stringify(wordArray); 16856 */ 16857 stringify: function (wordArray) { 16858 // Shortcuts 16859 var words = wordArray.words; 16860 var sigBytes = wordArray.sigBytes; 16861 16862 // Convert 16863 var hexChars = []; 16864 for (var i = 0; i < sigBytes; i++) { 16865 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 16866 hexChars.push((bite >>> 4).toString(16)); 16867 hexChars.push((bite & 0x0f).toString(16)); 16868 } 16869 16870 return hexChars.join(''); 16871 }, 16872 16873 /** 16874 * Converts a hex string to a word array. 16875 * 16876 * @param {string} hexStr The hex string. 16877 * 16878 * @return {WordArray} The word array. 16879 * 16880 * @static 16881 * 16882 * @example 16883 * 16884 * var wordArray = CryptoJS.enc.Hex.parse(hexString); 16885 */ 16886 parse: function (hexStr) { 16887 // Shortcut 16888 var hexStrLength = hexStr.length; 16889 16890 // Convert 16891 var words = []; 16892 for (var i = 0; i < hexStrLength; i += 2) { 16893 words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); 16894 } 16895 16896 return new WordArray.init(words, hexStrLength / 2); 16897 } 16898 }; 16899 16900 /** 16901 * Latin1 encoding strategy. 16902 */ 16903 var Latin1 = C_enc.Latin1 = { 16904 /** 16905 * Converts a word array to a Latin1 string. 16906 * 16907 * @param {WordArray} wordArray The word array. 16908 * 16909 * @return {string} The Latin1 string. 16910 * 16911 * @static 16912 * 16913 * @example 16914 * 16915 * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); 16916 */ 16917 stringify: function (wordArray) { 16918 // Shortcuts 16919 var words = wordArray.words; 16920 var sigBytes = wordArray.sigBytes; 16921 16922 // Convert 16923 var latin1Chars = []; 16924 for (var i = 0; i < sigBytes; i++) { 16925 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 16926 latin1Chars.push(String.fromCharCode(bite)); 16927 } 16928 16929 return latin1Chars.join(''); 16930 }, 16931 16932 /** 16933 * Converts a Latin1 string to a word array. 16934 * 16935 * @param {string} latin1Str The Latin1 string. 16936 * 16937 * @return {WordArray} The word array. 16938 * 16939 * @static 16940 * 16941 * @example 16942 * 16943 * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); 16944 */ 16945 parse: function (latin1Str) { 16946 // Shortcut 16947 var latin1StrLength = latin1Str.length; 16948 16949 // Convert 16950 var words = []; 16951 for (var i = 0; i < latin1StrLength; i++) { 16952 words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); 16953 } 16954 16955 return new WordArray.init(words, latin1StrLength); 16956 } 16957 }; 16958 16959 /** 16960 * UTF-8 encoding strategy. 16961 */ 16962 var Utf8 = C_enc.Utf8 = { 16963 /** 16964 * Converts a word array to a UTF-8 string. 16965 * 16966 * @param {WordArray} wordArray The word array. 16967 * 16968 * @return {string} The UTF-8 string. 16969 * 16970 * @static 16971 * 16972 * @example 16973 * 16974 * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); 16975 */ 16976 stringify: function (wordArray) { 16977 try { 16978 return decodeURIComponent(escape(Latin1.stringify(wordArray))); 16979 } catch (e) { 16980 throw new Error('Malformed UTF-8 data'); 16981 } 16982 }, 16983 16984 /** 16985 * Converts a UTF-8 string to a word array. 16986 * 16987 * @param {string} utf8Str The UTF-8 string. 16988 * 16989 * @return {WordArray} The word array. 16990 * 16991 * @static 16992 * 16993 * @example 16994 * 16995 * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); 16996 */ 16997 parse: function (utf8Str) { 16998 return Latin1.parse(unescape(encodeURIComponent(utf8Str))); 16999 } 17000 }; 17001 17002 /** 17003 * Abstract buffered block algorithm template. 17004 * 17005 * The property blockSize must be implemented in a concrete subtype. 17006 * 17007 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 17008 */ 17009 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ 17010 /** 17011 * Resets this block algorithm's data buffer to its initial state. 17012 * 17013 * @example 17014 * 17015 * bufferedBlockAlgorithm.reset(); 17016 */ 17017 reset: function () { 17018 // Initial values 17019 this._data = new WordArray.init(); 17020 this._nDataBytes = 0; 17021 }, 17022 17023 /** 17024 * Adds new data to this block algorithm's buffer. 17025 * 17026 * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. 17027 * 17028 * @example 17029 * 17030 * bufferedBlockAlgorithm._append('data'); 17031 * bufferedBlockAlgorithm._append(wordArray); 17032 */ 17033 _append: function (data) { 17034 // Convert string to WordArray, else assume WordArray already 17035 if (typeof data == 'string') { 17036 data = Utf8.parse(data); 17037 } 17038 17039 // Append 17040 this._data.concat(data); 17041 this._nDataBytes += data.sigBytes; 17042 }, 17043 17044 /** 17045 * Processes available data blocks. 17046 * 17047 * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. 17048 * 17049 * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. 17050 * 17051 * @return {WordArray} The processed data. 17052 * 17053 * @example 17054 * 17055 * var processedData = bufferedBlockAlgorithm._process(); 17056 * var processedData = bufferedBlockAlgorithm._process(!!'flush'); 17057 */ 17058 _process: function (doFlush) { 17059 var processedWords; 17060 17061 // Shortcuts 17062 var data = this._data; 17063 var dataWords = data.words; 17064 var dataSigBytes = data.sigBytes; 17065 var blockSize = this.blockSize; 17066 var blockSizeBytes = blockSize * 4; 17067 17068 // Count blocks ready 17069 var nBlocksReady = dataSigBytes / blockSizeBytes; 17070 if (doFlush) { 17071 // Round up to include partial blocks 17072 nBlocksReady = Math.ceil(nBlocksReady); 17073 } else { 17074 // Round down to include only full blocks, 17075 // less the number of blocks that must remain in the buffer 17076 nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); 17077 } 17078 17079 // Count words ready 17080 var nWordsReady = nBlocksReady * blockSize; 17081 17082 // Count bytes ready 17083 var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); 17084 17085 // Process blocks 17086 if (nWordsReady) { 17087 for (var offset = 0; offset < nWordsReady; offset += blockSize) { 17088 // Perform concrete-algorithm logic 17089 this._doProcessBlock(dataWords, offset); 17090 } 17091 17092 // Remove processed words 17093 processedWords = dataWords.splice(0, nWordsReady); 17094 data.sigBytes -= nBytesReady; 17095 } 17096 17097 // Return processed words 17098 return new WordArray.init(processedWords, nBytesReady); 17099 }, 17100 17101 /** 17102 * Creates a copy of this object. 17103 * 17104 * @return {Object} The clone. 17105 * 17106 * @example 17107 * 17108 * var clone = bufferedBlockAlgorithm.clone(); 17109 */ 17110 clone: function () { 17111 var clone = Base.clone.call(this); 17112 clone._data = this._data.clone(); 17113 17114 return clone; 17115 }, 17116 17117 _minBufferSize: 0 17118 }); 17119 17120 /** 17121 * Abstract hasher template. 17122 * 17123 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) 17124 */ 17125 var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ 17126 /** 17127 * Configuration options. 17128 */ 17129 cfg: Base.extend(), 17130 17131 /** 17132 * Initializes a newly created hasher. 17133 * 17134 * @param {Object} cfg (Optional) The configuration options to use for this hash computation. 17135 * 17136 * @example 17137 * 17138 * var hasher = CryptoJS.algo.SHA256.create(); 17139 */ 17140 init: function (cfg) { 17141 // Apply config defaults 17142 this.cfg = this.cfg.extend(cfg); 17143 17144 // Set initial values 17145 this.reset(); 17146 }, 17147 17148 /** 17149 * Resets this hasher to its initial state. 17150 * 17151 * @example 17152 * 17153 * hasher.reset(); 17154 */ 17155 reset: function () { 17156 // Reset data buffer 17157 BufferedBlockAlgorithm.reset.call(this); 17158 17159 // Perform concrete-hasher logic 17160 this._doReset(); 17161 }, 17162 17163 /** 17164 * Updates this hasher with a message. 17165 * 17166 * @param {WordArray|string} messageUpdate The message to append. 17167 * 17168 * @return {Hasher} This hasher. 17169 * 17170 * @example 17171 * 17172 * hasher.update('message'); 17173 * hasher.update(wordArray); 17174 */ 17175 update: function (messageUpdate) { 17176 // Append 17177 this._append(messageUpdate); 17178 17179 // Update the hash 17180 this._process(); 17181 17182 // Chainable 17183 return this; 17184 }, 17185 17186 /** 17187 * Finalizes the hash computation. 17188 * Note that the finalize operation is effectively a destructive, read-once operation. 17189 * 17190 * @param {WordArray|string} messageUpdate (Optional) A final message update. 17191 * 17192 * @return {WordArray} The hash. 17193 * 17194 * @example 17195 * 17196 * var hash = hasher.finalize(); 17197 * var hash = hasher.finalize('message'); 17198 * var hash = hasher.finalize(wordArray); 17199 */ 17200 finalize: function (messageUpdate) { 17201 // Final message update 17202 if (messageUpdate) { 17203 this._append(messageUpdate); 17204 } 17205 17206 // Perform concrete-hasher logic 17207 var hash = this._doFinalize(); 17208 17209 return hash; 17210 }, 17211 17212 blockSize: 512/32, 17213 17214 /** 17215 * Creates a shortcut function to a hasher's object interface. 17216 * 17217 * @param {Hasher} hasher The hasher to create a helper for. 17218 * 17219 * @return {Function} The shortcut function. 17220 * 17221 * @static 17222 * 17223 * @example 17224 * 17225 * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); 17226 */ 17227 _createHelper: function (hasher) { 17228 return function (message, cfg) { 17229 return new hasher.init(cfg).finalize(message); 17230 }; 17231 }, 17232 17233 /** 17234 * Creates a shortcut function to the HMAC's object interface. 17235 * 17236 * @param {Hasher} hasher The hasher to use in this HMAC helper. 17237 * 17238 * @return {Function} The shortcut function. 17239 * 17240 * @static 17241 * 17242 * @example 17243 * 17244 * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); 17245 */ 17246 _createHmacHelper: function (hasher) { 17247 return function (message, key) { 17248 return new C_algo.HMAC.init(hasher, key).finalize(message); 17249 }; 17250 } 17251 }); 17252 17253 /** 17254 * Algorithm namespace. 17255 */ 17256 var C_algo = C.algo = {}; 17257 17258 return C; 17259 }(Math)); 17260 17261 17262 (function (undefined) { 17263 // Shortcuts 17264 var C = CryptoJS; 17265 var C_lib = C.lib; 17266 var Base = C_lib.Base; 17267 var X32WordArray = C_lib.WordArray; 17268 17269 /** 17270 * x64 namespace. 17271 */ 17272 var C_x64 = C.x64 = {}; 17273 17274 /** 17275 * A 64-bit word. 17276 */ 17277 var X64Word = C_x64.Word = Base.extend({ 17278 /** 17279 * Initializes a newly created 64-bit word. 17280 * 17281 * @param {number} high The high 32 bits. 17282 * @param {number} low The low 32 bits. 17283 * 17284 * @example 17285 * 17286 * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); 17287 */ 17288 init: function (high, low) { 17289 this.high = high; 17290 this.low = low; 17291 } 17292 17293 /** 17294 * Bitwise NOTs this word. 17295 * 17296 * @return {X64Word} A new x64-Word object after negating. 17297 * 17298 * @example 17299 * 17300 * var negated = x64Word.not(); 17301 */ 17302 // not: function () { 17303 // var high = ~this.high; 17304 // var low = ~this.low; 17305 17306 // return X64Word.create(high, low); 17307 // }, 17308 17309 /** 17310 * Bitwise ANDs this word with the passed word. 17311 * 17312 * @param {X64Word} word The x64-Word to AND with this word. 17313 * 17314 * @return {X64Word} A new x64-Word object after ANDing. 17315 * 17316 * @example 17317 * 17318 * var anded = x64Word.and(anotherX64Word); 17319 */ 17320 // and: function (word) { 17321 // var high = this.high & word.high; 17322 // var low = this.low & word.low; 17323 17324 // return X64Word.create(high, low); 17325 // }, 17326 17327 /** 17328 * Bitwise ORs this word with the passed word. 17329 * 17330 * @param {X64Word} word The x64-Word to OR with this word. 17331 * 17332 * @return {X64Word} A new x64-Word object after ORing. 17333 * 17334 * @example 17335 * 17336 * var ored = x64Word.or(anotherX64Word); 17337 */ 17338 // or: function (word) { 17339 // var high = this.high | word.high; 17340 // var low = this.low | word.low; 17341 17342 // return X64Word.create(high, low); 17343 // }, 17344 17345 /** 17346 * Bitwise XORs this word with the passed word. 17347 * 17348 * @param {X64Word} word The x64-Word to XOR with this word. 17349 * 17350 * @return {X64Word} A new x64-Word object after XORing. 17351 * 17352 * @example 17353 * 17354 * var xored = x64Word.xor(anotherX64Word); 17355 */ 17356 // xor: function (word) { 17357 // var high = this.high ^ word.high; 17358 // var low = this.low ^ word.low; 17359 17360 // return X64Word.create(high, low); 17361 // }, 17362 17363 /** 17364 * Shifts this word n bits to the left. 17365 * 17366 * @param {number} n The number of bits to shift. 17367 * 17368 * @return {X64Word} A new x64-Word object after shifting. 17369 * 17370 * @example 17371 * 17372 * var shifted = x64Word.shiftL(25); 17373 */ 17374 // shiftL: function (n) { 17375 // if (n < 32) { 17376 // var high = (this.high << n) | (this.low >>> (32 - n)); 17377 // var low = this.low << n; 17378 // } else { 17379 // var high = this.low << (n - 32); 17380 // var low = 0; 17381 // } 17382 17383 // return X64Word.create(high, low); 17384 // }, 17385 17386 /** 17387 * Shifts this word n bits to the right. 17388 * 17389 * @param {number} n The number of bits to shift. 17390 * 17391 * @return {X64Word} A new x64-Word object after shifting. 17392 * 17393 * @example 17394 * 17395 * var shifted = x64Word.shiftR(7); 17396 */ 17397 // shiftR: function (n) { 17398 // if (n < 32) { 17399 // var low = (this.low >>> n) | (this.high << (32 - n)); 17400 // var high = this.high >>> n; 17401 // } else { 17402 // var low = this.high >>> (n - 32); 17403 // var high = 0; 17404 // } 17405 17406 // return X64Word.create(high, low); 17407 // }, 17408 17409 /** 17410 * Rotates this word n bits to the left. 17411 * 17412 * @param {number} n The number of bits to rotate. 17413 * 17414 * @return {X64Word} A new x64-Word object after rotating. 17415 * 17416 * @example 17417 * 17418 * var rotated = x64Word.rotL(25); 17419 */ 17420 // rotL: function (n) { 17421 // return this.shiftL(n).or(this.shiftR(64 - n)); 17422 // }, 17423 17424 /** 17425 * Rotates this word n bits to the right. 17426 * 17427 * @param {number} n The number of bits to rotate. 17428 * 17429 * @return {X64Word} A new x64-Word object after rotating. 17430 * 17431 * @example 17432 * 17433 * var rotated = x64Word.rotR(7); 17434 */ 17435 // rotR: function (n) { 17436 // return this.shiftR(n).or(this.shiftL(64 - n)); 17437 // }, 17438 17439 /** 17440 * Adds this word with the passed word. 17441 * 17442 * @param {X64Word} word The x64-Word to add with this word. 17443 * 17444 * @return {X64Word} A new x64-Word object after adding. 17445 * 17446 * @example 17447 * 17448 * var added = x64Word.add(anotherX64Word); 17449 */ 17450 // add: function (word) { 17451 // var low = (this.low + word.low) | 0; 17452 // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; 17453 // var high = (this.high + word.high + carry) | 0; 17454 17455 // return X64Word.create(high, low); 17456 // } 17457 }); 17458 17459 /** 17460 * An array of 64-bit words. 17461 * 17462 * @property {Array} words The array of CryptoJS.x64.Word objects. 17463 * @property {number} sigBytes The number of significant bytes in this word array. 17464 */ 17465 var X64WordArray = C_x64.WordArray = Base.extend({ 17466 /** 17467 * Initializes a newly created word array. 17468 * 17469 * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. 17470 * @param {number} sigBytes (Optional) The number of significant bytes in the words. 17471 * 17472 * @example 17473 * 17474 * var wordArray = CryptoJS.x64.WordArray.create(); 17475 * 17476 * var wordArray = CryptoJS.x64.WordArray.create([ 17477 * CryptoJS.x64.Word.create(0x00010203, 0x04050607), 17478 * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) 17479 * ]); 17480 * 17481 * var wordArray = CryptoJS.x64.WordArray.create([ 17482 * CryptoJS.x64.Word.create(0x00010203, 0x04050607), 17483 * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) 17484 * ], 10); 17485 */ 17486 init: function (words, sigBytes) { 17487 words = this.words = words || []; 17488 17489 if (sigBytes != undefined) { 17490 this.sigBytes = sigBytes; 17491 } else { 17492 this.sigBytes = words.length * 8; 17493 } 17494 }, 17495 17496 /** 17497 * Converts this 64-bit word array to a 32-bit word array. 17498 * 17499 * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. 17500 * 17501 * @example 17502 * 17503 * var x32WordArray = x64WordArray.toX32(); 17504 */ 17505 toX32: function () { 17506 // Shortcuts 17507 var x64Words = this.words; 17508 var x64WordsLength = x64Words.length; 17509 17510 // Convert 17511 var x32Words = []; 17512 for (var i = 0; i < x64WordsLength; i++) { 17513 var x64Word = x64Words[i]; 17514 x32Words.push(x64Word.high); 17515 x32Words.push(x64Word.low); 17516 } 17517 17518 return X32WordArray.create(x32Words, this.sigBytes); 17519 }, 17520 17521 /** 17522 * Creates a copy of this word array. 17523 * 17524 * @return {X64WordArray} The clone. 17525 * 17526 * @example 17527 * 17528 * var clone = x64WordArray.clone(); 17529 */ 17530 clone: function () { 17531 var clone = Base.clone.call(this); 17532 17533 // Clone "words" array 17534 var words = clone.words = this.words.slice(0); 17535 17536 // Clone each X64Word object 17537 var wordsLength = words.length; 17538 for (var i = 0; i < wordsLength; i++) { 17539 words[i] = words[i].clone(); 17540 } 17541 17542 return clone; 17543 } 17544 }); 17545 }()); 17546 17547 17548 (function () { 17549 // Check if typed arrays are supported 17550 if (typeof ArrayBuffer != 'function') { 17551 return; 17552 } 17553 17554 // Shortcuts 17555 var C = CryptoJS; 17556 var C_lib = C.lib; 17557 var WordArray = C_lib.WordArray; 17558 17559 // Reference original init 17560 var superInit = WordArray.init; 17561 17562 // Augment WordArray.init to handle typed arrays 17563 var subInit = WordArray.init = function (typedArray) { 17564 // Convert buffers to uint8 17565 if (typedArray instanceof ArrayBuffer) { 17566 typedArray = new Uint8Array(typedArray); 17567 } 17568 17569 // Convert other array views to uint8 17570 if ( 17571 typedArray instanceof Int8Array || 17572 (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || 17573 typedArray instanceof Int16Array || 17574 typedArray instanceof Uint16Array || 17575 typedArray instanceof Int32Array || 17576 typedArray instanceof Uint32Array || 17577 typedArray instanceof Float32Array || 17578 typedArray instanceof Float64Array 17579 ) { 17580 typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); 17581 } 17582 17583 // Handle Uint8Array 17584 if (typedArray instanceof Uint8Array) { 17585 // Shortcut 17586 var typedArrayByteLength = typedArray.byteLength; 17587 17588 // Extract bytes 17589 var words = []; 17590 for (var i = 0; i < typedArrayByteLength; i++) { 17591 words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); 17592 } 17593 17594 // Initialize this word array 17595 superInit.call(this, words, typedArrayByteLength); 17596 } else { 17597 // Else call normal init 17598 superInit.apply(this, arguments); 17599 } 17600 }; 17601 17602 subInit.prototype = WordArray; 17603 }()); 17604 17605 17606 (function () { 17607 // Shortcuts 17608 var C = CryptoJS; 17609 var C_lib = C.lib; 17610 var WordArray = C_lib.WordArray; 17611 var C_enc = C.enc; 17612 17613 /** 17614 * UTF-16 BE encoding strategy. 17615 */ 17616 var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { 17617 /** 17618 * Converts a word array to a UTF-16 BE string. 17619 * 17620 * @param {WordArray} wordArray The word array. 17621 * 17622 * @return {string} The UTF-16 BE string. 17623 * 17624 * @static 17625 * 17626 * @example 17627 * 17628 * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); 17629 */ 17630 stringify: function (wordArray) { 17631 // Shortcuts 17632 var words = wordArray.words; 17633 var sigBytes = wordArray.sigBytes; 17634 17635 // Convert 17636 var utf16Chars = []; 17637 for (var i = 0; i < sigBytes; i += 2) { 17638 var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; 17639 utf16Chars.push(String.fromCharCode(codePoint)); 17640 } 17641 17642 return utf16Chars.join(''); 17643 }, 17644 17645 /** 17646 * Converts a UTF-16 BE string to a word array. 17647 * 17648 * @param {string} utf16Str The UTF-16 BE string. 17649 * 17650 * @return {WordArray} The word array. 17651 * 17652 * @static 17653 * 17654 * @example 17655 * 17656 * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); 17657 */ 17658 parse: function (utf16Str) { 17659 // Shortcut 17660 var utf16StrLength = utf16Str.length; 17661 17662 // Convert 17663 var words = []; 17664 for (var i = 0; i < utf16StrLength; i++) { 17665 words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); 17666 } 17667 17668 return WordArray.create(words, utf16StrLength * 2); 17669 } 17670 }; 17671 17672 /** 17673 * UTF-16 LE encoding strategy. 17674 */ 17675 C_enc.Utf16LE = { 17676 /** 17677 * Converts a word array to a UTF-16 LE string. 17678 * 17679 * @param {WordArray} wordArray The word array. 17680 * 17681 * @return {string} The UTF-16 LE string. 17682 * 17683 * @static 17684 * 17685 * @example 17686 * 17687 * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); 17688 */ 17689 stringify: function (wordArray) { 17690 // Shortcuts 17691 var words = wordArray.words; 17692 var sigBytes = wordArray.sigBytes; 17693 17694 // Convert 17695 var utf16Chars = []; 17696 for (var i = 0; i < sigBytes; i += 2) { 17697 var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); 17698 utf16Chars.push(String.fromCharCode(codePoint)); 17699 } 17700 17701 return utf16Chars.join(''); 17702 }, 17703 17704 /** 17705 * Converts a UTF-16 LE string to a word array. 17706 * 17707 * @param {string} utf16Str The UTF-16 LE string. 17708 * 17709 * @return {WordArray} The word array. 17710 * 17711 * @static 17712 * 17713 * @example 17714 * 17715 * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); 17716 */ 17717 parse: function (utf16Str) { 17718 // Shortcut 17719 var utf16StrLength = utf16Str.length; 17720 17721 // Convert 17722 var words = []; 17723 for (var i = 0; i < utf16StrLength; i++) { 17724 words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); 17725 } 17726 17727 return WordArray.create(words, utf16StrLength * 2); 17728 } 17729 }; 17730 17731 function swapEndian(word) { 17732 return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); 17733 } 17734 }()); 17735 17736 17737 (function () { 17738 // Shortcuts 17739 var C = CryptoJS; 17740 var C_lib = C.lib; 17741 var WordArray = C_lib.WordArray; 17742 var C_enc = C.enc; 17743 17744 /** 17745 * Base64 encoding strategy. 17746 */ 17747 var Base64 = C_enc.Base64 = { 17748 /** 17749 * Converts a word array to a Base64 string. 17750 * 17751 * @param {WordArray} wordArray The word array. 17752 * 17753 * @return {string} The Base64 string. 17754 * 17755 * @static 17756 * 17757 * @example 17758 * 17759 * var base64String = CryptoJS.enc.Base64.stringify(wordArray); 17760 */ 17761 stringify: function (wordArray) { 17762 // Shortcuts 17763 var words = wordArray.words; 17764 var sigBytes = wordArray.sigBytes; 17765 var map = this._map; 17766 17767 // Clamp excess bits 17768 wordArray.clamp(); 17769 17770 // Convert 17771 var base64Chars = []; 17772 for (var i = 0; i < sigBytes; i += 3) { 17773 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 17774 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; 17775 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; 17776 17777 var triplet = (byte1 << 16) | (byte2 << 8) | byte3; 17778 17779 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { 17780 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); 17781 } 17782 } 17783 17784 // Add padding 17785 var paddingChar = map.charAt(64); 17786 if (paddingChar) { 17787 while (base64Chars.length % 4) { 17788 base64Chars.push(paddingChar); 17789 } 17790 } 17791 17792 return base64Chars.join(''); 17793 }, 17794 17795 /** 17796 * Converts a Base64 string to a word array. 17797 * 17798 * @param {string} base64Str The Base64 string. 17799 * 17800 * @return {WordArray} The word array. 17801 * 17802 * @static 17803 * 17804 * @example 17805 * 17806 * var wordArray = CryptoJS.enc.Base64.parse(base64String); 17807 */ 17808 parse: function (base64Str) { 17809 // Shortcuts 17810 var base64StrLength = base64Str.length; 17811 var map = this._map; 17812 var reverseMap = this._reverseMap; 17813 17814 if (!reverseMap) { 17815 reverseMap = this._reverseMap = []; 17816 for (var j = 0; j < map.length; j++) { 17817 reverseMap[map.charCodeAt(j)] = j; 17818 } 17819 } 17820 17821 // Ignore padding 17822 var paddingChar = map.charAt(64); 17823 if (paddingChar) { 17824 var paddingIndex = base64Str.indexOf(paddingChar); 17825 if (paddingIndex !== -1) { 17826 base64StrLength = paddingIndex; 17827 } 17828 } 17829 17830 // Convert 17831 return parseLoop(base64Str, base64StrLength, reverseMap); 17832 17833 }, 17834 17835 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' 17836 }; 17837 17838 function parseLoop(base64Str, base64StrLength, reverseMap) { 17839 var words = []; 17840 var nBytes = 0; 17841 for (var i = 0; i < base64StrLength; i++) { 17842 if (i % 4) { 17843 var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); 17844 var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); 17845 var bitsCombined = bits1 | bits2; 17846 words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); 17847 nBytes++; 17848 } 17849 } 17850 return WordArray.create(words, nBytes); 17851 } 17852 }()); 17853 17854 17855 (function () { 17856 // Shortcuts 17857 var C = CryptoJS; 17858 var C_lib = C.lib; 17859 var WordArray = C_lib.WordArray; 17860 var C_enc = C.enc; 17861 17862 /** 17863 * Base64url encoding strategy. 17864 */ 17865 var Base64url = C_enc.Base64url = { 17866 /** 17867 * Converts a word array to a Base64url string. 17868 * 17869 * @param {WordArray} wordArray The word array. 17870 * 17871 * @param {boolean} urlSafe Whether to use url safe 17872 * 17873 * @return {string} The Base64url string. 17874 * 17875 * @static 17876 * 17877 * @example 17878 * 17879 * var base64String = CryptoJS.enc.Base64url.stringify(wordArray); 17880 */ 17881 stringify: function (wordArray, urlSafe) { 17882 if (urlSafe === undefined) { 17883 urlSafe = true 17884 } 17885 // Shortcuts 17886 var words = wordArray.words; 17887 var sigBytes = wordArray.sigBytes; 17888 var map = urlSafe ? this._safe_map : this._map; 17889 17890 // Clamp excess bits 17891 wordArray.clamp(); 17892 17893 // Convert 17894 var base64Chars = []; 17895 for (var i = 0; i < sigBytes; i += 3) { 17896 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 17897 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; 17898 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; 17899 17900 var triplet = (byte1 << 16) | (byte2 << 8) | byte3; 17901 17902 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { 17903 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); 17904 } 17905 } 17906 17907 // Add padding 17908 var paddingChar = map.charAt(64); 17909 if (paddingChar) { 17910 while (base64Chars.length % 4) { 17911 base64Chars.push(paddingChar); 17912 } 17913 } 17914 17915 return base64Chars.join(''); 17916 }, 17917 17918 /** 17919 * Converts a Base64url string to a word array. 17920 * 17921 * @param {string} base64Str The Base64url string. 17922 * 17923 * @param {boolean} urlSafe Whether to use url safe 17924 * 17925 * @return {WordArray} The word array. 17926 * 17927 * @static 17928 * 17929 * @example 17930 * 17931 * var wordArray = CryptoJS.enc.Base64url.parse(base64String); 17932 */ 17933 parse: function (base64Str, urlSafe) { 17934 if (urlSafe === undefined) { 17935 urlSafe = true 17936 } 17937 17938 // Shortcuts 17939 var base64StrLength = base64Str.length; 17940 var map = urlSafe ? this._safe_map : this._map; 17941 var reverseMap = this._reverseMap; 17942 17943 if (!reverseMap) { 17944 reverseMap = this._reverseMap = []; 17945 for (var j = 0; j < map.length; j++) { 17946 reverseMap[map.charCodeAt(j)] = j; 17947 } 17948 } 17949 17950 // Ignore padding 17951 var paddingChar = map.charAt(64); 17952 if (paddingChar) { 17953 var paddingIndex = base64Str.indexOf(paddingChar); 17954 if (paddingIndex !== -1) { 17955 base64StrLength = paddingIndex; 17956 } 17957 } 17958 17959 // Convert 17960 return parseLoop(base64Str, base64StrLength, reverseMap); 17961 17962 }, 17963 17964 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', 17965 _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', 17966 }; 17967 17968 function parseLoop(base64Str, base64StrLength, reverseMap) { 17969 var words = []; 17970 var nBytes = 0; 17971 for (var i = 0; i < base64StrLength; i++) { 17972 if (i % 4) { 17973 var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); 17974 var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); 17975 var bitsCombined = bits1 | bits2; 17976 words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); 17977 nBytes++; 17978 } 17979 } 17980 return WordArray.create(words, nBytes); 17981 } 17982 }()); 17983 17984 17985 (function (Math) { 17986 // Shortcuts 17987 var C = CryptoJS; 17988 var C_lib = C.lib; 17989 var WordArray = C_lib.WordArray; 17990 var Hasher = C_lib.Hasher; 17991 var C_algo = C.algo; 17992 17993 // Constants table 17994 var T = []; 17995 17996 // Compute constants 17997 (function () { 17998 for (var i = 0; i < 64; i++) { 17999 T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; 18000 } 18001 }()); 18002 18003 /** 18004 * MD5 hash algorithm. 18005 */ 18006 var MD5 = C_algo.MD5 = Hasher.extend({ 18007 _doReset: function () { 18008 this._hash = new WordArray.init([ 18009 0x67452301, 0xefcdab89, 18010 0x98badcfe, 0x10325476 18011 ]); 18012 }, 18013 18014 _doProcessBlock: function (M, offset) { 18015 // Swap endian 18016 for (var i = 0; i < 16; i++) { 18017 // Shortcuts 18018 var offset_i = offset + i; 18019 var M_offset_i = M[offset_i]; 18020 18021 M[offset_i] = ( 18022 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | 18023 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) 18024 ); 18025 } 18026 18027 // Shortcuts 18028 var H = this._hash.words; 18029 18030 var M_offset_0 = M[offset + 0]; 18031 var M_offset_1 = M[offset + 1]; 18032 var M_offset_2 = M[offset + 2]; 18033 var M_offset_3 = M[offset + 3]; 18034 var M_offset_4 = M[offset + 4]; 18035 var M_offset_5 = M[offset + 5]; 18036 var M_offset_6 = M[offset + 6]; 18037 var M_offset_7 = M[offset + 7]; 18038 var M_offset_8 = M[offset + 8]; 18039 var M_offset_9 = M[offset + 9]; 18040 var M_offset_10 = M[offset + 10]; 18041 var M_offset_11 = M[offset + 11]; 18042 var M_offset_12 = M[offset + 12]; 18043 var M_offset_13 = M[offset + 13]; 18044 var M_offset_14 = M[offset + 14]; 18045 var M_offset_15 = M[offset + 15]; 18046 18047 // Working variables 18048 var a = H[0]; 18049 var b = H[1]; 18050 var c = H[2]; 18051 var d = H[3]; 18052 18053 // Computation 18054 a = FF(a, b, c, d, M_offset_0, 7, T[0]); 18055 d = FF(d, a, b, c, M_offset_1, 12, T[1]); 18056 c = FF(c, d, a, b, M_offset_2, 17, T[2]); 18057 b = FF(b, c, d, a, M_offset_3, 22, T[3]); 18058 a = FF(a, b, c, d, M_offset_4, 7, T[4]); 18059 d = FF(d, a, b, c, M_offset_5, 12, T[5]); 18060 c = FF(c, d, a, b, M_offset_6, 17, T[6]); 18061 b = FF(b, c, d, a, M_offset_7, 22, T[7]); 18062 a = FF(a, b, c, d, M_offset_8, 7, T[8]); 18063 d = FF(d, a, b, c, M_offset_9, 12, T[9]); 18064 c = FF(c, d, a, b, M_offset_10, 17, T[10]); 18065 b = FF(b, c, d, a, M_offset_11, 22, T[11]); 18066 a = FF(a, b, c, d, M_offset_12, 7, T[12]); 18067 d = FF(d, a, b, c, M_offset_13, 12, T[13]); 18068 c = FF(c, d, a, b, M_offset_14, 17, T[14]); 18069 b = FF(b, c, d, a, M_offset_15, 22, T[15]); 18070 18071 a = GG(a, b, c, d, M_offset_1, 5, T[16]); 18072 d = GG(d, a, b, c, M_offset_6, 9, T[17]); 18073 c = GG(c, d, a, b, M_offset_11, 14, T[18]); 18074 b = GG(b, c, d, a, M_offset_0, 20, T[19]); 18075 a = GG(a, b, c, d, M_offset_5, 5, T[20]); 18076 d = GG(d, a, b, c, M_offset_10, 9, T[21]); 18077 c = GG(c, d, a, b, M_offset_15, 14, T[22]); 18078 b = GG(b, c, d, a, M_offset_4, 20, T[23]); 18079 a = GG(a, b, c, d, M_offset_9, 5, T[24]); 18080 d = GG(d, a, b, c, M_offset_14, 9, T[25]); 18081 c = GG(c, d, a, b, M_offset_3, 14, T[26]); 18082 b = GG(b, c, d, a, M_offset_8, 20, T[27]); 18083 a = GG(a, b, c, d, M_offset_13, 5, T[28]); 18084 d = GG(d, a, b, c, M_offset_2, 9, T[29]); 18085 c = GG(c, d, a, b, M_offset_7, 14, T[30]); 18086 b = GG(b, c, d, a, M_offset_12, 20, T[31]); 18087 18088 a = HH(a, b, c, d, M_offset_5, 4, T[32]); 18089 d = HH(d, a, b, c, M_offset_8, 11, T[33]); 18090 c = HH(c, d, a, b, M_offset_11, 16, T[34]); 18091 b = HH(b, c, d, a, M_offset_14, 23, T[35]); 18092 a = HH(a, b, c, d, M_offset_1, 4, T[36]); 18093 d = HH(d, a, b, c, M_offset_4, 11, T[37]); 18094 c = HH(c, d, a, b, M_offset_7, 16, T[38]); 18095 b = HH(b, c, d, a, M_offset_10, 23, T[39]); 18096 a = HH(a, b, c, d, M_offset_13, 4, T[40]); 18097 d = HH(d, a, b, c, M_offset_0, 11, T[41]); 18098 c = HH(c, d, a, b, M_offset_3, 16, T[42]); 18099 b = HH(b, c, d, a, M_offset_6, 23, T[43]); 18100 a = HH(a, b, c, d, M_offset_9, 4, T[44]); 18101 d = HH(d, a, b, c, M_offset_12, 11, T[45]); 18102 c = HH(c, d, a, b, M_offset_15, 16, T[46]); 18103 b = HH(b, c, d, a, M_offset_2, 23, T[47]); 18104 18105 a = II(a, b, c, d, M_offset_0, 6, T[48]); 18106 d = II(d, a, b, c, M_offset_7, 10, T[49]); 18107 c = II(c, d, a, b, M_offset_14, 15, T[50]); 18108 b = II(b, c, d, a, M_offset_5, 21, T[51]); 18109 a = II(a, b, c, d, M_offset_12, 6, T[52]); 18110 d = II(d, a, b, c, M_offset_3, 10, T[53]); 18111 c = II(c, d, a, b, M_offset_10, 15, T[54]); 18112 b = II(b, c, d, a, M_offset_1, 21, T[55]); 18113 a = II(a, b, c, d, M_offset_8, 6, T[56]); 18114 d = II(d, a, b, c, M_offset_15, 10, T[57]); 18115 c = II(c, d, a, b, M_offset_6, 15, T[58]); 18116 b = II(b, c, d, a, M_offset_13, 21, T[59]); 18117 a = II(a, b, c, d, M_offset_4, 6, T[60]); 18118 d = II(d, a, b, c, M_offset_11, 10, T[61]); 18119 c = II(c, d, a, b, M_offset_2, 15, T[62]); 18120 b = II(b, c, d, a, M_offset_9, 21, T[63]); 18121 18122 // Intermediate hash value 18123 H[0] = (H[0] + a) | 0; 18124 H[1] = (H[1] + b) | 0; 18125 H[2] = (H[2] + c) | 0; 18126 H[3] = (H[3] + d) | 0; 18127 }, 18128 18129 _doFinalize: function () { 18130 // Shortcuts 18131 var data = this._data; 18132 var dataWords = data.words; 18133 18134 var nBitsTotal = this._nDataBytes * 8; 18135 var nBitsLeft = data.sigBytes * 8; 18136 18137 // Add padding 18138 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 18139 18140 var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); 18141 var nBitsTotalL = nBitsTotal; 18142 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( 18143 (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | 18144 (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) 18145 ); 18146 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( 18147 (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | 18148 (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) 18149 ); 18150 18151 data.sigBytes = (dataWords.length + 1) * 4; 18152 18153 // Hash final blocks 18154 this._process(); 18155 18156 // Shortcuts 18157 var hash = this._hash; 18158 var H = hash.words; 18159 18160 // Swap endian 18161 for (var i = 0; i < 4; i++) { 18162 // Shortcut 18163 var H_i = H[i]; 18164 18165 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | 18166 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); 18167 } 18168 18169 // Return final computed hash 18170 return hash; 18171 }, 18172 18173 clone: function () { 18174 var clone = Hasher.clone.call(this); 18175 clone._hash = this._hash.clone(); 18176 18177 return clone; 18178 } 18179 }); 18180 18181 function FF(a, b, c, d, x, s, t) { 18182 var n = a + ((b & c) | (~b & d)) + x + t; 18183 return ((n << s) | (n >>> (32 - s))) + b; 18184 } 18185 18186 function GG(a, b, c, d, x, s, t) { 18187 var n = a + ((b & d) | (c & ~d)) + x + t; 18188 return ((n << s) | (n >>> (32 - s))) + b; 18189 } 18190 18191 function HH(a, b, c, d, x, s, t) { 18192 var n = a + (b ^ c ^ d) + x + t; 18193 return ((n << s) | (n >>> (32 - s))) + b; 18194 } 18195 18196 function II(a, b, c, d, x, s, t) { 18197 var n = a + (c ^ (b | ~d)) + x + t; 18198 return ((n << s) | (n >>> (32 - s))) + b; 18199 } 18200 18201 /** 18202 * Shortcut function to the hasher's object interface. 18203 * 18204 * @param {WordArray|string} message The message to hash. 18205 * 18206 * @return {WordArray} The hash. 18207 * 18208 * @static 18209 * 18210 * @example 18211 * 18212 * var hash = CryptoJS.MD5('message'); 18213 * var hash = CryptoJS.MD5(wordArray); 18214 */ 18215 C.MD5 = Hasher._createHelper(MD5); 18216 18217 /** 18218 * Shortcut function to the HMAC's object interface. 18219 * 18220 * @param {WordArray|string} message The message to hash. 18221 * @param {WordArray|string} key The secret key. 18222 * 18223 * @return {WordArray} The HMAC. 18224 * 18225 * @static 18226 * 18227 * @example 18228 * 18229 * var hmac = CryptoJS.HmacMD5(message, key); 18230 */ 18231 C.HmacMD5 = Hasher._createHmacHelper(MD5); 18232 }(Math)); 18233 18234 18235 (function () { 18236 // Shortcuts 18237 var C = CryptoJS; 18238 var C_lib = C.lib; 18239 var WordArray = C_lib.WordArray; 18240 var Hasher = C_lib.Hasher; 18241 var C_algo = C.algo; 18242 18243 // Reusable object 18244 var W = []; 18245 18246 /** 18247 * SHA-1 hash algorithm. 18248 */ 18249 var SHA1 = C_algo.SHA1 = Hasher.extend({ 18250 _doReset: function () { 18251 this._hash = new WordArray.init([ 18252 0x67452301, 0xefcdab89, 18253 0x98badcfe, 0x10325476, 18254 0xc3d2e1f0 18255 ]); 18256 }, 18257 18258 _doProcessBlock: function (M, offset) { 18259 // Shortcut 18260 var H = this._hash.words; 18261 18262 // Working variables 18263 var a = H[0]; 18264 var b = H[1]; 18265 var c = H[2]; 18266 var d = H[3]; 18267 var e = H[4]; 18268 18269 // Computation 18270 for (var i = 0; i < 80; i++) { 18271 if (i < 16) { 18272 W[i] = M[offset + i] | 0; 18273 } else { 18274 var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; 18275 W[i] = (n << 1) | (n >>> 31); 18276 } 18277 18278 var t = ((a << 5) | (a >>> 27)) + e + W[i]; 18279 if (i < 20) { 18280 t += ((b & c) | (~b & d)) + 0x5a827999; 18281 } else if (i < 40) { 18282 t += (b ^ c ^ d) + 0x6ed9eba1; 18283 } else if (i < 60) { 18284 t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; 18285 } else /* if (i < 80) */ { 18286 t += (b ^ c ^ d) - 0x359d3e2a; 18287 } 18288 18289 e = d; 18290 d = c; 18291 c = (b << 30) | (b >>> 2); 18292 b = a; 18293 a = t; 18294 } 18295 18296 // Intermediate hash value 18297 H[0] = (H[0] + a) | 0; 18298 H[1] = (H[1] + b) | 0; 18299 H[2] = (H[2] + c) | 0; 18300 H[3] = (H[3] + d) | 0; 18301 H[4] = (H[4] + e) | 0; 18302 }, 18303 18304 _doFinalize: function () { 18305 // Shortcuts 18306 var data = this._data; 18307 var dataWords = data.words; 18308 18309 var nBitsTotal = this._nDataBytes * 8; 18310 var nBitsLeft = data.sigBytes * 8; 18311 18312 // Add padding 18313 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 18314 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); 18315 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; 18316 data.sigBytes = dataWords.length * 4; 18317 18318 // Hash final blocks 18319 this._process(); 18320 18321 // Return final computed hash 18322 return this._hash; 18323 }, 18324 18325 clone: function () { 18326 var clone = Hasher.clone.call(this); 18327 clone._hash = this._hash.clone(); 18328 18329 return clone; 18330 } 18331 }); 18332 18333 /** 18334 * Shortcut function to the hasher's object interface. 18335 * 18336 * @param {WordArray|string} message The message to hash. 18337 * 18338 * @return {WordArray} The hash. 18339 * 18340 * @static 18341 * 18342 * @example 18343 * 18344 * var hash = CryptoJS.SHA1('message'); 18345 * var hash = CryptoJS.SHA1(wordArray); 18346 */ 18347 C.SHA1 = Hasher._createHelper(SHA1); 18348 18349 /** 18350 * Shortcut function to the HMAC's object interface. 18351 * 18352 * @param {WordArray|string} message The message to hash. 18353 * @param {WordArray|string} key The secret key. 18354 * 18355 * @return {WordArray} The HMAC. 18356 * 18357 * @static 18358 * 18359 * @example 18360 * 18361 * var hmac = CryptoJS.HmacSHA1(message, key); 18362 */ 18363 C.HmacSHA1 = Hasher._createHmacHelper(SHA1); 18364 }()); 18365 18366 18367 (function (Math) { 18368 // Shortcuts 18369 var C = CryptoJS; 18370 var C_lib = C.lib; 18371 var WordArray = C_lib.WordArray; 18372 var Hasher = C_lib.Hasher; 18373 var C_algo = C.algo; 18374 18375 // Initialization and round constants tables 18376 var H = []; 18377 var K = []; 18378 18379 // Compute constants 18380 (function () { 18381 function isPrime(n) { 18382 var sqrtN = Math.sqrt(n); 18383 for (var factor = 2; factor <= sqrtN; factor++) { 18384 if (!(n % factor)) { 18385 return false; 18386 } 18387 } 18388 18389 return true; 18390 } 18391 18392 function getFractionalBits(n) { 18393 return ((n - (n | 0)) * 0x100000000) | 0; 18394 } 18395 18396 var n = 2; 18397 var nPrime = 0; 18398 while (nPrime < 64) { 18399 if (isPrime(n)) { 18400 if (nPrime < 8) { 18401 H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); 18402 } 18403 K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); 18404 18405 nPrime++; 18406 } 18407 18408 n++; 18409 } 18410 }()); 18411 18412 // Reusable object 18413 var W = []; 18414 18415 /** 18416 * SHA-256 hash algorithm. 18417 */ 18418 var SHA256 = C_algo.SHA256 = Hasher.extend({ 18419 _doReset: function () { 18420 this._hash = new WordArray.init(H.slice(0)); 18421 }, 18422 18423 _doProcessBlock: function (M, offset) { 18424 // Shortcut 18425 var H = this._hash.words; 18426 18427 // Working variables 18428 var a = H[0]; 18429 var b = H[1]; 18430 var c = H[2]; 18431 var d = H[3]; 18432 var e = H[4]; 18433 var f = H[5]; 18434 var g = H[6]; 18435 var h = H[7]; 18436 18437 // Computation 18438 for (var i = 0; i < 64; i++) { 18439 if (i < 16) { 18440 W[i] = M[offset + i] | 0; 18441 } else { 18442 var gamma0x = W[i - 15]; 18443 var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ 18444 ((gamma0x << 14) | (gamma0x >>> 18)) ^ 18445 (gamma0x >>> 3); 18446 18447 var gamma1x = W[i - 2]; 18448 var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ 18449 ((gamma1x << 13) | (gamma1x >>> 19)) ^ 18450 (gamma1x >>> 10); 18451 18452 W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; 18453 } 18454 18455 var ch = (e & f) ^ (~e & g); 18456 var maj = (a & b) ^ (a & c) ^ (b & c); 18457 18458 var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); 18459 var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); 18460 18461 var t1 = h + sigma1 + ch + K[i] + W[i]; 18462 var t2 = sigma0 + maj; 18463 18464 h = g; 18465 g = f; 18466 f = e; 18467 e = (d + t1) | 0; 18468 d = c; 18469 c = b; 18470 b = a; 18471 a = (t1 + t2) | 0; 18472 } 18473 18474 // Intermediate hash value 18475 H[0] = (H[0] + a) | 0; 18476 H[1] = (H[1] + b) | 0; 18477 H[2] = (H[2] + c) | 0; 18478 H[3] = (H[3] + d) | 0; 18479 H[4] = (H[4] + e) | 0; 18480 H[5] = (H[5] + f) | 0; 18481 H[6] = (H[6] + g) | 0; 18482 H[7] = (H[7] + h) | 0; 18483 }, 18484 18485 _doFinalize: function () { 18486 // Shortcuts 18487 var data = this._data; 18488 var dataWords = data.words; 18489 18490 var nBitsTotal = this._nDataBytes * 8; 18491 var nBitsLeft = data.sigBytes * 8; 18492 18493 // Add padding 18494 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 18495 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); 18496 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; 18497 data.sigBytes = dataWords.length * 4; 18498 18499 // Hash final blocks 18500 this._process(); 18501 18502 // Return final computed hash 18503 return this._hash; 18504 }, 18505 18506 clone: function () { 18507 var clone = Hasher.clone.call(this); 18508 clone._hash = this._hash.clone(); 18509 18510 return clone; 18511 } 18512 }); 18513 18514 /** 18515 * Shortcut function to the hasher's object interface. 18516 * 18517 * @param {WordArray|string} message The message to hash. 18518 * 18519 * @return {WordArray} The hash. 18520 * 18521 * @static 18522 * 18523 * @example 18524 * 18525 * var hash = CryptoJS.SHA256('message'); 18526 * var hash = CryptoJS.SHA256(wordArray); 18527 */ 18528 C.SHA256 = Hasher._createHelper(SHA256); 18529 18530 /** 18531 * Shortcut function to the HMAC's object interface. 18532 * 18533 * @param {WordArray|string} message The message to hash. 18534 * @param {WordArray|string} key The secret key. 18535 * 18536 * @return {WordArray} The HMAC. 18537 * 18538 * @static 18539 * 18540 * @example 18541 * 18542 * var hmac = CryptoJS.HmacSHA256(message, key); 18543 */ 18544 C.HmacSHA256 = Hasher._createHmacHelper(SHA256); 18545 }(Math)); 18546 18547 18548 (function () { 18549 // Shortcuts 18550 var C = CryptoJS; 18551 var C_lib = C.lib; 18552 var WordArray = C_lib.WordArray; 18553 var C_algo = C.algo; 18554 var SHA256 = C_algo.SHA256; 18555 18556 /** 18557 * SHA-224 hash algorithm. 18558 */ 18559 var SHA224 = C_algo.SHA224 = SHA256.extend({ 18560 _doReset: function () { 18561 this._hash = new WordArray.init([ 18562 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 18563 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 18564 ]); 18565 }, 18566 18567 _doFinalize: function () { 18568 var hash = SHA256._doFinalize.call(this); 18569 18570 hash.sigBytes -= 4; 18571 18572 return hash; 18573 } 18574 }); 18575 18576 /** 18577 * Shortcut function to the hasher's object interface. 18578 * 18579 * @param {WordArray|string} message The message to hash. 18580 * 18581 * @return {WordArray} The hash. 18582 * 18583 * @static 18584 * 18585 * @example 18586 * 18587 * var hash = CryptoJS.SHA224('message'); 18588 * var hash = CryptoJS.SHA224(wordArray); 18589 */ 18590 C.SHA224 = SHA256._createHelper(SHA224); 18591 18592 /** 18593 * Shortcut function to the HMAC's object interface. 18594 * 18595 * @param {WordArray|string} message The message to hash. 18596 * @param {WordArray|string} key The secret key. 18597 * 18598 * @return {WordArray} The HMAC. 18599 * 18600 * @static 18601 * 18602 * @example 18603 * 18604 * var hmac = CryptoJS.HmacSHA224(message, key); 18605 */ 18606 C.HmacSHA224 = SHA256._createHmacHelper(SHA224); 18607 }()); 18608 18609 18610 (function () { 18611 // Shortcuts 18612 var C = CryptoJS; 18613 var C_lib = C.lib; 18614 var Hasher = C_lib.Hasher; 18615 var C_x64 = C.x64; 18616 var X64Word = C_x64.Word; 18617 var X64WordArray = C_x64.WordArray; 18618 var C_algo = C.algo; 18619 18620 function X64Word_create() { 18621 return X64Word.create.apply(X64Word, arguments); 18622 } 18623 18624 // Constants 18625 var K = [ 18626 X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), 18627 X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), 18628 X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), 18629 X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), 18630 X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), 18631 X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), 18632 X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), 18633 X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), 18634 X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), 18635 X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), 18636 X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), 18637 X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), 18638 X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), 18639 X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), 18640 X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), 18641 X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), 18642 X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), 18643 X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), 18644 X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), 18645 X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), 18646 X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), 18647 X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), 18648 X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), 18649 X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), 18650 X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), 18651 X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), 18652 X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), 18653 X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), 18654 X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), 18655 X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), 18656 X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), 18657 X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), 18658 X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), 18659 X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), 18660 X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), 18661 X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), 18662 X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), 18663 X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), 18664 X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), 18665 X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) 18666 ]; 18667 18668 // Reusable objects 18669 var W = []; 18670 (function () { 18671 for (var i = 0; i < 80; i++) { 18672 W[i] = X64Word_create(); 18673 } 18674 }()); 18675 18676 /** 18677 * SHA-512 hash algorithm. 18678 */ 18679 var SHA512 = C_algo.SHA512 = Hasher.extend({ 18680 _doReset: function () { 18681 this._hash = new X64WordArray.init([ 18682 new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), 18683 new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), 18684 new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), 18685 new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) 18686 ]); 18687 }, 18688 18689 _doProcessBlock: function (M, offset) { 18690 // Shortcuts 18691 var H = this._hash.words; 18692 18693 var H0 = H[0]; 18694 var H1 = H[1]; 18695 var H2 = H[2]; 18696 var H3 = H[3]; 18697 var H4 = H[4]; 18698 var H5 = H[5]; 18699 var H6 = H[6]; 18700 var H7 = H[7]; 18701 18702 var H0h = H0.high; 18703 var H0l = H0.low; 18704 var H1h = H1.high; 18705 var H1l = H1.low; 18706 var H2h = H2.high; 18707 var H2l = H2.low; 18708 var H3h = H3.high; 18709 var H3l = H3.low; 18710 var H4h = H4.high; 18711 var H4l = H4.low; 18712 var H5h = H5.high; 18713 var H5l = H5.low; 18714 var H6h = H6.high; 18715 var H6l = H6.low; 18716 var H7h = H7.high; 18717 var H7l = H7.low; 18718 18719 // Working variables 18720 var ah = H0h; 18721 var al = H0l; 18722 var bh = H1h; 18723 var bl = H1l; 18724 var ch = H2h; 18725 var cl = H2l; 18726 var dh = H3h; 18727 var dl = H3l; 18728 var eh = H4h; 18729 var el = H4l; 18730 var fh = H5h; 18731 var fl = H5l; 18732 var gh = H6h; 18733 var gl = H6l; 18734 var hh = H7h; 18735 var hl = H7l; 18736 18737 // Rounds 18738 for (var i = 0; i < 80; i++) { 18739 var Wil; 18740 var Wih; 18741 18742 // Shortcut 18743 var Wi = W[i]; 18744 18745 // Extend message 18746 if (i < 16) { 18747 Wih = Wi.high = M[offset + i * 2] | 0; 18748 Wil = Wi.low = M[offset + i * 2 + 1] | 0; 18749 } else { 18750 // Gamma0 18751 var gamma0x = W[i - 15]; 18752 var gamma0xh = gamma0x.high; 18753 var gamma0xl = gamma0x.low; 18754 var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); 18755 var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); 18756 18757 // Gamma1 18758 var gamma1x = W[i - 2]; 18759 var gamma1xh = gamma1x.high; 18760 var gamma1xl = gamma1x.low; 18761 var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); 18762 var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); 18763 18764 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] 18765 var Wi7 = W[i - 7]; 18766 var Wi7h = Wi7.high; 18767 var Wi7l = Wi7.low; 18768 18769 var Wi16 = W[i - 16]; 18770 var Wi16h = Wi16.high; 18771 var Wi16l = Wi16.low; 18772 18773 Wil = gamma0l + Wi7l; 18774 Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); 18775 Wil = Wil + gamma1l; 18776 Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); 18777 Wil = Wil + Wi16l; 18778 Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); 18779 18780 Wi.high = Wih; 18781 Wi.low = Wil; 18782 } 18783 18784 var chh = (eh & fh) ^ (~eh & gh); 18785 var chl = (el & fl) ^ (~el & gl); 18786 var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); 18787 var majl = (al & bl) ^ (al & cl) ^ (bl & cl); 18788 18789 var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); 18790 var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); 18791 var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); 18792 var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); 18793 18794 // t1 = h + sigma1 + ch + K[i] + W[i] 18795 var Ki = K[i]; 18796 var Kih = Ki.high; 18797 var Kil = Ki.low; 18798 18799 var t1l = hl + sigma1l; 18800 var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); 18801 var t1l = t1l + chl; 18802 var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); 18803 var t1l = t1l + Kil; 18804 var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); 18805 var t1l = t1l + Wil; 18806 var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); 18807 18808 // t2 = sigma0 + maj 18809 var t2l = sigma0l + majl; 18810 var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); 18811 18812 // Update working variables 18813 hh = gh; 18814 hl = gl; 18815 gh = fh; 18816 gl = fl; 18817 fh = eh; 18818 fl = el; 18819 el = (dl + t1l) | 0; 18820 eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; 18821 dh = ch; 18822 dl = cl; 18823 ch = bh; 18824 cl = bl; 18825 bh = ah; 18826 bl = al; 18827 al = (t1l + t2l) | 0; 18828 ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; 18829 } 18830 18831 // Intermediate hash value 18832 H0l = H0.low = (H0l + al); 18833 H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); 18834 H1l = H1.low = (H1l + bl); 18835 H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); 18836 H2l = H2.low = (H2l + cl); 18837 H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); 18838 H3l = H3.low = (H3l + dl); 18839 H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); 18840 H4l = H4.low = (H4l + el); 18841 H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); 18842 H5l = H5.low = (H5l + fl); 18843 H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); 18844 H6l = H6.low = (H6l + gl); 18845 H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); 18846 H7l = H7.low = (H7l + hl); 18847 H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); 18848 }, 18849 18850 _doFinalize: function () { 18851 // Shortcuts 18852 var data = this._data; 18853 var dataWords = data.words; 18854 18855 var nBitsTotal = this._nDataBytes * 8; 18856 var nBitsLeft = data.sigBytes * 8; 18857 18858 // Add padding 18859 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 18860 dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); 18861 dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; 18862 data.sigBytes = dataWords.length * 4; 18863 18864 // Hash final blocks 18865 this._process(); 18866 18867 // Convert hash to 32-bit word array before returning 18868 var hash = this._hash.toX32(); 18869 18870 // Return final computed hash 18871 return hash; 18872 }, 18873 18874 clone: function () { 18875 var clone = Hasher.clone.call(this); 18876 clone._hash = this._hash.clone(); 18877 18878 return clone; 18879 }, 18880 18881 blockSize: 1024/32 18882 }); 18883 18884 /** 18885 * Shortcut function to the hasher's object interface. 18886 * 18887 * @param {WordArray|string} message The message to hash. 18888 * 18889 * @return {WordArray} The hash. 18890 * 18891 * @static 18892 * 18893 * @example 18894 * 18895 * var hash = CryptoJS.SHA512('message'); 18896 * var hash = CryptoJS.SHA512(wordArray); 18897 */ 18898 C.SHA512 = Hasher._createHelper(SHA512); 18899 18900 /** 18901 * Shortcut function to the HMAC's object interface. 18902 * 18903 * @param {WordArray|string} message The message to hash. 18904 * @param {WordArray|string} key The secret key. 18905 * 18906 * @return {WordArray} The HMAC. 18907 * 18908 * @static 18909 * 18910 * @example 18911 * 18912 * var hmac = CryptoJS.HmacSHA512(message, key); 18913 */ 18914 C.HmacSHA512 = Hasher._createHmacHelper(SHA512); 18915 }()); 18916 18917 18918 (function () { 18919 // Shortcuts 18920 var C = CryptoJS; 18921 var C_x64 = C.x64; 18922 var X64Word = C_x64.Word; 18923 var X64WordArray = C_x64.WordArray; 18924 var C_algo = C.algo; 18925 var SHA512 = C_algo.SHA512; 18926 18927 /** 18928 * SHA-384 hash algorithm. 18929 */ 18930 var SHA384 = C_algo.SHA384 = SHA512.extend({ 18931 _doReset: function () { 18932 this._hash = new X64WordArray.init([ 18933 new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), 18934 new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), 18935 new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), 18936 new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) 18937 ]); 18938 }, 18939 18940 _doFinalize: function () { 18941 var hash = SHA512._doFinalize.call(this); 18942 18943 hash.sigBytes -= 16; 18944 18945 return hash; 18946 } 18947 }); 18948 18949 /** 18950 * Shortcut function to the hasher's object interface. 18951 * 18952 * @param {WordArray|string} message The message to hash. 18953 * 18954 * @return {WordArray} The hash. 18955 * 18956 * @static 18957 * 18958 * @example 18959 * 18960 * var hash = CryptoJS.SHA384('message'); 18961 * var hash = CryptoJS.SHA384(wordArray); 18962 */ 18963 C.SHA384 = SHA512._createHelper(SHA384); 18964 18965 /** 18966 * Shortcut function to the HMAC's object interface. 18967 * 18968 * @param {WordArray|string} message The message to hash. 18969 * @param {WordArray|string} key The secret key. 18970 * 18971 * @return {WordArray} The HMAC. 18972 * 18973 * @static 18974 * 18975 * @example 18976 * 18977 * var hmac = CryptoJS.HmacSHA384(message, key); 18978 */ 18979 C.HmacSHA384 = SHA512._createHmacHelper(SHA384); 18980 }()); 18981 18982 18983 (function (Math) { 18984 // Shortcuts 18985 var C = CryptoJS; 18986 var C_lib = C.lib; 18987 var WordArray = C_lib.WordArray; 18988 var Hasher = C_lib.Hasher; 18989 var C_x64 = C.x64; 18990 var X64Word = C_x64.Word; 18991 var C_algo = C.algo; 18992 18993 // Constants tables 18994 var RHO_OFFSETS = []; 18995 var PI_INDEXES = []; 18996 var ROUND_CONSTANTS = []; 18997 18998 // Compute Constants 18999 (function () { 19000 // Compute rho offset constants 19001 var x = 1, y = 0; 19002 for (var t = 0; t < 24; t++) { 19003 RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; 19004 19005 var newX = y % 5; 19006 var newY = (2 * x + 3 * y) % 5; 19007 x = newX; 19008 y = newY; 19009 } 19010 19011 // Compute pi index constants 19012 for (var x = 0; x < 5; x++) { 19013 for (var y = 0; y < 5; y++) { 19014 PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; 19015 } 19016 } 19017 19018 // Compute round constants 19019 var LFSR = 0x01; 19020 for (var i = 0; i < 24; i++) { 19021 var roundConstantMsw = 0; 19022 var roundConstantLsw = 0; 19023 19024 for (var j = 0; j < 7; j++) { 19025 if (LFSR & 0x01) { 19026 var bitPosition = (1 << j) - 1; 19027 if (bitPosition < 32) { 19028 roundConstantLsw ^= 1 << bitPosition; 19029 } else /* if (bitPosition >= 32) */ { 19030 roundConstantMsw ^= 1 << (bitPosition - 32); 19031 } 19032 } 19033 19034 // Compute next LFSR 19035 if (LFSR & 0x80) { 19036 // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 19037 LFSR = (LFSR << 1) ^ 0x71; 19038 } else { 19039 LFSR <<= 1; 19040 } 19041 } 19042 19043 ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); 19044 } 19045 }()); 19046 19047 // Reusable objects for temporary values 19048 var T = []; 19049 (function () { 19050 for (var i = 0; i < 25; i++) { 19051 T[i] = X64Word.create(); 19052 } 19053 }()); 19054 19055 /** 19056 * SHA-3 hash algorithm. 19057 */ 19058 var SHA3 = C_algo.SHA3 = Hasher.extend({ 19059 /** 19060 * Configuration options. 19061 * 19062 * @property {number} outputLength 19063 * The desired number of bits in the output hash. 19064 * Only values permitted are: 224, 256, 384, 512. 19065 * Default: 512 19066 */ 19067 cfg: Hasher.cfg.extend({ 19068 outputLength: 512 19069 }), 19070 19071 _doReset: function () { 19072 var state = this._state = [] 19073 for (var i = 0; i < 25; i++) { 19074 state[i] = new X64Word.init(); 19075 } 19076 19077 this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; 19078 }, 19079 19080 _doProcessBlock: function (M, offset) { 19081 // Shortcuts 19082 var state = this._state; 19083 var nBlockSizeLanes = this.blockSize / 2; 19084 19085 // Absorb 19086 for (var i = 0; i < nBlockSizeLanes; i++) { 19087 // Shortcuts 19088 var M2i = M[offset + 2 * i]; 19089 var M2i1 = M[offset + 2 * i + 1]; 19090 19091 // Swap endian 19092 M2i = ( 19093 (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | 19094 (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) 19095 ); 19096 M2i1 = ( 19097 (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | 19098 (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) 19099 ); 19100 19101 // Absorb message into state 19102 var lane = state[i]; 19103 lane.high ^= M2i1; 19104 lane.low ^= M2i; 19105 } 19106 19107 // Rounds 19108 for (var round = 0; round < 24; round++) { 19109 // Theta 19110 for (var x = 0; x < 5; x++) { 19111 // Mix column lanes 19112 var tMsw = 0, tLsw = 0; 19113 for (var y = 0; y < 5; y++) { 19114 var lane = state[x + 5 * y]; 19115 tMsw ^= lane.high; 19116 tLsw ^= lane.low; 19117 } 19118 19119 // Temporary values 19120 var Tx = T[x]; 19121 Tx.high = tMsw; 19122 Tx.low = tLsw; 19123 } 19124 for (var x = 0; x < 5; x++) { 19125 // Shortcuts 19126 var Tx4 = T[(x + 4) % 5]; 19127 var Tx1 = T[(x + 1) % 5]; 19128 var Tx1Msw = Tx1.high; 19129 var Tx1Lsw = Tx1.low; 19130 19131 // Mix surrounding columns 19132 var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); 19133 var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); 19134 for (var y = 0; y < 5; y++) { 19135 var lane = state[x + 5 * y]; 19136 lane.high ^= tMsw; 19137 lane.low ^= tLsw; 19138 } 19139 } 19140 19141 // Rho Pi 19142 for (var laneIndex = 1; laneIndex < 25; laneIndex++) { 19143 var tMsw; 19144 var tLsw; 19145 19146 // Shortcuts 19147 var lane = state[laneIndex]; 19148 var laneMsw = lane.high; 19149 var laneLsw = lane.low; 19150 var rhoOffset = RHO_OFFSETS[laneIndex]; 19151 19152 // Rotate lanes 19153 if (rhoOffset < 32) { 19154 tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); 19155 tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); 19156 } else /* if (rhoOffset >= 32) */ { 19157 tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); 19158 tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); 19159 } 19160 19161 // Transpose lanes 19162 var TPiLane = T[PI_INDEXES[laneIndex]]; 19163 TPiLane.high = tMsw; 19164 TPiLane.low = tLsw; 19165 } 19166 19167 // Rho pi at x = y = 0 19168 var T0 = T[0]; 19169 var state0 = state[0]; 19170 T0.high = state0.high; 19171 T0.low = state0.low; 19172 19173 // Chi 19174 for (var x = 0; x < 5; x++) { 19175 for (var y = 0; y < 5; y++) { 19176 // Shortcuts 19177 var laneIndex = x + 5 * y; 19178 var lane = state[laneIndex]; 19179 var TLane = T[laneIndex]; 19180 var Tx1Lane = T[((x + 1) % 5) + 5 * y]; 19181 var Tx2Lane = T[((x + 2) % 5) + 5 * y]; 19182 19183 // Mix rows 19184 lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); 19185 lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); 19186 } 19187 } 19188 19189 // Iota 19190 var lane = state[0]; 19191 var roundConstant = ROUND_CONSTANTS[round]; 19192 lane.high ^= roundConstant.high; 19193 lane.low ^= roundConstant.low; 19194 } 19195 }, 19196 19197 _doFinalize: function () { 19198 // Shortcuts 19199 var data = this._data; 19200 var dataWords = data.words; 19201 var nBitsTotal = this._nDataBytes * 8; 19202 var nBitsLeft = data.sigBytes * 8; 19203 var blockSizeBits = this.blockSize * 32; 19204 19205 // Add padding 19206 dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); 19207 dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; 19208 data.sigBytes = dataWords.length * 4; 19209 19210 // Hash final blocks 19211 this._process(); 19212 19213 // Shortcuts 19214 var state = this._state; 19215 var outputLengthBytes = this.cfg.outputLength / 8; 19216 var outputLengthLanes = outputLengthBytes / 8; 19217 19218 // Squeeze 19219 var hashWords = []; 19220 for (var i = 0; i < outputLengthLanes; i++) { 19221 // Shortcuts 19222 var lane = state[i]; 19223 var laneMsw = lane.high; 19224 var laneLsw = lane.low; 19225 19226 // Swap endian 19227 laneMsw = ( 19228 (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | 19229 (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) 19230 ); 19231 laneLsw = ( 19232 (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | 19233 (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) 19234 ); 19235 19236 // Squeeze state to retrieve hash 19237 hashWords.push(laneLsw); 19238 hashWords.push(laneMsw); 19239 } 19240 19241 // Return final computed hash 19242 return new WordArray.init(hashWords, outputLengthBytes); 19243 }, 19244 19245 clone: function () { 19246 var clone = Hasher.clone.call(this); 19247 19248 var state = clone._state = this._state.slice(0); 19249 for (var i = 0; i < 25; i++) { 19250 state[i] = state[i].clone(); 19251 } 19252 19253 return clone; 19254 } 19255 }); 19256 19257 /** 19258 * Shortcut function to the hasher's object interface. 19259 * 19260 * @param {WordArray|string} message The message to hash. 19261 * 19262 * @return {WordArray} The hash. 19263 * 19264 * @static 19265 * 19266 * @example 19267 * 19268 * var hash = CryptoJS.SHA3('message'); 19269 * var hash = CryptoJS.SHA3(wordArray); 19270 */ 19271 C.SHA3 = Hasher._createHelper(SHA3); 19272 19273 /** 19274 * Shortcut function to the HMAC's object interface. 19275 * 19276 * @param {WordArray|string} message The message to hash. 19277 * @param {WordArray|string} key The secret key. 19278 * 19279 * @return {WordArray} The HMAC. 19280 * 19281 * @static 19282 * 19283 * @example 19284 * 19285 * var hmac = CryptoJS.HmacSHA3(message, key); 19286 */ 19287 C.HmacSHA3 = Hasher._createHmacHelper(SHA3); 19288 }(Math)); 19289 19290 19291 /** @preserve 19292 (c) 2012 by Cédric Mesnil. All rights reserved. 19293 19294 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 19295 19296 - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 19297 - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 19298 19299 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19300 */ 19301 19302 (function (Math) { 19303 // Shortcuts 19304 var C = CryptoJS; 19305 var C_lib = C.lib; 19306 var WordArray = C_lib.WordArray; 19307 var Hasher = C_lib.Hasher; 19308 var C_algo = C.algo; 19309 19310 // Constants table 19311 var _zl = WordArray.create([ 19312 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 19313 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 19314 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 19315 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 19316 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); 19317 var _zr = WordArray.create([ 19318 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 19319 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 19320 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 19321 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 19322 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); 19323 var _sl = WordArray.create([ 19324 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 19325 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 19326 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 19327 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 19328 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); 19329 var _sr = WordArray.create([ 19330 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 19331 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 19332 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 19333 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 19334 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); 19335 19336 var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); 19337 var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); 19338 19339 /** 19340 * RIPEMD160 hash algorithm. 19341 */ 19342 var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ 19343 _doReset: function () { 19344 this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); 19345 }, 19346 19347 _doProcessBlock: function (M, offset) { 19348 19349 // Swap endian 19350 for (var i = 0; i < 16; i++) { 19351 // Shortcuts 19352 var offset_i = offset + i; 19353 var M_offset_i = M[offset_i]; 19354 19355 // Swap 19356 M[offset_i] = ( 19357 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | 19358 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) 19359 ); 19360 } 19361 // Shortcut 19362 var H = this._hash.words; 19363 var hl = _hl.words; 19364 var hr = _hr.words; 19365 var zl = _zl.words; 19366 var zr = _zr.words; 19367 var sl = _sl.words; 19368 var sr = _sr.words; 19369 19370 // Working variables 19371 var al, bl, cl, dl, el; 19372 var ar, br, cr, dr, er; 19373 19374 ar = al = H[0]; 19375 br = bl = H[1]; 19376 cr = cl = H[2]; 19377 dr = dl = H[3]; 19378 er = el = H[4]; 19379 // Computation 19380 var t; 19381 for (var i = 0; i < 80; i += 1) { 19382 t = (al + M[offset+zl[i]])|0; 19383 if (i<16){ 19384 t += f1(bl,cl,dl) + hl[0]; 19385 } else if (i<32) { 19386 t += f2(bl,cl,dl) + hl[1]; 19387 } else if (i<48) { 19388 t += f3(bl,cl,dl) + hl[2]; 19389 } else if (i<64) { 19390 t += f4(bl,cl,dl) + hl[3]; 19391 } else {// if (i<80) { 19392 t += f5(bl,cl,dl) + hl[4]; 19393 } 19394 t = t|0; 19395 t = rotl(t,sl[i]); 19396 t = (t+el)|0; 19397 al = el; 19398 el = dl; 19399 dl = rotl(cl, 10); 19400 cl = bl; 19401 bl = t; 19402 19403 t = (ar + M[offset+zr[i]])|0; 19404 if (i<16){ 19405 t += f5(br,cr,dr) + hr[0]; 19406 } else if (i<32) { 19407 t += f4(br,cr,dr) + hr[1]; 19408 } else if (i<48) { 19409 t += f3(br,cr,dr) + hr[2]; 19410 } else if (i<64) { 19411 t += f2(br,cr,dr) + hr[3]; 19412 } else {// if (i<80) { 19413 t += f1(br,cr,dr) + hr[4]; 19414 } 19415 t = t|0; 19416 t = rotl(t,sr[i]) ; 19417 t = (t+er)|0; 19418 ar = er; 19419 er = dr; 19420 dr = rotl(cr, 10); 19421 cr = br; 19422 br = t; 19423 } 19424 // Intermediate hash value 19425 t = (H[1] + cl + dr)|0; 19426 H[1] = (H[2] + dl + er)|0; 19427 H[2] = (H[3] + el + ar)|0; 19428 H[3] = (H[4] + al + br)|0; 19429 H[4] = (H[0] + bl + cr)|0; 19430 H[0] = t; 19431 }, 19432 19433 _doFinalize: function () { 19434 // Shortcuts 19435 var data = this._data; 19436 var dataWords = data.words; 19437 19438 var nBitsTotal = this._nDataBytes * 8; 19439 var nBitsLeft = data.sigBytes * 8; 19440 19441 // Add padding 19442 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 19443 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( 19444 (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | 19445 (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) 19446 ); 19447 data.sigBytes = (dataWords.length + 1) * 4; 19448 19449 // Hash final blocks 19450 this._process(); 19451 19452 // Shortcuts 19453 var hash = this._hash; 19454 var H = hash.words; 19455 19456 // Swap endian 19457 for (var i = 0; i < 5; i++) { 19458 // Shortcut 19459 var H_i = H[i]; 19460 19461 // Swap 19462 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | 19463 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); 19464 } 19465 19466 // Return final computed hash 19467 return hash; 19468 }, 19469 19470 clone: function () { 19471 var clone = Hasher.clone.call(this); 19472 clone._hash = this._hash.clone(); 19473 19474 return clone; 19475 } 19476 }); 19477 19478 19479 function f1(x, y, z) { 19480 return ((x) ^ (y) ^ (z)); 19481 19482 } 19483 19484 function f2(x, y, z) { 19485 return (((x)&(y)) | ((~x)&(z))); 19486 } 19487 19488 function f3(x, y, z) { 19489 return (((x) | (~(y))) ^ (z)); 19490 } 19491 19492 function f4(x, y, z) { 19493 return (((x) & (z)) | ((y)&(~(z)))); 19494 } 19495 19496 function f5(x, y, z) { 19497 return ((x) ^ ((y) |(~(z)))); 19498 19499 } 19500 19501 function rotl(x,n) { 19502 return (x<<n) | (x>>>(32-n)); 19503 } 19504 19505 19506 /** 19507 * Shortcut function to the hasher's object interface. 19508 * 19509 * @param {WordArray|string} message The message to hash. 19510 * 19511 * @return {WordArray} The hash. 19512 * 19513 * @static 19514 * 19515 * @example 19516 * 19517 * var hash = CryptoJS.RIPEMD160('message'); 19518 * var hash = CryptoJS.RIPEMD160(wordArray); 19519 */ 19520 C.RIPEMD160 = Hasher._createHelper(RIPEMD160); 19521 19522 /** 19523 * Shortcut function to the HMAC's object interface. 19524 * 19525 * @param {WordArray|string} message The message to hash. 19526 * @param {WordArray|string} key The secret key. 19527 * 19528 * @return {WordArray} The HMAC. 19529 * 19530 * @static 19531 * 19532 * @example 19533 * 19534 * var hmac = CryptoJS.HmacRIPEMD160(message, key); 19535 */ 19536 C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); 19537 }(Math)); 19538 19539 19540 (function () { 19541 // Shortcuts 19542 var C = CryptoJS; 19543 var C_lib = C.lib; 19544 var Base = C_lib.Base; 19545 var C_enc = C.enc; 19546 var Utf8 = C_enc.Utf8; 19547 var C_algo = C.algo; 19548 19549 /** 19550 * HMAC algorithm. 19551 */ 19552 var HMAC = C_algo.HMAC = Base.extend({ 19553 /** 19554 * Initializes a newly created HMAC. 19555 * 19556 * @param {Hasher} hasher The hash algorithm to use. 19557 * @param {WordArray|string} key The secret key. 19558 * 19559 * @example 19560 * 19561 * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); 19562 */ 19563 init: function (hasher, key) { 19564 // Init hasher 19565 hasher = this._hasher = new hasher.init(); 19566 19567 // Convert string to WordArray, else assume WordArray already 19568 if (typeof key == 'string') { 19569 key = Utf8.parse(key); 19570 } 19571 19572 // Shortcuts 19573 var hasherBlockSize = hasher.blockSize; 19574 var hasherBlockSizeBytes = hasherBlockSize * 4; 19575 19576 // Allow arbitrary length keys 19577 if (key.sigBytes > hasherBlockSizeBytes) { 19578 key = hasher.finalize(key); 19579 } 19580 19581 // Clamp excess bits 19582 key.clamp(); 19583 19584 // Clone key for inner and outer pads 19585 var oKey = this._oKey = key.clone(); 19586 var iKey = this._iKey = key.clone(); 19587 19588 // Shortcuts 19589 var oKeyWords = oKey.words; 19590 var iKeyWords = iKey.words; 19591 19592 // XOR keys with pad constants 19593 for (var i = 0; i < hasherBlockSize; i++) { 19594 oKeyWords[i] ^= 0x5c5c5c5c; 19595 iKeyWords[i] ^= 0x36363636; 19596 } 19597 oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; 19598 19599 // Set initial values 19600 this.reset(); 19601 }, 19602 19603 /** 19604 * Resets this HMAC to its initial state. 19605 * 19606 * @example 19607 * 19608 * hmacHasher.reset(); 19609 */ 19610 reset: function () { 19611 // Shortcut 19612 var hasher = this._hasher; 19613 19614 // Reset 19615 hasher.reset(); 19616 hasher.update(this._iKey); 19617 }, 19618 19619 /** 19620 * Updates this HMAC with a message. 19621 * 19622 * @param {WordArray|string} messageUpdate The message to append. 19623 * 19624 * @return {HMAC} This HMAC instance. 19625 * 19626 * @example 19627 * 19628 * hmacHasher.update('message'); 19629 * hmacHasher.update(wordArray); 19630 */ 19631 update: function (messageUpdate) { 19632 this._hasher.update(messageUpdate); 19633 19634 // Chainable 19635 return this; 19636 }, 19637 19638 /** 19639 * Finalizes the HMAC computation. 19640 * Note that the finalize operation is effectively a destructive, read-once operation. 19641 * 19642 * @param {WordArray|string} messageUpdate (Optional) A final message update. 19643 * 19644 * @return {WordArray} The HMAC. 19645 * 19646 * @example 19647 * 19648 * var hmac = hmacHasher.finalize(); 19649 * var hmac = hmacHasher.finalize('message'); 19650 * var hmac = hmacHasher.finalize(wordArray); 19651 */ 19652 finalize: function (messageUpdate) { 19653 // Shortcut 19654 var hasher = this._hasher; 19655 19656 // Compute HMAC 19657 var innerHash = hasher.finalize(messageUpdate); 19658 hasher.reset(); 19659 var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); 19660 19661 return hmac; 19662 } 19663 }); 19664 }()); 19665 19666 19667 (function () { 19668 // Shortcuts 19669 var C = CryptoJS; 19670 var C_lib = C.lib; 19671 var Base = C_lib.Base; 19672 var WordArray = C_lib.WordArray; 19673 var C_algo = C.algo; 19674 var SHA256 = C_algo.SHA256; 19675 var HMAC = C_algo.HMAC; 19676 19677 /** 19678 * Password-Based Key Derivation Function 2 algorithm. 19679 */ 19680 var PBKDF2 = C_algo.PBKDF2 = Base.extend({ 19681 /** 19682 * Configuration options. 19683 * 19684 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) 19685 * @property {Hasher} hasher The hasher to use. Default: SHA256 19686 * @property {number} iterations The number of iterations to perform. Default: 250000 19687 */ 19688 cfg: Base.extend({ 19689 keySize: 128/32, 19690 hasher: SHA256, 19691 iterations: 250000 19692 }), 19693 19694 /** 19695 * Initializes a newly created key derivation function. 19696 * 19697 * @param {Object} cfg (Optional) The configuration options to use for the derivation. 19698 * 19699 * @example 19700 * 19701 * var kdf = CryptoJS.algo.PBKDF2.create(); 19702 * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); 19703 * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); 19704 */ 19705 init: function (cfg) { 19706 this.cfg = this.cfg.extend(cfg); 19707 }, 19708 19709 /** 19710 * Computes the Password-Based Key Derivation Function 2. 19711 * 19712 * @param {WordArray|string} password The password. 19713 * @param {WordArray|string} salt A salt. 19714 * 19715 * @return {WordArray} The derived key. 19716 * 19717 * @example 19718 * 19719 * var key = kdf.compute(password, salt); 19720 */ 19721 compute: function (password, salt) { 19722 // Shortcut 19723 var cfg = this.cfg; 19724 19725 // Init HMAC 19726 var hmac = HMAC.create(cfg.hasher, password); 19727 19728 // Initial values 19729 var derivedKey = WordArray.create(); 19730 var blockIndex = WordArray.create([0x00000001]); 19731 19732 // Shortcuts 19733 var derivedKeyWords = derivedKey.words; 19734 var blockIndexWords = blockIndex.words; 19735 var keySize = cfg.keySize; 19736 var iterations = cfg.iterations; 19737 19738 // Generate key 19739 while (derivedKeyWords.length < keySize) { 19740 var block = hmac.update(salt).finalize(blockIndex); 19741 hmac.reset(); 19742 19743 // Shortcuts 19744 var blockWords = block.words; 19745 var blockWordsLength = blockWords.length; 19746 19747 // Iterations 19748 var intermediate = block; 19749 for (var i = 1; i < iterations; i++) { 19750 intermediate = hmac.finalize(intermediate); 19751 hmac.reset(); 19752 19753 // Shortcut 19754 var intermediateWords = intermediate.words; 19755 19756 // XOR intermediate with block 19757 for (var j = 0; j < blockWordsLength; j++) { 19758 blockWords[j] ^= intermediateWords[j]; 19759 } 19760 } 19761 19762 derivedKey.concat(block); 19763 blockIndexWords[0]++; 19764 } 19765 derivedKey.sigBytes = keySize * 4; 19766 19767 return derivedKey; 19768 } 19769 }); 19770 19771 /** 19772 * Computes the Password-Based Key Derivation Function 2. 19773 * 19774 * @param {WordArray|string} password The password. 19775 * @param {WordArray|string} salt A salt. 19776 * @param {Object} cfg (Optional) The configuration options to use for this computation. 19777 * 19778 * @return {WordArray} The derived key. 19779 * 19780 * @static 19781 * 19782 * @example 19783 * 19784 * var key = CryptoJS.PBKDF2(password, salt); 19785 * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); 19786 * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); 19787 */ 19788 C.PBKDF2 = function (password, salt, cfg) { 19789 return PBKDF2.create(cfg).compute(password, salt); 19790 }; 19791 }()); 19792 19793 19794 (function () { 19795 // Shortcuts 19796 var C = CryptoJS; 19797 var C_lib = C.lib; 19798 var Base = C_lib.Base; 19799 var WordArray = C_lib.WordArray; 19800 var C_algo = C.algo; 19801 var MD5 = C_algo.MD5; 19802 19803 /** 19804 * This key derivation function is meant to conform with EVP_BytesToKey. 19805 * www.openssl.org/docs/crypto/EVP_BytesToKey.html 19806 */ 19807 var EvpKDF = C_algo.EvpKDF = Base.extend({ 19808 /** 19809 * Configuration options. 19810 * 19811 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) 19812 * @property {Hasher} hasher The hash algorithm to use. Default: MD5 19813 * @property {number} iterations The number of iterations to perform. Default: 1 19814 */ 19815 cfg: Base.extend({ 19816 keySize: 128/32, 19817 hasher: MD5, 19818 iterations: 1 19819 }), 19820 19821 /** 19822 * Initializes a newly created key derivation function. 19823 * 19824 * @param {Object} cfg (Optional) The configuration options to use for the derivation. 19825 * 19826 * @example 19827 * 19828 * var kdf = CryptoJS.algo.EvpKDF.create(); 19829 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); 19830 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); 19831 */ 19832 init: function (cfg) { 19833 this.cfg = this.cfg.extend(cfg); 19834 }, 19835 19836 /** 19837 * Derives a key from a password. 19838 * 19839 * @param {WordArray|string} password The password. 19840 * @param {WordArray|string} salt A salt. 19841 * 19842 * @return {WordArray} The derived key. 19843 * 19844 * @example 19845 * 19846 * var key = kdf.compute(password, salt); 19847 */ 19848 compute: function (password, salt) { 19849 var block; 19850 19851 // Shortcut 19852 var cfg = this.cfg; 19853 19854 // Init hasher 19855 var hasher = cfg.hasher.create(); 19856 19857 // Initial values 19858 var derivedKey = WordArray.create(); 19859 19860 // Shortcuts 19861 var derivedKeyWords = derivedKey.words; 19862 var keySize = cfg.keySize; 19863 var iterations = cfg.iterations; 19864 19865 // Generate key 19866 while (derivedKeyWords.length < keySize) { 19867 if (block) { 19868 hasher.update(block); 19869 } 19870 block = hasher.update(password).finalize(salt); 19871 hasher.reset(); 19872 19873 // Iterations 19874 for (var i = 1; i < iterations; i++) { 19875 block = hasher.finalize(block); 19876 hasher.reset(); 19877 } 19878 19879 derivedKey.concat(block); 19880 } 19881 derivedKey.sigBytes = keySize * 4; 19882 19883 return derivedKey; 19884 } 19885 }); 19886 19887 /** 19888 * Derives a key from a password. 19889 * 19890 * @param {WordArray|string} password The password. 19891 * @param {WordArray|string} salt A salt. 19892 * @param {Object} cfg (Optional) The configuration options to use for this computation. 19893 * 19894 * @return {WordArray} The derived key. 19895 * 19896 * @static 19897 * 19898 * @example 19899 * 19900 * var key = CryptoJS.EvpKDF(password, salt); 19901 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); 19902 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); 19903 */ 19904 C.EvpKDF = function (password, salt, cfg) { 19905 return EvpKDF.create(cfg).compute(password, salt); 19906 }; 19907 }()); 19908 19909 19910 /** 19911 * Cipher core components. 19912 */ 19913 CryptoJS.lib.Cipher || (function (undefined) { 19914 // Shortcuts 19915 var C = CryptoJS; 19916 var C_lib = C.lib; 19917 var Base = C_lib.Base; 19918 var WordArray = C_lib.WordArray; 19919 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; 19920 var C_enc = C.enc; 19921 var Utf8 = C_enc.Utf8; 19922 var Base64 = C_enc.Base64; 19923 var C_algo = C.algo; 19924 var EvpKDF = C_algo.EvpKDF; 19925 19926 /** 19927 * Abstract base cipher template. 19928 * 19929 * @property {number} keySize This cipher's key size. Default: 4 (128 bits) 19930 * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) 19931 * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. 19932 * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. 19933 */ 19934 var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ 19935 /** 19936 * Configuration options. 19937 * 19938 * @property {WordArray} iv The IV to use for this operation. 19939 */ 19940 cfg: Base.extend(), 19941 19942 /** 19943 * Creates this cipher in encryption mode. 19944 * 19945 * @param {WordArray} key The key. 19946 * @param {Object} cfg (Optional) The configuration options to use for this operation. 19947 * 19948 * @return {Cipher} A cipher instance. 19949 * 19950 * @static 19951 * 19952 * @example 19953 * 19954 * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); 19955 */ 19956 createEncryptor: function (key, cfg) { 19957 return this.create(this._ENC_XFORM_MODE, key, cfg); 19958 }, 19959 19960 /** 19961 * Creates this cipher in decryption mode. 19962 * 19963 * @param {WordArray} key The key. 19964 * @param {Object} cfg (Optional) The configuration options to use for this operation. 19965 * 19966 * @return {Cipher} A cipher instance. 19967 * 19968 * @static 19969 * 19970 * @example 19971 * 19972 * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); 19973 */ 19974 createDecryptor: function (key, cfg) { 19975 return this.create(this._DEC_XFORM_MODE, key, cfg); 19976 }, 19977 19978 /** 19979 * Initializes a newly created cipher. 19980 * 19981 * @param {number} xformMode Either the encryption or decryption transormation mode constant. 19982 * @param {WordArray} key The key. 19983 * @param {Object} cfg (Optional) The configuration options to use for this operation. 19984 * 19985 * @example 19986 * 19987 * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); 19988 */ 19989 init: function (xformMode, key, cfg) { 19990 // Apply config defaults 19991 this.cfg = this.cfg.extend(cfg); 19992 19993 // Store transform mode and key 19994 this._xformMode = xformMode; 19995 this._key = key; 19996 19997 // Set initial values 19998 this.reset(); 19999 }, 20000 20001 /** 20002 * Resets this cipher to its initial state. 20003 * 20004 * @example 20005 * 20006 * cipher.reset(); 20007 */ 20008 reset: function () { 20009 // Reset data buffer 20010 BufferedBlockAlgorithm.reset.call(this); 20011 20012 // Perform concrete-cipher logic 20013 this._doReset(); 20014 }, 20015 20016 /** 20017 * Adds data to be encrypted or decrypted. 20018 * 20019 * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. 20020 * 20021 * @return {WordArray} The data after processing. 20022 * 20023 * @example 20024 * 20025 * var encrypted = cipher.process('data'); 20026 * var encrypted = cipher.process(wordArray); 20027 */ 20028 process: function (dataUpdate) { 20029 // Append 20030 this._append(dataUpdate); 20031 20032 // Process available blocks 20033 return this._process(); 20034 }, 20035 20036 /** 20037 * Finalizes the encryption or decryption process. 20038 * Note that the finalize operation is effectively a destructive, read-once operation. 20039 * 20040 * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. 20041 * 20042 * @return {WordArray} The data after final processing. 20043 * 20044 * @example 20045 * 20046 * var encrypted = cipher.finalize(); 20047 * var encrypted = cipher.finalize('data'); 20048 * var encrypted = cipher.finalize(wordArray); 20049 */ 20050 finalize: function (dataUpdate) { 20051 // Final data update 20052 if (dataUpdate) { 20053 this._append(dataUpdate); 20054 } 20055 20056 // Perform concrete-cipher logic 20057 var finalProcessedData = this._doFinalize(); 20058 20059 return finalProcessedData; 20060 }, 20061 20062 keySize: 128/32, 20063 20064 ivSize: 128/32, 20065 20066 _ENC_XFORM_MODE: 1, 20067 20068 _DEC_XFORM_MODE: 2, 20069 20070 /** 20071 * Creates shortcut functions to a cipher's object interface. 20072 * 20073 * @param {Cipher} cipher The cipher to create a helper for. 20074 * 20075 * @return {Object} An object with encrypt and decrypt shortcut functions. 20076 * 20077 * @static 20078 * 20079 * @example 20080 * 20081 * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); 20082 */ 20083 _createHelper: (function () { 20084 function selectCipherStrategy(key) { 20085 if (typeof key == 'string') { 20086 return PasswordBasedCipher; 20087 } else { 20088 return SerializableCipher; 20089 } 20090 } 20091 20092 return function (cipher) { 20093 return { 20094 encrypt: function (message, key, cfg) { 20095 return selectCipherStrategy(key).encrypt
vendor: 11,908 bytes, lines 20095-20474
20095(cipher, message, key, cfg); 20096 }, 20097 20098 decrypt: function (ciphertext, key, cfg) { 20099 return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); 20100 } 20101 }; 20102 }; 20103 }()) 20104 }); 20105 20106 /** 20107 * Abstract base stream cipher template. 20108 * 20109 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) 20110 */ 20111 var StreamCipher = C_lib.StreamCipher = Cipher.extend({ 20112 _doFinalize: function () { 20113 // Process partial blocks 20114 var finalProcessedBlocks = this._process(!!'flush'); 20115 20116 return finalProcessedBlocks; 20117 }, 20118 20119 blockSize: 1 20120 }); 20121 20122 /** 20123 * Mode namespace. 20124 */ 20125 var C_mode = C.mode = {}; 20126 20127 /** 20128 * Abstract base block cipher mode template. 20129 */ 20130 var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ 20131 /** 20132 * Creates this mode for encryption. 20133 * 20134 * @param {Cipher} cipher A block cipher instance. 20135 * @param {Array} iv The IV words. 20136 * 20137 * @static 20138 * 20139 * @example 20140 * 20141 * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); 20142 */ 20143 createEncryptor: function (cipher, iv) { 20144 return this.Encryptor.create(cipher, iv); 20145 }, 20146 20147 /** 20148 * Creates this mode for decryption. 20149 * 20150 * @param {Cipher} cipher A block cipher instance. 20151 * @param {Array} iv The IV words. 20152 * 20153 * @static 20154 * 20155 * @example 20156 * 20157 * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); 20158 */ 20159 createDecryptor: function (cipher, iv) { 20160 return this.Decryptor.create(cipher, iv); 20161 }, 20162 20163 /** 20164 * Initializes a newly created mode. 20165 * 20166 * @param {Cipher} cipher A block cipher instance. 20167 * @param {Array} iv The IV words. 20168 * 20169 * @example 20170 * 20171 * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); 20172 */ 20173 init: function (cipher, iv) { 20174 this._cipher = cipher; 20175 this._iv = iv; 20176 } 20177 }); 20178 20179 /** 20180 * Cipher Block Chaining mode. 20181 */ 20182 var CBC = C_mode.CBC = (function () { 20183 /** 20184 * Abstract base CBC mode. 20185 */ 20186 var CBC = BlockCipherMode.extend(); 20187 20188 /** 20189 * CBC encryptor. 20190 */ 20191 CBC.Encryptor = CBC.extend({ 20192 /** 20193 * Processes the data block at offset. 20194 * 20195 * @param {Array} words The data words to operate on. 20196 * @param {number} offset The offset where the block starts. 20197 * 20198 * @example 20199 * 20200 * mode.processBlock(data.words, offset); 20201 */ 20202 processBlock: function (words, offset) { 20203 // Shortcuts 20204 var cipher = this._cipher; 20205 var blockSize = cipher.blockSize; 20206 20207 // XOR and encrypt 20208 xorBlock.call(this, words, offset, blockSize); 20209 cipher.encryptBlock(words, offset); 20210 20211 // Remember this block to use with next block 20212 this._prevBlock = words.slice(offset, offset + blockSize); 20213 } 20214 }); 20215 20216 /** 20217 * CBC decryptor. 20218 */ 20219 CBC.Decryptor = CBC.extend({ 20220 /** 20221 * Processes the data block at offset. 20222 * 20223 * @param {Array} words The data words to operate on. 20224 * @param {number} offset The offset where the block starts. 20225 * 20226 * @example 20227 * 20228 * mode.processBlock(data.words, offset); 20229 */ 20230 processBlock: function (words, offset) { 20231 // Shortcuts 20232 var cipher = this._cipher; 20233 var blockSize = cipher.blockSize; 20234 20235 // Remember this block to use with next block 20236 var thisBlock = words.slice(offset, offset + blockSize); 20237 20238 // Decrypt and XOR 20239 cipher.decryptBlock(words, offset); 20240 xorBlock.call(this, words, offset, blockSize); 20241 20242 // This block becomes the previous block 20243 this._prevBlock = thisBlock; 20244 } 20245 }); 20246 20247 function xorBlock(words, offset, blockSize) { 20248 var block; 20249 20250 // Shortcut 20251 var iv = this._iv; 20252 20253 // Choose mixing block 20254 if (iv) { 20255 block = iv; 20256 20257 // Remove IV for subsequent blocks 20258 this._iv = undefined; 20259 } else { 20260 block = this._prevBlock; 20261 } 20262 20263 // XOR blocks 20264 for (var i = 0; i < blockSize; i++) { 20265 words[offset + i] ^= block[i]; 20266 } 20267 } 20268 20269 return CBC; 20270 }()); 20271 20272 /** 20273 * Padding namespace. 20274 */ 20275 var C_pad = C.pad = {}; 20276 20277 /** 20278 * PKCS #5/7 padding strategy. 20279 */ 20280 var Pkcs7 = C_pad.Pkcs7 = { 20281 /** 20282 * Pads data using the algorithm defined in PKCS #5/7. 20283 * 20284 * @param {WordArray} data The data to pad. 20285 * @param {number} blockSize The multiple that the data should be padded to. 20286 * 20287 * @static 20288 * 20289 * @example 20290 * 20291 * CryptoJS.pad.Pkcs7.pad(wordArray, 4); 20292 */ 20293 pad: function (data, blockSize) { 20294 // Shortcut 20295 var blockSizeBytes = blockSize * 4; 20296 20297 // Count padding bytes 20298 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 20299 20300 // Create padding word 20301 var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; 20302 20303 // Create padding 20304 var paddingWords = []; 20305 for (var i = 0; i < nPaddingBytes; i += 4) { 20306 paddingWords.push(paddingWord); 20307 } 20308 var padding = WordArray.create(paddingWords, nPaddingBytes); 20309 20310 // Add padding 20311 data.concat(padding); 20312 }, 20313 20314 /** 20315 * Unpads data that had been padded using the algorithm defined in PKCS #5/7. 20316 * 20317 * @param {WordArray} data The data to unpad. 20318 * 20319 * @static 20320 * 20321 * @example 20322 * 20323 * CryptoJS.pad.Pkcs7.unpad(wordArray); 20324 */ 20325 unpad: function (data) { 20326 // Get number of padding bytes from last byte 20327 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 20328 20329 // Remove padding 20330 data.sigBytes -= nPaddingBytes; 20331 } 20332 }; 20333 20334 /** 20335 * Abstract base block cipher template. 20336 * 20337 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) 20338 */ 20339 var BlockCipher = C_lib.BlockCipher = Cipher.extend({ 20340 /** 20341 * Configuration options. 20342 * 20343 * @property {Mode} mode The block mode to use. Default: CBC 20344 * @property {Padding} padding The padding strategy to use. Default: Pkcs7 20345 */ 20346 cfg: Cipher.cfg.extend({ 20347 mode: CBC, 20348 padding: Pkcs7 20349 }), 20350 20351 reset: function () { 20352 var modeCreator; 20353 20354 // Reset cipher 20355 Cipher.reset.call(this); 20356 20357 // Shortcuts 20358 var cfg = this.cfg; 20359 var iv = cfg.iv; 20360 var mode = cfg.mode; 20361 20362 // Reset block mode 20363 if (this._xformMode == this._ENC_XFORM_MODE) { 20364 modeCreator = mode.createEncryptor; 20365 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { 20366 modeCreator = mode.createDecryptor; 20367 // Keep at least one block in the buffer for unpadding 20368 this._minBufferSize = 1; 20369 } 20370 20371 if (this._mode && this._mode.__creator == modeCreator) { 20372 this._mode.init(this, iv && iv.words); 20373 } else { 20374 this._mode = modeCreator.call(mode, this, iv && iv.words); 20375 this._mode.__creator = modeCreator; 20376 } 20377 }, 20378 20379 _doProcessBlock: function (words, offset) { 20380 this._mode.processBlock(words, offset); 20381 }, 20382 20383 _doFinalize: function () { 20384 var finalProcessedBlocks; 20385 20386 // Shortcut 20387 var padding = this.cfg.padding; 20388 20389 // Finalize 20390 if (this._xformMode == this._ENC_XFORM_MODE) { 20391 // Pad data 20392 padding.pad(this._data, this.blockSize); 20393 20394 // Process final blocks 20395 finalProcessedBlocks = this._process(!!'flush'); 20396 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { 20397 // Process final blocks 20398 finalProcessedBlocks = this._process(!!'flush'); 20399 20400 // Unpad data 20401 padding.unpad(finalProcessedBlocks); 20402 } 20403 20404 return finalProcessedBlocks; 20405 }, 20406 20407 blockSize: 128/32 20408 }); 20409 20410 /** 20411 * A collection of cipher parameters. 20412 * 20413 * @property {WordArray} ciphertext The raw ciphertext. 20414 * @property {WordArray} key The key to this ciphertext. 20415 * @property {WordArray} iv The IV used in the ciphering operation. 20416 * @property {WordArray} salt The salt used with a key derivation function. 20417 * @property {Cipher} algorithm The cipher algorithm. 20418 * @property {Mode} mode The block mode used in the ciphering operation. 20419 * @property {Padding} padding The padding scheme used in the ciphering operation. 20420 * @property {number} blockSize The block size of the cipher. 20421 * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. 20422 */ 20423 var CipherParams = C_lib.CipherParams = Base.extend({ 20424 /** 20425 * Initializes a newly created cipher params object. 20426 * 20427 * @param {Object} cipherParams An object with any of the possible cipher parameters. 20428 * 20429 * @example 20430 * 20431 * var cipherParams = CryptoJS.lib.CipherParams.create({ 20432 * ciphertext: ciphertextWordArray, 20433 * key: keyWordArray, 20434 * iv: ivWordArray, 20435 * salt: saltWordArray, 20436 * algorithm: CryptoJS.algo.AES, 20437 * mode: CryptoJS.mode.CBC, 20438 * padding: CryptoJS.pad.PKCS7, 20439 * blockSize: 4, 20440 * formatter: CryptoJS.format.OpenSSL 20441 * }); 20442 */ 20443 init: function (cipherParams) { 20444 this.mixIn(cipherParams); 20445 }, 20446 20447 /** 20448 * Converts this cipher params object to a string. 20449 * 20450 * @param {Format} formatter (Optional) The formatting strategy to use. 20451 * 20452 * @return {string} The stringified cipher params. 20453 * 20454 * @throws Error If neither the formatter nor the default formatter is set. 20455 * 20456 * @example 20457 * 20458 * var string = cipherParams + ''; 20459 * var string = cipherParams.toString(); 20460 * var string = cipherParams.toString(CryptoJS.format.OpenSSL); 20461 */ 20462 toString: function (formatter) { 20463 return (formatter || this.formatter).stringify(this); 20464 } 20465 }); 20466 20467 /** 20468 * Format namespace. 20469 */ 20470 var C_format = C.format = {}; 20471 20472 /** 20473 * OpenSSL formatting strategy. 20474 */
vendor: 7,596 bytes, lines 20475-20684
20475 var OpenSSLFormatter = C_format.OpenSSL = { 20476 /** 20477 * Converts a cipher params object to an OpenSSL-compatible string. 20478 * 20479 * @param {CipherParams} cipherParams The cipher params object. 20480 * 20481 * @return {string} The OpenSSL-compatible string. 20482 * 20483 * @static 20484 * 20485 * @example 20486 * 20487 * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); 20488 */ 20489 stringify: function (cipherParams) { 20490 var wordArray; 20491 20492 // Shortcuts 20493 var ciphertext = cipherParams.ciphertext; 20494 var salt = cipherParams.salt; 20495 20496 // Format 20497 if (salt) { 20498 wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); 20499 } else { 20500 wordArray = ciphertext; 20501 } 20502 20503 return wordArray.toString(Base64); 20504 }, 20505 20506 /** 20507 * Converts an OpenSSL-compatible string to a cipher params object. 20508 * 20509 * @param {string} openSSLStr The OpenSSL-compatible string. 20510 * 20511 * @return {CipherParams} The cipher params object. 20512 * 20513 * @static 20514 * 20515 * @example 20516 * 20517 * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); 20518 */ 20519 parse: function (openSSLStr) { 20520 var salt; 20521 20522 // Parse base64 20523 var ciphertext = Base64.parse(openSSLStr); 20524 20525 // Shortcut 20526 var ciphertextWords = ciphertext.words; 20527 20528 // Test for salt 20529 if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { 20530 // Extract salt 20531 salt = WordArray.create(ciphertextWords.slice(2, 4)); 20532 20533 // Remove salt from ciphertext 20534 ciphertextWords.splice(0, 4); 20535 ciphertext.sigBytes -= 16; 20536 } 20537 20538 return CipherParams.create({ ciphertext: ciphertext, salt: salt }); 20539 } 20540 }; 20541 20542 /** 20543 * A cipher wrapper that returns ciphertext as a serializable cipher params object. 20544 */ 20545 var SerializableCipher = C_lib.SerializableCipher = Base.extend({ 20546 /** 20547 * Configuration options. 20548 * 20549 * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL 20550 */ 20551 cfg: Base.extend({ 20552 format: OpenSSLFormatter 20553 }), 20554 20555 /** 20556 * Encrypts a message. 20557 * 20558 * @param {Cipher} cipher The cipher algorithm to use. 20559 * @param {WordArray|string} message The message to encrypt. 20560 * @param {WordArray} key The key. 20561 * @param {Object} cfg (Optional) The configuration options to use for this operation. 20562 * 20563 * @return {CipherParams} A cipher params object. 20564 * 20565 * @static 20566 * 20567 * @example 20568 * 20569 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); 20570 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); 20571 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); 20572 */ 20573 encrypt: function (cipher, message, key, cfg) { 20574 // Apply config defaults 20575 cfg = this.cfg.extend(cfg); 20576 20577 // Encrypt 20578 var encryptor = cipher.createEncryptor(key, cfg); 20579 var ciphertext = encryptor.finalize(message); 20580 20581 // Shortcut 20582 var cipherCfg = encryptor.cfg; 20583 20584 // Create and return serializable cipher params 20585 return CipherParams.create({ 20586 ciphertext: ciphertext, 20587 key: key, 20588 iv: cipherCfg.iv, 20589 algorithm: cipher, 20590 mode: cipherCfg.mode, 20591 padding: cipherCfg.padding, 20592 blockSize: cipher.blockSize, 20593 formatter: cfg.format 20594 }); 20595 }, 20596 20597 /** 20598 * Decrypts serialized ciphertext. 20599 * 20600 * @param {Cipher} cipher The cipher algorithm to use. 20601 * @param {CipherParams|string} ciphertext The ciphertext to decrypt. 20602 * @param {WordArray} key The key. 20603 * @param {Object} cfg (Optional) The configuration options to use for this operation. 20604 * 20605 * @return {WordArray} The plaintext. 20606 * 20607 * @static 20608 * 20609 * @example 20610 * 20611 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); 20612 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); 20613 */ 20614 decrypt: function (cipher, ciphertext, key, cfg) { 20615 // Apply config defaults 20616 cfg = this.cfg.extend(cfg); 20617 20618 // Convert string to CipherParams 20619 ciphertext = this._parse(ciphertext, cfg.format); 20620 20621 // Decrypt 20622 var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); 20623 20624 return plaintext; 20625 }, 20626 20627 /** 20628 * Converts serialized ciphertext to CipherParams, 20629 * else assumed CipherParams already and returns ciphertext unchanged. 20630 * 20631 * @param {CipherParams|string} ciphertext The ciphertext. 20632 * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. 20633 * 20634 * @return {CipherParams} The unserialized ciphertext. 20635 * 20636 * @static 20637 * 20638 * @example 20639 * 20640 * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); 20641 */ 20642 _parse: function (ciphertext, format) { 20643 if (typeof ciphertext == 'string') { 20644 return format.parse(ciphertext, this); 20645 } else { 20646 return ciphertext; 20647 } 20648 } 20649 }); 20650 20651 /** 20652 * Key derivation function namespace. 20653 */ 20654 var C_kdf = C.kdf = {}; 20655 20656 /** 20657 * OpenSSL key derivation function. 20658 */ 20659 var OpenSSLKdf = C_kdf.OpenSSL = { 20660 /** 20661 * Derives a key and IV from a password. 20662 * 20663 * @param {string} password The password to derive from. 20664 * @param {number} keySize The size in words of the key to generate. 20665 * @param {number} ivSize The size in words of the IV to generate. 20666 * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. 20667 * 20668 * @return {CipherParams} A cipher params object with the key, IV, and salt. 20669 * 20670 * @static 20671 * 20672 * @example 20673 * 20674 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); 20675 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); 20676 */ 20677 execute: function (password, keySize, ivSize, salt, hasher) { 20678 // Generate random salt 20679 if (!salt) { 20680 salt = WordArray.random(64/8); 20681 } 20682 20683 // Derive key and IV 20684 if (!hasher) {
vendor: 17,073 bytes, lines 20685-21302
20685 var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); 20686 } else { 20687 var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, salt); 20688 } 20689 20690 20691 // Separate key and IV 20692 var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); 20693 key.sigBytes = keySize * 4; 20694 20695 // Return params 20696 return CipherParams.create({ key: key, iv: iv, salt: salt }); 20697 } 20698 }; 20699 20700 /** 20701 * A serializable cipher wrapper that derives the key from a password, 20702 * and returns ciphertext as a serializable cipher params object. 20703 */ 20704 var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ 20705 /** 20706 * Configuration options. 20707 * 20708 * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL 20709 */ 20710 cfg: SerializableCipher.cfg.extend({ 20711 kdf: OpenSSLKdf 20712 }), 20713 20714 /** 20715 * Encrypts a message using a password. 20716 * 20717 * @param {Cipher} cipher The cipher algorithm to use. 20718 * @param {WordArray|string} message The message to encrypt. 20719 * @param {string} password The password. 20720 * @param {Object} cfg (Optional) The configuration options to use for this operation. 20721 * 20722 * @return {CipherParams} A cipher params object. 20723 * 20724 * @static 20725 * 20726 * @example 20727 * 20728 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); 20729 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); 20730 */ 20731 encrypt: function (cipher, message, password, cfg) { 20732 // Apply config defaults 20733 cfg = this.cfg.extend(cfg); 20734 20735 // Derive key and other params 20736 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher); 20737 20738 // Add IV to config 20739 cfg.iv = derivedParams.iv; 20740 20741 // Encrypt 20742 var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); 20743 20744 // Mix in derived params 20745 ciphertext.mixIn(derivedParams); 20746 20747 return ciphertext; 20748 }, 20749 20750 /** 20751 * Decrypts serialized ciphertext using a password. 20752 * 20753 * @param {Cipher} cipher The cipher algorithm to use. 20754 * @param {CipherParams|string} ciphertext The ciphertext to decrypt. 20755 * @param {string} password The password. 20756 * @param {Object} cfg (Optional) The configuration options to use for this operation. 20757 * 20758 * @return {WordArray} The plaintext. 20759 * 20760 * @static 20761 * 20762 * @example 20763 * 20764 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); 20765 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); 20766 */ 20767 decrypt: function (cipher, ciphertext, password, cfg) { 20768 // Apply config defaults 20769 cfg = this.cfg.extend(cfg); 20770 20771 // Convert string to CipherParams 20772 ciphertext = this._parse(ciphertext, cfg.format); 20773 20774 // Derive key and other params 20775 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher); 20776 20777 // Add IV to config 20778 cfg.iv = derivedParams.iv; 20779 20780 // Decrypt 20781 var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); 20782 20783 return plaintext; 20784 } 20785 }); 20786 }()); 20787 20788 20789 /** 20790 * Cipher Feedback block mode. 20791 */ 20792 CryptoJS.mode.CFB = (function () { 20793 var CFB = CryptoJS.lib.BlockCipherMode.extend(); 20794 20795 CFB.Encryptor = CFB.extend({ 20796 processBlock: function (words, offset) { 20797 // Shortcuts 20798 var cipher = this._cipher; 20799 var blockSize = cipher.blockSize; 20800 20801 generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 20802 20803 // Remember this block to use with next block 20804 this._prevBlock = words.slice(offset, offset + blockSize); 20805 } 20806 }); 20807 20808 CFB.Decryptor = CFB.extend({ 20809 processBlock: function (words, offset) { 20810 // Shortcuts 20811 var cipher = this._cipher; 20812 var blockSize = cipher.blockSize; 20813 20814 // Remember this block to use with next block 20815 var thisBlock = words.slice(offset, offset + blockSize); 20816 20817 generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 20818 20819 // This block becomes the previous block 20820 this._prevBlock = thisBlock; 20821 } 20822 }); 20823 20824 function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { 20825 var keystream; 20826 20827 // Shortcut 20828 var iv = this._iv; 20829 20830 // Generate keystream 20831 if (iv) { 20832 keystream = iv.slice(0); 20833 20834 // Remove IV for subsequent blocks 20835 this._iv = undefined; 20836 } else { 20837 keystream = this._prevBlock; 20838 } 20839 cipher.encryptBlock(keystream, 0); 20840 20841 // Encrypt 20842 for (var i = 0; i < blockSize; i++) { 20843 words[offset + i] ^= keystream[i]; 20844 } 20845 } 20846 20847 return CFB; 20848 }()); 20849 20850 20851 /** 20852 * Counter block mode. 20853 */ 20854 CryptoJS.mode.CTR = (function () { 20855 var CTR = CryptoJS.lib.BlockCipherMode.extend(); 20856 20857 var Encryptor = CTR.Encryptor = CTR.extend({ 20858 processBlock: function (words, offset) { 20859 // Shortcuts 20860 var cipher = this._cipher 20861 var blockSize = cipher.blockSize; 20862 var iv = this._iv; 20863 var counter = this._counter; 20864 20865 // Generate keystream 20866 if (iv) { 20867 counter = this._counter = iv.slice(0); 20868 20869 // Remove IV for subsequent blocks 20870 this._iv = undefined; 20871 } 20872 var keystream = counter.slice(0); 20873 cipher.encryptBlock(keystream, 0); 20874 20875 // Increment counter 20876 counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 20877 20878 // Encrypt 20879 for (var i = 0; i < blockSize; i++) { 20880 words[offset + i] ^= keystream[i]; 20881 } 20882 } 20883 }); 20884 20885 CTR.Decryptor = Encryptor; 20886 20887 return CTR; 20888 }()); 20889 20890 20891 /** @preserve 20892 * Counter block mode compatible with Dr Brian Gladman fileenc.c 20893 * derived from CryptoJS.mode.CTR 20894 * Jan Hruby [email protected] 20895 */ 20896 CryptoJS.mode.CTRGladman = (function () { 20897 var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); 20898 20899 function incWord(word) 20900 { 20901 if (((word >> 24) & 0xff) === 0xff) { //overflow 20902 var b1 = (word >> 16)&0xff; 20903 var b2 = (word >> 8)&0xff; 20904 var b3 = word & 0xff; 20905 20906 if (b1 === 0xff) // overflow b1 20907 { 20908 b1 = 0; 20909 if (b2 === 0xff) 20910 { 20911 b2 = 0; 20912 if (b3 === 0xff) 20913 { 20914 b3 = 0; 20915 } 20916 else 20917 { 20918 ++b3; 20919 } 20920 } 20921 else 20922 { 20923 ++b2; 20924 } 20925 } 20926 else 20927 { 20928 ++b1; 20929 } 20930 20931 word = 0; 20932 word += (b1 << 16); 20933 word += (b2 << 8); 20934 word += b3; 20935 } 20936 else 20937 { 20938 word += (0x01 << 24); 20939 } 20940 return word; 20941 } 20942 20943 function incCounter(counter) 20944 { 20945 if ((counter[0] = incWord(counter[0])) === 0) 20946 { 20947 // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 20948 counter[1] = incWord(counter[1]); 20949 } 20950 return counter; 20951 } 20952 20953 var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ 20954 processBlock: function (words, offset) { 20955 // Shortcuts 20956 var cipher = this._cipher 20957 var blockSize = cipher.blockSize; 20958 var iv = this._iv; 20959 var counter = this._counter; 20960 20961 // Generate keystream 20962 if (iv) { 20963 counter = this._counter = iv.slice(0); 20964 20965 // Remove IV for subsequent blocks 20966 this._iv = undefined; 20967 } 20968 20969 incCounter(counter); 20970 20971 var keystream = counter.slice(0); 20972 cipher.encryptBlock(keystream, 0); 20973 20974 // Encrypt 20975 for (var i = 0; i < blockSize; i++) { 20976 words[offset + i] ^= keystream[i]; 20977 } 20978 } 20979 }); 20980 20981 CTRGladman.Decryptor = Encryptor; 20982 20983 return CTRGladman; 20984 }()); 20985 20986 20987 20988 20989 /** 20990 * Output Feedback block mode. 20991 */ 20992 CryptoJS.mode.OFB = (function () { 20993 var OFB = CryptoJS.lib.BlockCipherMode.extend(); 20994 20995 var Encryptor = OFB.Encryptor = OFB.extend({ 20996 processBlock: function (words, offset) { 20997 // Shortcuts 20998 var cipher = this._cipher 20999 var blockSize = cipher.blockSize; 21000 var iv = this._iv; 21001 var keystream = this._keystream; 21002 21003 // Generate keystream 21004 if (iv) { 21005 keystream = this._keystream = iv.slice(0); 21006 21007 // Remove IV for subsequent blocks 21008 this._iv = undefined; 21009 } 21010 cipher.encryptBlock(keystream, 0); 21011 21012 // Encrypt 21013 for (var i = 0; i < blockSize; i++) { 21014 words[offset + i] ^= keystream[i]; 21015 } 21016 } 21017 }); 21018 21019 OFB.Decryptor = Encryptor; 21020 21021 return OFB; 21022 }()); 21023 21024 21025 /** 21026 * Electronic Codebook block mode. 21027 */ 21028 CryptoJS.mode.ECB = (function () { 21029 var ECB = CryptoJS.lib.BlockCipherMode.extend(); 21030 21031 ECB.Encryptor = ECB.extend({ 21032 processBlock: function (words, offset) { 21033 this._cipher.encryptBlock(words, offset); 21034 } 21035 }); 21036 21037 ECB.Decryptor = ECB.extend({ 21038 processBlock: function (words, offset) { 21039 this._cipher.decryptBlock(words, offset); 21040 } 21041 }); 21042 21043 return ECB; 21044 }()); 21045 21046 21047 /** 21048 * ANSI X.923 padding strategy. 21049 */ 21050 CryptoJS.pad.AnsiX923 = { 21051 pad: function (data, blockSize) { 21052 // Shortcuts 21053 var dataSigBytes = data.sigBytes; 21054 var blockSizeBytes = blockSize * 4; 21055 21056 // Count padding bytes 21057 var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; 21058 21059 // Compute last byte position 21060 var lastBytePos = dataSigBytes + nPaddingBytes - 1; 21061 21062 // Pad 21063 data.clamp(); 21064 data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); 21065 data.sigBytes += nPaddingBytes; 21066 }, 21067 21068 unpad: function (data) { 21069 // Get number of padding bytes from last byte 21070 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 21071 21072 // Remove padding 21073 data.sigBytes -= nPaddingBytes; 21074 } 21075 }; 21076 21077 21078 /** 21079 * ISO 10126 padding strategy. 21080 */ 21081 CryptoJS.pad.Iso10126 = { 21082 pad: function (data, blockSize) { 21083 // Shortcut 21084 var blockSizeBytes = blockSize * 4; 21085 21086 // Count padding bytes 21087 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 21088 21089 // Pad 21090 data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). 21091 concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); 21092 }, 21093 21094 unpad: function (data) { 21095 // Get number of padding bytes from last byte 21096 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 21097 21098 // Remove padding 21099 data.sigBytes -= nPaddingBytes; 21100 } 21101 }; 21102 21103 21104 /** 21105 * ISO/IEC 9797-1 Padding Method 2. 21106 */ 21107 CryptoJS.pad.Iso97971 = { 21108 pad: function (data, blockSize) { 21109 // Add 0x80 byte 21110 data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); 21111 21112 // Zero pad the rest 21113 CryptoJS.pad.ZeroPadding.pad(data, blockSize); 21114 }, 21115 21116 unpad: function (data) { 21117 // Remove zero padding 21118 CryptoJS.pad.ZeroPadding.unpad(data); 21119 21120 // Remove one more byte -- the 0x80 byte 21121 data.sigBytes--; 21122 } 21123 }; 21124 21125 21126 /** 21127 * Zero padding strategy. 21128 */ 21129 CryptoJS.pad.ZeroPadding = { 21130 pad: function (data, blockSize) { 21131 // Shortcut 21132 var blockSizeBytes = blockSize * 4; 21133 21134 // Pad 21135 data.clamp(); 21136 data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); 21137 }, 21138 21139 unpad: function (data) { 21140 // Shortcut 21141 var dataWords = data.words; 21142 21143 // Unpad 21144 var i = data.sigBytes - 1; 21145 for (var i = data.sigBytes - 1; i >= 0; i--) { 21146 if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { 21147 data.sigBytes = i + 1; 21148 break; 21149 } 21150 } 21151 } 21152 }; 21153 21154 21155 /** 21156 * A noop padding strategy. 21157 */ 21158 CryptoJS.pad.NoPadding = { 21159 pad: function () { 21160 }, 21161 21162 unpad: function () { 21163 } 21164 }; 21165 21166 21167 (function (undefined) { 21168 // Shortcuts 21169 var C = CryptoJS; 21170 var C_lib = C.lib; 21171 var CipherParams = C_lib.CipherParams; 21172 var C_enc = C.enc; 21173 var Hex = C_enc.Hex; 21174 var C_format = C.format; 21175 21176 var HexFormatter = C_format.Hex = { 21177 /** 21178 * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. 21179 * 21180 * @param {CipherParams} cipherParams The cipher params object. 21181 * 21182 * @return {string} The hexadecimally encoded string. 21183 * 21184 * @static 21185 * 21186 * @example 21187 * 21188 * var hexString = CryptoJS.format.Hex.stringify(cipherParams); 21189 */ 21190 stringify: function (cipherParams) { 21191 return cipherParams.ciphertext.toString(Hex); 21192 }, 21193 21194 /** 21195 * Converts a hexadecimally encoded ciphertext string to a cipher params object. 21196 * 21197 * @param {string} input The hexadecimally encoded string. 21198 * 21199 * @return {CipherParams} The cipher params object. 21200 * 21201 * @static 21202 * 21203 * @example 21204 * 21205 * var cipherParams = CryptoJS.format.Hex.parse(hexString); 21206 */ 21207 parse: function (input) { 21208 var ciphertext = Hex.parse(input); 21209 return CipherParams.create({ ciphertext: ciphertext }); 21210 } 21211 }; 21212 }()); 21213 21214 21215 (function () { 21216 // Shortcuts 21217 var C = CryptoJS; 21218 var C_lib = C.lib; 21219 var BlockCipher = C_lib.BlockCipher; 21220 var C_algo = C.algo; 21221 21222 // Lookup tables 21223 var SBOX = []; 21224 var INV_SBOX = []; 21225 var SUB_MIX_0 = []; 21226 var SUB_MIX_1 = []; 21227 var SUB_MIX_2 = []; 21228 var SUB_MIX_3 = []; 21229 var INV_SUB_MIX_0 = []; 21230 var INV_SUB_MIX_1 = []; 21231 var INV_SUB_MIX_2 = []; 21232 var INV_SUB_MIX_3 = []; 21233 21234 // Compute lookup tables 21235 (function () { 21236 // Compute double table 21237 var d = []; 21238 for (var i = 0; i < 256; i++) { 21239 if (i < 128) { 21240 d[i] = i << 1; 21241 } else { 21242 d[i] = (i << 1) ^ 0x11b; 21243 } 21244 } 21245 21246 // Walk GF(2^8) 21247 var x = 0; 21248 var xi = 0; 21249 for (var i = 0; i < 256; i++) { 21250 // Compute sbox 21251 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); 21252 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; 21253 SBOX[x] = sx; 21254 INV_SBOX[sx] = x; 21255 21256 // Compute multiplication 21257 var x2 = d[x]; 21258 var x4 = d[x2]; 21259 var x8 = d[x4]; 21260 21261 // Compute sub bytes, mix columns tables 21262 var t = (d[sx] * 0x101) ^ (sx * 0x1010100); 21263 SUB_MIX_0[x] = (t << 24) | (t >>> 8); 21264 SUB_MIX_1[x] = (t << 16) | (t >>> 16); 21265 SUB_MIX_2[x] = (t << 8) | (t >>> 24); 21266 SUB_MIX_3[x] = t; 21267 21268 // Compute inv sub bytes, inv mix columns tables 21269 var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); 21270 INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); 21271 INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); 21272 INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); 21273 INV_SUB_MIX_3[sx] = t; 21274 21275 // Compute next counter 21276 if (!x) { 21277 x = xi = 1; 21278 } else { 21279 x = x2 ^ d[d[d[x8 ^ x2]]]; 21280 xi ^= d[d[xi]]; 21281 } 21282 } 21283 }()); 21284 21285 // Precomputed Rcon lookup 21286 var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; 21287 21288 /** 21289 * AES block cipher algorithm. 21290 */ 21291 var AES = C_algo.AES = BlockCipher.extend({ 21292 _doReset: function () { 21293 var t; 21294 21295 // Skip reset of nRounds has been set before and key did not change 21296 if (this._nRounds && this._keyPriorReset === this._key) { 21297 return; 21298 } 21299 21300 // Shortcuts 21301 var key = this._keyPriorReset = this._key; 21302 var keyWords = key.words;
vendor: 2,989 bytes, lines 21303-21376
21303 var keySize = key.sigBytes / 4; 21304 21305 // Compute number of rounds 21306 var nRounds = this._nRounds = keySize + 6; 21307 21308 // Compute number of key schedule rows 21309 var ksRows = (nRounds + 1) * 4; 21310 21311 // Compute key schedule 21312 var keySchedule = this._keySchedule = []; 21313 for (var ksRow = 0; ksRow < ksRows; ksRow++) { 21314 if (ksRow < keySize) { 21315 keySchedule[ksRow] = keyWords[ksRow]; 21316 } else { 21317 t = keySchedule[ksRow - 1]; 21318 21319 if (!(ksRow % keySize)) { 21320 // Rot word 21321 t = (t << 8) | (t >>> 24); 21322 21323 // Sub word 21324 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; 21325 21326 // Mix Rcon 21327 t ^= RCON[(ksRow / keySize) | 0] << 24; 21328 } else if (keySize > 6 && ksRow % keySize == 4) { 21329 // Sub word 21330 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; 21331 } 21332 21333 keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; 21334 } 21335 } 21336 21337 // Compute inv key schedule 21338 var invKeySchedule = this._invKeySchedule = []; 21339 for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { 21340 var ksRow = ksRows - invKsRow; 21341 21342 if (invKsRow % 4) { 21343 var t = keySchedule[ksRow]; 21344 } else { 21345 var t = keySchedule[ksRow - 4]; 21346 } 21347 21348 if (invKsRow < 4 || ksRow <= 4) { 21349 invKeySchedule[invKsRow] = t; 21350 } else { 21351 invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ 21352 INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; 21353 } 21354 } 21355 }, 21356 21357 encryptBlock: function (M, offset) { 21358 this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); 21359 }, 21360 21361 decryptBlock: function (M, offset) { 21362 // Swap 2nd and 4th rows 21363 var t = M[offset + 1]; 21364 M[offset + 1] = M[offset + 3]; 21365 M[offset + 3] = t; 21366 21367 this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); 21368 21369 // Inv swap 2nd and 4th rows 21370 var t = M[offset + 1]; 21371 M[offset + 1] = M[offset + 3]; 21372 M[offset + 3] = t; 21373 }, 21374 21375 _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { 21376 // Shortcut
vendor: 14,827 bytes, lines 21377-21817
21377 var nRounds = this._nRounds; 21378 21379 // Get input, add round key 21380 var s0 = M[offset] ^ keySchedule[0]; 21381 var s1 = M[offset + 1] ^ keySchedule[1]; 21382 var s2 = M[offset + 2] ^ keySchedule[2]; 21383 var s3 = M[offset + 3] ^ keySchedule[3]; 21384 21385 // Key schedule row counter 21386 var ksRow = 4; 21387 21388 // Rounds 21389 for (var round = 1; round < nRounds; round++) { 21390 // Shift rows, sub bytes, mix columns, add round key 21391 var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; 21392 var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; 21393 var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; 21394 var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; 21395 21396 // Update state 21397 s0 = t0; 21398 s1 = t1; 21399 s2 = t2; 21400 s3 = t3; 21401 } 21402 21403 // Shift rows, sub bytes, add round key 21404 var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; 21405 var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; 21406 var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; 21407 var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; 21408 21409 // Set output 21410 M[offset] = t0; 21411 M[offset + 1] = t1; 21412 M[offset + 2] = t2; 21413 M[offset + 3] = t3; 21414 }, 21415 21416 keySize: 256/32 21417 }); 21418 21419 /** 21420 * Shortcut functions to the cipher's object interface. 21421 * 21422 * @example 21423 * 21424 * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); 21425 * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); 21426 */ 21427 C.AES = BlockCipher._createHelper(AES); 21428 }()); 21429 21430 21431 (function () { 21432 // Shortcuts 21433 var C = CryptoJS; 21434 var C_lib = C.lib; 21435 var WordArray = C_lib.WordArray; 21436 var BlockCipher = C_lib.BlockCipher; 21437 var C_algo = C.algo; 21438 21439 // Permuted Choice 1 constants 21440 var PC1 = [ 21441 57, 49, 41, 33, 25, 17, 9, 1, 21442 58, 50, 42, 34, 26, 18, 10, 2, 21443 59, 51, 43, 35, 27, 19, 11, 3, 21444 60, 52, 44, 36, 63, 55, 47, 39, 21445 31, 23, 15, 7, 62, 54, 46, 38, 21446 30, 22, 14, 6, 61, 53, 45, 37, 21447 29, 21, 13, 5, 28, 20, 12, 4 21448 ]; 21449 21450 // Permuted Choice 2 constants 21451 var PC2 = [ 21452 14, 17, 11, 24, 1, 5, 21453 3, 28, 15, 6, 21, 10, 21454 23, 19, 12, 4, 26, 8, 21455 16, 7, 27, 20, 13, 2, 21456 41, 52, 31, 37, 47, 55, 21457 30, 40, 51, 45, 33, 48, 21458 44, 49, 39, 56, 34, 53, 21459 46, 42, 50, 36, 29, 32 21460 ]; 21461 21462 // Cumulative bit shift constants 21463 var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; 21464 21465 // SBOXes and round permutation constants 21466 var SBOX_P = [ 21467 { 21468 0x0: 0x808200, 21469 0x10000000: 0x8000, 21470 0x20000000: 0x808002, 21471 0x30000000: 0x2, 21472 0x40000000: 0x200, 21473 0x50000000: 0x808202, 21474 0x60000000: 0x800202, 21475 0x70000000: 0x800000, 21476 0x80000000: 0x202, 21477 0x90000000: 0x800200, 21478 0xa0000000: 0x8200, 21479 0xb0000000: 0x808000, 21480 0xc0000000: 0x8002, 21481 0xd0000000: 0x800002, 21482 0xe0000000: 0x0, 21483 0xf0000000: 0x8202, 21484 0x8000000: 0x0, 21485 0x18000000: 0x808202, 21486 0x28000000: 0x8202, 21487 0x38000000: 0x8000, 21488 0x48000000: 0x808200, 21489 0x58000000: 0x200, 21490 0x68000000: 0x808002, 21491 0x78000000: 0x2, 21492 0x88000000: 0x800200, 21493 0x98000000: 0x8200, 21494 0xa8000000: 0x808000, 21495 0xb8000000: 0x800202, 21496 0xc8000000: 0x800002, 21497 0xd8000000: 0x8002, 21498 0xe8000000: 0x202, 21499 0xf8000000: 0x800000, 21500 0x1: 0x8000, 21501 0x10000001: 0x2, 21502 0x20000001: 0x808200, 21503 0x30000001: 0x800000, 21504 0x40000001: 0x808002, 21505 0x50000001: 0x8200, 21506 0x60000001: 0x200, 21507 0x70000001: 0x800202, 21508 0x80000001: 0x808202, 21509 0x90000001: 0x808000, 21510 0xa0000001: 0x800002, 21511 0xb0000001: 0x8202, 21512 0xc0000001: 0x202, 21513 0xd0000001: 0x800200, 21514 0xe0000001: 0x8002, 21515 0xf0000001: 0x0, 21516 0x8000001: 0x808202, 21517 0x18000001: 0x808000, 21518 0x28000001: 0x800000, 21519 0x38000001: 0x200, 21520 0x48000001: 0x8000, 21521 0x58000001: 0x800002, 21522 0x68000001: 0x2, 21523 0x78000001: 0x8202, 21524 0x88000001: 0x8002, 21525 0x98000001: 0x800202, 21526 0xa8000001: 0x202, 21527 0xb8000001: 0x808200, 21528 0xc8000001: 0x800200, 21529 0xd8000001: 0x0, 21530 0xe8000001: 0x8200, 21531 0xf8000001: 0x808002 21532 }, 21533 { 21534 0x0: 0x40084010, 21535 0x1000000: 0x4000, 21536 0x2000000: 0x80000, 21537 0x3000000: 0x40080010, 21538 0x4000000: 0x40000010, 21539 0x5000000: 0x40084000, 21540 0x6000000: 0x40004000, 21541 0x7000000: 0x10, 21542 0x8000000: 0x84000, 21543 0x9000000: 0x40004010, 21544 0xa000000: 0x40000000, 21545 0xb000000: 0x84010, 21546 0xc000000: 0x80010, 21547 0xd000000: 0x0, 21548 0xe000000: 0x4010, 21549 0xf000000: 0x40080000, 21550 0x800000: 0x40004000, 21551 0x1800000: 0x84010, 21552 0x2800000: 0x10, 21553 0x3800000: 0x40004010, 21554 0x4800000: 0x40084010, 21555 0x5800000: 0x40000000, 21556 0x6800000: 0x80000, 21557 0x7800000: 0x40080010, 21558 0x8800000: 0x80010, 21559 0x9800000: 0x0, 21560 0xa800000: 0x4000, 21561 0xb800000: 0x40080000, 21562 0xc800000: 0x40000010, 21563 0xd800000: 0x84000, 21564 0xe800000: 0x40084000, 21565 0xf800000: 0x4010, 21566 0x10000000: 0x0, 21567 0x11000000: 0x40080010, 21568 0x12000000: 0x40004010, 21569 0x13000000: 0x40084000, 21570 0x14000000: 0x40080000, 21571 0x15000000: 0x10, 21572 0x16000000: 0x84010, 21573 0x17000000: 0x4000, 21574 0x18000000: 0x4010, 21575 0x19000000: 0x80000, 21576 0x1a000000: 0x80010, 21577 0x1b000000: 0x40000010, 21578 0x1c000000: 0x84000, 21579 0x1d000000: 0x40004000, 21580 0x1e000000: 0x40000000, 21581 0x1f000000: 0x40084010, 21582 0x10800000: 0x84010, 21583 0x11800000: 0x80000, 21584 0x12800000: 0x40080000, 21585 0x13800000: 0x4000, 21586 0x14800000: 0x40004000, 21587 0x15800000: 0x40084010, 21588 0x16800000: 0x10, 21589 0x17800000: 0x40000000, 21590 0x18800000: 0x40084000, 21591 0x19800000: 0x40000010, 21592 0x1a800000: 0x40004010, 21593 0x1b800000: 0x80010, 21594 0x1c800000: 0x0, 21595 0x1d800000: 0x4010, 21596 0x1e800000: 0x40080010, 21597 0x1f800000: 0x84000 21598 }, 21599 { 21600 0x0: 0x104, 21601 0x100000: 0x0, 21602 0x200000: 0x4000100, 21603 0x300000: 0x10104, 21604 0x400000: 0x10004, 21605 0x500000: 0x4000004, 21606 0x600000: 0x4010104, 21607 0x700000: 0x4010000, 21608 0x800000: 0x4000000, 21609 0x900000: 0x4010100, 21610 0xa00000: 0x10100, 21611 0xb00000: 0x4010004, 21612 0xc00000: 0x4000104, 21613 0xd00000: 0x10000, 21614 0xe00000: 0x4, 21615 0xf00000: 0x100, 21616 0x80000: 0x4010100, 21617 0x180000: 0x4010004, 21618 0x280000: 0x0, 21619 0x380000: 0x4000100, 21620 0x480000: 0x4000004, 21621 0x580000: 0x10000, 21622 0x680000: 0x10004, 21623 0x780000: 0x104, 21624 0x880000: 0x4, 21625 0x980000: 0x100, 21626 0xa80000: 0x4010000, 21627 0xb80000: 0x10104, 21628 0xc80000: 0x10100, 21629 0xd80000: 0x4000104, 21630 0xe80000: 0x4010104, 21631 0xf80000: 0x4000000, 21632 0x1000000: 0x4010100, 21633 0x1100000: 0x10004, 21634 0x1200000: 0x10000, 21635 0x1300000: 0x4000100, 21636 0x1400000: 0x100, 21637 0x1500000: 0x4010104, 21638 0x1600000: 0x4000004, 21639 0x1700000: 0x0, 21640 0x1800000: 0x4000104, 21641 0x1900000: 0x4000000, 21642 0x1a00000: 0x4, 21643 0x1b00000: 0x10100, 21644 0x1c00000: 0x4010000, 21645 0x1d00000: 0x104, 21646 0x1e00000: 0x10104, 21647 0x1f00000: 0x4010004, 21648 0x1080000: 0x4000000, 21649 0x1180000: 0x104, 21650 0x1280000: 0x4010100, 21651 0x1380000: 0x0, 21652 0x1480000: 0x10004, 21653 0x1580000: 0x4000100, 21654 0x1680000: 0x100, 21655 0x1780000: 0x4010004, 21656 0x1880000: 0x10000, 21657 0x1980000: 0x4010104, 21658 0x1a80000: 0x10104, 21659 0x1b80000: 0x4000004, 21660 0x1c80000: 0x4000104, 21661 0x1d80000: 0x4010000, 21662 0x1e80000: 0x4, 21663 0x1f80000: 0x10100 21664 }, 21665 { 21666 0x0: 0x80401000, 21667 0x10000: 0x80001040, 21668 0x20000: 0x401040, 21669 0x30000: 0x80400000, 21670 0x40000: 0x0, 21671 0x50000: 0x401000, 21672 0x60000: 0x80000040, 21673 0x70000: 0x400040, 21674 0x80000: 0x80000000, 21675 0x90000: 0x400000, 21676 0xa0000: 0x40, 21677 0xb0000: 0x80001000, 21678 0xc0000: 0x80400040, 21679 0xd0000: 0x1040, 21680 0xe0000: 0x1000, 21681 0xf0000: 0x80401040, 21682 0x8000: 0x80001040, 21683 0x18000: 0x40, 21684 0x28000: 0x80400040, 21685 0x38000: 0x80001000, 21686 0x48000: 0x401000, 21687 0x58000: 0x80401040, 21688 0x68000: 0x0, 21689 0x78000: 0x80400000, 21690 0x88000: 0x1000, 21691 0x98000: 0x80401000, 21692 0xa8000: 0x400000, 21693 0xb8000: 0x1040, 21694 0xc8000: 0x80000000, 21695 0xd8000: 0x400040, 21696 0xe8000: 0x401040, 21697 0xf8000: 0x80000040, 21698 0x100000: 0x400040, 21699 0x110000: 0x401000, 21700 0x120000: 0x80000040, 21701 0x130000: 0x0, 21702 0x140000: 0x1040, 21703 0x150000: 0x80400040, 21704 0x160000: 0x80401000, 21705 0x170000: 0x80001040, 21706 0x180000: 0x80401040, 21707 0x190000: 0x80000000, 21708 0x1a0000: 0x80400000, 21709 0x1b0000: 0x401040, 21710 0x1c0000: 0x80001000, 21711 0x1d0000: 0x400000, 21712 0x1e0000: 0x40, 21713 0x1f0000: 0x1000, 21714 0x108000: 0x80400000, 21715 0x118000: 0x80401040, 21716 0x128000: 0x0, 21717 0x138000: 0x401000, 21718 0x148000: 0x400040, 21719 0x158000: 0x80000000, 21720 0x168000: 0x80001040, 21721 0x178000: 0x40, 21722 0x188000: 0x80000040, 21723 0x198000: 0x1000, 21724 0x1a8000: 0x80001000, 21725 0x1b8000: 0x80400040, 21726 0x1c8000: 0x1040, 21727 0x1d8000: 0x80401000, 21728 0x1e8000: 0x400000, 21729 0x1f8000: 0x401040 21730 }, 21731 { 21732 0x0: 0x80, 21733 0x1000: 0x1040000, 21734 0x2000: 0x40000, 21735 0x3000: 0x20000000, 21736 0x4000: 0x20040080, 21737 0x5000: 0x1000080, 21738 0x6000: 0x21000080, 21739 0x7000: 0x40080, 21740 0x8000: 0x1000000, 21741 0x9000: 0x20040000, 21742 0xa000: 0x20000080, 21743 0xb000: 0x21040080, 21744 0xc000: 0x21040000, 21745 0xd000: 0x0, 21746 0xe000: 0x1040080, 21747 0xf000: 0x21000000, 21748 0x800: 0x1040080, 21749 0x1800: 0x21000080, 21750 0x2800: 0x80, 21751 0x3800: 0x1040000, 21752 0x4800: 0x40000, 21753 0x5800: 0x20040080, 21754 0x6800: 0x21040000, 21755 0x7800: 0x20000000, 21756 0x8800: 0x20040000, 21757 0x9800: 0x0, 21758 0xa800: 0x21040080, 21759 0xb800: 0x1000080, 21760 0xc800: 0x20000080, 21761 0xd800: 0x21000000, 21762 0xe800: 0x1000000, 21763 0xf800: 0x40080, 21764 0x10000: 0x40000, 21765 0x11000: 0x80, 21766 0x12000: 0x20000000, 21767 0x13000: 0x21000080, 21768 0x14000: 0x1000080, 21769 0x15000: 0x21040000, 21770 0x16000: 0x20040080, 21771 0x17000: 0x1000000, 21772 0x18000: 0x21040080, 21773 0x19000: 0x21000000, 21774 0x1a000: 0x1040000, 21775 0x1b000: 0x20040000, 21776 0x1c000: 0x40080, 21777 0x1d000: 0x20000080, 21778 0x1e000: 0x0, 21779 0x1f000: 0x1040080, 21780 0x10800: 0x21000080, 21781 0x11800: 0x1000000, 21782 0x12800: 0x1040000, 21783 0x13800: 0x20040080, 21784 0x14800: 0x20000000, 21785 0x15800: 0x1040080, 21786 0x16800: 0x80, 21787 0x17800: 0x21040000, 21788 0x18800: 0x40080, 21789 0x19800: 0x21040080, 21790 0x1a800: 0x0, 21791 0x1b800: 0x21000000, 21792 0x1c800: 0x1000080, 21793 0x1d800: 0x40000, 21794 0x1e800: 0x20040000, 21795 0x1f800: 0x20000080 21796 }, 21797 { 21798 0x0: 0x10000008, 21799 0x100: 0x2000, 21800 0x200: 0x10200000, 21801 0x300: 0x10202008, 21802 0x400: 0x10002000, 21803 0x500: 0x200000, 21804 0x600: 0x200008, 21805 0x700: 0x10000000, 21806 0x800: 0x0, 21807 0x900: 0x10002008, 21808 0xa00: 0x202000, 21809 0xb00: 0x8, 21810 0xc00: 0x10200008, 21811 0xd00: 0x202008, 21812 0xe00: 0x2008, 21813 0xf00: 0x10202000, 21814 0x80: 0x10200000, 21815 0x180: 0x10202008, 21816 0x280: 0x8, 21817 0x380: 0x200000,
vendor: 9,888 bytes, lines 21818-22131
21818 0x480: 0x202008, 21819 0x580: 0x10000008, 21820 0x680: 0x10002000, 21821 0x780: 0x2008, 21822 0x880: 0x200008, 21823 0x980: 0x2000, 21824 0xa80: 0x10002008, 21825 0xb80: 0x10200008, 21826 0xc80: 0x0, 21827 0xd80: 0x10202000, 21828 0xe80: 0x202000, 21829 0xf80: 0x10000000, 21830 0x1000: 0x10002000, 21831 0x1100: 0x10200008, 21832 0x1200: 0x10202008, 21833 0x1300: 0x2008, 21834 0x1400: 0x200000, 21835 0x1500: 0x10000000, 21836 0x1600: 0x10000008, 21837 0x1700: 0x202000, 21838 0x1800: 0x202008, 21839 0x1900: 0x0, 21840 0x1a00: 0x8, 21841 0x1b00: 0x10200000, 21842 0x1c00: 0x2000, 21843 0x1d00: 0x10002008, 21844 0x1e00: 0x10202000, 21845 0x1f00: 0x200008, 21846 0x1080: 0x8, 21847 0x1180: 0x202000, 21848 0x1280: 0x200000, 21849 0x1380: 0x10000008, 21850 0x1480: 0x10002000, 21851 0x1580: 0x2008, 21852 0x1680: 0x10202008, 21853 0x1780: 0x10200000, 21854 0x1880: 0x10202000, 21855 0x1980: 0x10200008, 21856 0x1a80: 0x2000, 21857 0x1b80: 0x202008, 21858 0x1c80: 0x200008, 21859 0x1d80: 0x0, 21860 0x1e80: 0x10000000, 21861 0x1f80: 0x10002008 21862 }, 21863 { 21864 0x0: 0x100000, 21865 0x10: 0x2000401, 21866 0x20: 0x400, 21867 0x30: 0x100401, 21868 0x40: 0x2100401, 21869 0x50: 0x0, 21870 0x60: 0x1, 21871 0x70: 0x2100001, 21872 0x80: 0x2000400, 21873 0x90: 0x100001, 21874 0xa0: 0x2000001, 21875 0xb0: 0x2100400, 21876 0xc0: 0x2100000, 21877 0xd0: 0x401, 21878 0xe0: 0x100400, 21879 0xf0: 0x2000000, 21880 0x8: 0x2100001, 21881 0x18: 0x0, 21882 0x28: 0x2000401, 21883 0x38: 0x2100400, 21884 0x48: 0x100000, 21885 0x58: 0x2000001, 21886 0x68: 0x2000000, 21887 0x78: 0x401, 21888 0x88: 0x100401, 21889 0x98: 0x2000400, 21890 0xa8: 0x2100000, 21891 0xb8: 0x100001, 21892 0xc8: 0x400, 21893 0xd8: 0x2100401, 21894 0xe8: 0x1, 21895 0xf8: 0x100400, 21896 0x100: 0x2000000, 21897 0x110: 0x100000, 21898 0x120: 0x2000401, 21899 0x130: 0x2100001, 21900 0x140: 0x100001, 21901 0x150: 0x2000400, 21902 0x160: 0x2100400, 21903 0x170: 0x100401, 21904 0x180: 0x401, 21905 0x190: 0x2100401, 21906 0x1a0: 0x100400, 21907 0x1b0: 0x1, 21908 0x1c0: 0x0, 21909 0x1d0: 0x2100000, 21910 0x1e0: 0x2000001, 21911 0x1f0: 0x400, 21912 0x108: 0x100400, 21913 0x118: 0x2000401, 21914 0x128: 0x2100001, 21915 0x138: 0x1, 21916 0x148: 0x2000000, 21917 0x158: 0x100000, 21918 0x168: 0x401, 21919 0x178: 0x2100400, 21920 0x188: 0x2000001, 21921 0x198: 0x2100000, 21922 0x1a8: 0x0, 21923 0x1b8: 0x2100401, 21924 0x1c8: 0x100401, 21925 0x1d8: 0x400, 21926 0x1e8: 0x2000400, 21927 0x1f8: 0x100001 21928 }, 21929 { 21930 0x0: 0x8000820, 21931 0x1: 0x20000, 21932 0x2: 0x8000000, 21933 0x3: 0x20, 21934 0x4: 0x20020, 21935 0x5: 0x8020820, 21936 0x6: 0x8020800, 21937 0x7: 0x800, 21938 0x8: 0x8020000, 21939 0x9: 0x8000800, 21940 0xa: 0x20800, 21941 0xb: 0x8020020, 21942 0xc: 0x820, 21943 0xd: 0x0, 21944 0xe: 0x8000020, 21945 0xf: 0x20820, 21946 0x80000000: 0x800, 21947 0x80000001: 0x8020820, 21948 0x80000002: 0x8000820, 21949 0x80000003: 0x8000000, 21950 0x80000004: 0x8020000, 21951 0x80000005: 0x20800, 21952 0x80000006: 0x20820, 21953 0x80000007: 0x20, 21954 0x80000008: 0x8000020, 21955 0x80000009: 0x820, 21956 0x8000000a: 0x20020, 21957 0x8000000b: 0x8020800, 21958 0x8000000c: 0x0, 21959 0x8000000d: 0x8020020, 21960 0x8000000e: 0x8000800, 21961 0x8000000f: 0x20000, 21962 0x10: 0x20820, 21963 0x11: 0x8020800, 21964 0x12: 0x20, 21965 0x13: 0x800, 21966 0x14: 0x8000800, 21967 0x15: 0x8000020, 21968 0x16: 0x8020020, 21969 0x17: 0x20000, 21970 0x18: 0x0, 21971 0x19: 0x20020, 21972 0x1a: 0x8020000, 21973 0x1b: 0x8000820, 21974 0x1c: 0x8020820, 21975 0x1d: 0x20800, 21976 0x1e: 0x820, 21977 0x1f: 0x8000000, 21978 0x80000010: 0x20000, 21979 0x80000011: 0x800, 21980 0x80000012: 0x8020020, 21981 0x80000013: 0x20820, 21982 0x80000014: 0x20, 21983 0x80000015: 0x8020000, 21984 0x80000016: 0x8000000, 21985 0x80000017: 0x8000820, 21986 0x80000018: 0x8020820, 21987 0x80000019: 0x8000020, 21988 0x8000001a: 0x8000800, 21989 0x8000001b: 0x0, 21990 0x8000001c: 0x20800, 21991 0x8000001d: 0x820, 21992 0x8000001e: 0x20020, 21993 0x8000001f: 0x8020800 21994 } 21995 ]; 21996 21997 // Masks that select the SBOX input 21998 var SBOX_MASK = [ 21999 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 22000 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f 22001 ]; 22002 22003 /** 22004 * DES block cipher algorithm. 22005 */ 22006 var DES = C_algo.DES = BlockCipher.extend({ 22007 _doReset: function () { 22008 // Shortcuts 22009 var key = this._key; 22010 var keyWords = key.words; 22011 22012 // Select 56 bits according to PC1 22013 var keyBits = []; 22014 for (var i = 0; i < 56; i++) { 22015 var keyBitPos = PC1[i] - 1; 22016 keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; 22017 } 22018 22019 // Assemble 16 subkeys 22020 var subKeys = this._subKeys = []; 22021 for (var nSubKey = 0; nSubKey < 16; nSubKey++) { 22022 // Create subkey 22023 var subKey = subKeys[nSubKey] = []; 22024 22025 // Shortcut 22026 var bitShift = BIT_SHIFTS[nSubKey]; 22027 22028 // Select 48 bits according to PC2 22029 for (var i = 0; i < 24; i++) { 22030 // Select from the left 28 key bits 22031 subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); 22032 22033 // Select from the right 28 key bits 22034 subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); 22035 } 22036 22037 // Since each subkey is applied to an expanded 32-bit input, 22038 // the subkey can be broken into 8 values scaled to 32-bits, 22039 // which allows the key to be used without expansion 22040 subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); 22041 for (var i = 1; i < 7; i++) { 22042 subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); 22043 } 22044 subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); 22045 } 22046 22047 // Compute inverse subkeys 22048 var invSubKeys = this._invSubKeys = []; 22049 for (var i = 0; i < 16; i++) { 22050 invSubKeys[i] = subKeys[15 - i]; 22051 } 22052 }, 22053 22054 encryptBlock: function (M, offset) { 22055 this._doCryptBlock(M, offset, this._subKeys); 22056 }, 22057 22058 decryptBlock: function (M, offset) { 22059 this._doCryptBlock(M, offset, this._invSubKeys); 22060 }, 22061 22062 _doCryptBlock: function (M, offset, subKeys) { 22063 // Get input 22064 this._lBlock = M[offset]; 22065 this._rBlock = M[offset + 1]; 22066 22067 // Initial permutation 22068 exchangeLR.call(this, 4, 0x0f0f0f0f); 22069 exchangeLR.call(this, 16, 0x0000ffff); 22070 exchangeRL.call(this, 2, 0x33333333); 22071 exchangeRL.call(this, 8, 0x00ff00ff); 22072 exchangeLR.call(this, 1, 0x55555555); 22073 22074 // Rounds 22075 for (var round = 0; round < 16; round++) { 22076 // Shortcuts 22077 var subKey = subKeys[round]; 22078 var lBlock = this._lBlock; 22079 var rBlock = this._rBlock; 22080 22081 // Feistel function 22082 var f = 0; 22083 for (var i = 0; i < 8; i++) { 22084 f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; 22085 } 22086 this._lBlock = rBlock; 22087 this._rBlock = lBlock ^ f; 22088 } 22089 22090 // Undo swap from last round 22091 var t = this._lBlock; 22092 this._lBlock = this._rBlock; 22093 this._rBlock = t; 22094 22095 // Final permutation 22096 exchangeLR.call(this, 1, 0x55555555); 22097 exchangeRL.call(this, 8, 0x00ff00ff); 22098 exchangeRL.call(this, 2, 0x33333333); 22099 exchangeLR.call(this, 16, 0x0000ffff); 22100 exchangeLR.call(this, 4, 0x0f0f0f0f); 22101 22102 // Set output 22103 M[offset] = this._lBlock; 22104 M[offset + 1] = this._rBlock; 22105 }, 22106 22107 keySize: 64/32, 22108 22109 ivSize: 64/32, 22110 22111 blockSize: 64/32 22112 }); 22113 22114 // Swap bits across the left and right words 22115 function exchangeLR(offset, mask) { 22116 var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; 22117 this._rBlock ^= t; 22118 this._lBlock ^= t << offset; 22119 } 22120 22121 function exchangeRL(offset, mask) { 22122 var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; 22123 this._lBlock ^= t; 22124 this._rBlock ^= t << offset; 22125 } 22126 22127 /** 22128 * Shortcut functions to the cipher's object interface. 22129 * 22130 * @example 22131 *
vendor: 38,179 bytes, lines 22132-23114
22132 * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); 22133 * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); 22134 */ 22135 C.DES = BlockCipher._createHelper(DES); 22136 22137 /** 22138 * Triple-DES block cipher algorithm. 22139 */ 22140 var TripleDES = C_algo.TripleDES = BlockCipher.extend({ 22141 _doReset: function () { 22142 // Shortcuts 22143 var key = this._key; 22144 var keyWords = key.words; 22145 // Make sure the key length is valid (64, 128 or >= 192 bit) 22146 if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) { 22147 throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.'); 22148 } 22149 22150 // Extend the key according to the keying options defined in 3DES standard 22151 var key1 = keyWords.slice(0, 2); 22152 var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4); 22153 var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6); 22154 22155 // Create DES instances 22156 this._des1 = DES.createEncryptor(WordArray.create(key1)); 22157 this._des2 = DES.createEncryptor(WordArray.create(key2)); 22158 this._des3 = DES.createEncryptor(WordArray.create(key3)); 22159 }, 22160 22161 encryptBlock: function (M, offset) { 22162 this._des1.encryptBlock(M, offset); 22163 this._des2.decryptBlock(M, offset); 22164 this._des3.encryptBlock(M, offset); 22165 }, 22166 22167 decryptBlock: function (M, offset) { 22168 this._des3.decryptBlock(M, offset); 22169 this._des2.encryptBlock(M, offset); 22170 this._des1.decryptBlock(M, offset); 22171 }, 22172 22173 keySize: 192/32, 22174 22175 ivSize: 64/32, 22176 22177 blockSize: 64/32 22178 }); 22179 22180 /** 22181 * Shortcut functions to the cipher's object interface. 22182 * 22183 * @example 22184 * 22185 * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); 22186 * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); 22187 */ 22188 C.TripleDES = BlockCipher._createHelper(TripleDES); 22189 }()); 22190 22191 22192 (function () { 22193 // Shortcuts 22194 var C = CryptoJS; 22195 var C_lib = C.lib; 22196 var StreamCipher = C_lib.StreamCipher; 22197 var C_algo = C.algo; 22198 22199 /** 22200 * RC4 stream cipher algorithm. 22201 */ 22202 var RC4 = C_algo.RC4 = StreamCipher.extend({ 22203 _doReset: function () { 22204 // Shortcuts 22205 var key = this._key; 22206 var keyWords = key.words; 22207 var keySigBytes = key.sigBytes; 22208 22209 // Init sbox 22210 var S = this._S = []; 22211 for (var i = 0; i < 256; i++) { 22212 S[i] = i; 22213 } 22214 22215 // Key setup 22216 for (var i = 0, j = 0; i < 256; i++) { 22217 var keyByteIndex = i % keySigBytes; 22218 var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; 22219 22220 j = (j + S[i] + keyByte) % 256; 22221 22222 // Swap 22223 var t = S[i]; 22224 S[i] = S[j]; 22225 S[j] = t; 22226 } 22227 22228 // Counters 22229 this._i = this._j = 0; 22230 }, 22231 22232 _doProcessBlock: function (M, offset) { 22233 M[offset] ^= generateKeystreamWord.call(this); 22234 }, 22235 22236 keySize: 256/32, 22237 22238 ivSize: 0 22239 }); 22240 22241 function generateKeystreamWord() { 22242 // Shortcuts 22243 var S = this._S; 22244 var i = this._i; 22245 var j = this._j; 22246 22247 // Generate keystream word 22248 var keystreamWord = 0; 22249 for (var n = 0; n < 4; n++) { 22250 i = (i + 1) % 256; 22251 j = (j + S[i]) % 256; 22252 22253 // Swap 22254 var t = S[i]; 22255 S[i] = S[j]; 22256 S[j] = t; 22257 22258 keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); 22259 } 22260 22261 // Update counters 22262 this._i = i; 22263 this._j = j; 22264 22265 return keystreamWord; 22266 } 22267 22268 /** 22269 * Shortcut functions to the cipher's object interface. 22270 * 22271 * @example 22272 * 22273 * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); 22274 * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); 22275 */ 22276 C.RC4 = StreamCipher._createHelper(RC4); 22277 22278 /** 22279 * Modified RC4 stream cipher algorithm. 22280 */ 22281 var RC4Drop = C_algo.RC4Drop = RC4.extend({ 22282 /** 22283 * Configuration options. 22284 * 22285 * @property {number} drop The number of keystream words to drop. Default 192 22286 */ 22287 cfg: RC4.cfg.extend({ 22288 drop: 192 22289 }), 22290 22291 _doReset: function () { 22292 RC4._doReset.call(this); 22293 22294 // Drop 22295 for (var i = this.cfg.drop; i > 0; i--) { 22296 generateKeystreamWord.call(this); 22297 } 22298 } 22299 }); 22300 22301 /** 22302 * Shortcut functions to the cipher's object interface. 22303 * 22304 * @example 22305 * 22306 * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); 22307 * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); 22308 */ 22309 C.RC4Drop = StreamCipher._createHelper(RC4Drop); 22310 }()); 22311 22312 22313 (function () { 22314 // Shortcuts 22315 var C = CryptoJS; 22316 var C_lib = C.lib; 22317 var StreamCipher = C_lib.StreamCipher; 22318 var C_algo = C.algo; 22319 22320 // Reusable objects 22321 var S = []; 22322 var C_ = []; 22323 var G = []; 22324 22325 /** 22326 * Rabbit stream cipher algorithm 22327 */ 22328 var Rabbit = C_algo.Rabbit = StreamCipher.extend({ 22329 _doReset: function () { 22330 // Shortcuts 22331 var K = this._key.words; 22332 var iv = this.cfg.iv; 22333 22334 // Swap endian 22335 for (var i = 0; i < 4; i++) { 22336 K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | 22337 (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); 22338 } 22339 22340 // Generate initial state values 22341 var X = this._X = [ 22342 K[0], (K[3] << 16) | (K[2] >>> 16), 22343 K[1], (K[0] << 16) | (K[3] >>> 16), 22344 K[2], (K[1] << 16) | (K[0] >>> 16), 22345 K[3], (K[2] << 16) | (K[1] >>> 16) 22346 ]; 22347 22348 // Generate initial counter values 22349 var C = this._C = [ 22350 (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), 22351 (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), 22352 (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), 22353 (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) 22354 ]; 22355 22356 // Carry bit 22357 this._b = 0; 22358 22359 // Iterate the system four times 22360 for (var i = 0; i < 4; i++) { 22361 nextState.call(this); 22362 } 22363 22364 // Modify the counters 22365 for (var i = 0; i < 8; i++) { 22366 C[i] ^= X[(i + 4) & 7]; 22367 } 22368 22369 // IV setup 22370 if (iv) { 22371 // Shortcuts 22372 var IV = iv.words; 22373 var IV_0 = IV[0]; 22374 var IV_1 = IV[1]; 22375 22376 // Generate four subvectors 22377 var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); 22378 var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); 22379 var i1 = (i0 >>> 16) | (i2 & 0xffff0000); 22380 var i3 = (i2 << 16) | (i0 & 0x0000ffff); 22381 22382 // Modify counter values 22383 C[0] ^= i0; 22384 C[1] ^= i1; 22385 C[2] ^= i2; 22386 C[3] ^= i3; 22387 C[4] ^= i0; 22388 C[5] ^= i1; 22389 C[6] ^= i2; 22390 C[7] ^= i3; 22391 22392 // Iterate the system four times 22393 for (var i = 0; i < 4; i++) { 22394 nextState.call(this); 22395 } 22396 } 22397 }, 22398 22399 _doProcessBlock: function (M, offset) { 22400 // Shortcut 22401 var X = this._X; 22402 22403 // Iterate the system 22404 nextState.call(this); 22405 22406 // Generate four keystream words 22407 S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); 22408 S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); 22409 S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); 22410 S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); 22411 22412 for (var i = 0; i < 4; i++) { 22413 // Swap endian 22414 S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | 22415 (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); 22416 22417 // Encrypt 22418 M[offset + i] ^= S[i]; 22419 } 22420 }, 22421 22422 blockSize: 128/32, 22423 22424 ivSize: 64/32 22425 }); 22426 22427 function nextState() { 22428 // Shortcuts 22429 var X = this._X; 22430 var C = this._C; 22431 22432 // Save old counter values 22433 for (var i = 0; i < 8; i++) { 22434 C_[i] = C[i]; 22435 } 22436 22437 // Calculate new counter values 22438 C[0] = (C[0] + 0x4d34d34d + this._b) | 0; 22439 C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; 22440 C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; 22441 C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; 22442 C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; 22443 C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; 22444 C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; 22445 C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; 22446 this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; 22447 22448 // Calculate the g-values 22449 for (var i = 0; i < 8; i++) { 22450 var gx = X[i] + C[i]; 22451 22452 // Construct high and low argument for squaring 22453 var ga = gx & 0xffff; 22454 var gb = gx >>> 16; 22455 22456 // Calculate high and low result of squaring 22457 var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; 22458 var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); 22459 22460 // High XOR low 22461 G[i] = gh ^ gl; 22462 } 22463 22464 // Calculate new state values 22465 X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; 22466 X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; 22467 X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; 22468 X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; 22469 X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; 22470 X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; 22471 X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; 22472 X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; 22473 } 22474 22475 /** 22476 * Shortcut functions to the cipher's object interface. 22477 * 22478 * @example 22479 * 22480 * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); 22481 * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); 22482 */ 22483 C.Rabbit = StreamCipher._createHelper(Rabbit); 22484 }()); 22485 22486 22487 (function () { 22488 // Shortcuts 22489 var C = CryptoJS; 22490 var C_lib = C.lib; 22491 var StreamCipher = C_lib.StreamCipher; 22492 var C_algo = C.algo; 22493 22494 // Reusable objects 22495 var S = []; 22496 var C_ = []; 22497 var G = []; 22498 22499 /** 22500 * Rabbit stream cipher algorithm. 22501 * 22502 * This is a legacy version that neglected to convert the key to little-endian. 22503 * This error doesn't affect the cipher's security, 22504 * but it does affect its compatibility with other implementations. 22505 */ 22506 var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ 22507 _doReset: function () { 22508 // Shortcuts 22509 var K = this._key.words; 22510 var iv = this.cfg.iv; 22511 22512 // Generate initial state values 22513 var X = this._X = [ 22514 K[0], (K[3] << 16) | (K[2] >>> 16), 22515 K[1], (K[0] << 16) | (K[3] >>> 16), 22516 K[2], (K[1] << 16) | (K[0] >>> 16), 22517 K[3], (K[2] << 16) | (K[1] >>> 16) 22518 ]; 22519 22520 // Generate initial counter values 22521 var C = this._C = [ 22522 (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), 22523 (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), 22524 (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), 22525 (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) 22526 ]; 22527 22528 // Carry bit 22529 this._b = 0; 22530 22531 // Iterate the system four times 22532 for (var i = 0; i < 4; i++) { 22533 nextState.call(this); 22534 } 22535 22536 // Modify the counters 22537 for (var i = 0; i < 8; i++) { 22538 C[i] ^= X[(i + 4) & 7]; 22539 } 22540 22541 // IV setup 22542 if (iv) { 22543 // Shortcuts 22544 var IV = iv.words; 22545 var IV_0 = IV[0]; 22546 var IV_1 = IV[1]; 22547 22548 // Generate four subvectors 22549 var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); 22550 var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); 22551 var i1 = (i0 >>> 16) | (i2 & 0xffff0000); 22552 var i3 = (i2 << 16) | (i0 & 0x0000ffff); 22553 22554 // Modify counter values 22555 C[0] ^= i0; 22556 C[1] ^= i1; 22557 C[2] ^= i2; 22558 C[3] ^= i3; 22559 C[4] ^= i0; 22560 C[5] ^= i1; 22561 C[6] ^= i2; 22562 C[7] ^= i3; 22563 22564 // Iterate the system four times 22565 for (var i = 0; i < 4; i++) { 22566 nextState.call(this); 22567 } 22568 } 22569 }, 22570 22571 _doProcessBlock: function (M, offset) { 22572 // Shortcut 22573 var X = this._X; 22574 22575 // Iterate the system 22576 nextState.call(this); 22577 22578 // Generate four keystream words 22579 S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); 22580 S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); 22581 S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); 22582 S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); 22583 22584 for (var i = 0; i < 4; i++) { 22585 // Swap endian 22586 S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | 22587 (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); 22588 22589 // Encrypt 22590 M[offset + i] ^= S[i]; 22591 } 22592 }, 22593 22594 blockSize: 128/32, 22595 22596 ivSize: 64/32 22597 }); 22598 22599 function nextState() { 22600 // Shortcuts 22601 var X = this._X; 22602 var C = this._C; 22603 22604 // Save old counter values 22605 for (var i = 0; i < 8; i++) { 22606 C_[i] = C[i]; 22607 } 22608 22609 // Calculate new counter values 22610 C[0] = (C[0] + 0x4d34d34d + this._b) | 0; 22611 C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; 22612 C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; 22613 C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; 22614 C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; 22615 C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; 22616 C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; 22617 C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; 22618 this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; 22619 22620 // Calculate the g-values 22621 for (var i = 0; i < 8; i++) { 22622 var gx = X[i] + C[i]; 22623 22624 // Construct high and low argument for squaring 22625 var ga = gx & 0xffff; 22626 var gb = gx >>> 16; 22627 22628 // Calculate high and low result of squaring 22629 var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; 22630 var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); 22631 22632 // High XOR low 22633 G[i] = gh ^ gl; 22634 } 22635 22636 // Calculate new state values 22637 X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; 22638 X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; 22639 X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; 22640 X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; 22641 X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; 22642 X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; 22643 X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; 22644 X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; 22645 } 22646 22647 /** 22648 * Shortcut functions to the cipher's object interface. 22649 * 22650 * @example 22651 * 22652 * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); 22653 * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); 22654 */ 22655 C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); 22656 }()); 22657 22658 22659 (function () { 22660 // Shortcuts 22661 var C = CryptoJS; 22662 var C_lib = C.lib; 22663 var BlockCipher = C_lib.BlockCipher; 22664 var C_algo = C.algo; 22665 22666 const N = 16; 22667 22668 //Origin pbox and sbox, derived from PI 22669 const ORIG_P = [ 22670 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 22671 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, 22672 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 22673 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917, 22674 0x9216D5D9, 0x8979FB1B 22675 ]; 22676 22677 const ORIG_S = [ 22678 [ 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 22679 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99, 22680 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 22681 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E, 22682 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 22683 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013, 22684 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 22685 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E, 22686 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 22687 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440, 22688 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 22689 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A, 22690 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 22691 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677, 22692 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 22693 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032, 22694 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 22695 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239, 22696 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 22697 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0, 22698 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 22699 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98, 22700 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 22701 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE, 22702 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 22703 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D, 22704 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 22705 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7, 22706 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 22707 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463, 22708 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F, 22709 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09, 22710 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3, 22711 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB, 22712 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279, 22713 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8, 22714 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB, 22715 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82, 22716 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB, 22717 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573, 22718 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0, 22719 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B, 22720 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790, 22721 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8, 22722 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4, 22723 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0, 22724 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7, 22725 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C, 22726 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD, 22727 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1, 22728 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299, 22729 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9, 22730 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477, 22731 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF, 22732 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49, 22733 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF, 22734 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA, 22735 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5, 22736 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41, 22737 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915, 22738 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400, 22739 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915, 22740 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664, 22741 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A ], 22742 [ 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623, 22743 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266, 22744 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1, 22745 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E, 22746 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6, 22747 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1, 22748 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E, 22749 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1, 22750 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737, 22751 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8, 22752 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF, 22753 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD, 22754 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701, 22755 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7, 22756 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41, 22757 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331, 22758 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF, 22759 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF, 22760 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E, 22761 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87, 22762 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C, 22763 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2, 22764 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16, 22765 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD, 22766 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B, 22767 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509, 22768 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E, 22769 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3, 22770 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F, 22771 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A, 22772 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4, 22773 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960, 22774 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66, 22775 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28, 22776 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802, 22777 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84, 22778 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510, 22779 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF, 22780 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14, 22781 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E, 22782 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50, 22783 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7, 22784 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8, 22785 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281, 22786 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99, 22787 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696, 22788 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128, 22789 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73, 22790 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0, 22791 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0, 22792 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105, 22793 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250, 22794 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3, 22795 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285, 22796 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00, 22797 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061, 22798 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB, 22799 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E, 22800 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735, 22801 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC, 22802 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9, 22803 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340, 22804 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20, 22805 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7 ], 22806 [ 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934, 22807 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068, 22808 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF, 22809 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840, 22810 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45, 22811 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504, 22812 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A, 22813 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB, 22814 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE, 22815 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6, 22816 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42, 22817 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B, 22818 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2, 22819 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB, 22820 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527, 22821 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B, 22822 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33, 22823 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C, 22824 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3, 22825 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC, 22826 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17, 22827 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564, 22828 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B, 22829 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115, 22830 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922, 22831 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728, 22832 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0, 22833 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E, 22834 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37, 22835 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D, 22836 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804, 22837 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B, 22838 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3, 22839 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB, 22840 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D, 22841 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C, 22842 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350, 22843 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9, 22844 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A, 22845 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE, 22846 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D, 22847 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC, 22848 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F, 22849 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61, 22850 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2, 22851 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9, 22852 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2, 22853 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C, 22854 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E, 22855 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633, 22856 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10, 22857 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169, 22858 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52, 22859 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027, 22860 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5, 22861 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62, 22862 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634, 22863 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76, 22864 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24, 22865 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC, 22866 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4, 22867 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C, 22868 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837, 22869 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0 ], 22870 [ 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B, 22871 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE, 22872 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B, 22873 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4, 22874 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8, 22875 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6, 22876 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304, 22877 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22, 22878 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4, 22879 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6, 22880 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9, 22881 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59, 22882 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593, 22883 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51, 22884 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28, 22885 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C, 22886 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B, 22887 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28, 22888 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C, 22889 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD, 22890 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A, 22891 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319, 22892 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB, 22893 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F, 22894 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991, 22895 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32, 22896 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680, 22897 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166, 22898 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE, 22899 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB, 22900 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5, 22901 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47, 22902 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370, 22903 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D, 22904 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84, 22905 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048, 22906 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8, 22907 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD, 22908 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9, 22909 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7, 22910 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38, 22911 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F, 22912 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C, 22913 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525, 22914 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1, 22915 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442, 22916 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964, 22917 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E, 22918 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8, 22919 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D, 22920 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F, 22921 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299, 22922 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02, 22923 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC, 22924 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614, 22925 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A, 22926 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6, 22927 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B, 22928 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0, 22929 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060, 22930 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E, 22931 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9, 22932 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F, 22933 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6 ] 22934 ]; 22935 22936 var BLOWFISH_CTX = { 22937 pbox: [], 22938 sbox: [] 22939 } 22940 22941 function F(ctx, x){ 22942 let a = (x >> 24) & 0xFF; 22943 let b = (x >> 16) & 0xFF; 22944 let c = (x >> 8) & 0xFF; 22945 let d = x & 0xFF; 22946 22947 let y = ctx.sbox[0][a] + ctx.sbox[1][b]; 22948 y = y ^ ctx.sbox[2][c]; 22949 y = y + ctx.sbox[3][d]; 22950 22951 return y; 22952 } 22953 22954 function BlowFish_Encrypt(ctx, left, right){ 22955 let Xl = left; 22956 let Xr = right; 22957 let temp; 22958 22959 for(let i = 0; i < N; ++i){ 22960 Xl = Xl ^ ctx.pbox[i]; 22961 Xr = F(ctx, Xl) ^ Xr; 22962 22963 temp = Xl; 22964 Xl = Xr; 22965 Xr = temp; 22966 } 22967 22968 temp = Xl; 22969 Xl = Xr; 22970 Xr = temp; 22971 22972 Xr = Xr ^ ctx.pbox[N]; 22973 Xl = Xl ^ ctx.pbox[N + 1]; 22974 22975 return {left: Xl, right: Xr}; 22976 } 22977 22978 function BlowFish_Decrypt(ctx, left, right){ 22979 let Xl = left; 22980 let Xr = right; 22981 let temp; 22982 22983 for(let i = N + 1; i > 1; --i){ 22984 Xl = Xl ^ ctx.pbox[i]; 22985 Xr = F(ctx, Xl) ^ Xr; 22986 22987 temp = Xl; 22988 Xl = Xr; 22989 Xr = temp; 22990 } 22991 22992 temp = Xl; 22993 Xl = Xr; 22994 Xr = temp; 22995 22996 Xr = Xr ^ ctx.pbox[1]; 22997 Xl = Xl ^ ctx.pbox[0]; 22998 22999 return {left: Xl, right: Xr}; 23000 } 23001 23002 /** 23003 * Initialization ctx's pbox and sbox. 23004 * 23005 * @param {Object} ctx The object has pbox and sbox. 23006 * @param {Array} key An array of 32-bit words. 23007 * @param {int} keysize The length of the key. 23008 * 23009 * @example 23010 * 23011 * BlowFishInit(BLOWFISH_CTX, key, 128/32); 23012 */ 23013 function BlowFishInit(ctx, key, keysize) 23014 { 23015 for(let Row = 0; Row < 4; Row++) 23016 { 23017 ctx.sbox[Row] = []; 23018 for(let Col = 0; Col < 256; Col++) 23019 { 23020 ctx.sbox[Row][Col] = ORIG_S[Row][Col]; 23021 } 23022 } 23023 23024 let keyIndex = 0; 23025 for(let index = 0; index < N + 2; index++) 23026 { 23027 ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex]; 23028 keyIndex++; 23029 if(keyIndex >= keysize) 23030 { 23031 keyIndex = 0; 23032 } 23033 } 23034 23035 let Data1 = 0; 23036 let Data2 = 0; 23037 let res = 0; 23038 for(let i = 0; i < N + 2; i += 2) 23039 { 23040 res = BlowFish_Encrypt(ctx, Data1, Data2); 23041 Data1 = res.left; 23042 Data2 = res.right; 23043 ctx.pbox[i] = Data1; 23044 ctx.pbox[i + 1] = Data2; 23045 } 23046 23047 for(let i = 0; i < 4; i++) 23048 { 23049 for(let j = 0; j < 256; j += 2) 23050 { 23051 res = BlowFish_Encrypt(ctx, Data1, Data2); 23052 Data1 = res.left; 23053 Data2 = res.right; 23054 ctx.sbox[i][j] = Data1; 23055 ctx.sbox[i][j + 1] = Data2; 23056 } 23057 } 23058 23059 return true; 23060 } 23061 23062 /** 23063 * Blowfish block cipher algorithm. 23064 */ 23065 var Blowfish = C_algo.Blowfish = BlockCipher.extend({ 23066 _doReset: function () { 23067 // Skip reset of nRounds has been set before and key did not change 23068 if (this._keyPriorReset === this._key) { 23069 return; 23070 } 23071 23072 // Shortcuts 23073 var key = this._keyPriorReset = this._key; 23074 var keyWords = key.words; 23075 var keySize = key.sigBytes / 4; 23076 23077 //Initialization pbox and sbox 23078 BlowFishInit(BLOWFISH_CTX, keyWords, keySize); 23079 }, 23080 23081 encryptBlock: function (M, offset) { 23082 var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]); 23083 M[offset] = res.left; 23084 M[offset + 1] = res.right; 23085 }, 23086 23087 decryptBlock: function (M, offset) { 23088 var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]); 23089 M[offset] = res.left; 23090 M[offset + 1] = res.right; 23091 }, 23092 23093 blockSize: 64/32, 23094 23095 keySize: 128/32, 23096 23097 ivSize: 64/32 23098 }); 23099 23100 /** 23101 * Shortcut functions to the cipher's object interface. 23102 * 23103 * @example 23104 * 23105 * var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg); 23106 * var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg); 23107 */ 23108 C.Blowfish = BlockCipher._createHelper(Blowfish); 23109 }()); 23110 23111 23112 return CryptoJS; 23113 23114}));
23114 23115// ==ClosureCompiler== 23116// @compilation_level ADVANCED_OPTIMIZATIONS 23117// @externs_url https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/maps/google_maps_api_v3.js 23118// ==/ClosureCompiler== 23119 23120/** 23121 * @name Gmaps MarkerClusterer for Google Maps v3 23122 * @version version 1.2.0 23123 * @author Luke Mahe 23124 * @author Sebastian Hösl <[email protected]> 23125 * @fileoverview 23126 * The library creates and manages per-zoom-level clusters for large amounts of 23127 * markers. 23128 * This is a v3 implementation of the v2 MarkerClusterer 23129 * {@link http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/} 23130 * ></a>. 23131 */ 23132 23133/** 23134 * @license 23135 * 23136 * Licensed under the Apache License, Version 2.0 (the "License"); 23137 * you may not use this file except in compliance with the License. 23138 * You may obtain a copy of the License at 23139 * 23140 * http://www.apache.org/licenses/LICENSE-2.0 23141 * 23142 * Unless required by applicable law or agreed to in writing, software 23143 * distributed under the License is distributed on an "AS IS" BASIS, 23144 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23145 * See the License for the specific language governing permissions and 23146 * limitations under the License. 23147 */ 23148 23149/** 23150 * A Marker Clusterer that clusters markers. 23151 * 23152 * @param {google.maps.Map} map The Google map to attach to. 23153 * @param {Array.<google.maps.Marker>=} opt_markers Optional markers to add to 23154 * the cluster. 23155 * @param {Object=} opt_options support the following options: 23156 * 'gridSize': (number) The grid size of a cluster in pixels. 23157 * 'maxZoom': (number) The maximum zoom level that a marker can be part of a 23158 * cluster. 23159 * 'zoomOnClick': (boolean) Whether the default behaviour of clicking on a 23160 * cluster is to zoom into it. 23161 * 'averageCenter': (boolean) Whether the center of each cluster should be 23162 * the average of all markers in the cluster. 23163 * 'minimumClusterSize': (number) The minimum number of markers to be in a 23164 * cluster before the markers are hidden and a count 23165 * is shown. 23166 * 'ignoreHiddenMarkers': (boolean) Whether to ignore markers that are not 23167 * visible or count and cluster them anyway 23168 * 'styles': (Array) An array of objects with these properties: 23169 * 'url': (string) The image url. 23170 * 'height': (number) The image height. 23171 * 'width': (number) The image width. 23172 * 'anchor': (Array) The anchor position of the label text. 23173 * 'textColor': (string) The text color. 23174 * 'textSize': (number) The text size. 23175 * 'backgroundPosition': (string) The position of the backgound x, y. 23176 * 'iconAnchor': (Array) The anchor position of the icon x, y. 23177 * 'cssClass': (string) One or more CSS class for styling this marker. 23178 * 'onMouseoverCluster': (function) The event handler used for onmouseover 23179 * each cluster 23180 * 'onMouseoutCluster': (function) The event handler used for onmouseout 23181 * each cluster 23182 * 'drawCluster': (function) Custom draw method for ClusterIcon 23183 * 'hideCluster': (function) Custom hide method for ClusterIcon 23184 * 'showCluster': (function) Custom hide method for ClusterIcon 23185 * 'onAddCluster': (function) Custom onAdd method for ClusterIcon 23186 * 'onRemoveCluster': (function) Custom onRemove method for ClusterIcon 23187 * @constructor 23188 * @extends google.maps.OverlayView 23189 */ 23190function MarkerClusterer(map, opt_markers, opt_options) { 23191 // MarkerClusterer implements google.maps.OverlayView interface. We use the 23192 // extend function to extend MarkerClusterer with google.maps.OverlayView 23193 // because it might not always be available when the code is defined so we 23194 // look for it at the last possible moment. If it doesn't exist now then 23195 // there is no point going ahead :) 23196 this.extend(MarkerClusterer, google.maps.OverlayView); 23197 this.map_ = map; 23198 23199 /** 23200 * @type {Array.<google.maps.Marker>} 23201 * @private 23202 */ 23203 this.markers_ = []; 23204 23205 /** 23206 * @type {Array.<Cluster>} 23207 */
23208 this.clusters_ = []; 23209 23210 /** 23211 * @type {Object} holding information about every markers cluster 23212 */ 23213 this.markersCluster_ = {}; 23214 23215 /** 23216 * @type {Number} Unique markers ID 23217 */ 23218 this.markersUniqueID = 1; 23219 23220 this.sizes = [53, 56, 66, 78, 90]; 23221 23222 /** 23223 * @private 23224 */ 23225 this.styles_ = []; 23226 23227 /** 23228 * @private 23229 */ 23230 this.cssClass_ = ''; 23231 23232 /** 23233 * @private 23234 * @type {string} Set a default Cluster Class 23235 */ 23236 this.cssDefaultClass_ = 'cluster'; 23237 23238 /** 23239 * @private 23240 */ 23241 this.setIndex_ = 0; 23242 23243 /** 23244 * @type {boolean} 23245 * @private 23246 */ 23247 this.ready_ = false; 23248 23249 var options = opt_options || {}; 23250 23251 /** 23252 * @type {number} 23253 * @private 23254 */ 23255 this.gridSize_ = (options['gridSize'] !== undefined) ? options['gridSize'] : 60; 23256 23257 /** 23258 * @private 23259 */ 23260 this.minClusterSize_ = options['minimumClusterSize'] || 2; 23261 23262 /** 23263 * @type {boolean} 23264 * @private 23265 */ 23266 this.ignoreHiddenMarkers_ = options['ignoreHiddenMarkers'] || false; 23267 23268 /** 23269 * @type {?number} 23270 * @private 23271 */ 23272 this.maxZoom_ = options['maxZoom'] || null; 23273 23274 this.styles_ = options['styles'] || []; 23275 23276 this.cssClass_ = options['cssClass'] || null; 23277 23278 /** 23279 * @type {string} 23280 * @private 23281 */ 23282 this.imagePath_ = options['imagePath'] || 23283 this.MARKER_CLUSTER_IMAGE_PATH_; 23284 23285 /** 23286 * @type {string} 23287 * @private 23288 */ 23289 this.imageExtension_ = options['imageExtension'] || 23290 this.MARKER_CLUSTER_IMAGE_EXTENSION_; 23291 23292 /** 23293 * @type {boolean} 23294 * @private 23295 */ 23296 this.zoomOnClick_ = true; 23297 23298 if (options['zoomOnClick'] != undefined) { 23299 this.zoomOnClick_ = options['zoomOnClick']; 23300 } 23301 23302 /** 23303 * @type {boolean} 23304 * @private 23305 */ 23306 this.averageCenter_ = false; 23307 23308 if (options['averageCenter'] != undefined) { 23309 this.averageCenter_ = options['averageCenter']; 23310 } 23311 23312 /** 23313 * @type {function} 23314 * @private 23315 */ 23316 this.onMouseoverCluster_ = options['onMouseoverCluster']; 23317 23318 /** 23319 * @type {function} 23320 * @private 23321 */ 23322 this.onMouseoutCluster_ = options['onMouseoutCluster']; 23323 23324 /** 23325 * @type {function} 23326 * @private 23327 */ 23328 this.drawCluster_ = options['drawCluster']; 23329 23330 /** 23331 * @type {function} 23332 * @private 23333 */ 23334 this.hideCluster_ = options['hideCluster']; 23335 23336 /** 23337 * @type {function} 23338 * @private 23339 */ 23340 this.showCluster_ = options['showCluster']; 23341 23342 /** 23343 * @type {function} 23344 * @private 23345 */ 23346 this.onAddCluster_ = options['onAddCluster']; 23347 23348 /** 23349 * @type {function} 23350 * @private 23351 */ 23352 this.onRemoveCluster_ = options['onRemoveCluster']; 23353 23354 this.setupStyles_(); 23355 23356 this.setMap(map); 23357 23358 /** 23359 * @type {number} 23360 * @private 23361 */ 23362 this.prevZoom_ = this.map_.getZoom(); 23363 23364 // Add the map event listeners 23365 var that = this; 23366 google.maps.event.addListener(this.map_, 'zoom_changed', function() { 23367 var zoom = that.map_.getZoom(); 23368 23369 if (that.prevZoom_ != zoom) { 23370 that.prevZoom_ = zoom; 23371 that.resetViewport(); 23372 } 23373 }); 23374 23375 google.maps.event.addListener(this.map_, 'idle', function() { 23376 that.redraw(); 23377 }); 23378 23379 // Finally, add the markers 23380 if (opt_markers && opt_markers.length) { 23381 this.addMarkers(opt_markers, false); 23382 } 23383} 23384 23385 23386/** 23387 * The marker cluster image path. 23388 * 23389 * @type {string} 23390 * @private 23391 */ 23392MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = 'https://raw.githubusercontent.com/gmaps-marker-clusterer/gmaps-marker-clusterer/master/images/m'; 23393 23394 23395/** 23396 * The marker cluster image path. 23397 * 23398 * @type {string} 23399 * @private 23400 */ 23401MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png'; 23402 23403 23404/** 23405 * Extends a objects prototype by anothers. 23406 * 23407 * @param {Object} obj1 The object to be extended. 23408 * @param {Object} obj2 The object to extend with. 23409 * @return {Object} The new extended object. 23410 * @ignore 23411 */ 23412MarkerClusterer.prototype.extend = function(obj1, obj2) { 23413 return (function(object) { 23414 for (var property in object.prototype) { 23415 this.prototype[property] = object.prototype[property]; 23416 } 23417 return this; 23418 }).apply(obj1, [obj2]); 23419}; 23420 23421 23422/** 23423 * Implementaion of the interface method. 23424 * @ignore 23425 */ 23426MarkerClusterer.prototype.onAdd = function() { 23427 this.setReady_(true); 23428}; 23429 23430/** 23431 * Implementaion of the interface method. 23432 * @ignore 23433 */ 23434MarkerClusterer.prototype.draw = function() {}; 23435 23436/** 23437 * Sets up the styles object. 23438 * 23439 * @private 23440 */ 23441MarkerClusterer.prototype.setupStyles_ = function() { 23442 if (this.styles_.length) { 23443 return; 23444 } 23445 23446 for (var i = 0, size; size = this.sizes[i]; i++) { 23447 var url = ''; 23448 if (typeof this.imagePath_ === 'function') { 23449 url = this.imagePath_(i, size); 23450 } else { 23451 url = this.imagePath_ + (i + 1) + '.' + this.imageExtension_; 23452 } 23453 this.styles_.push({ 23454 url: url, 23455 height: size, 23456 width: size 23457 }); 23458 } 23459}; 23460 23461/** 23462 * Fit the map to the bounds of the markers in the clusterer. 23463 */ 23464MarkerClusterer.prototype.fitMapToMarkers = function() { 23465 var markers = this.getMarkers(); 23466 var bounds = new google.maps.LatLngBounds(); 23467 for (var i = 0, marker; marker = markers[i]; i++) { 23468 bounds.extend(marker.getPosition()); 23469 } 23470 23471 this.map_.fitBounds(bounds); 23472}; 23473 23474 23475/** 23476 * Sets the styles. 23477 * 23478 * @param {Object} styles The style to set. 23479 */ 23480MarkerClusterer.prototype.setStyles = function(styles) { 23481 this.styles_ = styles; 23482}; 23483 23484 23485/** 23486 * Gets the styles. 23487 * 23488 * @return {Object} The styles object. 23489 */ 23490MarkerClusterer.prototype.getStyles = function() { 23491 return this.styles_; 23492}; 23493 23494 23495/** 23496 * Whether zoom on click is set. 23497 * 23498 * @return {boolean} True if zoomOnClick_ is set. 23499 */ 23500MarkerClusterer.prototype.isZoomOnClick = function() { 23501 return this.zoomOnClick_; 23502}; 23503 23504/** 23505 * Whether average center is set. 23506 * 23507 * @return {boolean} True if averageCenter_ is set. 23508 */ 23509MarkerClusterer.prototype.isAverageCenter = function() { 23510 return this.averageCenter_; 23511}; 23512 23513 23514/** 23515 * Returns the array of markers in the clusterer. 23516 * 23517 * @return {Array.<google.maps.Marker>} The markers. 23518 */ 23519MarkerClusterer.prototype.getMarkers = function() { 23520 return this.markers_; 23521}; 23522 23523 23524/** 23525 * Returns the number of markers in the clusterer 23526 * 23527 * @return {Number} The number of markers. 23528 */ 23529MarkerClusterer.prototype.getTotalMarkers = function() { 23530 return this.markers_.length; 23531}; 23532 23533 23534/** 23535 * Sets the max zoom for the clusterer. 23536 * 23537 * @param {number} maxZoom The max zoom level. 23538 */ 23539MarkerClusterer.prototype.setMaxZoom = function(maxZoom) { 23540 this.maxZoom_ = maxZoom; 23541}; 23542 23543 23544/** 23545 * Gets the max zoom for the clusterer. 23546 * 23547 * @return {number} The max zoom level. 23548 */ 23549MarkerClusterer.prototype.getMaxZoom = function() { 23550 return this.maxZoom_; 23551}; 23552 23553/** 23554 * Gets marker's cluster object based on given marker 23555 * 23556 * @param {google.maps.Marker} marker 23557 * 23558 * @return {Cluster} 23559 */ 23560MarkerClusterer.prototype.getMarkersCluster = function(marker) {
23561 return this.clusters_[this.markersCluster_[marker.uniqueID]]; 23562}; 23563 23564/** 23565 * The function for calculating the cluster icon image. 23566 * 23567 * @param {Array.<google.maps.Marker>} markers The markers in the clusterer. 23568 * @param {number} numStyles The number of styles available. 23569 * @return {Object} A object properties: 'text' (string) and 'index' (number). 23570 * @private 23571 */ 23572MarkerClusterer.prototype.calculator_ = function(markers, numStyles) { 23573 var index = 0; 23574 var count = markers.length; 23575 var dv = count; 23576 while (dv !== 0) { 23577 dv = parseInt(dv / 10, 10); 23578 index++; 23579 } 23580 23581 index = Math.min(index, numStyles); 23582 23583 return { 23584 text: count, 23585 index: index 23586 }; 23587}; 23588 23589 23590/** 23591 * Set the calculator function. 23592 * 23593 * @param {function(Array, number)} calculator The function to set as the 23594 * calculator. The function should return a object properties: 23595 * 'text' (string) and 'index' (number). 23596 * 23597 */ 23598MarkerClusterer.prototype.setCalculator = function(calculator) { 23599 this.calculator_ = calculator; 23600}; 23601 23602 23603/** 23604 * Get the calculator function. 23605 * 23606 * @return {function(Array, number)} the calculator function. 23607 */ 23608MarkerClusterer.prototype.getCalculator = function() { 23609 return this.calculator_; 23610}; 23611 23612 23613/** 23614 * Add an array of markers to the clusterer. 23615 * 23616 * @param {Array.<google.maps.Marker>} markers The markers to add. 23617 * @param {boolean=} opt_nodraw Whether to redraw the clusters. 23618 */ 23619MarkerClusterer.prototype.addMarkers = function(markers, opt_nodraw) { 23620 for (var i = 0, marker; marker = markers[i]; i++) { 23621 this.pushMarkerTo_(marker); 23622 } 23623 if (!opt_nodraw) { 23624 this.redraw(); 23625 } 23626}; 23627 23628 23629/** 23630 * Pushes a marker to the clusterer. 23631 * 23632 * @param {google.maps.Marker} marker The marker to add. 23633 * @private 23634 */ 23635MarkerClusterer.prototype.pushMarkerTo_ = function(marker) { 23636 marker.isAdded = false; 23637 if (marker['draggable']) { 23638 // If the marker is draggable add a listener so we update the clusters on 23639 // the drag end. 23640 var that = this; 23641 google.maps.event.addListener(marker, 'dragend', function() { 23642 marker.isAdded = false; 23643 that.repaint(); 23644 }); 23645 } 23646 marker.uniqueID = this.markersUniqueID; 23647 this.markersUniqueID++; 23648 this.markers_.push(marker); 23649}; 23650 23651 23652/** 23653 * Adds a marker to the clusterer and redraws if needed. 23654 * 23655 * @param {google.maps.Marker} marker The marker to add. 23656 * @param {boolean=} opt_nodraw Whether to redraw the clusters. 23657 */ 23658MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) { 23659 this.pushMarkerTo_(marker); 23660 if (!opt_nodraw) { 23661 this.redraw(); 23662 } 23663}; 23664 23665 23666/** 23667 * Removes a marker and returns true if removed, false if not 23668 * 23669 * @param {google.maps.Marker} marker The marker to remove 23670 * @return {boolean} Whether the marker was removed or not 23671 * @private 23672 */ 23673MarkerClusterer.prototype.removeMarker_ = function(marker) { 23674 var index = -1; 23675 if (this.markers_.indexOf) { 23676 index = this.markers_.indexOf(marker); 23677 } else { 23678 for (var i = 0, m; m = this.markers_[i]; i++) { 23679 if (m == marker) { 23680 index = i; 23681 break; 23682 } 23683 } 23684 } 23685 23686 if (index == -1) { 23687 // Marker is not in our list of markers. 23688 return false; 23689 } 23690 23691 marker.setMap(null); 23692 23693 this.markers_.splice(index, 1); 23694 delete this.markersCluster_[marker.uniqueID]; 23695 23696 return true; 23697}; 23698 23699 23700/** 23701 * Remove a marker from the cluster. 23702 * 23703 * @param {google.maps.Marker} marker The marker to remove. 23704 * @param {boolean=} opt_nodraw Optional boolean to force no redraw. 23705 * @return {boolean} True if the marker was removed. 23706 */ 23707MarkerClusterer.prototype.removeMarker = function(marker, opt_nodraw) { 23708 var removed = this.removeMarker_(marker); 23709 23710 if (!opt_nodraw && removed) { 23711 this.resetViewport(); 23712 this.redraw(); 23713 return true; 23714 } else { 23715 return false; 23716 } 23717}; 23718 23719 23720/** 23721 * Removes an array of markers from the cluster. 23722 * 23723 * @param {Array.<google.maps.Marker>} markers The markers to remove. 23724 * @param {boolean=} opt_nodraw Optional boolean to force no redraw. 23725 */ 23726MarkerClusterer.prototype.removeMarkers = function(markers, opt_nodraw) { 23727 var removed = false;
23728 23729 for (var i = markers.length; i >= 0; i--) { 23730 var marker = markers[i]; 23731 var r = this.removeMarker_(marker); 23732 removed = removed || r; 23733 } 23734 23735 if (!opt_nodraw && removed) { 23736 this.resetViewport(); 23737 this.redraw(); 23738 return true; 23739 } 23740}; 23741 23742 23743/** 23744 * Sets the clusterer's ready state. 23745 * 23746 * @param {boolean} ready The state. 23747 * @private 23748 */ 23749MarkerClusterer.prototype.setReady_ = function(ready) { 23750 if (!this.ready_) { 23751 this.ready_ = ready; 23752 this.createClusters_(); 23753 } 23754}; 23755 23756 23757/** 23758 * Returns the number of clusters in the clusterer. 23759 * 23760 * @return {number} The number of clusters. 23761 */ 23762MarkerClusterer.prototype.getTotalClusters = function() { 23763 return this.clusters_.length; 23764}; 23765 23766 23767/** 23768 * Returns the list of clusters in the clusterer 23769 * 23770 * @return {Array.<Cluster>} The list of clusters. 23771 */ 23772MarkerClusterer.prototype.getClusters = function() { 23773 return this.clusters_; 23774}; 23775 23776 23777/** 23778 * Returns the google map that the clusterer is associated with. 23779 * 23780 * @return {google.maps.Map} The map. 23781 */ 23782MarkerClusterer.prototype.getMap = function() { 23783 return this.map_; 23784}; 23785 23786 23787/** 23788 * Sets the google map that the clusterer is associated with. 23789 * 23790 * @param {google.maps.Map} map The map. 23791 */ 23792MarkerClusterer.prototype.setMap = function(map) { 23793 this.map_ = map; 23794}; 23795 23796 23797/** 23798 * Returns the size of the grid. 23799 * 23800 * @return {number} The grid size. 23801 */ 23802MarkerClusterer.prototype.getGridSize = function() { 23803 return this.gridSize_; 23804}; 23805 23806 23807/** 23808 * Sets the size of the grid. 23809 * 23810 * @param {number} size The grid size. 23811 */ 23812MarkerClusterer.prototype.setGridSize = function(size) { 23813 this.gridSize_ = size; 23814}; 23815 23816 23817/** 23818 * Returns the min cluster size. 23819 * 23820 * @return {number} The grid size. 23821 */ 23822MarkerClusterer.prototype.getMinClusterSize = function() { 23823 return this.minClusterSize_; 23824}; 23825 23826/** 23827 * Sets the min cluster size. 23828 * 23829 * @param {number} size The grid size. 23830 */ 23831MarkerClusterer.prototype.setMinClusterSize = function(size) { 23832 this.minClusterSize_ = size; 23833}; 23834 23835 23836/** 23837 * Extends a bounds object by the grid size. 23838 * 23839 * @param {google.maps.LatLngBounds} bounds The bounds to extend. 23840 * @return {google.maps.LatLngBounds}
23840 The extended bounds. 23841 */ 23842MarkerClusterer.prototype.getExtendedBounds = function(bounds) { 23843 var projection = this.getProjection(); 23844 23845 // Turn the bounds into latlng. 23846 var tr = new google.maps.LatLng(bounds.getNorthEast().lat(), 23847 bounds.getNorthEast().lng()); 23848 var bl = new google.maps.LatLng(bounds.getSouthWest().lat(), 23849 bounds.getSouthWest().lng()); 23850 23851 // Convert the points to pixels and the extend out by the grid size. 23852 var trPix = projection.fromLatLngToDivPixel(tr); 23853 trPix.x += this.gridSize_; 23854 trPix.y -= this.gridSize_; 23855 23856 var blPix = projection.fromLatLngToDivPixel(bl); 23857 blPix.x -= this.gridSize_; 23858 blPix.y += this.gridSize_; 23859 23860 // Convert the pixel points back to LatLng 23861 var ne = projection.fromDivPixelToLatLng(trPix); 23862 var sw = projection.fromDivPixelToLatLng(blPix); 23863 23864 // Extend the bounds to contain the new bounds. 23865 bounds.extend(ne); 23866 bounds.extend(sw); 23867 23868 return bounds; 23869}; 23870 23871 23872/** 23873 * Determins if a marker is contained in a bounds. 23874 * 23875 * @param {google.maps.Marker} marker The marker to check. 23876 * @param {google.maps.LatLngBounds} bounds The bounds to check against. 23877 * @return {boolean} True if the marker is in the bounds. 23878 * @private 23879 */ 23880MarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) { 23881 return bounds.contains(marker.getPosition()); 23882}; 23883 23884 23885/** 23886 * Clears all clusters and markers from the clusterer. 23887 */ 23888MarkerClusterer.prototype.clearMarkers = function() { 23889 this.resetViewport(true); 23890 23891 // Set the markers a empty array. 23892 this.markers_ = []; 23893 this.markersCluster_ = {}; 23894 this.markersUniqueID = 1; 23895}; 23896 23897 23898/** 23899 * Clears all existing clusters and recreates them. 23900 * @param {boolean} opt_hide To also hide the marker. 23901 */ 23902MarkerClusterer.prototype.resetViewport = function(opt_hide) { 23903 // Remove all the clusters 23904 for (var i = 0, cluster; cluster = this.clusters_[i]; i++) { 23905 cluster.remove(); 23906 } 23907 23908 // Reset the markers to not be added and to be invisible. 23909 for (var i = 0, marker; marker = this.markers_[i]; i++) { 23910 marker.isAdded = false; 23911 if (opt_hide) { 23912 marker.setMap(null); 23913 } 23914 } 23915 23916 this.clusters_ = []; 23917 this.markersCluster_ = {}; 23918 this.markersUniqueID = 1; 23919}; 23920 23921/** 23922 * 23923 */ 23924MarkerClusterer.prototype.repaint = function() { 23925 var oldClusters = this.clusters_.slice(); 23926 this.clusters_.length = 0; 23927 this.resetViewport(); 23928 this.redraw(); 23929 23930 // Remove the old clusters. 23931 // Do it in a timeout so the other clusters have been drawn first. 23932 window.setTimeout(function() { 23933 for (var i = 0, cluster; cluster = oldClusters[i]; i++) { 23934 cluster.remove(); 23935 } 23936 }, 0); 23937}; 23938 23939 23940/** 23941 * Redraws the clusters. 23942 */ 23943MarkerClusterer.prototype.redraw = function() { 23944 this.createClusters_(); 23945}; 23946 23947 23948/** 23949 * Calculates the distance between two latlng locations in km. 23950 * @see http://www.movable-type.co.uk/scripts/latlong.html 23951 * 23952 * @param {google.maps.LatLng} p1 The first lat lng point. 23953 * @param {google.maps.LatLng} p2 The second lat lng point. 23954 * @return {number} The distance between the two points in km. 23955 * @private 23956 */ 23957MarkerClusterer.prototype.distanceBetweenPoints_ = function(p1, p2) { 23958 if (!p1 || !p2) { 23959 return 0; 23960 } 23961 23962 var R = 6371; // Radius of the Earth in km 23963 var dLat = (p2.lat() - p1.lat()) * Math.PI / 180; 23964 var dLon = (p2.lng() - p1.lng()) * Math.PI / 180; 23965 var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + 23966 Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) * 23967 Math.sin(dLon / 2) * Math.sin(dLon / 2); 23968 var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 23969 var d = R * c; 23970 return d; 23971}; 23972 23973 23974/** 23975 * Add a marker to a cluster, or creates a new cluster. 23976 * 23977 * @param {google.maps.Marker} marker The marker to add. 23978 * @private 23979 */ 23980MarkerClusterer.prototype.addToClosestCluster_ = function(marker) { 23981 var distance = 40000; // Some large number 23982 var clusterToAddTo = null; 23983 var pos = marker.getPosition(); 23984 var clusterIndex = null; 23985 for (var i = 0, cluster; cluster = this.clusters_[i]; i++) { 23986 var center = cluster.getCenter(); 23987 if (center) { 23988 var d = this.distanceBetweenPoints_(center, marker.getPosition()); 23989 if (d < distance) { 23990 distance = d; 23991 clusterToAddTo = cluster; 23992 clusterIndex = i; 23993 } 23994 } 23995 } 23996 23997 if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) { 23998 clusterToAddTo.addMarker(marker); 23999 } else { 24000 var cluster = new Cluster(this); 24001 cluster.addMarker(marker);
24002 this.clusters_.push(cluster); 24003 clusterIndex = this.clusters_.length - 1; 24004 } 24005 24006 if (marker.isAdded) { 24007 this.markersCluster_[marker.uniqueID] = clusterIndex; 24008 } 24009}; 24010 24011 24012/** 24013 * Creates the clusters. 24014 * 24015 * @private 24016 */ 24017MarkerClusterer.prototype.createClusters_ = function() { 24018 if (!this.ready_) { 24019 return; 24020 } 24021 24022 // Get our current map view bounds. 24023 // Create a new bounds object so we don't affect the map. 24024 var mapBounds = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(), 24025 this.map_.getBounds().getNorthEast()); 24026 var bounds = this.getExtendedBounds(mapBounds); 24027 24028 for (var i = 0, marker; marker = this.markers_[i]; i++) { 24029 if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds) && (!this.ignoreHiddenMarkers_ || marker.getVisible())) { 24030 this.addToClosestCluster_(marker); 24031 } 24032 } 24033}; 24034 24035 24036/** 24037 * A cluster that contains markers. 24038 * 24039 * @param {MarkerClusterer} markerClusterer The markerclusterer that this 24040 * cluster is associated with. 24041 * @constructor 24042 * @ignore 24043 */ 24044function Cluster(markerClusterer) { 24045 this.markerClusterer_ = markerClusterer; 24046 this.map_ = markerClusterer.getMap(); 24047 this.gridSize_ = markerClusterer.getGridSize(); 24048 this.minClusterSize_ = markerClusterer.getMinClusterSize(); 24049 this.averageCenter_ = markerClusterer.isAverageCenter(); 24050 this.center_ = null; 24051 this.markers_ = []; 24052 this.bounds_ = null; 24053 this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(), 24054 markerClusterer.getGridSize()); 24055} 24056 24057/** 24058 * Determins if a marker is already added to the cluster. 24059 * 24060 * @param {google.maps.Marker} marker The marker to check. 24061 * @return {boolean} True if the marker is already added. 24062 */ 24063Cluster.prototype.isMarkerAlreadyAdded = function(marker) { 24064 if (this.markers_.indexOf) { 24065 return this.markers_.indexOf(marker) != -1; 24066 } else { 24067 for (var i = 0, m; m = this.markers_[i]; i++) { 24068 if (m == marker) { 24069 return true; 24070 } 24071 } 24072 } 24073 return false; 24074}; 24075 24076 24077/** 24078 * Add a marker the cluster. 24079 * 24080 * @param {google.maps.Marker} marker The marker to add. 24081 * @return {boolean} True if the marker was added. 24082 */ 24083Cluster.prototype.addMarker = function(marker) { 24084 if (this.isMarkerAlreadyAdded(marker)) { 24085 return false; 24086 } 24087 24088 if (!this.center_) { 24089 this.center_ = marker.getPosition(); 24090 this.calculateBounds_(); 24091 } else { 24092 if (this.averageCenter_) { 24093 var l = this.markers_.length + 1; 24094 var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l; 24095 var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l; 24096 this.center_ = new google.maps.LatLng(lat, lng); 24097 this.calculateBounds_(); 24098 } 24099 } 24100 24101 marker.isAdded = true; 24102 this.markers_.push(marker); 24103 24104 var len = this.markers_.length; 24105 if (len < this.minClusterSize_ && marker.getMap() != this.map_) { 24106 // Min cluster size not reached so show the marker. 24107 marker.setMap(this.map_); 24108 } 24109 24110 if (len == this.minClusterSize_) { 24111 // Hide the markers that were showing. 24112 for (var i = 0; i < len; i++) { 24113 this.markers_[i].setMap(null); 24114 } 24115 } 24116 24117 if (len >= this.minClusterSize_) { 24118 marker.setMap(null); 24119 } 24120 24121 this.updateIcon(); 24122 return true; 24123}; 24124 24125 24126/** 24127 * Returns the marker clusterer that the cluster is associated with. 24128 * 24129 * @return {MarkerClusterer} The associated marker clusterer. 24130 */ 24131Cluster.prototype.getMarkerClusterer = function() { 24132 return this.markerClusterer_; 24133}; 24134 24135 24136/** 24137 * Returns the bounds of the cluster. 24138 * 24139 * @return {google.maps.LatLngBounds} the cluster bounds. 24140 */ 24141Cluster.prototype.getBounds = function() { 24142 var bounds = new google.maps.LatLngBounds(this.center_, this.center_); 24143 var markers = this.getMarkers(); 24144 for (var i = 0, marker; marker = markers[i]; i++) { 24145 bounds.extend(marker.getPosition()); 24146 } 24147 return bounds; 24148}; 24149 24150 24151/** 24152 * Removes the cluster 24153 */ 24154Cluster.prototype.remove = function() { 24155 this.clusterIcon_.remove(); 24156 this.markers_.length = 0; 24157 delete this.markers_; 24158}; 24159 24160 24161/** 24162 * Returns the center of the cluster. 24163 * 24164 * @return {number} The cluster center. 24165 */ 24166Cluster.prototype.getSize = function() { 24167 return this.markers_.length; 24168}; 24169 24170 24171/** 24172 * Returns the center of the cluster. 24173 * 24174 * @return {Array.<google.maps.Marker>} The cluster center. 24175 */ 24176Cluster.prototype.getMarkers = function() { 24177 return this.markers_; 24178}; 24179 24180 24181/** 24182 * Returns the center of the cluster. 24183 * 24184 * @return {google.maps.LatLng} The cluster center. 24185 */ 24186Cluster.prototype.getCenter = function() { 24187 return this.center_; 24188}; 24189 24190 24191/**
24192 * Calculated the extended bounds of the cluster with the grid. 24193 * 24194 * @private 24195 */ 24196Cluster.prototype.calculateBounds_ = function() { 24197 var bounds = new google.maps.LatLngBounds(this.center_, this.center_); 24198 this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds); 24199}; 24200 24201 24202/** 24203 * Determines if a marker lies in the clusters bounds. 24204 * 24205 * @param {google.maps.Marker} marker The marker to check. 24206 * @return {boolean} True if the marker lies in the bounds. 24207 */ 24208Cluster.prototype.isMarkerInClusterBounds = function(marker) { 24209 return this.bounds_.contains(marker.getPosition()); 24210}; 24211 24212 24213/** 24214 * Returns the map that the cluster is associated with. 24215 * 24216 * @return {google.maps.Map} The map. 24217 */ 24218Cluster.prototype.getMap = function() { 24219 return this.map_; 24220}; 24221 24222 24223/** 24224 * Updates the cluster icon 24225 */ 24226Cluster.prototype.updateIcon = function() { 24227 var zoom = this.map_.getZoom(); 24228 var mz = this.markerClusterer_.getMaxZoom(); 24229 24230 if (mz && zoom > mz) { 24231 // The zoom is greater than our max zoom so show all the markers in cluster. 24232 for (var i = 0, marker; marker = this.markers_[i]; i++) { 24233 marker.setMap(this.map_); 24234 } 24235 return; 24236 } 24237 24238 if (this.markers_.length < this.minClusterSize_) { 24239 // Min cluster size not yet reached. 24240 this.clusterIcon_.hide(); 24241 return; 24242 } 24243 24244 var numStyles = this.markerClusterer_.getStyles().length; 24245 var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles); 24246 this.clusterIcon_.setCenter(this.center_); 24247 this.clusterIcon_.setSums(sums); 24248 this.clusterIcon_.show(); 24249}; 24250 24251 24252/** 24253 * A cluster icon 24254 * 24255 * @param {Cluster} cluster The cluster to be associated with. 24256 * @param {Object} styles An object that has style properties: 24257 * 'url': (string) The image url. 24258 * 'height': (number) The image height. 24259 * 'width': (number) The image width. 24260 * 'anchor': (Array) The anchor position of the label text. 24261 * 'textColor': (string) The text color. 24262 * 'textSize': (number) The text size. 24263 * 'backgroundPosition: (string) The background postition x, y. 24264 * @param {number=} opt_padding Optional padding to apply to the cluster icon. 24265 * @constructor 24266 * @extends google.maps.OverlayView 24267 * @ignore 24268 */ 24269function ClusterIcon(cluster, styles, opt_padding) { 24270 cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView); 24271 24272 this.styles_ = styles; 24273 this.padding_ = opt_padding || 0; 24274 this.cluster_ = cluster; 24275 this.center_ = null; 24276 this.map_ = cluster.getMap(); 24277 this.div_ = null; 24278 this.sums_ = null; 24279 this.visible_ = false; 24280 24281 this.setMap(this.map_); 24282} 24283 24284/** 24285 * Triggers the clusterclick event and zoom's if the option is set. 24286 * 24287 * @param {google.maps.MouseEvent} event The event to propagate 24288 */ 24289ClusterIcon.prototype.triggerClusterClick = function(event) { 24290 var markerClusterer = this.cluster_.getMarkerClusterer(); 24291 24292 // Trigger the clusterclick event. 24293 google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_, event); 24294 24295 if (markerClusterer.isZoomOnClick()) { 24296 // Zoom into the cluster. 24297 this.map_.fitBounds(this.cluster_.getBounds()); 24298 } 24299}; 24300 24301/** 24302 * Triggers the clustermouseover event. 24303 * @param {google.maps.MouseEvent} event The event to propagate 24304 */ 24305ClusterIcon.prototype.triggerClusterMouseover = function(event) { 24306 var markerClusterer = this.cluster_.getMarkerClusterer(); 24307 24308 // Trigger the clustermouseover event. 24309 google.maps.event.trigger(markerClusterer, 'clustermouseover', this.cluster_, event); 24310 24311 if (typeof this.cluster_.markerClusterer_.onMouseoverCluster_ === 'function') { 24312 this.cluster_.markerClusterer_.onMouseoverCluster_(this, event); 24313 } 24314}; 24315 24316/** 24317 * Triggers the clustermouseout event. 24318 * @param {google.maps.MouseEvent} event The event to propagate 24319 */ 24320ClusterIcon.prototype.triggerClusterMouseout = function(event) { 24321 var markerClusterer = this.cluster_.getMarkerClusterer(); 24322 24323 // Trigger the clustermouseout event. 24324 google.maps.event.trigger(markerClusterer, 'clustermouseout', this.cluster_, event); 24325 24326 if (typeof this.cluster_.markerClusterer_.onMouseoutCluster_ === 'function') { 24327 this.cluster_.markerClusterer_.onMouseoutCluster_(this, event); 24328 } 24329}; 24330 24331/** 24332 * Adding the cluster icon to the dom. 24333 * @ignore 24334 */ 24335ClusterIcon.prototype.onAdd = function () { 24336 if (typeof this.cluster_.markerClusterer_.onAddCluster_ === 'function') { 24337 this.cluster_.markerClusterer_.onAddCluster_(this); 24338 } 24339 else { 24340 defaultClusterOnAdd(this); 24341 } 24342}; 24343 24344/** 24345 * Default onAdd function 24346 * @ignore 24347 */ 24348function defaultClusterOnAdd(clusterIcon) { 24349 clusterIcon.div_ = document.createElement('DIV'); 24350 if (clusterIcon.visible_) { 24351 var pos = clusterIcon.getPosFromLatLng_(clusterIcon.center_); 24352 clusterIcon.div_.style.cssText = clusterIcon.createCss(pos); 24353 clusterIcon.div_.innerHTML = clusterIcon.sums_.text; 24354 clusterIcon.addClass(); 24355 } 24356 24357 var panes = clusterIcon.getPanes(); 24358 24359 panes.overlayMouseTarget.appendChild(clusterIcon.div_); 24360 24361 var isDragging = false;
24362 var isMouseDown = false; 24363 24364 google.maps.event.addDomListener(clusterIcon.div_, 'click', function(event) { 24365 // Only perform click when not preceded by a drag 24366 if (!isDragging) { 24367 clusterIcon.triggerClusterClick(event); 24368 } 24369 }); 24370 24371 google.maps.event.addDomListener(clusterIcon.div_, 'mousedown', function() { 24372 isDragging = false; 24373 isMouseDown = true; 24374 }); 24375 24376 google.maps.event.addDomListener(clusterIcon.div_, 'mouseup', function() { 24377 isDragging = false; 24378 isMouseDown = false; 24379 }); 24380 24381 google.maps.event.addDomListener(clusterIcon.div_, 'mousemove', function() { 24382 if (isMouseDown) { 24383 isDragging = true; 24384 } 24385 }); 24386 24387 google.maps.event.addDomListener(clusterIcon.div_, 'mouseover', function(event) { 24388 clusterIcon.triggerClusterMouseover(event); 24389 }); 24390 24391 google.maps.event.addDomListener(clusterIcon.div_, 'mouseout', function(event) { 24392 clusterIcon.triggerClusterMouseout(event); 24393 }); 24394} 24395 24396/** 24397 * Returns the position to place the div dending on the latlng. 24398 * 24399 * @param {google.maps.LatLng} latlng The position in latlng. 24400 * @return {google.maps.Point} The position in pixels. 24401 * @private 24402 */ 24403ClusterIcon.prototype.getPosFromLatLng_ = function(latlng) { 24404 var pos = this.getProjection().fromLatLngToDivPixel(latlng); 24405 24406 if (typeof this.iconAnchor_ === 'object' && this.iconAnchor_.length === 2) { 24407 pos.x -= this.iconAnchor_[0]; 24408 pos.y -= this.iconAnchor_[1]; 24409 } else { 24410 pos.x -= parseInt(this.width_ / 2, 10); 24411 pos.y -= parseInt(this.height_ / 2, 10); 24412 } 24413 return pos; 24414}; 24415 24416 24417/** 24418 * Draw the icon. 24419 * @ignore 24420 */ 24421ClusterIcon.prototype.draw = function () { 24422 if (typeof this.cluster_.markerClusterer_.drawCluster_ === 'function') { 24423 this.cluster_.markerClusterer_.drawCluster_(this); 24424 } 24425 else { 24426 defaultClusterDraw(this); 24427 } 24428}; 24429 24430/** 24431 * Default draw function 24432 * @ignore 24433 */ 24434function defaultClusterDraw(clusterIcon) { 24435 if (clusterIcon.visible_) { 24436 var pos = clusterIcon.getPosFromLatLng_(clusterIcon.center_); 24437 clusterIcon.div_.style.top = pos.y + 'px'; 24438 clusterIcon.div_.style.left = pos.x + 'px'; 24439 } 24440} 24441 24442 24443/** 24444 * Hide the icon. 24445 */ 24446ClusterIcon.prototype.hide = function() { 24447 if (typeof this.cluster_.markerClusterer_.hideCluster_ === 'function') { 24448 this.cluster_.markerClusterer_.hideCluster_(this); 24449 } 24450 else { 24451 defaultClusterHide(this); 24452 } 24453}; 24454 24455 24456/** 24457 * Default hide function 24458 * @ignore 24459 */ 24460function defaultClusterHide(clusterIcon) { 24461 if (clusterIcon.div_) { 24462 clusterIcon.div_.style.display = 'none'; 24463 clusterIcon.div_.className = ''; 24464 } 24465 clusterIcon.visible_ = false; 24466} 24467 24468 24469/** 24470 * Position and show the icon. 24471 */ 24472ClusterIcon.prototype.show = function() { 24473 if (typeof this.cluster_.markerClusterer_.showCluster_ === 'function') { 24474 this.cluster_.markerClusterer_.showCluster_(this); 24475 } 24476 else { 24477 defaultClusterShow(this); 24478 } 24479}; 24480 24481/** 24482 * Default show function 24483 * @ignore 24484 */ 24485function defaultClusterShow(clusterIcon) { 24486 if (clusterIcon.div_) { 24487 var pos = clusterIcon.getPosFromLatLng_(clusterIcon.center_); 24488 clusterIcon.div_.style.cssText = clusterIcon.createCss(pos); 24489 clusterIcon.div_.style.display = ''; 24490 clusterIcon.addClass(); 24491 } 24492 clusterIcon.visible_ = true; 24493} 24494 24495 24496/** 24497 * Remove the icon from the map 24498 */ 24499ClusterIcon.prototype.remove = function() { 24500 this.setMap(null); 24501}; 24502 24503 24504/** 24505 * Implementation of the onRemove interface. 24506 * @ignore 24507 */ 24508ClusterIcon.prototype.onRemove = function() { 24509 if (typeof this.cluster_.markerClusterer_.onRemoveCluster_ === 'function') { 24510 this.cluster_.markerClusterer_.onRemoveCluster_(this); 24511 } 24512 else { 24513 defaultClusterOnRemove(this); 24514 } 24515}; 24516 24517/** 24518 * Default onRemove function 24519 * @ignore 24520 */ 24521function defaultClusterOnRemove(clusterIcon) { 24522 if (clusterIcon.div_ && clusterIcon.div_.parentNode) { 24523 clusterIcon.hide(); 24524 clusterIcon.div_.parentNode.removeChild(clusterIcon.div_); 24525 clusterIcon.div_ = null; 24526 } 24527} 24528 24529 24530/** 24531 * Set the sums of the icon. 24532 * 24533 * @param {Object} sums The sums containing: 24534 * 'text': (string) The text to display in the icon. 24535 * 'index': (number) The style index of the icon. 24536 */ 24537ClusterIcon.prototype.setSums = function(sums) { 24538 this.sums_ = sums; 24539 this.text_ = sums.text; 24540 this.index_ = sums.index; 24541 if (this.div_) { 24542 this.div_.innerHTML = sums.text; 24543 } 24544 24545 this.useStyle(); 24546}; 24547 24548 24549/** 24550 * Sets the icon to the the styles. 24551 */ 24552ClusterIcon.prototype.useStyle = function() { 24553 var index = Math.max(0, this.sums_.index - 1); 24554 index = Math.min(this.styles_.length - 1, index); 24555 var style = this.styles_[index]; 24556 this.url_ = style['url']; 24557 this.height_ = style['height']; 24558 this.width_ = style['width']; 24559 this.textColor_ = style['textColor']; 24560 this.anchor_ = style['anchor']; 24561 this.textSize_ = style['textSize']; 24562 this.backgroundPosition_ = style['backgroundPosition']; 24563 this.iconAnchor_ = style['iconAnchor']; 24564 this.setIndex_ = index; 24565}; 24566 24567 24568/** 24569 * Sets the center of the icon. 24570 * 24571 * @param {google.maps.LatLng} center The latlng to set as the center. 24572 */ 24573ClusterIcon.prototype.setCenter = function(center) { 24574 this.center_ = center; 24575}; 24576 24577 24578/** 24579 * Create the css text based on the position of the icon. 24580 * 24581 * @param {google.maps.Point} pos The position. 24582 * @return {string} The css style text. 24583 */ 24584ClusterIcon.prototype.createCss = function(pos) { 24585 var style = []; 24586 var markerClusterer = this.cluster_.getMarkerClusterer(); 24587 24588 if (!markerClusterer.cssClass_) { 24589 style.push('background-image:url(' + this.url_ + ');'); 24590 var backgroundPosition = this.backgroundPosition_ ? this.backgroundPosition_ : '0 0'; 24591 style.push('background-position:' + backgroundPosition + ';'); 24592 24593 if (typeof this.anchor_ === 'object') { 24594 if (typeof this.anchor_[0] === 'number' && this.anchor_[0] > 0 && 24595 this.anchor_[0] < this.height_) { 24596 style.push('height:' + (this.height_ - this.anchor_[0]) + 24597 'px; padding-top:' + this.anchor_[0] + 'px;'); 24598 } else if (typeof this.anchor_[0] === 'number' && this.anchor_[0] < 0 && 24599 -this.anchor_[0] < this.height_) { 24600 style.push('height:' + this.height_ + 'px; line-height:' + (this.height_ + this.anchor_[0]) + 24601 'px;'); 24602 } else { 24603 style.push('height:' + this.height_ + 'px; line-height:' + this.height_ + 24604 'px;'); 24605 } 24606 if (typeof this.anchor_[1] === 'number' && this.anchor_[1] > 0 && 24607 this.anchor_[1] < this.width_) { 24608 style.push('width:' + (this.width_ - this.anchor_[1]) + 24609 'px; padding-left:' + this.anchor_[1] + 'px;'); 24610 } else { 24611 style.push('width:' + this.width_ + 'px; text-align:center;'); 24612 } 24613 } else { 24614 style.push('height:' + this.height_ + 'px; line-height:' + 24615 this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;'); 24616 } 24617 24618 var txtColor = this.textColor_ ? this.textColor_ : 'black'; 24619 var txtSize = this.textSize_ ? this.textSize_ : 11; 24620 24621 style.push('cursor:pointer; top:' + pos.y + 'px; left:' + 24622 pos.x + 'px; color:' + txtColor + '; position:absolute; font-size:' + 24623 txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold'); 24624 24625 } else { 24626 style.push('top:' + pos.y + 'px; left:' + pos.x + 'px;'); 24627 } 24628 24629 return style.join(''); 24630}; 24631 24632/** 24633 * Set the class for the cluster icon 24634 * @ignore 24635 */ 24636ClusterIcon.prototype.addClass = function() { 24637 var markerClusterer = this.cluster_.getMarkerClusterer(); 24638 24639 if (markerClusterer.cssClass_) { 24640 this.div_.className = markerClusterer.cssClass_ + ' ' + markerClusterer.cssDefaultClass_ + this.setIndex_; 24641 } else { 24642 this.div_.className = markerClusterer.cssDefaultClass_ + this.setIndex_; 24643 } 24644} 24645 24646 24647// Export Symbols for Closure
24648// If you are not going to compile with closure then you can remove the 24649// code below. 24650window['MarkerClusterer'] = MarkerClusterer; 24651MarkerClusterer.prototype['addMarker'] = MarkerClusterer.prototype.addMarker; 24652MarkerClusterer.prototype['addMarkers'] = MarkerClusterer.prototype.addMarkers; 24653MarkerClusterer.prototype['clearMarkers'] = 24654 MarkerClusterer.prototype.clearMarkers; 24655MarkerClusterer.prototype['fitMapToMarkers'] = 24656 MarkerClusterer.prototype.fitMapToMarkers; 24657MarkerClusterer.prototype['getCalculator'] = 24658 MarkerClusterer.prototype.getCalculator; 24659MarkerClusterer.prototype['getGridSize'] = 24660 MarkerClusterer.prototype.getGridSize; 24661MarkerClusterer.prototype['getExtendedBounds'] = 24662 MarkerClusterer.prototype.getExtendedBounds; 24663MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap; 24664MarkerClusterer.prototype['getMarkers'] = MarkerClusterer.prototype.getMarkers; 24665MarkerClusterer.prototype['getMaxZoom'] = MarkerClusterer.prototype.getMaxZoom; 24666MarkerClusterer.prototype['getMarkersCluster'] = MarkerClusterer.prototype.getMarkersCluster; 24667MarkerClusterer.prototype['getStyles'] = MarkerClusterer.prototype.getStyles; 24668MarkerClusterer.prototype['getTotalClusters'] = 24669 MarkerClusterer.prototype.getTotalClusters; 24670MarkerClusterer.prototype['getTotalMarkers'] = 24671 MarkerClusterer.prototype.getTotalMarkers; 24672MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw; 24673MarkerClusterer.prototype['removeMarker'] = 24674 MarkerClusterer.prototype.removeMarker; 24675MarkerClusterer.prototype['removeMarkers'] = 24676 MarkerClusterer.prototype.removeMarkers; 24677MarkerClusterer.prototype['resetViewport'] = 24678 MarkerClusterer.prototype.resetViewport; 24679MarkerClusterer.prototype['repaint'] = 24680 MarkerClusterer.prototype.repaint; 24681MarkerClusterer.prototype['setCalculator'] = 24682 MarkerClusterer.prototype.setCalculator; 24683MarkerClusterer.prototype['setGridSize'] = 24684 MarkerClusterer.prototype.setGridSize; 24685MarkerClusterer.prototype['setMaxZoom'] = 24686 MarkerClusterer.prototype.setMaxZoom; 24687MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd; 24688MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw; 24689 24690Cluster.prototype['getCenter'] = Cluster.prototype.getCenter; 24691Cluster.prototype['getSize'] = Cluster.prototype.getSize; 24692Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers; 24693 24694ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd; 24695ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw; 24696ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove; 24697this.SS = (function () { 24698 function SS() { 24699 } 24700 24701 SS.config = {}; 24702 24703 SS.head = ""; 24704 24705 SS.href = ""; 24706 24707 SS.loading = "\u003cimg style=\"vertical-align:middle\" alt=\"loading..\" border=\"0\" width=\"16\" height=\"11\" class=\"ss-base-loading\" src=\"/assets/img/loading.gif\" /\u003e"; 24708 24709 SS.noticeTimeoutId = null; 24710 24711 SS.page = ""; 24712 24713 SS.pageName = null; 24714 24715 SS.parts = null; 24716 24717 SS.siteName = null; 24718 24719 SS.debug = false; 24720 24721 SS.defaultTimeoutMillis = 5000; 24722 24723 SS.KEY_ENTER = 13; 24724 SS.DEFAULT_DATE_FORMAT = '%Y/%m/%d'; 24725 SS.DEFAULT_TIME_FORMAT = '%Y/%m/%d %H:%M'; 24726 24727 SS.isReady = false; 24728 var readyPromise = new Promise(function(resolve, _reject) { 24729 // 5ç§ä»¥å ã« doneReady ãå¼ã°ããªãå ´åãå¼·å¶çã«å¼ã¶ 24730 SS.readyTimeout = setTimeout(function() { 24731 console.error("'application.js' wasn't loaded within 10 secs. please check your 'config/ss.yml'."); 24732 resolve(); 24733 }, 10000); 24734 24735 SS.doneReady = function() { 24736 if (SS.isReady) { 24737 return; 24738 } 24739 24740 SS.isReady = true; 24741 if (SS.readyTimeout) { 24742 clearTimeout(SS.readyTimeout); 24743 SS.readyTimeout = null; 24744 } 24745 24746 resolve(); 24747 } 24748 }); 24749 24750 SS.ready = readyPromise.then.bind(readyPromise); 24751 24752 // $.isEmptyObject ã«ã¯ IE11 ã§éäºæãããã 24753 // 24754 // | Chrome 84 | IE 11 | 24755 // ===========================|===========|========| 24756 // $.isEmptyObject() | true | true | 24757 // $.isEmptyObject(undefined) | true | true | 24758 // $.isEmptyObject(null) | true | true | 24759 // $.isEmptyObject([]) | true | false | 24760 // $.isEmptyObject({}) | true | true | 24761 // $.isEmptyObject(0) | true | true | 24762 // $.isEmptyObject("") | true | false | 24763 // $.isEmptyObject([0]) | false | false | 24764 // $.isEmptyObject({a:0}) | false | false | 24765 // $.isEmptyObject(1) | true | true | 24766 // $.isEmptyObject(-1) | true | true | 24767 // $.isEmptyObject("a") | false | false | 24768 // * `[]` 㨠`""` ã¨ã®å ´åã§éäºæãããã 24769 // 24770 // æ¬æ¥ã® $.isEmptyObject ã«ã¯ä¸è¨ã®ãããªéäºæã¯åå¨ããªããã 24771 // IE 11 åãã«ããªãã£ã«ãçµã¿è¾¼ãã¨ãä¸è¨ã®ãããªéäºæãçºçããã 24772 // 24773 // IE 11 ã§ã isEmptyObject ãåä½ããããã«æ¬ã¡ã½ãããæä¾ããã 24774 SS.isEmptyObject = function (objectOrArray) { 24775 if ($.isEmptyObject(objectOrArray)) { 24776 return true; 24777 } 24778 if ($.isArray(objectOrArray) && objectOrArray.length === 0) { 24779 return true; 24780 } 24781 if ($.type(objectOrArray) === "string" && objectOrArray.length === 0) { 24782 return true; 24783 } 24784 24785 return false;
24786 }; 24787 24788 SS.disableClick = function (el) { 24789 if (el.data('clicked')) { 24790 return false; 24791 } 24792 el.data('clicked', true); 24793 return true; 24794 }; 24795 24796 SS.load = function () { 24797 }; 24798 24799 SS.justOnce = function(element, key, callback, alreadyInitializedCallback) { 24800 if (!element.ss) { 24801 element.ss = {}; 24802 } 24803 24804 var ret = element.ss[key]; 24805 if (ret) { 24806 if (alreadyInitializedCallback) { 24807 alreadyInitializedCallback(ret); 24808 } 24809 return ret; 24810 } 24811 24812 ret = callback(); 24813 if (!ret) { 24814 ret = true; 24815 } 24816 24817 element.ss[key] = ret; 24818 return ret; 24819 }; 24820 24821 SS.deleteJustOnce = function(element, key) { 24822 if (!element.ss) { 24823 return; 24824 } 24825 24826 delete element.ss[key]; 24827 } 24828 24829 SS.render = function (box) { 24830 if (box == null) { 24831 box = null; 24832 } 24833 if (box) { 24834 this.renderInBox(box); 24835 } else { 24836 this.renderNotInBox(); 24837 } 24838 //default 24839 box = $(document); 24840 //eternal links 24841 box.find("a[href^=http]").each(function () { 24842 return $(this).addClass("external"); 24843 }); 24844 this.renderAjaxBox(); 24845 SS_DateTimePicker.render(); 24846 this.renderFileUpload(); 24847 }; 24848 24849 SS.renderNotInBox = function () { 24850 return SS_Login.render(); 24851 }; 24852 24853 SS.renderInBox = function (box) { 24854 var anchorCallback; 24855 anchorCallback = function () { 24856 return $("#cboxLoadedContent .ajax-box:not(.cboxElement)").each(function () { 24857 var elem; 24858 elem = $(this); 24859 elem.addClass("cboxElement"); 24860 if (!elem.attr("target") && !elem.data("target")) { 24861 return elem.colorbox({ 24862 fixed: true, 24863 width: "90%", 24864 height: "90%", 24865 onComplete: anchorCallback 24866 }); 24867 } 24868 }); 24869 }; 24870 return $(box).find(".ajax-box:not(.cboxElement)").each(function () { 24871 var elem; 24872 elem = $(this); 24873 if (!elem.attr("target") && !elem.data("target")) { 24874 return elem.colorbox({ 24875 fixed: true, 24876 width: "90%", 24877 height: "90%", 24878 onComplete: anchorCallback 24879 }); 24880 } 24881 }); 24882 }; 24883 24884 SS.renderClipboardCopy = function () { 24885 $(".ss-clipboard-copy").on("click", function () { 24886 var clip_attr = $(this).attr("data-clip-attr"); 24887 if (clip_attr) { 24888 SS_Clipboard.copy($(this).attr(clip_attr), { "success_alert": true }); 24889 } else { 24890 SS_Clipboard.copy($(this).text(), { "success_alert": true }); 24891 } 24892 return false; 24893 }) 24894 }; 24895 24896 SS.renderLayout = function (url) { 24897 var body, head; 24898 head = $("head"); 24899 body = $("body"); 24900 SS.head = head.html(); 24901 SS.page = $("#page").html(); 24902 body.html(SS.loading); 24903 return $.ajax({ 24904 type: "GET", 24905 url: SS_Kana.url(url), 24906 dataType: "json", 24907 cache: true, 24908 success: function (data) { 24909 var cache; 24910 body.append(data.body.replace("</ yield />", SS.page)); 24911 $("#ss-site-name").html(SS.siteName); 24912 $("#ss-page-name").html(SS.pageName); 24913 if (data.href !== SS.href) { 24914 cache = $.ajaxSettings.cache; 24915 $.ajaxSettings.cache = true; 24916 if (SS.href) { 24917 head.children("link").remove(); 24918 head.children("script").remove(); 24919 } 24920 head.append(data.head); 24921 $.ajaxSettings.cache = cache; 24922 } 24923 SS.href = data.href; 24924 return SS.renderTools(); 24925 }, 24926 error: function (_req, _status, _error) { 24927 return body.html(SS.page); 24928 }, 24929 complete: function () { 24930 $(".ss-part").each(function () { 24931 SS.renderPart($(this)); 24932 }); 24933 } 24934 }); 24935 }; 24936 24937 SS.renderPart = function ($elem) { 24938 var url = $elem.data("href") || $elem.attr("href"); 24939 url = SS_Kana.url(url.replace(/\.html/, ".json")); 24940 url = SS_Translate.url(url.replace(/\.html/, ".json"), $("body").data("translate")); 24941 24942 var ref = SS_Translate.url(location.pathname, false); 24943 24944 $elem.append(" " + SS.loading); 24945 var $elemParent = $elem.parent(); 24946 $.ajax({ 24947 type: "GET", 24948 url: url, 24949 dataType: "json", 24950 data: "ref=" + ref, 24951 success: function (data) { 24952 $elem.replaceWith(data); 24953 }, 24954 error: function (_xhr, _status, _error) { 24955 $elem.remove(); 24956 }, 24957 complete: function () { 24958 SS.partCountToLoad = SS.partCountToLoad - 1; 24959 // $elem ã¯ããã¼ãã«æåããå ´å㯠replaceWith ã«ããããã¼ãã«å¤±æããå ´å㯠remove() ã«ãã DOM ããªã¼ããåé¤ããã¦ããã 24960 // DOM ããªã¼ããåé¤ããã¦ããã®ã§ã$elem ã§ã¤ãã³ããçºçããã¦ãç¡é§ã誰ãã¤ãã³ããè£è¶³ã§ããªãã 24961 // ããã§ $elem ã®è¦ªãã¼ãã§ã¤ãã³ããçºçãããã 24962 $elemParent.trigger("ss:ajaxPartComplete"); 24963 if (SS.partCountToLoad === 0) { 24964 SS_Recommend.render(); 24965 } 24966 } 24967 }); 24968 }; 24969 24970 SS.ajaxForm = function (elem, selector, params) { 24971 if (typeof selector !== "string") { 24972 params = params || selector; 24973 selector = undefined; 24974 } 24975 if (!params) { 24976 params = {}; 24977 } 24978 elem = $(elem); 24979 var defaults = { 24980 url: elem.attr("action") + ".json", 24981 dataType: "json", 24982 success: function () { 24983 }, 24984 error: function (data, _status) { 24985 alert([ "== Error(AjaxForm) ==" ].concat(data.responseJSON).join("\n")); 24986 } 24987 }; 24988 elem.on("submit", selector, function (e) { 24989 var options; 24990 24991 if ($.isFunction(params)) { 24992 options = params(); 24993 } else { 24994 options = params; 24995 } 24996 24997 $(this).ajaxSubmit($.extend(true, defaults, options)); 24998 e.preventDefault(); 24999 }); 25000 }; 25001 25002 SS.ajax = function (elem, selector, params) { 25003 if (typeof selector !== "string") { 25004 params = params || selector; 25005 selector = undefined; 25006 } 25007 if (!params) { 25008 params = {}; 25009 } 25010 return $(elem).on("click", selector, function (e) { 25011 var defaults, self; 25012 self = $(this); 25013 defaults = { 25014 url: self.attr("href"), 25015 beforeSend: function () { 25016 return self.html(SS.loading); 25017 }, 25018 success: function () { 25019 }, 25020 error: function (_data, _status) { 25021 return alert("== Error(Ajax) =="); 25022 } 25023 }; 25024 $.ajax($.extend(true, defaults, params)); 25025 e.preventDefault(); 25026 return false;
25027 }); 25028 }; 25029 25030 SS.ajaxDelete = function (elem, selector, params) { 25031 if (typeof selector !== "string") { 25032 params = params || selector; 25033 selector = undefined; 25034 } 25035 if (!params) { 25036 params = {}; 25037 } 25038 25039 $(elem).on("click", selector, function (e) { 25040 var defaults, self; 25041 if (!confirm(i18next.t('ss.confirm.delete'))) { 25042 return false; 25043 } 25044 self = $(this); 25045 defaults = { 25046 type: "POST", 25047 data: "_method=delete", 25048 url: self.attr("href") + ".json", 25049 dataType: "json", 25050 beforeSend: function () { 25051 self.html(SS.loading); 25052 }, 25053 success: function () { 25054 if (self.data("remove")) { 25055 $(self.data("remove")).remove(); 25056 } 25057 }, 25058 error: function (data, _status) { 25059 alert([ "== Error(AjaxDelete) ==" ].concat(data.responseJSON).join("\n")); 25060 } 25061 }; 25062 $.ajax($.extend(true, defaults, params)); 25063 e.preventDefault(); 25064 return false; 25065 }); 25066 }; 25067 25068 SS.notice = function (message, opts) { 25069 if (!opts) { 25070 opts = {}; 25071 } 25072 25073 SS.clearNotice(message); 25074 25075 var notice = $('#notice'); 25076 if (!notice.hasClass('js-notice')) { 25077 notice.addClass('js-notice').on("click", function () { 25078 return notice.slideUp('normal'); 25079 }); 25080 } 25081 notice.find('.wrap').html(message); 25082 notice.slideDown('normal'); 25083 if (opts) { 25084 if (opts.timeout === 0) { 25085 return; 25086 } 25087 } 25088 SS.noticeTimeoutId = setTimeout((function () { 25089 return $('#notice').slideUp('normal'); 25090 }), 1800); 25091 25092 return SS.noticeTimeoutId; 25093 }; 25094 25095 SS.clearNotice = function (message) { 25096 if (SS.noticeTimeoutId) { 25097 clearTimeout(SS.noticeTimeoutId); 25098 SS.noticeTimeoutId = null; 25099 } 25100 25101 var $notice = $('#notice'); 25102 $notice.hide(); 25103 25104 var $wrap = $notice.find('.wrap'); 25105 var save = $wrap.html(); 25106 $wrap.html(message || ''); 25107 25108 return save; 25109 }; 25110 25111 SS.formChanged = undefined; 25112 SS.disableConfirmUnloading = false; 25113 $(window).on("beforeunload", function () { 25114 if (SS.formChanged && !SS.disableConfirmUnloading) { 25115 return i18next.t('ss.confirm.unload'); 25116 } 25117 }); 25118 25119 SS.confirmUnloading = function () { 25120 $("#item-form").each(function() { 25121 if (this.dataset.controller) { 25122 if (this.dataset.controller.includes("ss--confirm-unloading")) { 25123 return; 25124 } else { 25125 this.dataset.controller = this.dataset.controller + " ss--confirm-unloading"; 25126 } 25127 } else { 25128 this.dataset.controller = "ss--confirm-unloading"; 25129 } 25130 }); 25131 SS.formChanged = undefined; 25132 }; 25133 25134 SS.randomPassword = function (length) { 25135 var chars, i, j, pass, ref1; 25136 if (length == null) { 25137 length = 8; 25138 } 25139 chars = 'abcdefghijkmnopqrstuvwxyz!@#$%&-+ABCDEFGHIJKLMNOP234567890'; 25140 pass = ''; 25141 for (i = j = 0, ref1 = length; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { 25142 i = Math.floor(Math.random() * chars.length); 25143 pass += chars.charAt(i); 25144 } 25145 return pass; 25146 }; 25147 25148 SS.fileCheck = function () { 25149 $('#item_files').on("change", function () { 25150 var $uploaderAlertMessage = $(".js-uploader-alert-message"); 25151 25152 var uploadedFile = $(this).val(); 25153 if (!uploadedFile) { 25154 return; 25155 } 25156 25157 $uploaderAlertMessage.html(SS.loading); 25158 $uploaderAlertMessage.show(); 25159 25160 $.ajax({ 25161 type: "get", 25162 url: location.pathname, 25163 dataType: "json", 25164 data: { 25165 "do": "check", 25166 item_files: uploadedFile 25167 }, 25168 success: function (data) { 25169 if (data["message"]) { 25170 $uploaderAlertMessage.html(data["message"]); 25171 $uploaderAlertMessage.show(); 25172 } else { 25173 $uploaderAlertMessage.html('ok'); 25174 $uploaderAlertMessage.show(); 25175 } 25176 }, 25177 error: function (xhr, _status) { 25178 var errors; 25179 try { 25180 errors = $.parseJSON(xhr.responseText); 25181 } catch (_error) { 25182 errors = xhr["statusText"] 25183 } 25184 var message = [ "== Error(FileCheck) ==" ].concat(errors).join("\n"); 25185 $uploaderAlertMessage.html(message); 25186 $uploaderAlertMessage.show(); 25187 if (SS.env !== 'test') { 25188 alert(message); 25189 } 25190 } 25191 }); 25192 }); 25193 }; 25194 25195 // renderAjaxBox([box][, params]) 25196 SS.renderAjaxBox = function () { 25197 var box = null; 25198 var params = null; 25199 25200 // parse arguments 25201 if (arguments.length > 0) { 25202 if (typeof (arguments[0]) === "object") { 25203 if (arguments[0].jquery) { 25204 box = arguments[0]; 25205 } else { 25206 params = arguments[0]; 25207 } 25208 } else { 25209 box = $(arguments[0]); 25210 } 25211 25212 if (!params && arguments.length > 1) { 25213 params = arguments[1]; 25214 } 25215 } 25216 25217 if (!box) { 25218 box = $(document); 25219 } 25220 25221 if (!params) { 25222 params = { 25223 fixed: true, 25224 width: "90%", 25225 height: "90%", 25226 onOpen: function () { 25227 $("#cboxContent").data('on-select', null); 25228 } 25229 }; 25230 } 25231 25232 box.find(".ajax-box:not(.cboxElement)").each(function () { 25233 var elem = $(this); 25234 if (elem.attr("target") || elem.data("target") || typeof elem.colorbox === 'undefined') { 25235 return; 25236 } 25237 25238 elem.colorbox(params); 25239 }); 25240 }; 25241 25242 // datetimepicker 25243 25244 SS.rubyToMomenFormatMap = [ 25245 [ "%Y", "YYYY" ], 25246 [ "%y", "YY" ], 25247 [ "%m", "MM" ], 25248 [ "%1m", "M" ], 25249 [ "%B", "MMMM" ], 25250 [ "%b", "MMM" ], 25251 [ "%d", "DD" ], 25252 [ "%1d", "D" ], 25253 [ "%H", "HH" ], 25254 [ "%1H", "H" ], 25255 [ "%I", "hh" ], 25256 [ "%1I", "h" ], 25257 [ "%P", "a" ], 25258 [ "%p", "A" ], 25259 [ "%M", "mm" ], 25260 [ "%A", "dddd" ], 25261 [ "%a", "ddd" ], 25262 ]; 25263 25264 SS.convertDateTimeFormat = function(format) { 25265 $.each(SS.rubyToMomenFormatMap, function() { 25266 var from = this[0]; 25267 var to = this[1]; 25268 25269 from = new RegExp(from, "g"); 25270 format = format.replace(from, to); 25271 }); 25272 25273 // "(" ã®ãããªæåãã¨ã¹ã±ã¼ãããï¼moment ã®ã¨ã¹ã±ã¼ãã¯ã¨ã¹ã±ã¼ããããæååã "[" 㨠"]" ã§å²ãï¼ 25274 format = format.replaceAll(/[^A-Za-z ,/:]+/g, function(match) { return "[" + match + "]"; }); 25275 25276 return format; 25277 }; 25278 25279 SS.renderDateTimePicker = function (rooElement) { SS_DateTimePicker.render(rooElement) } 25280 25281 // SS.formatTime("2019-07-09T14:33:38+0900") = "2019/7/9 14:33" 25282 // SS.formatTime("2019-07-09T14:33:38+0900", "default") = "2019/7/9 14:33" 25283 // 25284 // You can pass a Date or moment instance to 1st argument 25285 // 25286 // SS.formatTime(new Date()) 25287 // SS.formatTime(moment()) 25288 SS.formatTime = function (time, format) { 25289 if (!time) { 25290 return time; 25291 } 25292 if ("i18next" in window) { 25293 if (!format) { 25294 format = "default" 25295 } 25296 format = i18next.t("time.formats." + format, format); 25297 } else { 25298 format = SS.DEFAULT_TIME_FORMAT; 25299 } 25300 format = SS.convertDateTimeFormat(format); 25301 25302 return moment(time).format(format); 25303 }; 25304 25305 SS.formatDate = function (date, format) { 25306 if (!date) { 25307 return date; 25308 } 25309 if ("i18next" in window) { 25310 if (!format) { 25311 format = "default" 25312 } 25313 format = i18next.t("date.formats." + format, format); 25314 } else { 25315 format = SS.DEFAULT_DATE_FORMAT; 25316 } 25317 format = SS.convertDateTimeFormat(format); 25318 25319 return moment(date).format(format); 25320 }; 25321 25322 SS.renderFileUpload = function () { 25323 $(".ss-file-field .btn-file-upload").each(function () { 25324 var $uploadBtn = $(this); 25325 SS.justOnce(this, "ss-file-field", function() { 25326 if ($uploadBtn.data("on-select")) { 25327 return; 25328 } 25329 25330 var $container = $uploadBtn.closest(".ss-file-field") 25331 var onSelect = function ($item) { 25332 $.colorbox.close(); 25333 25334 var $data = $item.closest("[data-id]"); 25335 var fileId = $data.data('id'); 25336 var fileName = $data.data("humanizedName") || $data.data("name") || $data.find(".select-item").text() || $item.text() || $data.text(); 25337 if (!fileId || !fileName) { 25338 return; 25339 } 25340 25341 $container.find(".humanized-name").text(fileName); 25342 $container.find(".file-id").val(fileId); 25343 $container.find(".sanitizer-status").replaceWith($data.find('.sanitizer-status')); 25344 $container.find(".btn-file-delete").removeClass("hide"); 25345 $container.find(".upload-drop-notice").addClass("hide"); 25346 }; 25347 25348 $uploadBtn.data("on-select", onSelect); 25349 25350 $container.find(".dropdown-item").on("click", function (ev) { 25351 ev.preventDefault(); 25352 25353 var $el = $(this); 25354 var href = $el.attr("href"); 25355 25356 $uploadBtn.attr("href", href).text($el.text()).trigger("click"); 25357 25358 var $dropdown = $el.closest(".dropdown") 25359 $dropdown.removeClass('active'); 25360 $dropdown.find(".dropdown-menu").removeClass('active'); 25361 25362 return false;
25363 }); 25364 25365 var dropEventTriggered = false; 25366 var dropNoticeHtml = $container.find(".upload-drop-notice").html(); 25367 $container.on("dragenter", function (_ev) { 25368 if (!dropEventTriggered) { 25369 $container.addClass('file-dragenter'); 25370 } 25371 return false; 25372 }); 25373 $container.on("dragleave", function (_ev) { 25374 $container.removeClass('file-dragenter'); 25375 return false; 25376 }); 25377 $container.on("dragover", function (_ev) { 25378 if (!dropEventTriggered) { 25379 $container.addClass('file-dragenter'); 25380 } 25381 return false; 25382 }); 25383 $container.on("drop", function (ev) { 25384 $container.removeClass('file-dragenter'); 25385 25386 var files = ev.originalEvent.dataTransfer.files; 25387 if (files.length === 0) { 25388 return false; 25389 } 25390 25391 if (dropEventTriggered) { 25392 return false; 25393 } 25394 dropEventTriggered = true; 25395 $container.find(".upload-drop-notice").html(SS.loading).removeClass("hide"); 25396 $container.css("cursor", "progress"); 25397 25398 var token = $('meta[name="csrf-token"]').attr('content'); 25399 var formData = new FormData(); 25400 formData.append('authenticity_token', token); 25401 var defaultFileResizing = SS_AjaxFile.defaultFileResizing(); 25402 if (defaultFileResizing) { 25403 formData.append('item[resizing]', defaultFileResizing); 25404 } 25405 for (var j = 0, len = files.length; j < len; j++) { 25406 formData.append('item[in_files][]', files[j]); 25407 } 25408 25409 var uploadUrl = $uploadBtn.attr("href"); 25410 $.ajax({ 25411 url: uploadUrl, 25412 type: "POST", 25413 dataType: "JSON", 25414 data: formData, 25415 processData: false, 25416 contentType: false 25417 }).then(function (data) { 25418 // success 25419 var fileData = data[0]; 25420 if (!fileData) { 25421 return; 25422 } 25423 25424 $container.find(".humanized-name").text(fileData["humanized_name"]); 25425 $container.find(".file-id").val(fileData["id"] || fileData["_id"]); 25426 $container.find(".sanitizer-status").addClass("hide"); 25427 $container.find(".btn-file-delete").removeClass("hide"); 25428 $container.find(".upload-drop-notice").addClass("hide"); 25429 }, function (xhr, _textStatus, _errorThrown) { 25430 // error 25431 if (xhr.status === 413) { 25432 alert([ "== Error(FileUpload) ==" ].concat(i18next.t('errors.messages.request_entity_too_large')).join("\n")); 25433 } else if (xhr.responseJSON && Array.isArray(xhr.responseJSON)) { 25434 alert([ "== Error(FileUpload) ==" ].concat(xhr.responseJSON).join("\n")); 25435 } else { 25436 alert([ "== Error(FileUpload) ==" ].concat(xhr.statusText).join("\n")); 25437 } 25438 }).then(function () { 25439 // complete 25440 dropEventTriggered = false; 25441 $container.find(".upload-drop-notice").html(dropNoticeHtml); 25442 $container.css("cursor", "auto"); 25443 }); 25444 25445 return false; 25446 }); 25447 }); 25448 }); 25449 25450 SS.justOnce(document, "ss-file-field", function() { 25451 $(document).on("click", ".ss-file-field .btn-file-delete", function () { 25452 var $this = $(this); 25453 var $container = $this.closest(".ss-file-field") 25454 $container.find(".humanized-name").text(""); 25455 $container.find(".file-id").val(""); 25456 $container.find(".sanitizer-status").addClass("hide"); 25457 $container.find(".btn-file-delete").addClass("hide"); 25458 $container.find(".upload-drop-notice").removeClass("hide"); 25459 25460 return false; 25461 }); 25462 }); 25463 }; 25464 25465 SS.timeoutAfterSubmit = function() { 25466 $(document).on("submit", "form", function (ev) { 25467 var $form = $(ev.target); 25468 var timeout = $form.data("ss-timeout") || SS.defaultTimeoutMillis; 25469 25470 if (timeout > -1) { 25471 setTimeout(function () { 25472 $form.trigger("ss:submitTimeout"); 25473 }, timeout); 25474 } 25475 }); 25476 }; 25477 25478 SS.enableFormElementsOnTimeoutSubmit = function() { 25479 $(document).on("ss:submitTimeout", function (ev) { 25480 var $form = $(ev.target); 25481 $.rails.enableFormElements($form); 25482 }); 25483 }; 25484 25485 SS.onDoubleClickGuardClick = function(ev) { 25486 var $element = $(ev.target); 25487 var timeout = $element.data("ss-timeout") || SS.defaultTimeoutMillis; 25488 25489 $.rails.disableFormElement($element); 25490 if (timeout > -1) { 25491 setTimeout(function () { 25492 $element.trigger("ss:clickTimeout"); 25493 }, timeout); 25494 } 25495 }; 25496 25497 SS.onClickTimeout = function(ev) { 25498 var $element = $(ev.target); 25499 $.rails.enableFormElement($element); 25500 }; 25501 25502 SS.enableDoubleClickGuard = function () { 25503 SS.timeoutAfterSubmit(); 25504 SS.enableFormElementsOnTimeoutSubmit(); 25505 25506 $(document).on("click", ".ss-dc-guard", SS.onDoubleClickGuardClick); 25507 $(document).on("ss:clickTimeout", SS.onClickTimeout); 25508 }; 25509 25510 SS.debugLog = function () { 25511 if (SS.debug) { 25512 console.log.apply(console, arguments); 25513 } 25514 }; 25515 25516 return SS; 25517 25518})(); 25519 25520 25521 25522 25523 25524 25525 25526 25527 25528 25529 25530 25531 25532 25533 25534 25535 25536 25537 25538 25539 25540 25541 25542 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 25559 25560 25561SS.ready(function () { 25562 SS_Kana.render(); 25563 SS_Translate.render(); 25564 SS_Font.render(); 25565 SS_AdobeReader.render(); 25566 SS_Mobile.render(); 25567 var $voiceTags = $('#ss-voice,[data-tool="ss-voice"]'); 25568 $voiceTags.each(function (index, voiceTag) { 25569 SS.justOnce(voiceTag, "ss-voice", function() { 25570 var voiceInstance = new SS_Voice(); // Instantiate SS_Voice for each voiceTag 25571 voiceInstance.render($(voiceTag), index); // Pass the voiceTag to the render method 25572 }); 25573 }); 25574 SS_Theme.render(); 25575 SS.renderAjaxBox(); 25576 SS.partCountToLoad = $(".ss-part").length; 25577 if (SS.partCountToLoad === 0) { 25578 SS_Recommend.render(); 25579 } 25580 $(".ss-part").each(function () { 25581 SS.renderPart($(this)); 25582 }); 25583 SS_DateTimePicker.render(); 25584 SS_SearchUI.render(); 25585 SS.enableDoubleClickGuard(); 25586 SS_Print.render(); 25587 SS_ClipboardCopy.render(); 25588}); 25589 25590this.SS_Kana = (function () { 25591 function SS_Kana() { 25592 } 25593
25594 SS_Kana.dir = "/kana"; 25595 25596 SS_Kana.siteUrl = "/"; 25597 25598 SS_Kana.kanaUrl = "/kana" + "/"; 25599 25600 SS_Kana.render = function () { 25601 if (SS.config["site_url"] && SS.config["kana_url"]) { 25602 SS_Kana.siteUrl = SS.config["site_url"]; 25603 SS_Kana.kanaUrl = SS.config["kana_url"]; 25604 } 25605 25606 const kanaElements = document.querySelectorAll('#ss-kana, [data-tool="ss-kana"]'); 25607 kanaElements.forEach((kanaElement, index) => { 25608 if (!kanaElement) return; 25609 25610 SS.justOnce(kanaElement, "ss-kana", function() { 25611 const pathname = location.pathname; 25612 let url, cssClass; 25613 if (document.body.dataset.kana) { 25614 url = SS_Kana.url(pathname, false); 25615 url = SS_Translate.url(url); 25616 cssClass = "off"; 25617 } else { 25618 url = SS_Translate.url(pathname, false) 25619 url = SS_Kana.url(url, true); 25620 cssClass = "on"; 25621 } 25622 if (url[0] !== '/') { 25623 // "javascript:alert('xss')" ã®ãã㪠URL ã location.href ã«ã»ãããã¦ãã¾ã㨠xss ã¨ãã¤ã¢ãã°ã表示ããã¦ãã¾ãã 25624 // å é ã "/" ãã©ããããã§ãã¯ãããã¨ã§ããã®ç¨®ã®èå¼±æ§ãé²ãã 25625 return; 25626 } 25627 25628 // legacyï¼htmlã«buttonãå«ã¾ãã¦ããªããâ a ã¿ã°ãçæ 25629 if (kanaElement.dataset.toolType === "button") { 25630 const buttonId = 'kana_button_' + index; 25631 const content = kanaElement.innerHTML; 25632 const button = document.createElement('button'); 25633 button.id = buttonId; 25634 button.className = cssClass; 25635 button.setAttribute('name', 'kana'); 25636 button.setAttribute('type', 'button'); 25637 button.setAttribute('aria-pressed', (cssClass === 'on') ? 'false' : 'true'); 25638 button.innerHTML = content; 25639 kanaElement.innerHTML = ''; 25640 kanaElement.appendChild(button); 25641 25642 button.addEventListener('click', function(ev){ 25643 ev.preventDefault(); 25644 const expressed = (this.getAttribute('aria-pressed') === 'true') ? 'false' : 'true'; 25645 this.setAttribute('aria-pressed', expressed); 25646 location.href = url; 25647 }); 25648 } else { 25649 const anchorId = 'kana_a_' + index; 25650 const content = kanaElement.innerHTML; 25651 const anchor = document.createElement('a'); 25652 anchor.id = anchorId; 25653 anchor.className = cssClass; 25654 anchor.href = '#' + url; 25655 anchor.rel = 'nofollow'; 25656 anchor.innerHTML = content; 25657 kanaElement.innerHTML = ''; 25658 kanaElement.appendChild(anchor); 25659 25660 anchor.addEventListener("click", function (ev) { 25661 ev.preventDefault(); 25662 const clickedUrl = this.getAttribute('href').substring(1); // Remove '#' 25663 location.href = clickedUrl; 25664 return false; 25665 }); 25666 } 25667 }); 25668 }); 25669 }; 25670 25671 SS_Kana.url = function (url, bool) { 25672 if (bool == null) { 25673 bool = null; 25674 } 25675 if (bool === null) { 25676 bool = $("body").data("kana"); 25677 } 25678 if (bool) { 25679 url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + this.siteUrl), "$1" + this.kanaUrl); 25680 } else { 25681 url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + this.kanaUrl), "$1" + this.siteUrl); 25682 } 25683 return url; 25684 }; 25685 25686 SS_Kana.loadPage = function (elem) { 25687 $.ajax({ 25688 type: "GET", 25689 url: elem.attr("href"), 25690 dataType: "html", 25691 success: function (data) { 25692 let body; 25693 body = $("body"); 25694 body.data("kana", elem.hasClass("on")); 25695 return body.html(data.replace(/[\s\S]*<body.*?>([\s\S]*)<\/body>[\s\S]*/, "$1")); 25696 } 25697 }); 25698 return false; 25699 }; 25700 25701 return SS_Kana; 25702 25703})(); 25704 25705this.SS_Translate = (function () { 25706 function SS_Translate() { 25707 } 25708 25709 SS_Translate.dir = "/translate"; 25710 25711 SS_Translate.siteUrl = "/"; 25712 25713 SS_Translate.translateUrl = "/translate" + "/"; 25714 25715 SS_Translate.url = function (url, target) { 25716 if (target) { 25717 var targetUrl = this.translateUrl + target + "/"; 25718 url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + this.siteUrl), "$1" + targetUrl); 25719 } else { 25720 var targetUrl = this.translateUrl + $("body").data("translate") + "/"; 25721 url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + targetUrl), "$1" + this.siteUrl); 25722 } 25723 return url; 25724 }; 25725 25726 SS_Translate.render = function () { 25727 if (SS.config["site_url"] && SS.config["translate_url"]) { 25728 SS_Translate.siteUrl = SS.config["site_url"]; 25729 SS_Translate.translateUrl = SS.config["translate_url"]; 25730 } 25731 }; 25732 25733 return SS_Translate; 25734 25735})(); 25736 25737//èæ¯è² 25738this.SS_Theme = (function () { 25739 function SS_Theme() { 25740 } 25741 25742 SS_Theme.render = function () { 25743 const $themes = $('#ss-theme,[data-tool="ss-theme"]'); 25744 if ($themes.length === 0) { 25745 return; 25746 } 25747 25748 $themes.each(function(index) { 25749 const $theme = $(this); 25750 SS.justOnce(this, "ss-theme", function() { 25751 $theme.attr("aria-busy", "true"); 25752 25753 let cls; 25754 const theme = SS.config["theme"]; 25755 let inlineStyle = ''; 25756 const isButton = $theme.is('[data-tool-type="button"]'); 25757 for (const cls in theme) { 25758 let $el = $theme.find("." + $.escapeSelector(cls)); 25759 if (!$el.length) continue; 25760 25761 if (isButton) { 25762 $el.each(function () { 25763 const $el = $(this); 25764 // å ã®è¦ç´ (ã¾ãã¯åè¦ç´ )ã« aria-label ãããã°åå¾ 25765 let ariaLabel = $el.attr("aria-label"); 25766 if (!ariaLabel) { 25767 const $labelEl = $el.find("[aria-label]").first(); 25768 if ($labelEl.length > 0) { 25769 ariaLabel = $labelEl.attr("aria-label"); 25770 } 25771 } 25772 const $btn = $("<button>", { 25773 type: "button", 25774 name: $el.attr("class"), 25775 class: $el.attr("class"), 25776 "data-ss-theme": cls, 25777 "aria-pressed": "false" 25778 }).html($el.html()); 25779 if (ariaLabel) { 25780 $btn.attr("aria-label", ariaLabel); 25781 } 25782 $el.replaceWith($btn); 25783 }); 25784 $el = $theme.find("button." + $.escapeSelector(cls)); 25785 } else { 25786 $el.each(function () { 25787 const $el = $(this); 25788 const $a = $("<a>", { 25789 href: "#", 25790 name: $el.attr("class"), 25791 class: $el.attr("class"), 25792 "data-ss-theme": cls, 25793 "aria-pressed": "false" 25794 }).html($el.html()); 25795 $el.replaceWith($a); 25796 }); 25797 $el = $theme.find("a." + $.escapeSelector(cls)); 25798 } 25799 const elId = "ss-theme-" + index + "-" + cls;
25799 // Unique ID for the anchor 25800 $el.attr("id", elId); // Assign the unique ID to the anchor 25801 const v = theme[cls]; 25802 if (v["css_path"]) { 25803 const $styleSheetLink = $('<link />', { 25804 rel: "alternate stylesheet", 25805 type: "text/css", 25806 title: v["name"], 25807 href: v["css_path"], 25808 class: "ss-theme " + $.escapeSelector(cls), 25809 disabled: true 25810 }); 25811 $('head').append($styleSheetLink); 25812 } 25813 if (v["font_color"] && v["background_color"]) { 25814 inlineStyle += SS_Theme.cssTemplate(cls, v["font_color"], v["background_color"]) + "\n"; 25815 } 25816 if (v["default_theme"]) { 25817 $theme.find("[data-ss-theme]").removeClass('active'); 25818 $el.addClass('active').attr('aria-pressed', true); 25819 SS_Theme.switchTheme(cls); 25820 } 25821 $el.on("click", function () { 25822 const $this = $(this); 25823 const cls = $this.data("ss-theme"); 25824 $themes.find("[data-ss-theme]").removeClass('active').attr('aria-pressed', false); 25825 $themes.find("[data-ss-theme='" + $.escapeSelector(cls) + "']").addClass('active').attr('aria-pressed', true); 25826 Cookies.set("ss-theme", cls, { 25827 expires: 7, 25828 path: '/' 25829 }); 25830 SS_Theme.switchTheme(cls); 25831 return false; 25832 }); 25833 } 25834 25835 if (inlineStyle) { 25836 const $inlineStyle = $("<style />", {type: "text/css", class: "ss-theme"}).text(inlineStyle); 25837 $("head").append($inlineStyle); 25838 } 25839 25840 cls = Cookies.get("ss-theme"); 25841 if (!theme[cls]) { 25842 Cookies.remove("ss-theme"); 25843 cls = null; 25844 } 25845 if (cls) { 25846 $theme.find('[data-ss-theme]').removeClass('active').attr('aria-pressed', false); 25847 $theme.find('[data-ss-theme="' + $.escapeSelector(cls) + '"]').addClass('active').attr('aria-pressed', true); 25848 SS_Theme.switchTheme(cls); 25849 } 25850 25851 $theme.attr("aria-busy", "false").trigger("ss:ready"); 25852 }); 25853 }); 25854 }; 25855 25856 SS_Theme.cssTemplate = function (cls, color, backgroundColor) { 25857 return "body[data-ss-theme=\"" + $.escapeSelector(cls) + "\"] * {\n border-color: " + color + " !important;\n background-color: " + backgroundColor + " !important;\n color: " + color + " !important;\n}"; 25858 }; 25859 25860 SS_Theme.switchTheme = function (cls) { 25861 $('head link.ss-theme').prop("disabled", true); 25862 $('head link.ss-theme.' + $.escapeSelector(cls)).prop("disabled", false); 25863 $("body").attr("data-ss-theme", cls); 25864 }; 25865 25866 return SS_Theme; 25867 25868})(); 25869 25870this.SS_AdobeReader = (function () { 25871 function SS_AdobeReader() { 25872 } 25873 25874 SS_AdobeReader.render = function () { 25875 if ($("a[href$='.pdf']").length) { 25876 return $("#ss-adobe-reader, .ss-adobe-reader").each(function () { 25877 return $(this).html("\u003cdiv\u003ePDFãã¡ã¤ã«ãã覧ããã ãããã«ã¯ãAdobe Readerã®ãã©ã°ã¤ã³ï¼ç¡åï¼ãå¿ è¦ã¨ãªãã¾ãããæã¡ã§ãªãå ´åã¯ãã使ãã®æ©ç¨®ã¨ã¹ããã¯ã«åããããã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ãã¦ãã ããã\u003c/div\u003e\u003ca href=\"https://get.adobe.com/jp/reader/\"\u003eAdobe Readerããã¦ã³ãã¼ããã\u003c/a\u003e").show(); 25878 }); 25879 } 25880 }; 25881 25882 return SS_AdobeReader; 25883 25884})(); 25885 25886this.SS_Tabs = (function () { 25887 function SS_Tabs() { 25888 } 25889 25890 SS_Tabs.render = function (box) { 25891 var $box = $(box); 25892 var anchors = []; 25893 $box.find(".tab").each(function (index) { 25894 var $tab = $(this); 25895 var name = $tab.find('> header h2').text(); 25896 var $nav = $tab.find('nav'); 25897 var url = $nav.find(".more").attr("href"); 25898 var altClass = $tab.attr('data-class'); 25899 var baseId = $tab.attr("id"); 25900 var nameId = baseId + "-name"; 25901 var viewId = baseId + "-view"; 25902 if (!url) { 25903 url = "#" + viewId; 25904 } 25905 var tabCls = index === 0 ? "name current" : "name"; 25906 if (altClass) { 25907 tabCls = tabCls + " " + altClass; 25908 } 25909 25910 var $anchor = $("<a />", { id: nameId, class: tabCls, href: url }).text(name); 25911 $anchor.on("click", function() { 25912 return SS_Tabs.select(box, "#" + nameId, "#" + viewId); 25913 }); 25914 anchors.push($anchor); 25915 25916 var bodyCls = 'view'; 25917 if (altClass) { 25918 bodyCls = bodyCls + " " + altClass; 25919 } 25920 25921 var $html = $("<article />", { id: viewId, class: bodyCls }); 25922 if (index !== 0) { 25923 $html.css("display", "none") 25924 } 25925 $html.append($("<h2 />", { style: "display: none;" }).text(name)); 25926 $html.append($("<div />", { class: "pages" }).html($tab.find(".pages").html())); 25927 if ($tab.find('nav').length) { 25928 $html.append($("<nav />").html($tab.find('nav').html())); 25929 } 25930 $box.append($html); 25931 $tab.remove(); 25932 }); 25933 25934 $box.prepend($("<nav />", { class: 'names' }).html(anchors)); 25935 }; 25936 25937 SS_Tabs.select = function (box, name, view) { 25938 $(box).find(".name").each(function () { 25939 return $(this).removeClass("current"); 25940 }); 25941 $(box).find(".view").each(function () { 25942 return $(this).hide(); 25943 }); 25944 $(name).addClass("current"); 25945 $(view).show(); 25946 return false;
25947 }; 25948 25949 return SS_Tabs; 25950 25951})(); 25952function SS_Voice() { 25953 this.voiceConfig = { 25954 'location': "/.voice", 25955 'loading-resource': "/assets/voice/voice-loading.mp3", 25956 'disabled-resource': "/assets/voice/voice-disabled.mp3", 25957 'overload-resource': "/assets/voice/voice-overload.mp3" 25958 }; 25959 25960 this.url = null; 25961 25962 this.$voiceTag = null; 25963 25964 this.voiceController = null; 25965 25966 this.state = null; 25967 25968 this.cancelLoading = null; 25969 25970 this.timerId = null; 25971} 25972 25973SS_Voice.prototype.render = function ($voiceTag, index_1) { 25974 const self = this; 25975 const index = index_1; 25976 self.url = self.requestUrl(); 25977 25978 if ($voiceTag.is('[data-tool-type="button"]')) { 25979 const button = $('<button/>', { 25980 type: "button", 25981 name: "voice", 25982 "aria-expanded": "false", 25983 "aria-haspopup": "dialog" 25984 }).html($voiceTag.html()); 25985 $voiceTag.html(''); 25986 button.appendTo($voiceTag); 25987 self.$voiceTag = button; 25988 } else { 25989 const anchor = $('<a rel="nofollow"/>').attr('href', "#/voice/").html($voiceTag.html()); 25990 $voiceTag.html(''); 25991 anchor.appendTo($voiceTag); 25992 self.$voiceTag = anchor; 25993 } 25994 25995 const controllerId = 'ss-voice-controller-' + index; 25996 const voice_controller = $('<div id="' + controllerId + '" class="ss-voice-controller" style="display: none;"/>'); 25997 self.$voiceTag.attr("aria-controls", controllerId); 25998 self.$voiceTag.after(voice_controller); 25999 self.voiceController = new SS_VoiceController(voice_controller[0], index); 26000 self.state = null; 26001 self.cancelLoading = false; 26002 self.timerId = null; 26003 self.init(); 26004 voice_controller.find('.ss-jp-close').on('click', self.cancel.bind(self)); 26005}; 26006 26007SS_Voice.prototype.init = function () { 26008 this.state = 'init'; 26009 this.voiceController.stop(); 26010 this.setAction(this.load.bind(this)); 26011 this.cancelLoading = false; 26012 return false; 26013}; 26014 26015SS_Voice.prototype.setAction = function (action) { 26016 this.$voiceTag.off('click'); 26017 this.$voiceTag.on('click', action); 26018}; 26019 26020SS_Voice.prototype.load = function (ev) { 26021 const self = this; 26022 this.$voiceTag.attr("aria-expanded", "true"); 26023 if (this.cancelLoading) { 26024 if (ev) { 26025 ev.preventDefault(); 26026 } 26027 return false; 26028 } 26029 26030 $.ajax({ 26031 type: 'HEAD', 26032 url: this.url, 26033 cache: false, 26034 statusCode: { 26035 200: function () { 26036 return self.playAudio(); 26037 }, 26038 202: function (data, status, xhr) { 26039 let retry_after; 26040 self.renderLoading(); 26041 retry_after = xhr.getResponseHeader('Retry-After'); 26042 if (!retry_after) { 26043 retry_after = 5; 26044 } 26045 return self.timerId = setTimeout(self.load.bind(self), retry_after * 1000); 26046 } 26047 }, 26048 error: function (xhr, status, error) { 26049 return self.renderError(xhr.status); 26050 } 26051 }); 26052 26053 if (ev) { 26054 ev.preventDefault(); 26055 } 26056 return false; 26057}; 26058 26059SS_Voice.prototype.renderLoading = function () { 26060 let url; 26061 if (this.state === 'loading') { 26062 return false; 26063 } 26064 url = this.voiceConfig['loading-resource']; 26065 this.state = 'loading'; 26066 this.setAction(this.cancel.bind(this)); 26067 this.voiceController.play(url); 26068 return false; 26069}; 26070 26071SS_Voice.prototype.renderError = function (status) { 26072 let url; 26073 if (this.state === 'error') { 26074 return false; 26075 } 26076 if (this.timerId >= 0) { 26077 clearTimeout(this.timerId); 26078 } 26079 this.timerId = -1; 26080 if (status === 429) { 26081 url = this.voiceConfig['overload-resource']; 26082 } else { 26083 url = this.voiceConfig['disabled-resource']; 26084 } 26085 this.state = 'error'; 26086 this.setAction(this.cancel.bind(this)); 26087 this.voiceController.play(url); 26088 return false; 26089}; 26090 26091SS_Voice.prototype.cancel = function (ev) { 26092 this.cancelLoading = true; 26093 if (this.timerId !== null) { 26094 clearTimeout(this.timerId); 26095 } 26096 this.timerId = null; 26097 this.init(); 26098 this.$voiceTag.attr("aria-expanded", "false"); 26099 if (ev) { 26100 ev.preventDefault(); 26101 } 26102 return false; 26103}; 26104 26105SS_Voice.prototype.playAudio = function () { 26106 this.state = 'playing'; 26107 this.voiceController.play(this.url); 26108 this.setAction(this.cancel.bind(this)); 26109 return false; 26110}; 26111 26112SS_Voice.prototype.requestUrl = function () { 26113 let path, url; 26114 path = this.trimKanaDir(location.pathname); 26115 if (path === "/") { 26116 path = "/index.html"; 26117 } 26118 url = encodeURIComponent(this.normalizeProtocol(location.protocol) + '://' + location.host + path); 26119 url = this.normalizeLocation(this.voiceConfig['location']) + '/' + url; 26120 return url; 26121}; 26122 26123SS_Voice.prototype.trimKanaDir = function (path, kana_dir) { 26124 if (kana_dir == null) { 26125 kana_dir = SS_Kana.dir; 26126 } 26127 return path.replace(new RegExp('^' + kana_dir.replace('/', '\/') + '\/'), '/'); 26128}; 26129 26130SS_Voice.prototype.normalizeProtocol = function (protocol) { 26131 return protocol.replace(new RegExp(':$'), ''); 26132}; 26133 26134SS_Voice.prototype.normalizeLocation = function (location) { 26135 return location.replace(new RegExp('/$'), ''); 26136}; 26137 26138 26139this.SS_VoiceController = (function () { 26140 function SS_VoiceController(container, index) { 26141 this.status = 'stopped'; 26142 this.index = index || 0; 26143 this.container = $(container); 26144 this.initialized = false;
26145 this.container.html(this.template()); 26146 this.player = this.container.children('.jp-jplayer'); 26147 this.controller = this.container.children('.jp-audio'); 26148 } 26149 26150 SS_VoiceController.prototype.play = function (source) { 26151 this.stop(); 26152 this.status = 'playing'; 26153 this.container.show(); 26154 if (this.initialized) { 26155 this.player.jPlayer("setMedia", { 26156 title: document.title, 26157 mp3: source 26158 }); 26159 return this.player.jPlayer("play"); 26160 } else { 26161 return this.player.jPlayer({ 26162 ready: (function (_this) { 26163 return function () { 26164 _this.player.jPlayer("setMedia", { 26165 title: document.title, 26166 mp3: source 26167 }); 26168 if (_this.status === 'playing') { 26169 _this.player.jPlayer("play"); 26170 } 26171 return _this.initialized = true; 26172 }; 26173 })(this), 26174 autoBlur: false, 26175 cssSelectorAncestor: "#" + this.controller[0].id, 26176 keyEnabled: false, 26177 loop: true, 26178 remainingDuration: true, 26179 smoothPlayBar: true, 26180 supplied: "mp3", 26181 swfPath: "/assets/js/jplayer", 26182 toggleDuration: true, 26183 useStateClassSkin: true 26184 }); 26185 } 26186 }; 26187 26188 SS_VoiceController.prototype.stop = function () { 26189 if (!this.initialized) { 26190 return; 26191 } 26192 if (this.status === 'stopped') { 26193 return; 26194 } 26195 this.player.jPlayer("stop"); 26196 this.container.hide(); 26197 return this.status = 'stopped'; 26198 }; 26199 26200 SS_VoiceController.prototype.template = function () { 26201 let template = "<div id=\"jquery_jplayer_:TIMESTAMP:\" class=\"jp-jplayer\"></div>\n" + 26202 "<div id=\"jp_container_:TIMESTAMP:\" class=\"jp-audio\" role=\"application\" aria-label=\"media player\">\n" + 26203 " <div class=\"jp-type-single\">\n" + 26204 " <div class=\"jp-gui jp-interface\">\n" + 26205 " <div class=\"jp-controls\">\n" + 26206 " <button class=\"jp-play\" role=\"button\" tabindex=\"0\">play</button>\n" + 26207 " <button class=\"jp-stop\" role=\"button\" tabindex=\"0\">stop</button>\n" + 26208 " </div>\n" + 26209 " <div class=\"jp-progress\">\n" + 26210 " <div class=\"jp-seek-bar\">\n" + 26211 " <div class=\"jp-play-bar\"></div>\n" + 26212 " </div>\n" + 26213 " </div>\n" + 26214 " <div class=\"jp-volume-controls\">\n" + 26215 " <button class=\"jp-mute\" role=\"button\" tabindex=\"0\">mute</button>\n" + 26216 " <button class=\"jp-volume-max\" role=\"button\" tabindex=\"0\">max volume</button>\n" + 26217 " <div class=\"jp-volume-bar\">\n" + 26218 " <div class=\"jp-volume-bar-value\"></div>\n" + 26219 " </div>\n" + 26220 " </div>\n" + 26221 " <div class=\"jp-time-holder\">\n" + 26222 " <div class=\"jp-current-time\" role=\"timer\" aria-label=\"time\"> </div>\n" + 26223 " <div class=\"jp-toggles\">\n" + 26224 " <button class=\"jp-repeat\" role=\"button\" tabindex=\"0\">repeat</button>\n" + 26225 " </div>\n" + 26226 " </div>\n" + 26227 " <div class=\"ss-jp-dismiss\">\n" + 26228 " <button class=\"ss-jp-close\" role=\"button\" tabindex=\"0\">×</button>\n" + 26229 " </div>\n" + 26230 " </div>\n" + 26231 " </div>\n" + 26232 "</div>"; 26233 const timestamp = (new Date).getTime() + "_" + this.index; 26234 26235 template = template.replace(new RegExp(":TIMESTAMP:", 'g'), timestamp); 26236 return template; 26237 }; 26238 26239 return SS_VoiceController; 26240 26241})(); 26242 26243this.SS_Recommend = (function () { 26244 function SS_Recommend() { 26245 } 26246 26247 SS_Recommend.render = function () { 26248 var params, receiver_url, recommend; 26249 recommend = SS.config["recommend"]; 26250 if (!recommend) { 26251 return; 26252 } 26253 receiver_url = recommend["receiver_url"]; 26254 params = recommend["params"]; 26255 if (!(receiver_url && params)) { 26256 return; 26257 } 26258 params["access_url"] = location.href; 26259 return $.ajax({ 26260 type: 'GET', 26261 url: receiver_url, 26262 cache: false, 26263 dataType: 'json', 26264 data: params, 26265 error: function (req, status, error) { 26266 } 26267 }); 26268 }; 26269 26270 return SS_Recommend; 26271 26272})(); 26273 26274this.SS_Print = (function () { 26275 function SS_Print() { 26276 } 26277 26278 SS_Print.render = function () { 26279 if (! window.print) { 26280 $(".btn-ss-print").addClass("unsupported"); 26281 } 26282 26283 $(document).on("click", ".btn-ss-print", function() {
26284 try { 26285 window.print(); 26286 return false; 26287 } catch (ex) { 26288 console.info("print is unsupported") 26289 } 26290 }) 26291 }; 26292 26293 return SS_Print; 26294 26295})(); 26296 26297this.SS_ClipboardCopy = (function () { 26298 function SS_ClipboardCopy() { 26299 } 26300 26301 var getText = function(ev) { 26302 var target = ev.target.dataset.target; 26303 if (!target) { 26304 return; 26305 } 26306 26307 var text; 26308 if (target === "css_selector") { 26309 var selector = ev.target.dataset.selector; 26310 if (!selector) { 26311 selector = "title" 26312 } 26313 26314 var el = document.querySelector(selector); 26315 if (el) { 26316 text = el.text; 26317 } 26318 } else { 26319 // url 26320 text = location.href 26321 } 26322 26323 return text; 26324 }; 26325 26326 SS_ClipboardCopy.render = function () { 26327 if (! navigator.clipboard) { 26328 $(".btn-ss-clipboard-copy").addClass("unsupported"); 26329 } 26330 26331 $(document).on("click", ".btn-ss-clipboard-copy", function(ev) { 26332 try { 26333 var text = getText(ev); 26334 navigator.clipboard.writeText(text || '').then(function() { 26335 $(".btn-ss-clipboard-copy.copied").removeClass("copied"); 26336 ev.target.classList.add("copied"); 26337 }); 26338 return false; 26339 } catch (_ex) { 26340 console.info("copy to clipboard is unsupported"); 26341 } 26342 }); 26343 26344 $(document).on("copy cut", function() { 26345 $(".btn-ss-clipboard-copy.copied").removeClass("copied"); 26346 }); 26347 }; 26348 26349 return SS_ClipboardCopy; 26350 26351})(); 26352this.SS_Font = (function () { 26353 function SS_Font() { 26354 } 26355 26356 SS_Font.size = null; //% 26357 26358 SS_Font.render = function () { 26359 this.size = parseInt(Cookies.get("ss-font")) || 100; 26360 if (this.size !== 100) { 26361 this.set(this.size); 26362 } else { 26363 $('[data-tool="ss-medium"]').attr("aria-pressed", "true"); 26364 } 26365 26366 $('#ss-medium,[data-tool="ss-medium"]').each(function() { 26367 const $this = $(this); 26368 SS.justOnce(this, "ss-font", function() { 26369 SS_Font.embed($this, function () { return SS_Font.set(100); }); 26370 }); 26371 }); 26372 26373 $('#ss-small,[data-tool="ss-small"]').each(function() { 26374 const $this = $(this); 26375 SS.justOnce(this, "ss-font", function() { 26376 SS_Font.embed($this, function () { return SS_Font.set(false); }); 26377 }); 26378 }); 26379 26380 $('#ss-large,[data-tool="ss-large"]').each(function() { 26381 const $this = $(this); 26382 SS.justOnce(this, "ss-font", function() { 26383 SS_Font.embed($this, function () { return SS_Font.set(true); }); 26384 }); 26385 }); 26386 }; 26387 26388 SS_Font.embed = function($elements, callback) { 26389 $elements.each(function() { 26390 const $el = $(this); 26391 if ($el.is('[data-tool-type="button"]')) { 26392 SS.justOnce(this, "font", function() { 26393 const $btn = $("<button/>", { 26394 type: "button", 26395 name: $el.attr("data-tool"), 26396 "data-tool": $el.attr("data-tool") 26397 }); 26398 // ãæ¨æºãã®ã¿ aria-pressed 屿§ãä»ä¸ https://github.com/shirasagi/shirasagi/pull/5572 26399 if ($el.attr("data-tool") === "ss-medium") { 26400 $btn.attr("aria-pressed", (SS_Font.size === 100 ? "true" : "false")); 26401 } 26402 $btn.on("click", callback); 26403 $btn.html($el.html()); 26404 26405 $el.replaceWith($btn); 26406 }); 26407 } else { 26408 SS.justOnce(this, "font", function() { 26409 const $anchor = $("<a/>", {href: "#"}); 26410 $anchor.on("click", callback); 26411 $anchor.html($el.html()); 26412 26413 $el.replaceWith($anchor); 26414 }); 26415 } 26416 }); 26417 } 26418 26419 SS_Font.set = function (size) { 26420 if (size === true) { 26421 size = this.size + 20; 26422 if (size > 200) { 26423 return false; 26424 } 26425 } else if (size === false) { 26426 size = this.size - 20; 26427 if (size < 60) { 26428 return false; 26429 } 26430 } 26431 this.size = size; 26432 $("body").css("font-size", size + "%"); 26433 Cookies.set("ss-font", size, { 26434 expires: 7, 26435 path: '/' 26436 }); 26437 26438 $('[data-tool="ss-medium"]').each(function() { 26439 const $btn = $(this); 26440 if (size === 100) { 26441 $btn.attr('aria-pressed', 'true'); 26442 } else { 26443 $btn.attr('aria-pressed', 'false'); 26444 } 26445 }); 26446 return false; 26447 }; 26448 26449 return SS_Font; 26450 26451})(); 26452 26453// --- 26454// generated by coffee-script 1.9.2; 26455// ref: http://minghai.github.io/library/coffeescript/03_classes.html 26456 26457 var moduleKeywords, 26458 indexOf = [].indexOf || function (item) { 26459 for (var i = 0, l = this.length; i < l; i++) { 26460 if (i in this && this[i] === item) return i; 26461 } 26462 return -1; 26463 }; 26464 26465moduleKeywords = ['extended', 'included']; 26466 26467this.SS_Module = (function () { 26468 function SS_Module() { 26469 } 26470 26471 SS_Module.extend = function (obj) { 26472 var key, ref, value; 26473 for (key in obj) { 26474 value = obj[key]; 26475 if (indexOf.call(moduleKeywords, key) < 0) { 26476 this[key] = value; 26477 } 26478 } 26479 if ((ref = obj.extended) != null) { 26480 ref.apply(this); 26481 } 26482 return this; 26483 }; 26484 26485 SS_Module.include = function (obj) { 26486 var key, ref, value; 26487 for (key in obj) { 26488 value = obj[key]; 26489 if (indexOf.call(moduleKeywords, key) < 0) { 26490 this.prototype[key] = value; 26491 } 26492 } 26493 if ((ref = obj.included) != null) { 26494 ref.apply(this); 26495 } 26496 return this; 26497 }; 26498 26499 return SS_Module; 26500 26501})(); 26502 26503this.SS_Mobile = (function () { 26504 function SS_Mobile() { 26505 } 26506 26507 SS_Mobile.render = function () { 26508 var head, vr; 26509 if (navigator.userAgent.match(/(Android|iPad|iPhone)/)) { 26510 if (Cookies.get("ss-mobile") === "pc") { 26511 head = $("head"); 26512 head.children("meta[name=viewport]").remove(); 26513 head.append('<meta name="viewport" content="width=1024" />'); 26514 vr = $("#ss-mb"); 26515 return vr.html('<a href="#" onclick="return SS_Mobile.unset()">' + vr.text() + '</a>').show(); 26516 } else { 26517 vr = $("#ss-pc"); 26518 return vr.html('<a href="#" onclick="return SS_Mobile.setPc()">' + vr.text() + '</a>').show(); 26519 } 26520 } 26521 }; 26522 26523 SS_Mobile.unset = function () { 26524 Cookies.remove("ss-mobile", { 26525 path: '/' 26526 }); 26527 location.reload(); 26528 return false;
26529 }; 26530 26531 SS_Mobile.setPc = function () { 26532 Cookies.set("ss-mobile", "pc", { 26533 expires: 7, 26534 path: '/' 26535 }); 26536 location.reload(); 26537 return false; 26538 }; 26539 26540 return SS_Mobile; 26541 26542})(); 26543 26544this.SS_Clipboard = (function () { 26545 function SS_Clipboard() { 26546 } 26547 26548 SS_Clipboard.successAlertMessage = 'ã³ãã¼ãã¾ããã'; 26549 26550 SS_Clipboard.failedAlertMessage = 'ã³ãã¼ã§ãã¾ããã§ãããã¯ãªãããã¼ãããµãã¼ãããã¦ãã¾ããã'; 26551 26552 SS_Clipboard.copyButtonLabel = 'ã³ãã¼'; 26553 26554 SS_Clipboard.copy = function (text, opts) { 26555 var copy, e, message, style, $body; 26556 26557 if (opts == null) { 26558 opts = {}; 26559 } 26560 if (document.queryCommandSupported('copy')) { 26561 try { 26562 style = 'position: absolute; overflow: hidden; width: 0; height: 0;'; 26563 style += 'border: none; box-shadow: none; background: transparent; resize: none;'; 26564 copy = $("<textarea style='" + style + "'>" + text + "</textarea>"); 26565 $body = ($("#ajax-box").length > 0) ? $("#ajax-box") : $('body'); 26566 $body.after(copy); 26567 copy.select(); 26568 document.execCommand('copy'); 26569 copy.remove(); 26570 if (opts["success_alert"]) { 26571 message = SS_Clipboard.successAlertMessage; 26572 if ("i18next" in window) { 26573 message = i18next.t("ss.notice.clipboard_copied"); 26574 } 26575 alert(message); 26576 } 26577 return true; 26578 } catch (_error) { 26579 e = _error; 26580 console.warn(e); 26581 message = SS_Clipboard.failedAlertMessage; 26582 if ("i18next" in window) { 26583 message = i18next.t("ss.notice.clipboard_copy_failed"); 26584 } 26585 alert(message); 26586 return false; 26587 } 26588 } 26589 }; 26590 26591 SS_Clipboard.renderCopy = function () { 26592 $('.js-clipboard-copy').each(function () { 26593 var label, text; 26594 text = $(this).text(); 26595 if (!text) { 26596 return true; 26597 } 26598 label = SS_Clipboard.copyButtonLabel; 26599 if ("i18next" in window) { 26600 label = i18next.t("ss.buttons.copy"); 26601 } 26602 return $(this).append("<a href='#' class='clipboard-copy-button' data-text='" + text + "'>" + label + "</a>"); 26603 }); 26604 return $('.clipboard-copy-button').on("click", function () { 26605 $('.clipboard-copy-button').removeClass('copied'); 26606 if (SS_Clipboard.copy($(this).data('text'))) { 26607 $(this).addClass('copied'); 26608 } 26609 return false; 26610 }); 26611 }; 26612 26613 return SS_Clipboard; 26614 26615})(); 26616 26617function SS_FileView(el, options) { 26618 this.$el = $(el); 26619 this.options = options; 26620 26621 this.$canvasContainer = this.$el.find(".canvas-container"); 26622 this.$canvasContainer.html(SS.loading); 26623 26624 this.canvas = document.createElement("canvas"); 26625 this.ctx = this.canvas.getContext("2d"); 26626 26627 this.scale = 1; 26628 this.$slider = this.$el.find("#zoom-slider"); 26629 this.$slider.prop({ value: this.scale * 100, min: SS_FileView.MIN_SCALE * 100, max: SS_FileView.MAX_SCALE * 100, step: "any" }); 26630 this.$slider.on("input", this.zooming.bind(this)).on("change", this.zoomChanged.bind(this)); 26631 26632 this.dragInfo = { 26633 isDragging: false, 26634 start: { x: 0, y: 0 }, 26635 diff: { x: 0, y: 0 }, 26636 canvas: { x: 0, y: 0 } 26637 }; 26638 26639 var self = this; 26640 26641 // ãã¤ã¢ãã°ãå®å ¨ã«éããªãã¨ããã£ã³ãã¹ãµã¤ãºãè¨ç®ã§ããªãã®ã§ãå®å ¨ã«éãã¾ã§å¾ 㤠26642 var d1 = $.Deferred(); 26643 this.$el.one("ss:cboxCompleted", function() { d1.resolve(); }); 26644 // // 3 ç§ä»¥å ã«ãã¤ã¢ãã°ãéããªããã°å¤±æã 26645 // setTimeout(function() { d1.rejectWith(self, [ "failed to open dialog" ]); }, 3000); 26646 // 3 ç§ä»¥å ã«ãã¤ã¢ãã°ãéããªããã°ãã¤ã¢ãã°ãéããã¨ã¿ãªãã 26647 setTimeout(function() { d1.resolve(); }, 3000); 26648 26649 // 仿§ã§ç»åã¯éåæã§èªã¿è¾¼ã¾ããã®ã§ãç»åèªã¿è¾¼ã¿å®äºã¾ã§å¾ 㤠26650 var d2 = $.Deferred(); 26651 this.image = new Image(); 26652 this.image.src = this.options.itemUrl; 26653 this.image.onload = function() { d2.resolve(); }; 26654 this.image.onerror = function() { d2.rejectWith(self, [ "failed to load image" ]); }; 26655 26656 // ãã¤ã¢ãã°ãå®å ¨ã«éãã¦ããã¤ãç»åã®èªã¿è¾¼ã¿ãå®äºããããæ®ãã®åæåãå¯è½ã¨ãªãã 26657 $.when(d1.promise(), d2.promise()) 26658 .done(this.initializationComplete.bind(this)) 26659 .fail(function(msg) { self.$canvasContainer.html(msg); }); 26660 26661 SS_Color.render(); 26662} 26663 26664SS_FileView.HEX_DECIMAL = "0123456789abcdef"; 26665SS_FileView.CANVAS_SAFE_MARGIN = 10; 26666SS_FileView.MIN_SCALE = 0.1; 26667SS_FileView.MAX_SCALE = 2; 26668SS_FileView.SCALE_STEPS = [ 0.1, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2.0 ]; 26669 26670SS_FileView.listenTo = function(el, options) { 26671 $(el).on("click", function(ev) { 26672 SS_FileView.open(ev, options); 26673 }); 26674}; 26675 26676SS_FileView.renderFileView = function($el, options) { 26677 $el.on("click", ".file-view a.thumb", function(ev) { 26678 SS_FileView.open(ev, options); 26679 }); 26680 $el.on("click", ".file-view .action-attach", function(ev) { 26681 // æ·»ä»è²¼ä» 26682 SS_FileView.pasteFile(ev, options); 26683 }); 26684 $el.on("click", ".file-view .action-paste", function(ev) { 26685 // ç»åè²¼ä» 26686 SS_FileView.pasteImage(ev, options); 26687 }); 26688 $el.on("click", ".file-view .action-thumb", function(ev) { 26689 // ãµã ãã¤ã«è²¼ä» 26690 SS_FileView.pasteThumbnail(ev, options); 26691 }); 26692 $el.on("click", ".file-view .action-delete", function(ev) { 26693 // åé¤ 26694 SS_FileView.deleteFile(ev, options); 26695 }); 26696 $el.on("click", ".file-view .action-copy-request-form", function(ev) { 26697 // ç³è«æ¸è²¼ä» 26698 SS_FileView.copyRequestForm(ev, options); 26699 }); 26700}; 26701 26702SS_FileView.open = function(ev, options) { 26703 var $this = $(ev.currentTarget); 26704 if ($this.find("img").length === 0) { 26705 return true; 26706 } 26707 26708 var path = $this.attr("href"); 26709 if (path.startsWith("/fs/")) { 26710 if (options && options.viewPath) { 26711 var $fileView = $this.closest(".file-view"); 26712 if ($fileView.length > 0) { 26713 var fileId = $fileView.data("file-id"); 26714 if (fileId) { 26715 path = options.viewPath.replace(":id", fileId); 26716 } 26717 } 26718 } 26719 } 26720 if (path.startsWith("/fs/")) { 26721 return true; 26722 } 26723 26724 $.colorbox({ 26725 href: path, 26726 width: "90%", 26727 height: "90%", 26728 fixed: true, 26729 open: true, 26730 onComplete: function() { $("#ss-file-view").trigger("ss:cboxCompleted"); } 26731 }); 26732 26733 ev.preventDefault(); 26734 return false;
26735}; 26736 26737SS_FileView.getContent = function() { 26738 var editor = null; 26739 26740 if ((typeof tinymce) != "undefined") { 26741 editor = tinymce.get(Cms_Form.editorId); 26742 if (editor) { 26743 return editor.getContent(); 26744 } 26745 } else if ((typeof CKEDITOR) != "undefined") { 26746 if (Cms_Form.editorId) { 26747 editor = CKEDITOR.instances[Cms_Form.editorId]; 26748 if (editor) { 26749 return editor.getData(); 26750 } 26751 } 26752 } 26753 26754 return null; 26755} 26756 26757SS_FileView.insertContent = function(content) { 26758 if ((typeof tinymce) != "undefined") { 26759 tinymce.get(Cms_Form.editorId).execCommand("mceInsertContent", false, content); 26760 } else if (typeof CKEDITOR != "undefined") { 26761 CKEDITOR.instances[Cms_Form.editorId].insertHtml(content); 26762 } 26763}; 26764 26765SS_FileView.pasteFile = function(ev, options) { 26766 var $fileView = $(ev.currentTarget).closest(".file-view"); 26767 if (!$fileView[0]) { 26768 return; 26769 } 26770 26771 // link_to file.humanized_name, file.url, class: "icon-#{file.extname}" 26772 var $content = $("<a/>", { href: $fileView.data("url"), class: "icon-" + $fileView.data("extname") }) 26773 .html($fileView.data("humanizedName")); 26774 26775 var insertContent; 26776 if (options && options.insertContent) { 26777 insertContent = options.insertContent; 26778 } else { 26779 insertContent = SS_FileView.insertContent; 26780 } 26781 26782 insertContent($content.prop("outerHTML")); 26783 26784 ev.preventDefault(); 26785 return false; 26786}; 26787 26788SS_FileView.pasteImage = function(ev, options) { 26789 var $fileView = $(ev.currentTarget).closest(".file-view"); 26790 if (!$fileView[0]) { 26791 return; 26792 } 26793 26794 // image_tag file.url, alt: file.name 26795 var $content = $("<img/>", { src: $fileView.data("url"), alt: $fileView.data("name") }); 26796 26797 var insertContent; 26798 if (options && options.insertContent) { 26799 insertContent = options.insertContent; 26800 } else { 26801 insertContent = SS_FileView.insertContent; 26802 } 26803 26804 insertContent($content.prop("outerHTML")); 26805 26806 ev.preventDefault(); 26807 return false; 26808}; 26809 26810SS_FileView.pasteThumbnail = function(ev, options) { 26811 var $fileView = $(ev.currentTarget).closest(".file-view"); 26812 if (!$fileView[0]) { 26813 return; 26814 } 26815 26816 // link_to(file.url, alt: file.name, class: "ajax-box") { image_tag(file.thumb_url, alt: file.name) } 26817 var $img = $("<img/>", { src: $fileView.data("thumbUrl"), alt: $fileView.data("name") }); 26818 var $content = $("<a/>", { href: $fileView.data("url"), alt: $fileView.data("name"), class: "ajax-box" }).html($img); 26819 26820 var insertContent; 26821 if (options && options.insertContent) { 26822 insertContent = options.insertContent; 26823 } else { 26824 insertContent = SS_FileView.insertContent; 26825 } 26826 26827 insertContent($content.prop("outerHTML")); 26828 26829 ev.preventDefault(); 26830 return false; 26831}; 26832 26833SS_FileView.deleteFile = function(ev, options) { 26834 var $fileView = $(ev.currentTarget).closest(".file-view"); 26835 if (!$fileView[0]) { 26836 return; 26837 } 26838 26839 var path = $fileView.data("url").replace(/\/[^/]*$/, "/"); 26840 26841 var getContent; 26842 if (options && options.getContent) { 26843 getContent = options.getContent; 26844 } else { 26845 getContent = SS_FileView.getContent 26846 } 26847 26848 var data = getContent(); 26849 var inUse = false; 26850 if (data && data.indexOf(path) > 0) { 26851 inUse = true; 26852 } 26853 var messge; 26854 if (inUse && options && options.inUseConfirmation) { 26855 messge = options.inUseConfirmation; 26856 } else if (options && options.confirmationOnDelete) { 26857 messge = options.confirmationOnDelete; 26858 } 26859 if (messge) { 26860 if (!confirm(messge)) { 26861 ev.preventDefault(); 26862 return false; 26863 } 26864 } 26865 26866 $fileView.remove(); 26867 26868 ev.preventDefault(); 26869 return false; 26870}; 26871 26872SS_FileView.copyRequestForm = function(ev, options) { 26873 var $requestForm = $("#addon-cms-agents-addons-request_form"); 26874 26875 if (!$requestForm[0]) { 26876 return false; 26877 } 26878 26879 var $fileView = $(ev.currentTarget).closest(".file-view"); 26880 if (!$fileView[0]) { 26881 return false; 26882 } 26883 26884 var id = $fileView.data("file-id"); 26885 var name = $fileView.data("name"); 26886 var tr = $requestForm.find(".request-form-table-tr-" + id); 26887 if (tr.length > 0) { 26888 return false; 26889 } 26890 26891 // insert element 26892 var tbody = document.getElementById("request-form-table-tbody"); 26893 var row = tbody.insertRow(-1); 26894 row.classList.add("request-form-table-tr-" + id); 26895 26896 var cell = row.insertCell(-1); 26897 cell.innerHTML = '<input name="item[request_form_ids][]" id="item_request_form_ids_" type="hidden" value="' + id + '">' + name; 26898 cell = row.insertCell(-1); 26899 cell.innerHTML = '<a class="rowup btn" href="#">
26899' + i18next.t("ss.buttons.up_sign") + '</a>'; 26900 cell = row.insertCell(-1); 26901 cell.innerHTML = '<a class="rowdown btn" href="#">' + i18next.t("ss.buttons.down_sign") + '</a>'; 26902 cell = row.insertCell(-1); 26903 cell.innerHTML = '<a class="rowdelete btn" href="#">' + i18next.t("ss.buttons.delete") + '</a>'; 26904 26905 return false; 26906}; 26907 26908SS_FileView.toHex = function(n) { 26909 if (isNaN(n)) { 26910 return "00"; 26911 } 26912 26913 n = Math.max(0, Math.min(n, 255)); 26914 return SS_FileView.HEX_DECIMAL.charAt((n - n % 16) / 16) + SS_FileView.HEX_DECIMAL.charAt(n % 16); 26915}; 26916 26917SS_FileView.calcPositionAndScale = function(image, canvas) { 26918 var position = 0; 26919 var scale = 1; 26920 26921 if (image > canvas) { 26922 position = 0; 26923 scale = canvas / image; 26924 if (scale < SS_FileView.MIN_SCALE) { 26925 scale = SS_FileView.MIN_SCALE; 26926 } 26927 } else { 26928 position = (canvas - image) / 2; 26929 scale = 1; 26930 } 26931 26932 return { position: position, scale: scale }; 26933}; 26934 26935SS_FileView.findScaleStepIndex = function(scale) { 26936 var found = -1; 26937 if (scale < SS_FileView.SCALE_STEPS[0]) { 26938 found = 0; 26939 } else if (scale > SS_FileView.SCALE_STEPS[SS_FileView.SCALE_STEPS.length - 1]) { 26940 found = SS_FileView.SCALE_STEPS.length - 1; 26941 } else { 26942 for (var i = 0; i < SS_FileView.SCALE_STEPS.length - 1; i += 1) { 26943 if (SS_FileView.SCALE_STEPS[i] <= scale && scale < SS_FileView.SCALE_STEPS[i + 1]) { 26944 found = i; 26945 break; 26946 } 26947 if (found === -1) { 26948 found = SS_FileView.SCALE_STEPS.length - 1; 26949 } 26950 } 26951 } 26952 26953 return found; 26954}; 26955 26956SS_FileView.prototype.initializationComplete = function() { 26957 var self = this; 26958 var canvasWidth = self.$el.width(); 26959 26960 var $ajaxBox = $("#ajax-box"); 26961 var canvasHeight = $("#cboxLoadedContent").height(); 26962 // minus padding 26963 canvasHeight -= $ajaxBox.outerHeight(true) - $ajaxBox.height(); 26964 // minus toolbar height 26965 canvasHeight -= Math.ceil(self.$canvasContainer.offset().top) - Math.floor(self.$el.offset().top); 26966 canvasHeight -= SS_FileView.CANVAS_SAFE_MARGIN; 26967 26968 self.canvas.width = canvasWidth; 26969 self.canvas.height = canvasHeight; 26970 26971 var x = SS_FileView.calcPositionAndScale(self.image.width, canvasWidth); 26972 var y = SS_FileView.calcPositionAndScale(self.image.height, canvasHeight); 26973 26974 if (y.scale > x.scale) { 26975 self.scale = x.scale; 26976 self.dragInfo.diff.x = x.position; 26977 self.dragInfo.diff.y = ((canvasHeight - self.image.height * self.scale) / 2) / self.scale; 26978 if (self.dragInfo.diff.y < 0) { 26979 self.dragInfo.diff.y = 0; 26980 } 26981 } else { 26982 self.scale = y.scale; 26983 self.dragInfo.diff.x = ((canvasWidth - self.image.width * self.scale) / 2) / self.scale; 26984 if (self.dragInfo.diff.x < 0) { 26985 self.dragInfo.diff.x = 0; 26986 } 26987 self.dragInfo.diff.y = y.position; 26988 } 26989 self.dragInfo.canvas.x = self.dragInfo.diff.x; 26990 self.dragInfo.canvas.y = self.dragInfo.diff.y; 26991 self.redrawImage(); 26992 26993 self.$slider.prop({ value: self.scale * 100 }); 26994 26995 self.$el.find(".btn-zoom-out").on("click", self.prevScale.bind(self)); 26996 self.$el.find(".btn-zoom-in").on("click", self.nextScale.bind(self)); 26997 26998 var $foregroundColorEl = self.$el.find("[name='foreground-color']"); 26999 if ($foregroundColorEl.attr("aria-busy")) { 27000 $foregroundColorEl.one("ss:colorPickerReady", function() { 27001 $foregroundColorEl.minicolors("value", self.rgbAt(canvasWidth / 2, canvasHeight / 2)); 27002 }); 27003 } else { 27004 $foregroundColorEl.minicolors("value", self.rgbAt(canvasWidth / 2, canvasHeight / 2)); 27005 } 27006 27007 var $backgroundColorEl = self.$el.find("[name='background-color']"); 27008 if ($backgroundColorEl.attr("aria-busy")) { 27009 $backgroundColorEl.one("ss:colorPickerReady", function() { 27010 $backgroundColorEl.minicolors("value", "#ffffff"); 27011 }); 27012 } else { 27013 $backgroundColorEl.minicolors("value", "#ffffff"); 27014 } 27015 self.calculateContrastRatio(); 27016 27017 self.$el.find(".btn-contrast-ratio").on("click", self.calculateContrastRatio.bind(self)); 27018 27019 self.canvas.addEventListener("click", self.pickUpColor.bind(self)); 27020 self.canvas.addEventListener("mousedown", self.dragStart.bind(self)); 27021 self.canvas.addEventListener("mousemove", self.dragging.bind(self)); 27022 self.canvas.addEventListener("mouseup", self.dragEnd.bind(self)); 27023 27024 self.$el.find(".btn-color-picker").on("click", self.pickUpColorStart.bind(self)); 27025 27026 self.$el.find(".canvas-container").html(self.canvas); 27027}; 27028 27029SS_FileView.prototype.calculateContrastRatio = function() { 27030 var foregroundColor = this.$el.find("#foreground-color").minicolors("value"); 27031 var backgroundColor = this.$el.find("#background-color").minicolors("value"); 27032 if (!foregroundColor || !backgroundColor) { 27033 return; 27034 } 27035 27036 this.$el.find(".contrast-ratio").html(SS.loading); 27037 $.ajax({ 27038 url: this.options.contrastRatioPath, 27039 type: 'GET', 27040 data: { f: foregroundColor, b: backgroundColor, _: Date.now() } 27041 }).done(function(data) { 27042 $(".contrast-ratio").html(data.contrast_ratio_human); 27043 }).fail(function(xhr, status, error) { 27044 $(".contrast-ratio").html(error); 27045 }); 27046}; 27047 27048SS_FileView.prototype.redrawImage = function() { 27049 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); 27050 this.ctx.scale(this.scale, this.scale); 27051 this.ctx.drawImage(this.image, this.dragInfo.diff.x, this.dragInfo.diff.y); 27052 // reset scale 27053 this.ctx.setTransform(1, 0, 0, 1, 0, 0); 27054}; 27055 27056SS_FileView.prototype.zooming = function(ev) { 27057 this.scale = ev.target.value / 100.0; 27058 27059 if (this.$sliderTimeoutId) { 27060 clearTimeout(this.$sliderTimeoutId); 27061 } 27062 27063 this.$sliderTimeoutId = setTimeout(this.zoomCommitted.bind(this), 10); 27064}; 27065 27066SS_FileView.prototype.zoomChanged = function(ev) { 27067 this.scale = ev.target.value / 100.0; 27068 if (this.$sliderTimeoutId) { 27069 clearTimeout(this.$sliderTimeoutId); 27070 } 27071 this.zoomCommitted(); 27072}; 27073 27074SS_FileView.prototype.zoomCommitted = function() { 27075 this.$sliderTimeoutId = null; 27076 this.redrawImage(); 27077}; 27078 27079SS_FileView.prototype.nextScale = function(_ev) { 27080 var current = SS_FileView.findScaleStepIndex(this.scale); 27081 var next = current + 1; 27082 if (next >= SS_FileView.SCALE_STEPS.length) { 27083 next = SS_FileView.SCALE_STEPS.length - 1; 27084 } 27085 27086 this.scale = SS_FileView.SCALE_STEPS[next]; 27087 this.$slider.prop({ value: this.scale * 100 }); 27088 27089 this.redrawImage(); 27090}; 27091 27092SS_FileView.prototype.prevScale = function(_ev) { 27093 var prev = SS_FileView.findScaleStepIndex(this.scale); 27094 if (SS_FileView.SCALE_STEPS[prev] === this.scale) { 27095 prev -= 1; 27096 } 27097 if (prev < 0) { 27098 prev = 0; 27099 } 27100 27101 this.scale = SS_FileView.SCALE_STEPS[prev]; 27102 this.$slider.prop({ value: this.scale * 100 }); 27103 27104 this.redrawImage(); 27105}; 27106 27107SS_FileView.prototype.dragStart = function(ev) { 27108 if (this.isPickingUpColor) { 27109 return; 27110 } 27111 27112 this.dragInfo.isDragging = true;
27113 this.dragInfo.start.x = ev.clientX; 27114 this.dragInfo.start.y = ev.clientY; 27115 27116 this.canvas.style.cursor = "move"; 27117}; 27118 27119SS_FileView.prototype.dragging = function(ev) { 27120 if (!this.dragInfo.isDragging) { 27121 return; 27122 } 27123 27124 this.dragInfo.diff.x = this.dragInfo.canvas.x + (ev.clientX - this.dragInfo.start.x) / this.scale; 27125 this.dragInfo.diff.y = this.dragInfo.canvas.y + (ev.clientY - this.dragInfo.start.y) / this.scale; 27126 this.redrawImage(); 27127}; 27128 27129SS_FileView.prototype.dragEnd = function(_ev) { 27130 if (!this.dragInfo.isDragging) { 27131 return; 27132 } 27133 27134 this.canvas.style.cursor = "auto"; 27135 27136 this.dragInfo.isDragging = false; 27137 this.dragInfo.canvas.x = this.dragInfo.diff.x; 27138 this.dragInfo.canvas.y = this.dragInfo.diff.y; 27139}; 27140 27141SS_FileView.prototype.pickUpColorStart = function(ev) { 27142 var $target = $(ev.currentTarget); 27143 if ($target.hasClass("btn-active")) { 27144 // cancel picking 27145 $target.removeClass("btn-active"); 27146 this.isPickingUpColor = false; 27147 this.canvas.style.cursor = "auto"; 27148 } else { 27149 this.$el.find(".btn-color-picker.btn-active").removeClass("btn-active"); 27150 27151 this.isPickingUpColor = true; 27152 $target.addClass("btn-active"); 27153 this.canvas.style.cursor = "crosshair"; 27154 } 27155}; 27156 27157SS_FileView.prototype.pickUpColor = function(ev) { 27158 if (!this.isPickingUpColor) { 27159 return; 27160 } 27161 27162 var x = ev.offsetX; 27163 var y = ev.offsetY; 27164 if (x < 0) { 27165 x = 0; 27166 } 27167 if (x >= this.canvas.width) { 27168 x = this.canvas.width - 1; 27169 } 27170 if (y < 0) { 27171 y = 0; 27172 } 27173 if (y >= this.canvas.height) { 27174 y = this.canvas.height - 1; 27175 } 27176 27177 var rgb = this.rgbAt(x, y); 27178 this.$el.find(".btn-color-picker.btn-active").closest(".btn-group").find(".js-color").minicolors("value", rgb); 27179 27180 this.canvas.style.cursor = "auto"; 27181 this.$el.find(".btn-color-picker").removeClass("btn-active"); 27182 this.isPickingUpColor = false; 27183 27184 this.calculateContrastRatio(); 27185}; 27186 27187SS_FileView.prototype.rgbAt = function(x, y) { 27188 this.ctx.scale(this.scale, this.scale); 27189 var pixels = this.ctx.getImageData(x, y, 1, 1).data; 27190 // reset scale 27191 this.ctx.setTransform(1, 0, 0, 1, 0, 0); 27192 27193 var red = pixels[0]; 27194 var green = pixels[1]; 27195 var blue = pixels[2]; 27196 var alpha = pixels[3]; 27197 27198 if (alpha === 0) { 27199 return "#ffffff"; 27200 } 27201 27202 red = SS_FileView.toHex(red); 27203 green = SS_FileView.toHex(green); 27204 blue = SS_FileView.toHex(blue); 27205 return "#" + red + green + blue; 27206}; 27207this.SS_DateTimePicker = (function () { 27208 // 注æ: 27209 // datetimepicker ã«ã¯ãã°ãããã 27210 // ãã®ã³ã³ãã¼ã«ã®æ¬¡ã®è¦ç´ ã disabled ã®å ´åãã³ã³ããã¼ã«å ã§ Enter ãã¼ãæ¼ãã¦ããå ¥åããæ¥æã確å®ããªãã 27211 // 27212 // datetimepicker ã§ã¯ãã³ã³ããã¼ã«å ã§ Enter ãã¼ãæ¼ãã¨æ¬¡ã®è¦ç´ ã«ãã©ã¼ã«ã¹ãç§»åãããã 27213 // ãã©ã¼ã«ã¹ãç§»åããããã¨ã§ã¤ãã³ã "blur" ãçºçããå ¥åãç¢ºå® â onChangeDateTime ã¤ãã³ãçºçã¨ããé ã§å¦çãé²ãã 27214 // 27215 // ããããæ¬¡ã®è¦ç´ ã disabled ã®å ´åããã©ã¼ã«ã¹ãç§»åãããããã¤ãã³ã "blur" ãçºçããªãã 27216 // ãã®ãããå ¥åã確å®ãããonChangeDateTime ã¤ãã³ããçºçããªãã 27217 // 27218 // åé¡ã¨ãªãã½ã¼ã¹ã³ã¼ã㯠https://github.com/xdan/datetimepicker/blob/master/jquery.datetimepicker.js#L2591 27219 // è¦ç´ ã»ã¬ã¯ã¿ã¼ã« ":enabled" ã®æ¡ä»¶ããªãã 27220 // 27221 // ããã§ãEnter ãã¼ãæ¼ãããããã¤ãã³ã "blur" ãçºçãããå ¥åãç¢ºå® â onChangeDateTime ã¤ãã³ãçºçã¨ããé ã§å¦çãé²ãããã«ããã 27222 // ã¾ãã念ã®çº Enter ãã¼ã§ãã©ã¼ã«ã¹ãç§»åãããªãããã«ãããã enterLikeTab ã false ã«ããã 27223 function SS_DateTimePicker(el, type) { 27224 this.$el = $(el); 27225 27226 if (!type) { 27227 if (this.$el.hasClass("js-date")) { 27228 type = "date" 27229 } else { 27230 type = "datetime" 27231 } 27232 } 27233 this.type = type; 27234 this.initialized = false; 27235 // this.ee = new EventEmitter3(); 27236 27237 this.render(); 27238 this.$el.data("ss_datetimepicker", this); 27239 } 27240 27241 var standardFormats = { 27242 RFC_2822: 'D, d M Y H:i:s O', 27243 ATOM: 'Y-m-dTH:i:sP', 27244 ISO_8601: 'Y-m-dTH:i:sO', 27245 RFC_822: 'D, d M y H:i:s O', 27246 RFC_850: 'l, d-M-y H:i:s T', 27247 RFC_1036: 'D, d M y H:i:s O', 27248 RFC_1123: 'D, d M Y H:i:s O', 27249 RSS: 'D, d M Y H:i:s O', 27250 W3C: 'Y-m-dTH:i:sP' 27251 } 27252 27253 var isFormatStandard = function(format){ 27254 return Object.values(standardFormats).indexOf(format) === -1 ? false : true; 27255 } 27256 27257 var dateFormatter = { 27258 parseDate: function (date, format) { 27259 // å ¨è§åè§å¤æ 27260 if (typeof date === "string") { 27261 date = date.replace(/[ï¼-ï¼]/g, function(s) { 27262 return String.fromCharCode(s.charCodeAt(0) - 0xFEE0); 27263 }); 27264 } 27265 27266 if(isFormatStandard(format)){ 27267 return defaultDateHelper.parseDate(date, format); 27268 } 27269 var d = moment(date, format); 27270 return d.isValid() ? d.toDate() : false;
27271 }, 27272 27273 formatDate: function (date, format) { 27274 if(isFormatStandard(format)){ 27275 return defaultDateHelper.formatDate(date, format); 27276 } 27277 return moment(date).format(format); 27278 }, 27279 27280 formatMask: function(format){ 27281 return format 27282 .replace(/Y{4}/g, '9999') 27283 .replace(/Y{2}/g, '99') 27284 .replace(/M{2}/g, '19') 27285 .replace(/D{2}/g, '39') 27286 .replace(/H{2}/g, '29') 27287 .replace(/m{2}/g, '59') 27288 .replace(/s{2}/g, '59'); 27289 } 27290 }; 27291 27292 var dateFormat = function() { 27293 if ("i18next" in window) { 27294 return i18next.t("date.formats.picker") 27295 } else { 27296 return SS.DEFAULT_DATE_FORMAT; 27297 } 27298 } 27299 27300 var timeFormat = function() { 27301 if ("i18next" in window) { 27302 return i18next.t("time.formats.picker") 27303 } else { 27304 return SS.DEFAULT_TIME_FORMAT; 27305 } 27306 } 27307 27308 var initialized = false; 27309 27310 SS_DateTimePicker.renderOnce = function () { 27311 if (initialized) { 27312 return; 27313 } 27314 27315 $.datetimepicker.setLocale(document.documentElement.lang || 'ja'); 27316 // setLocale() ãå¼ã³åºã㨠dateFormatter ããªã»ãããããã®ã§ãsetLocale() ã®å¾ã« setDateFormatter() ãå¼ã³åºããªããã°ãªããªãã 27317 $.datetimepicker.setDateFormatter(dateFormatter); 27318 27319 initialized = true; 27320 }; 27321 27322 SS_DateTimePicker.render = function (root, type) { 27323 SS_DateTimePicker.renderOnce(); 27324 27325 $(root || document).find(".js-date,.js-datetime").each(function () { 27326 var $this = $(this); 27327 var data = $this.data(); 27328 if ("ss_datetimepicker" in data) { 27329 // already instantiated 27330 return; 27331 } 27332 27333 new SS_DateTimePicker(this, type); 27334 }); 27335 }; 27336 27337 SS_DateTimePicker.instance = function (selector) { 27338 return $(selector).data("ss_datetimepicker"); 27339 }; 27340 27341 // [ "on", "once", "off", "momentValue", "valueForExchange" ].forEach(function(method) { 27342 [ "momentValue", "valueForExchange" ].forEach(function(method) { 27343 SS_DateTimePicker[method] = function() { 27344 var selector = Array.prototype.shift.call(arguments) 27345 return SS_DateTimePicker.prototype[method].apply(SS_DateTimePicker.instance(selector), arguments); 27346 }; 27347 }); 27348 27349 SS_DateTimePicker.prototype.render = function () { 27350 var self = this; 27351 27352 var options = self.type === "date" ? self.buildDatePickerOptions() : self.buildDateTimePickerOptions(); 27353 self.$el 27354 .attr('autocomplete', 'off') 27355 .datetimepicker(options) 27356 .on("keydown", function(ev) { 27357 var key = ev.which; 27358 if (key === SS.KEY_ENTER) { 27359 $this.trigger("blur.xdsoft") 27360 } 27361 return true; 27362 }); 27363 27364 self.$el.one("ss:generate", function() { self.onInitialized(); }); 27365 27366 var $form = this.$el.closest("form"); 27367 if (!$form.data("ss-datetime-picker-installed")) { 27368 $form.data("ss-datetime-picker-installed", true); 27369 } 27370 }; 27371 27372 SS_DateTimePicker.prototype.onInitialized = function () { 27373 this.initialized = true; 27374 }; 27375 27376 SS_DateTimePicker.prototype.momentValue = function(value) { 27377 var self = this; 27378 27379 if (arguments.length === 1) { 27380 // setter 27381 if (value) { 27382 value = self.type === "datetime" ? SS.formatTime(value, "picker") : SS.formatDate(value, "picker") 27383 } 27384 self.$el.val(value || ''); 27385 self.$el.datetimepicker({ value: value || '' }); 27386 } else { 27387 // getter 27388 // datetimepicker ã®ãã°ã ã¨æãããåæåæã« value ã nil ã空æåã®å ´åãgetValue ãã«ã¬ã³ãæå»ã«ãªã£ã¦ãã¾ãã 27389 // 表示ããã¦ããå¤ï¼input ã® value)ã¨ãå é¨ã®å¤ï¼datetimepicker ã® getValueï¼ã¨ãç°ãªãå ´åãèæ ®ããã 27390 if (!self.$el.val()) { 27391 return null; 27392 } 27393 27394 var ret = self.$el.datetimepicker("getValue"); 27395 if (!ret) { 27396 return ret; 27397 } 27398 27399 return moment(ret); 27400 } 27401 }; 27402 27403 SS_DateTimePicker.prototype.valueForExchange = function () { 27404 var self = this; 27405 27406 var value = self.momentValue(); 27407 if (value) { 27408 value = value.format(this.type === "datetime" ? "YYYY/MM/DD HH:mm:ss" : "YYYY/MM/DD"); 27409 } 27410 27411 return value || ''; 27412 }; 27413 27414 SS_DateTimePicker.prototype.buildDatePickerOptions = function () { 27415 var self = this; 27416 var opts = { 27417 format: SS.convertDateTimeFormat(dateFormat()), 27418 formatDate: SS.convertDateTimeFormat(dateFormat()), 27419 formatTime: "HH:mm", 27420 value: self.$el.val(), 27421 enterLikeTab: false, 27422 timepicker: false, 27423 closeOnDateSelect: true, 27424 scrollInput: false, 27425 onGenerate: function() { self.$el.trigger("ss:generate"); }, 27426 onChangeDateTime: function(currentTime, $input, ev) { 27427 self.$el.trigger("ss:changeDateTime", [ currentTime, $input, ev ]); 27428 } 27429 }; 27430 27431 var data = self.$el.data(); 27432 if (data.format) { 27433 opts.format = SS.convertDateTimeFormat(data.format); 27434 } 27435 if ("closeOnDateSelect" in data) { 27436 opts.closeOnDateSelect = data.closeOnDateSelect; 27437 } 27438 if ("scrollInput" in data) { 27439 opts.scrollInput = data.scrollInput; 27440 } 27441 if (data.minDate) { 27442 opts.minDate = data.minDate; 27443 } 27444 if (data.maxDate) { 27445 opts.maxDate = data.maxDate; 27446 } 27447 27448 return opts; 27449 }; 27450 27451 SS_DateTimePicker.prototype.buildDateTimePickerOptions = function () { 27452 var self = this; 27453 var opts = { 27454 format: SS.convertDateTimeFormat(timeFormat()), 27455 formatDate: SS.convertDateTimeFormat(dateFormat()), 27456 formatTime: "HH:mm", 27457 value: self.$el.val(), 27458 closeOnDateSelect: false, 27459 enterLikeTab: false, 27460 scrollInput: false, 27461 roundTime: 'ceil', 27462 step: 30, 27463 onGenerate: function() { self.$el.trigger("ss:generate"); }, 27464 onChangeDateTime: function(currentTime, $input, ev) { 27465 self.$el.trigger("ss:changeDateTime", [ currentTime, $input, ev ]); 27466 } 27467 }; 27468 27469 var data = self.$el.data(); 27470 if (data.format) { 27471 opts.format = SS.convertDateTimeFormat(data.format); 27472 } 27473 if (data.minDate) { 27474 opts.minDate = data.minDate; 27475 } 27476 if (data.maxDate) { 27477 opts.maxDate = data.maxDate; 27478 } 27479 if ("closeOnDateSelect" in data) { 27480 opts.closeOnDateSelect = data.closeOnDateSelect; 27481 } 27482 if ("scrollInput" in data) { 27483 opts.scrollInput = data.scrollInput; 27484 } 27485 // time specific options 27486 if (data.step) { 27487 opts.step = data.step; 27488 } 27489 if (data.roundTime) {
27490 opts.roundTime = data.roundTime; 27491 } 27492 27493 return opts; 27494 }; 27495 27496 return SS_DateTimePicker; 27497})(); 27498this.Cms_Site_Search = (function () { 27499 function Cms_Site_Search() { 27500 } 27501 27502 Cms_Site_Search.render = function () { 27503 $(".ajax-box.article-nodes, .ajax-box.categories").colorbox({ 27504 fixed: true, 27505 width: "90%", 27506 height: "90%" 27507 }); 27508 $(".selected-article-nodes, .selected-categories").find(".deselect").on("click", function () { 27509 $(this).closest(".selected-item").remove(); 27510 return false; 27511 }); 27512 } 27513 27514 Cms_Site_Search.selectItem = function (ele) { 27515 var item = $(ele).find(".selected-item").clone(false); 27516 27517 // remove renderInBox class 27518 $(item).find("a").removeClass("cboxElement"); 27519 27520 // deselect button 27521 $(item).find(".deselect").on("click", function () { 27522 $(this).closest(".selected-item").remove(); 27523 return false; 27524 }); 27525 27526 // append 27527 item.show(); 27528 SS_SearchUI.anchorAjaxBox.closest("dl").find(".selected-article-nodes, .selected-categories").append(item); 27529 27530 return item; 27531 } 27532 27533 Cms_Site_Search.toggleSelectButton = function () { 27534 if ($(".search-ui .items input:checked").size() > 0) { 27535 $(".select-items").parent("div").show(); 27536 } else { 27537 $(".select-items").parent("div").hide(); 27538 } 27539 }; 27540 27541 Cms_Site_Search.modal = function () { 27542 // form search event 27543 $(".search-ui-form form.search").on("submit", function (_e) { 27544 $(this).ajaxSubmit({ 27545 url: $(this).attr("action"), 27546 success: function (data) { 27547 return $("#cboxLoadedContent").html(data); 27548 }, 27549 error: function (_data, _status) { 27550 return alert("== Error(SiteSearch) =="); 27551 } 27552 }); 27553 return false; 27554 }); 27555 27556 // select item event 27557 $(".search-ui a.select-item").on("click", function (_e) { 27558 SS_SearchUI.anchorAjaxBox.closest("dl").find(".selected-article-nodes, .selected-categories").html(''); 27559 var tr = $(this).closest("tr"); 27560 var article = Cms_Site_Search.selectItem(tr); 27561 27562 $.colorbox.close(); 27563 $(article).find(".set-graph:first").trigger("click"); 27564 27565 return false; 27566 }); 27567 27568 // select items event 27569 $(".search-ui-select .select-items").on("click", function (_e) { 27570 SS_SearchUI.anchorAjaxBox.closest("dl").find(".selected-article-nodes, .selected-categories").html(''); 27571 $(".search-ui .items .set-article-node:checked, .search-ui .items .set-category:checked").each(function () { 27572 var tr = $(this).closest("tr"); 27573 Cms_Site_Search.selectItem(tr); 27574 }); 27575 $.colorbox.close(); 27576 return false; 27577 }); 27578 27579 // list-head checkbox event 27580 $(".search-ui .list-head input:checkbox").on("change", function (_e) { 27581 var chk = $(this).prop('checked'); 27582 $('.search-ui .list-item').each(function () { 27583 $(this).toggleClass('checked', chk); 27584 $(this).find('.set-article-node, .set-category').prop('checked', chk); 27585 }); 27586 }); 27587 27588 // check selected items in modal 27589 $(".selected-categories .selected-item").each(function () { 27590 var name = $(this).attr("data-name"); 27591 $(`#colorbox .items [data-name="${name}"] input[type=checkbox]`).prop('checked', true); 27592 }); 27593 $(".selected-article-nodes .selected-item").each(function () { 27594 var id = $(this).attr("data-id"); 27595 $(`#colorbox .items [data-id="${id}"] input[type=checkbox]`).prop('checked', true); 27596 }); 27597 } 27598 27599 return Cms_Site_Search; 27600})(); 27601this.Cms_Site_Search_History = (function () { 27602 function Cms_Site_Search_History(selector, url) { 27603 this.form = $(selector); 27604 this.url = url; 27605 27606 this.keyword = this.form.find('[name="s[keyword]"]'); 27607 this.history = this.form.find('.site-search-history'); 27608 this.histories = []; 27609 27610 this.maxHistoryLength = 6; 27611 this.maxKeywordLength = 30; 27612 27613 if (this.keyword.length > 0 && this.history.length > 0) { 27614 this.render(); 27615 } 27616 } 27617 27618 var DATA_KEY = "cms-site-search-history"; 27619 27620 Cms_Site_Search_History.render = function(selector, url) { 27621 $(selector).each(function() { 27622 var $this = $(this); 27623 var instance = $this.data(DATA_KEY); 27624 if (instance) { 27625 return; 27626 } 27627 27628 instance = new Cms_Site_Search_History(this, url); 27629 $this.data(DATA_KEY, instance); 27630 }); 27631 }; 27632 27633 Cms_Site_Search_History.prototype.storageKey = function (key) { 27634 if (!this.formKey) { 27635 this.formKey = CryptoJS.MD5(this.url).toString(); 27636 } 27637 return "ss_site_search_" + this.formKey + "_" + key; 27638 }; 27639 27640 Cms_Site_Search_History.prototype.getHistories = function () { 27641 var _this = this; 27642 var histories = []; 27643 var length = 0; 27644 27645 try { 27646 length = localStorage.getItem(_this.storageKey("history_length")); 27647 if (length && (length = parseInt(length))) { 27648 var history; 27649 for (var i = 0; i < length; i++) { 27650 history = localStorage.getItem(_this.storageKey("history_" + i)); 27651 if (history) { 27652 histories.push(history); 27653 } 27654 } 27655 } 27656 } catch (error) { 27657 console.warn(error); 27658 } 27659 return histories; 27660 }; 27661 27662 Cms_Site_Search_History.prototype.setHistories = function (histories) { 27663 var _this = this; 27664 27665 try { 27666 localStorage.setItem(_this.storageKey("history_length"), histories.length); 27667 $.each(histories, function (idx, history) { 27668 localStorage.setItem(_this.storageKey("history_" + idx), history); 27669 }); 27670 } catch (error) { 27671 console.warn(error); 27672 } 27673 }; 27674 27675 Cms_Site_Search_History.prototype.renderHistories = function () { 27676 var _this = this; 27677 27678 _this.histories = _this.getHistories(); 27679 if (_this.histories.length > 0) { 27680 $(_this.histories).each(function () { 27681 var li = $('<li><a href="#">
27681' + this + '</a></li>'); 27682 li .find("a").on("click", function () { 27683 _this.keyword.val($(this).text()); 27684 _this.form.trigger("submit"); 27685 return false; 27686 }); 27687 _this.history.append(li); 27688 }); 27689 } 27690 27691 this.index = 0; 27692 this.indexLength = this.histories.length; 27693 }; 27694 27695 Cms_Site_Search_History.prototype.renderEvents = function () { 27696 var _this = this; 27697 27698 this.form.on("submit", function(){ 27699 var histories = _this.histories; 27700 var keyword = _this.keyword.val(); 27701 27702 keyword = _this.formatKeyword(keyword); 27703 if (keyword) { 27704 _this.keyword.val(keyword); 27705 histories = histories.filter(function (v) { return v != keyword; }); 27706 histories.unshift(keyword); 27707 histories = histories.slice(0, _this.maxHistoryLength); 27708 _this.setHistories(histories); 27709 } 27710 }); 27711 27712 if (this.histories.length > 0) { 27713 this.keyword.on("focus", function(){ 27714 _this.history.show(); 27715 }); 27716 this.keyword.on("blur", function(){ 27717 _this.index = 0; 27718 _this.history.find("li").removeClass("selected"); 27719 _this.history.hide(); 27720 }); 27721 this.history.find("a").on("mousedown", function(){ 27722 _this.keyword.off("blur"); 27723 }); 27724 this.keyword.on("keydown", function(e) { 27725 if (e.which != SS.KEY_ENTER && e.which != 38 && e.which != 40) { 27726 return; 27727 } 27728 27729 if (e.which == SS.KEY_ENTER) { 27730 if ((_this.index - 1) >= 0) { 27731 _this.keyword.val(_this.histories[_this.index - 1]); 27732 } 27733 return true; 27734 } 27735 if (e.which == 38) { 27736 _this.index -= 1; 27737 } 27738 if (e.which == 40) { 27739 _this.index += 1; 27740 } 27741 if (_this.index > _this.indexLength) { 27742 _this.index = 1; 27743 } else if (_this.index <= 0) { 27744 _this.index = _this.indexLength; 27745 } 27746 _this.history.find("li").removeClass("selected"); 27747 _this.history.find("li:nth-child(" + _this.index + ")").addClass("selected"); 27748 _this.keyword.val(_this.history.find("li.selected a").data("value")); 27749 }); 27750 } 27751 }; 27752 27753 Cms_Site_Search_History.prototype.render = function () { 27754 this.renderHistories(); 27755 this.renderEvents(); 27756 }; 27757 27758 Cms_Site_Search_History.prototype.formatKeyword = function (keyword) { 27759 if (!keyword) { 27760 return keyword; 27761 } 27762 27763 keyword = keyword.replace(/[\s\u3000]+/g, ' '); 27764 keyword = keyword.trim(); 27765 27766 if (keyword.length > this.maxKeywordLength) { 27767 keyword = keyword.substr(0, this.maxKeywordLength); 27768 keyword = keyword.trim(); 27769 } 27770 return keyword; 27771 }; 27772 27773 return Cms_Site_Search_History; 27774 27775})(); 27776this.Cms_Line_Message_Repeat_Plan = (function () { 27777 function Cms_Line_Message_Repeat_Plan() { 27778 } 27779 27780 Cms_Line_Message_Repeat_Plan.renderForm = function () { 27781 this.changeRepeatForm(); 27782 $('#item_repeat_type').on("change", function () { 27783 Cms_Line_Message_Repeat_Plan.changeRepeatForm(); 27784 }); 27785 }; 27786 27787 Cms_Line_Message_Repeat_Plan.changeRepeatForm = function () { 27788 var repeat_type; 27789 repeat_type = $('#item_repeat_type').val(); 27790 if (repeat_type === '') { 27791 $('.cms-line-message-repeat').addClass("hide"); 27792 } else { 27793 $('.cms-line-message-repeat').removeClass("hide"); 27794 $(".repeat-daily, .repeat-weekly, .repeat-monthly").hide(); 27795 $(".repeat-" + repeat_type).show(); 27796 } 27797 }; 27798 27799 return Cms_Line_Message_Repeat_Plan; 27800 27801})(); 27802 27803this.Cms_Line_Area_Cropper = (function () { 27804 function Cms_Line_Area_Cropper(el, opts) { 27805 if (!opts) { 27806 opts = {}; 27807 } 27808 this.$el = $(el); 27809 this.$currentArea = this.$el.find(".areas .area1"); 27810 this.$image = this.$el.find(".image-warp img"); 27811 this.readonly = opts["readonly"]; 27812 this.render(); 27813 } 27814 27815 Cms_Line_Area_Cropper.prototype.render = function () { 27816 var self = this; 27817 self.cropper = new Cropper( 27818 self.$image[0], 27819 { 27820 viewMode: 1, 27821 zoomOnWheel: false, 27822 background: true, 27823 autoCrop: false, 27824 ready: function(_e) { 27825 $(".area-names .area-name:first").trigger("click"); 27826 if (self.readonly) { 27827 self.cropper.disable(); 27828 } 27829 window.cropper = self.cropper; 27830 }, 27831 cropmove: function(_e) { 27832 self.setCroppedArea(); 27833 } 27834 } 27835 ); 27836 27837 self.$el.find(".area-name").on("click" , function(){ 27838 self.$el.find(".area-name").removeClass("current") 27839 self.$el.find(".area-name").removeClass("btn-active"); 27840 $(this).addClass("current"); 27841 $(this).addClass("btn-active"); 27842 27843 var idx = $(this).data("area"); 27844 self.$currentArea = $('[data-area="' + idx + '"]'); 27845 27846 self.$el.find(".areas .area").hide(); 27847 self.$currentArea.show(); 27848 self.cropCurrentArea(); 27849 return false;
27850 }); 27851 27852 self.$el.find(".reset-area").on("click", function() { 27853 self.$currentArea.find('[name="item[in_areas][][x]"]').val(""); 27854 self.$currentArea.find('[name="item[in_areas][][y]"]').val(""); 27855 self.$currentArea.find('[name="item[in_areas][][width]"]').val(""); 27856 self.$currentArea.find('[name="item[in_areas][][height]"]').val(""); 27857 self.$currentArea.find('[name="item[in_areas][][text]"]').val(""); 27858 self.$currentArea.find('[name="item[in_areas][][uri]"]').val(""); 27859 self.$currentArea.find('[name="item[in_areas][][data]"]').val(""); 27860 self.$currentArea.find('[name="item[in_areas][][menu_id]"]').val(""); 27861 self.$currentArea.find('[name="item[in_areas][][type]"]').val("message"); 27862 self.cropper.clear(); 27863 return false; 27864 }); 27865 27866 self.$el.find(".action").each(function() { 27867 var $action = $(this) 27868 var $select = $action.find('[name="item[in_areas][][type]"]'); 27869 var toggleAction = function(){ 27870 $action.find('[data-type]').hide(); 27871 $action.find('[data-type="' + $select.val() + '"]').show(); 27872 }; 27873 $select.on("change", toggleAction); 27874 toggleAction(); 27875 }); 27876 }; 27877 27878 Cms_Line_Area_Cropper.prototype.cropCurrentArea = function () { 27879 var self = this; 27880 var x = self.$currentArea.find('input[name="item[in_areas][][x]"]').val(); 27881 var y = self.$currentArea.find('input[name="item[in_areas][][y]"]').val(); 27882 var width = self.$currentArea.find('input[name="item[in_areas][][width]"]').val(); 27883 var height = self.$currentArea.find('input[name="item[in_areas][][height]"]').val(); 27884 27885 if (x && y && width && height) { 27886 var data = self.cropper.getData(true); 27887 Object.assign(data, { x: parseInt(x), y: parseInt(y), width: parseInt(width), height: parseInt(height) }); 27888 self.cropper.enable(); 27889 self.cropper.crop(); 27890 self.cropper.setData(data); 27891 } else { 27892 self.cropper.enable(); 27893 self.cropper.clear(); 27894 } 27895 27896 if (self.readonly) { 27897 self.cropper.disable(); 27898 } 27899 }; 27900 27901 Cms_Line_Area_Cropper.prototype.setCroppedArea = function () { 27902 var self = this; 27903 var data = self.cropper.getData(true); 27904 self.$currentArea.find('input[name="item[in_areas][][x]"]').val(data.x); 27905 self.$currentArea.find('input[name="item[in_areas][][y]"]').val(data.y); 27906 self.$currentArea.find('input[name="item[in_areas][][width]"]').val(data.width); 27907 self.$currentArea.find('input[name="item[in_areas][][height]"]').val(data.height); 27908 }; 27909 27910 return Cms_Line_Area_Cropper; 27911})(); 27912 27913 27914this.Cms_Line_Deliver_Condition = (function () { 27915 function Cms_Line_Deliver_Condition() { 27916 this.render(); 27917 } 27918 27919 Cms_Line_Deliver_Condition.prototype.render = function () { 27920 $(".select-deliver-category").on("change", this.toggleDeliverCategory); 27921 $(".select-deliver-category").on("change", this.toggleDeliverCategoryRemark); 27922 $(".remarks-button").on("click", this.toggleRemarkText); 27923 this.toggleDeliverCategory(); 27924 this.toggleDeliverCategoryRemark(); 27925 }; 27926 27927 Cms_Line_Deliver_Condition.prototype.toggleDeliverCategory = function(){ 27928 var selected = {}; 27929 $(".deliver-category").each(function(){ 27930 var category = this; 27931 27932 // select 27933 var id = $(this).find("select").val(); 27934 if (id) { 27935 selected[id] = $(category); 27936 } 27937 // checkbox 27938 $(this).find("input:checked").each(function(){ 27939 var id = $(this).val(); 27940 selected[id] = $(category); 27941 }); 27942 }); 27943 27944 $(".deliver-category[data-required]").each(function() { 27945 var ids = $(this).attr("data-required").split(","); 27946 var required = false; 27947 $.each(ids, function() { 27948 var id = this; 27949 if (selected[id] && selected[id].is(':visible')) { 27950 required = true; 27951 } 27952 }); 27953 if (required) { 27954 $(this).show(); 27955 $(this).find("[name]").attr("name", "item[deliver_category_ids][]"); 27956 } else { 27957 $(this).hide(); 27958 $(this).find("[name]").attr("name", ""); 27959 } 27960 }); 27961 }; 27962 27963 Cms_Line_Deliver_Condition.prototype.toggleDeliverCategoryRemark = function () { 27964 $(".deliver-remarks").hide(); 27965 $(".deliver-category").each(function () { 27966 // select 27967 var id = $(this).find("select").val(); 27968 $(".remark-" + id).show(); 27969 $(".remark-" + id).text("ï¼ è©³ç´°ãéã"); 27970 }); 27971 27972 // checkbox 27973 $(this).find("input:checked").each(function(){ 27974 var id = $(this).val(); 27975 $(".remark-" + id).show(); 27976 $(".remark-" + id).text("ï¼ è©³ç´°ãéã"); 27977 }); 27978 27979 }; 27980 27981 Cms_Line_Deliver_Condition.prototype.toggleRemarkText = function () { 27982 className = $(this).attr("class").split(" ")[0]; 27983 $( "." + className + "-text").toggle(); 27984 if ($(this).text() == "ï¼ è©³ç´°ãéã") { 27985 $(this).text("â 詳細ãéãã"); 27986 } else { 27987 $(this).text("ï¼ è©³ç´°ãéã"); 27988 } 27989 }; 27990 27991 return Cms_Line_Deliver_Condition; 27992})(); 27993this.Cms_History = (function () { 27994 function Cms_History(selector, listIdentity, opts) { 27995 if (!opts) { 27996 opts = {}; 27997 } 27998 27999 this.selector = selector; 28000 this.listIdentity = listIdentity; 28001 this.limit = opts["limit"] ? opts["limit"] : 5; 28002 this.render(); 28003 } 28004 28005 Cms_History.prototype.storageKey = function (key) { 28006 return "ss_cms_history_" + this.listIdentity + "_" + key; 28007 }; 28008 28009 Cms_History.prototype.render = function () { 28010 var _this = this; 28011 var histories = _this.getHistories(); 28012 var current = $(_this.selector).find(".current"); 28013 28014 if (!current.length) { 28015 return; 28016 } 28017 28018 var warp = $(current).parent(); 28019 var html = $(warp).html(); 28020 $(current).remove(); 28021 28022 if (histories.length > 0) { 28023 $(histories).each(function () { 28024 $(warp).append(this); 28025 }); 28026 } 28027 28028 histories = histories.filter(function (v) { return v != html; }); 28029 histories.unshift(html); 28030 histories = histories.slice(0, _this.limit); 28031 _this.setHistories(histories); 28032 }; 28033 28034 Cms_History.prototype.setHistories = function (histories) { 28035 var _this = this; 28036 28037 try { 28038 localStorage.setItem(_this.storageKey("length"), histories.length); 28039 $.each(histories, function (i, history) { 28040 localStorage.setItem(_this.storageKey(i), history); 28041 }); 28042 } catch (error) { 28043 console.warn(error); 28044 } 28045 }; 28046 28047 Cms_History.prototype.getHistories = function () { 28048 var _this = this; 28049 var histories = []; 28050 var length = 0; 28051 28052 try { 28053 length = localStorage.getItem(_this.storageKey("length")); 28054 if (length && (length = parseInt(length))) { 28055 var history; 28056 for (var i = 0; i < length; i++) { 28057 history = localStorage.getItem(_this.storageKey(i)); 28058 if (history) { 28059 histories.push(history); 28060 } 28061 } 28062 } 28063 } catch (error) { 28064 console.warn(error); 28065 } 28066 return histories; 28067 }; 28068 28069 return Cms_History; 28070 28071})(); 28072this.SS_SearchUI = (function () { 28073 function SS_SearchUI() { 28074 } 28075 28076 var selectTable = null; 28077 let toSelected = [], ccSelected = [], bcSelected = []; 28078 28079 SS_SearchUI.dialogType = 'colorbox'; 28080 28081 SS_SearchUI.anchorAjaxBox; 28082 28083 SS_SearchUI.defaultTemplate = " \ 28084 <tr data-id=\"<%= data.id %>\"> \ 28085 <td> \ 28086 <input type=\"<%= attr.type %>\" name=\"<%= attr.name %>\" value=\"<%= data.id %>\" class=\"<%= attr.class %>\"> \ 28087 <%= data.name %> \ 28088 </td> \ 28089 <td><a class=\"deselect btn\" href=\"#\"><%= label.delete %></a></td> \ 28090 </tr>"; 28091 28092 SS_SearchUI.defaultSelector = function ($item, $prevSelected) { 28093 if (!SS_SearchUI.anchorAjaxBox) { 28094 return 28095 } 28096 28097 var templateId = SS_SearchUI.anchorAjaxBox.data("template"); 28098 var templateEl = templateId ? document.getElementById(templateId) : null; 28099 var template, attr; 28100 if (templateEl) { 28101 template = templateEl.innerHTML; 28102 attr = {}; 28103 } else { 28104 template = SS_SearchUI.defaultTemplate; 28105 28106 var $input = SS_SearchUI.anchorAjaxBox.closest("dl").find(".hidden-ids"); 28107 if (selectTable === "to") { 28108 attr = { 28109 name: "item[in_to_members][]", 28110 type: $input.attr("type"), 28111 class: $input.attr("class").replace("hidden-ids", "") 28112 } 28113 } else if (selectTable === "cc") { 28114 attr = { 28115 name: "item[in_cc_members][]", 28116 type: $input.attr("type"), 28117 class: $input.attr("class").replace("hidden-ids", "") 28118 } 28119 } else if (selectTable === "bcc") { 28120 attr = { 28121 name: "item[in_bcc_members][]", 28122 type: $input.attr("type"), 28123 class: $input.attr("class").replace("hidden-ids", "") 28124 } 28125 } else { 28126 attr = { 28127 name: $input.attr("name"), 28128 type: $input.attr("type"), 28129 class: $input.attr("class").replace("hidden-ids", "") 28130 } 28131 } 28132 } 28133 28134 var $data = $item.closest("[data-id]"); 28135 var data = $data[0].dataset; 28136 if (!data.name) { 28137 data.name = $data.find(".select-item").text() || $item.text() || $data.text(); 28138 } 28139 28140 var deleteLabel; 28141 if ("i18next" in window) { 28142 deleteLabel = i18next.t("ss.buttons.delete"); 28143 } else { 28144 deleteLabel = "åé¤"; 28145 } 28146 var tr = ejs.render(template, {data: data, attr: attr, label: { delete: deleteLabel }}); 28147 var $tr = $(tr); 28148 var $ajaxSelected; 28149 if (selectTable === "to") { 28150 $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("body").find(".see.to .ajax-selected"); 28151 } else if (selectTable === "cc") { 28152 $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("body").find(".see.cc-bcc.cc .ajax-selected"); 28153 } else if (selectTable === "bcc") { 28154 $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("body").find(".see.cc-bcc.bcc .ajax-selected"); 28155 } else { 28156 $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("dl").find(".ajax-selected"); 28157 } 28158 28159 if ($prevSelected) { 28160 $prevSelected.after($tr); 28161 } else { 28162 $ajaxSelected.find("tbody").prepend($tr); 28163 } 28164 $ajaxSelected.trigger("change"); 28165 return $tr; 28166 }; 28167 28168 SS_SearchUI.defaultDeselector = function (item) { 28169 var table = $(item).closest(".ajax-selected"); 28170 var tr = $(item).closest("tr"); 28171 28172 tr.remove(); 28173 if (table.find("tbody tr").size() === 0) { 28174 table.hide(); 28175 } 28176 table.trigger("change"); 28177 }; 28178 28179 SS_SearchUI.dispatchEvent = function (eventName, detail) { 28180 var ajaxBox = document.getElementById("ajax-box"); 28181 if (ajaxBox) { 28182 var event = new CustomEvent(eventName, { bubbles: true, cancelable: false, composed: true, detail: detail }); 28183 ajaxBox.dispatchEvent(event); 28184 } 28185 } 28186 28187 SS_SearchUI.select = function (item, prevSelected) { 28188 if (SS_SearchUI.anchorAjaxBox) { 28189 var selector = SS_SearchUI.anchorAjaxBox.data('on-select'); 28190 if (selector) { 28191 return selector(item); 28192 } else { 28193 if (!selectTable) { 28194 if (item.closest("[data-id]").find(".to-checkbox")[0]) { 28195 selectTable = "to"; 28196 } 28197 } 28198 var result = this.defaultSelector(item, prevSelected); 28199 if (selectTable === "to") { 28200 SS_SearchUI.anchorAjaxBox.closest("body").find(".see.to .ajax-selected").show(); 28201 } 28202 return result; 28203 } 28204 } else { 28205 SS_SearchUI.dispatchEvent("ss:modal-select", { item: item }) 28206 } 28207 }; 28208 28209 SS_SearchUI.selectItems = function ($el) { 28210 if (!$el) { 28211 $el = $("#ajax-box"); 28212 } 28213 var self = this; 28214 var $prevSelected = undefined;
28215 $el.find(".items .to-checkbox input:checkbox").filter(":checked").each(function () { 28216 selectTable = "to"; 28217 // è¤æ°é ç®ã鏿ãããå ´åãæåã®é ç®ãå é ã«æ¿å ¥ãã2åç®ä»¥éã®é¸æããã®æ¬¡ã«æ¿å ¥ããã 28218 $prevSelected = self.select($(this), $prevSelected); 28219 }); 28220 if (selectTable === "to" && self.anchorAjaxBox) { 28221 self.anchorAjaxBox.closest("body").find(".see.to .ajax-selected").show(); 28222 } 28223 28224 $prevSelected = undefined; 28225 $el.find(".items .cc-checkbox input:checkbox").filter(":checked").each(function () { 28226 selectTable = "cc"; 28227 // è¤æ°é ç®ã鏿ãããå ´åãæåã®é ç®ãå é ã«æ¿å ¥ãã2åç®ä»¥éã®é¸æããã®æ¬¡ã«æ¿å ¥ããã 28228 $prevSelected = self.select($(this), $prevSelected); 28229 }); 28230 if (selectTable === "cc" && self.anchorAjaxBox) { 28231 self.anchorAjaxBox.closest("body").find(".see.cc-bcc.cc .ajax-selected").show(); 28232 } 28233 28234 $prevSelected = undefined; 28235 $el.find(".items .bcc-checkbox input:checkbox").filter(":checked").each(function () { 28236 selectTable = "bcc"; 28237 // è¤æ°é ç®ã鏿ãããå ´åãæåã®é ç®ãå é ã«æ¿å ¥ãã2åç®ä»¥éã®é¸æããã®æ¬¡ã«æ¿å ¥ããã 28238 $prevSelected = self.select($(this), $prevSelected); 28239 }); 28240 if (selectTable === "bcc" && self.anchorAjaxBox) { 28241 self.anchorAjaxBox.closest("body").find(".see.cc-bcc.bcc .ajax-selected").show(); 28242 } 28243 if (selectTable === null) { 28244 $prevSelected = undefined; 28245 $el.find(".items input:checkbox").filter(":checked").each(function () { 28246 // è¤æ°é ç®ã鏿ãããå ´åãæåã®é ç®ãå é ã«æ¿å ¥ãã2åç®ä»¥éã®é¸æããã®æ¬¡ã«æ¿å ¥ããã 28247 $prevSelected = self.select($(this), $prevSelected); 28248 }); 28249 if (self.anchorAjaxBox) { 28250 self.anchorAjaxBox.closest("dl").find(".ajax-selected").show(); 28251 } 28252 } 28253 }; 28254 28255 SS_SearchUI.deselect = function (e) { 28256 var $item = $(this); 28257 var selector = $item.closest(".ajax-selected").data('on-deselect'); 28258 if (selector) { 28259 selector($item); 28260 } else { 28261 SS_SearchUI.defaultDeselector($item); 28262 } 28263 e.preventDefault(); 28264 }; 28265 28266 SS_SearchUI.toggleSelectButton = function ($el) { 28267 if (!$el) { 28268 $el = $("#ajax-box"); 28269 } 28270
28271 if ($el.find(".items input:checkbox").filter(":checked").size() > 0) { 28272 return $el.find(".select-items").parent("div").show(); 28273 } else { 28274 return $el.find(".select-items").parent("div").hide(); 28275 } 28276 }; 28277 28278 SS_SearchUI.onceRendered = false; 28279 28280 SS_SearchUI.renderOnce = function() { 28281 if (SS_SearchUI.onceRendered) { 28282 return; 28283 } 28284 28285 $(document) 28286 .on("cbox_load", SS_SearchUI.onColorBoxLoaded) 28287 .on("cbox_cleanup", SS_SearchUI.onColorBoxCleanedUp); 28288 SS_SearchUI.onceRendered = true; 28289 }; 28290 28291 SS_SearchUI.render = function (box) { 28292 SS_SearchUI.renderOnce(); 28293 28294 $(box || document).find(".ajax-selected").each(function () { 28295 var $this = $(this); 28296 SS.justOnce(this, "searchUI", function() { 28297 $this.on("click", "a.deselect", SS_SearchUI.deselect); 28298 if ($this.find("a.deselect").size() === 0) { 28299 $this.hide(); 28300 } 28301 }); 28302 }); 28303 }; 28304 28305 SS_SearchUI.onColorBoxLoaded = function (_ev) { 28306 if (!SS_SearchUI.anchorAjaxBox) { 28307 // ãã¡ã¤ã«é¸æãã¤ã¢ãã°ã®ãç·¨éããã¿ã³ã®ã¯ãªãã¯ãªã©ã§å¥ã®ã¢ã¼ãã«ã表示ãããå ´åãããã 28308 // å¥ã®ã¢ã¼ãã«ãããã£ã³ã»ã«ãªã©ã§æ»ã£ã¦ããéã«ãå ã ã® anchor ãå©ç¨ãããã
28309 // ããã§ãåå表示æã® anchor ãè¨æ¶ãã¦ããã 28310 SS_SearchUI.anchorAjaxBox = $.colorbox.element(); 28311 } 28312 }; 28313 28314 SS_SearchUI.onColorBoxCleanedUp = function (_ev) { 28315 SS_SearchUI.anchorAjaxBox = null; 28316 selectTable = null; 28317 }; 28318 28319 SS_SearchUI.modal = function (options) { 28320 if (!options) { 28321 options = {}; 28322 } 28323 28324 var self = this; 28325 var colorbox = options.colorbox || $.colorbox; 28326 var $el = options.$el || $("#ajax-box"); 28327 28328 if (SS_SearchUI.dialogType === 'ss') { 28329 $el.find("form.search").attr("data-turbo", true) 28330 } 28331 28332 var isSameWindow = (window == $el[0].ownerDocument.defaultView) 28333 if (isSameWindow) { 28334 $el.find("form.search").on("submit", function (ev) { 28335 var $div = $("<span />", {class: "loading"}).html(SS.loading); 28336 $el.find("[type=submit]").after($div); 28337 28338 if (SS_SearchUI.dialogType !== 'ss') { 28339 $(this).ajaxSubmit({ 28340 url: $(this).attr("action"), 28341 success: function (data) { 28342 var $data = $("<div />").html(data); 28343 $.colorbox.prep($data.contents()); 28344 }, 28345 error: function (_data, _status) { 28346 $div.html("== Error =="); 28347 } 28348 }); 28349 ev.preventDefault(); 28350 return false; 28351 } 28352 }); 28353 } 28354 $el.find(".pagination a").on("click", function (ev) { 28355 self.selectItems($el); 28356 28357 if (isSameWindow) { 28358 $el.find(".pagination").html(SS.loading); 28359 28360 $.ajax({ 28361 url: $(this).attr("href"), 28362 type: "GET", 28363 success: function (data) { 28364 $el.closest("#cboxLoadedContent").html(data); 28365 }, 28366 error: function (_data, _status) { 28367 $el.find(".pagination").html("== Error =="); 28368 }, 28369 complete: function (_xhr, _status) { 28370 $("#cboxContent").trigger("ss:ajaxPagination"); 28371 } 28372 }); 28373 28374 ev.preventDefault(); 28375 return false; 28376 } else { 28377 return true; 28378 } 28379 }); 28380 $el.find("#s_group").on("change", function (_ev) { 28381 self.selectItems($el); 28382 return $el.find("form.search")[0].requestSubmit(); 28383 }); 28384 $el.find(".submit-on-change").on("change", function (_ev) { 28385 self.selectItems($el); 28386 return $el.find("form.search")[0].requestSubmit(); 28387 }); 28388 28389 if (self.anchorAjaxBox) { 28390 var $ajaxSelected = self.anchorAjaxBox.closest("dl").find(".ajax-selected"); 28391 var $toAjaxSelected = self.anchorAjaxBox.closest("body").find(".see.to .ajax-selected"); 28392 var $ccAjaxSelected = self.anchorAjaxBox.closest("body").find(".see.cc-bcc.cc .ajax-selected"); 28393 var $bcAjaxSelected = self.anchorAjaxBox.closest("body").find(".see.cc-bcc.bcc .ajax-selected"); 28394 if (!$ajaxSelected.length) { 28395 $ajaxSelected = self.anchorAjaxBox.parent().find(".ajax-selected"); 28396 } 28397 if (!$toAjaxSelected.length) { 28398 $toAjaxSelected = self.anchorAjaxBox.parent().find(".ajax-selected"); 28399 } 28400 if (!$ccAjaxSelected.length) { 28401 $ccAjaxSelected = self.anchorAjaxBox.parent().find(".ajax-selected"); 28402 } 28403 if (!$bcAjaxSelected.length) { 28404 $bcAjaxSelected = self.anchorAjaxBox.parent().find("see.cc-bcc.bcc .ajax-selected"); 28405 } 28406 $toAjaxSelected.find("tr[data-id]").each(function () { 28407 var id = $(this).data("id"); 28408 toSelected.push($("#colorbox .items [data-id='" + id + "']")); 28409 }); 28410 $ccAjaxSelected.find("tr[data-id]").each(function () { 28411 var id = $(this).data("id"); 28412 ccSelected.push($("#colorbox .items [data-id='" + id + "']")); 28413 }); 28414 $bcAjaxSelected.find("tr[data-id]").each(function () { 28415 var id = $(this).data("id"); 28416 bcSelected.push($("#colorbox .items [data-id='" + id + "']")); 28417 }); 28418 $ajaxSelected.find("tr[data-id]").each(function () { 28419 var id = $(this).data("id"); 28420 var tr = $("#colorbox .items [data-id='" + id + "']"); 28421 var i; 28422 for (i = 0; i < toSelected.length; i++) { 28423 toSelected[i].find(".to-checkbox input[type=checkbox]").remove(); 28424 } 28425 for (i = 0; i < ccSelected.length; i++) { 28426 ccSelected[i].find(".cc-checkbox input[type=checkbox]").remove(); 28427 } 28428 for (i = 0; i < bcSelected.length; i++) { 28429 bcSelected[i].find(".bcc-checkbox input[type=checkbox]").remove(); 28430 } 28431 tr.find(".checkbox input[type=checkbox]").remove(); 28432 tr.find(".select-item,.select-single-item").each(function () { 28433 var $this = $(this); 28434 var html = $this.html(); 28435 28436 var disabledHtml = $("<span />", {class: $this.prop("class"), style: 'color: #888'}).html(html); 28437 $this.replaceWith(disabledHtml); 28438 }); 28439 }); 28440 self.anchorAjaxBox.closest("body").find("tr[data-id]").each(function () { 28441 var i; 28442 for (i = 0; i < toSelected.length; i++) { 28443 toSelected[i].find(".to-checkbox input[type=checkbox]").remove(); 28444 } 28445 for (i = 0; i < ccSelected.length; i++) { 28446 ccSelected[i].find(".cc-checkbox input[type=checkbox]").remove(); 28447 } 28448 for (i = 0; i < bcSelected.length; i++) { 28449 bcSelected[i].find(".bcc-checkbox input[type=checkbox]").remove(); 28450 } 28451 }); 28452 } 28453 $el.find("table.index").each(function () { 28454 SS_ListUI.render(this); 28455 }); 28456 $el.find("a.select-item").on("click", function (ev) { 28457 if (!SS.disableClick($(this))) { 28458 return false;
28459 } 28460 // self.select() ãå¼ã³åºããéã«ãã¤ã¢ãã°ãéããã self.anchorAjaxBox ã null ã¨ãªãå¯è½æ§ãããã®ã§ãäºåã«éé¿ãã¦ããã 28461 var ajaxBox = SS_SearchUI.anchorAjaxBox; 28462 //append newly selected item 28463 self.select($(this)); 28464 if (ajaxBox) { 28465 ajaxBox.closest("dl").find(".ajax-selected").show(); 28466 } 28467 ev.preventDefault(); 28468 if (SS_SearchUI.dialogType === "ss") { 28469 SS_SearchUI.dispatchEvent("ss:modal-close") 28470 } else { 28471 colorbox.close(); 28472 } 28473 return false; 28474 }); 28475 //remove old items 28476 $el.find(".select-single-item").on("click", function (ev) { 28477 if (!SS.disableClick($(this))) { 28478 return false; 28479 } 28480 // self.select() ãå¼ã³åºããéã«ãã¤ã¢ãã°ãéããã self.anchorAjaxBox ã null ã¨ãªãå¯è½æ§ãããã®ã§ãäºåã«éé¿ãã¦ããã 28481 var ajaxBox = SS_SearchUI.anchorAjaxBox; 28482 if (ajaxBox) { 28483 ajaxBox.closest("dl").find(".ajax-selected tr[data-id]").each(function () { 28484 if ($(this).find("input[value]").length) { 28485 return $(this).remove(); 28486 } 28487 }); 28488 } 28489 //append newly selected item 28490 self.select($(this)); 28491 if (ajaxBox) { 28492 ajaxBox.closest("dl").find(".ajax-selected").show(); 28493 } 28494 ev.preventDefault(); 28495 if (SS_SearchUI.dialogType === "ss") { 28496 SS_SearchUI.dispatchEvent("ss:modal-close") 28497 } else { 28498 colorbox.close(); 28499 } 28500 return false; 28501 }); 28502 $el.find(".select-items").on("click", function (ev) { 28503 if (!SS.disableClick($(this))) { 28504 return false; 28505 } 28506 self.selectItems($el); 28507 ev.preventDefault(); 28508 if (SS_SearchUI.dialogType === "ss") { 28509 SS_SearchUI.dispatchEvent("ss:modal-close") 28510 } else { 28511 colorbox.close(); 28512 } 28513 return false; 28514 }); 28515 $el.find(".index").on("change", function (_ev) { 28516 return self.toggleSelectButton($el); 28517 }); 28518 return self.toggleSelectButton($el); 28519 }; 28520 28521 return SS_SearchUI; 28522 28523})(); 28524this.SS_AjaxFile = (function () { 28525 function SS_AjaxFile(el, options) { 28526 this.$el = $(el || "#ajax-file-box"); 28527 this.options = options || {}; 28528 28529 this.render(); 28530 } 28531 28532 SS_AjaxFile.additionalFileResizings = []; 28533 SS_AjaxFile.firesEvents = false; 28534 28535 SS_AjaxFile.errors = { 28536 entityTooLarge: "request entity is too large" 28537 } 28538 28539 SS_AjaxFile.addFileResizing = function() { 28540 for (var i = 0; i < arguments.length; i++) { 28541 var argument = arguments[i]; 28542 if (argument.default) { 28543 for (var j = 0; j < SS_AjaxFile.additionalFileResizings.length; j++) { 28544 if (SS_AjaxFile.additionalFileResizings[j].default) { 28545 SS_AjaxFile.additionalFileResizings[j].default = false;
28546 } 28547 } 28548 } 28549 28550 SS_AjaxFile.additionalFileResizings.push(argument); 28551 } 28552 } 28553 28554 SS_AjaxFile.defaultFileResizing = function () { 28555 for (var i = 0; i < SS_AjaxFile.additionalFileResizings.length; i++) { 28556 if (SS_AjaxFile.additionalFileResizings[i].default) { 28557 return SS_AjaxFile.additionalFileResizings[i].value; 28558 } 28559 } 28560 28561 return null; 28562 }; 28563 28564 SS_AjaxFile.defaultFileSelectHandler = function() { 28565 var promisses = []; 28566 var fileViews = []; 28567 28568 for (var i = 0; i < arguments.length; i++) { 28569 var $argument = $(arguments[i]); 28570 var url = $argument.attr('href'); 28571 if (!url) { 28572 continue; 28573 } 28574 28575 var filename = $argument.data("humanized-name"); 28576 28577 promisses.push($.ajax({ 28578 url: url, 28579 success: function(html) { 28580 fileViews.push({ name: filename, html: html }); 28581 }, 28582 error: function(xhr, _status, _data) { 28583 if (xhr.responseJSON && Array.isArray(xhr.responseJSON)) { 28584 alert(["== Error(AjaxFile) =="].concat(xhr.responseJSON).join("\n")); 28585 } else { 28586 alert(["== Error(AjaxFile) =="].concat(xhr.statusText).join("\n")); 28587 } 28588 } 28589 })); 28590 } 28591 28592 $.when.apply($, promisses).done(function () { 28593 fileViews.sort(function(a,b) { 28594 if (a.name < b.name) return 1; 28595 if (a.name > b.name) return -1; 28596 return 0; 28597 }); 28598 28599 for (var i = 0; i < fileViews.length; i++) { 28600 $("#selected-files").prepend(fileViews[i].html).trigger("change"); 28601 } 28602 28603 $.colorbox.close(); 28604 }); 28605 }; 28606 28607 SS_AjaxFile.prototype.render = function() { 28608 var self = this; 28609 28610 self.$el.on("submit", "form.user-file", function (ev) { 28611 var submitted = "attach"; 28612 if (ev.originalEvent && ev.originalEvent.submitter) { 28613 submitted = ev.originalEvent.submitter.dataset.submitted; 28614 } 28615 var $form = $(this); 28616 28617 var params = { 28618 url: $form.attr("action") + ".json", 28619 dataType: "json", 28620 success: function(data, _textStatus, _xhr) { 28621 self.submitSuccess(submitted, data); 28622 }, 28623 error: function (xhr, _status, _error) { 28624 self.submitError(xhr); 28625 }, 28626 complete: function (_xhr, _status) { 28627 SS.enableFormElementsOnTimeoutSubmit(); 28628 } 28629 }; 28630 28631 $form.ajaxSubmit(params); 28632 ev.preventDefault(); 28633 }); 28634 28635 self.$el.on("click", ".user-files .select", function(ev) { 28636 self.selectFiles(this); 28637 28638 ev.preventDefault(); 28639 return false; 28640 }); 28641 28642 self.$el.on("click", ".user-files .delete", function(ev) { 28643 ev.preventDefault(); 28644 self.deleteFile(ev.target); 28645 return false; 28646 }); 28647 28648 for (var i = 0; i < SS_AjaxFile.additionalFileResizings.length; i++) { 28649 var fileResizing = SS_AjaxFile.additionalFileResizings[i]; 28650 var option = $('<option />').val(fileResizing.value).text(fileResizing.label); 28651 if (fileResizing.default) { 28652 option.prop('selected', true) 28653 } 28654 28655 self.$el.find('form.user-file .image-size').append(option); 28656 } 28657 }; 28658 28659 SS_AjaxFile.prototype.submitSuccess = function(submitted, data) { 28660 var self = this; 28661 var loadUrl = (submitted === "attach") ? self.options.selectedFilesPath : self.options.indexPath; 28662 var indexOptions = self.options.pathOptions || {}; 28663 28664 if (submitted === "attach" && Array.isArray(data)) { 28665 var select_ids = $.map(data, function(v) { return v._id }); 28666 indexOptions = Object.assign(indexOptions, { select_ids: select_ids }); 28667 } 28668 28669 if (Object.keys(indexOptions).length) { 28670 loadUrl += "?" + $.param(indexOptions); 28671 } 28672 28673 $("<div />").load(loadUrl, function () { 28674 var $userFiles = $(this).find(".user-files"); 28675 if ($userFiles[0]) { 28676 // TODO: å·®åã ããã¢ãã¡ã¼ã·ã§ã³ã¤ãã§ insert ããã¨ãã£ããããªã 28677 self.$el.find(".user-files").html($userFiles.html()); 28678 SS.renderInBox(self.$el); 28679 } 28680 28681 self.$el.find("form.user-file [type='file']").val(null).trigger("change"); 28682 28683 var defaultImageSize = null; 28684 for (var i = 0; i < SS_AjaxFile.additionalFileResizings.length; i++) {
28685 var fileResizing = SS_AjaxFile.additionalFileResizings[i]; 28686 if (fileResizing.default) { 28687 defaultImageSize = fileResizing.value; 28688 break; 28689 } 28690 } 28691 self.$el.find("form.user-file .image-size").val(defaultImageSize).trigger("change"); 28692 28693 if (submitted === "attach") { 28694 self.attachFiles(data); 28695 } else { 28696 $.rails.enableFormElements(self.$el.find('form.user-file')); 28697 } 28698 }); 28699 }; 28700 28701 SS_AjaxFile.prototype.attachFiles = function(data) { 28702 var self = this; 28703 28704 if (!Array.isArray(data) || data.length == 0) { 28705 return; 28706 } 28707 28708 var elements = []; 28709 $.each(data, function(index, file) { 28710 var item = self.$el.find(".user-files [data-id='" + file._id + "'] .select"); 28711 elements.push(item); 28712 }); 28713 28714 self.selectFiles.apply(self, elements); 28715 }; 28716 28717 SS_AjaxFile.prototype.submitError = function(xhr) { 28718 var self = this; 28719 if (xhr.status === 413) { 28720 alert(["== Error(AjaxFile) =="].concat(SS_AjaxFile.errors.entityTooLarge).join("\n")); 28721 } else { 28722 try { 28723 alert(["== Error(AjaxFile) =="].concat(xhr.responseJSON).join("\n")); 28724 } catch(_error) { 28725 alert(["== Error(AjaxFile) =="].concat(xhr.statusText).join("\n")); 28726 } 28727 } 28728 28729 $.rails.enableFormElements(self.$el.find('form.user-file')); 28730 }; 28731 28732 SS_AjaxFile.prototype.selectFiles = function() { 28733 if (SS_SearchUI.anchorAjaxBox) { 28734 if (SS_AjaxFile.firesEvents) { 28735 var event = $.Event("ss:ajaxFileSelected"); 28736 SS_SearchUI.anchorAjaxBox.trigger(event, [ arguments ]); 28737 if (event.isDefaultPrevented()) { 28738 return; 28739 } 28740 } 28741 28742 var handler = SS_SearchUI.anchorAjaxBox.data('on-select'); 28743 if (handler) { 28744 $.each(arguments, function() { 28745 handler($(this)); 28746 }); 28747 28748 return true; 28749 } 28750 } 28751 28752 SS_AjaxFile.defaultFileSelectHandler.apply(SS_AjaxFile, arguments); 28753 }; 28754 28755 SS_AjaxFile.prototype.deleteFile = function(el) { 28756 var confirmMessage = "åé¤ãã¦ããããã§ããï¼"; 28757 if ("i18next" in window) { 28758 confirmMessage = i18next.t('ss.confirm.delete') 28759 } else { 28760 confirmMessage = "åé¤ãã¦ããããã§ããï¼"; 28761 } 28762 if (!confirm(confirmMessage)) { 28763 return false; 28764 } 28765 28766 var $el = $(el); 28767 $.ajax({ 28768 type: "POST", 28769 data: "_method=delete", 28770 url: $el.attr("href") + ".json", 28771 dataType: "json", 28772 beforeSend: function () { 28773 $el.html(SS.loading); 28774 }, 28775 success: function () { 28776 var $target; 28777 if ($el.data("remove")) { 28778 $target = $($el.data("remove")); 28779 } else { 28780 $target = $el.closest(".file-view") 28781 } 28782 28783 $target.slideUp("fast", function() { 28784 $target.remove(); 28785 if (SS_AjaxFile.firesEvents && SS_SearchUI.anchorAjaxBox) { 28786 SS_SearchUI.anchorAjaxBox.trigger("ss:ajaxRemoved"); 28787 } 28788 }); 28789 }, 28790 error: function (data, _status) { 28791 alert(["== Error(AjaxFile) =="].concat(data.responseJSON).join("\n")); 28792 } 28793 }); 28794 }; 28795 28796 return SS_AjaxFile; 28797 28798})(); 28799this.Chat_Bot = (function () { 28800 function Chat_Bot(el, url) { 28801 this.$el = $(el); 28802 this.url = url; 28803 this.inProgress = false; 28804 this.render(); 28805 } 28806 28807 Chat_Bot.prototype.render = function () { 28808 var _this = this; 28809 _this.$el.on("keypress", '.chat-text', function (ev) { 28810 if ((ev.which && ev.which === SS.KEY_ENTER) || (ev.keyCode && ev.keyCode === SS.KEY_ENTER)) { 28811 _this.sendChatRequest($(this)); 28812 } 28813 }); 28814 _this.$el.on("click", '.chat-button', function () { 28815 _this.sendChatRequest($(this)); 28816 }); 28817 _this.$el.on("click", '.chat-items', function (ev) { 28818 var $target = $(ev.target); 28819 if ($target.hasClass('chat-suggest')) { 28820 _this.sendChatRequest($(this), { text: $target.text(), value: $target.data("value"), clickSuggest: true }); 28821 return false; 28822 } else if ($target.hasClass('chat-success')) { 28823 _this.sendFeedback($target, 'success'); 28824 return false; 28825 } else if ($target.hasClass('chat-retry')) { 28826 _this.sendFeedback($target, 'retry'); 28827 return false;
28828 } 28829 }); 28830 _this.$el.on("click", '.chat-dismiss', function () { 28831 _this.$el.trigger("ss:chatClose"); 28832 }); 28833 }; 28834 28835 Chat_Bot.prototype.fetchFirstMessagenAndSuggestions = function () { 28836 var _this = this; 28837 28838 if (_this.inProgress) { 28839 return; 28840 } 28841 28842 _this.inProgress = true; 28843 28844 $.ajax({ 28845 type: "GET", 28846 url: _this.url, 28847 cache: false, 28848 success: function (res, _status) { 28849 _this.renderChatResponse(res); 28850 }, 28851 error: function (_xhr, _status, _error) { 28852 }, 28853 complete: function(_xhr, _status) { 28854 _this.inProgress = false; 28855 } 28856 }); 28857 }; 28858 28859 Chat_Bot.prototype.sendChatRequest = function ($el, options) { 28860 var _this = this; 28861 if (_this.inProgress) { 28862 return; 28863 } 28864 28865 _this.inProgress = true; 28866 28867 var $chatText = _this.$el.find('.chat-text'); 28868 28869 var text, value; 28870 if (options) { 28871 text = options.text; 28872 value = options.value ? options.value : text; 28873 } 28874 if (!text) { 28875 text = $chatText.val(); 28876 value = text; 28877 $chatText.val(''); 28878 } 28879 if (!text) { 28880 return false; 28881 } 28882 28883 var $chatItems = _this.$el.find('.chat-items'); 28884 $chatItems.append($('<div class="chat-item user"></div>').append(text)); 28885 $chatItems.append($('<div class="chat-item in-progress">' + SS.loading + '</div>')); 28886 $chatItems.animate({ scrollTop: $chatItems[0].scrollHeight }); 28887 $.ajax({ 28888 type: "GET", 28889 url: _this.url, 28890 cache: false, 28891 data: { 28892 text: text, 28893 value: value, 28894 click_suggest: options && options.clickSuggest 28895 }, 28896 success: function (res, _status) { 28897 $chatItems.find(".in-progress").remove(); 28898 _this.renderChatResponse(res); 28899 }, 28900 error: function (_xhr, _status, _error) { 28901 $chatItems.find(".in-progress").remove(); 28902 }, 28903 complete: function(_xhr, _status) { 28904 $chatItems.find(".in-progress").remove(); 28905 _this.inProgress = false; 28906 } 28907 }); 28908 }; 28909 28910 Chat_Bot.prototype.renderChatResponse = function (res) { 28911 var _this = this; 28912 var $chatItems = _this.$el.find('.chat-items'); 28913 28914 var result = res; 28915 if (typeof res === 'string' || res instanceof String) { 28916 result = $.parseJSON(res); 28917 } 28918 28919 $.each(result.results, function (i, r) { 28920 if (!r.response) { 28921 return; 28922 } 28923 28924 var siteSearchParagraph; 28925 if (r.siteSearchUrl) { 28926 var siteSearchLink = $('<a />', { href: r.siteSearchUrl, target: "_blank", rel: "noopener" }).append(result.siteSearchText); 28927 siteSearchParagraph = $('<p />', { class: "search-result-btn" }).append(siteSearchLink); 28928 } else { 28929 siteSearchParagraph = ''; 28930 } 28931 28932 if (r.suggests) { 28933 $chatItems.append($('<div class="chat-item sys"></div>').append(r.response).append(siteSearchParagraph)); 28934 r.suggests.forEach(function (suggest) { 28935 var chatSuggest = $('<a class="chat-suggest"></a>').attr('href', _this.url).attr('data-value', suggest.value).append(suggest.text); 28936 $chatItems.append($('<div class="chat-item suggest"></div>').append(chatSuggest)); 28937 }); 28938 } else if (r.question) { 28939 var chatSuccess = $('<button name="button" type="button" class="chat-success" data-id="' + r.id + '"></button>').append(result.chatSuccess); 28940 var chatRetry = $('<button name="button" type="button" class="chat-retry" data-id="' + r.id + '"></button>').append(result.chatRetry); 28941 var chatFinish = $('<div class="chat-finish"></div>').append(r.question).append(chatSuccess).append(chatRetry); 28942 $chatItems.append($('<div class="chat-item sys"></div>').append(r.response).append(siteSearchParagraph).append(chatFinish)); 28943 } else { 28944 $chatItems.append($('<div class="chat-item sys"></div>').append(r.response).append(siteSearchParagraph)); 28945 } 28946 }); 28947 28948 $chatItems.animate({ scrollTop: $chatItems[0].scrollHeight }); 28949 }; 28950 28951 Chat_Bot.prototype.sendFeedback = function ($el, question) { 28952 var _this = this; 28953 if (_this.inProgress) { 28954 return; 28955 } 28956 28957 _this.inProgress = true; 28958 28959 $.ajax({ 28960 type: "GET", 28961 url: _this.url, 28962 cache: false, 28963 data: { 28964 intent_id: $el.data('id'), 28965 question: question || 'success' 28966 }, 28967 success: function (res, _status) { 28968 _this.renderFeedback(res); 28969 }, 28970 error: function (_xhr, _status, _error) { 28971 }, 28972 complete: function(_xhr, _status) { 28973 _this.inProgress = false;
28974 } 28975 }); 28976 }; 28977 28978 Chat_Bot.prototype.renderFeedback = function (res) { 28979 var _this = this; 28980 28981 var result = res; 28982 if (typeof res === 'string' || res instanceof String) { 28983 result = $.parseJSON(res); 28984 } 28985 28986 var $chatItems = _this.$el.find('.chat-items'); 28987 28988 $.each(result.results, function (i, r) { 28989 if (!r.response) { 28990 return; 28991 } 28992 28993 $chatItems.append($('<div class="chat-item sys"></div>').append(r.response)); 28994 }); 28995 28996 $chatItems.animate({ scrollTop: $chatItems[0].scrollHeight }); 28997 setTimeout(_this.fetchFirstMessagenAndSuggestions.bind(_this), 1000) 28998 }; 28999 29000 return Chat_Bot; 29001 29002})(); 29003this.Cms_Editor_Module = (function () { 29004 function Cms_Editor_Module() { 29005 } 29006 29007 Cms_Editor_Module.editorId = "item_html"; 29008 29009 Cms_Editor_Module.getEditorHtml = function (id) { 29010 var html; 29011 if (id == null) { 29012 id = null; 29013 } 29014 id || (id = Cms_Form.editorId); 29015 if (typeof tinymce !== 'undefined') { 29016 html = tinymce.get(id).getContent(); 29017 } else if (typeof CKEDITOR !== 'undefined') { 29018 html = CKEDITOR.instances[id].getData(); 29019 } else { 29020 html = ""; 29021 } 29022 return html; 29023 }; 29024 29025 Cms_Editor_Module.setEditorHtml = function (html, opts) { 29026 var id = null; 29027 29028 opts = opts || {}; 29029 if (opts["id"]) { 29030 id = opts["id"]; 29031 } 29032 29033 id || (id = Cms_Form.editorId); 29034 if (typeof tinymce !== 'undefined') { 29035 return tinymce.get(id).setContent(html); 29036 } else if (typeof CKEDITOR !== 'undefined') { 29037 return CKEDITOR.instances[id].setData(html); 29038 } 29039 }; 29040 29041 return Cms_Editor_Module; 29042 29043})(); 29044 29045this.Cms_Editor_CodeMirror = (function () { 29046 function Cms_Editor_CodeMirror() { 29047 //Render codeMirror 29048 } 29049 29050 Cms_Editor_CodeMirror.render = function (selector, opts) { 29051 if (opts == null) { 29052 opts = {}; 29053 } 29054 return $(selector).each(function () { 29055 var cm, form; 29056 form = $(this); 29057 cm = CodeMirror.fromTextArea(form.get(0), opts); 29058 cm.setSize(null, form.height()); 29059 if (opts["readonly"]) { 29060 cm.refresh(); 29061 } 29062 return form.data("editor", cm); 29063 }); 29064 }; 29065 29066 Cms_Editor_CodeMirror.lock = function (selector, target) { 29067 Cms_Editor_CodeMirror.setOption(selector, target); 29068 return $(document).on('change', selector, function (_ev) { 29069 return Cms_Editor_CodeMirror.setOption(selector, target); 29070 }); 29071 }; 29072 29073 Cms_Editor_CodeMirror.setOption = function (selector, target) { 29074 var cm; 29075 cm = $(target).next('.CodeMirror')[0].CodeMirror; 29076 if ($(selector).val() === '') { 29077 cm.setOption('mode', 'text/html'); 29078 return cm.setOption('readOnly', false); 29079 } else { 29080 cm.setOption('mode', 'text/plain'); 29081 return cm.setOption('readOnly', true); 29082 } 29083 }; 29084 29085 return Cms_Editor_CodeMirror; 29086 29087})(); 29088 29089this.Cms_Editor_CKEditor = (function () { 29090 function Cms_Editor_CKEditor() { 29091 } 29092 29093 var onceInitialized = false; 29094 29095 Cms_Editor_CKEditor.initializeOnce = function () { 29096 if (onceInitialized) { 29097 return; 29098 } 29099 29100 onceInitialized = true; 29101 29102 CKEDITOR.on('dialogDefinition', function (ev) { 29103 var def, info, name, text; 29104 name = ev.data.name; 29105 def = ev.data.definition; 29106 if (name === 'table' || name === 'tableProperties') { 29107 info = def.getContents('info'); 29108 text = info.get('txtWidth'); 29109 text['default'] = ""; 29110 text = info.get('txtCellSpace'); 29111 text['controlStyle'] = "display: none"; 29112 text['label'] = ""; 29113 text['default'] = ""; 29114 text = info.get('txtCellPad'); 29115 text['controlStyle'] = "display: none"; 29116 text['label'] = ""; 29117 text['default'] = ""; 29118 text = info.get('txtBorder'); 29119 text['controlStyle'] = "display: none"; 29120 text['label'] = ""; 29121 text['default'] = ""; 29122 text = info.get('txtSummary'); 29123 text['controlStyle'] = "display: none"; 29124 text['label'] = ""; 29125 return text['default'] = ""; 29126 } 29127 }); 29128 29129 // fix. CKEditor Paste Dialog: github.com/ckeditor/ckeditor4/issues/469 29130 CKEDITOR.on('instanceReady', function (outerEv) { 29131 var elemet = outerEv.editor.element.$; 29132 outerEv.editor.on("change", function () { 29133 var event = new CustomEvent("ss:change", { bubbles: true, cancelable: true, composed: true }); 29134 elemet.dispatchEvent(event); 29135 }); 29136 outerEv.editor.on("beforeCommandExec", function(innerEv) { 29137 // Show the paste dialog for the paste buttons and right-click paste 29138 if (innerEv.data.name === "paste") { 29139 innerEv.editor._.forcePasteDialog = true; 29140 } 29141 // Don't show the paste dialog for Ctrl+Shift+V 29142 if (innerEv.data.name === "pastetext" && innerEv.data.commandData.from === "keystrokeHandler") { 29143 innerEv.cancel(); 29144 } 29145 }); 29146 }); 29147 } 29148 29149 Cms_Editor_CKEditor.render = function (selector, opts, _jsOpts) { 29150 //Render CKEditor 29151 if (opts == null) { 29152 opts = {}; 29153 } 29154 29155 // $(selector).ckeditor(opts); 29156 $(selector).each(function() { 29157 var $this = $(this); 29158 SS.justOnce(this, "ss-editor", function() { 29159 $this.ckeditor(opts); 29160 }); 29161 }); 29162 29163 Cms_Editor_CKEditor.initializeOnce(); 29164 }; 29165 29166 Cms_Editor_CKEditor.destroy = function (selector) { 29167 $(selector).each(function() { 29168 var $this = $(this); 29169 var editor = $this.data("ckeditorInstance"); 29170 if (editor) { 29171 editor.destroy(); 29172 } 29173 29174 SS.deleteJustOnce(this, "ss-editor"); 29175 }); 29176 }; 29177 29178 return Cms_Editor_CKEditor; 29179 29180})(); 29181
29182this.Cms_Editor_TinyMCE = (function () { 29183 function Cms_Editor_TinyMCE() { 29184 } 29185 29186 Cms_Editor_TinyMCE.render = function (selector, opts) { 29187 //Render TinyMCE 29188 if (opts == null) { 29189 opts = {}; 29190 } 29191 opts["selector"] = selector; 29192 return tinymce.init(opts); 29193 }; 29194 29195 return Cms_Editor_TinyMCE; 29196 29197})(); 29198this.Ads_Banner = (function () { 29199 function Ads_Banner() { 29200 //landomize banners 29201 } 29202 29203 Ads_Banner.randomize = function (selector) { 29204 var list, wrap; 29205 wrap = $(selector); 29206 list = wrap.find("a").parent("span"); 29207 list = list.sort(function () { 29208 return Math.random() - .5; 29209 }); 29210 return list.each(function () { 29211 return wrap.append($(this)); 29212 }); 29213 }; 29214 29215 return Ads_Banner; 29216 29217})(); 29218this.Event_Monthly = (function () { 29219 function Event_Monthly() { 29220 } 29221 29222 Event_Monthly.render = function () { 29223 $(".event-pages-filter a[data-id!=all]").on('click', function () { 29224 $(".event-pages-filter a[data-id=all]").removeClass("clicked"); 29225 29226 if ($(this).hasClass("clicked")) { 29227 $(this).removeClass("clicked"); 29228 } else { 29229 $(this).addClass("clicked"); 29230 } 29231 29232 var dataIds = []; 29233 $(".event-pages-filter a.clicked").each(function () { 29234 var dataId = parseInt($(this).attr("data-id")); 29235 if (!isNaN(dataId)) { 29236 return dataIds.push(dataId); 29237 } 29238 }); 29239 29240 $("#event-list .page").each(function () { 29241 var pageDataIds = []; 29242 $.each($(this).attr("data-id").split(" "), function () { 29243 return pageDataIds.push(parseInt(this)); 29244 }); 29245 29246 var visible = false; 29247 $.each(dataIds, function () { 29248 if ($.inArray(parseInt(this), pageDataIds) >= 0) { 29249 visible = true; 29250 return false; 29251 } 29252 }); 29253 29254 if (visible) { 29255 return $(this).show(); 29256 } else { 29257 return $(this).hide(); 29258 } 29259 }); 29260 return false; 29261 }); 29262 29263 $(".event-pages-filter a[data-id=all]").on('click', function () { 29264 if (!$(this).hasClass("clicked")) { 29265 $(this).addClass("clicked"); 29266 $(".event-pages-filter a[data-id!=all]").removeClass("clicked"); 29267 $("#event-list .page").show(); 29268 } 29269 return false; 29270 }); 29271 }; 29272 29273 return Event_Monthly; 29274 29275})(); 29276this.Event_Calendar = (function () { 29277 function Event_Calendar() { 29278 } 29279 29280 Event_Calendar.render = function (url) { 29281 var paginate; 29282 paginate = function (a) { 29283 var month, year; 29284 year = $(a).attr("data-year"); 29285 month = $(a).attr("data-month"); 29286 return $.ajax({ 29287 type: "GET", 29288 url: url + "?year=" + year + "&month=" + month, 29289 cache: false, 29290 success: function (res, _status) { 29291 var html; 29292 html = "<div>" + res + "</div>"; 29293 $(".event-calendar").replaceWith($(html).find(".event-calendar")); 29294 $(".calendar-nav a.paginate").on('click', function () { 29295 paginate(this); 29296 return false; 29297 }); 29298 }, 29299 error: function (_xhr, _status, _error) { 29300 }, 29301 complete: function (_xhr, _status) { 29302 $(".event-calendar .calendar").hide().fadeIn('fast'); 29303 } 29304 }); 29305 }; 29306 return $(".calendar-nav a.paginate").on('click', function () { 29307 paginate(this); 29308 return false; 29309 }); 29310 }; 29311 29312 return Event_Calendar; 29313 29314})(); 29315this.Event_Search = (function () { 29316 function Event_Search() { 29317 } 29318 29319 Event_Search.render = function () { 29320 SS.justOnce(this, "event-search", function() { 29321 $("form.event-search .search_clear").on("click", function () { 29322 $(this).parents("form.event-search").each(function() {
29323 $(this).find("input.keyword").val(""); 29324 $(this).find("input.prop").prop("checked", false); 29325 $(this).find("input.start").val(""); 29326 $(this).find("input.close").val(""); 29327 $(this).find("select.facility").val(""); 29328 $(this).find("select.sort").val(""); 29329 }); 29330 return false; 29331 }); 29332 }); 29333 }; 29334 29335 return Event_Search; 29336 29337})(); 29338Inquiry_Form = function (options) { 29339 this.options = options; 29340 this.render(); 29341}; 29342 29343Inquiry_Form.instance = null; 29344 29345Inquiry_Form.render = function(options) { 29346 if (Inquiry_Form.instance) { 29347 return; 29348 } 29349 29350 Inquiry_Form.instance = new Inquiry_Form(options); 29351}; 29352 29353Inquiry_Form.prototype.render = function() { 29354 $('.inquiry-form input:not([type="submit"], [type="button"], [type="reset"])').on('keypress', function (ev) { 29355 if ((ev.which && ev.which === SS.KEY_ENTER) || (ev.keyCode && ev.keyCode === SS.KEY_ENTER)) { 29356 return false; 29357 } else { 29358 return true; 29359 } 29360 }); 29361 29362 var _this = this; 29363 $(document).on('change', '.form-select input[type="radio"]', function() { 29364 return _this.changeForm(); 29365 }); 29366 29367 if ($('.form-select').length > 0) { 29368 this.changeForm(); 29369 } 29370}; 29371 29372Inquiry_Form.prototype.collectSelectFormValues = function() { 29373 var selector; 29374 if (this.options.confirm) { 29375 selector = 'input[type="hidden"]'; 29376 } else { 29377 selector = 'input[type="radio"]:checked'; 29378 } 29379 29380 var values = []; 29381 $('.form-select ' + selector).each(function() { 29382 var val = $(this).val(); 29383 if (values.indexOf(val) < 0) { 29384 values.push(val); 29385 } 29386 }); 29387 return values; 29388}; 29389 29390Inquiry_Form.prototype.intersect = function(arr1, arr2) { 29391 return arr1.filter(function(el) { 29392 return arr2.indexOf(el) !== -1 29393 }); 29394}; 29395 29396Inquiry_Form.prototype.changeForm = function() { 29397 var _this = this; 29398 var checkedValues = this.collectSelectFormValues(); 29399 29400 $('.select-form-target').each(function() { 29401 if (_this.intersect(checkedValues, $(this).data('select-form')).length > 0) { 29402 // append required label if absent 29403 if ($(this).find('span.required').length === 0) { 29404 var span = $("<span/>").attr('class', 'required').text(_this.options.requiredLabel); 29405 if (_this.options.confirm) { 29406 span.appendTo($(this).children('dt')); 29407 } else { 29408 span.appendTo($(this).children('legend')); 29409 } 29410 } 29411 } else { 29412 // remove required label 29413 $(this).find('span.required').remove(); 29414 } 29415 }); 29416}; 29417/** 29418 * bxSlider v4.2.5 29419 * Copyright 2013-2015 Steven Wanderski 29420 * Written while drinking Belgian ales and listening to jazz 29421 29422 * Licensed under MIT (http://opensource.org/licenses/MIT) 29423 */ 29424 29425;(function($) { 29426 29427 var defaults = { 29428 29429 // GENERAL 29430 mode: 'horizontal', 29431 slideSelector: '', 29432 infiniteLoop: true, 29433 hideControlOnEnd: false, 29434 speed: 500, 29435 easing: null, 29436 slideMargin: 0, 29437 startSlide: 0, 29438 randomStart: false, 29439 captions: false, 29440 ticker: false, 29441 tickerHover: false, 29442 adaptiveHeight: false, 29443 adaptiveHeightSpeed: 500, 29444 video: false, 29445 useCSS: true, 29446 preloadImages: 'visible', 29447 responsive: true, 29448 slideZIndex: 50, 29449 wrapperClass: 'bx-wrapper', 29450 29451 // TOUCH 29452 touchEnabled: true, 29453 swipeThreshold: 50, 29454 oneToOneTouch: true, 29455 preventDefaultSwipeX: true, 29456 preventDefaultSwipeY: false, 29457 29458 // ACCESSIBILITY 29459 ariaLive: true, 29460 ariaHidden: true, 29461 29462 // KEYBOARD 29463 keyboardEnabled: false, 29464 29465 // PAGER 29466 pager: true, 29467 pagerType: 'full', 29468 pagerShortSeparator: ' / ', 29469 pagerSelector: null, 29470 buildPager: null, 29471 pagerCustom: null, 29472 29473 // CONTROLS 29474 controls: true, 29475 nextText: 'Next', 29476 prevText: 'Prev', 29477 nextSelector: null, 29478 prevSelector: null, 29479 autoControls: false, 29480 startText: 'Start', 29481 stopText: 'Stop', 29482 autoControlsCombine: false, 29483 autoControlsSelector: null, 29484 29485 // AUTO 29486 auto: false, 29487 pause: 4000, 29488 autoStart: true, 29489 autoDirection: 'next', 29490 stopAutoOnClick: false, 29491 autoHover: false, 29492 autoDelay: 0, 29493 autoSlideForOnePage: false, 29494 29495 // CAROUSEL 29496 minSlides: 1, 29497 maxSlides: 1, 29498 moveSlides: 0, 29499 slideWidth: 0, 29500 shrinkItems: false, 29501 29502 // CALLBACKS 29503 onSliderLoad: function() { return true; }, 29504 onSlideBefore: function() { return true; }, 29505 onSlideAfter: function() { return true; }, 29506 onSlideNext: function() { return true; }, 29507 onSlidePrev: function() { return true; }, 29508 onSliderResize: function() { return true; } 29509 }; 29510 29511 $.fn.bxSlider = function(options) { 29512 29513 if (this.length === 0) { 29514 return this; 29515 } 29516 29517 // support multiple elements 29518 if (this.length > 1) { 29519 this.each(function() { 29520 $(this).bxSlider(options); 29521 }); 29522 return this; 29523 } 29524 29525 // create a namespace to be used throughout the plugin 29526 var slider = {}, 29527 // set a reference to our slider element 29528 el = this, 29529 // get the original window dimens (thanks a lot IE) 29530 windowWidth = $(window).width(), 29531 windowHeight = $(window).height(); 29532 29533 // Return if slider is already initialized 29534 if ($(el).data('bxSlider')) { return; } 29535 29536 /** 29537 * =================================================================================== 29538 * = PRIVATE FUNCTIONS 29539 * =================================================================================== 29540 */ 29541 29542 /** 29543 * Initializes namespace settings to be used throughout plugin 29544 */ 29545 var init = function() { 29546 // Return if slider is already initialized 29547 if ($(el).data('bxSlider')) { return; } 29548 // merge user-supplied options with the defaults 29549 slider.settings = $.extend({}, defaults, options); 29550 // parse slideWidth setting 29551 slider.settings.slideWidth = parseInt(slider.settings.slideWidth); 29552 // store the original children 29553 slider.children = el.children(slider.settings.slideSelector); 29554 // check if actual number of slides is less than minSlides / maxSlides 29555 if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; } 29556 if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; } 29557 // if random start, set the startSlide setting to random number 29558 if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); } 29559 // store active slide information 29560 slider.active = { index: slider.settings.startSlide };
vendor: 26,035 bytes, lines 29561-30121
29561 // store if the slider is in carousel mode (displaying / moving multiple slides) 29562 slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false; 29563 // if carousel, force preloadImages = 'all' 29564 if (slider.carousel) { slider.settings.preloadImages = 'all'; } 29565 // calculate the min / max width thresholds based on min / max number of slides 29566 // used to setup and update carousel slides dimensions 29567 slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin); 29568 slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 29569 // store the current state of the slider (if currently animating, working is true) 29570 slider.working = false; 29571 // initialize the controls object 29572 slider.controls = {}; 29573 // initialize an auto interval 29574 slider.interval = null; 29575 // determine which property to use for transitions 29576 slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left'; 29577 // determine if hardware acceleration can be used 29578 slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() { 29579 // create our test div element 29580 var div = document.createElement('div'), 29581 // css transition properties 29582 props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; 29583 // test for each property 29584 for (var i = 0; i < props.length; i++) { 29585 if (div.style[props[i]] !== undefined) { 29586 slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase(); 29587 slider.animProp = '-' + slider.cssPrefix + '-transform'; 29588 return true; 29589 } 29590 } 29591 return false; 29592 }()); 29593 // if vertical mode always make maxSlides and minSlides equal 29594 if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; } 29595 // save original style data 29596 el.data('origStyle', el.attr('style')); 29597 el.children(slider.settings.slideSelector).each(function() { 29598 $(this).data('origStyle', $(this).attr('style')); 29599 }); 29600 29601 // perform all DOM / CSS modifications 29602 setup(); 29603 }; 29604 29605 /** 29606 * Performs all DOM and CSS modifications 29607 */ 29608 var setup = function() { 29609 var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible) 29610 29611 // wrap el in a wrapper 29612 el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>'); 29613 // store a namespace reference to .bx-viewport 29614 slider.viewport = el.parent(); 29615 29616 // add aria-live if the setting is enabled and ticker mode is disabled 29617 if (slider.settings.ariaLive && !slider.settings.ticker) { 29618 slider.viewport.attr('aria-live', 'polite'); 29619 } 29620 // add a loading div to display while images are loading 29621 slider.loader = $('<div class="bx-loading" />'); 29622 slider.viewport.prepend(slider.loader); 29623 // set el to a massive width, to hold any needed slides 29624 // also strip any margin and padding from el 29625 el.css({ 29626 width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto', 29627 position: 'relative' 29628 }); 29629 // if using CSS, add the easing property 29630 if (slider.usingCSS && slider.settings.easing) { 29631 el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing); 29632 // if not using CSS and no easing value was supplied, use the default JS animation easing (swing) 29633 } else if (!slider.settings.easing) { 29634 slider.settings.easing = 'swing'; 29635 } 29636 // make modifications to the viewport (.bx-viewport) 29637 slider.viewport.css({ 29638 width: '100%', 29639 overflow: 'hidden', 29640 position: 'relative' 29641 }); 29642 slider.viewport.parent().css({ 29643 maxWidth: getViewportMaxWidth() 29644 }); 29645 // make modification to the wrapper (.bx-wrapper) 29646 if (!slider.settings.pager && !slider.settings.controls) { 29647 slider.viewport.parent().css({ 29648 margin: '0 auto 0px' 29649 }); 29650 } 29651 // apply css to all slider children 29652 slider.children.css({ 29653 'float': slider.settings.mode === 'horizontal' ? 'left' : 'none', 29654 listStyle: 'none', 29655 position: 'relative' 29656 }); 29657 // apply the calculated width after the float is applied to prevent scrollbar interference 29658 slider.children.css('width', getSlideWidth()); 29659 // if slideMargin is supplied, add the css 29660 if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); } 29661 if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); } 29662 // if "fade" mode, add positioning and z-index CSS 29663 if (slider.settings.mode === 'fade') { 29664 slider.children.css({ 29665 position: 'absolute', 29666 zIndex: 0, 29667 display: 'none' 29668 }); 29669 // prepare the z-index on the showing element 29670 slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'}); 29671 } 29672 // create an element to contain all slider controls (pager, start / stop, etc) 29673 slider.controls.el = $('<div class="bx-controls" />'); 29674 // if captions are requested, add them 29675 if (slider.settings.captions) { appendCaptions(); } 29676 // check if startSlide is last slide 29677 slider.active.last = slider.settings.startSlide === getPagerQty() - 1; 29678 // if video is true, set up the fitVids plugin 29679 if (slider.settings.video) { el.fitVids(); } 29680 if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; } 29681 // only check for control addition if not in "ticker" mode 29682 if (!slider.settings.ticker) { 29683 // if controls are requested, add them 29684 if (slider.settings.controls) { appendControls(); } 29685 // if auto is true, and auto controls are requested, add them 29686 if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); } 29687 // if pager is requested, add it 29688 if (slider.settings.pager) { appendPager(); } 29689 // if any control option is requested, add the controls wrapper 29690 if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); } 29691 // if ticker mode, do not allow a pager 29692 } else { 29693 slider.settings.pager = false; 29694 } 29695 loadElements(preloadSelector, start); 29696 }; 29697 29698 var loadElements = function(selector, callback) { 29699 var total = selector.find('img:not([src=""]), iframe').length, 29700 count = 0; 29701 if (total === 0) { 29702 callback(); 29703 return; 29704 } 29705 selector.find('img:not([src=""]), iframe').each(function() { 29706 $(this).one('load error', function() { 29707 if (++count === total) { callback(); } 29708 }).each(function() { 29709 if (this.complete) { $(this).load(); } 29710 }); 29711 }); 29712 }; 29713 29714 /** 29715 * Start the slider 29716 */ 29717 var start = function() { 29718 // if infinite loop, prepare additional slides 29719 if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) { 29720 var slice = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides, 29721 sliceAppend = slider.children.slice(0, slice).clone(true).addClass('bx-clone'), 29722 slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone'); 29723 if (slider.settings.ariaHidden) { 29724 sliceAppend.attr('aria-hidden', true); 29725 slicePrepend.attr('aria-hidden', true); 29726 } 29727 el.append(sliceAppend).prepend(slicePrepend); 29728 } 29729 // remove the loading DOM element 29730 slider.loader.remove(); 29731 // set the left / top position of "el" 29732 setSlidePosition(); 29733 // if "vertical" mode, always use adaptiveHeight to prevent odd behavior 29734 if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; } 29735 // set the viewport height 29736 slider.viewport.height(getViewportHeight()); 29737 // make sure everything is positioned just right (same as a window resize) 29738 el.redrawSlider(); 29739 // onSliderLoad callback 29740 slider.settings.onSliderLoad.call(el, slider.active.index); 29741 // slider has been fully initialized 29742 slider.initialized = true; 29743 // bind the resize call to the window 29744 if (slider.settings.responsive) { $(window).bind('resize', resizeWindow); } 29745 // if auto is true and has more than 1 page, start the show 29746 if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); } 29747 // if ticker is true, start the ticker 29748 if (slider.settings.ticker) { initTicker(); } 29749 // if pager is requested, make the appropriate pager link active 29750 if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); } 29751 // check for any updates to the controls (like hideControlOnEnd updates) 29752 if (slider.settings.controls) { updateDirectionControls(); } 29753 // if touchEnabled is true, setup the touch events 29754 if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); } 29755 // if keyboardEnabled is true, setup the keyboard events 29756 if (slider.settings.keyboardEnabled && !slider.settings.ticker) { 29757 $(document).keydown(keyPress); 29758 } 29759 }; 29760 29761 /** 29762 * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value 29763 */ 29764 var getViewportHeight = function() { 29765 var height = 0; 29766 // first determine which children (slides) should be used in our height calculation 29767 var children = $(); 29768 // if mode is not "vertical" and adaptiveHeight is false, include all children 29769 if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) { 29770 children = slider.children; 29771 } else { 29772 // if not carousel, return the single active child 29773 if (!slider.carousel) { 29774 children = slider.children.eq(slider.active.index); 29775 // if carousel, return a slice of children 29776 } else { 29777 // get the individual slide index 29778 var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy(); 29779 // add the current slide to the children 29780 children = slider.children.eq(currentIndex); 29781 // cycle through the remaining "showing" slides 29782 for (i = 1; i <= slider.settings.maxSlides - 1; i++) { 29783 // if looped back to the start 29784 if (currentIndex + i >= slider.children.length) { 29785 children = children.add(slider.children.eq(i - 1)); 29786 } else { 29787 children = children.add(slider.children.eq(currentIndex + i)); 29788 } 29789 } 29790 } 29791 } 29792 // if "vertical" mode, calculate the sum of the heights of the children 29793 if (slider.settings.mode === 'vertical') { 29794 children.each(function(index) { 29795 height += $(this).outerHeight(); 29796 }); 29797 // add user-supplied margins 29798 if (slider.settings.slideMargin > 0) { 29799 height += slider.settings.slideMargin * (slider.settings.minSlides - 1); 29800 } 29801 // if not "vertical" mode, calculate the max height of the children 29802 } else { 29803 height = Math.max.apply(Math, children.map(function() { 29804 return $(this).outerHeight(false); 29805 }).get()); 29806 } 29807 29808 if (slider.viewport.css('box-sizing') === 'border-box') { 29809 height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) + 29810 parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width')); 29811 } else if (slider.viewport.css('box-sizing') === 'padding-box') { 29812 height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')); 29813 } 29814 29815 return height; 29816 }; 29817 29818 /** 29819 * Returns the calculated width to be used for the outer wrapper / viewport 29820 */ 29821 var getViewportMaxWidth = function() { 29822 var width = '100%'; 29823 if (slider.settings.slideWidth > 0) { 29824 if (slider.settings.mode === 'horizontal') { 29825 width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 29826 } else { 29827 width = slider.settings.slideWidth; 29828 } 29829 } 29830 return width; 29831 }; 29832 29833 /** 29834 * Returns the calculated width to be applied to each slide 29835 */ 29836 var getSlideWidth = function() { 29837 var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width 29838 wrapWidth = slider.viewport.width(); // get the current viewport width 29839 // if slide width was not supplied, or is larger than the viewport use the viewport width 29840 if (slider.settings.slideWidth === 0 || 29841 (slider.settings.slideWidth > wrapWidth && !slider.carousel) || 29842 slider.settings.mode === 'vertical') { 29843 newElWidth = wrapWidth; 29844 // if carousel, use the thresholds to determine the width 29845 } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') { 29846 if (wrapWidth > slider.maxThreshold) { 29847 return newElWidth; 29848 } else if (wrapWidth < slider.minThreshold) { 29849 newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides; 29850 } else if (slider.settings.shrinkItems) { 29851 newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin); 29852 } 29853 } 29854 return newElWidth; 29855 }; 29856 29857 /** 29858 * Returns the number of slides currently visible in the viewport (includes partially visible slides) 29859 */ 29860 var getNumberSlidesShowing = function() { 29861 var slidesShowing = 1, 29862 childWidth = null; 29863 if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) { 29864 // if viewport is smaller than minThreshold, return minSlides 29865 if (slider.viewport.width() < slider.minThreshold) { 29866 slidesShowing = slider.settings.minSlides; 29867 // if viewport is larger than maxThreshold, return maxSlides 29868 } else if (slider.viewport.width() > slider.maxThreshold) { 29869 slidesShowing = slider.settings.maxSlides; 29870 // if viewport is between min / max thresholds, divide viewport width by first child width 29871 } else { 29872 childWidth = slider.children.first().width() + slider.settings.slideMargin; 29873 slidesShowing = Math.floor((slider.viewport.width() + 29874 slider.settings.slideMargin) / childWidth); 29875 } 29876 // if "vertical" mode, slides showing will always be minSlides 29877 } else if (slider.settings.mode === 'vertical') { 29878 slidesShowing = slider.settings.minSlides; 29879 } 29880 return slidesShowing; 29881 }; 29882 29883 /** 29884 * Returns the number of pages (one full viewport of slides is one "page") 29885 */ 29886 var getPagerQty = function() { 29887 var pagerQty = 0, 29888 breakPoint = 0, 29889 counter = 0; 29890 // if moveSlides is specified by the user 29891 if (slider.settings.moveSlides > 0) { 29892 if (slider.settings.infiniteLoop) { 29893 pagerQty = Math.ceil(slider.children.length / getMoveBy()); 29894 } else { 29895 // when breakpoint goes above children length, counter is the number of pages 29896 while (breakPoint < slider.children.length) { 29897 ++pagerQty; 29898 breakPoint = counter + getNumberSlidesShowing(); 29899 counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing(); 29900 } 29901 } 29902 // if moveSlides is 0 (auto) divide children length by sides showing, then round up 29903 } else { 29904 pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing()); 29905 } 29906 return pagerQty; 29907 }; 29908 29909 /** 29910 * Returns the number of individual slides by which to shift the slider 29911 */ 29912 var getMoveBy = function() { 29913 // if moveSlides was set by the user and moveSlides is less than number of slides showing 29914 if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) { 29915 return slider.settings.moveSlides; 29916 } 29917 // if moveSlides is 0 (auto) 29918 return getNumberSlidesShowing(); 29919 }; 29920 29921 /** 29922 * Sets the slider's (el) left or top position 29923 */ 29924 var setSlidePosition = function() { 29925 var position, lastChild, lastShowingIndex; 29926 // if last slide, not infinite loop, and number of children is larger than specified maxSlides 29927 if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) { 29928 if (slider.settings.mode === 'horizontal') { 29929 // get the last child's position 29930 lastChild = slider.children.last(); 29931 position = lastChild.position(); 29932 // set the left position 29933 setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0); 29934 } else if (slider.settings.mode === 'vertical') { 29935 // get the last showing index's position 29936 lastShowingIndex = slider.children.length - slider.settings.minSlides; 29937 position = slider.children.eq(lastShowingIndex).position(); 29938 // set the top position 29939 setPositionProperty(-position.top, 'reset', 0); 29940 } 29941 // if not last slide 29942 } else { 29943 // get the position of the first showing slide 29944 position = slider.children.eq(slider.active.index * getMoveBy()).position(); 29945 // check for last slide 29946 if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; } 29947 // set the respective position 29948 if (position !== undefined) { 29949 if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); } 29950 else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); } 29951 } 29952 } 29953 }; 29954 29955 /** 29956 * Sets the el's animating property position (which in turn will sometimes animate el). 29957 * If using CSS, sets the transform property. If not using CSS, sets the top / left property. 29958 * 29959 * @param value (int) 29960 * - the animating property's value 29961 * 29962 * @param type (string) 'slide', 'reset', 'ticker' 29963 * - the type of instance for which the function is being 29964 * 29965 * @param duration (int) 29966 * - the amount of time (in ms) the transition should occupy 29967 * 29968 * @param params (array) optional 29969 * - an optional parameter containing any variables that need to be passed in 29970 */ 29971 var setPositionProperty = function(value, type, duration, params) { 29972 var animateObj, propValue; 29973 // use CSS transform 29974 if (slider.usingCSS) { 29975 // determine the translate3d value 29976 propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)'; 29977 // add the CSS transition-duration 29978 el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's'); 29979 if (type === 'slide') { 29980 // set the property value 29981 el.css(slider.animProp, propValue); 29982 if (duration !== 0) { 29983 // bind a callback method - executes when CSS transition completes 29984 el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) { 29985 //make sure it's the correct one 29986 if (!$(e.target).is(el)) { return; } 29987 // unbind the callback 29988 el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 29989 updateAfterSlideTransition(); 29990 }); 29991 } else { //duration = 0 29992 updateAfterSlideTransition(); 29993 } 29994 } else if (type === 'reset') { 29995 el.css(slider.animProp, propValue); 29996 } else if (type === 'ticker') { 29997 // make the transition use 'linear' 29998 el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear'); 29999 el.css(slider.animProp, propValue); 30000 if (duration !== 0) { 30001 el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) { 30002 //make sure it's the correct one 30003 if (!$(e.target).is(el)) { return; } 30004 // unbind the callback 30005 el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 30006 // reset the position 30007 setPositionProperty(params.resetValue, 'reset', 0); 30008 // start the loop again 30009 tickerLoop(); 30010 }); 30011 } else { //duration = 0 30012 setPositionProperty(params.resetValue, 'reset', 0); 30013 tickerLoop(); 30014 } 30015 } 30016 // use JS animate 30017 } else { 30018 animateObj = {}; 30019 animateObj[slider.animProp] = value; 30020 if (type === 'slide') { 30021 el.animate(animateObj, duration, slider.settings.easing, function() { 30022 updateAfterSlideTransition(); 30023 }); 30024 } else if (type === 'reset') { 30025 el.css(slider.animProp, value); 30026 } else if (type === 'ticker') { 30027 el.animate(animateObj, duration, 'linear', function() { 30028 setPositionProperty(params.resetValue, 'reset', 0); 30029 // run the recursive loop after animation 30030 tickerLoop(); 30031 }); 30032 } 30033 } 30034 }; 30035 30036 /** 30037 * Populates the pager with proper amount of pages 30038 */ 30039 var populatePager = function() { 30040 var pagerHtml = '', 30041 linkContent = '', 30042 pagerQty = getPagerQty(); 30043 // loop through each pager item 30044 for (var i = 0; i < pagerQty; i++) { 30045 linkContent = ''; 30046 // if a buildPager function is supplied, use it to get pager link value, else use index + 1 30047 if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) { 30048 linkContent = slider.settings.buildPager(i); 30049 slider.pagerEl.addClass('bx-custom-pager'); 30050 } else { 30051 linkContent = i + 1; 30052 slider.pagerEl.addClass('bx-default-pager'); 30053 } 30054 // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1; 30055 // add the markup to the string 30056 pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>'; 30057 } 30058 // populate the pager element with pager links 30059 slider.pagerEl.html(pagerHtml); 30060 }; 30061 30062 /** 30063 * Appends the pager to the controls element 30064 */ 30065 var appendPager = function() { 30066 if (!slider.settings.pagerCustom) { 30067 // create the pager DOM element 30068 slider.pagerEl = $('<div class="bx-pager" />'); 30069 // if a pager selector was supplied, populate it with the pager 30070 if (slider.settings.pagerSelector) { 30071 $(slider.settings.pagerSelector).html(slider.pagerEl); 30072 // if no pager selector was supplied, add it after the wrapper 30073 } else { 30074 slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl); 30075 } 30076 // populate the pager 30077 populatePager(); 30078 } else { 30079 slider.pagerEl = $(slider.settings.pagerCustom); 30080 } 30081 // assign the pager click binding 30082 slider.pagerEl.on('click touchend', 'a', clickPagerBind); 30083 }; 30084 30085 /** 30086 * Appends prev / next controls to the controls element 30087 */ 30088 var appendControls = function() { 30089 slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>'); 30090 slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>'); 30091 // bind click actions to the controls 30092 slider.controls.next.bind('click touchend', clickNextBind); 30093 slider.controls.prev.bind('click touchend', clickPrevBind); 30094 // if nextSelector was supplied, populate it 30095 if (slider.settings.nextSelector) { 30096 $(slider.settings.nextSelector).append(slider.controls.next); 30097 } 30098 // if prevSelector was supplied, populate it 30099 if (slider.settings.prevSelector) { 30100 $(slider.settings.prevSelector).append(slider.controls.prev); 30101 } 30102 // if no custom selectors were supplied 30103 if (!slider.settings.nextSelector && !slider.settings.prevSelector) { 30104 // add the controls to the DOM 30105 slider.controls.directionEl = $('<div class="bx-controls-direction" />'); 30106 // add the control elements to the directionEl 30107 slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next); 30108 // slider.viewport.append(slider.controls.directionEl); 30109 slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl); 30110 } 30111 }; 30112 30113 /** 30114 * Appends start / stop auto controls to the controls element 30115 */ 30116 var appendControlsAuto = function() { 30117 slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>'); 30118 slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>'); 30119 // add the controls to the DOM 30120 slider.controls.autoEl = $('<div class="bx-controls-auto" />'); 30121 // bind
vendor: 7,154 bytes, lines 30121-30319
30121 click actions to the controls 30122 slider.controls.autoEl.on('click', '.bx-start', clickStartBind); 30123 slider.controls.autoEl.on('click', '.bx-stop', clickStopBind); 30124 // if autoControlsCombine, insert only the "start" control 30125 if (slider.settings.autoControlsCombine) { 30126 slider.controls.autoEl.append(slider.controls.start); 30127 // if autoControlsCombine is false, insert both controls 30128 } else { 30129 slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop); 30130 } 30131 // if auto controls selector was supplied, populate it with the controls 30132 if (slider.settings.autoControlsSelector) { 30133 $(slider.settings.autoControlsSelector).html(slider.controls.autoEl); 30134 // if auto controls selector was not supplied, add it after the wrapper 30135 } else { 30136 slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl); 30137 } 30138 // update the auto controls 30139 updateAutoControls(slider.settings.autoStart ? 'stop' : 'start'); 30140 }; 30141 30142 /** 30143 * Appends image captions to the DOM 30144 */ 30145 var appendCaptions = function() { 30146 // cycle through each child 30147 slider.children.each(function(index) { 30148 // get the image title attribute 30149 var title = $(this).find('img:first').attr('title'); 30150 // append the caption 30151 if (title !== undefined && ('' + title).length) { 30152 $(this).append('<div class="bx-caption"><span>' + title + '</span></div>'); 30153 } 30154 }); 30155 }; 30156 30157 /** 30158 * Click next binding 30159 * 30160 * @param e (event) 30161 * - DOM event object 30162 */ 30163 var clickNextBind = function(e) { 30164 e.preventDefault(); 30165 if (slider.controls.el.hasClass('disabled')) { return; } 30166 // if auto show is running, stop it 30167 if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } 30168 el.goToNextSlide(); 30169 }; 30170 30171 /** 30172 * Click prev binding 30173 * 30174 * @param e (event) 30175 * - DOM event object 30176 */ 30177 var clickPrevBind = function(e) { 30178 e.preventDefault(); 30179 if (slider.controls.el.hasClass('disabled')) { return; } 30180 // if auto show is running, stop it 30181 if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } 30182 el.goToPrevSlide(); 30183 }; 30184 30185 /** 30186 * Click start binding 30187 * 30188 * @param e (event) 30189 * - DOM event object 30190 */ 30191 var clickStartBind = function(e) { 30192 el.startAuto(); 30193 e.preventDefault(); 30194 }; 30195 30196 /** 30197 * Click stop binding 30198 * 30199 * @param e (event) 30200 * - DOM event object 30201 */ 30202 var clickStopBind = function(e) { 30203 el.stopAuto(); 30204 e.preventDefault(); 30205 }; 30206 30207 /** 30208 * Click pager binding 30209 * 30210 * @param e (event) 30211 * - DOM event object 30212 */ 30213 var clickPagerBind = function(e) { 30214 var pagerLink, pagerIndex; 30215 e.preventDefault(); 30216 if (slider.controls.el.hasClass('disabled')) { 30217 return; 30218 } 30219 // if auto show is running, stop it 30220 if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } 30221 pagerLink = $(e.currentTarget); 30222 if (pagerLink.attr('data-slide-index') !== undefined) { 30223 pagerIndex = parseInt(pagerLink.attr('data-slide-index')); 30224 // if clicked pager link is not active, continue with the goToSlide call 30225 if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); } 30226 } 30227 }; 30228 30229 /** 30230 * Updates the pager links with an active class 30231 * 30232 * @param slideIndex (int) 30233 * - index of slide to make active 30234 */ 30235 var updatePagerActive = function(slideIndex) { 30236 // if "short" pager type 30237 var len = slider.children.length; // nb of children 30238 if (slider.settings.pagerType === 'short') { 30239 if (slider.settings.maxSlides > 1) { 30240 len = Math.ceil(slider.children.length / slider.settings.maxSlides); 30241 } 30242 slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len); 30243 return; 30244 } 30245 // remove all pager active classes 30246 slider.pagerEl.find('a').removeClass('active'); 30247 // apply the active class for all pagers 30248 slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); }); 30249 }; 30250 30251 /** 30252 * Performs needed actions after a slide transition 30253 */ 30254 var updateAfterSlideTransition = function() { 30255 // if infinite loop is true 30256 if (slider.settings.infiniteLoop) { 30257 var position = ''; 30258 // first slide 30259 if (slider.active.index === 0) { 30260 // set the new position 30261 position = slider.children.eq(0).position(); 30262 // carousel, last slide 30263 } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) { 30264 position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position(); 30265 // last slide 30266 } else if (slider.active.index === slider.children.length - 1) { 30267 position = slider.children.eq(slider.children.length - 1).position(); 30268 } 30269 if (position) { 30270 if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); } 30271 else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); } 30272 } 30273 } 30274 // declare that the transition is complete 30275 slider.working = false; 30276 // onSlideAfter callback 30277 slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 30278 }; 30279 30280 /** 30281 * Updates the auto controls state (either active, or combined switch) 30282 * 30283 * @param state (string) "start", "stop" 30284 * - the new state of the auto show 30285 */ 30286 var updateAutoControls = function(state) { 30287 // if autoControlsCombine is true, replace the current control with the new state 30288 if (slider.settings.autoControlsCombine) { 30289 slider.controls.autoEl.html(slider.controls[state]); 30290 // if autoControlsCombine is false, apply the "active" class to the appropriate control 30291 } else { 30292 slider.controls.autoEl.find('a').removeClass('active'); 30293 slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active'); 30294 } 30295 }; 30296 30297 /** 30298 * Updates the direction controls (checks if either should be hidden) 30299 */ 30300 var updateDirectionControls = function() { 30301 if (getPagerQty() === 1) { 30302 slider.controls.prev.addClass('disabled'); 30303 slider.controls.next.addClass('disabled'); 30304 } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) { 30305 // if first slide 30306 if (slider.active.index === 0) { 30307 slider.controls.prev.addClass('disabled'); 30308 slider.controls.next.removeClass('disabled'); 30309 // if last slide 30310 } else if (slider.active.index === getPagerQty() - 1) { 30311 slider.controls.next.addClass('disabled'); 30312 slider.controls.prev.removeClass('disabled'); 30313 // if any slide in the middle 30314 } else { 30315 slider.controls.prev.removeClass('disabled'); 30316 slider.controls.next.removeClass('disabled'); 30317 } 30318 } 30319 };
30320 30321 /** 30322 * Initializes the auto process 30323 */ 30324 var initAuto = function() { 30325 // if autoDelay was supplied, launch the auto show using a setTimeout() call 30326 if (slider.settings.autoDelay > 0) { 30327 var timeout = setTimeout(el.startAuto, slider.settings.autoDelay); 30328 // if autoDelay was not supplied, start the auto show normally 30329 } else { 30330 el.startAuto(); 30331 30332 //add focus and blur events to ensure its running if timeout gets paused 30333 $(window).focus(function() { 30334 el.startAuto(); 30335 }).blur(function() { 30336 el.stopAuto(); 30337 }
vendor: 6,234 bytes, lines 30337-30497
30337); 30338 } 30339 // if autoHover is requested 30340 if (slider.settings.autoHover) { 30341 // on el hover 30342 el.hover(function() { 30343 // if the auto show is currently playing (has an active interval) 30344 if (slider.interval) { 30345 // stop the auto show and pass true argument which will prevent control update 30346 el.stopAuto(true); 30347 // create a new autoPaused value which will be used by the relative "mouseout" event 30348 slider.autoPaused = true; 30349 } 30350 }, function() { 30351 // if the autoPaused value was created be the prior "mouseover" event 30352 if (slider.autoPaused) { 30353 // start the auto show and pass true argument which will prevent control update 30354 el.startAuto(true); 30355 // reset the autoPaused value 30356 slider.autoPaused = null; 30357 } 30358 }); 30359 } 30360 }; 30361 30362 /** 30363 * Initializes the ticker process 30364 */ 30365 var initTicker = function() { 30366 var startPosition = 0, 30367 position, transform, value, idx, ratio, property, newSpeed, totalDimens; 30368 // if autoDirection is "next", append a clone of the entire slider 30369 if (slider.settings.autoDirection === 'next') { 30370 el.append(slider.children.clone().addClass('bx-clone')); 30371 // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position 30372 } else { 30373 el.prepend(slider.children.clone().addClass('bx-clone')); 30374 position = slider.children.first().position(); 30375 startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top; 30376 } 30377 setPositionProperty(startPosition, 'reset', 0); 30378 // do not allow controls in ticker mode 30379 slider.settings.pager = false; 30380 slider.settings.controls = false; 30381 slider.settings.autoControls = false; 30382 // if autoHover is requested 30383 if (slider.settings.tickerHover) { 30384 if (slider.usingCSS) { 30385 idx = slider.settings.mode === 'horizontal' ? 4 : 5; 30386 slider.viewport.hover(function() { 30387 transform = el.css('-' + slider.cssPrefix + '-transform'); 30388 value = parseFloat(transform.split(',')[idx]); 30389 setPositionProperty(value, 'reset', 0); 30390 }, function() { 30391 totalDimens = 0; 30392 slider.children.each(function(index) { 30393 totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); 30394 }); 30395 // calculate the speed ratio (used to determine the new speed to finish the paused animation) 30396 ratio = slider.settings.speed / totalDimens; 30397 // determine which property to use 30398 property = slider.settings.mode === 'horizontal' ? 'left' : 'top'; 30399 // calculate the new speed 30400 newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value)))); 30401 tickerLoop(newSpeed); 30402 }); 30403 } else { 30404 // on el hover 30405 slider.viewport.hover(function() { 30406 el.stop(); 30407 }, function() { 30408 // calculate the total width of children (used to calculate the speed ratio) 30409 totalDimens = 0; 30410 slider.children.each(function(index) { 30411 totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); 30412 }); 30413 // calculate the speed ratio (used to determine the new speed to finish the paused animation) 30414 ratio = slider.settings.speed / totalDimens; 30415 // determine which property to use 30416 property = slider.settings.mode === 'horizontal' ? 'left' : 'top'; 30417 // calculate the new speed 30418 newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property))))); 30419 tickerLoop(newSpeed); 30420 }); 30421 } 30422 } 30423 // start the ticker loop 30424 tickerLoop(); 30425 }; 30426 30427 /** 30428 * Runs a continuous loop, news ticker-style 30429 */ 30430 var tickerLoop = function(resumeSpeed) { 30431 var speed = resumeSpeed ? resumeSpeed : slider.settings.speed, 30432 position = {left: 0, top: 0}, 30433 reset = {left: 0, top: 0}, 30434 animateProperty, resetValue, params; 30435 30436 // if "next" animate left position to last child, then reset left to 0 30437 if (slider.settings.autoDirection === 'next') { 30438 position = el.find('.bx-clone').first().position(); 30439 // if "prev" animate left position to 0, then reset left to first non-clone child 30440 } else { 30441 reset = slider.children.first().position(); 30442 } 30443 animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top; 30444 resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top; 30445 params = {resetValue: resetValue}; 30446 setPositionProperty(animateProperty, 'ticker', speed, params); 30447 }; 30448 30449 /** 30450 * Check if el is on screen 30451 */ 30452 var isOnScreen = function(el) { 30453 var win = $(window), 30454 viewport = { 30455 top: win.scrollTop(), 30456 left: win.scrollLeft() 30457 }, 30458 bounds = el.offset(); 30459 30460 viewport.right = viewport.left + win.width(); 30461 viewport.bottom = viewport.top + win.height(); 30462 bounds.right = bounds.left + el.outerWidth(); 30463 bounds.bottom = bounds.top + el.outerHeight(); 30464 30465 return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); 30466 }; 30467 30468 /** 30469 * Initializes keyboard events 30470 */ 30471 var keyPress = function(e) { 30472 var activeElementTag = document.activeElement.tagName.toLowerCase(), 30473 tagFilters = 'input|textarea', 30474 p = new RegExp(activeElementTag,['i']), 30475 result = p.exec(tagFilters); 30476 30477 if (result == null && isOnScreen(el)) { 30478 if (e.keyCode === 39) { 30479 clickNextBind(e); 30480 return false; 30481 } else if (e.keyCode === 37) { 30482 clickPrevBind(e); 30483 return false; 30484 } 30485 } 30486 }; 30487 30488 /** 30489 * Initializes touch events 30490 */ 30491 var initTouch = function() { 30492 // initialize object to contain all touch values 30493 slider.touch = { 30494 start: {x: 0, y: 0}, 30495 end: {x: 0, y: 0} 30496 }; 30497 slider.viewport.
vendor: 6,558 bytes, lines 30497-30658
30497bind('touchstart MSPointerDown pointerdown', onTouchStart); 30498 30499 //for browsers that have implemented pointer events and fire a click after 30500 //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not 30501 slider.viewport.on('click', '.bxslider a', function(e) { 30502 if (slider.viewport.hasClass('click-disabled')) { 30503 e.preventDefault(); 30504 slider.viewport.removeClass('click-disabled'); 30505 } 30506 }); 30507 }; 30508 30509 /** 30510 * Event handler for "touchstart" 30511 * 30512 * @param e (event) 30513 * - DOM event object 30514 */ 30515 var onTouchStart = function(e) { 30516 //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls 30517 slider.controls.el.addClass('disabled'); 30518 30519 if (slider.working) { 30520 e.preventDefault(); 30521 slider.controls.el.removeClass('disabled'); 30522 } else { 30523 // record the original position when touch starts 30524 slider.touch.originalPos = el.position(); 30525 var orig = e.originalEvent, 30526 touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig]; 30527 // record the starting touch x, y coordinates 30528 slider.touch.start.x = touchPoints[0].pageX; 30529 slider.touch.start.y = touchPoints[0].pageY; 30530 30531 if (slider.viewport.get(0).setPointerCapture) { 30532 slider.pointerId = orig.pointerId; 30533 slider.viewport.get(0).setPointerCapture(slider.pointerId); 30534 } 30535 // bind a "touchmove" event to the viewport 30536 slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove); 30537 // bind a "touchend" event to the viewport 30538 slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd); 30539 slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel); 30540 } 30541 }; 30542 30543 /** 30544 * Cancel Pointer for Windows Phone 30545 * 30546 * @param e (event) 30547 * - DOM event object 30548 */ 30549 var onPointerCancel = function(e) { 30550 /* onPointerCancel handler is needed to deal with situations when a touchend 30551 doesn't fire after a touchstart (this happens on windows phones only) */ 30552 setPositionProperty(slider.touch.originalPos.left, 'reset', 0); 30553 30554 //remove handlers 30555 slider.controls.el.removeClass('disabled'); 30556 slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel); 30557 slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove); 30558 slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd); 30559 if (slider.viewport.get(0).releasePointerCapture) { 30560 slider.viewport.get(0).releasePointerCapture(slider.pointerId); 30561 } 30562 }; 30563 30564 /** 30565 * Event handler for "touchmove" 30566 * 30567 * @param e (event) 30568 * - DOM event object 30569 */ 30570 var onTouchMove = function(e) { 30571 var orig = e.originalEvent, 30572 touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig], 30573 // if scrolling on y axis, do not prevent default 30574 xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x), 30575 yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y), 30576 value = 0, 30577 change = 0; 30578 30579 // x axis swipe 30580 if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) { 30581 e.preventDefault(); 30582 // y axis swipe 30583 } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) { 30584 e.preventDefault(); 30585 } 30586 if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) { 30587 // if horizontal, drag along x axis 30588 if (slider.settings.mode === 'horizontal') { 30589 change = touchPoints[0].pageX - slider.touch.start.x; 30590 value = slider.touch.originalPos.left + change; 30591 // if vertical, drag along y axis 30592 } else { 30593 change = touchPoints[0].pageY - slider.touch.start.y; 30594 value = slider.touch.originalPos.top + change; 30595 } 30596 setPositionProperty(value, 'reset', 0); 30597 } 30598 }; 30599 30600 /** 30601 * Event handler for "touchend" 30602 * 30603 * @param e (event) 30604 * - DOM event object 30605 */ 30606 var onTouchEnd = function(e) { 30607 slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove); 30608 //enable slider controls as soon as user stops interacing with slides 30609 slider.controls.el.removeClass('disabled'); 30610 var orig = e.originalEvent, 30611 touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig], 30612 value = 0, 30613 distance = 0; 30614 // record end x, y positions 30615 slider.touch.end.x = touchPoints[0].pageX; 30616 slider.touch.end.y = touchPoints[0].pageY; 30617 // if fade mode, check if absolute x distance clears the threshold 30618 if (slider.settings.mode === 'fade') { 30619 distance = Math.abs(slider.touch.start.x - slider.touch.end.x); 30620 if (distance >= slider.settings.swipeThreshold) { 30621 if (slider.touch.start.x > slider.touch.end.x) { 30622 el.goToNextSlide(); 30623 } else { 30624 el.goToPrevSlide(); 30625 } 30626 el.stopAuto(); 30627 } 30628 // not fade mode 30629 } else { 30630 // calculate distance and el's animate property 30631 if (slider.settings.mode === 'horizontal') { 30632 distance = slider.touch.end.x - slider.touch.start.x; 30633 value = slider.touch.originalPos.left; 30634 } else { 30635 distance = slider.touch.end.y - slider.touch.start.y; 30636 value = slider.touch.originalPos.top; 30637 } 30638 // if not infinite loop and first / last slide, do not attempt a slide transition 30639 if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) { 30640 setPositionProperty(value, 'reset', 200); 30641 } else { 30642 // check if distance clears threshold 30643 if (Math.abs(distance) >= slider.settings.swipeThreshold) { 30644 if (distance < 0) { 30645 el.goToNextSlide(); 30646 } else { 30647 el.goToPrevSlide(); 30648 } 30649 el.stopAuto(); 30650 } else { 30651 // el.animate(property, 200); 30652 setPositionProperty(value, 'reset', 200); 30653 } 30654 } 30655 } 30656 slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd); 30657 if (slider.viewport.get(0).releasePointerCapture) { 30658 slider.viewport.get(0).releasePointerCapture(slider.pointerId
vendor: 8,775 bytes, lines 30658-30853
30658); 30659 } 30660 }; 30661 30662 /** 30663 * Window resize event callback 30664 */ 30665 var resizeWindow = function(e) { 30666 // don't do anything if slider isn't initialized. 30667 if (!slider.initialized) { return; } 30668 // Delay if slider working. 30669 if (slider.working) { 30670 window.setTimeout(resizeWindow, 10); 30671 } else { 30672 // get the new window dimens (again, thank you IE) 30673 var windowWidthNew = $(window).width(), 30674 windowHeightNew = $(window).height(); 30675 // make sure that it is a true window resize 30676 // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements 30677 // are resized. Can you just die already?* 30678 if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) { 30679 // set the new window dimens 30680 windowWidth = windowWidthNew; 30681 windowHeight = windowHeightNew; 30682 // update all dynamic elements 30683 el.redrawSlider(); 30684 // Call user resize handler 30685 slider.settings.onSliderResize.call(el, slider.active.index); 30686 } 30687 } 30688 }; 30689 30690 /** 30691 * Adds an aria-hidden=true attribute to each element 30692 * 30693 * @param startVisibleIndex (int) 30694 * - the first visible element's index 30695 */ 30696 var applyAriaHiddenAttributes = function(startVisibleIndex) { 30697 var numberOfSlidesShowing = getNumberSlidesShowing(); 30698 // only apply attributes if the setting is enabled and not in ticker mode 30699 if (slider.settings.ariaHidden && !slider.settings.ticker) { 30700 // add aria-hidden=true to all elements 30701 slider.children.attr('aria-hidden', 'true'); 30702 // get the visible elements and change to aria-hidden=false 30703 slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false'); 30704 } 30705 }; 30706 30707 /** 30708 * Returns index according to present page range 30709 * 30710 * @param slideOndex (int) 30711 * - the desired slide index 30712 */ 30713 var setSlideIndex = function(slideIndex) { 30714 if (slideIndex < 0) { 30715 if (slider.settings.infiniteLoop) { 30716 return getPagerQty() - 1; 30717 }else { 30718 //we don't go to undefined slides 30719 return slider.active.index; 30720 } 30721 // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop) 30722 } else if (slideIndex >= getPagerQty()) { 30723 if (slider.settings.infiniteLoop) { 30724 return 0; 30725 } else { 30726 //we don't move to undefined pages 30727 return slider.active.index; 30728 } 30729 // set active index to requested slide 30730 } else { 30731 return slideIndex; 30732 } 30733 }; 30734 30735 /** 30736 * =================================================================================== 30737 * = PUBLIC FUNCTIONS 30738 * =================================================================================== 30739 */ 30740 30741 /** 30742 * Performs slide transition to the specified slide 30743 * 30744 * @param slideIndex (int) 30745 * - the destination slide's index (zero-based) 30746 * 30747 * @param direction (string) 30748 * - INTERNAL USE ONLY - the direction of travel ("prev" / "next") 30749 */ 30750 el.goToSlide = function(slideIndex, direction) { 30751 // onSlideBefore, onSlideNext, onSlidePrev callbacks 30752 // Allow transition canceling based on returned value 30753 var performTransition = true, 30754 moveBy = 0, 30755 position = {left: 0, top: 0}, 30756 lastChild = null, 30757 lastShowingIndex, eq, value, requestEl; 30758 // store the old index 30759 slider.oldIndex = slider.active.index; 30760 //set new index 30761 slider.active.index = setSlideIndex(slideIndex); 30762 30763 // if plugin is currently in motion, ignore request 30764 if (slider.working || slider.active.index === slider.oldIndex) { return; } 30765 // declare that plugin is in motion 30766 slider.working = true; 30767 30768 performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 30769 30770 // If transitions canceled, reset and return 30771 if (typeof (performTransition) !== 'undefined' && !performTransition) { 30772 slider.active.index = slider.oldIndex; // restore old index 30773 slider.working = false; // is not in motion 30774 return; 30775 } 30776 30777 if (direction === 'next') { 30778 // Prevent canceling in future functions or lack there-of from negating previous commands to cancel 30779 if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) { 30780 performTransition = false; 30781 } 30782 } else if (direction === 'prev') { 30783 // Prevent canceling in future functions or lack there-of from negating previous commands to cancel 30784 if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) { 30785 performTransition = false; 30786 } 30787 } 30788 30789 // check if last slide 30790 slider.active.last = slider.active.index >= getPagerQty() - 1; 30791 // update the pager with active class 30792 if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); } 30793 // // check for direction control update 30794 if (slider.settings.controls) { updateDirectionControls(); } 30795 // if slider is set to mode: "fade" 30796 if (slider.settings.mode === 'fade') { 30797 // if adaptiveHeight is true and next height is different from current height, animate to the new height 30798 if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) { 30799 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 30800 } 30801 // fade out the visible child and reset its z-index value 30802 slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0}); 30803 // fade in the newly requested slide 30804 slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() { 30805 $(this).css('zIndex', slider.settings.slideZIndex); 30806 updateAfterSlideTransition(); 30807 }); 30808 // slider mode is not "fade" 30809 } else { 30810 // if adaptiveHeight is true and next height is different from current height, animate to the new height 30811 if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) { 30812 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 30813 } 30814 // if carousel and not infinite loop 30815 if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) { 30816 if (slider.settings.mode === 'horizontal') { 30817 // get the last child position 30818 lastChild = slider.children.eq(slider.children.length - 1); 30819 position = lastChild.position(); 30820 // calculate the position of the last slide 30821 moveBy = slider.viewport.width() - lastChild.outerWidth(); 30822 } else { 30823 // get last showing index position 30824 lastShowingIndex = slider.children.length - slider.settings.minSlides; 30825 position = slider.children.eq(lastShowingIndex).position(); 30826 } 30827 // horizontal carousel, going previous while on first slide (infiniteLoop mode) 30828 } else if (slider.carousel && slider.active.last && direction === 'prev') { 30829 // get the last child position 30830 eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides); 30831 lastChild = el.children('.bx-clone').eq(eq); 30832 position = lastChild.position(); 30833 // if infinite loop and "Next" is clicked on the last slide 30834 } else if (direction === 'next' && slider.active.index === 0) { 30835 // get the last clone position 30836 position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position(); 30837 slider.active.last = false; 30838 // normal non-zero requests 30839 } else if (slideIndex >= 0) { 30840 //parseInt is applied to allow floats for slides/page 30841 requestEl = slideIndex * parseInt(getMoveBy()); 30842 position = slider.children.eq(requestEl).position(); 30843 } 30844 30845 /* If the position doesn't exist 30846 * (e.g. if you destroy the slider on a next click), 30847 * it doesn't throw an error. 30848 */ 30849 if (typeof (position) !== 'undefined') { 30850 value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top; 30851 // plugin values to be animated 30852 setPositionProperty(value, 'slide', slider.settings.speed); 30853 }
30853 else { 30854 slider.working = false; 30855 } 30856 } 30857 if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); } 30858 }; 30859 30860 /** 30861 * Transitions to the next slide in the show 30862 */ 30863 el.goToNextSlide = function() { 30864 // if infiniteLoop is false and last page is showing, disregard call 30865 if (!slider.settings.infiniteLoop && slider.active.last) { return; } 30866 var pagerIndex = parseInt(slider.active.index) + 1; 30867 el.goToSlide(pagerIndex, 'next'); 30868 }; 30869 30870 /** 30871 * Transitions to the prev slide in the show 30872 */ 30873 el.goToPrevSlide = function() { 30874 // if infiniteLoop is false and last page is showing, disregard call 30875 if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; } 30876 var pagerIndex = parseInt(slider.active.index) - 1; 30877 el.goToSlide(pagerIndex, 'prev'); 30878 }; 30879 30880 /** 30881 * Starts the auto show 30882 * 30883 * @param preventControlUpdate (boolean) 30884 * - if true, auto controls state will not be updated 30885 */ 30886 el.startAuto = function(preventControlUpdate) { 30887 // if an interval already exists, disregard call 30888 if (slider.interval) { return; } 30889 // create an interval 30890 slider.interval = setInterval(function() { 30891 if (slider.settings.autoDirection === 'next') { 30892 el.goToNextSlide(); 30893 } else { 30894 el.goToPrevSlide(); 30895 } 30896 }, slider.settings.pause); 30897 // if auto controls are displayed and preventControlUpdate is not true 30898 if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); } 30899 }; 30900 30901 /** 30902 * Stops the auto show 30903 * 30904 * @param preventControlUpdate (boolean) 30905 * - if true, auto controls state will not be updated 30906 */ 30907 el.stopAuto = function(preventControlUpdate) { 30908 // if no interval exists, disregard call 30909 if (!slider.interval) { return; } 30910 // clear the interval 30911 clearInterval(slider.interval); 30912 slider.interval = null; 30913 // if auto controls are displayed and preventControlUpdate is not true 30914 if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); } 30915 }; 30916 30917 /** 30918 * Returns current slide index (zero-based) 30919 */ 30920 el.getCurrentSlide = function() { 30921 return slider.active.index; 30922 }; 30923 30924 /** 30925 * Returns current slide element 30926 */ 30927 el.getCurrentSlideElement = function() { 30928 return slider.children.eq(slider.active.index); 30929 }; 30930 30931 /** 30932 * Returns a slide element 30933 * @param index (int) 30934 * - The index (zero-based) of the element you want returned. 30935 */ 30936 el.getSlideElement = function(index) { 30937 return slider.children.eq(index); 30938 }; 30939 30940 /** 30941 * Returns number of slides in show 30942 */ 30943 el.getSlideCount = function() { 30944 return slider.children.length; 30945 }; 30946 30947 /** 30948 * Return slider.working variable 30949 */ 30950 el.isWorking = function() { 30951 return slider.working; 30952 }; 30953 30954 /** 30955 * Update all dynamic slider elements 30956 */ 30957 el.redrawSlider = function() { 30958 // resize all children in ratio to new screen size 30959 slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth()); 30960 // adjust the height
vendor: 4,198 bytes, lines 30961-31059
30961 slider.viewport.css('height', getViewportHeight()); 30962 // update the slide position 30963 if (!slider.settings.ticker) { setSlidePosition(); } 30964 // if active.last was true before the screen resize, we want 30965 // to keep it last no matter what screen size we end on 30966 if (slider.active.last) { slider.active.index = getPagerQty() - 1; } 30967 // if the active index (page) no longer exists due to the resize, simply set the index as last 30968 if (slider.active.index >= getPagerQty()) { slider.active.last = true; } 30969 // if a pager is being displayed and a custom pager is not being used, update it 30970 if (slider.settings.pager && !slider.settings.pagerCustom) { 30971 populatePager(); 30972 updatePagerActive(slider.active.index); 30973 } 30974 if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); } 30975 }; 30976 30977 /** 30978 * Destroy the current instance of the slider (revert everything back to original state) 30979 */ 30980 el.destroySlider = function() { 30981 // don't do anything if slider has already been destroyed 30982 if (!slider.initialized) { return; } 30983 slider.initialized = false; 30984 $('.bx-clone', this).remove(); 30985 slider.children.each(function() { 30986 if ($(this).data('origStyle') !== undefined) { 30987 $(this).attr('style', $(this).data('origStyle')); 30988 } else { 30989 $(this).removeAttr('style'); 30990 } 30991 }); 30992 if ($(this).data('origStyle') !== undefined) { 30993 this.attr('style', $(this).data('origStyle')); 30994 } else { 30995 $(this).removeAttr('style'); 30996 } 30997 $(this).unwrap().unwrap(); 30998 if (slider.controls.el) { slider.controls.el.remove(); } 30999 if (slider.controls.next) { slider.controls.next.remove(); } 31000 if (slider.controls.prev) { slider.controls.prev.remove(); } 31001 if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); } 31002 $('.bx-caption', this).remove(); 31003 if (slider.controls.autoEl) { slider.controls.autoEl.remove(); } 31004 clearInterval(slider.interval); 31005 if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); } 31006 if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); } 31007 //remove self reference in data 31008 $(this).removeData('bxSlider'); 31009 }; 31010 31011 /** 31012 * Reload the slider (revert all DOM changes, and re-initialize) 31013 */ 31014 el.reloadSlider = function(settings) { 31015 if (settings !== undefined) { options = settings; } 31016 el.destroySlider(); 31017 init(); 31018 //store reference to self in order to access public functions later 31019 $(el).data('bxSlider', this); 31020 }; 31021 31022 init(); 31023 31024 $(el).data('bxSlider', this); 31025 31026 // returns the current jQuery object 31027 return this; 31028 }; 31029 31030})(jQuery); 31031/* 31032 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 31033 * 31034 * Uses the built in easing capabilities added In jQuery 1.1 31035 * to offer multiple easing options 31036 * 31037 * TERMS OF USE - jQuery Easing 31038 * 31039 * Open source under the BSD License. 31040 * 31041 * Copyright © 2008 George McGinley Smith 31042 * All rights reserved. 31043 * 31044 * Redistribution and use in source and binary forms, with or without modification, 31045 * are permitted provided that the following conditions are met: 31046 * 31047 * Redistributions of source code must retain the above copyright notice, this list of 31048 * conditions and the following disclaimer. 31049 * Redistributions in binary form must reproduce the above copyright notice, this list 31050 * of conditions and the following disclaimer in the documentation and/or other materials 31051 * provided with the distribution. 31052 * 31053 * Neither the name of the author nor the names of contributors may be used to endorse 31054 * or promote products derived from this software without specific prior written permission. 31055 * 31056 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 31057 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 31058 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31059 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 31060-31205
31060 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 31061 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 31062 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31063 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31064 * OF THE POSSIBILITY OF SUCH DAMAGE. 31065 * 31066*/ 31067 31068// t: current time, b: begInnIng value, c: change In value, d: duration 31069jQuery.easing['jswing'] = jQuery.easing['swing']; 31070 31071jQuery.extend( jQuery.easing, 31072{ 31073 def: 'easeOutQuad', 31074 swing: function (x, t, b, c, d) { 31075 //alert(jQuery.easing.default); 31076 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 31077 }, 31078 easeInQuad: function (x, t, b, c, d) { 31079 return c*(t/=d)*t + b; 31080 }, 31081 easeOutQuad: function (x, t, b, c, d) { 31082 return -c *(t/=d)*(t-2) + b; 31083 }, 31084 easeInOutQuad: function (x, t, b, c, d) { 31085 if ((t/=d/2) < 1) return c/2*t*t + b; 31086 return -c/2 * ((--t)*(t-2) - 1) + b; 31087 }, 31088 easeInCubic: function (x, t, b, c, d) { 31089 return c*(t/=d)*t*t + b; 31090 }, 31091 easeOutCubic: function (x, t, b, c, d) { 31092 return c*((t=t/d-1)*t*t + 1) + b; 31093 }, 31094 easeInOutCubic: function (x, t, b, c, d) { 31095 if ((t/=d/2) < 1) return c/2*t*t*t + b; 31096 return c/2*((t-=2)*t*t + 2) + b; 31097 }, 31098 easeInQuart: function (x, t, b, c, d) { 31099 return c*(t/=d)*t*t*t + b; 31100 }, 31101 easeOutQuart: function (x, t, b, c, d) { 31102 return -c * ((t=t/d-1)*t*t*t - 1) + b; 31103 }, 31104 easeInOutQuart: function (x, t, b, c, d) { 31105 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 31106 return -c/2 * ((t-=2)*t*t*t - 2) + b; 31107 }, 31108 easeInQuint: function (x, t, b, c, d) { 31109 return c*(t/=d)*t*t*t*t + b; 31110 }, 31111 easeOutQuint: function (x, t, b, c, d) { 31112 return c*((t=t/d-1)*t*t*t*t + 1) + b; 31113 }, 31114 easeInOutQuint: function (x, t, b, c, d) { 31115 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 31116 return c/2*((t-=2)*t*t*t*t + 2) + b; 31117 }, 31118 easeInSine: function (x, t, b, c, d) { 31119 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 31120 }, 31121 easeOutSine: function (x, t, b, c, d) { 31122 return c * Math.sin(t/d * (Math.PI/2)) + b; 31123 }, 31124 easeInOutSine: function (x, t, b, c, d) { 31125 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 31126 }, 31127 easeInExpo: function (x, t, b, c, d) { 31128 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 31129 }, 31130 easeOutExpo: function (x, t, b, c, d) { 31131 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 31132 }, 31133 easeInOutExpo: function (x, t, b, c, d) { 31134 if (t==0) return b; 31135 if (t==d) return b+c; 31136 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 31137 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 31138 }, 31139 easeInCirc: function (x, t, b, c, d) { 31140 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 31141 }, 31142 easeOutCirc: function (x, t, b, c, d) { 31143 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 31144 }, 31145 easeInOutCirc: function (x, t, b, c, d) { 31146 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 31147 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 31148 }, 31149 easeInElastic: function (x, t, b, c, d) { 31150 var s=1.70158;var p=0;var a=c; 31151 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 31152 if (a < Math.abs(c)) { a=c; var s=p/4; } 31153 else var s = p/(2*Math.PI) * Math.asin (c/a); 31154 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 31155 }, 31156 easeOutElastic: function (x, t, b, c, d) { 31157 var s=1.70158;var p=0;var a=c; 31158 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 31159 if (a < Math.abs(c)) { a=c; var s=p/4; } 31160 else var s = p/(2*Math.PI) * Math.asin (c/a); 31161 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 31162 }, 31163 easeInOutElastic: function (x, t, b, c, d) { 31164 var s=1.70158;var p=0;var a=c; 31165 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 31166 if (a < Math.abs(c)) { a=c; var s=p/4; } 31167 else var s = p/(2*Math.PI) * Math.asin (c/a); 31168 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 31169 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 31170 }, 31171 easeInBack: function (x, t, b, c, d, s) { 31172 if (s == undefined) s = 1.70158; 31173 return c*(t/=d)*t*((s+1)*t - s) + b; 31174 }, 31175 easeOutBack: function (x, t, b, c, d, s) { 31176 if (s == undefined) s = 1.70158; 31177 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 31178 }, 31179 easeInOutBack: function (x, t, b, c, d, s) { 31180 if (s == undefined) s = 1.70158; 31181 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 31182 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 31183 }, 31184 easeInBounce: function (x, t, b, c, d) { 31185 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 31186 }, 31187 easeOutBounce: function (x, t, b, c, d) { 31188 if ((t/=d) < (1/2.75)) { 31189 return c*(7.5625*t*t) + b; 31190 } else if (t < (2/2.75)) { 31191 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 31192 } else if (t < (2.5/2.75)) { 31193 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 31194 } else { 31195 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 31196 } 31197 }, 31198 easeInOutBounce: function (x, t, b, c, d) { 31199 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 31200 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 31201 } 31202}); 31203 31204/* 31205 *
31206 * TERMS OF USE - EASING EQUATIONS 31207 * 31208 * Open source under the BSD License. 31209 * 31210 * Copyright © 2001 Robert Penner 31211 * All rights reserved. 31212 * 31213 * Redistribution and use in source and binary forms, with or without modification, 31214 * are permitted provided that the following conditions are met: 31215 * 31216 * Redistributions of source code must retain the above copyright notice, this list of 31217 * conditions and the following disclaimer. 31218 * Redistributions in binary form must reproduce the above copyright notice, this list 31219 * of conditions and the following disclaimer in the documentation and/or other materials 31220 * provided with the distribution. 31221 * 31222 * Neither the name of the author nor the names of contributors may be used to endorse 31223 * or promote products derived from this software without specific prior written permission. 31224 * 31225 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 31226 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 31227 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31228 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31229 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 31230 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 31231 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31232 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31233 * OF THE POSSIBILITY OF SUCH DAMAGE. 31234 * 31235 */; 31236/*global jQuery */ 31237/*jshint multistr:true browser:true */ 31238/*! 31239* FitVids 1.0 31240* 31241* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 31242* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 31243* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 31244* 31245* Date: Thu Sept 01 18:00:00 2011 -0500 31246*/ 31247 31248(function( $ ){ 31249 31250 "use strict"; 31251 31252 $.fn.fitVids = function( options ) { 31253 var settings = { 31254 customSelector: null 31255 }; 31256 31257 var div = document.createElement('div'), 31258 ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; 31259 31260 div.className = 'fit-vids-style'; 31261 div.innerHTML = '­<style> \ 31262 .fluid-width-video-wrapper { \ 31263 width: 100%; \ 31264 position: relative; \ 31265 padding: 0; \ 31266 } \ 31267 \ 31268 .fluid-width-video-wrapper iframe, \ 31269 .fluid-width-video-wrapper object, \ 31270 .fluid-width-video-wrapper embed { \ 31271 position: absolute; \ 31272 top: 0; \ 31273 left: 0; \ 31274 width: 100%; \ 31275 height: 100%; \ 31276 } \ 31277 </style>'; 31278 31279 ref.parentNode.insertBefore(div,ref); 31280 31281 if ( options ) { 31282 $.extend( settings, options ); 31283 } 31284 31285 return this.each(function(){ 31286 var selectors = [ 31287 "iframe[src*='player.vimeo.com']", 31288 "iframe[src*='www.youtube.com']", 31289 "iframe[src*='www.kickstarter.com']", 31290 "object", 31291 "embed" 31292 ]; 31293 31294 if (settings.customSelector) { 31295 selectors.push(settings.customSelector); 31296 } 31297 31298 var $allVideos = $(this).find(selectors.join(',')); 31299 31300 $allVideos.each(function(){ 31301 var $this = $(this); 31302 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 31303 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 31304 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 31305 aspectRatio = height / width; 31306 if(!$this.attr('id')){ 31307 var videoID = 'fitvid' + Math.floor(Math.random()*999999); 31308 $this.attr('id', videoID); 31309 } 31310 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); 31311 $this.removeAttr('height').removeAttr('width'); 31312 }); 31313 }); 31314 }; 31315})( jQuery ); 31316 31317 31318 31319 31320 31321 31322this.KeyVisual_Image = (function () { 31323 function KeyVisual_Image() { 31324 } 31325 31326 KeyVisual_Image.slide = function (selector, opts) { 31327 var defaultOpts; 31328 if (opts == null) { 31329 opts = {}; 31330 } 31331 defaultOpts = { 31332 auto: true, 31333 autoControls: true, 31334 startText: $(selector).find(".controls-start").text(), 31335 stopText: $(selector).find(".controls-stop").text(), 31336 controls: false, 31337 pagerCustom: selector + " .bx-thumbs", 31338 touchEnabled : false 31339 }; 31340 return $(selector + " .images").bxSlider($.extend(defaultOpts, opts)); 31341 }; 31342 31343 KeyVisual_Image.randomize = function (selector) { 31344 var list, wrap; 31345 wrap = $(selector); 31346 list = wrap.find("li"); 31347 list = list.sort(function () { 31348 return Math.random() - .5; 31349 }); 31350 return list.each(function () { 31351 return wrap.append($(this)); 31352 }); 31353 }; 31354 31355 return KeyVisual_Image; 31356 31357})(); 31358this.Googlemaps_Map = (function () { 31359 function Googlemaps_Map() { 31360 } 31361 31362 Googlemaps_Map.map = null; 31363 31364 Googlemaps_Map.form = null; 31365 31366 Googlemaps_Map.center = null; // null means auto 31367 31368 Googlemaps_Map.zoom = null; // null means auto 31369 31370 Googlemaps_Map.defaultCenter = [36.204824, 138.252924]; 31371 31372 Googlemaps_Map.defaultZoom = 13; 31373 31374 Googlemaps_Map.markers = null; 31375 31376 Googlemaps_Map.markerClusterer = null; 31377 31378 Googlemaps_Map.markerIcon = "/assets/img/googlemaps/marker1.png"; 31379 31380 Googlemaps_Map.clickIcon = "/assets/img/googlemaps/marker17.png"; 31381 31382 Googlemaps_Map.openedInfo = null; 31383 31384 Googlemaps_Map.resized = null; 31385 31386 Googlemaps_Map.kmlLayer = null; 31387 31388 Googlemaps_Map.showGoogleMapsSearch = false;
31389 31390 Googlemaps_Map.mapsSearchUrl = "https://www.google.co.jp/maps/search/"; 31391 31392 Googlemaps_Map.attachMessage = function (id) { 31393 google.maps.event.addListener(Googlemaps_Map.markers[id]["marker"], 'click', function (_event) { 31394 if (Googlemaps_Map.openedInfo) { 31395 Googlemaps_Map.openedInfo.close(); 31396 } 31397 if (Googlemaps_Map.markers[id]["window"]) { 31398 Googlemaps_Map.markers[id]["window"].open(Googlemaps_Map.markers[id]["marker"].getMap(), Googlemaps_Map.markers[id]["marker"]); 31399 } 31400 Googlemaps_Map.openedInfo = Googlemaps_Map.markers[id]["window"]; 31401 }); 31402 return google.maps.event.addListener(Googlemaps_Map.markers[id]["window"], 'closeclick', function (_event) { 31403 Googlemaps_Map.openedInfo = null; 31404 }); 31405 }; 31406 31407 Googlemaps_Map.setForm = function (form) { 31408 return this.form = form; 31409 }; 31410 31411 Googlemaps_Map.load = function (selector, options) { 31412 if (!options) { 31413 options = {} 31414 } 31415 31416 if (options["zoom"]) { 31417 if (Googlemaps_Map.validateZoom(options["zoom"])) { 31418 Googlemaps_Map.zoom = options["zoom"]; 31419 } 31420 } 31421 if (options["center"]) { 31422 if (Googlemaps_Map.validateLatLon(options["center"][1], options["center"][0])) { 31423 Googlemaps_Map.center = options["center"].reverse(); 31424 } 31425 } 31426 if (options["showGoogleMapsSearch"]) { 31427 Googlemaps_Map.showGoogleMapsSearch = true; 31428 } 31429 31430 var center = Googlemaps_Map.getCenter(); 31431 var mapOptions = { 31432 center: new google.maps.LatLng(center[0], center[1]), 31433 zoom: Googlemaps_Map.getZoom(), 31434 mapTypeId: google.maps.MapTypeId.ROADMAP, 31435 panControl: false, 31436 zoomControl: true, 31437 zoomControlOptions: { 31438 style: google.maps.ZoomControlStyle.LARGE 31439 }, 31440 mapTypeControl: true, 31441 scaleControl: true, 31442 scrollwheel: true, 31443 streetViewControl: true, 31444 overviewMapControl: true, 31445 overviewMapControlOptions: { 31446 opened: true 31447 } 31448 }; 31449 Googlemaps_Map.map = new google.maps.Map($(selector).get(0), mapOptions); 31450 }; 31451 31452 Googlemaps_Map.getCenter = function () { 31453 return (Googlemaps_Map.center ? Googlemaps_Map.center : Googlemaps_Map.defaultCenter); 31454 } 31455 31456 Googlemaps_Map.getZoom = function () { 31457 return (Googlemaps_Map.zoom ? Googlemaps_Map.zoom : Googlemaps_Map.defaultZoom); 31458 } 31459 31460 Googlemaps_Map.resize = function () { 31461 google.maps.event.trigger(this.map, "resize"); 31462 if (!this.resized) { 31463 var center = Googlemaps_Map.getCenter(); 31464 this.map.setCenter(new google.maps.LatLng(center[0], center[1])); 31465 if (this.form) { 31466 this.form.renderMarkers(); 31467 } 31468 } 31469 return this.resized = true; 31470 }; 31471 31472 Googlemaps_Map.renderMarkers = function () { 31473 if (this.form) { 31474 return this.form.renderMarkers(); 31475 } 31476 }; 31477 31478 Googlemaps_Map.renderEvents = function () { 31479 if (this.form) { 31480 return this.form.renderEvents(); 31481 } 31482 }; 31483 31484 Googlemaps_Map.setMarkers = function (markers, opts = {}) { 31485 let markerBounds; 31486 Googlemaps_Map.markers = markers; 31487 markerBounds = new google.maps.LatLngBounds(); 31488 31489 Object.entries(Googlemaps_Map.markers).forEach(([id, value]) => { 31490 const position = new google.maps.LatLng(value["loc"][1], value["loc"][0]); 31491 const markerOpts = { 31492 position: position, 31493 map: Googlemaps_Map.map, 31494 icon: value["image"] || Googlemaps_Map.markerIcon 31495 }; 31496 31497 Googlemaps_Map.markers[id]["marker"] = new google.maps.Marker(markerOpts); 31498 markerBounds.extend(position); 31499 31500 let markerHtml = ""; 31501 if (value['html']) { 31502 markerHtml = value['html']; 31503 } else if (value['name'] || value['text']) { 31504 const $markerContent = $("<div/>", { class: "marker marker-info" }); 31505 if (value['name']) { 31506 $markerContent.append($("<p/>", { class: "marker-name" }).text(value['name'])); 31507 } 31508 if (value['text']) { 31509 const $explanation = $("<div/>", { class: "marker-explanation" }); 31510 value['text'].split(/[\r\n]+/).forEach(line => { 31511 if (/^https?:\/\//.test(line)) { 31512 $explanation.append($("<p/>", { class: "marker-link" }).html($("<a />", { href: line }).text(line))); 31513 } else { 31514 $explanation.append($("<p/>").text(line)); 31515 } 31516 }); 31517 $markerContent.append($explanation); 31518 } 31519 markerHtml = $markerContent.html(); 31520 } 31521 31522 if (Googlemaps_Map.showGoogleMapsSearch) { 31523 markerHtml += Googlemaps_Map.getMapsSearchHtml(value['loc'][1], value['loc'][0]); 31524 } 31525 31526 if (markerHtml) { 31527 Googlemaps_Map.markers[id]["window"] = new google.maps.InfoWindow({ 31528 content: markerHtml, 31529 pixelOffset: new google.maps.Size(0, 0), 31530 }); 31531 Googlemaps_Map.attachMessage(id); 31532 } 31533 }); 31534 31535 if (opts['markerCluster']) { 31536 Googlemaps_Map.renderMarkerCluster(); 31537 } 31538 Googlemaps_Map.adjustMarkerBounds(Object.keys(Googlemaps_Map.markers).length, markerBounds); 31539 }; 31540 31541 Googlemaps_Map.renderMarkerCluster = function () { 31542 const clusterMarkers = Object.values(Googlemaps_Map.markers).map(data => data.marker); 31543 Googlemaps_Map.markerClusterer = new MarkerClusterer(Googlemaps_Map.map, clusterMarkers, { 31544 // averageCenter: true, 31545 ignoreHiddenMarkers: true, 31546 imagePath: '/assets/img/marker-clusterer/m', 31547 // zoomOnClick: false, 31548 }); 31549 31550 google.maps.event.addListener(Googlemaps_Map.map, 'zoom_changed', () => { 31551 Googlemaps_Map.closeMarkerClusterInfo(); 31552 }); 31553 31554 ClusterIcon.prototype.triggerClusterClick = function(event) { 31555 const cluster = this.cluster_; 31556 const markers = cluster.getMarkers(); 31557 const positions = markers.map(marker => marker.position.toUrlValue()); 31558 31559 const clusterMarkers = Object.values(Googlemaps_Map.markers).filter(marker => 31560 positions.includes([marker.loc[1], marker.loc[0]].toString()) 31561 ); 31562 const contents = clusterMarkers.map(marker => marker.html || ""); 31563 const infoWindow = new google.maps.InfoWindow({ 31564 content: `<div class="marker-cluster-info">${contents.join('')}</div>`, 31565 position: markers[0].position, 31566 pixelOffset: new google.maps.Size(0, -15), 31567 markerType: 'cluster', // custom parameter 31568 }); 31569 31570 Googlemaps_Map.openMarkerClusterInfo(infoWindow); 31571 event.stopPropagation(); 31572 }; 31573 }; 31574 31575 Googlemaps_Map.openMarkerClusterInfo = function (infoWindow) { 31576 if (Googlemaps_Map.openedInfo) { 31577 Googlemaps_Map.openedInfo.close(); 31578 } 31579 Googlemaps_Map.openedInfo = infoWindow; 31580 31581 infoWindow.open({ 31582 map: Googlemaps_Map.map, 31583 }); 31584 }; 31585 31586 Googlemaps_Map.closeMarkerClusterInfo = function () { 31587 if (Googlemaps_Map.openedInfo && Googlemaps_Map.openedInfo.markerType === 'cluster') { 31588 Googlemaps_Map.openedInfo.close(); 31589 } 31590 }; 31591 31592 Googlemaps_Map.setKmlLayer = function (url) { 31593 Googlemaps_Map.kmlLayer = new google.maps.KmlLayer({ 31594 url: url, 31595 suppressInfoWindows: true, 31596 preserveViewport: false 31597 }); 31598 Googlemaps_Map.kmlLayer.setMap(Googlemaps_Map.map); 31599 }; 31600 31601 Googlemaps_Map.setGeoJson = function (url) { 31602 Googlemaps_Map.map.data.setStyle({ 31603 fillColor: "#b2c9e8", 31604 strokeColor: "#5A88C6", 31605 strokeWeight: 1 31606 }); 31607 Googlemaps_Map.map.data.loadGeoJson(url, {}, function(data) { 31608 var bounds = new google.maps.LatLngBounds(); 31609 var locs = []; 31610 31611 data.forEach(function (feature) {
31612 feature.getGeometry().forEachLatLng(function (LatLng) { 31613 bounds.extend(LatLng); 31614 locs.push(LatLng); 31615 }); 31616 }); 31617 31618 Googlemaps_Map.adjustMarkerBounds(locs.length, bounds); 31619 }); 31620 }; 31621 31622 Googlemaps_Map.adjustMarkerBounds = function(pointCount, bounds) { 31623 if (pointCount > 0) { 31624 // marker exists 31625 // set manually options or do fit 31626 var manuallyAdjust = false; 31627 var idleAdjuster = function() {}; 31628 31629 if (Googlemaps_Map.center) { 31630 var center = Googlemaps_Map.getCenter(); 31631 Googlemaps_Map.map.setCenter(new google.maps.LatLng(center[0], center[1])); 31632 manuallyAdjust = true; 31633 } 31634 31635 if (Googlemaps_Map.zoom) { 31636 Googlemaps_Map.map.setZoom(Googlemaps_Map.getZoom()); 31637 manuallyAdjust = true; 31638 } 31639 31640 if (!manuallyAdjust) { 31641 idleAdjuster = function() { 31642 if (Googlemaps_Map.map.getZoom() > Googlemaps_Map.getZoom()) { 31643 Googlemaps_Map.map.setZoom(Googlemaps_Map.getZoom()); 31644 } 31645 }; 31646 Googlemaps_Map.map.fitBounds(bounds); 31647 } 31648 google.maps.event.addListenerOnce(Googlemaps_Map.map, "idle", idleAdjuster); 31649 } else { 31650 // marker not exists 31651 // set manually or default options 31652 var center = Googlemaps_Map.getCenter(); 31653 Googlemaps_Map.map.setCenter(new google.maps.LatLng(center[0], center[1])); 31654 Googlemaps_Map.map.setZoom(Googlemaps_Map.getZoom()); 31655 } 31656 }; 31657 31658 Googlemaps_Map.validateZoom = function (zoom) { 31659 if (zoom >= 1 && zoom <= 21) { 31660 return true; 31661 } else { 31662 return false; 31663 } 31664 }; 31665 31666 Googlemaps_Map.validateLatLon = function (lat, lon) { 31667 if (lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) { 31668 return true; 31669 } else { 31670 return false; 31671 } 31672 }; 31673 31674 Googlemaps_Map.getMapsSearchHtml = function(lat, lng) { 31675 const url = `${Googlemaps_Map.mapsSearchUrl}${lat},${lng}`; 31676 return `<p class="marker-link"><a href="${url}">Googleãããã§ç¢ºèªãã</a></p>`; 31677 }; 31678 31679 return Googlemaps_Map; 31680})(); 31681this.Facility_Search = (function () { 31682 function Facility_Search() { 31683 } 31684 31685 Facility_Search.render = function (selector, opts) { 31686 var markers, overrided, slideSidebar; 31687 if (opts == null) { 31688 //define functions 31689 opts = {}; 31690 } 31691 markers = opts["markers"]; 31692 slideSidebar = function (column) { 31693 var columnTop, indexTop, scrolled; 31694 columnTop = column.offset().top; 31695 indexTop = column.closest("#map-sidebar").offset().top; 31696 scrolled = column.closest("#map-sidebar").scrollTop(); 31697 column.closest("#map-sidebar").animate({ 31698 scrollTop: columnTop - indexTop + scrolled 31699 }, 'fast'); 31700 }; 31701 31702 //setup map 31703 Googlemaps_Map.load(selector, opts); 31704 31705 //setup markers 31706 overrided = Googlemaps_Map.attachMessage; 31707 Googlemaps_Map.attachMessage = function (id) { 31708 overrided(id); 31709 google.maps.event.addListener(Googlemaps_Map.markers[id]["marker"], 'click', function (_event) { 31710 var column, dataID; 31711 $("#map-sidebar .column").removeClass("current"); 31712 dataID = Googlemaps_Map.markers[id]["id"]; 31713 column = $('#map-sidebar .column[data-id="' + dataID + '"]'); 31714 if (column.length) { 31715 column.addClass("current"); 31716 slideSidebar(column); 31717 } 31718 }); 31719 google.maps.event.addListener(Googlemaps_Map.markers[id]["window"], 'closeclick', function (_event) { 31720 $("#map-sidebar .column").removeClass("current"); 31721 }); 31722 }; 31723 Googlemaps_Map.setMarkers(markers, { markerCluster: opts['markerCluster'] }); 31724 31725 //setup sidebar 31726 $("#map-sidebar .column .click-marker").on("click", function () { 31727 var dataID; 31728 dataID = parseInt($(this).closest(".column").attr("data-id")); 31729 $("#map-sidebar .column").removeClass("current"); 31730 $.each(Googlemaps_Map.markers, function (i, m) { 31731 var column; 31732 if (dataID === m["id"]) { 31733 if (Googlemaps_Map.markerClusterer) { 31734 var cluster = Googlemaps_Map.markerClusterer.clusters_.find(function(cluster) { 31735 if (cluster.getMarkers().length === 1) return false;
31736 return cluster.getMarkers().find(function(marker) { 31737 return marker.position === m.marker.position; 31738 }); 31739 }); 31740 if (cluster) { 31741 m["window"].setPosition(cluster.getMarkers()[0].position); 31742 m["window"].pixelOffset = new google.maps.Size(0, -15); 31743 } 31744 } 31745 31746 if (Googlemaps_Map.openedInfo) { 31747 Googlemaps_Map.openedInfo.close(); 31748 } 31749 m["window"].open(m["marker"].getMap() || Googlemaps_Map.map, m["marker"]); 31750 Googlemaps_Map.openedInfo = m["window"]; 31751 column = $('#map-sidebar .column[data-id="' + dataID + '"]'); 31752 column.addClass("current"); 31753 slideSidebar(column); 31754 return false; 31755 } 31756 }); 31757 31758 return false; 31759 }); 31760 31761 //setup category filter 31762 $(".filters a").on("click", function () { 31763 var dataIDs; 31764 $(this).toggleClass("clicked").blur(); 31765 dataIDs = []; 31766 $(".filters a.clicked").each(function () { 31767 return dataIDs.push(parseInt($(this).attr("data-id"))); 31768 }); 31769 $.each(Googlemaps_Map.markers, function (id, _value) { 31770 var column, dataID, visible; 31771 visible = false; 31772 $.each(dataIDs, function () { 31773 if ($.inArray(parseInt(this), Googlemaps_Map.markers[id]["category"]) >= 0) { 31774 visible = true; 31775 return false; 31776 } 31777 }); 31778 dataID = Googlemaps_Map.markers[id]["id"]; 31779 column = $('#map-sidebar .column[data-id="' + dataID + '"]'); 31780 if (visible) { 31781 Googlemaps_Map.markers[id]["marker"].setVisible(true); 31782 column.show(); 31783 } else { 31784 Googlemaps_Map.markers[id]["marker"].setVisible(false); 31785 if (Googlemaps_Map.markers[id]["window"]) { 31786 Googlemaps_Map.markers[id]["window"].close(); 31787 } 31788 column.hide(); 31789 } 31790 }); 31791 31792 $('#map-sidebar .column[data-cate-id]').each(function() { 31793 var column = $(this); 31794 var cateID = parseInt(column.attr('data-cate-id')); 31795 var exists = $.inArray(cateID, dataIDs) >= 0; 31796 column.toggle(exists); 31797 }); 31798 31799 var resultSize = $('#map-sidebar .column:visible').length; 31800 $('.map-search-result .number').text(resultSize); 31801 31802 if (Googlemaps_Map.openedInfo) { 31803 Googlemaps_Map.openedInfo.close(); 31804 Googlemaps_Map.openedInfo = null; 31805 } 31806 if (Googlemaps_Map.markerClusterer) { 31807 Googlemaps_Map.markerClusterer.repaint(); 31808 Googlemaps_Map.closeMarkerClusterInfo(); 31809 } 31810 return false; 31811 }); 31812 31813 //setup location filter 31814 $(".filters .focus").on("change", function () { 31815 var select; 31816 select = $(this); 31817 select.find("option:selected").each(function () { 31818 var latlng, loc, zoomLevel; 31819 if ($(this).val() === "") { 31820 return false; 31821 } 31822 loc = $(this).val().split(","); 31823 zoomLevel = $(this).attr("data-zoom-level"); 31824 latlng = new google.maps.LatLng(loc[0], loc[1]); 31825 Googlemaps_Map.map.setCenter(latlng); 31826 if (zoomLevel) { 31827 Googlemaps_Map.map.setZoom(parseInt(zoomLevel)); 31828 } 31829 select.val(""); 31830 }); 31831 }); 31832 31833 //click selected category 31834 $('.map-search-condition .category-settings').each(function() { 31835 var settings = $(this).attr('data-category-settings'); 31836 if (!settings) return false; 31837 $('.map-search-index .filters a').each(function() { 31838 var $btn = $(this); 31839 if (!settings.includes($btn.text())) { 31840 $btn.click(); 31841 } 31842 }); 31843 }); 31844 }; 31845 31846 return Facility_Search; 31847})();
vendor: 40,454 bytes, lines 31848-32906
31848(function() { 31849 31850 var debug = false; 31851 31852 var root = this; 31853 31854 var EXIF = function(obj) { 31855 if (obj instanceof EXIF) return obj; 31856 if (!(this instanceof EXIF)) return new EXIF(obj); 31857 this.EXIFwrapped = obj; 31858 }; 31859 31860 if (typeof exports !== 'undefined') { 31861 if (typeof module !== 'undefined' && module.exports) { 31862 exports = module.exports = EXIF; 31863 } 31864 exports.EXIF = EXIF; 31865 } else { 31866 root.EXIF = EXIF; 31867 } 31868 31869 var ExifTags = EXIF.Tags = { 31870 31871 // version tags 31872 0x9000 : "ExifVersion", // EXIF version 31873 0xA000 : "FlashpixVersion", // Flashpix format version 31874 31875 // colorspace tags 31876 0xA001 : "ColorSpace", // Color space information tag 31877 31878 // image configuration 31879 0xA002 : "PixelXDimension", // Valid width of meaningful image 31880 0xA003 : "PixelYDimension", // Valid height of meaningful image 31881 0x9101 : "ComponentsConfiguration", // Information about channels 31882 0x9102 : "CompressedBitsPerPixel", // Compressed bits per pixel 31883 31884 // user information 31885 0x927C : "MakerNote", // Any desired information written by the manufacturer 31886 0x9286 : "UserComment", // Comments by user 31887 31888 // related file 31889 0xA004 : "RelatedSoundFile", // Name of related sound file 31890 31891 // date and time 31892 0x9003 : "DateTimeOriginal", // Date and time when the original image was generated 31893 0x9004 : "DateTimeDigitized", // Date and time when the image was stored digitally 31894 0x9290 : "SubsecTime", // Fractions of seconds for DateTime 31895 0x9291 : "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal 31896 0x9292 : "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized 31897 31898 // picture-taking conditions 31899 0x829A : "ExposureTime", // Exposure time (in seconds) 31900 0x829D : "FNumber", // F number 31901 0x8822 : "ExposureProgram", // Exposure program 31902 0x8824 : "SpectralSensitivity", // Spectral sensitivity 31903 0x8827 : "ISOSpeedRatings", // ISO speed rating 31904 0x8828 : "OECF", // Optoelectric conversion factor 31905 0x9201 : "ShutterSpeedValue", // Shutter speed 31906 0x9202 : "ApertureValue", // Lens aperture 31907 0x9203 : "BrightnessValue", // Value of brightness 31908 0x9204 : "ExposureBias", // Exposure bias 31909 0x9205 : "MaxApertureValue", // Smallest F number of lens 31910 0x9206 : "SubjectDistance", // Distance to subject in meters 31911 0x9207 : "MeteringMode", // Metering mode 31912 0x9208 : "LightSource", // Kind of light source 31913 0x9209 : "Flash", // Flash status 31914 0x9214 : "SubjectArea", // Location and area of main subject 31915 0x920A : "FocalLength", // Focal length of the lens in mm 31916 0xA20B : "FlashEnergy", // Strobe energy in BCPS 31917 0xA20C : "SpatialFrequencyResponse", // 31918 0xA20E : "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit 31919 0xA20F : "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit 31920 0xA210 : "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution 31921 0xA214 : "SubjectLocation", // Location of subject in image 31922 0xA215 : "ExposureIndex", // Exposure index selected on camera 31923 0xA217 : "SensingMethod", // Image sensor type 31924 0xA300 : "FileSource", // Image source (3 == DSC) 31925 0xA301 : "SceneType", // Scene type (1 == directly photographed) 31926 0xA302 : "CFAPattern", // Color filter array geometric pattern 31927 0xA401 : "CustomRendered", // Special processing 31928 0xA402 : "ExposureMode", // Exposure mode 31929 0xA403 : "WhiteBalance", // 1 = auto white balance, 2 = manual 31930 0xA404 : "DigitalZoomRation", // Digital zoom ratio 31931 0xA405 : "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm) 31932 0xA406 : "SceneCaptureType", // Type of scene 31933 0xA407 : "GainControl", // Degree of overall image gain adjustment 31934 0xA408 : "Contrast", // Direction of contrast processing applied by camera 31935 0xA409 : "Saturation", // Direction of saturation processing applied by camera 31936 0xA40A : "Sharpness", // Direction of sharpness processing applied by camera 31937 0xA40B : "DeviceSettingDescription", // 31938 0xA40C : "SubjectDistanceRange", // Distance to subject 31939 31940 // other tags 31941 0xA005 : "InteroperabilityIFDPointer", 31942 0xA420 : "ImageUniqueID" // Identifier assigned uniquely to each image 31943 }; 31944 31945 var TiffTags = EXIF.TiffTags = { 31946 0x0100 : "ImageWidth", 31947 0x0101 : "ImageHeight", 31948 0x8769 : "ExifIFDPointer", 31949 0x8825 : "GPSInfoIFDPointer", 31950 0xA005 : "InteroperabilityIFDPointer", 31951 0x0102 : "BitsPerSample", 31952 0x0103 : "Compression", 31953 0x0106 : "PhotometricInterpretation", 31954 0x0112 : "Orientation", 31955 0x0115 : "SamplesPerPixel", 31956 0x011C : "PlanarConfiguration", 31957 0x0212 : "YCbCrSubSampling", 31958 0x0213 : "YCbCrPositioning", 31959 0x011A : "XResolution", 31960 0x011B : "YResolution", 31961 0x0128 : "ResolutionUnit", 31962 0x0111 : "StripOffsets", 31963 0x0116 : "RowsPerStrip", 31964 0x0117 : "StripByteCounts", 31965 0x0201 : "JPEGInterchangeFormat", 31966 0x0202 : "JPEGInterchangeFormatLength", 31967 0x012D : "TransferFunction", 31968 0x013E : "WhitePoint", 31969 0x013F : "PrimaryChromaticities", 31970 0x0211 : "YCbCrCoefficients", 31971 0x0214 : "ReferenceBlackWhite", 31972 0x0132 : "DateTime", 31973 0x010E : "ImageDescription", 31974 0x010F : "Make", 31975 0x0110 : "Model", 31976 0x0131 : "Software", 31977 0x013B : "Artist", 31978 0x8298 : "Copyright" 31979 }; 31980 31981 var GPSTags = EXIF.GPSTags = { 31982 0x0000 : "GPSVersionID", 31983 0x0001 : "GPSLatitudeRef", 31984 0x0002 : "GPSLatitude", 31985 0x0003 : "GPSLongitudeRef", 31986 0x0004 : "GPSLongitude", 31987 0x0005 : "GPSAltitudeRef", 31988 0x0006 : "GPSAltitude", 31989 0x0007 : "GPSTimeStamp", 31990 0x0008 : "GPSSatellites", 31991 0x0009 : "GPSStatus", 31992 0x000A : "GPSMeasureMode", 31993 0x000B : "GPSDOP", 31994 0x000C : "GPSSpeedRef", 31995 0x000D : "GPSSpeed", 31996 0x000E : "GPSTrackRef", 31997 0x000F : "GPSTrack", 31998 0x0010 : "GPSImgDirectionRef", 31999 0x0011 : "GPSImgDirection", 32000 0x0012 : "GPSMapDatum", 32001 0x0013 : "GPSDestLatitudeRef", 32002 0x0014 : "GPSDestLatitude", 32003 0x0015 : "GPSDestLongitudeRef", 32004 0x0016 : "GPSDestLongitude", 32005 0x0017 : "GPSDestBearingRef", 32006 0x0018 : "GPSDestBearing", 32007 0x0019 : "GPSDestDistanceRef", 32008 0x001A : "GPSDestDistance", 32009 0x001B : "GPSProcessingMethod", 32010 0x001C : "GPSAreaInformation", 32011 0x001D : "GPSDateStamp", 32012 0x001E : "GPSDifferential" 32013 }; 32014 32015 // EXIF 2.3 Spec 32016 var IFD1Tags = EXIF.IFD1Tags = { 32017 0x0100: "ImageWidth", 32018 0x0101: "ImageHeight", 32019 0x0102: "BitsPerSample", 32020 0x0103: "Compression", 32021 0x0106: "PhotometricInterpretation", 32022 0x0111: "StripOffsets", 32023 0x0112: "Orientation", 32024 0x0115: "SamplesPerPixel", 32025 0x0116: "RowsPerStrip", 32026 0x0117: "StripByteCounts", 32027 0x011A: "XResolution", 32028 0x011B: "YResolution", 32029 0x011C: "PlanarConfiguration", 32030 0x0128: "ResolutionUnit", 32031 0x0201: "JpegIFOffset", // When image format is JPEG, this value show offset to JPEG data stored.(aka "ThumbnailOffset" or "JPEGInterchangeFormat") 32032 0x0202: "JpegIFByteCount", // When image format is JPEG, this value shows data size of JPEG image (aka "ThumbnailLength" or "JPEGInterchangeFormatLength") 32033 0x0211: "YCbCrCoefficients", 32034 0x0212: "YCbCrSubSampling", 32035 0x0213: "YCbCrPositioning", 32036 0x0214: "ReferenceBlackWhite" 32037 }; 32038 32039 var StringValues = EXIF.StringValues = { 32040 ExposureProgram : { 32041 0 : "Not defined", 32042 1 : "Manual", 32043 2 : "Normal program", 32044 3 : "Aperture priority", 32045 4 : "Shutter priority", 32046 5 : "Creative program", 32047 6 : "Action program", 32048 7 : "Portrait mode", 32049 8 : "Landscape mode" 32050 }, 32051 MeteringMode : { 32052 0 : "Unknown", 32053 1 : "Average", 32054 2 : "CenterWeightedAverage", 32055 3 : "Spot", 32056 4 : "MultiSpot", 32057 5 : "Pattern", 32058 6 : "Partial", 32059 255 : "Other" 32060 }, 32061 LightSource : { 32062 0 : "Unknown", 32063 1 : "Daylight", 32064 2 : "Fluorescent", 32065 3 : "Tungsten (incandescent light)", 32066 4 : "Flash", 32067 9 : "Fine weather", 32068 10 : "Cloudy weather", 32069 11 : "Shade", 32070 12 : "Daylight fluorescent (D 5700 - 7100K)", 32071 13 : "Day white fluorescent (N 4600 - 5400K)", 32072 14 : "Cool white fluorescent (W 3900 - 4500K)", 32073 15 : "White fluorescent (WW 3200 - 3700K)", 32074 17 : "Standard light A", 32075 18 : "Standard light B", 32076 19 : "Standard light C", 32077 20 : "D55", 32078 21 : "D65", 32079 22 : "D75", 32080 23 : "D50", 32081 24 : "ISO studio tungsten", 32082 255 : "Other" 32083 }, 32084 Flash : { 32085 0x0000 : "Flash did not fire", 32086 0x0001 : "Flash fired", 32087 0x0005 : "Strobe return light not detected", 32088 0x0007 : "Strobe return light detected", 32089 0x0009 : "Flash fired, compulsory flash mode", 32090 0x000D : "Flash fired, compulsory flash mode, return light not detected", 32091 0x000F : "Flash fired, compulsory flash mode, return light detected", 32092 0x0010 : "Flash did not fire, compulsory flash mode", 32093 0x0018 : "Flash did not fire, auto mode", 32094 0x0019 : "Flash fired, auto mode", 32095 0x001D : "Flash fired, auto mode, return light not detected", 32096 0x001F : "Flash fired, auto mode, return light detected", 32097 0x0020 : "No flash function", 32098 0x0041 : "Flash fired, red-eye reduction mode", 32099 0x0045 : "Flash fired, red-eye reduction mode, return light not detected", 32100 0x0047 : "Flash fired, red-eye reduction mode, return light detected", 32101 0x0049 : "Flash fired, compulsory flash mode, red-eye reduction mode", 32102 0x004D : "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", 32103 0x004F : "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", 32104 0x0059 : "Flash fired, auto mode, red-eye reduction mode", 32105 0x005D : "Flash fired, auto mode, return light not detected, red-eye reduction mode", 32106 0x005F : "Flash fired, auto mode, return light detected, red-eye reduction mode" 32107 }, 32108 SensingMethod : { 32109 1 : "Not defined", 32110 2 : "One-chip color area sensor", 32111 3 : "Two-chip color area sensor", 32112 4 : "Three-chip color area sensor", 32113 5 : "Color sequential area sensor", 32114 7 : "Trilinear sensor", 32115 8 : "Color sequential linear sensor" 32116 }, 32117 SceneCaptureType : { 32118 0 : "Standard", 32119 1 : "Landscape", 32120 2 : "Portrait", 32121 3 : "Night scene" 32122 }, 32123 SceneType : { 32124 1 : "Directly photographed" 32125 }, 32126 CustomRendered : { 32127 0 : "Normal process", 32128 1 : "Custom process" 32129 }, 32130 WhiteBalance : { 32131 0 : "Auto white balance", 32132 1 : "Manual white balance" 32133 }, 32134 GainControl : { 32135 0 : "None", 32136 1 : "Low gain up", 32137 2 : "High gain up", 32138 3 : "Low gain down", 32139 4 : "High gain down" 32140 }, 32141 Contrast : { 32142 0 : "Normal", 32143 1 : "Soft", 32144 2 : "Hard" 32145 }, 32146 Saturation : { 32147 0 : "Normal", 32148 1 : "Low saturation", 32149 2 : "High saturation" 32150 }, 32151 Sharpness : { 32152 0 : "Normal", 32153 1 : "Soft", 32154 2 : "Hard" 32155 }, 32156 SubjectDistanceRange : { 32157 0 : "Unknown", 32158 1 : "Macro", 32159 2 : "Close view", 32160 3 : "Distant view" 32161 }, 32162 FileSource : { 32163 3 : "DSC" 32164 }, 32165 32166 Components : { 32167 0 : "", 32168 1 : "Y", 32169 2 : "Cb", 32170 3 : "Cr", 32171 4 : "R", 32172 5 : "G", 32173 6 : "B" 32174 } 32175 }; 32176 32177 function addEvent(element, event, handler) { 32178 if (element.addEventListener) { 32179 element.addEventListener(event, handler, false); 32180 } else if (element.attachEvent) { 32181 element.attachEvent("on" + event, handler); 32182 } 32183 } 32184 32185 function imageHasData(img) { 32186 return !!(img.exifdata); 32187 } 32188 32189 32190 function base64ToArrayBuffer(base64, contentType) { 32191 contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg' 32192 base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, ''); 32193 var binary = atob(base64); 32194 var len = binary.length; 32195 var buffer = new ArrayBuffer(len); 32196 var view = new Uint8Array(buffer); 32197 for (var i = 0; i < len; i++) { 32198 view[i] = binary.charCodeAt(i); 32199 } 32200 return buffer; 32201 } 32202 32203 function objectURLToBlob(url, callback) { 32204 var http = new XMLHttpRequest(); 32205 http.open("GET", url, true); 32206 http.responseType = "blob"; 32207 http.onload = function(e) { 32208 if (this.status == 200 || this.status === 0) { 32209 callback(this.response); 32210 } 32211 }; 32212 http.send(); 32213 } 32214 32215 function getImageData(img, callback) { 32216 function handleBinaryFile(binFile) { 32217 var data = findEXIFinJPEG(binFile); 32218 img.exifdata = data || {}; 32219 var iptcdata = findIPTCinJPEG(binFile); 32220 img.iptcdata = iptcdata || {}; 32221 if (EXIF.isXmpEnabled) { 32222 var xmpdata= findXMPinJPEG(binFile); 32223 img.xmpdata = xmpdata || {}; 32224 } 32225 if (callback) { 32226 callback.call(img); 32227 } 32228 } 32229 32230 if (img.src) { 32231 if (/^data\:/i.test(img.src)) { // Data URI 32232 var arrayBuffer = base64ToArrayBuffer(img.src); 32233 handleBinaryFile(arrayBuffer); 32234 32235 } else if (/^blob\:/i.test(img.src)) { // Object URL 32236 var fileReader = new FileReader(); 32237 fileReader.onload = function(e) { 32238 handleBinaryFile(e.target.result); 32239 }; 32240 objectURLToBlob(img.src, function (blob) { 32241 fileReader.readAsArrayBuffer(blob); 32242 }); 32243 } else { 32244 var http = new XMLHttpRequest(); 32245 http.onload = function() { 32246 if (this.status == 200 || this.status === 0) { 32247 handleBinaryFile(http.response); 32248 } else { 32249 throw "Could not load image"; 32250 } 32251 http = null; 32252 }; 32253 http.open("GET", img.src, true); 32254 http.responseType = "arraybuffer"; 32255 http.send(null); 32256 } 32257 } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) { 32258 var fileReader = new FileReader(); 32259 fileReader.onload = function(e) { 32260 if (debug) console.log("Got file of length " + e.target.result.byteLength); 32261 handleBinaryFile(e.target.result); 32262 }; 32263 32264 fileReader.readAsArrayBuffer(img); 32265 } 32266 } 32267 32268 function findEXIFinJPEG(file) { 32269 var dataView = new DataView(file); 32270 32271 if (debug) console.log("Got file of length " + file.byteLength); 32272 if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) { 32273 if (debug) console.log("Not a valid JPEG"); 32274 return false; // not a valid jpeg 32275 } 32276 32277 var offset = 2, 32278 length = file.byteLength, 32279 marker; 32280 32281 while (offset < length) { 32282 if (dataView.getUint8(offset) != 0xFF) { 32283 if (debug) console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset)); 32284 return false; // not a valid marker, something is wrong 32285 } 32286 32287 marker = dataView.getUint8(offset + 1); 32288 if (debug) console.log(marker); 32289 32290 // we could implement handling for other markers here, 32291 // but we're only looking for 0xFFE1 for EXIF data 32292 32293 if (marker == 225) { 32294 if (debug) console.log("Found 0xFFE1 marker"); 32295 32296 return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2); 32297 32298 // offset += 2 + file.getShortAt(offset+2, true); 32299 32300 } else { 32301 offset += 2 + dataView.getUint16(offset+2); 32302 } 32303 32304 } 32305 32306 } 32307 32308 function findIPTCinJPEG(file) { 32309 var dataView = new DataView(file); 32310 32311 if (debug) console.log("Got file of length " + file.byteLength); 32312 if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) { 32313 if (debug) console.log("Not a valid JPEG"); 32314 return false; // not a valid jpeg 32315 } 32316 32317 var offset = 2, 32318 length = file.byteLength; 32319 32320 32321 var isFieldSegmentStart = function(dataView, offset){ 32322 return ( 32323 dataView.getUint8(offset) === 0x38 && 32324 dataView.getUint8(offset+1) === 0x42 && 32325 dataView.getUint8(offset+2) === 0x49 && 32326 dataView.getUint8(offset+3) === 0x4D && 32327 dataView.getUint8(offset+4) === 0x04 && 32328 dataView.getUint8(offset+5) === 0x04 32329 ); 32330 }; 32331 32332 while (offset < length) { 32333 32334 if ( isFieldSegmentStart(dataView, offset )){ 32335 32336 // Get the length of the name header (which is padded to an even number of bytes) 32337 var nameHeaderLength = dataView.getUint8(offset+7); 32338 if(nameHeaderLength % 2 !== 0) nameHeaderLength += 1; 32339 // Check for pre photoshop 6 format 32340 if(nameHeaderLength === 0) { 32341 // Always 4 32342 nameHeaderLength = 4; 32343 } 32344 32345 var startOffset = offset + 8 + nameHeaderLength; 32346 var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength); 32347 32348 return readIPTCData(file, startOffset, sectionLength); 32349 32350 break; 32351 32352 } 32353 32354 32355 // Not the marker, continue searching 32356 offset++; 32357 32358 } 32359 32360 } 32361 var IptcFieldMap = { 32362 0x78 : 'caption', 32363 0x6E : 'credit', 32364 0x19 : 'keywords', 32365 0x37 : 'dateCreated', 32366 0x50 : 'byline', 32367 0x55 : 'bylineTitle', 32368 0x7A : 'captionWriter', 32369 0x69 : 'headline', 32370 0x74 : 'copyright', 32371 0x0F : 'category' 32372 }; 32373 function readIPTCData(file, startOffset, sectionLength){ 32374 var dataView = new DataView(file); 32375 var data = {}; 32376 var fieldValue, fieldName, dataSize, segmentType, segmentSize; 32377 var segmentStartPos = startOffset; 32378 while(segmentStartPos < startOffset+sectionLength) { 32379 if(dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos+1) === 0x02){ 32380 segmentType = dataView.getUint8(segmentStartPos+2); 32381 if(segmentType in IptcFieldMap) { 32382 dataSize = dataView.getInt16(segmentStartPos+3); 32383 segmentSize = dataSize + 5; 32384 fieldName = IptcFieldMap[segmentType]; 32385 fieldValue = getStringFromDB(dataView, segmentStartPos+5, dataSize); 32386 // Check if we already stored a value with this name 32387 if(data.hasOwnProperty(fieldName)) { 32388 // Value already stored with this name, create multivalue field 32389 if(data[fieldName] instanceof Array) { 32390 data[fieldName].push(fieldValue); 32391 } 32392 else { 32393 data[fieldName] = [data[fieldName], fieldValue]; 32394 } 32395 } 32396 else { 32397 data[fieldName] = fieldValue; 32398 } 32399 } 32400 32401 } 32402 segmentStartPos++; 32403 } 32404 return data; 32405 } 32406 32407 32408 32409 function readTags(file, tiffStart, dirStart, strings, bigEnd) { 32410 var entries = file.getUint16(dirStart, !bigEnd), 32411 tags = {}, 32412 entryOffset, tag, 32413 i; 32414 32415 for (i=0;i<entries;i++) { 32416 entryOffset = dirStart + i*12 + 2; 32417 tag = strings[file.getUint16(entryOffset, !bigEnd)]; 32418 if (!tag && debug) console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd)); 32419 tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd); 32420 } 32421 return tags; 32422 } 32423 32424 32425 function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) { 32426 var type = file.getUint16(entryOffset+2, !bigEnd), 32427 numValues = file.getUint32(entryOffset+4, !bigEnd), 32428 valueOffset = file.getUint32(entryOffset+8, !bigEnd) + tiffStart, 32429 offset, 32430 vals, val, n, 32431 numerator, denominator; 32432 32433 switch (type) { 32434 case 1: // byte, 8-bit unsigned int 32435 case 7: // undefined, 8-bit byte, value depending on field 32436 if (numValues == 1) { 32437 return file.getUint8(entryOffset + 8, !bigEnd); 32438 } else { 32439 offset = numValues > 4 ? valueOffset : (entryOffset + 8); 32440 vals = []; 32441 for (n=0;n<numValues;n++) { 32442 vals[n] = file.getUint8(offset + n); 32443 } 32444 return vals; 32445 } 32446 32447 case 2: // ascii, 8-bit byte 32448 offset = numValues > 4 ? valueOffset : (entryOffset + 8); 32449 return getStringFromDB(file, offset, numValues-1); 32450 32451 case 3: // short, 16 bit int 32452 if (numValues == 1) { 32453 return file.getUint16(entryOffset + 8, !bigEnd); 32454 } else { 32455 offset = numValues > 2 ? valueOffset : (entryOffset + 8); 32456 vals = []; 32457 for (n=0;n<numValues;n++) { 32458 vals[n] = file.getUint16(offset + 2*n, !bigEnd); 32459 } 32460 return vals; 32461 } 32462 32463 case 4: // long, 32 bit int 32464 if (numValues == 1) { 32465 return file.getUint32(entryOffset + 8, !bigEnd); 32466 } else { 32467 vals = []; 32468 for (n=0;n<numValues;n++) { 32469 vals[n] = file.getUint32(valueOffset + 4*n, !bigEnd); 32470 } 32471 return vals; 32472 } 32473 32474 case 5: // rational = two long values, first is numerator, second is denominator 32475 if (numValues == 1) { 32476 numerator = file.getUint32(valueOffset, !bigEnd); 32477 denominator = file.getUint32(valueOffset+4, !bigEnd); 32478 val = new Number(numerator / denominator); 32479 val.numerator = numerator; 32480 val.denominator = denominator; 32481 return val; 32482 } else { 32483 vals = []; 32484 for (n=0;n<numValues;n++) { 32485 numerator = file.getUint32(valueOffset + 8*n, !bigEnd); 32486 denominator = file.getUint32(valueOffset+4 + 8*n, !bigEnd); 32487 vals[n] = new Number(numerator / denominator); 32488 vals[n].numerator = numerator; 32489 vals[n].denominator = denominator; 32490 } 32491 return vals; 32492 } 32493 32494 case 9: // slong, 32 bit signed int 32495 if (numValues == 1) { 32496 return file.getInt32(entryOffset + 8, !bigEnd); 32497 } else { 32498 vals = []; 32499 for (n=0;n<numValues;n++) { 32500 vals[n] = file.getInt32(valueOffset + 4*n, !bigEnd); 32501 } 32502 return vals; 32503 } 32504 32505 case 10: // signed rational, two slongs, first is numerator, second is denominator 32506 if (numValues == 1) { 32507 return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset+4, !bigEnd); 32508 } else { 32509 vals = []; 32510 for (n=0;n<numValues;n++) { 32511 vals[n] = file.getInt32(valueOffset + 8*n, !bigEnd) / file.getInt32(valueOffset+4 + 8*n, !bigEnd); 32512 } 32513 return vals; 32514 } 32515 } 32516 } 32517 32518 /** 32519 * Given an IFD (Image File Directory) start offset 32520 * returns an offset to next IFD or 0 if it's the last IFD. 32521 */ 32522 function getNextIFDOffset(dataView, dirStart, bigEnd){ 32523 //the first 2bytes means the number of directory entries contains in this IFD 32524 var entries = dataView.getUint16(dirStart, !bigEnd); 32525 32526 // After last directory entry, there is a 4bytes of data, 32527 // it means an offset to next IFD. 32528 // If its value is '0x00000000', it means this is the last IFD and there is no linked IFD. 32529 32530 return dataView.getUint32(dirStart + 2 + entries * 12, !bigEnd); // each entry is 12 bytes long 32531 } 32532 32533 function readThumbnailImage(dataView, tiffStart, firstIFDOffset, bigEnd){ 32534 // get the IFD1 offset 32535 var IFD1OffsetPointer = getNextIFDOffset(dataView, tiffStart+firstIFDOffset, bigEnd); 32536 32537 if (!IFD1OffsetPointer) { 32538 // console.log('******** IFD1Offset is empty, image thumb not found ********'); 32539 return {}; 32540 } 32541 else if (IFD1OffsetPointer > dataView.byteLength) { // this should not happen 32542 // console.log('******** IFD1Offset is outside the bounds of the DataView ********'); 32543 return {}; 32544 } 32545 // console.log('******* thumbnail IFD offset (IFD1) is: %s', IFD1OffsetPointer); 32546 32547 var thumbTags = readTags(dataView, tiffStart, tiffStart + IFD1OffsetPointer, IFD1Tags, bigEnd) 32548 32549 // EXIF 2.3 specification for JPEG format thumbnail 32550 32551 // If the value of Compression(0x0103) Tag in IFD1 is '6', thumbnail image format is JPEG. 32552 // Most of Exif image uses JPEG format for thumbnail. In that case, you can get offset of thumbnail 32553 // by JpegIFOffset(0x0201) Tag in IFD1, size of thumbnail by JpegIFByteCount(0x0202) Tag. 32554 // Data format is ordinary JPEG format, starts from 0xFFD8 and ends by 0xFFD9. It seems that 32555 // JPEG format and 160x120pixels of size are recommended thumbnail format for Exif2.1 or later. 32556 32557 if (thumbTags['Compression']) { 32558 // console.log('Thumbnail image found!'); 32559 32560 switch (thumbTags['Compression']) { 32561 case 6: 32562 // console.log('Thumbnail image format is JPEG'); 32563 if (thumbTags.JpegIFOffset && thumbTags.JpegIFByteCount) { 32564 // extract the thumbnail 32565 var tOffset = tiffStart + thumbTags.JpegIFOffset; 32566 var tLength = thumbTags.JpegIFByteCount; 32567 thumbTags['blob'] = new Blob([new Uint8Array(dataView.buffer, tOffset, tLength)], { 32568 type: 'image/jpeg' 32569 }); 32570 } 32571 break; 32572 32573 case 1: 32574 console.log("Thumbnail image format is TIFF, which is not implemented."); 32575 break; 32576 default: 32577 console.log("Unknown thumbnail image format '%s'", thumbTags['Compression']); 32578 } 32579 } 32580 else if (thumbTags['PhotometricInterpretation'] == 2) { 32581 console.log("Thumbnail image format is RGB, which is not implemented."); 32582 } 32583 return thumbTags; 32584 } 32585 32586 function getStringFromDB(buffer, start, length) { 32587 var outstr = ""; 32588 for (n = start; n < start+length; n++) { 32589 outstr += String.fromCharCode(buffer.getUint8(n)); 32590 } 32591 return outstr; 32592 } 32593 32594 function readEXIFData(file, start) { 32595 if (getStringFromDB(file, start, 4) != "Exif") { 32596 if (debug) console.log("Not valid EXIF data! " + getStringFromDB(file, start, 4)); 32597 return false; 32598 } 32599 32600 var bigEnd, 32601 tags, tag, 32602 exifData, gpsData, 32603 tiffOffset = start + 6; 32604 32605 // test for TIFF validity and endianness 32606 if (file.getUint16(tiffOffset) == 0x4949) { 32607 bigEnd = false; 32608 } else if (file.getUint16(tiffOffset) == 0x4D4D) { 32609 bigEnd = true; 32610 } else { 32611 if (debug) console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"); 32612 return false; 32613 } 32614 32615 if (file.getUint16(tiffOffset+2, !bigEnd) != 0x002A) { 32616 if (debug) console.log("Not valid TIFF data! (no 0x002A)"); 32617 return false; 32618 } 32619 32620 var firstIFDOffset = file.getUint32(tiffOffset+4, !bigEnd); 32621 32622 if (firstIFDOffset < 0x00000008) { 32623 if (debug) console.log("Not valid TIFF data! (First offset less than 8)", file.getUint32(tiffOffset+4, !bigEnd)); 32624 return false; 32625 } 32626 32627 tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, TiffTags, bigEnd); 32628 32629 if (tags.ExifIFDPointer) { 32630 exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd); 32631 for (tag in exifData) { 32632 switch (tag) { 32633 case "LightSource" : 32634 case "Flash" : 32635 case "MeteringMode" : 32636 case "ExposureProgram" : 32637 case "SensingMethod" : 32638 case "SceneCaptureType" : 32639 case "SceneType" : 32640 case "CustomRendered" : 32641 case "WhiteBalance" : 32642 case "GainControl" : 32643 case "Contrast" : 32644 case "Saturation" : 32645 case "Sharpness" : 32646 case "SubjectDistanceRange" : 32647 case "FileSource" : 32648 exifData[tag] = StringValues[tag][exifData[tag]]; 32649 break; 32650 32651 case "ExifVersion" : 32652 case "FlashpixVersion" : 32653 exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]); 32654 break; 32655 32656 case "ComponentsConfiguration" : 32657 exifData[tag] = 32658 StringValues.Components[exifData[tag][0]] + 32659 StringValues.Components[exifData[tag][1]] + 32660 StringValues.Components[exifData[tag][2]] + 32661 StringValues.Components[exifData[tag][3]]; 32662 break; 32663 } 32664 tags[tag] = exifData[tag]; 32665 } 32666 } 32667 32668 if (tags.GPSInfoIFDPointer) { 32669 gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd); 32670 for (tag in gpsData) { 32671 switch (tag) { 32672 case "GPSVersionID" : 32673 gpsData[tag] = gpsData[tag][0] + 32674 "." + gpsData[tag][1] + 32675 "." + gpsData[tag][2] + 32676 "." + gpsData[tag][3]; 32677 break; 32678 } 32679 tags[tag] = gpsData[tag]; 32680 } 32681 } 32682 32683 // extract thumbnail 32684 tags['thumbnail'] = readThumbnailImage(file, tiffOffset, firstIFDOffset, bigEnd); 32685 32686 return tags; 32687 } 32688 32689 function findXMPinJPEG(file) { 32690 32691 if (!('DOMParser' in self)) { 32692 // console.warn('XML parsing not supported without DOMParser'); 32693 return; 32694 } 32695 var dataView = new DataView(file); 32696 32697 if (debug) console.log("Got file of length " + file.byteLength); 32698 if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) { 32699 if (debug) console.log("Not a valid JPEG"); 32700 return false; // not a valid jpeg 32701 } 32702 32703 var offset = 2, 32704 length = file.byteLength, 32705 dom = new DOMParser(); 32706 32707 while (offset < (length-4)) { 32708 if (getStringFromDB(dataView, offset, 4) == "http") { 32709 var startOffset = offset - 1; 32710 var sectionLength = dataView.getUint16(offset - 2) - 1; 32711 var xmpString = getStringFromDB(dataView, startOffset, sectionLength) 32712 var xmpEndIndex = xmpString.indexOf('xmpmeta>') + 8; 32713 xmpString = xmpString.substring( xmpString.indexOf( '<x:xmpmeta' ), xmpEndIndex ); 32714 32715 var indexOfXmp = xmpString.indexOf('x:xmpmeta') + 10 32716 //Many custom written programs embed xmp/xml without any namespace. Following are some of them. 32717 //Without these namespaces, XML is thought to be invalid by parsers 32718 xmpString = xmpString.slice(0, indexOfXmp) 32719 + 'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" ' 32720 + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' 32721 + 'xmlns:tiff="http://ns.adobe.com/tiff/1.0/" ' 32722 + 'xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" ' 32723 + 'xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" ' 32724 + 'xmlns:exif="http://ns.adobe.com/exif/1.0/" ' 32725 + 'xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" ' 32726 + 'xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" ' 32727 + 'xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" ' 32728 + 'xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" ' 32729 + 'xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" ' 32730 + xmpString.slice(indexOfXmp) 32731 32732 var domDocument = dom.parseFromString( xmpString, 'text/xml' ); 32733 return xml2Object(domDocument); 32734 } else{ 32735 offset++; 32736 } 32737 } 32738 } 32739 32740 function xml2json(xml) { 32741 var json = {}; 32742 32743 if (xml.nodeType == 1) { // element node 32744 if (xml.attributes.length > 0) { 32745 json['@attributes'] = {}; 32746 for (var j = 0; j < xml.attributes.length; j++) { 32747 var attribute = xml.attributes.item(j); 32748 json['@attributes'][attribute.nodeName] = attribute.nodeValue; 32749 } 32750 } 32751 } else if (xml.nodeType == 3) { // text node 32752 return xml.nodeValue; 32753 } 32754 32755 // deal with children 32756 if (xml.hasChildNodes()) { 32757 for(var i = 0; i < xml.childNodes.length; i++) { 32758 var child = xml.childNodes.item(i); 32759 var nodeName = child.nodeName; 32760 if (json[nodeName] == null) { 32761 json[nodeName] = xml2json(child); 32762 } else { 32763 if (json[nodeName].push == null) { 32764 var old = json[nodeName]; 32765 json[nodeName] = []; 32766 json[nodeName].push(old); 32767 } 32768 json[nodeName].push(xml2json(child)); 32769 } 32770 } 32771 } 32772 32773 return json; 32774 } 32775 32776 function xml2Object(xml) { 32777 try { 32778 var obj = {}; 32779 if (xml.children.length > 0) { 32780 for (var i = 0; i < xml.children.length; i++) { 32781 var item = xml.children.item(i); 32782 var attributes = item.attributes; 32783 for(var idx in attributes) { 32784 var itemAtt = attributes[idx]; 32785 var dataKey = itemAtt.nodeName; 32786 var dataValue = itemAtt.nodeValue; 32787 32788 if(dataKey !== undefined) { 32789 obj[dataKey] = dataValue; 32790 } 32791 } 32792 var nodeName = item.nodeName; 32793 32794 if (typeof (obj[nodeName]) == "undefined") { 32795 obj[nodeName] = xml2json(item); 32796 } else { 32797 if (typeof (obj[nodeName].push) == "undefined") { 32798 var old = obj[nodeName]; 32799 32800 obj[nodeName] = []; 32801 obj[nodeName].push(old); 32802 } 32803 obj[nodeName].push(xml2json(item)); 32804 } 32805 } 32806 } else { 32807 obj = xml.textContent; 32808 } 32809 return obj; 32810 } catch (e) { 32811 console.log(e.message); 32812 } 32813 } 32814 32815 EXIF.enableXmp = function() { 32816 EXIF.isXmpEnabled = true; 32817 } 32818 32819 EXIF.disableXmp = function() { 32820 EXIF.isXmpEnabled = false; 32821 } 32822 32823 EXIF.getData = function(img, callback) { 32824 if (((self.Image && img instanceof self.Image) 32825 || (self.HTMLImageElement && img instanceof self.HTMLImageElement)) 32826 && !img.complete) 32827 return false; 32828 32829 if (!imageHasData(img)) { 32830 getImageData(img, callback); 32831 } else { 32832 if (callback) { 32833 callback.call(img); 32834 } 32835 } 32836 return true; 32837 } 32838 32839 EXIF.getTag = function(img, tag) { 32840 if (!imageHasData(img)) return; 32841 return img.exifdata[tag]; 32842 } 32843 32844 EXIF.getIptcTag = function(img, tag) { 32845 if (!imageHasData(img)) return; 32846 return img.iptcdata[tag]; 32847 } 32848 32849 EXIF.getAllTags = function(img) { 32850 if (!imageHasData(img)) return {}; 32851 var a, 32852 data = img.exifdata, 32853 tags = {}; 32854 for (a in data) { 32855 if (data.hasOwnProperty(a)) { 32856 tags[a] = data[a]; 32857 } 32858 } 32859 return tags; 32860 } 32861 32862 EXIF.getAllIptcTags = function(img) { 32863 if (!imageHasData(img)) return {}; 32864 var a, 32865 data = img.iptcdata, 32866 tags = {}; 32867 for (a in data) { 32868 if (data.hasOwnProperty(a)) { 32869 tags[a] = data[a]; 32870 } 32871 } 32872 return tags; 32873 } 32874 32875 EXIF.pretty = function(img) { 32876 if (!imageHasData(img)) return ""; 32877 var a, 32878 data = img.exifdata, 32879 strPretty = ""; 32880 for (a in data) { 32881 if (data.hasOwnProperty(a)) { 32882 if (typeof data[a] == "object") { 32883 if (data[a] instanceof Number) { 32884 strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n"; 32885 } else { 32886 strPretty += a + " : [" + data[a].length + " values]\r\n"; 32887 } 32888 } else { 32889 strPretty += a + " : " + data[a] + "\r\n"; 32890 } 32891 } 32892 } 32893 return strPretty; 32894 } 32895 32896 EXIF.readFromBinaryFile = function(file) { 32897 return findEXIFinJPEG(file); 32898 } 32899 32900 if (typeof define === 'function' && define.amd) { 32901 define('exif-js', [], function() { 32902 return EXIF; 32903 }); 32904 } 32905}.call(this)); 32906
32907 32908this.Member_Photo_Form = (function () { 32909 function Member_Photo_Form() { 32910 } 32911 32912 Member_Photo_Form.maxPointForm = 10; 32913 32914 Member_Photo_Form.deleteMessage = "ãã¼ã«ã¼ãåé¤ãã¦ããããã§ããï¼"; 32915 32916 Member_Photo_Form.setExifMessage = "ç»åã«ä½ç½®æ å ±ãå«ã¾ãã¦ãã¾ããä½ç½®æ å ±ãå°å³ã«è¨å®ãã¾ããï¼"; 32917 32918 Member_Photo_Form.dataID = 0; 32919 32920 Member_Photo_Form.clickMarker = null; 32921 32922 Member_Photo_Form.setMapLoc = function (ele, lat, lon) { 32923 lat = Math.ceil(lat * Math.pow(10, 6)) / Math.pow(10, 6); 32924 lon = Math.ceil(lon * Math.pow(10, 6)) / Math.pow(10, 6); 32925 ele.val(lat.toFixed(6) + "," + lon.toFixed(6)); 32926 }; 32927 32928 Member_Photo_Form.getMapLoc = function (ele) { 32929 var latlon; 32930 latlon = ele.val().split(','); 32931 return new google.maps.LatLng(parseFloat(latlon[1]), parseFloat(latlon[0])); 32932 }; 32933 32934 Member_Photo_Form.attachMessage = function (id) { 32935 google.maps.event.addListener(Googlemaps_Map.markers[id], 'click', function (_event) { 32936 if (Googlemaps_Map.openedInfo) { 32937 Googlemaps_Map.openedInfo.close(); 32938 } 32939 $('dd[data-id = "' + id + '"]').each(function () { 32940 var markerHtml, name, text; 32941 name = $(this).find(".marker-name").val(); 32942 text = $(this).find(".marker-text").val(); 32943 if (name !== "" || text !== "") { 32944 markerHtml = '<div class="marker-info">'; 32945 if (name !== "") { 32946 markerHtml += '<p>' + name + '</p>'; 32947 } 32948 if (text !== "") { 32949 $.each(text.split(/[\r\n]+/), function () { 32950 if (this.match(/^https?:\/\//)) { 32951 return markerHtml += '<p><a href="' + this + '">' + this + '</a></p>'; 32952 } else { 32953 return markerHtml += '<p>' + this + '</p>'; 32954 } 32955 }); 32956 } 32957 Googlemaps_Map.openedInfo = new google.maps.InfoWindow({ 32958 content: markerHtml, 32959 maxWidth: 260 32960 }); 32961 Googlemaps_Map.openedInfo.open(Googlemaps_Map.markers[id].getMap(), Googlemaps_Map.markers[id]); 32962 } 32963 return false; 32964 }); 32965 }); 32966 }; 32967 32968 Member_Photo_Form.clearMarker = function (ele) { 32969 var dataId; 32970 dataId = 0; 32971 if (ele.val() !== "") { 32972 if (confirm(Member_Photo_Form.deleteMessage)) { 32973 if (Googlemaps_Map.markers[dataId]) { 32974 Googlemaps_Map.markers[dataId].setMap(null); 32975 ele.val(""); 32976 } 32977 } 32978 } else { 32979 if (Googlemaps_Map.markers[dataId]) { 32980 Googlemaps_Map.markers[dataId].setMap(null); 32981 } 32982 } 32983 }; 32984 32985 Member_Photo_Form.createMarker = function (ele) { 32986 var dataId; 32987 if ($(".mod-map .clicked").val() !== "") { 32988 ele.val($(".mod-map .clicked").val()); 32989 dataId = 0; 32990 if (Googlemaps_Map.markers[dataId]) { 32991 Googlemaps_Map.markers[dataId].setMap(null); 32992 } 32993 Googlemaps_Map.markers[dataId] = new google.maps.Marker({ 32994 position: Member_Photo_Form.getMapLoc($(".mod-map .marker-loc")), 32995 map: Googlemaps_Map.map, 32996 icon: Googlemaps_Map.markerIcon 32997 }); 32998 Member_Photo_Form.attachMessage(dataId); 32999 } 33000 }; 33001 33002 Member_Photo_Form.renderMarkers = function () { 33003 var i, len, m, markerBounds, ref; 33004 markerBounds = new google.maps.LatLngBounds(); 33005 if (Googlemaps_Map.markers) { 33006 ref = Googlemaps_Map.markers; 33007 for (i = 0, len = ref.length; i < len; i++) { 33008 m = ref[i]; 33009 m.setMap(null); 33010 } 33011 } 33012 33013 Googlemaps_Map.markers = []; 33014 Member_Photo_Form.dataID = 0; 33015 $(".mod-map .marker").each(function () { 33016 var loc; 33017 $(this).attr("data-id", Member_Photo_Form.dataID); 33018 if ($(this).find(".marker-loc").val() !== "") { 33019 loc = Member_Photo_Form.getMapLoc($(this).find(".marker-loc")); 33020 Googlemaps_Map.markers[Member_Photo_Form.dataID] = new google.maps.Marker({ 33021 position: loc, 33022 map: Googlemaps_Map.map, 33023 icon: Googlemaps_Map.markerIcon 33024 }); 33025 Member_Photo_Form.attachMessage(Member_Photo_Form.dataID); 33026 markerBounds.extend(loc); 33027 } 33028 return Member_Photo_Form.dataID += 1; 33029 }); 33030 Googlemaps_Map.adjustMarkerBounds(Googlemaps_Map.markers.length, markerBounds); 33031 }; 33032 33033 Member_Photo_Form.setExifLatLng = function (selector) { 33034 return $(selector).on("change", function (e) { 33035 if (!e.target.files[0]) { 33036 return; 33037 } 33038 return EXIF.getData(e.target.files[0], function () { 33039 var lat, latRef, lon, lonRef; 33040 lat = EXIF.getTag(this, 'GPSLatitude'); 33041 lon = EXIF.getTag(this, 'GPSLongitude'); 33042 latRef = EXIF.getTag(this, 'GPSLatitudeRef') || "N"; 33043 lonRef = EXIF.getTag(this, 'GPSLongitudeRef') || "W"; 33044 if (!(lat && lon)) { 33045 return false;
33046 } 33047 if (!confirm(Member_Photo_Form.setExifMessage)) { 33048 return false; 33049 } 33050 latRef = latRef === "N" ? 1 : -1; 33051 lonRef = lonRef === "W" ? -1 : 1; 33052 lat = (lat[0] + (lat[1] / 60) + (lat[2] / 3600)) * latRef; 33053 lon = (lon[0] + (lon[1] / 60) + (lon[2] / 3600)) * lonRef; 33054 $(".mod-map .clicked").val([lat, lon].join()); 33055 Member_Photo_Form.createMarker($(".mod-map .marker-loc")); 33056 return Googlemaps_Map.map.setCenter(new google.maps.LatLng(lon, lat)); 33057 }); 33058 }); 33059 }; 33060 33061 Member_Photo_Form.renderEvents = function () { 33062 google.maps.event.addListener(Googlemaps_Map.map, 'click', function (event) { 33063 Member_Photo_Form.setMapLoc($(".mod-map .clicked"), event.latLng.lng(), event.latLng.lat()); 33064 return Member_Photo_Form.createMarker($(".mod-map .marker-loc")); 33065 }); 33066 $(".mod-map .clear-marker").on('click', function (_e) { 33067 Member_Photo_Form.clearMarker($(".mod-map .marker-loc")); 33068 return false; 33069 }); 33070 $(".mod-map .set-center-position").on('click', function () { 33071 var latlng = Googlemaps_Map.map.getCenter(); 33072 var lat = Math.floor((latlng.lat() * 1000000)) / 1000000; 33073 var lng = Math.floor((latlng.lng() * 1000000)) / 1000000; 33074 $(".center-input").val(lng + "," + lat); 33075 return false; 33076 }); 33077 $(".mod-map .set-zoom-level").on('click', function () { 33078 $(".zoom-input").val(Googlemaps_Map.map.getZoom()); 33079 return false; 33080 }); 33081 google.maps.event.addListener(Googlemaps_Map.map, 'bounds_changed', function (_event) { 33082 var zoom = Googlemaps_Map.map.getZoom(); 33083 $('input[name="item[map_zoom_level]"]').val(zoom); 33084 }); 33085 }; 33086 33087 return Member_Photo_Form; 33088})(); 33089this.Openlayers_Map = (function () { 33090 function Openlayers_Map(canvas, opts) { 33091 if (opts == null) { 33092 opts = {}; 33093 } 33094 this.canvas = canvas; 33095 this.opts = opts; 33096 33097 if (opts["zoom"] && this.validateZoom(opts["zoom"])) { 33098 this.zoom = opts["zoom"]; 33099 } 33100 this.defaultZoom = Openlayers_Map.defaultZoom; 33101 33102 if (opts["center"] && this.validateLatLon(opts["center"][1], opts["center"][0])) { 33103 this.center = opts["center"]; 33104 } 33105 this.defaultCenter = Openlayers_Map.defaultCenter.reverse(); 33106 33107 this.showGoogleMapsSearch = false; 33108 if (opts["showGoogleMapsSearch"]) { 33109 this.showGoogleMapsSearch = opts["showGoogleMapsSearch"]; 33110 } 33111 33112 this.markerFeature = null; 33113 this.markerLayer = null; 33114 this.popup = null; 33115 this.markerIcon = Openlayers_Map.markerIcon; 33116 this.loadedLayers = []; 33117 this.render(); 33118 } 33119 33120 Openlayers_Map.defaultCenter = [36.204824, 138.252924]; 33121 33122 Openlayers_Map.defaultZoom = 10; 33123 33124 Openlayers_Map.markerIcon = "/assets/img/googlemaps/marker1.png"; 33125 33126 Openlayers_Map.clickIcon = "/assets/img/googlemaps/marker17.png"; 33127 33128 Openlayers_Map.prototype.getCenter = function () { 33129 return (this.center ? this.center : this.defaultCenter); 33130 }; 33131 33132 Openlayers_Map.prototype.getZoom = function () { 33133 return (this.zoom ? this.zoom : this.defaultZoom); 33134 }; 33135 33136 Openlayers_Map.prototype.render = function () { 33137 this.initMap(); 33138 this.initPopup(); 33139 if (this.opts["markers"]) { 33140 this.renderMarkers(this.opts["markers"]); 33141 } 33142 this.resize(); 33143 this.renderEvents(); 33144 }; 33145 33146 Openlayers_Map.prototype.createLayers = function (layerOpts) { 33147 var i, layer, layers, len, opts, projection, source, url; 33148 layers = []; 33149 for (i = 0, len = layerOpts.length; i < len; i++) { 33150 opts = layerOpts[i]; 33151 source = opts["source"]; 33152 url = opts["url"]; 33153 projection = opts["projection"]; 33154 layer = new ol.layer.Tile({ 33155 source: new ol.source[source]({ 33156 url: url, 33157 projection: projection 33158 }) 33159 }); 33160 layers.push(layer); 33161 } 33162 return layers; 33163 }; 33164 33165 Openlayers_Map.prototype.initMap = function () { 33166 var layerOpts; 33167 33168 layerOpts = this.opts['layers']; 33169 layerOpts || (layerOpts = [ 33170 { 33171 source: "XYZ", 33172 url: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png", 33173 projection: "EPSG:3857" 33174 } 33175 ]); 33176 this.map = new ol.Map({ 33177 target: this.canvas, 33178 renderer: ['canvas', 'dom'], 33179 layers: this.createLayers(layerOpts), 33180 controls: ol.control.defaults({ 33181 attributionOptions: { 33182 collapsible: false 33183 } 33184 }), 33185 view: new ol.View({ 33186 projection: "EPSG:3857", 33187 center: ol.proj.transform(this.getCenter(), "EPSG:4326", "EPSG:3857"), 33188 maxZoom: 18, 33189 zoom: this.getZoom() 33190 }), 33191 logo: true 33192 }); 33193 }; 33194 33195 Openlayers_Map.prototype.initPopup = function () { 33196 $("body").append('<div id="marker-popup"><button type="button" class="closer" aria-label="éãã"></button><div class="content marker"></div></div>'); 33197 this.popup = $('#marker-popup'); 33198 this.popup.hide(); 33199 this.popupOverlay = new ol.Overlay({ 33200 element: this.popup.get(0), 33201 autoPan: true, 33202 autoPanAnimation: { 33203 duration: 250 33204 } 33205 }); 33206 this.map.addOverlay(this.popupOverlay); 33207 this.map.on('pointermove', (function (_this) { 33208 return function (e) { 33209 var cursor, hit, pixel; 33210 if (e.dragging) { 33211 _this.popup.hide(); 33212 return; 33213 } 33214 pixel = _this.map.getEventPixel(e.originalEvent); 33215 hit = _this.map.hasFeatureAtPixel(pixel); 33216 cursor = hit ? 'pointer' : '';
33217 return _this.map.getTarget().style.cursor = cursor; 33218 }; 33219 })(this)); 33220 this.popup.find('.closer').on('click', (function (_this) { 33221 return function (_e) { 33222 _this.popupOverlay.setPosition(void 0); 33223 $(_this).blur(); 33224 return false; 33225 }; 33226 })(this)); 33227 }; 33228 33229 Openlayers_Map.prototype.showPopup = function (feature, coordinate) { 33230 var markerHtml; 33231 markerHtml = feature.get("markerHtml"); 33232 if (!markerHtml) { 33233 this.popup.hide(); 33234 return; 33235 } 33236 this.popup.find('.content').html(markerHtml); 33237 this.popup.show(); 33238 this.popupOverlay.setPosition(coordinate); 33239 }; 33240 33241 Openlayers_Map.prototype.renderEvents = function () { 33242 this.map.on('click', (function (_this) { 33243 return function (e) { 33244 var feature; 33245 feature = _this.map.forEachFeatureAtPixel(e.pixel, function (feature, _layer) { 33246 return feature; 33247 }); 33248 if (feature) { 33249 _this.showPopup(feature, e.coordinate); 33250 } 33251 }; 33252 })(this)); 33253 }; 33254 33255 Openlayers_Map.prototype.createMarkerStyle = function (iconSrc) { 33256 return new ol.style.Style({ 33257 image: new ol.style.Icon({ 33258 anchor: [0.5, 1], 33259 anchorXUnits: 'fraction', 33260 anchorYUnits: 'fraction', 33261 src: iconSrc 33262 }) 33263 }); 33264 }; 33265 33266 Openlayers_Map.prototype.setMarker = function (loc, opts) { 33267 var feature, iconSrc, pos, style; 33268 if (opts == null) { 33269 opts = {}; 33270 } 33271 iconSrc = this.markerIcon; 33272 if (opts['image']) { 33273 iconSrc = opts['image']; 33274 } 33275 style = this.createMarkerStyle(iconSrc); 33276 pos = [loc[1], loc[0]]; 33277 33278 feature = new ol.Feature({ 33279 geometry: new ol.geom.Point(ol.proj.transform(pos, "EPSG:4326", "EPSG:3857")), 33280 markerId: opts['id'], 33281 markerHtml: opts['html'], 33282 category: opts['category'] 33283 }); 33284 feature.setStyle(style); 33285 if (!this.markerLayer) { 33286 this.markerLayer = new ol.layer.Vector({ 33287 source: new ol.source.Vector({ 33288 features: [feature] 33289 }) 33290 }); 33291 this.map.addLayer(this.markerLayer); 33292 } else { 33293 this.markerLayer.getSource().addFeature(feature); 33294 } 33295 return feature; 33296 }; 33297 33298 Openlayers_Map.prototype.getMarker = function (markerId) { 33299 var ret, source; 33300 ret = null; 33301 if (!this.markerLayer) { 33302 return ret; 33303 } 33304 source = this.markerLayer.getSource(); 33305 source.forEachFeature(function (feature) { 33306 if (feature.get("markerId") === markerId) { 33307 return ret = feature; 33308 } 33309 }); 33310 return ret; 33311 }; 33312 33313 Openlayers_Map.prototype.getMarkers = function () { 33314 var features, source; 33315 source = this.markerLayer.getSource(); 33316 features = source.getFeatures(); 33317 return features; 33318 }; 33319 33320 Openlayers_Map.prototype.removeMarkers = function () { 33321 var source; 33322 if (this.popup) { 33323 this.popup.hide(); 33324 } 33325 if (this.markerLayer) { 33326 source = this.markerLayer.getSource(); 33327 source.forEachFeature(function (feature) { 33328 source.removeFeature(feature); 33329 }); 33330 } 33331 }; 33332 33333 Openlayers_Map.prototype.setCenter = function (pos) { 33334 return this.map.getView().setCenter(ol.proj.transform(pos, 'EPSG:4326', 'EPSG:3857')); 33335 }; 33336 33337 Openlayers_Map.prototype.setZoom = function (level) { 33338 return this.map.getView().setZoom(level); 33339 }; 33340 33341 Openlayers_Map.prototype.renderMarkers = function (markers) { 33342 markers.forEach(marker => { 33343 const iconSrc = marker['image'] || this.markerIcon || '/assets/img/openlayers/marker1.png'; 33344 const style = this.createMarkerStyle(iconSrc); 33345 33346 const name = marker['name']; 33347 const text = marker['text']; 33348 const html = marker['html']; 33349 const pos = [marker['loc'][0], marker['loc'][1]]; 33350 33351 let markerHtml = ""; 33352 if (html) { 33353 markerHtml = html; 33354 } else if (name || text) { 33355 const $markerContent = $("<div/>"); 33356 if (name) { 33357 $markerContent.append($("<p/>", { class: "marker-name" }).text(name)); 33358 } 33359 if (text) { 33360 $markerContent.append(renderMarkerExplanation(text)); 33361 } 33362 markerHtml = $markerContent.html(); 33363 } 33364 if (this.showGoogleMapsSearch) { 33365 markerHtml += Googlemaps_Map.getMapsSearchHtml(pos[1], pos[0]); 33366 } 33367 33368 const feature = new ol.Feature({ 33369 geometry: new ol.geom.Point(ol.proj.transform(pos, "EPSG:4326", "EPSG:3857")), 33370 markerId: marker['id'], 33371 markerHtml: markerHtml, 33372 iconSrc: iconSrc, 33373 category: marker['category'] 33374 }); 33375 33376 feature.setStyle(style); 33377 33378 if (!this.markerLayer) { 33379 this.markerLayer = new ol.layer.Vector({ 33380 source: new ol.source.Vector() 33381 }); 33382 this.map.addLayer(this.markerLayer); 33383 } 33384 this.markerLayer.getSource().addFeature(feature); 33385 }); 33386 }; 33387 33388 function renderMarkerExplanation(text) { 33389 const $markerExplanation = $("<div/>", { class: "marker-explanation" });
33390 text.split(/[\r\n]+/).forEach((line) => { 33391 let $element; 33392 if (/^https?:\/\//.test(line)) { 33393 $element = $("<p/>", { class: "marker-link" }).html($("<a />", { href: line }).text(line)); 33394 } else { 33395 $element = $("<p/>").text(line); 33396 } 33397 $markerExplanation.append($element); 33398 }); 33399 return $markerExplanation.html(); 33400 } 33401 33402 Openlayers_Map.prototype.resize = function () { 33403 if (!this.markerLayer) { 33404 return; 33405 } 33406 33407 var markerLength = this.markerLayer.getSource().getFeatures().length; 33408 if (markerLength >= 0) { 33409 // marker exists 33410 // set manually options and do fit 33411 var extent = this.markerLayer.getSource().getExtent(); 33412 this.map.getView().fit(extent, this.map.getSize()); 33413 33414 if (markerLength == 1) { 33415 this.map.getView().setZoom(this.getZoom()); 33416 } 33417 if (this.center) { 33418 this.setCenter(this.getCenter()); 33419 } 33420 if (this.zoom) { 33421 this.setZoom(this.getZoom()); 33422 } 33423 } else { 33424 // marker not exists 33425 // set manually or default options 33426 this.setCenter(this.getCenter()); 33427 this.setZoom(this.getZoom()); 33428 } 33429 }; 33430 33431 Openlayers_Map.prototype.loadLayer = function (url, olFormat) { 33432 var _self = this; 33433 var _url = url; 33434 var _olFormat = olFormat; 33435 33436 // https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html 33437 var vectorSource = new ol.source.Vector({ 33438 format: new _olFormat(), 33439 loader: function(extent, resolution, projection) { 33440 // var proj = projection.getCode(); 33441 var xhr = new XMLHttpRequest(); 33442 var onError = function() { 33443 console.warn("loadLayer error:" + url); 33444 } 33445 xhr.open('GET', _url); 33446 xhr.onerror = onError; 33447 xhr.onloadstart = function() { 33448 $(_self.canvas).hide(); 33449 } 33450 xhr.onload = function() { 33451 if (xhr.status == 200) { 33452 var feature = new _olFormat(). 33453 readFeatures(xhr.responseText, { featureProjection: projection }); 33454 vectorSource.addFeatures(feature); 33455 33456 extent = layer.getSource().getExtent(); 33457 $(_self.canvas).show(); 33458 _self.map.getView().fit(extent, _self.map.getSize()); 33459 if (_self.map.getView().getZoom() > _self.opts.zoom) { 33460 _self.map.getView().setZoom(_self.opts.zoom); 33461 } 33462 } else { 33463 onError(); 33464 } 33465 } 33466 xhr.send(); 33467 }, 33468 //strategy: ol.loadingstrategy.bbox 33469 }); 33470 var layer = new ol.layer.Vector({ 33471 source: vectorSource 33472 }); 33473 this.map.addLayer(layer); 33474 this.loadedLayers.push(layer); 33475 }; 33476 33477 Openlayers_Map.prototype.validateZoom = function (zoom) { 33478 if (zoom >= 3 && zoom <= 18) { 33479 return true; 33480 } else { 33481 return false; 33482 } 33483 }; 33484 33485 Openlayers_Map.prototype.validateLatLon = function (lat, lon) { 33486 if (lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) { 33487 return true; 33488 } else { 33489 return false; 33490 } 33491 }; 33492 33493 Openlayers_Map.prototype.removeloadedLayers = function () { 33494 var _self = this; 33495 $.each(this.loadedLayers, function () { 33496 _self.map.removeLayer(this); 33497 }); 33498 }; 33499 33500 return Openlayers_Map; 33501})(); 33502this.Openlayers_Facility_Search = (function () { 33503 function Openlayers_Facility_Search() { 33504 } 33505 33506 Openlayers_Facility_Search.render = function (selector, opts) { 33507 var canvas, map, overrided, slideSidebar; 33508 33509 //define function 33510 if (opts == null) { 33511 opts = {}; 33512 } 33513 slideSidebar = function (column) { 33514 var columnTop, indexTop, scrolled; 33515 columnTop = column.offset().top; 33516 indexTop = column.closest("#map-sidebar").offset().top; 33517 scrolled = column.closest("#map-sidebar").scrollTop(); 33518 column.closest("#map-sidebar").animate({ 33519 scrollTop: columnTop - indexTop + scrolled 33520 }, 'fast'); 33521 }; 33522 33523 //setup map 33524 canvas = $(selector)[0]; 33525 map = new Openlayers_Map(canvas, opts); 33526 33527 //setup markers 33528 overrided = map.showPopup; 33529 map.showPopup = function (feature, coordinate) { 33530 var column, dataId; 33531 overrided.call(map, feature, coordinate); 33532 $("#map-sidebar .column").removeClass("current"); 33533 dataId = feature.get("markerId"); 33534 column = $('#map-sidebar .column[data-id="' + dataId + '"]'); 33535 if (column.length) { 33536 column.addClass("current"); 33537 slideSidebar(column); 33538 } 33539 }; 33540 33541 //setup sidebar 33542 $("#map-sidebar .column .click-marker").on("click", function () { 33543 var coordinate, dataId, marker; 33544 dataId = parseInt($(this).closest(".column").attr("data-id")); 33545 $("#map-sidebar .column").removeClass("current"); 33546 marker = map.getMarker(dataId); 33547 if (!marker) { 33548 return false;
33549 } 33550 coordinate = marker.getGeometry().getCoordinates(); 33551 map.showPopup(marker, coordinate); 33552 return false; 33553 }); 33554 $(".filters a").on("click", function () { 33555 var dataIds, markers; 33556 if ($(this).hasClass("clicked")) { 33557 $(this).removeClass("clicked"); 33558 } else { 33559 $(this).addClass("clicked"); 33560 } 33561 dataIds = []; 33562 $(".filters a.clicked").each(function () { 33563 dataIds.push(parseInt($(this).attr("data-id"))); 33564 }); 33565 markers = map.getMarkers(); 33566 $.each(markers, function () { 33567 var category, column, dataId, iconSrc, style, visible; 33568 visible = false; 33569 category = this.get("category"); 33570 $.each(dataIds, function () { 33571 if ($.inArray(parseInt(this), category) >= 0) { 33572 visible = true; 33573 return false; 33574 } 33575 }); 33576 dataId = this.get("markerId"); 33577 column = $('#map-sidebar .column[data-id="' + dataId + '"]'); 33578 map.popup.hide(); 33579 if (visible) { 33580 iconSrc = this.get("iconSrc"); 33581 style = map.createMarkerStyle(iconSrc); 33582 this.setStyle(style); 33583 column.show(); 33584 } else { 33585 style = new ol.style.Style({}); 33586 this.setStyle(style); 33587 column.hide(); 33588 } 33589 }); 33590 33591 var resultSize = $('#map-sidebar .column:visible').length; 33592 $('.map-search-result .number').text(resultSize); 33593 return false; 33594 }); 33595 33596 //setup location filter 33597 $(".filters .focus").on("change", function () { 33598 var select; 33599 select = $(this); 33600 select.find("option:selected").each(function () { 33601 var loc, pos, zoomLevel; 33602 if ($(this).val() === "") { 33603 return false; 33604 } 33605 loc = $(this).val().split(","); 33606 zoomLevel = $(this).attr("data-zoom-level"); 33607 pos = [parseFloat(loc[1]), parseFloat(loc[0])]; 33608 map.setCenter(pos); 33609 if (zoomLevel) { 33610 map.setZoom(parseInt(zoomLevel)); 33611 } 33612 select.val(""); 33613 }); 33614 }); 33615 33616 //click selected category 33617 $('.map-search-condition .category-settings').each(function() { 33618 var settings = $(this).attr('data-category-settings'); 33619 if (!settings) return false; 33620 $('.map-search-index .filters a').each(function() { 33621 var $btn = $(this); 33622 if (!settings.includes($btn.text())) { 33623 $btn.click(); 33624 } 33625 }); 33626 }); 33627 }; 33628 33629 return Openlayers_Facility_Search; 33630})(); 33631 33632this.Openlayers_Member_Photo_Form = (function () { 33633 function Openlayers_Member_Photo_Form(canvas, opts) { 33634 if (opts == null) { 33635 opts = {}; 33636 } 33637 33638 this.canvas = canvas; 33639 this.opts = opts; 33640 33641 if (opts["zoom"] && this.validateZoom(opts["zoom"])) { 33642 this.zoom = opts["zoom"]; 33643 } 33644 this.defaultZoom = Openlayers_Map.defaultZoom; 33645 33646 if (opts["center"] && this.validateLatLon(opts["center"][1], opts["center"][0])) { 33647 this.center = opts["center"]; 33648 } 33649 this.defaultCenter = Openlayers_Map.defaultCenter.reverse(); 33650 33651 this.markerFeature = null; 33652 this.markerLayer = null; 33653 33654 this.popup = null; 33655 this.maxPointForm = 10; 33656 this.deleteMessage = "ãã¼ã«ã¼ãåé¤ãã¦ããããã§ããï¼"; 33657 this.setExifMessage = "ç»åã«ä½ç½®æ å ±ãå«ã¾ãã¦ãã¾ããä½ç½®æ å ±ãå°å³ã«è¨å®ãã¾ããï¼"; 33658 this.dataID = 0; 33659 this.markerIcon = Openlayers_Map.markerIcon; 33660 this.clickIcon = Openlayers_Map.clickIcon; 33661 this.clickMarkerId = null; 33662 this.render(); 33663 } 33664 33665 Openlayers_Member_Photo_Form.prototype.getMapLoc = function (ele) { 33666 var latlon; 33667 latlon = ele.val().split(','); 33668 return [parseFloat(latlon[0]), parseFloat(latlon[1])]; 33669 }; 33670 33671 Openlayers_Member_Photo_Form.prototype.setMapLoc = function (ele, lat, lon) { 33672 lat = Math.ceil(lat * Math.pow(10, 6)) / Math.pow(10, 6); 33673 lon = Math.ceil(lon * Math.pow(10, 6)) / Math.pow(10, 6); 33674 ele.val(lat.toFixed(6) + "," + lon.toFixed(6)); 33675 }; 33676 33677 Openlayers_Member_Photo_Form.prototype.render = function () { 33678 this.initMap(); 33679 this.renderMarkers(); 33680 this.resize(); 33681 return this.renderEvents(); 33682 }; 33683 33684 Openlayers_Member_Photo_Form.prototype.createLayers = function (layerOpts) { 33685 var j, layer, layers, len, opts, projection, source, url; 33686 layers = []; 33687 for (j = 0, len = layerOpts.length; j < len; j++) { 33688 opts = layerOpts[j]; 33689 source = opts["source"]; 33690 url = opts["url"]; 33691 projection = opts["projection"]; 33692 layer = new ol.layer.Tile({ 33693 source: new ol.source[source]({ 33694 url: url, 33695 projection: projection 33696 }) 33697 }); 33698 layers.push(layer); 33699 } 33700 return layers; 33701 }; 33702 33703 Openlayers_Member_Photo_Form.prototype.initMap = function () { 33704 var layerOpts; 33705 33706 layerOpts = this.opts['layers']; 33707 layerOpts || (layerOpts = [ 33708 { 33709 source: "XYZ", 33710 url: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png", 33711 projection: "EPSG:3857" 33712 } 33713 ]); 33714 33715 this.map = new ol.Map({ 33716 target: this.canvas, 33717 renderer: ['canvas', 'dom'], 33718 layers: this.createLayers(layerOpts), 33719 controls: ol.control.defaults({ 33720 attributionOptions: { 33721 collapsible: false 33722 } 33723 }), 33724 view: new ol.View({ 33725 projection: "EPSG:3857", 33726 center: ol.proj.transform(this.getCenter(), "EPSG:4326", "EPSG:3857"), 33727 minZoom: 3, 33728 maxZoom: 18, 33729 zoom: this.getZoom() 33730 }), 33731 logo: false 33732 }); 33733 }; 33734 33735 Openlayers_Member_Photo_Form.prototype.getCenter = function () { 33736 return (this.center ? this.center : this.defaultCenter); 33737 }; 33738 33739 Openlayers_Member_Photo_Form.prototype.getZoom = function () { 33740 return (this.zoom ? this.zoom : this.defaultZoom); 33741 }; 33742 33743 Openlayers_Member_Photo_Form.prototype.setCenter = function (pos) { 33744 return this.map.getView().setCenter(ol.proj.transform(pos, 'EPSG:4326', 'EPSG:3857')); 33745 }; 33746 33747 Openlayers_Member_Photo_Form.prototype.setZoom = function (level) { 33748 return this.map.getView().setZoom(level); 33749 }; 33750 33751 Openlayers_Member_Photo_Form.prototype.renderMarkers = function () { 33752 $(".mod-map .marker").each((function (_this) { 33753 return function (i, e) { 33754 var loc; 33755 $(e).attr("data-id", _this.dataID); 33756 if ($(e).find(".marker-loc").val()) { 33757 loc = _this.getMapLoc($(e).find(".marker-loc")); 33758 _this.setMarker(loc, { 33759 id: parseInt(_this.dataID) 33760 }); 33761 } 33762 _this.dataID += 1; 33763 }; 33764 })(this)); 33765 }; 33766 33767 Openlayers_Member_Photo_Form.prototype.setMarker = function (loc, opts) { 33768 var feature, pos, ref, ref1, ref2, src, style; 33769 if (opts == null) { 33770 opts = {}; 33771 } 33772 src = this.markerIcon; 33773 if (opts['image']) { 33774 src = opts['image']; 33775 } 33776 style = new ol.style.Style({ 33777 image: new ol.style.Icon({ 33778 anchor: [0.5, 1], 33779 anchorXUnits: 'fraction', 33780 anchorYUnits: 'fraction', 33781 src: src 33782 }) 33783 }); 33784 pos = [loc[0], loc[1]]; 33785 feature = new ol.Feature({ 33786 geometry: new ol.geom.Point(ol.proj.transform(pos, "EPSG:4326", "EPSG:3857")), 33787 markerId: (ref = opts['id']) != null ? ref : null, 33788 markerHtml: (ref1 = opts['html']) != null ? ref1 : null, 33789 category: (ref2 = opts['category']) != null ? ref2 : null 33790 }); 33791 feature.setStyle(style); 33792 if (!this.markerLayer) { 33793 this.markerLayer = new ol.layer.Vector({ 33794 source: new ol.source.Vector({ 33795 features: [feature] 33796 }) 33797 }); 33798 this.map.addLayer(this.markerLayer); 33799 } else { 33800 this.markerLayer.getSource().addFeature(feature); 33801 } 33802 return feature; 33803 }; 33804 33805 Openlayers_Member_Photo_Form.prototype.getMarker = function (markerId) { 33806 var ret, source; 33807 ret = null; 33808 if (!this.markerLayer) { 33809 return ret; 33810 } 33811 source = this.markerLayer.getSource(); 33812 source.forEachFeature(function (feature) { 33813 if (feature.get("markerId") === markerId) { 33814 return ret = feature; 33815 } 33816 }); 33817 return ret; 33818 }; 33819 33820 Openlayers_Member_Photo_Form.prototype.removeMarker = function (markerId) { 33821 var feature, source; 33822 feature = this.getMarker(markerId); 33823 if (feature) { 33824 source = this.markerLayer.getSource();
33825 source.removeFeature(feature); 33826 return true; 33827 } 33828 return false; 33829 }; 33830 33831 Openlayers_Member_Photo_Form.prototype.renderEvents = function () { 33832 this.map.on('click', (function (_this) { 33833 return function (e) { 33834 var pos = ol.proj.transform(e.coordinate, "EPSG:3857", "EPSG:4326"); 33835 while (pos[0] < 180) { 33836 pos[0] += 360; 33837 } 33838 while (pos[0] > 180) { 33839 pos[0] -= 360; 33840 } 33841 _this.setMapLoc($(".mod-map .clicked"), pos[0], pos[1]); 33842 _this.setMapLoc($(".mod-map .marker-loc"), pos[0], pos[1]); 33843 return _this.createMarker($(".mod-map .marker-loc")); 33844 }; 33845 })(this)); 33846 this.map.getView().on("propertychange", function(e) { 33847 if (e.key === 'resolution') { 33848 var zoom = this.getZoom(); 33849 $('input[name="item[map_zoom_level]"]').val(zoom); 33850 } 33851 }); 33852 $(".mod-map .set-center-position").on('click', (function (_this) { 33853 return function () { 33854 var latlng = ol.proj.transform(_this.map.getView().getCenter(), 'EPSG:3857', 'EPSG:4326'); 33855 var lat = Math.floor((latlng[1] * 1000000)) / 1000000; 33856 var lng = Math.floor((latlng[0] * 1000000)) / 1000000; 33857 $(".center-input").val(lng + "," + lat); 33858 return false; 33859 }; 33860 })(this)); 33861 $(".mod-map .set-zoom-level").on('click', (function (_this) { 33862 return function () { 33863 $(".zoom-input").val(_this.map.getView().getZoom()); 33864 return false; 33865 }; 33866 })(this)); 33867 return $(".mod-map .clear-marker").on('click', (function (_this) { 33868 return function (_e) { 33869 _this.clearMarker($(".mod-map .marker-loc")); 33870 return false; 33871 }; 33872 })(this)); 33873 }; 33874 33875 Openlayers_Member_Photo_Form.prototype.createMarker = function (ele) { 33876 var dataId; 33877 dataId = 0; 33878 this.removeMarker(dataId); 33879 return this.setMarker(this.getMapLoc(ele), { 33880 id: dataId 33881 }); 33882 }; 33883 33884 Openlayers_Member_Photo_Form.prototype.clearMarker = function (ele) { 33885 var dataId; 33886 dataId = 0; 33887 if (ele.val() !== "") { 33888 if (confirm(this.deleteMessage)) { 33889 this.removeMarker(dataId); 33890 ele.val(""); 33891 } 33892 } else { 33893 this.removeMarker(dataId); 33894 } 33895 }; 33896 33897 Openlayers_Member_Photo_Form.prototype.setExifLatLng = function (selector) { 33898 return $(selector).on("change", (function (_this) { 33899 return function (e) { 33900 var self; 33901 if (!e.target.files[0]) { 33902 return; 33903 } 33904 self = _this; 33905 return EXIF.getData(e.target.files[0], function () { 33906 var lat, latRef, lon, lonRef; 33907 lat = EXIF.getTag(this, 'GPSLatitude'); 33908 lon = EXIF.getTag(this, 'GPSLongitude'); 33909 latRef = EXIF.getTag(this, 'GPSLatitudeRef') || "N"; 33910 lonRef = EXIF.getTag(this, 'GPSLongitudeRef') || "W"; 33911 if (!(lat && lon)) { 33912 return false; 33913 } 33914 if (!confirm(self.setExifMessage)) { 33915 return false; 33916 } 33917 latRef = latRef === "N" ? 1 : -1; 33918 lonRef = lonRef === "W" ? -1 : 1; 33919 lat = (lat[0] + (lat[1] / 60) + (lat[2] / 3600)) * latRef; 33920 lon = (lon[0] + (lon[1] / 60) + (lon[2] / 3600)) * lonRef; 33921 $(".mod-map .clicked").val([lat, lon].join()); 33922 $(".mod-map .marker-loc").val([lat, lon].join()); 33923 self.createMarker($(".mod-map .marker-loc")); 33924 return self.setCenter([lat, lon]); 33925 }); 33926 }; 33927 })(this)); 33928 }; 33929 33930 Openlayers_Member_Photo_Form.prototype.resize = function () { 33931 if (!this.markerLayer) { 33932 return; 33933 } 33934 33935 var markerLength = this.markerLayer.getSource().getFeatures().length; 33936 if (markerLength >= 0) { 33937 // marker exists 33938 // set manually options and do fit 33939 var extent = this.markerLayer.getSource().getExtent(); 33940 this.map.getView().fit(extent, this.map.getSize()); 33941 this.map.getView().setZoom(this.getZoom()); 33942 33943 if (this.center) { 33944 this.setCenter(this.getCenter()); 33945 } 33946 if (this.zoom) { 33947 this.setZoom(this.getZoom()); 33948 } 33949 } else { 33950 // marker not exists 33951 // set manually or default options 33952 this.setCenter(this.getCenter()); 33953 this.setZoom(this.getZoom()); 33954 } 33955 }; 33956 33957 Openlayers_Member_Photo_Form.prototype.validateZoom = function (zoom) { 33958 if (zoom >= 3 && zoom <= 18) { 33959 return true; 33960 } else { 33961 return false;
33962 } 33963 }; 33964 33965 Openlayers_Member_Photo_Form.prototype.validateLatLon = function (lat, lon) { 33966 if (lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) { 33967 return true; 33968 } else { 33969 return false; 33970 } 33971 }; 33972 33973 return Openlayers_Member_Photo_Form; 33974})(); 33975this.Openlayers_Dataset_Map = (function () { 33976 function Openlayers_Dataset_Map() { 33977 } 33978 33979 Openlayers_Dataset_Map.map = null; 33980 Openlayers_Dataset_Map.map_points = null; 33981 33982 Openlayers_Dataset_Map.render = function (selector, opts) { 33983 $(".dataset-search a#ajax-search").colorbox({ 33984 fixed: true, 33985 width: "90%", 33986 height: "90%" 33987 }); 33988 var canvas = $(selector)[0]; 33989 Openlayers_Dataset_Map.map = new Openlayers_Map(canvas, opts); 33990 } 33991 33992 Openlayers_Dataset_Map.selectItem = function (ele) { 33993 var dataset_id = $(ele).attr("data-id"); 33994 var item = $(ele).find(".selected-item").clone(false); 33995 33996 // remove renderInBox class 33997 $(item).find("a").removeClass("cboxElement"); 33998 33999 $(item).find('[name="resource_id"]').each(function (_idx) { 34000 var resource_id = $(this).val(); 34001 34002 $(this).data("map_points", Openlayers_Dataset_Map.map_points[dataset_id][resource_id]); 34003 34004 // checkbox 34005 $(this).on("click", function () { 34006 Openlayers_Dataset_Map.setMarkers(); 34007 Openlayers_Dataset_Map.map.resize(); 34008 }); 34009 34010 // select marker image 34011 $(this).closest("li").find(".marker-image-form .select-marker-image").on("click", function () { 34012 var form = $(this).closest(".marker-image-form"); 34013 var images = $(form).find(".images"); 34014 34015 $(".marker-image-form .images").hide(); 34016 34017 images.show(); 34018 $("body").not(this).one("click", function (_e) { 34019 images.hide(); 34020 }); 34021 34022 return false; 34023 }); 34024 34025 // marker images 34026 $(this).closest("li").find(".marker-image-form .images .image").on("click", function () { 34027 var form = $(this).closest(".marker-image-form"); 34028 var images = $(form).find(".images"); 34029 var thumb = $(form).find(".marker-thumb img"); 34030 var src = $(this).find('img').andSelf("img").attr("src"); 34031 34032 form.data("src", src); 34033 thumb.attr("src", src); 34034 images.hide(); 34035 34036 Openlayers_Dataset_Map.setMarkers(); 34037 return false; 34038 }); 34039 $(this).closest("li").find(".marker-image-form .marker-thumb").html($('<img />', { src: Openlayers_Dataset_Map.map.markerIcon })); 34040 }); 34041 34042 // deselect button 34043 $(item).find(".deselect").on("click", function (_e) { 34044 $(this).closest(".selected-item").remove(); 34045 Openlayers_Dataset_Map.setMarkers(); 34046 Openlayers_Dataset_Map.map.resize(); 34047 return false; 34048 }); 34049 34050 // append and remove 34051 item.show(); 34052 $(".dataset-search .selected-dataset").append(item); 34053 var length = $(".dataset-search .selected-dataset .selected-item").length - 10; 34054 for (var i = 0; i < length; i++) { 34055 $(".dataset-search .selected-dataset .selected-item:first").remove(); 34056 } 34057 34058 return item; 34059 } 34060 34061 Openlayers_Dataset_Map.setMarkers = function () { 34062 Openlayers_Dataset_Map.map.removeMarkers(); 34063 Openlayers_Dataset_Map.map.removeloadedLayers(); 34064 $(".dataset-search .selected-item .set-markers:checked").each(function () { 34065 var map_points = $(this).data("map_points"); 34066 var form = $(this).closest("li").find(".marker-image-form"); 34067 34068 if (form && form.data("src")) { 34069 $.each(map_points["points"], function(){ 34070 this["image"] = form.data("src"); 34071 }); 34072 } 34073 34074 if (map_points["points"]) { 34075 Openlayers_Dataset_Map.map.renderMarkers(map_points["points"]); 34076 } else if (map_points["format"] == "KML") { 34077 Openlayers_Dataset_Map.map.loadLayer(map_points["url"], ol.format.KML); 34078 } else if (map_points["format"] == "GEOJSON") { 34079 Openlayers_Dataset_Map.map.loadLayer(map_points["url"], ol.format.GeoJSON); 34080 } 34081 }); 34082 }; 34083 34084 Openlayers_Dataset_Map.toggleSelectButton = function () { 34085 if ($(".search-ui .items input:checked").size() > 0) { 34086 $(".select-items").parent("div").show(); 34087 } else { 34088 $(".select-items").parent("div").hide(); 34089 } 34090 }; 34091 34092 Openlayers_Dataset_Map.modal = function (map_points) { 34093 Openlayers_Dataset_Map.map_points = map_points; 34094 34095 // form search event 34096 $(".search-ui-form form.search").on("submit", function (_e) { 34097 $(this).ajaxSubmit({ 34098 url: $(this).attr("action"), 34099 success: function (data) { 34100 return $("#cboxLoadedContent").html(data); 34101 }, 34102 error: function (_data, _status) { 34103 return alert("== Error =="); 34104 } 34105 }); 34106 return false;
34107 }); 34108 34109 // select item event 34110 $(".search-ui a.select-item").on("click", function (_e) { 34111 var tr = $(this).closest("tr"); 34112 var article = Openlayers_Dataset_Map.selectItem(tr); 34113 34114 $.colorbox.close(); 34115 $(article).find(".set-markers").trigger("click"); 34116 34117 return false; 34118 }); 34119 34120 // select items event 34121 $(".search-ui-select .select-items").on("click", function (_e) { 34122 $(".search-ui .items .set-dataset:checked").each(function () { 34123 var tr = $(this).closest("tr"); 34124 Openlayers_Dataset_Map.selectItem(tr); 34125 }); 34126 $.colorbox.close(); 34127 return false; 34128 }); 34129 34130 // list-head checkbox event 34131 $(".search-ui .list-head input:checkbox").on("change", function (_e) { 34132 var chk = $(this).prop('checked'); 34133 $('.search-ui .list-item').each(function () { 34134 $(this).toggleClass('checked', chk); 34135 $(this).find('.set-dataset').prop('checked', chk); 34136 }); 34137 }); 34138 34139 // toggle select items button event 34140 $(".search-ui").on("change", function (_e) { 34141 Openlayers_Dataset_Map.toggleSelectButton(); 34142 }); 34143 34144 // disable selected items in modal 34145 $(".dataset-search .selected-dataset .selected-item").each(function () { 34146 var id = $(this).attr("data-id"); 34147 var tr = $(".items [data-id='" + id + "']"); 34148 tr.find("input[type=checkbox]").remove(); 34149 34150 var item = tr.find(".select-item").html(); 34151 tr.find(".select-item").replaceWith("<span class='select-item' style='color: #888'>" + item + "</span>"); 34152 }); 34153 } 34154 34155 return Openlayers_Dataset_Map; 34156})(); 34157/*! 34158 * Chart.js v4.5.0
vendor: 23,253 bytes, lines 34158-34169
34158 34159 * https://www.chartjs.org 34160 * (c) 2025 Chart.js Contributors 34161 * Released under the MIT License 34162 */ 34163!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,get Colors(){return Jo},get Decimation(){return ta},get Filler(){return ba},get Legend(){return Ma},get SubTitle(){return Pa},get Title(){return ka},get Tooltip(){return Na}});function e(){}const i=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,e){return a(t)?t:e}function l(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,c=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,s){let a,r,l;if(n(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(o(t))for(l=Object.keys(t),r=l.length,a=0;a<r;a++)e.call(i,t[l[a]],l[a])}function f(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function g(t){if(n(t))return t.map(g);if(o(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=g(t[i[n]]);return e}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,e,i,s){if(!p(t))return;const n=e[t],a=i[t];o(n)&&o(a)?x(n,a,s):e[t]=g(a)}function x(t,e,i){const s=n(e)?e:[e],a=s.length;if(!o(t))return t;const r=(i=i||{}).merger||m;let l;for(let e=0;e<a;++e){if(l=s[e],!o(l))continue;const n=Object.keys(l);for(let e=0,s=n.length;e<s;++e)r(n[e],t,l,i)}return t}function b(t,e){return x(t,e,{merger:_})}function _(t,e,i){if(!p(t))return;const s=e[t],n=i[t];o(s)&&o(n)?b(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=g(n))}const y={"":t=>t,x:t=>t.x,y:t=>t.y};function v(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function M(t,e){const i=y[e]||(y[e]=function(t){const e=v(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const C=Math.PI,O=2*C,A=O+C,T=Number.POSITIVE_INFINITY,L=C/180,E=C/2,R=C/4,I=2*C/3,z=Math.log10,F=Math.sign;function V(t,e,i){return Math.abs(t-e)<i}function B(t){const e=Math.round(t);t=V(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(z(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function W(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function N(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function H(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function j(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function $(t){return t*(C/180)}function Y(t){return t*(180/C)}function U(t){if(!a(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function X(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*C&&(o+=O),{angle:o,distance:n}}function q(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+A)%O-C}function G(t){return(t%O+O)%O}function J(t,e,i,s){const n=G(t),o=G(e),a=G(i),r=G(o-n),l=G(a-n),h=G(n-o),c=G(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function Z(t,e,i){return Math.max(e,Math.min(i,t))}function Q(t){return Z(t,-32768,32767)}function tt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const it=(t,e,i,s)=>et(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),st=(t,e,i)=>et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}const ot=["push","pop","shift","splice","unshift"];function at(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ot.forEach((e=>{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function rt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(ot.forEach((e=>{delete t[e]})),delete t._chartjs)}function lt(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const ht="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function ct(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,ht.call(window,(()=>{s=!1,t.apply(e,i)})))}}function dt(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const ut=t=>"start"===t?"left":"end"===t?"right":"center",ft=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,gt=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function pt(t,e,i){const n=e.length;let o=0,a=n;if(t._sorted){const{iScale:r,vScale:l,_parsed:h}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,d=r.axis,{min:u,max:f,minDefined:g,maxDefined:p}=r.getUserBounds();if(g){if(o=Math.min(it(h,d,u).lo,i?n:it(e,d,r.getPixelForValue(u)).lo),c){const t=h.slice(0,o+1).reverse().findIndex((t=>!s(t[l.axis])));o-=Math.max(0,t)}o=Z(o,0,n-1)}if(p){let t=Math.max(it(h,r.axis,f,!0).hi+1,i?0:it(e,d,r.getPixelForValue(f),!0).hi+1);if(c){const e=h.slice(t-1).findIndex((t=>!s(t[l.axis])));t+=Math.max(0,e)}a=Z(t,o,n)-o}else a=n-o}return{start:o,count:a}}function mt(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}class xt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=ht.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var bt=new xt; 34164/*! 34165 * @kurkle/color v0.3.2 34166 * https://github.com/kurkle/color#readme 34167 * (c) 2023 Jukka Kurkela 34168 * Released under the MIT License 34169 */function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function zt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function Ft(t,e,i){return zt(Lt,t,e,i)}function Vt(t){return(t%360+360)%360}function Bt(t){const e=Tt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?vt(+e[5]):Mt(+e[5]));const n=Vt(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return zt(Rt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return zt(Et,t,e,i)}(n,o,a):Ft(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const Wt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Nt={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Ht;function jt(t){Ht||(Ht=function(){const t={},e=Object.keys(Nt),i=Object.keys(Wt);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,Wt[o]);o=parseInt(Nt[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),Ht.transparent=[0,0,0,0]);const e=Ht[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const $t=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,e,i){if(t){let s=It(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Ft(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function qt(t,e){return t?Object.assign(e||{},t):t}function Kt(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Mt(t[3]))):(e=qt(t,{r:0,g:0,b:0,a:1})).a=Mt(e.a),e}function Gt(t){return"r"===t.charAt(0)?function(t){const e=$t.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?vt(t):yt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?vt(i):yt(i,0,255)),s=255&(e[4]?vt(s):yt(s,0,255)),n=255&(e[6]?vt(n):yt(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):Bt(t)}class Jt{constructor(t){if(t instanceof Jt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=Kt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*St[s[1]],g:255&17*St[s[2]],b:255&17*St[s[3]],a:5===o?17*St[s[4]]:255}:7!==o&&9!==o||(n={r:St[s[1]]<<4|St[s[2]],g:St[s[3]]<<4|St[s[4]],b:St[s[5]]<<4|St[s[6]],a:9===o?St[s[7]]<<4|St[s[8]]:255})),i=n||jt(t)||Gt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=qt(this._rgb);return t&&(t.a=wt(t.a)),t}set rgb(t){this._rgb=Kt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?At(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=It(t),i=e[0],s=kt(e[1]),n=kt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${wt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Ut(wt(t.r)),n=Ut(wt(t.g)),o=Ut(wt(t.b));return{r:Mt(Yt(s+i*(Ut(wt(e.r))-s))),g:Mt(Yt(n+i*(Ut(wt(e.g))-n))),b:Mt(Yt(o+i*(Ut(wt(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Jt(this.rgb)}alpha(t){return this._rgb.a=Mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=_t(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xt(this._rgb,2,t),this}darken(t){return Xt(this._rgb,2,-t),this}saturate(t){return Xt(this._rgb,1,t),this}desaturate(t){return Xt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=It(t);i[0]=Vt(i[0]+e),i=Ft(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Zt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Qt(t){return Zt(t)?t:new Jt(t)}function te(t){return Zt(t)?t:new Jt(t).saturate(.5).darken(.1).hexString()}const ee=["x","y","borderWidth","radius","tension"],ie=["color","borderColor","backgroundColor"];const se=new Map;function ne(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=se.get(i);return s||(s=new Intl.NumberFormat(t,e),se.set(i,s)),s}(e,i).format(t)}const oe={values:t=>n(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=z(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ne(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(z(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?oe.numeric.call(this,t,e,i):""}};var ae={formatters:oe};const re=Object.create(null),le=Object.create(null);function he(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function ce(t,e,i){return"string"==typeof e?x(he(t,e),i):x(he(t,""),e)}class de{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>te(e.backgroundColor),this.hoverBorderColor=(t,e)=>te(e.borderColor),this.hoverColor=(t,e)=>te(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ce(this,t,e)}get(t){return he(this,t)}describe(t,e){return ce(le,t,e)}override(t,e){return ce(re,t,e)}route(t,e,i,s){const n=he(this,t),a=he(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=a[s];return o(t)?Object.assign({},e,t):l(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var ue=new de({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ie},numbers:{type:"number",properties:ee}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ae.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ge(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function pe(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const me=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function xe(t,e){return me(t).getPropertyValue(e)}const be=["top","right","bottom","left"];function _e(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=be[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const ye=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function ve(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=me(i),o="border-box"===n.boxSizing,a=_e(n,"padding"),r=_e(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(ye(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const Me=t=>Math.round(10*t)/10;function we(t,e,i,s){const n=me(t),o=_e(n,"margin"),a=pe(n.maxWidth,t,"clientWidth")||T,r=pe(n.maxHeight,t,"clientHeight")||T,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=t&&ge(t);if(o){const t=o.getBoundingClientRect(),a=me(o),r=_e(a,"border","width"),l=_e(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=pe(a.maxWidth,o,"clientWidth"),n=pe(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||T,maxHeight:n||T}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=_e(n,"border","width"),e=_e(n,"padding");h-=e.width+t.width,c-=e.height+t.height}h=Math.max(0,h-o.width),c=Math.max(0,s?h/s:c-o.height),h=Me(Math.min(h,a,l.maxWidth)),c=Me(Math.min(c,r,l.maxHeight)),h&&!c&&(c=Me(h/2));return(void 0!==e||void 0!==i)&&s&&l.height&&c>l.height&&(c=l.height,h=Me(Math.floor(c*s))),{width:h,height:c}}function ke(t,e,i){const s=e||1,n=M
34169ath.floor(t.height*s),o=Math.floor(t.width*s);t.height=Math.floor(t.height),t.width=Math.floor
vendor: 68,851 bytes, line 34169
34169(t.width);const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const Se=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};fe()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function Pe(t,e){const i=xe(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function De(t){return!t||s(t.size)||s(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Ce(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function Oe(t,e,i,s){let o=(s=s||{}).data=s.data||{},a=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(o=s.data={},a=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let r=0;const l=i.length;let h,c,d,u,f;for(h=0;h<l;h++)if(u=i[h],null==u||n(u)){if(n(u))for(c=0,d=u.length;c<d;c++)f=u[c],null==f||n(f)||(r=Ce(t,o,a,r,f))}else r=Ce(t,o,a,r,u);t.restore();const g=a.length/2;if(g>i.length){for(h=0;h<g;h++)delete o[a[h]];a.splice(0,g)}return r}function Ae(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function Te(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Le(t,e,i,s){Ee(t,e,i,s,null)}function Ee(t,e,i,s,n){let o,a,r,l,h,c,d,u;const f=e.pointStyle,g=e.rotation,p=e.radius;let m=(g||0)*L;if(f&&"object"==typeof f&&(o=f.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,s),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),void t.restore();if(!(isNaN(p)||p<=0)){switch(t.beginPath(),f){default:n?t.ellipse(i,s,n/2,p,0,0,O):t.arc(i,s,p,0,O),t.closePath();break;case"triangle":c=n?n/2:p,t.moveTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=I,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=I,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":h=.516*p,l=p-h,a=Math.cos(m+R)*l,d=Math.cos(m+R)*(n?n/2-h:l),r=Math.sin(m+R)*l,u=Math.sin(m+R)*(n?n/2-h:l),t.arc(i-d,s-r,h,m-C,m-E),t.arc(i+u,s-a,h,m-E,m),t.arc(i+d,s+r,h,m,m+E),t.arc(i-u,s+a,h,m+E,m+C),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,c=n?n/2:l,t.rect(i-c,s-l,2*c,2*l);break}m+=R;case"rectRot":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+u,s-a),t.lineTo(i+d,s+r),t.lineTo(i-u,s+a),t.closePath();break;case"crossRot":m+=R;case"cross":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"star":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a),m+=R,d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"line":a=n?n/2:Math.cos(m)*p,r=Math.sin(m)*p,t.moveTo(i-a,s-r),t.lineTo(i+a,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function Re(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Ie(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function ze(t){t.restore()}function Fe(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Ve(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function Be(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,h=i+o.actualBoundingBoxDescent,c=n.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function We(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Ne(t,e,i,o,a,r={}){const l=n(e)?e:[e],h=r.strokeWidth>0&&""!==r.strokeColor;let c,d;for(t.save(),t.font=a.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),s(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,r),c=0;c<l.length;++c)d=l[c],r.backdrop&&We(t,r.backdrop),h&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),s(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(d,i,o,r.maxWidth)),t.fillText(d,i,o,r.maxWidth),Be(t,i,o,d,r),o+=Number(a.lineHeight);t.restore()}function He(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,1.5*C,C,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,C,E,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,E,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-E,!0),t.lineTo(i+a.topLeft,s)}function je(t,e=[""],i,s,n=(()=>t[0])){const o=i||t;void 0===s&&(s=ti("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:s,_getTarget:n,override:i=>je([i,...t],e,o,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>qe(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=ti(Ue(o,t),i),void 0!==n)return Xe(t,n)?Ze(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>ei(t).includes(e),ownKeys:t=>ei(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function $e(t,e,i,s){const a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ye(t,s),setContext:e=>$e(t,e,i,s),override:n=>$e(t.override(n),e,i,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>qe(t,e,(()=>function(t,e,i){const{_proxy:s,_context:a,_subProxy:r,_descriptors:l}=t;let h=s[e];S(h)&&l.isScriptable(e)&&(h=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||s);r.delete(t),Xe(t,l)&&(l=Ze(n._scopes,n,t,l));return l}(e,h,t,i));n(h)&&h.length&&(h=function(t,e,i,s){const{_proxy:n,_context:a,_subProxy:r,_descriptors:l}=i;if(void 0!==a.index&&s(t))return e[a.index%e.length];if(o(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const o of i){const i=Ze(s,n,t,o);e.push($e(i,a,r&&r[t],l))}}return e}(e,h,t,l.isIndexable));Xe(e,h)&&(h=$e(h,a,r&&r[e],l));return h}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Ye(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:S(i)?i:()=>i,isIndexable:S(s)?s:()=>s}}const Ue=(t,e)=>t?t+w(e):e,Xe=(t,e)=>o(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function qe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function Ke(t,e,i){return S(t)?t(e,i):t}const Ge=(t,e)=>!0===t?e:"string"==typeof t?M(e,t):void 0;function Je(t,e,i,s,n){for(const o of e){const e=Ge(i,o);if(e){t.add(e);const o=Ke(e._fallback,i,n);if(void 0!==o&&o!==i&&o!==s)return o}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}function Ze(t,e,i,s){const a=e._rootScopes,r=Ke(e._fallback,i,s),l=[...t,...a],h=new Set;h.add(s);let c=Qe(h,l,i,r||i,s);return null!==c&&((void 0===r||r===i||(c=Qe(h,l,r,c,s),null!==c))&&je(Array.from(h),[""],a,r,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const a=s[e];if(n(a)&&o(i))return i;return a||{}}(e,i,s))))}function Qe(t,e,i,s,n){for(;i;)i=Je(t,e,i,s,n);return i}function ti(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function ei(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ii(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={r:n.parse(M(c,o),h)};return a}const si=Number.EPSILON||1e-14,ni=(t,e)=>e<t.length&&!t[e].skip&&t[e],oi=t=>"x"===t?"y":"x";function ai(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=q(o,n),l=q(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ri(t,e="x"){const i=oi(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=ni(t,0);for(a=0;a<s;++a)if(r=l,l=h,h=ni(t,a+1),l){if(h){const t=h[e]-l[e];n[a]=0!==t?(h[i]-l[i])/t:0}o[a]=r?h?F(n[a-1])!==F(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,i){const s=t.length;let n,o,a,r,l,h=ni(t,0);for(let c=0;c<s-1;++c)l=h,h=ni(t,c+1),l&&h&&(V(e[c],0,si)?i[c]=i[c+1]=0:(n=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=n*a*e[c],i[c+1]=o*a*e[c])))}(t,n,o),function(t,e,i="x"){const s=oi(i),n=t.length;let o,a,r,l=ni(t,0);for(let h=0;h<n;++h){if(a=r,r=l,l=ni(t,h+1),!r)continue;const n=r[i],c=r[s];a&&(o=(n-a[i])/3,r[`cp1${i}`]=n-o,r[`cp1${s}`]=c-o*e[h]),l&&(o=(l[i]-n)/3,r[`cp2${i}`]=n+o,r[`cp2${s}`]=c+o*e[h])}}(t,o,e)}function li(t,e,i){return Math.max(Math.min(t,i),e)}function hi(t,e,i,s,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)ri(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=ai(i,r,t[Math.min(o+1,a-(s?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,n,o,a,r=Re(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&Re(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=li(n.cp1x,e.left,e.right),n.cp1y=li(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=li(n.cp2x,e.left,e.right),n.cp2y=li(n.cp2y,e.top,e.bottom)))}(t,i)}const ci=t=>0===t||1===t,di=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*O/i),ui=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*O/i)+1,fi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*E),easeOutSine:t=>Math.sin(t*E),easeInOutSine:t=>-.5*(Math.cos(C*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ci(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ci(t)?t:di(t,.075,.3),easeOutElastic:t=>ci(t)?t:ui(t,.075,.3),easeInOutElastic(t){const e=.1125;return ci(t)?t:t<.5?.5*di(2*t,e,.45):.5+.5*ui(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-fi.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*fi.easeInBounce(2*t):.5*fi.easeOutBounce(2*t-1)+.5};function gi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function mi(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=gi(t,n,i),r=gi(n,o,i),l=gi(o,e,i),h=gi(a,r,i),c=gi(r,l,i);return gi(h,c,i)}const xi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,bi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,e){const i=(""+t).match(xi);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const yi=t=>+t||0;function vi(t,e){const i={},s=o(e),n=s?Object.keys(e):e,a=o(t)?s?i=>l(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=yi(a(t));return i}function Mi(t){return vi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return vi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ki(t){const e=Mi(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Si(t,e){t=t||{},e=e||ue.font;let i=l(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=l(t.style,e.style);s&&!(""+s).match(bi)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:l(t.family,e.family),lineHeight:_i(l(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:l(t.weight,e.weight),string:""};return n.string=De(n),n}function Pi(t,e,i,s){let o,a,r,l=!0;for(o=0,a=t.length;o<a;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),l=!1),void 0!==i&&n(r)&&(r=r[i%r.length],l=!1),void 0!==r))return s&&!l&&(s.cacheable=!1),r}function Di(t,e,i){const{min:s,max:n}=t,o=c(e,(n-s)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Ci(t,e){return Object.assign(Object.create(t),e)}function Oi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ai(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Ti(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Li(t){return"angle"===t?{between:J,compare:K,normalize:G}:{between:tt,compare:(t,e)=>t-e,normalize:t=>t}}function Ei({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function Ri(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Li(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=Li(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;h<c&&a(r(e[d%l][s]),n,o);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,x,b=!1,_=null;const y=()=>b||l(n,x,p)&&0!==r(n,x),v=()=>!b||0===r(o,p)||l(o,x,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==x&&(b=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(Ei({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p));return null!==_&&g.push(Ei({start:_,end:d,loop:u,count:a,style:f})),g}function Ii(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const o=Ri(s[n],t.points,e);o.length&&i.push(...o)}return i}function zi(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return Fi(t,[{start:a,end:r,loop:o}],i,e);return Fi(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),i,e)}function Fi(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=Vi(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,h=[];let c=o,d=e[0].start,u=d;function f(t,e,s,n){const o=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:s,style:n}),c=n,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=Vi(s.setContext(Ci(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Bi(e,c)&&f(d,u-1,t.loop,c),o=r,c=e}d<u-1&&f(d,u-1,t.loop,c)}return h}(t,e,i,s):e}function Vi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Bi(t,e){if(!e)return!1;const i=[],s=function(t,e){return Zt(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,s)!==JSON.stringify(e,s)}function Wi(t,e,i){return t.options.clip?t[i]:e[i]}function Ni(t,e){const i=e._clip;if(i.disabled)return!1;const s=function(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:Wi(i,e,"left"),right:Wi(i,e,"right"),top:Wi(s,e,"top"),bottom:Wi(s,e,"bottom")}:e}(e,t.chartArea);return{left:!1===i.left?0:s.left-(!0===i.left?0:i.left),right:!1===i.right?t.width:s.right+(!0===i.right?0:i.right),top:!1===i.top?0:s.top-(!0===i.top?0:i.top),bottom:!1===i.bottom?t.height:s.bottom+(!0===i.bottom?0:i.bottom)}}var Hi=Object.freeze({__proto__:null,HALF_PI:E,INFINITY:T,PI:C,PITAU:A,QUARTER_PI:R,RAD_PER_DEG:L,TAU:O,TWO_THIRDS_PI:I,_addGrace:Di,_alignPixel:Ae,_alignStartEnd:ft,_angleBetween:J,_angleDiff:K,_arrayUnique:lt,_attachContext:$e,_bezierCurveTo:Ve,_bezierInterpolation:mi,_boundSegment:Ri,_boundSegments:Ii,_capitalize:w,_computeSegments:zi,_createResolver:je,_decimalPlaces:U,_deprecated:function(t,e,i,s){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+s+'" instead')},_descriptors:Ye,_elementsEqual:f,_factorize:W,_filterBetween:nt,_getParentNode:ge,_getStartAndCountOfVisiblePoints:pt,_int16Range:Q,_isBetween:tt,_isClickEvent:D,_isDomSupported:fe,_isPointInArea:Re,_limitValue:Z,_longestText:Oe,_lookup:et,_lookupByKey:it,_measureText:Ce,_merger:m,_mergerIf:_,_normalizeAngle:G,_parseObjectDataRadialScale:ii,_pointInLine:gi,_readValueToProps:vi,_rlookupByKey:st,_scaleRangesChanged:mt,_setMinAndMaxByKey:j,_splitKey:v,_steppedInterpolation:pi,_steppedLineTo:Fe,_textX:gt,_toLeftRightCenter:ut,_updateBezierControlPoints:hi,addRoundedRectPath:He,almostEquals:V,almostWhole:H,callback:d,clearCanvas:Te,clipArea:Ie,clone:g,color:Qt,createContext:Ci,debounce:dt,defined:k,distanceBetweenPoints:q,drawPoint:Le,drawPointLegend:Ee,each:u,easingEffects:fi,finiteOrDefault:r,fontString:function(t,e,i){return e+" "+t+"px "+i},formatNumber:ne,getAngleFromPoint:X,getDatasetClipArea:Ni,getHoverColor:te,getMaximumSize:we,getRelativePosition:ve,getRtlAdapter:Oi,getStyle:xe,isArray:n,isFinite:a,isFunction:S,isNullOrUndef:s,isNumber:N,isObject:o,isPatternOrGradient:Zt,listenArrayEvents:at,log10:z,merge:x,mergeIf:b,niceNum:B,noop:e,overrideTextDirection:Ai,readUsedSize:Pe,renderText:Ne,requestAnimFrame:ht,resolve:Pi,resolveObjectKey:M,restoreTextDirection:Ti,retinaScale:ke,setsEqual:P,sign:F,splineCurve:ai,splineCurveMonotone:ri,supportsEventListenerOptions:Se,throttled:ct,toDegrees:Y,toDimension:c,toFont:Si,toFontString:De,toLineHeight:_i,toPadding:ki,toPercentage:h,toRadians:$,toTRBL:Mi,toTRBLCorners:wi,uid:i,unclipArea:ze,unlistenArrayEvents:rt,valueOrDefault:l});function ji(t,e,i,n){const{controller:o,data:a,_sorted:r}=t,l=o._cachedMeta.iScale,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(l&&e===l.axis&&"r"!==e&&r&&a.length){const r=l._reversePixels?st:it;if(!n){const n=r(a,e,i);if(h){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,a=i.slice(0,n.lo+1).reverse().findIndex((t=>!s(t[e.axis])));n.lo-=Math.max(0,a);const r=i.slice(n.hi).findIndex((t=>!s(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=a[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){const t=r(a,e,i-s),n=r(a,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function $i(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:r}=o[t],{lo:l,hi:h}=ji(o[t],e,a,n);for(let t=l;t<=h;++t){const e=r[t];e.skip||s(e,i,t)}}}function Yi(t,e,i,s,n){const o=[];if(!n&&!t.isPointInArea(e))return o;return $i(t,i,e,(function(i,a,r){(n||Re(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&o.push({element:i,datasetIndex:a,index:r})}),!0),o}function Ui(t,e,i,s,n,o){let a=[];const r=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,o=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(i);let l=Number.POSITIVE_INFINITY;return $i(t,i,e,(function(i,h,c){const d=i.inRange(e.x,e.y,n);if(s&&!d)return;const u=i.getCenterPoint(n);if(!(!!o||t.isPointInArea(u))&&!d)return;const f=r(e,u);f<l?(a=[{element:i,datasetIndex:h,index:c}],l=f):f===l&&a.push({element:i,datasetIndex:h,index:c})})),a}function Xi(t,e,i,s,n,o){return o||t.isPointInArea(e)?"r"!==i||s?Ui(t,e,i,s,n,o):function(t,e,i,s){let n=[];return $i(t,i,e,(function(t,i,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=X(t,{x:e.x,y:e.y});J(l,a,r)&&n.push({element:t,datasetIndex:i,index:o})})),n}(t,e,i,n):[]}function qi(t,e,i,s,n){const o=[],a="x"===i?"inXRange":"inYRange";let r=!1;return $i(t,i,e,((t,s,l)=>{t[a]&&t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:o}var Ki={evaluateInteractionItems:$i,modes:{index(t,e,i,s){const n=ve(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,s)=>Yi(t,ve(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Xi(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>qi(t,ve(e,t),"x",i.intersect,s),y:(t,e,i,s)=>qi(t,ve(e,t),"y",i.intersect,s)}};const Gi=["left","top","right","bottom"];function Ji(t,e){return t.filter((t=>t.pos===e))}function Zi(t,e){return t.filter((t=>-1===Gi.indexOf(t.pos)&&t.box.axis===e))}function Qi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function ts(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Gi.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:a&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:a&&e.availableHeight)}return i}function es(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function is(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function ss(t,e,i,s){const{pos:n,box:a}=i,r=t.maxPadding;if(!o(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?a.height:a.width),i.size=e.size/e.count,t[n]+=i.size}a.getPadding&&is(r,a.getPadding());const l=Math.max(0,e.outerWidth-es(r,t,"left","right")),h=Math.max(0,e.outerHeight-es(r,t,"top","bottom")),c=l!==t.w,d=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:c,other:d}:{same:d,other:c}}function ns(t,e){const i=e.maxPadding;function s(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function os(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,ns(r.horizontal,e));const{same:a,other:d}=ss(e,i,r,s);h|=a&&n.length,c=c||d,l.fullSize||n.push(r)}return h&&os(n,e,i,s)||c}function as(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function rs(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,o=l.size||t.height;k(l.start)&&(a=l.start),t.fullSize?as(t,n.left,a,i.outerWidth-n.right-n.left,o):as(t,e.left+l.placed,a,s,o),l.start=a,l.placed+=s,a=t.bottom}else{const s=e.h*h,a=l.size||t.width;k(l.start)&&(o=l.start),t.fullSize?as(t,o,n.top,a,i.outerHeight-n.bottom-n.top):as(t,o,e.top+l.placed,a,s),l.start=o,l.placed+=s,o=t.right}}e.x=o,e.y=a}var ls={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=ki(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=Qi(e.filter((t=>t.box.fullSize)),!0),s=Qi(Ji(e,"left"),!0),n=Qi(Ji(e,"right")),o=Qi(Ji(e,"top"),!0),a=Qi(Ji(e,"bottom")),r=Zi(e,"x"),l=Zi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ji(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;u(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),f=Object.assign({},n);is(f,ki(s));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=ts(l.concat(h),d);os(r.fullSize,g,d,p),os(l,g,d,p),os(h,g,d,p)&&os(l,g,d,p),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(g),rs(r.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,rs(r.rightAndBottom,g,d,p),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},u(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})}))}};class hs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class cs extends hs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ds="$chartjs",us={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},fs=t=>null===t||""===t;const gs=!!Se&&{passive:!0};function ps(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,gs)}function ms(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function xs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.addedNodes,s),e=e&&!ms(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function bs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.removedNodes,s),e=e&&!ms(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const _s=new Map;let ys=0;function vs(){const t=window.devicePixelRatio;t!==ys&&(ys=t,_s.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Ms(t,e,i){const s=t.canvas,n=s&&ge(s);if(!n)return;const o=ct(((t,e)=>{const s=n.clientWidth;i(t,e),s<n.clientWidth&&i()}),window),a=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return a.observe(n),function(t,e){_s.size||window.addEventListener("resize",vs),_s.set(t,e)}(t,o),a}function ws(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){_s.delete(t),_s.size||window.removeEventListener("resize",vs)}(t)}function ks(t,e,i){const s=t.canvas,n=ct((e=>{null!==t.ctx&&i(function(t,e){const i=us[t.type]||t.type,{x:s,y:n}=ve(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,gs)}(s,e,n),n}class Ss extends hs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[ds]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",fs(n)){const e=Pe(t,"width");void 0!==e&&(t.width=e)}if(fs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Pe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ds])return!1;const i=e[ds].initial;["height","width"].forEach((t=>{const n=i[t];s(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[ds],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:xs,detach:bs,resize:Ms}[e]||ks;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:ws,detach:ws,resize:ws}[e]||ps)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return we(t,e,i,s)}isAttached(t){const e=t&&ge(t);return!(!e||!e.isConnected)}}function Ps(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?cs:Ss}var Ds=Object.freeze({__proto__:null,BasePlatform:hs,BasicPlatform:cs,DomPlatform:Ss,_detectPlatform:Ps});const Cs="transparent",Os={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Qt(t||Cs),n=s.valid&&Qt(e||Cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class As{constructor(t,e,i,s){const n=e[i];s=Pi([t.to,s,n,t.from]);const o=Pi([t.from,n,s]);this._active=!0,this._fn=t.fn||Os[t.type||typeof o],this._easing=fi[t.easing]||fi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Pi([t.to,e,s,t.from]),this._from=Pi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<i),!this._active)return this._target[s]=a,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class Ts{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!o(t))return;const e=Object.keys(ue.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((s=>{const a=t[s];if(!o(a))return;const r={};for(const t of e)r[t]=a[t];(n(a.properties)&&a.properties||[s]).forEach((t=>{t!==s&&i.has(t)||i.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new As(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(bt.add(this._chart,i),!0):void 0}}function Ls(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function Es(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function Rs(t,e,i,s={}){const n=t.keys,o="single"===s.mode;let r,l,h,c;if(null===e)return;let d=!1;for(r=0,l=n.length;r<l;++r){if(h=+n[r],h===i){if(d=!0,s.all)continue;break}c=t.values[h],a(c)&&(o||0===e||F(e)===F(c))&&(e+=c)}return d||s.all?e:0}function Is(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function zs(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function Fs(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function Vs(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:o,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=zs(n,c,o),u[r]=d,u._top=Fs(u,a,!0,s.type),u._bottom=Fs(u,a,!1,s.type);(u._visualValues||(u._visualValues={}))[r]=d}}function Bs(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Ws(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ns=t=>"reset"===t||"none"===t,Hs=(t,e)=>e?t:Object.assign({},t);class js{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Is(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ws(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=l(i.xAxisID,Bs(t,"x")),o=e.yAxisID=l(i.yAxisID,Bs(t,"y")),a=e.rAxisID=l(i.rAxisID,Bs(t,"r")),r=e.indexAxis,h=e.iAxisID=s(r,n,o,a),c=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&Ws(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(o(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",o="x"===s.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,h,c;for(l=0,h=a.length;l<h;++l)c=a[l],r[l]={[n]:c,[o]:t[c]};return r}(e,t)}else if(i!==e){if(i){rt(i,this);const t=this._cachedMeta;Ws(t),t._parsed=[]}e&&Object.isExtensible(e)&&at(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=Is(e.vScale,e),e.stack!==i.stack&&(s=!0,Ws(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&(Vs(this,e._parsed),e._stacked=Is(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:a,_stacked:r}=i,l=a.axis;let h,c,d,u=0===t&&e===s.length||i._sorted,f=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,d=s;else{d=n(s[t])?this.parseArrayData(i,s,t,e):o(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const a=()=>null===c[l]||f&&c[l]<f[l];for(h=0;h<e;++h)i._parsed[h+t]=c=d[h],u&&(a()&&(u=!1),f=c);i._sorted=u}r&&Vs(this,d)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),h=n===o,c=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,c[d]={[a]:h||n.parse(l[f],f),[r]:o.parse(e[f],f)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={x:n.parse(c[0],h),y:o.parse(c[1],h)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:n.parse(M(u,a),d),y:o.parse(M(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return Rs({keys:Es(s,!0),values:e._stacks[t.axis]._visualValues},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=null===n?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=Rs(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,r=this._getOtherScale(t),l=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Es(i,!0),values:null})(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let u,f;function g(){f=s[u];const e=f[r.axis];return!a(f[t.axis])||c>e||d<e}for(u=0;u<o&&(g()||(this.updateRangeFromParsed(h,t,f,l),!n));++u);if(n)for(u=o-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s][t.axis],a(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return o(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(l(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=Ls(t,i),n=Ls(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,n,a,r),h=a;h<a+r;++h){const e=s[h];e.hidden||(e.active&&l?o.push(e):e.draw(t,n))}for(h=0;h<o.length;++h)o[h].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return Ci(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return Ci(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&k(i);if(a)return Hs(a,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(ue.elements[t]),f=l.resolveNamedOptions(d,u,(()=>this.getContext(i,s,e)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Hs(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new Ts(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ns(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Ns(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ns(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Ws(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class $s{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return N(this.x)&&N(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function Ys(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=Math.min(i.maxTicksLimit||n,n),a=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],r=a.length,l=a[0],h=a[r-1],c=[];if(r>o)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=i[o*s])}(e,c,a,r/o),c;const d=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const o=W(s);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)return e}return Math.max(n,1)}(a,e,o);if(r>0){let t,i;const n=r>1?Math.round((h-l)/(r-1)):null;for(Us(e,c,d,s(n)?0:l-n,l),t=0,i=r-1;t<i;t++)Us(e,c,d,a[t],a[t+1]);return Us(e,c,d,h,s(n)?e.length:h+n),c}return Us(e,c,d),c}function Us(t,e,i,s,n){const o=l(s,0),a=Math.min(l(n,t.length),t.length);let r,h,c,d=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),c=o;c<0;)d++,c=Math.round(o+d*i);for(h=Math.max(o,0);h<a;h++)h===c&&(e.push(t[h]),d++,c=Math.round(o+d*i))}const Xs=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,qs=(t,e)=>Math.min(e||t,t);function Ks(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function Gs(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(h-o,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(n-1))/2,h+=n<e?l:-l,h<o-r||h>a+r)))return h}function Js(t){return t.drawTicks?t.tickLength:0}function Zs(t,e){if(!t.display)return 0;const i=Si(t.font,e),s=ki(t.padding);return(n(t.text)?t.text.length:1)*i.lineHeight+s.height}function Qs(t,e,i){let s=ut(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class tn extends $s{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=r(t,Number.POSITIVE_INFINITY),e=r(e,Number.NEGATIVE_INFINITY),i=r(i,Number.POSITIVE_INFINITY),s=r(s,Number.NEGATIVE_INFINITY),{min:r(t,i),max:r(e,s),minDefined:a(t),maxDefined:a(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;r<l;++r)e=a[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),o||(s=Math.max(s,e.max));return i=o&&i>s?s:i,s=n&&i>s?i:s,{min:r(i,r(s,i)),max:r(s,r(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Di(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?Ks(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=Ys(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){d(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),d(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){d(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=d(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=qs(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,n=e.maxRotation;let o,a,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Z(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Js(t.grid)-e.padding-Zs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Y(Math.min(Math.asin(Z((h.highest.height+6)/o,-1,1)),Math.asin(Z(a/r,-1,1))-Math.asin(Z(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Zs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Js(n)+o):(t.height=this.maxHeight,t.width=Js(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=$(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)s(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Ks(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:o,_longestTextCache:a}=this,r=[],l=[],h=Math.floor(e/qs(e,i));let c,d,f,g,p,m,x,b,_,y,v,M=0,w=0;for(c=0;c<e;c+=h){if(g=t[c].label,p=this._resolveTickFontOptions(c),o.font=m=p.string,x=a[m]=a[m]||{data:{},gc:[]},b=p.lineHeight,_=y=0,s(g)||n(g)){if(n(g))for(d=0,f=g.length;d<f;++d)v=g[d],s(v)||n(v)||(_=Ce(o,x.data,x.gc,_,v),y+=b)}else _=Ce(o,x.data,x.gc,_,g),y=b;r.push(_),l.push(y),M=Math.max(_,M),w=Math.max(y,w)}!function(t,e){u(t,(t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}}))}(a,e);const k=r.indexOf(M),S=l.indexOf(w),P=t=>({width:r[t]||0,height:l[t]||0});return{first:P(0),last:P(e-1),widest:P(k),highest:P(S),widths:r,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Q(this._alignToPixels?Ae(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Ci(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Ci(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=$(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*i>a*s?a/i:r/s:r*s<a*i?r/i:a/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:a,border:r}=s,h=n.offset,c=this.isHorizontal(),d=this.ticks.length+(h?1:0),u=Js(n),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,x=function(t){return Ae(i,t,p)};let b,_,y,v,M,w,k,S,P,D,C,O;if("top"===a)b=x(this.bottom),w=this.bottom-u,S=b-m,D=x(t.top)+m,O=t.bottom;else if("bottom"===a)b=x(this.top),D=t.top,O=x(t.bottom)-m,w=b+m,S=this.top+u;else if("left"===a)b=x(this.right),M=this.right-u,k=b-m,P=x(t.left)+m,C=t.right;else if("right"===a)b=x(this.left),P=t.left,C=x(t.right)-m,M=b+m,k=this.left+u;else if("x"===e){if("center"===a)b=x((t.top+t.bottom)/2+.5);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}D=t.top,O=t.bottom,w=b+m,S=w+u}else if("y"===e){if("center"===a)b=x((t.left+t.right)/2);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}M=b-m,k=M-u,P=t.left,C=t.right}const A=l(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/A));for(_=0;_<d;_+=T){const t=this.getContext(_),e=n.setContext(t),s=r.setContext(t),o=e.lineWidth,a=e.color,l=s.dash||[],d=s.dashOffset,u=e.tickWidth,g=e.tickColor,p=e.tickBorderDash||[],m=e.tickBorderDashOffset;y=Gs(this,_,h),void 0!==y&&(v=Ae(i,y,o),c?M=k=P=C=v:w=S=D=O=v,f.push({tx1:M,ty1:w,tx2:k,ty2:S,x1:P,y1:D,x2:C,y2:O,width:o,color:a,borderDash:l,borderDashOffset:d,tickWidth:u,tickColor:g,tickBorderDash:p,tickBorderDashOffset:m}))}return this._ticksLength=d,this._borderValue=b,f}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:a}=i,r=this.isHorizontal(),l=this.ticks,{align:h,crossAlign:c,padding:d,mirror:u}=a,f=Js(i.grid),g=f+d,p=u?-d:g,m=-$(this.labelRotation),x=[];let b,_,y,v,M,w,k,S,P,D,C,O,A="middle";if("top"===s)w=this.bottom-p,k=this._getXAxisLabelAlignment();else if("bottom"===s)w=this.top+p,k=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(f);k=t.textAlign,M=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(f);k=t.textAlign,M=t.x}else if("x"===e){if("center"===s)w=(t.top+t.bottom)/2+g;else if(o(s)){const t=Object.keys(s)[0],e=s[t];w=this.chart.scales[t].getPixelForValue(e)+g}k=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)M=(t.left+t.right)/2-g;else if(o(s)){const t=Object.keys(s)[0],e=s[t];M=this.chart.scales[t].getPixelForValue(e)}k=this._getYAxisLabelAlignment(f).textAlign}"y"===e&&("start"===h?A="top":"end"===h&&(A="bottom"));const T=this._getLabelSizes();for(b=0,_=l.length;b<_;++b){y=l[b],v=y.label;const t=a.setContext(this.getContext(b));S=this.getPixelForTick(b)+a.labelOffset,P=this._resolveTickFontOptions(b),D=P.lineHeight,C=n(v)?v.length:1;const e=C/2,i=t.color,o=t.textStrokeColor,h=t.textStrokeWidth;let d,f=k;if(r?(M=S,"inner"===k&&(f=b===_-1?this.options.reverse?"left":"right":0===b?this.options.reverse?"right":"left":"center"),O="top"===s?"near"===c||0!==m?-C*D+D/2:"center"===c?-T.highest.height/2-e*D+D:-T.highest.height+D/2:"near"===c||0!==m?D/2:"center"===c?T.highest.height/2-e*D:T.highest.height-C*D,u&&(O*=-1),0===m||t.showLabelBackdrop||(M+=D/2*Math.sin(m))):(w=S,O=(1-C)*D/2),t.showLabelBackdrop){const e=ki(t.backdropPadding),i=T.heights[b],s=T.widths[b];let n=O-e.top,o=0-e.left;switch(A){case"middle":n-=i/2;break;case"bottom":n-=i}switch(k){case"center":o-=s/2;break;case"right":o-=s;break;case"inner":b===_-1?o-=s:b>0&&(o-=s/2)}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}x.push({label:v,font:P,textOffset:O,options:{rotation:m,color:i,strokeColor:o,strokeWidth:h,textAlign:f,textBaseline:A,translation:[M,w],backdrop:d}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-$(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n<o;++n){const t=s[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,n=i.setContext(this.getContext()),o=i.display?n.width:0;if(!o)return;const a=s.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=Ae(t,this.left,o)-o/2,h=Ae(t,this.right,a)+a/2,c=d=r):(c=Ae(t,this.top,o)-o/2,d=Ae(t,this.bottom,a)+a/2,l=h=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Ie(e,i);const s=this.getLabelItems(t);for(const t of s){const i=t.options,s=t.font;Ne(e,t.label,0,t.textOffset,s,i)}i&&ze(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const a=Si(i.font),r=ki(i.padding),l=i.align;let h=a.lineHeight/2;"bottom"===e||"center"===e||o(e)?(h+=r.bottom,n(i.text)&&(h+=a.lineHeight*(i.text.length-1))):h+=r.top;const{titleX:c,titleY:d,maxWidth:u,rotation:f}=function(t,e,i,s){const{top:n,left:a,bottom:r,right:l,chart:h}=t,{chartArea:c,scales:d}=h;let u,f,g,p=0;const m=r-n,x=l-a;if(t.isHorizontal()){if(f=ft(s,a,l),o(i)){const t=Object.keys(i)[0],s=i[t];g=d[t].getPixelForValue(s)+m-e}else g="center"===i?(c.bottom+c.top)/2+m-e:Xs(t,i,e);u=l-a}else{if(o(i)){const t=Object.keys(i)[0],s=i[t];f=d[t].getPixelForValue(s)-x+e}else f="center"===i?(c.left+c.right)/2-x+e:Xs(t,i,e);g=ft(s,r,n),p="left"===i?-E:E}return{titleX:f,titleY:g,maxWidth:u,rotation:p}}(this,h,e,l);Ne(t,i.text,0,0,a,{color:i.color,maxWidth:u,rotation:f,textAlign:Qs(l,e,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=l(t.grid&&t.grid.z,-1),s=l(t.border&&t.border.z,0);return this._isVisible()&&this.draw===tn.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||s.push(o)}return s}_resolveTickFontOptions(t){return Si(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class en{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=x(Object.create(null),[i?ue.get(i):{},ue.get(e),t.defaults]);ue.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");ue.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&ue.describe(e,t.descriptors)}(t,o,i),this.override&&ue.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ue[s]&&(delete ue[s][i],this.override&&delete re[i])}}class sn{constructor(){this.controllers=new en(js,"datasets",!0),this.elements=new en($s,"elements"),this.plugins=new en(Object,"plugins"),this.scales=new en(tn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):u(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=w(t);d(i["before"+s],[],i),e[t](i),d(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var nn=new sn;class on{constructor(){this._init=
vendor: 3,433 bytes, line 34169
34169[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===d(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){s(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=l(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],s=Object.keys(nn.plugins.items);for(let t=0;t<s.length;t++)i.push(nn.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==s||e?function(t,{plugins:e,localIds:i},s,n){const o=[],a=t.getContext();for(const r of e){const e=r.id,l=an(s[e],n);null!==l&&o.push({plugin:r,options:rn(t.config,{plugin:r,local:i[e]},l,a)})}return o}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function an(t,e){return e||!1!==t?!0===t?{}:t:null}function rn(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ln(t,e){const i=ue.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function hn(t){if("x"===t||"y"===t||"r"===t)return t}function cn(t,...e){if(hn(t))return t;for(const s of e){const e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&hn(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function dn(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function un(t,e){const i=re[t.type]||{scales:{}},s=e.scales||{},n=ln(t.type,e),a=Object.create(null);return Object.keys(s).forEach((e=>{const r=s[e];if(!o(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const l=cn(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return dn(t,"x",i[0])||dn(t,"y",i[0])}return{}}(e,t),ue.scales[r.type]),h=function(t,e){return t===e?"_index_":"_value_"}(l,n),c=i.scales||{};a[e]=b(Object.create(null),[{axis:l},r,c[l],c[h]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||ln(n,e),r=(re[n]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),b(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];b(e,[ue.scales[e.type],ue.scale])})),a}function fn(t){const e=t.options||(t.options={});e.plugins=l(e.plugins,{}),e.scales=un(t,e)}function gn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const pn=new Map,mn=new Set;function xn(t,e){let i=pn.get(t);
vendor: 3,327 bytes, line 34169
34169return i||(i=e(),pn.set(t,i),mn.add(i)),i}const bn=(t,e,i)=>{const s=M(e,i);void 0!==s&&t.add(s)};class _n{constructor(t){this._config=function(t){return(t=t||{}).data=gn(t.data),fn(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),fn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return xn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return xn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return xn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return xn(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>bn(r,t,e)))),e.forEach((t=>bn(r,s,t))),e.forEach((t=>bn(r,re[n]||{},t))),e.forEach((t=>bn(r,ue,t))),e.forEach((t=>bn(r,le,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),mn.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,re[e]||{},ue.datasets[e]||{},{type:e},ue,le]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=yn(this._resolverCache,t,s);let l=a;if(function(t,e){const{isScriptable:i,isIndexable:s}=Ye(t);for(const o of e){const e=i(o),a=s(o),r=(a||e)&&t[o];if(e&&(S(r)||vn(r))||a&&n(r))return!0}return!1}(a,e)){o.$shared=!1;l=$e(a,i=S(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=l[t];return o}createResolver(t,e,i=[""],s){const{resolver:n}=yn(this._resolverCache,t,i);return o(e)?$e(n,e,void 0,s):n}}function yn(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:je(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const vn=t=>o(t)&&Object.getOwnPropertyNames(t).some((e=>S(t[e])));const Mn=["top","bottom","left","right","chartArea"];function wn(t,e){return"top"===t||"bottom"===t||-1===Mn.indexOf(t)&&"x"===e}function kn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Sn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function Pn(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function Dn(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Cn={},On=t=>{const e=Dn(t);return Object.values(Cn).filter((t=>t.canvas===e)).pop()};function An(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class Tn{static defaults=ue;static instances=Cn;static overrides=re;static registry=nn;static version="4.5.0
vendor: 16,156 bytes, line 34169
34169";static getChart=On;static register(...t){nn.add(...t),Ln()}static unregister(...t){nn.remove(...t),Ln()}constructor(t,e){const s=this.config=new _n(e),n=Dn(t),o=On(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ps(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;this.id=i(),this.ctx=r,this.canvas=l,this.width=c,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new on,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=dt((t=>this.update(t)),a.resizeDelay||0),this._dataChanges=[],Cn[this.id]=this,r&&l?(bt.listen(this,"complete",Sn),bt.listen(this,"progress",Pn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return s(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ke(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Te(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,e){bt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ke(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),d(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){u(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=cn(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),u(n,(e=>{const n=e.options,o=n.id,a=cn(o,n),r=l(n.type,e.dtype);void 0!==n.position&&wn(n.position,a)===wn(e.dposition)||(n.position=e.dposition),s[o]=!0;let h=null;if(o in i&&i[o].type===r)h=i[o];else{h=new(nn.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(n,t)})),u(s,((t,e)=>{t||delete i[e]})),u(i,(t=>{ls.configure(this,t,t.options),ls.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(kn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const o=s.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=o,n.indexAxis=s.indexAxis||ln(o,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=nn.getController(o),{datasetElementType:s,dataElementType:a}=ue.datasets[o];Object.assign(e,{dataElementType:nn.getElement(a),datasetElementType:s&&nn.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){u(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||u(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(kn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){u(this.scales,(t=>{ls.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);P(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){An(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;t<e;t++)if(!P(s,i(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ls.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],u(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,S(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(bt.has(this)?this.attached&&!bt.running(this)&&bt.start(this):(this.draw(),Sn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Ni(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&Ie(e,s),t.controller.draw(),s&&ze(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ki.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ci(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);k(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),bt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Te(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Cn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};u(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){u(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},u(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!f(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=D(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,d(n.onHover,[t,a,this],this),r&&d(n.onClick,[t,a,this],this));const h=!f(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function Ln(){return u(Tn.instances,(t=>t._plugins.invalidate()))}function En(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rn{static override(t){Object.assign(Rn.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return En()}parse(){return En()}format(){return En()}add(){return En()}diff(){return En()}startOf(){return En()}endOf(){return En()}}var In={_date:Rn};function zn(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=lt(s.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(k(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;s<n;++s)o=e.getPixelForValue(i[s]),l();for(a=void 0,s=0,n=e.ticks.length;s<n;++s)o=e.getPixelForTick(s),l();return r}function Fn(t,e,i,s){return n(t)?function(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,h=r;Math.abs(a)>Math.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Vn(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;h<c;++h)u=e[h],d={},d[n.axis]=r||n.parse(a[h],h),l.push(Fn(u,d,o,h));return l}function Bn(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Wn(t,e,i,s){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=h:(i._bottom||0)===s?n=c:(o[Nn(c,a,r,l)]=!0,n=h)),o[Nn(n,a,r,l)]=!0,t.borderSkipped=o}function Nn(t,e,i,s){var n,o,a;return s?(a=i,t=Hn(t=(n=t)===(o=e)?a:n===a?o:n,i,e)):t=Hn(t,e,i),t}function Hn(t,e,i){return"start"===t?e:"end"===t?i:t}function jn(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class $n extends js{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data
34169;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return
vendor: 92,844 bytes, lines 34169-34170
34169[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,a,r=t=>+i[t];if(o(i[t])){const{key:t="value"}=this._parsing;r=e=>+M(i[e],t)}for(n=t,a=t+e;n<a;++n)s._parsed[n]=r(n)}}_getRotation(){return $(this.options.rotation-90)}_getCircumference(){return $(this.options.circumference)}_getRotationExtents(){let t=O,e=-O;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),r=Math.min(h(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=function(t,e,i){let s=1,n=1,o=0,a=0;if(e<O){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(t,e,s)=>J(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>J(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(E,c,u),x=g(C,h,d),b=g(C+E,c,u);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,a=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),x=(i.width-o)/f,b=(i.height-o)/g,_=Math.max(Math.min(x,b)/2,0),y=c(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/O)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p<e;++p)m+=this._circumference(p,n);for(p=e;p<e+i;++p){const e=this._circumference(p,n),i=t[p],o={x:l+this.offsetX,y:h+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:u,innerRadius:d};g&&(o.options=f||this.resolveDataElementOptions(p,i.active?"active":s)),m+=e,this.updateElement(i,p,o,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?O*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(l(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Yn extends js{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(s<e.min&&(e.min=s),s>e.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*C;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,s,f);for(d=e;d<e+i;d++){const e=t[d];let i=u,g=u+this._computeAngle(d,s,f),p=o.getDataVisibility(d)?r.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=g,n&&(a.animateScale&&(p=0),a.animateRotate&&(i=g=c));const m={x:l,y:h,innerRadius:0,outerRadius:p,startAngle:i,endAngle:g,options:this.resolveDataElementOptions(d,e.active?"active":s)};this.updateElement(e,d,m,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?$(this.resolveDataElementOptions(t,e).angle||i):0}}var Un=Object.freeze({__proto__:null,BarController:class extends js{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Vn(t,e,i,s)}parseArrayData(t,e,i,s){return Vn(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(M(g,l),d),c.push(Fn(M(g,h),f,o,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),o=n._custom,a=Bn(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),h=r.isHorizontal(),c=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){const e=this.getParsed(f),i=o||s(e[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,c),p=(e._stacks||{})[r.axis],m={horizontal:h,base:i.base,enableBorderRadius:!p||Bn(e._custom)||a===p._top||a===p._bottom,x:h?i.head:g.center,y:h?g.center:i.head,height:h?g.size:Math.abs(i.size),width:h?Math.abs(i.size):g.size};u&&(m.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const x=m.options||t[f].options;Wn(m,x,p,a),jn(m,x,c.ratio),this.updateElement(t[f],f,m,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],h=t=>{const e=t._parsed.find((t=>t[i.axis]===l)),n=e&&e[t.vScale.axis];if(s(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!h(i))&&((!1===o||-1===a.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter((i=>t[i].axis===e)).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[l("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||zn(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),h=l._custom,c=Bn(h);let d,u,f=l[e.axis],g=0,p=i?this.applyStack(e,l,i):f;p!==f&&(g=p-f,p=f),c&&(f=h.barStart,p=h.barEnd-h.barStart,0!==f&&F(f)!==F(h.barEnd)&&(g=0),g+=f);const m=s(o)||c?g:o;let x=e.getPixelForValue(m);if(d=this.chart.getDataVisibility(t)?e.getPixelForValue(g+p):x,u=d-x,Math.abs(u)<a){u=function(t,e,i){return 0!==t?F(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(u,e,r)*a,f===r&&(x-=u/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),o=Math.min(t,s),h=Math.max(t,s);x=Math.max(Math.min(x,h),o),d=x+u,i&&!c&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(d)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){const t=F(u)*e.getLineWidthForValue(r)/2;x+=t,u-=t}return{size:u,base:x,head:d,center:d+u/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,a=l(n.maxBarThickness,1/0);let r,h;const c=this._getAxisCount();if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,d="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:i.barPercentage,start:h}}(t,e,n,i*c):function(t,e,i,n){const o=i.barThickness;let a,r;return s(o)?(a=e.min*i.categoryPercentage,r=i.barPercentage):(a=o*n,r=1),{chunk:a/n,ratio:r,start:e.pixels[t]-a/2}}(t,e,n,i*c),u="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(l(u,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=d.start+d.chunk*g+d.chunk/2,h=Math.min(a,d.chunk*d.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),h=Math.min(a,e.min*e.ratio);return{base:r-h/2,head:r+h/2,center:r,size:h}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}},BubbleController:class extends js{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=l(s[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=l(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=o.axis,c=a.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!n&&this.getParsed(d),u={},f=u[h]=n?o.getPixelForDecimal(.5):o.getPixelForValue(i[h]),g=u[c]=n?a.getBasePixel():a.getPixelForValue(i[c]);u.skip=isNaN(f)||isNaN(g),l&&(u.options=r||this.resolveDataElementOptions(d,e.active?"active":s),n&&(u.options.radius=0)),this.updateElement(e,d,u,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=l(i&&i._custom,n),s}},DoughnutController:$n,LineController:class extends js{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=pt(e,s,o);this._drawStart=a,this._drawCount=r,mt(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:g,segment:p}=this.options,m=N(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||"none"===n,b=e+i,_=t.length;let y=e>0&&this.getParsed(e-1);for(let i=0;i<_;++i){const g=t[i],_=x?g:{};if(i<e||i>=b){_.skip=!0;continue}const v=this.getParsed(i),M=s(v[f]),w=_[u]=a.getPixelForValue(v[u],i),k=_[f]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,v,l):v[f],i);_.skip=isNaN(w)||isNaN(k)||M,_.stop=i>0&&Math.abs(v[u]-y[u])>m,p&&(_.parsed=v,_.raw=h.data[i]),d&&(_.options=c||this.resolveDataElementOptions(i,g.active?"active":n)),x||this.updateElement(g,i,_,n),y=v}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends $n{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:Yn,RadarController:class extends js{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a<e+i;a++){const e=t[a],i=this.resolveDataElementOptions(a,e.active?"active":s),r=n.getPointPositionForValue(a,this.getParsed(a).r),l=o?n.xCenter:r.x,h=o?n.yCenter:r.y,c={x:l,y:h,angle:r.angle,skip:isNaN(l)||isNaN(h),options:i};this.updateElement(e,a,c,s)}}},ScatterController:class extends js{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y);return{label:i[t]||"",value:"("+a+", "+r+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:n,count:o}=pt(e,i,s);if(this._drawStart=n,this._drawCount=o,mt(e)&&(n=0,o=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:o}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;const a=this.resolveDatasetElementOptions(t);a.segment=this.options.segment,this.updateElement(n,void 0,{animated:!s,options:a},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(c),u=this.includeOptions(n,d),f=a.axis,g=r.axis,{spanGaps:p,segment:m}=this.options,x=N(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||"none"===n;let _=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),p=b?e:{},y=s(i[g]),v=p[f]=a.getPixelForValue(i[f],c),M=p[g]=o||y?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,i,l):i[g],c);p.skip=isNaN(v)||isNaN(M)||y,p.stop=c>0&&Math.abs(i[f]-_[f])>x,m&&(p.parsed=i,p.raw=h.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),b||this.updateElement(e,c,p,n),_=i}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}});function Xn(t,e,i,s){const n=vi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Z(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Z(n.innerStart,0,a),innerEnd:Z(n.innerEnd,0,a)}}function qn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Kn(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let f=0;const g=n-l;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;f=(g-(0!==t?g*t/(t+s):g))/2}const p=(g-Math.max(.001,g*d-i/C)/d)/2,m=l+p+f,x=n-p-f,{outerStart:b,outerEnd:_,innerStart:y,innerEnd:v}=Xn(e,u,d,x-m),M=d-b,w=d-_,k=m+b/M,S=x-_/w,P=u+y,D=u+v,O=m+y/P,A=x-v/D;if(t.beginPath(),o){const e=(k+S)/2;if(t.arc(a,r,d,k,e),t.arc(a,r,d,e,S),_>0){const e=qn(w,S,a,r);t.arc(e.x,e.y,_,S,x+E)}const i=qn(D,x,a,r);if(t.lineTo(i.x,i.y),v>0){const e=qn(D,A,a,r);t.arc(e.x,e.y,v,x+E,A+Math.PI)}const s=(x-v/u+(m+y/u))/2;if(t.arc(a,r,u,x-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=qn(P,O,a,r);t.arc(e.x,e.y,y,O+Math.PI,m-E)}const n=qn(M,m,a,r);if(t.lineTo(n.x,n.y),b>0){const e=qn(M,k,a,r);t.arc(e.x,e.y,b,m-E,k)}}else{t.moveTo(a,r);const e=Math.cos(k)*d+a,i=Math.sin(k)*d+r;t.lineTo(e,i);const s=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(s,n)}t.closePath()}function Gn(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,g?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let p=e.endAngle;if(o){Kn(t,e,i,s,p,n);for(let e=0;e<o;++e)t.stroke();isNaN(r)||(p=a+(r%O||O))}g&&function(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(o,a,r,s-h,i+h),l>n?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+E,s-E),t.closePath(),t.clip()}(t,e,p),l.selfJoin&&p-a>=C&&0===f&&"miter"!==c&&function(t,e,i){const{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,G(s-i));if(t.beginPath(),t.arc(n,o,a-h/2,s+d/2,i-d/2),r>0){const e=Math.min(h/r,G(s-i));t.arc(n,o,r+h/2,i-e/2,s+e/2,!0)}else{const e=Math.min(h/2,a*G(s-i));if("round"===c)t.arc(n,o,e,i-C/2,s+C/2,!0);else if("bevel"===c){const a=2*e*e,r=-a*Math.cos(i+C/2)+n,l=-a*Math.sin(i+C/2)+o,h=a*Math.cos(s+C/2)+n,c=a*Math.sin(s+C/2)+o;t.lineTo(r,l),t.lineTo(h,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,p),o||(Kn(t,e,i,s,p,n),t.stroke())}function Jn(t,e,i=e){t.lineCap=l(i.borderCapStyle,e.borderCapStyle),t.setLineDash(l(i.borderDash,e.borderDash)),t.lineDashOffset=l(i.borderDashOffset,e.borderDashOffset),t.lineJoin=l(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=l(i.borderWidth,e.borderWidth),t.strokeStyle=l(i.borderColor,e.borderColor)}function Zn(t,e,i){t.lineTo(i.x,i.y)}function Qn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=n<a&&o<a||n>r&&o>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function to(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:h}=Qn(n,i,s),c=function(t){return t.stepped?Fe:t.tension||"monotone"===t.cubicInterpolationMode?Ve:Zn}(o);let d,u,f,{move:g=!0,reverse:p}=s||{};for(d=0;d<=h;++d)u=n[(r+(p?h-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,f,u,p,o.stepped),f=u);return l&&(u=n[(r+(p?h:0))%a],c(t,f,u,p,o.stepped)),!!l}function eo(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=Qn(n,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,f,g,p,m=0,x=0;const b=t=>(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<f?f=i:i>g&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,f=g=i),p=i}_()}function io(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?eo:to}const so="function"==typeof Path2D;function no(t,e,i,s){so&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Jn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=io(e);for(const r of n)Jn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class oo extends $s{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;hi(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=zi(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Ii(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?pi:t.tension||"monotone"===t.cubicInterpolationMode?mi:gi}(i);let l,h;for(l=0,h=o.length;l<h;++l){const{start:h,end:c}=o[l],d=n[h],u=n[c];if(d===u){a.push(d);continue}const f=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return io(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=io(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),no(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function ao(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}function ro(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=a/2,r=Math.min(i,n),l=Math.max(i,n),h=s-d,c=s+d):(d=o/2,r=i-d,l=i+d,h=Math.min(s,n),c=Math.max(s,n)),{left:r,top:h,right:l,bottom:c}}function lo(t,e,i,s){return t?0:Z(e,i,s)}function ho(t){const e=ro(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=Mi(s);return{t:lo(n.top,o.top,0,i),r:lo(n.right,o.right,0,e),b:lo(n.bottom,o.bottom,0,i),l:lo(n.left,o.left,0,e)}}(t,i/2,s/2),a=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,a=wi(n),r=Math.min(e,i),l=t.borderSkipped,h=s||o(n);return{topLeft:lo(!h||l.top||l.left,a.topLeft,0,r),topRight:lo(!h||l.top||l.right,a.topRight,0,r),bottomLeft:lo(!h||l.bottom||l.left,a.bottomLeft,0,r),bottomRight:lo(!h||l.bottom||l.right,a.bottomRight,0,r)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:a},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,a.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(n.b,n.r))}}}}function co(t,e,i,s){const n=null===e,o=null===i,a=t&&!(n&&o)&&ro(t,s);return a&&(n||tt(e,a.left,a.right))&&(o||tt(i,a.top,a.bottom))}function uo(t,e){t.rect(e.x,e.y,e.w,e.h)}function fo(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}var go=Object.freeze({__proto__:null,ArcElement:class extends $s{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=X(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=l(d,r-a),g=J(n,a,r)&&a!==r,p=f>=O||g,m=tt(o,h+u,c+u);return p&&m}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>O?Math.floor(i/O):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(C,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Kn(t,e,i,s,l,n);for(let e=0;e<o;++e)t.fill();isNaN(r)||(l=a+(r%O||O))}Kn(t,e,i,s,l,n),t.fill()}(t,this,r,n,o),Gn(t,this,r,n,o),t.restore()}},BarElement:class extends $s{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:o}=ho(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?He:uo;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,fo(o,e,n)),t.clip(),a(t,fo(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,fo(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return co(this,t,e,i)}inXRange(t,e){return co(this,t,null,e)}inYRange(t,e){return co(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:oo,PointElement:class extends $s{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return ao(this,t,"x",e)}inYRange(t,e){return ao(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Re(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Le(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});function po(t,e,i,s){const n=t.indexOf(e);if(-1===n)return((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}function mo(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function xo(t,e,{horizontal:i,minRotation:s}){const n=$(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class bo extends tn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return s(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,a=t=>n=i?n:t;if(t){const t=F(s),e=F(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=function(t,e){const i=[],{bounds:n,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=t,f=o||1,g=c-1,{min:p,max:m}=e,x=!s(a),b=!s(r),_=!s(h),y=(m-p)/(d+1);let v,M,w,k,S=B((m-p)/g/f)*f;if(S<1e-14&&!x&&!b)return[{value:p},{value:m}];k=Math.ceil(m/S)-Math.floor(p/S),k>g&&(S=B(k*S/g/f)*f),s(l)||(v=Math.pow(10,l),S=Math.ceil(S*v)/v),"ticks"===n?(M=Math.floor(p/S)*S,w=Math.ceil(m/S)*S):(M=p,w=m),x&&b&&o&&H((r-a)/o,S/1e3)?(k=Math.round(Math.min((r-a)/S,c)),S=(r-a)/k,M=a,w=r):_?(M=x?a:M,w=b?r:w,k=h-1,S=(w-M)/k):(k=(w-M)/S,k=V(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const P=Math.max(U(S),U(M));v=Math.pow(10,s(l)?P:l),M=Math.round(M*v)/v,w=Math.round(w*v)/v;let D=0;for(x&&(u&&M!==a?(i.push({value:a}),M<a&&D++,V(Math.round((M+D*S)*v)/v,a,xo(a,y,t))&&D++):M<a&&D++);D<k;++D){const t=Math.round((M+D*S)*v)/v;if(b&&t>r)break;i.push({value:t})}return b&&u&&w!==r?i.length&&V(i[i.length-1].value,r,xo(r,y,t))?i[i.length-1].value=r:i.push({value:r}):b&&w!==r||i.push({value:w}),i}({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&j(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ne(t,this.chart.options.locale,this.options.ticks.format)}}class _o extends bo{static id="linear";static defaults={ticks:{callback:ae.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?t:0,this.max=a(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=$(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const yo=t=>Math.floor(z(t)),vo=(t,e)=>Math.pow(10,yo(t)+e);function Mo(t){return 1===t/Math.pow(10,yo(t))}function wo(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function ko(t,{min:e,max:i}){e=r(t.min,e);const s=[],n=yo(e);let o=function(t,e){let i=yo(e-t);for(;wo(t,e,i)>10;)i++;for(;wo(t,e,i)<10;)i--;return Math.min(i,yo(t))}(e,i),a=o<0?Math.pow(10,Math.abs(o)):1;const l=Math.pow(10,o),h=n>o?Math.pow(10,n):0,c=Math.round((e-h)*a)/a,d=Math.floor((e-h)/l/10)*l*10;let u=Math.floor((c-d)/Math.pow(10,o)),f=r(t.min,Math.round((h+d+u*Math.pow(10,o))*a)/a);for(;f<i;)s.push({value:f,major:Mo(f),significand:u}),u>=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,a=o>=0?1:a),f=Math.round((h+d+u*Math.pow(10,o))*a)/a;const g=r(t.max,f);return s.push({value:g,major:Mo(g),significand:u}),s}class So extends tn{static id="logarithmic";static defaults={ticks:{callback:ae.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=bo.prototype.parse.apply(this,[t,e]);if(0!==i)return a(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?Math.max(0,t):null,this.max=a(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!a(this._userMin)&&(this.min=t===vo(this.min,0)?vo(this.min,-1):vo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t;i===s&&(i<=0?(n(1),o(10)):(n(vo(i,-1)),o(vo(s,1)))),i<=0&&n(vo(s,-1)),s<=0&&o(vo(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=ko({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&j(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ne(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=z(t),this._valueRange=z(this.max)-z(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(z(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Po(t){const e=t.ticks;if(e.display&&t.display){const t=ki(e.backdropPadding);return l(e.font&&e.font.size,ue.font.size)+t.height}return 0}function Do(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Co(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],o=[],a=t._pointLabels.length,r=t.options.pointLabels,l=r.centerPointLabels?C/a:0;for(let u=0;u<a;u++){const a=r.setContext(t.getPointLabelContext(u));o[u]=a.padding;const f=t.getPointPosition(u,t.drawingArea+o[u],l),g=Si(a.font),p=(h=t.ctx,c=g,d=n(d=t._pointLabels[u])?d:[d],{w:Oe(h,c.string,d),h:d.length*c.lineHeight});s[u]=p;const m=G(t.getIndexAngle(u)+l),x=Math.round(Y(m));Oo(i,e,m,Do(x,f.x,p.w,0,180),Do(x,f.y,p.h,90,270))}var h,c,d;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const s=[],n=t._pointLabels.length,o=t.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Po(o)/2,additionalAngle:a?C/n:0};let h;for(let o=0;o<n;o++){l.padding=i[o],l.size=e[o];const n=Ao(t,o,l);s.push(n),"auto"===r&&(n.visible=To(n,h),n.visible&&(h=n))}return s}(t,s,o)}function Oo(t,e,i,s,n){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/o,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function Ao(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=i,l=t.getPointPosition(e,s+n+a,o),h=Math.round(Y(G(l.angle+E))),c=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,r.h,h),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(h),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function To(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:o}=t;return!(Re({x:i,y:s},e)||Re({x:i,y:o},e)||Re({x:n,y:s},e)||Re({x:n,y:o},e))}function Lo(t,e,i){const{left:n,top:o,right:a,bottom:r}=i,{backdropColor:l}=e;if(!s(l)){const i=wi(e.borderRadius),s=ki(e.backdropPadding);t.fillStyle=l;const h=n-s.left,c=o-s.top,d=a-n+s.width,u=r-o+s.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),He(t,{x:h,y:c,w:d,h:u,radius:i}),t.fill()):t.fillRect(h,c,d,u)}}function Eo(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,O);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o<s;o++)i=t.getPointPosition(o,e),n.lineTo(i.x,i.y)}}class Ro extends bo{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ae.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ki(Po(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=a(t)&&!isNaN(t)?t:0,this.max=a(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Po(this.options))}generateTickLabels(t){bo.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=d(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?Co(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return G(t*(O/(this._pointLabels.length||1))+$(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(s(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(s(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Ci(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-E+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Eo(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:n}=e,o=this._pointLabels.length;let a,r,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=s.setContext(t.getPointLabelContext(n));Lo(i,o,e);const a=Si(o.font),{x:r,y:l,textAlign:h}=e;Ne(i,t._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}(this,o),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),a=s.setContext(i),l=n.setContext(i);!function(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Eo(t,i,a,s),o.closePath(),o.stroke(),o.restore())}(this,a,r,o,l)}})),i.display){for(t.save(),a=o-1;a>=0;a--){const s=i.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=s;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&this.min>=0&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=Si(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=ki(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Ne(t,s.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})})),t.restore()}drawTitle(){}}const Io={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},zo=Object.keys(Io);function Fo(t,e){return t-e}function Vo(t,e){if(s(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:r}=t._parseOpts;let l=e;return"function"==typeof n&&(l=n(l)),a(l)||(l="string"==typeof n?i.parse(l,n):i.parse(l)),null===l?null:(o&&(l="week"!==o||!N(r)&&!0!==r?i.startOf(l,o):i.startOf(l,"isoWeek",r)),+l)}function Bo(t,e,i,s){const n=zo.length;for(let o=zo.indexOf(t);o<n-1;++o){const t=Io[zo[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return zo[o]}return zo[n-1]}function Wo(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=et(i,e);t[i[s]>=e?i[s]:i[n]]=!0}}else t[e]=!0}function No(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return 0!==o&&i?function(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}(t,s,n,i):s}class Ho extends tn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new In._date(t.adapters.date);s.init(e),b(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Vo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:r}=this.getUserBounds();function l(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}o&&r||(l(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(this.getMinMax(!1))),s=a(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=a(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=nt(s,n,this.max);return this._unit=e.unit||(i.autoSkip?Bo(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=zo.length-1;o>=zo.indexOf(i);o--){const i=zo[o];if(Io[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return zo[i?zo.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=zo.indexOf(t)+1,i=zo.length;e<i;++e)if(Io[zo[e]].common)return zo[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),No(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Z(s,0,o),n=Z(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||Bo(n.minUnit,e,i,this._getLabelCapacity(e)),a=l(s.ticks.stepSize,1),r="week"===o&&n.isoWeekday,h=N(r)||!0===r,c={};let d,u,f=e;if(h&&(f=+t.startOf(f,"isoWeek",r)),f=+t.startOf(f,h?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g="data"===s.ticks.source&&this.getDataTimestamps();for(d=f,u=0;d<i;d=+t.add(d,a,o),u++)Wo(c,d,g);return d!==i&&"ticks"!==s.bounds&&1!==u||Wo(c,d,g),Object.keys(c).sort(Fo).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,s=this._unit,n=e||i[s];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return d(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&a[r],c=l&&a[l],u=i[e],f=l&&c&&u&&u.major;return this._adapter.format(t,s||(f?c:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=$(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,No(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Vo(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return lt(t.sort(Fo))}}function jo(t,e,i){let s,n,o,a,r=0,l=t.length-1;i?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=it(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=it(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}var $o=Object.freeze({__proto__:null,CategoryScale:class extends tn{static id="category";static defaults={ticks:{callback:mo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(s(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Z(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:po(i,t,l(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return mo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:_o,LogarithmicScale:So,RadialLinearScale:Ro,TimeScale:Ho,TimeSeriesScale:class extends Ho{static id="timeseries";static defaults=Ho.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=jo(e,this.min),this._tableRange=jo(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)h=s[o+1],r=s[o-1],l=s[o],Math.round((h+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(jo(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return jo(this._table,i*this._tableRange+this._minPos,!0)}}});const Yo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Uo=Yo.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function Xo(t){return Yo[t%Yo.length]}function qo(t){return Uo[t%Uo.length]}function Ko(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof $n?e=function(t,e){return t.backgroundColor=t.data.map((()=>Xo(e++))),e}(i,e):n instanceof Yn?e=function(t,e){return t.backgroundColor=t.data.map((()=>qo(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=Xo(e),t.backgroundColor=qo(e),++e}(i,e))}}function Go(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var Jo={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:o}=n,a=Go(s)||(r=n)&&(r.borderColor||r.backgroundColor)||o&&Go(o)||"rgba(0,0,0,0.1)"!==ue.borderColor||"rgba(0,0,0,0.1)"!==ue.backgroundColor;var r;if(!i.forceOverride&&a)return;const l=Ko(t);s.forEach(l)}};function Zo(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Qo(t){t.data.datasets.forEach((t=>{Zo(t)}))}var ta={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Qo(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:a,indexAxis:r}=e,l=t.getDatasetMeta(o),h=a||e.data;if("y"===Pi([r,t.options.indexAxis]))return;if(!l.controller.supportsDecimation)return;const c=t.scales[l.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:d,count:u}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Z(it(e,o.axis,a).lo,0,i-1)),s=h?Z(it(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(l,h);if(u<=(i.threshold||4*n))return void Zo(e);let f;switch(s(a)&&(e._data=h,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":f=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;c<o-2;c++){let s,n=0,o=0;const h=Math.floor((c+1)*r)+1+e,m=Math.min(Math.floor((c+2)*r)+1,i)+e,x=m-h;for(s=h;s<m;s++)n+=t[s].x,o+=t[s].y;n/=x,o/=x;const b=Math.floor(c*r)+1+e,_=Math.min(Math.floor((c+1)*r)+1,i)+e,{x:y,y:v}=t[p];for(u=f=-1,s=b;s<_;s++)f=.5*Math.abs((y-n)*(t[s].y-v)-(y-t[s].x)*(o-v)),f>u&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(h,d,u,n,i);break;case"min-max":f=function(t,e,i,n){let o,a,r,l,h,c,d,u,f,g,p=0,m=0;const x=[],b=e+i-1,_=t[e].x,y=t[b].x-_;for(o=e;o<e+i;++o){a=t[o],r=(a.x-_)/y*n,l=a.y;const e=0|r;if(e===h)l<f?(f=l,c=o):l>g&&(g=l,d=o),p=(m*p+a.x)/++m;else{const i=o-1;if(!s(c)&&!s(d)){const e=Math.min(c,d),s=Math.max(c,d);e!==u&&e!==i&&x.push({...t[e],x:p}),s!==u&&s!==i&&x.push({...t[s],x:p})}o>0&&i!==u&&x.push(t[i]),x.push(a),h=e,m=0,f=g=l,c=d=u=o}}return x}(h,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=f}))},destroy(t){Qo(t)}};function ea(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=G(n),o=G(o)),{property:t,start:n,end:o}}function ia(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function sa(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function na(t,e){let i=[],s=!1;return n(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=ia(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new oo({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function oa(t){return t&&!1!==t.fill}function aa(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!a(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function ra(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=l(i&&i.target,i);void 0===s&&(s=!!e.backgroundColor);if(!1===s||null===s)return!1;if(!0===s)return"origin";return s}(t);if(o(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return a(n)&&Math.floor(n)===n?function(t,e,i,s){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=s)return!1;return i}(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function la(t,e,i){const s=[];for(let n=0;n<i.length;n++){const o=i[n],{first:a,last:r,point:l}=ha(o,e,"x");if(!(!l||a&&r))if(a)s.unshift(l);else if(t.push(l),!r)break}t.push(...s)}function ha(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const n=s[i],o=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],s=a[e.start][i],h=a[e.end][i];if(tt(n,s,h)){r=n===s,l=n===h;break}}return{first:r,last:l,point:s}}class ca{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:n,radius:o}=this;return e=e||{start:0,end:O},t.arc(s,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}}function da(t){const{chart:e,fill:i,line:s}=t;if(a(i))return function(t,e){const i=t.getDatasetMeta(e),s=i&&t.isDatasetVisible(e);return s?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:s}=t,n=[],o=s.segments,a=s.points,r=function(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){const n=s[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);r.push(na({x:null,y:e.bottom},s));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)la(n,a[t],r)}return new oo({points:n,options:{}})}(t);if("shape"===i)return!0;const n=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,s=e.options,n=e.getLabels().length,a=s.reverse?e.max:e.min,r=function(t,e,i){let s;return s="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:o(t)?t.value:e.getBaseValue(),s}(i,e,a),l=[];if(s.grid.circular){const t=e.getPointPositionForValue(0,a);return new ca({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<n;++t)l.push(e.getPointPositionForValue(t,r));return l}(t);return function(t){const{scale:e={},fill:i}=t,s=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:o(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(a(s)){const t=e.isHorizontal();return{x:t?s:null,y:t?null:s}}return null}(t)}(t);return n instanceof ca?n:na(n,s)}function ua(t,e,i){const s=da(e),{chart:n,index:o,line:a,scale:r,axis:l}=e,h=a.options,c=h.fill,d=h.backgroundColor,{above:u=d,below:f=d}=c||{},g=n.getDatasetMeta(o),p=Ni(n,g);s&&a.points.length&&(Ie(t,i),function(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r,clip:l}=e,h=i._loop?"angle":e.axis;t.save();let c=o;o!==n&&("x"===h?(fa(t,s,a.top),pa(t,{line:i,target:s,color:n,scale:r,property:h,clip:l}),t.restore(),t.save(),fa(t,s,a.bottom)):"y"===h&&(ga(t,s,a.left),pa(t,{line:i,target:s,color:o,scale:r,property:h,clip:l}),t.restore(),t.save(),ga(t,s,a.right),c=n));pa(t,{line:i,target:s,color:c,scale:r,property:h,clip:l}),t.restore()}(t,{line:a,target:s,above:u,below:f,area:i,scale:r,axis:l,clip:p}),ze(t))}function fa(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[ia(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function ga(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[ia(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(i,h.y),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(i,c.y)}t.lineTo(i,e.first().y),t.closePath(),t.clip()}function pa(t,e){const{line:i,target:s,property:n,color:o,scale:a,clip:r}=e,l=function(t,e,i){const s=t.segments,n=t.points,o=e.points,a=[];for(const t of s){let{start:s,end:r}=t;r=ia(s,r,n);const l=ea(i,n[s],n[r],t.loop);if(!e.segments){a.push({source:t,target:l,start:n[s],end:n[r]});continue}const h=Ii(e,l);for(const e of h){const s=ea(i,o[e.start],o[e.end],e.loop),r=Ri(t,n,s);for(const t of r)a.push({source:t,target:e,start:{[i]:sa(l,s,"start",Math.max)},end:{[i]:sa(l,s,"end",Math.min)}})}}return a}(i,s,n);for(const{source:e,target:h,start:c,end:d}of l){const{style:{backgroundColor:l=o}={}}=e,u=!0!==s;t.save(),t.fillStyle=l,ma(t,a,r,u&&ea(n,c,d)),t.beginPath();const f=!!i.pathSegment(t,e);let g;if(u){f?t.closePath():xa(t,s,d,n);const e=!!s.pathSegment(t,h,{move:f,reverse:!0});g=f&&e,g||xa(t,s,c,n)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function ma(t,e,i,s){const n=e.chart.chartArea,{property:o,start:a,end:r}=s||{};if("x"===o||"y"===o){let e,s,l,h;"x"===o?(e=a,s=n.top,l=r,h=n.bottom):(e=n.left,s=a,l=n.right,h=r),t.beginPath(),i&&(e=Math.max(e,i.left),l=Math.min(l,i.right),s=Math.max(s,i.top),h=Math.min(h,i.bottom)),t.rect(e,s,l-e,h-s),t.clip()}}function xa(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}var ba={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof oo&&(l={visible:t.isDatasetVisible(a),index:a,fill:ra(r,a,s),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],l&&!1!==l.fill&&(l.fill=aa(n,a,i.propagate))},beforeDraw(t,e,i){const s="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&ua(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;oa(i)&&ua(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;oa(s)&&"beforeDatasetDraw"===i.drawTime&&ua(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const _a=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class ya extends $s{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=d(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=Si(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=_a(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const o=function(t,e,i,s){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+s.measureText(n).width}(s,t,e,i),a=function(t,e,i){let s=t;"string"!=typeof e.text&&(s=va(e,i));return s}(n,s,e.lineHeight);return{itemWidth:o,itemHeight:a}}(i,e,n,t,s);o>0&&u+m+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=Oi(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=ft(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=ft(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+s}else{let n=0,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+s,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ie(t,this),this._draw(),ze(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=ue.color,r=Oi(t.rtl,this.left,this.width),h=Si(o.font),{padding:c}=o,d=h.size,u=d/2;let f;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=_a(o,d),x=this.isHorizontal(),b=this._computeTitleHeight();f=x?{x:ft(n,this.left+c,this.right-i[0]),y:this.top+c+b,line:0}:{x:this.left+c,y:ft(n,this.top+b+c,this.bottom-e[0].height),line:0},Ai(this.ctx,t.textDirection);const _=m+c;this.legendItems.forEach(((y,v)=>{s.strokeStyle=y.fontColor,s.fillStyle=y.fontColor;const M=s.measureText(y.text).width,w=r.textAlign(y.textAlign||(y.textAlign=o.textAlign)),k=g+u+M;let S=f.x,P=f.y;r.setWidth(this.width),x?v>0&&S+k+c>this.right&&(P=f.y+=_,f.line++,S=f.x=ft(n,this.left+c,this.right-i[f.line])):v>0&&P+_>this.bottom&&(S=f.x=S+e[f.line].width+c,f.line++,P=f.y=ft(n,this.top+b+c,this.bottom-e[f.line].height));if(function(t,e,i){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const n=l(i.lineWidth,1);if(s.fillStyle=l(i.fillStyle,a),s.lineCap=l(i.lineCap,"butt"),s.lineDashOffset=l(i.lineDashOffset,0),s.lineJoin=l(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=l(i.strokeStyle,a),s.setLineDash(l(i.lineDash,[])),o.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,g/2);Ee(s,a,l,e+u,o.pointStyleWidth&&g)}else{const o=e+Math.max((d-p)/2,0),a=r.leftForLtr(t,g),l=wi(i.borderRadius);s.beginPath(),Object.values(l).some((t=>0!==t))?He(s,{x:a,y:o,w:g,h:p,radius:l}):s.rect(a,o,g,p),s.fill(),0!==n&&s.stroke()}s.restore()}(r.x(S),P,y),S=gt(w,S+g+u,x?S+k:this.right,t.rtl),function(t,e,i){Ne(s,i.text,t,e+m/2,h,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(S),P,y),x)f.x+=k+c;else if("string"!=typeof y.text){const t=h.lineHeight;f.y+=va(y,t)+c}else f.y+=_})),Ti(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Si(e.font),s=ki(e.padding);if(!e.display)return;const n=Oi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=ft(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);h=l+ft(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ft(a,c,c+d);o.textAlign=n.textAlign(ut(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Ne(o,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=Si(t.font),i=ki(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(tt(t,this.left,this.right)&&tt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],tt(t,s.left,s.left+s.width)&&tt(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,a=(n=i,null!==(s=o)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);o&&!a&&d(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!a&&d(e.onHover,[t,i,this],this)}else i&&d(e.onClick,[t,i,this],this);var s,n}}function va(t,e){return e*(t.text?t.text.length:0)}var Ma={id:"legend",_element:ya,start(t,e,i){const s=t.legend=new ya({ctx:t.ctx,options:i,chart:t});ls.configure(t,s,i),ls.addBox(t,s)},stop(t){ls.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;ls.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),h=ki(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class wa extends $s{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=n(i.text)?i.text.length:1;this._padding=ki(i.padding);const o=s*Si(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r,l,h,c=0;return this.isHorizontal()?(l=ft(a,i,n),h=e+t,r=n-i):("left"===o.position?(l=i+t,h=ft(a,s,e),c=-.5*C):(l=n-t,h=ft(a,e,s),c=.5*C),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Si(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);Ne(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:ut(e.align),textBaseline:"middle",translation:[n,o]})}}var ka={id:"title",_element:wa,start(t,e,i){!function(t,e){const i=new wa({ctx:t.ctx,options:e,chart:t});ls.configure(t,i,e),ls.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ls.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Sa=new WeakMap;var Pa={id:"subtitle",start(t,e,i){const s=new wa({ctx:t.ctx,options:i,chart:t});ls.configure(t,s,i),ls.addBox(t,s),Sa.set(t,s)},stop(t){ls.removeBox(t,Sa.get(t)),Sa.delete(t)},beforeUpdate(t,e,i){const s=Sa.get(t);ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Da={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s.add(t.x),n+=t.y,++o}}if(0===o||0===s.size)return!1;return{x:[...s].reduce(((t,e)=>t+e))/s.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=q(e,s.getCenterPoint());t<r&&(r=t,n=s)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function Ca(t,e){return e&&(n(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Oa(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Aa(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ta(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=Si(e.bodyFont),h=Si(e.titleFont),c=Si(e.footerFont),d=o.length,f=n.length,g=s.length,p=ki(e.padding);let m=p.height,x=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){m+=g*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(m+=e.footerMarginTop+f*c.lineHeight+(f-1)*e.footerSpacing);let _=0;const y=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=h.string,u(t.title,y),i.font=l.string,u(t.beforeBody.concat(t.afterBody),y),_=e.displayColors?a+2+e.boxPadding:0,u(s,(t=>{u(t.before,y),u(t.lines,y),u(t.after,y)})),_=0,i.font=c.string,u(t.footer,y),i.restore(),x+=p.width,{width:x,height:m}}function La(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function Ea(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||La(t,e,i,s),yAlign:s}}function Ra(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Z(g,0,s.width-e.width),y:Z(p,0,s.height-e.height)}}function Ia(t,e,i){const s=ki(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function za(t){return Ca([],Oa(t))}function Fa(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Va={beforeTitle:e,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:e,beforeBody:e,beforeLabel:e,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return s(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:e,afterBody:e,beforeFooter:e,footer:e,afterFooter:e};function Ba(t,e,i,s){const n=t[e].call(i,s);return void 0===n?Va[e].call(i,s):n}class Wa extends $s{static positioners=Da;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new Ts(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Ci(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=Ba(i,"beforeTitle",this,t),n=Ba(i,"title",this,t),o=Ba(i,"afterTitle",this,t);let a=[];return a=Ca(a,Oa(s)),a=Ca(a,Oa(n)),a=Ca(a,Oa(o)),a}getBeforeBody(t,e){return za(Ba(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return u(t,(t=>{const e={before:[],lines:[],after:[]},n=Fa(i,t);Ca(e.before,Oa(Ba(n,"beforeLabel",this,t))),Ca(e.lines,Ba(n,"label",this,t)),Ca(e.after,Oa(Ba(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return za(Ba(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ba(i,"beforeFooter",this,t),n=Ba(i,"footer",this,t),o=Ba(i,"afterFooter",this,t);let a=[];return a=Ca(a,Oa(s)),a=Ca(a,Oa(n)),a=Ca(a,Oa(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;a<r;++a)l.push(Aa(this.chart,e[a]));return t.filter&&(l=l.filter(((e,s,n)=>t.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),u(l,(e=>{const i=Fa(t.callbacks,e);s.push(Ba(i,"labelColor",this,e)),n.push(Ba(i,"labelPointStyle",this,e)),o.push(Ba(i,"labelTextColor",this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Da[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Ta(this,i),a=Object.assign({},t,e),r=Ea(this.chart,i,a),l=Ra(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=wi(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,x,b,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,b=_+o,y=_-o):(p=d+f,m=p+o,b=_-o,y=_+o),x=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(b=u,_=b-o,p=m-o,x=m+o):(b=u+g,_=b+o,p=m+o,x=m-o),y=b),{x1:p,x2:m,x3:x,y1:b,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=Oi(i.rtl,this.x,this.width);for(t.x=Ia(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=Si(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:h}=n,c=Si(n.bodyFont),d=Ia(this,"left",n),u=s.x(d),f=l<c.lineHeight?(c.lineHeight-l)/2:0,g=e.y+f;if(n.usePointStyle){const e={radius:Math.min(h,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=s.leftForLtr(u,h)+h/2,o=g+l/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Le(t,e,i,o),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Le(t,e,i,o)}else{t.lineWidth=o(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const e=s.leftForLtr(u,h),i=s.leftForLtr(s.xPlus(u,1),h-2),r=wi(a.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,He(t,{x:e,y:g,w:h,h:l,radius:r}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),He(t,{x:i,y:g+1,w:h-2,h:l-2,radius:r}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,h,l),t.strokeRect(e,g,h,l),t.fillStyle=a.backgroundColor,t.fillRect(i,g+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=Si(i.bodyFont);let d=c.lineHeight,f=0;const g=Oi(i.rtl,this.x,this.width),p=function(i){e.fillText(i,g.x(t.x+f),t.y+d/2),t.y+=d+n},m=g.textAlign(o);let x,b,_,y,v,M,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Ia(this,m,i),e.fillStyle=i.bodyColor,u(this.beforeBody,p),f=a&&"right"!==m?"center"===o?l/2+h:l+2+h:0,y=0,M=s.length;y<M;++y){for(x=s[y],b=this.labelTextColors[y],e.fillStyle=b,u(x.before,p),_=x.lines,a&&_.length&&(this._drawColorBox(e,t,y,g,i),d=Math.max(c.lineHeight,r)),v=0,w=_.length;v<w;++v)p(_[v]),d=c.lineHeight;u(x.after,p)}f=0,d=c.lineHeight,u(this.afterBody,p),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=Oi(i.rtl,this.x,this.width);for(t.x=Ia(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=Si(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+c,r),"top"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(a+l,r+h-f),e.quadraticCurveTo(a+l,r+h,a+l-f,r+h),"bottom"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+h),e.quadraticCurveTo(a,r+h,a,r+h-u),"center"===o&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(a,r+c),e.quadraticCurveTo(a,r,a+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Da[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Ta(this,t),a=Object.assign({},i,this._size),r=Ea(e,t,a),l=Ra(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ki(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Ai(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Ti(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!f(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!f(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Da[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var Na={id:"tooltip",_element:Wa,positioners:Da,afterInit(t,e,i){i&&(t.tooltip=new Wa({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Va},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return Tn.register(Un,$o,go,t),Tn.helpers={...Hi},Tn._adapters=In,Tn.Animation=As,Tn.Animations=Ts,Tn.animator=bt,Tn.controllers=nn.controllers.items,Tn.DatasetController=js,Tn.Element=$s,Tn.elements=go,Tn.Interaction=Ki,Tn.layouts=ls,Tn.platforms=Ds,Tn.Scale=tn,Tn.Ticks=ae,Object.assign(Tn,Un,$o,go,t,Ds),Tn.Chart=Tn,"undefined"!=typeof window&&(window.Chart=Tn),Tn})); 34170//# sourceMappingURL=
34170/assets/chart.js/dist/chart.umd.js.map 34171//! 34172;
vendor: 19,817 bytes, lines 34173-35022
34173/*! 34174 * chartjs-plugin-datalabels v2.2.0 34175 * https://chartjs-plugin-datalabels.netlify.app 34176 * (c) 2017-2022 chartjs-plugin-datalabels contributors 34177 * Released under the MIT license 34178 */ 34179(function (global, factory) { 34180typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('chart.js/helpers'), require('chart.js')) : 34181typeof define === 'function' && define.amd ? define(['chart.js/helpers', 'chart.js'], factory) : 34182(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ChartDataLabels = factory(global.Chart.helpers, global.Chart)); 34183})(this, (function (helpers, chart_js) { 'use strict'; 34184 34185var devicePixelRatio = (function() { 34186 if (typeof window !== 'undefined') { 34187 if (window.devicePixelRatio) { 34188 return window.devicePixelRatio; 34189 } 34190 34191 // devicePixelRatio is undefined on IE10 34192 // https://stackoverflow.com/a/20204180/8837887 34193 // https://github.com/chartjs/chartjs-plugin-datalabels/issues/85 34194 var screen = window.screen; 34195 if (screen) { 34196 return (screen.deviceXDPI || 1) / (screen.logicalXDPI || 1); 34197 } 34198 } 34199 34200 return 1; 34201}()); 34202 34203var utils = { 34204 // @todo move this in Chart.helpers.toTextLines 34205 toTextLines: function(inputs) { 34206 var lines = []; 34207 var input; 34208 34209 inputs = [].concat(inputs); 34210 while (inputs.length) { 34211 input = inputs.pop(); 34212 if (typeof input === 'string') { 34213 lines.unshift.apply(lines, input.split('\n')); 34214 } else if (Array.isArray(input)) { 34215 inputs.push.apply(inputs, input); 34216 } else if (!helpers.isNullOrUndef(inputs)) { 34217 lines.unshift('' + input); 34218 } 34219 } 34220 34221 return lines; 34222 }, 34223 34224 // @todo move this in Chart.helpers.canvas.textSize 34225 // @todo cache calls of measureText if font doesn't change?! 34226 textSize: function(ctx, lines, font) { 34227 var items = [].concat(lines); 34228 var ilen = items.length; 34229 var prev = ctx.font; 34230 var width = 0; 34231 var i; 34232 34233 ctx.font = font.string; 34234 34235 for (i = 0; i < ilen; ++i) { 34236 width = Math.max(ctx.measureText(items[i]).width, width); 34237 } 34238 34239 ctx.font = prev; 34240 34241 return { 34242 height: ilen * font.lineHeight, 34243 width: width 34244 }; 34245 }, 34246 34247 /** 34248 * Returns value bounded by min and max. This is equivalent to max(min, min(value, max)). 34249 * @todo move this method in Chart.helpers.bound 34250 * https://doc.qt.io/qt-5/qtglobal.html#qBound 34251 */ 34252 bound: function(min, value, max) { 34253 return Math.max(min, Math.min(value, max)); 34254 }, 34255 34256 /** 34257 * Returns an array of pair [value, state] where state is: 34258 * * -1: value is only in a0 (removed) 34259 * * 1: value is only in a1 (added) 34260 */ 34261 arrayDiff: function(a0, a1) { 34262 var prev = a0.slice(); 34263 var updates = []; 34264 var i, j, ilen, v; 34265 34266 for (i = 0, ilen = a1.length; i < ilen; ++i) { 34267 v = a1[i]; 34268 j = prev.indexOf(v); 34269 34270 if (j === -1) { 34271 updates.push([v, 1]); 34272 } else { 34273 prev.splice(j, 1); 34274 } 34275 } 34276 34277 for (i = 0, ilen = prev.length; i < ilen; ++i) { 34278 updates.push([prev[i], -1]); 34279 } 34280 34281 return updates; 34282 }, 34283 34284 /** 34285 * https://github.com/chartjs/chartjs-plugin-datalabels/issues/70 34286 */ 34287 rasterize: function(v) { 34288 return Math.round(v * devicePixelRatio) / devicePixelRatio; 34289 } 34290}; 34291 34292function orient(point, origin) { 34293 var x0 = origin.x; 34294 var y0 = origin.y; 34295 34296 if (x0 === null) { 34297 return {x: 0, y: -1}; 34298 } 34299 if (y0 === null) { 34300 return {x: 1, y: 0}; 34301 } 34302 34303 var dx = point.x - x0; 34304 var dy = point.y - y0; 34305 var ln = Math.sqrt(dx * dx + dy * dy); 34306 34307 return { 34308 x: ln ? dx / ln : 0, 34309 y: ln ? dy / ln : -1 34310 }; 34311} 34312 34313function aligned(x, y, vx, vy, align) { 34314 switch (align) { 34315 case 'center': 34316 vx = vy = 0; 34317 break; 34318 case 'bottom': 34319 vx = 0; 34320 vy = 1; 34321 break; 34322 case 'right': 34323 vx = 1; 34324 vy = 0; 34325 break; 34326 case 'left': 34327 vx = -1; 34328 vy = 0; 34329 break; 34330 case 'top': 34331 vx = 0; 34332 vy = -1; 34333 break; 34334 case 'start': 34335 vx = -vx; 34336 vy = -vy; 34337 break; 34338 case 'end': 34339 // keep natural orientation 34340 break; 34341 default: 34342 // clockwise rotation (in degree) 34343 align *= (Math.PI / 180); 34344 vx = Math.cos(align); 34345 vy = Math.sin(align); 34346 break; 34347 } 34348 34349 return { 34350 x: x, 34351 y: y, 34352 vx: vx, 34353 vy: vy 34354 }; 34355} 34356 34357// Line clipping (CohenâSutherland algorithm) 34358// https://en.wikipedia.org/wiki/CohenâSutherland_algorithm 34359 34360var R_INSIDE = 0; 34361var R_LEFT = 1; 34362var R_RIGHT = 2; 34363var R_BOTTOM = 4; 34364var R_TOP = 8; 34365 34366function region(x, y, rect) { 34367 var res = R_INSIDE; 34368 34369 if (x < rect.left) { 34370 res |= R_LEFT; 34371 } else if (x > rect.right) { 34372 res |= R_RIGHT; 34373 } 34374 if (y < rect.top) { 34375 res |= R_TOP; 34376 } else if (y > rect.bottom) { 34377 res |= R_BOTTOM; 34378 } 34379 34380 return res; 34381} 34382 34383function clipped(segment, area) { 34384 var x0 = segment.x0; 34385 var y0 = segment.y0; 34386 var x1 = segment.x1; 34387 var y1 = segment.y1; 34388 var r0 = region(x0, y0, area); 34389 var r1 = region(x1, y1, area); 34390 var r, x, y; 34391 34392 // eslint-disable-next-line no-constant-condition 34393 while (true) { 34394 if (!(r0 | r1) || (r0 & r1)) { 34395 // both points inside or on the same side: no clipping 34396 break; 34397 } 34398 34399 // at least one point is outside 34400 r = r0 || r1; 34401 34402 if (r & R_TOP) { 34403 x = x0 + (x1 - x0) * (area.top - y0) / (y1 - y0); 34404 y = area.top; 34405 } else if (r & R_BOTTOM) { 34406 x = x0 + (x1 - x0) * (area.bottom - y0) / (y1 - y0); 34407 y = area.bottom; 34408 } else if (r & R_RIGHT) { 34409 y = y0 + (y1 - y0) * (area.right - x0) / (x1 - x0); 34410 x = area.right; 34411 } else if (r & R_LEFT) { 34412 y = y0 + (y1 - y0) * (area.left - x0) / (x1 - x0); 34413 x = area.left; 34414 } 34415 34416 if (r === r0) { 34417 x0 = x; 34418 y0 = y; 34419 r0 = region(x0, y0, area); 34420 } else { 34421 x1 = x; 34422 y1 = y; 34423 r1 = region(x1, y1, area); 34424 } 34425 } 34426 34427 return { 34428 x0: x0, 34429 x1: x1, 34430 y0: y0, 34431 y1: y1 34432 }; 34433} 34434 34435function compute$1(range, config) { 34436 var anchor = config.anchor; 34437 var segment = range; 34438 var x, y; 34439 34440 if (config.clamp) { 34441 segment = clipped(segment, config.area); 34442 } 34443 34444 if (anchor === 'start') { 34445 x = segment.x0; 34446 y = segment.y0; 34447 } else if (anchor === 'end') { 34448 x = segment.x1; 34449 y = segment.y1; 34450 } else { 34451 x = (segment.x0 + segment.x1) / 2; 34452 y = (segment.y0 + segment.y1) / 2; 34453 } 34454 34455 return aligned(x, y, range.vx, range.vy, config.align); 34456} 34457 34458var positioners = { 34459 arc: function(el, config) { 34460 var angle = (el.startAngle + el.endAngle) / 2; 34461 var vx = Math.cos(angle); 34462 var vy = Math.sin(angle); 34463 var r0 = el.innerRadius; 34464 var r1 = el.outerRadius; 34465 34466 return compute$1({ 34467 x0: el.x + vx * r0, 34468 y0: el.y + vy * r0, 34469 x1: el.x + vx * r1, 34470 y1: el.y + vy * r1, 34471 vx: vx, 34472 vy: vy 34473 }, config); 34474 }, 34475 34476 point: function(el, config) { 34477 var v = orient(el, config.origin); 34478 var rx = v.x * el.options.radius; 34479 var ry = v.y * el.options.radius; 34480 34481 return compute$1({ 34482 x0: el.x - rx, 34483 y0: el.y - ry, 34484 x1: el.x + rx, 34485 y1: el.y + ry, 34486 vx: v.x, 34487 vy: v.y 34488 }, config); 34489 }, 34490 34491 bar: function(el, config) { 34492 var v = orient(el, config.origin); 34493 var x = el.x; 34494 var y = el.y; 34495 var sx = 0; 34496 var sy = 0; 34497 34498 if (el.horizontal) { 34499 x = Math.min(el.x, el.base); 34500 sx = Math.abs(el.base - el.x); 34501 } else { 34502 y = Math.min(el.y, el.base); 34503 sy = Math.abs(el.base - el.y); 34504 } 34505 34506 return compute$1({ 34507 x0: x, 34508 y0: y + sy, 34509 x1: x + sx, 34510 y1: y, 34511 vx: v.x, 34512 vy: v.y 34513 }, config); 34514 }, 34515 34516 fallback: function(el, config) { 34517 var v = orient(el, config.origin); 34518 34519 return compute$1({ 34520 x0: el.x, 34521 y0: el.y, 34522 x1: el.x + (el.width || 0), 34523 y1: el.y + (el.height || 0), 34524 vx: v.x, 34525 vy: v.y 34526 }, config); 34527 } 34528}; 34529 34530var rasterize = utils.rasterize; 34531 34532function boundingRects(model) { 34533 var borderWidth = model.borderWidth || 0; 34534 var padding = model.padding; 34535 var th = model.size.height; 34536 var tw = model.size.width; 34537 var tx = -tw / 2; 34538 var ty = -th / 2; 34539 34540 return { 34541 frame: { 34542 x: tx - padding.left - borderWidth, 34543 y: ty - padding.top - borderWidth, 34544 w: tw + padding.width + borderWidth * 2, 34545 h: th + padding.height + borderWidth * 2 34546 }, 34547 text: { 34548 x: tx, 34549 y: ty, 34550 w: tw, 34551 h: th 34552 } 34553 }; 34554} 34555 34556function getScaleOrigin(el, context) { 34557 var scale = context.chart.getDatasetMeta(context.datasetIndex).vScale; 34558 34559 if (!scale) { 34560 return null; 34561 } 34562 34563 if (scale.xCenter !== undefined && scale.yCenter !== undefined) { 34564 return {x: scale.xCenter, y: scale.yCenter}; 34565 } 34566 34567 var pixel = scale.getBasePixel(); 34568 return el.horizontal ? 34569 {x: pixel, y: null} : 34570 {x: null, y: pixel}; 34571} 34572 34573function getPositioner(el) { 34574 if (el instanceof chart_js.ArcElement) { 34575 return positioners.arc; 34576 } 34577 if (el instanceof chart_js.PointElement) { 34578 return positioners.point; 34579 } 34580 if (el instanceof chart_js.BarElement) { 34581 return positioners.bar; 34582 } 34583 return positioners.fallback; 34584} 34585 34586function drawRoundedRect(ctx, x, y, w, h, radius) { 34587 var HALF_PI = Math.PI / 2; 34588 34589 if (radius) { 34590 var r = Math.min(radius, h / 2, w / 2); 34591 var left = x + r; 34592 var top = y + r; 34593 var right = x + w - r; 34594 var bottom = y + h - r; 34595 34596 ctx.moveTo(x, top); 34597 if (left < right && top < bottom) { 34598 ctx.arc(left, top, r, -Math.PI, -HALF_PI); 34599 ctx.arc(right, top, r, -HALF_PI, 0); 34600 ctx.arc(right, bottom, r, 0, HALF_PI); 34601 ctx.arc(left, bottom, r, HALF_PI, Math.PI); 34602 } else if (left < right) { 34603 ctx.moveTo(left, y); 34604 ctx.arc(right, top, r, -HALF_PI, HALF_PI); 34605 ctx.arc(left, top, r, HALF_PI, Math.PI + HALF_PI); 34606 } else if (top < bottom) { 34607 ctx.arc(left, top, r, -Math.PI, 0); 34608 ctx.arc(left, bottom, r, 0, Math.PI); 34609 } else { 34610 ctx.arc(left, top, r, -Math.PI, Math.PI); 34611 } 34612 ctx.closePath(); 34613 ctx.moveTo(x, y); 34614 } else { 34615 ctx.rect(x, y, w, h); 34616 } 34617} 34618 34619function drawFrame(ctx, rect, model) { 34620 var bgColor = model.backgroundColor; 34621 var borderColor = model.borderColor; 34622 var borderWidth = model.borderWidth; 34623 34624 if (!bgColor && (!borderColor || !borderWidth)) { 34625 return; 34626 } 34627 34628 ctx.beginPath(); 34629 34630 drawRoundedRect( 34631 ctx, 34632 rasterize(rect.x) + borderWidth / 2, 34633 rasterize(rect.y) + borderWidth / 2, 34634 rasterize(rect.w) - borderWidth, 34635 rasterize(rect.h) - borderWidth, 34636 model.borderRadius); 34637 34638 ctx.closePath(); 34639 34640 if (bgColor) { 34641 ctx.fillStyle = bgColor; 34642 ctx.fill(); 34643 } 34644 34645 if (borderColor && borderWidth) { 34646 ctx.strokeStyle = borderColor; 34647 ctx.lineWidth = borderWidth; 34648 ctx.lineJoin = 'miter'; 34649 ctx.stroke(); 34650 } 34651} 34652 34653function textGeometry(rect, align, font) { 34654 var h = font.lineHeight; 34655 var w = rect.w; 34656 var x = rect.x; 34657 var y = rect.y + h / 2; 34658 34659 if (align === 'center') { 34660 x += w / 2; 34661 } else if (align === 'end' || align === 'right') { 34662 x += w; 34663 } 34664 34665 return { 34666 h: h, 34667 w: w, 34668 x: x, 34669 y: y 34670 }; 34671} 34672 34673function drawTextLine(ctx, text, cfg) { 34674 var shadow = ctx.shadowBlur; 34675 var stroked = cfg.stroked; 34676 var x = rasterize(cfg.x); 34677 var y = rasterize(cfg.y); 34678 var w = rasterize(cfg.w); 34679 34680 if (stroked) { 34681 ctx.strokeText(text, x, y, w); 34682 } 34683 34684 if (cfg.filled) { 34685 if (shadow && stroked) { 34686 // Prevent drawing shadow on both the text stroke and fill, so 34687 // if the text is stroked, remove the shadow for the text fill. 34688 ctx.shadowBlur = 0; 34689 } 34690 34691 ctx.fillText(text, x, y, w); 34692 34693 if (shadow && stroked) { 34694 ctx.shadowBlur = shadow; 34695 } 34696 } 34697} 34698 34699function drawText(ctx, lines, rect, model) { 34700 var align = model.textAlign; 34701 var color = model.color; 34702 var filled = !!color; 34703 var font = model.font; 34704 var ilen = lines.length; 34705 var strokeColor = model.textStrokeColor; 34706 var strokeWidth = model.textStrokeWidth; 34707 var stroked = strokeColor && strokeWidth; 34708 var i; 34709 34710 if (!ilen || (!filled && !stroked)) { 34711 return; 34712 } 34713 34714 // Adjust coordinates based on text alignment and line height 34715 rect = textGeometry(rect, align, font); 34716 34717 ctx.font = font.string; 34718 ctx.textAlign = align; 34719 ctx.textBaseline = 'middle'; 34720 ctx.shadowBlur = model.textShadowBlur; 34721 ctx.shadowColor = model.textShadowColor; 34722 34723 if (filled) { 34724 ctx.fillStyle = color; 34725 } 34726 if (stroked) { 34727 ctx.lineJoin = 'round'; 34728 ctx.lineWidth = strokeWidth; 34729 ctx.strokeStyle = strokeColor; 34730 } 34731 34732 for (i = 0, ilen = lines.length; i < ilen; ++i) { 34733 drawTextLine(ctx, lines[i], { 34734 stroked: stroked, 34735 filled: filled, 34736 w: rect.w, 34737 x: rect.x, 34738 y: rect.y + rect.h * i 34739 }); 34740 } 34741} 34742 34743var Label = function(config, ctx, el, index) { 34744 var me = this; 34745 34746 me._config = config; 34747 me._index = index; 34748 me._model = null; 34749 me._rects = null; 34750 me._ctx = ctx; 34751 me._el = el; 34752}; 34753 34754helpers.merge(Label.prototype, { 34755 /** 34756 * @private 34757 */ 34758 _modelize: function(display, lines, config, context) { 34759 var me = this; 34760 var index = me._index; 34761 var font = helpers.toFont(helpers.resolve([config.font, {}], context, index)); 34762 var color = helpers.resolve([config.color, chart_js.defaults.color], context, index); 34763 34764 return { 34765 align: helpers.resolve([config.align, 'center'], context, index), 34766 anchor: helpers.resolve([config.anchor, 'center'], context, index), 34767 area: context.chart.chartArea, 34768 backgroundColor: helpers.resolve([config.backgroundColor, null], context, index), 34769 borderColor: helpers.resolve([config.borderColor, null], context, index), 34770 borderRadius: helpers.resolve([config.borderRadius, 0], context, index), 34771 borderWidth: helpers.resolve([config.borderWidth, 0], context, index), 34772 clamp: helpers.resolve([config.clamp, false], context, index), 34773 clip: helpers.resolve([config.clip, false], context, index), 34774 color: color, 34775 display: display, 34776 font: font, 34777 lines: lines, 34778 offset: helpers.resolve([config.offset, 4], context, index), 34779 opacity: helpers.resolve([config.opacity, 1], context, index), 34780 origin: getScaleOrigin(me._el, context), 34781 padding: helpers.toPadding(helpers.resolve([config.padding, 4], context, index)), 34782 positioner: getPositioner(me._el), 34783 rotation: helpers.resolve([config.rotation, 0], context, index) * (Math.PI / 180), 34784 size: utils.textSize(me._ctx, lines, font), 34785 textAlign: helpers.resolve([config.textAlign, 'start'], context, index), 34786 textShadowBlur: helpers.resolve([config.textShadowBlur, 0], context, index), 34787 textShadowColor: helpers.resolve([config.textShadowColor, color], context, index), 34788 textStrokeColor: helpers.resolve([config.textStrokeColor, color], context, index), 34789 textStrokeWidth: helpers.resolve([config.textStrokeWidth, 0], context, index) 34790 }; 34791 }, 34792 34793 update: function(context) { 34794 var me = this; 34795 var model = null; 34796 var rects = null; 34797 var index = me._index; 34798 var config = me._config; 34799 var value, label, lines; 34800 34801 // We first resolve the display option (separately) to avoid computing 34802 // other options in case the label is hidden (i.e. display: false). 34803 var display = helpers.resolve([config.display, true], context, index); 34804 34805 if (display) { 34806 value = context.dataset.data[index]; 34807 label = helpers.valueOrDefault(helpers.callback(config.formatter, [value, context]), value); 34808 lines = helpers.isNullOrUndef(label) ? [] : utils.toTextLines(label); 34809 34810 if (lines.length) { 34811 model = me._modelize(display, lines, config, context); 34812 rects = boundingRects(model); 34813 } 34814 } 34815 34816 me._model = model; 34817 me._rects = rects; 34818 }, 34819 34820 geometry: function() { 34821 return this._rects ? this._rects.frame : {}; 34822 }, 34823 34824 rotation: function() { 34825 return this._model ? this._model.rotation : 0; 34826 }, 34827 34828 visible: function() { 34829 return this._model && this._model.opacity; 34830 }, 34831 34832 model: function() { 34833 return this._model; 34834 }, 34835 34836 draw: function(chart, center) { 34837 var me = this; 34838 var ctx = chart.ctx; 34839 var model = me._model; 34840 var rects = me._rects; 34841 var area; 34842 34843 if (!this.visible()) { 34844 return; 34845 } 34846 34847 ctx.save(); 34848 34849 if (model.clip) { 34850 area = model.area; 34851 ctx.beginPath(); 34852 ctx.rect( 34853 area.left, 34854 area.top, 34855 area.right - area.left, 34856 area.bottom - area.top); 34857 ctx.clip(); 34858 } 34859 34860 ctx.globalAlpha = utils.bound(0, model.opacity, 1); 34861 ctx.translate(rasterize(center.x), rasterize(center.y)); 34862 ctx.rotate(model.rotation); 34863 34864 drawFrame(ctx, rects.frame, model); 34865 drawText(ctx, model.lines, rects.text, model); 34866 34867 ctx.restore(); 34868 } 34869}); 34870 34871var MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991; // eslint-disable-line es/no-number-minsafeinteger 34872var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; // eslint-disable-line es/no-number-maxsafeinteger 34873 34874function rotated(point, center, angle) { 34875 var cos = Math.cos(angle); 34876 var sin = Math.sin(angle); 34877 var cx = center.x; 34878 var cy = center.y; 34879 34880 return { 34881 x: cx + cos * (point.x - cx) - sin * (point.y - cy), 34882 y: cy + sin * (point.x - cx) + cos * (point.y - cy) 34883 }; 34884} 34885 34886function projected(points, axis) { 34887 var min = MAX_INTEGER; 34888 var max = MIN_INTEGER; 34889 var origin = axis.origin; 34890 var i, pt, vx, vy, dp; 34891 34892 for (i = 0; i < points.length; ++i) { 34893 pt = points[i]; 34894 vx = pt.x - origin.x; 34895 vy = pt.y - origin.y; 34896 dp = axis.vx * vx + axis.vy * vy; 34897 min = Math.min(min, dp); 34898 max = Math.max(max, dp); 34899 } 34900 34901 return { 34902 min: min, 34903 max: max 34904 }; 34905} 34906 34907function toAxis(p0, p1) { 34908 var vx = p1.x - p0.x; 34909 var vy = p1.y - p0.y; 34910 var ln = Math.sqrt(vx * vx + vy * vy); 34911 34912 return { 34913 vx: (p1.x - p0.x) / ln, 34914 vy: (p1.y - p0.y) / ln, 34915 origin: p0, 34916 ln: ln 34917 }; 34918} 34919 34920var HitBox = function() { 34921 this._rotation = 0; 34922 this._rect = { 34923 x: 0, 34924 y: 0, 34925 w: 0, 34926 h: 0 34927 }; 34928}; 34929 34930helpers.merge(HitBox.prototype, { 34931 center: function() { 34932 var r = this._rect; 34933 return { 34934 x: r.x + r.w / 2, 34935 y: r.y + r.h / 2 34936 }; 34937 }, 34938 34939 update: function(center, rect, rotation) { 34940 this._rotation = rotation; 34941 this._rect = { 34942 x: rect.x + center.x, 34943 y: rect.y + center.y, 34944 w: rect.w, 34945 h: rect.h 34946 }; 34947 }, 34948 34949 contains: function(point) { 34950 var me = this; 34951 var margin = 1; 34952 var rect = me._rect; 34953 34954 point = rotated(point, me.center(), -me._rotation); 34955 34956 return !(point.x < rect.x - margin 34957 || point.y < rect.y - margin 34958 || point.x > rect.x + rect.w + margin * 2 34959 || point.y > rect.y + rect.h + margin * 2); 34960 }, 34961 34962 // Separating Axis Theorem 34963 // https://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169 34964 intersects: function(other) { 34965 var r0 = this._points(); 34966 var r1 = other._points(); 34967 var axes = [ 34968 toAxis(r0[0], r0[1]), 34969 toAxis(r0[0], r0[3]) 34970 ]; 34971 var i, pr0, pr1; 34972 34973 if (this._rotation !== other._rotation) { 34974 // Only separate with r1 axis if the rotation is different, 34975 // else it's enough to separate r0 and r1 with r0 axis only! 34976 axes.push( 34977 toAxis(r1[0], r1[1]), 34978 toAxis(r1[0], r1[3]) 34979 ); 34980 } 34981 34982 for (i = 0; i < axes.length; ++i) { 34983 pr0 = projected(r0, axes[i]); 34984 pr1 = projected(r1, axes[i]); 34985 34986 if (pr0.max < pr1.min || pr1.max < pr0.min) { 34987 return false; 34988 } 34989 } 34990 34991 return true; 34992 }, 34993 34994 /** 34995 * @private 34996 */ 34997 _points: function() { 34998 var me = this; 34999 var rect = me._rect; 35000 var angle = me._rotation; 35001 var center = me.center(); 35002 35003 return [ 35004 rotated({x: rect.x, y: rect.y}, center, angle), 35005 rotated({x: rect.x + rect.w, y: rect.y}, center, angle), 35006 rotated({x: rect.x + rect.w, y: rect.y + rect.h}, center, angle), 35007 rotated({x: rect.x, y: rect.y + rect.h}, center, angle) 35008 ]; 35009 } 35010}); 35011 35012function coordinates(el, model, geometry) { 35013 var point = model.positioner(el, model); 35014 var vx = point.vx; 35015 var vy = point.vy; 35016 35017 if (!vx && !vy) { 35018 // if aligned center, we don't want to offset the center point 35019 return {x: point.x, y: point.y}; 35020 } 35021 35022 var w = geometry.w;
vendor: 4,081 bytes, lines 35023-35174
35023 var h = geometry.h; 35024 35025 // take in account the label rotation 35026 var rotation = model.rotation; 35027 var dx = Math.abs(w / 2 * Math.cos(rotation)) + Math.abs(h / 2 * Math.sin(rotation)); 35028 var dy = Math.abs(w / 2 * Math.sin(rotation)) + Math.abs(h / 2 * Math.cos(rotation)); 35029 35030 // scale the unit vector (vx, vy) to get at least dx or dy equal to 35031 // w or h respectively (else we would calculate the distance to the 35032 // ellipse inscribed in the bounding rect) 35033 var vs = 1 / Math.max(Math.abs(vx), Math.abs(vy)); 35034 dx *= vx * vs; 35035 dy *= vy * vs; 35036 35037 // finally, include the explicit offset 35038 dx += model.offset * vx; 35039 dy += model.offset * vy; 35040 35041 return { 35042 x: point.x + dx, 35043 y: point.y + dy 35044 }; 35045} 35046 35047function collide(labels, collider) { 35048 var i, j, s0, s1; 35049 35050 // IMPORTANT Iterate in the reverse order since items at the end of the 35051 // list have an higher weight/priority and thus should be less impacted 35052 // by the overlapping strategy. 35053 35054 for (i = labels.length - 1; i >= 0; --i) { 35055 s0 = labels[i].$layout; 35056 35057 for (j = i - 1; j >= 0 && s0._visible; --j) { 35058 s1 = labels[j].$layout; 35059 35060 if (s1._visible && s0._box.intersects(s1._box)) { 35061 collider(s0, s1); 35062 } 35063 } 35064 } 35065 35066 return labels; 35067} 35068 35069function compute(labels) { 35070 var i, ilen, label, state, geometry, center, proxy; 35071 35072 // Initialize labels for overlap detection 35073 for (i = 0, ilen = labels.length; i < ilen; ++i) { 35074 label = labels[i]; 35075 state = label.$layout; 35076 35077 if (state._visible) { 35078 // Chart.js 3 removed el._model in favor of getProps(), making harder to 35079 // abstract reading values in positioners. Also, using string arrays to 35080 // read values (i.e. var {a,b,c} = el.getProps(["a","b","c"])) would make 35081 // positioners inefficient in the normal case (i.e. not the final values) 35082 // and the code a bit ugly, so let's use a Proxy instead. 35083 proxy = new Proxy(label._el, {get: (el, p) => el.getProps([p], true)[p]}); 35084 35085 geometry = label.geometry(); 35086 center = coordinates(proxy, label.model(), geometry); 35087 state._box.update(center, geometry, label.rotation()); 35088 } 35089 } 35090 35091 // Auto hide overlapping labels 35092 return collide(labels, function(s0, s1) { 35093 var h0 = s0._hidable; 35094 var h1 = s1._hidable; 35095 35096 if ((h0 && h1) || h1) { 35097 s1._visible = false; 35098 } else if (h0) { 35099 s0._visible = false; 35100 } 35101 }); 35102} 35103 35104var layout = { 35105 prepare: function(datasets) { 35106 var labels = []; 35107 var i, j, ilen, jlen, label; 35108 35109 for (i = 0, ilen = datasets.length; i < ilen; ++i) { 35110 for (j = 0, jlen = datasets[i].length; j < jlen; ++j) { 35111 label = datasets[i][j]; 35112 labels.push(label); 35113 label.$layout = { 35114 _box: new HitBox(), 35115 _hidable: false, 35116 _visible: true, 35117 _set: i, 35118 _idx: label._index 35119 }; 35120 } 35121 } 35122 35123 // TODO New `z` option: labels with a higher z-index are drawn 35124 // of top of the ones with a lower index. Lowest z-index labels 35125 // are also discarded first when hiding overlapping labels. 35126 labels.sort(function(a, b) { 35127 var sa = a.$layout; 35128 var sb = b.$layout; 35129 35130 return sa._idx === sb._idx 35131 ? sb._set - sa._set 35132 : sb._idx - sa._idx; 35133 }); 35134 35135 this.update(labels); 35136 35137 return labels; 35138 }, 35139 35140 update: function(labels) { 35141 var dirty = false; 35142 var i, ilen, label, model, state; 35143 35144 for (i = 0, ilen = labels.length; i < ilen; ++i) { 35145 label = labels[i]; 35146 model = label.model(); 35147 state = label.$layout; 35148 state._hidable = model && model.display === 'auto'; 35149 state._visible = label.visible(); 35150 dirty |= state._hidable; 35151 } 35152 35153 if (dirty) { 35154 compute(labels); 35155 } 35156 }, 35157 35158 lookup: function(labels, point) { 35159 var i, state; 35160 35161 // IMPORTANT Iterate in the reverse order since items at the end of 35162 // the list have an higher z-index, thus should be picked first. 35163 35164 for (i = labels.length - 1; i >= 0; --i) { 35165 state = labels[i].$layout; 35166 35167 if (state && state._visible && state._box.contains(point)) { 35168 return labels[i]; 35169 } 35170 } 35171 35172 return null; 35173 }, 35174
vendor: 8,875 bytes, lines 35175-35528
35175 draw: function(chart, labels) { 35176 var i, ilen, label, state, geometry, center; 35177 35178 for (i = 0, ilen = labels.length; i < ilen; ++i) { 35179 label = labels[i]; 35180 state = label.$layout; 35181 35182 if (state._visible) { 35183 geometry = label.geometry(); 35184 center = coordinates(label._el, label.model(), geometry); 35185 state._box.update(center, geometry, label.rotation()); 35186 label.draw(chart, center); 35187 } 35188 } 35189 } 35190}; 35191 35192var formatter = function(value) { 35193 if (helpers.isNullOrUndef(value)) { 35194 return null; 35195 } 35196 35197 var label = value; 35198 var keys, klen, k; 35199 if (helpers.isObject(value)) { 35200 if (!helpers.isNullOrUndef(value.label)) { 35201 label = value.label; 35202 } else if (!helpers.isNullOrUndef(value.r)) { 35203 label = value.r; 35204 } else { 35205 label = ''; 35206 keys = Object.keys(value); 35207 for (k = 0, klen = keys.length; k < klen; ++k) { 35208 label += (k !== 0 ? ', ' : '') + keys[k] + ': ' + value[keys[k]]; 35209 } 35210 } 35211 } 35212 35213 return '' + label; 35214}; 35215 35216/** 35217 * IMPORTANT: make sure to also update tests and TypeScript definition 35218 * files (`/test/specs/defaults.spec.js` and `/types/options.d.ts`) 35219 */ 35220 35221var defaults = { 35222 align: 'center', 35223 anchor: 'center', 35224 backgroundColor: null, 35225 borderColor: null, 35226 borderRadius: 0, 35227 borderWidth: 0, 35228 clamp: false, 35229 clip: false, 35230 color: undefined, 35231 display: true, 35232 font: { 35233 family: undefined, 35234 lineHeight: 1.2, 35235 size: undefined, 35236 style: undefined, 35237 weight: null 35238 }, 35239 formatter: formatter, 35240 labels: undefined, 35241 listeners: {}, 35242 offset: 4, 35243 opacity: 1, 35244 padding: { 35245 top: 4, 35246 right: 4, 35247 bottom: 4, 35248 left: 4 35249 }, 35250 rotation: 0, 35251 textAlign: 'start', 35252 textStrokeColor: undefined, 35253 textStrokeWidth: 0, 35254 textShadowBlur: 0, 35255 textShadowColor: undefined 35256}; 35257 35258/** 35259 * @see https://github.com/chartjs/Chart.js/issues/4176 35260 */ 35261 35262var EXPANDO_KEY = '$datalabels'; 35263var DEFAULT_KEY = '$default'; 35264 35265function configure(dataset, options) { 35266 var override = dataset.datalabels; 35267 var listeners = {}; 35268 var configs = []; 35269 var labels, keys; 35270 35271 if (override === false) { 35272 return null; 35273 } 35274 if (override === true) { 35275 override = {}; 35276 } 35277 35278 options = helpers.merge({}, [options, override]); 35279 labels = options.labels || {}; 35280 keys = Object.keys(labels); 35281 delete options.labels; 35282 35283 if (keys.length) { 35284 keys.forEach(function(key) { 35285 if (labels[key]) { 35286 configs.push(helpers.merge({}, [ 35287 options, 35288 labels[key], 35289 {_key: key} 35290 ])); 35291 } 35292 }); 35293 } else { 35294 // Default label if no "named" label defined. 35295 configs.push(options); 35296 } 35297 35298 // listeners: {<event-type>: {<label-key>: <fn>}} 35299 listeners = configs.reduce(function(target, config) { 35300 helpers.each(config.listeners || {}, function(fn, event) { 35301 target[event] = target[event] || {}; 35302 target[event][config._key || DEFAULT_KEY] = fn; 35303 }); 35304 35305 delete config.listeners; 35306 return target; 35307 }, {}); 35308 35309 return { 35310 labels: configs, 35311 listeners: listeners 35312 }; 35313} 35314 35315function dispatchEvent(chart, listeners, label, event) { 35316 if (!listeners) { 35317 return; 35318 } 35319 35320 var context = label.$context; 35321 var groups = label.$groups; 35322 var callback; 35323 35324 if (!listeners[groups._set]) { 35325 return; 35326 } 35327 35328 callback = listeners[groups._set][groups._key]; 35329 if (!callback) { 35330 return; 35331 } 35332 35333 if (helpers.callback(callback, [context, event]) === true) { 35334 // Users are allowed to tweak the given context by injecting values that can be 35335 // used in scriptable options to display labels differently based on the current 35336 // event (e.g. highlight an hovered label). That's why we update the label with 35337 // the output context and schedule a new chart render by setting it dirty. 35338 chart[EXPANDO_KEY]._dirty = true; 35339 label.update(context); 35340 } 35341} 35342 35343function dispatchMoveEvents(chart, listeners, previous, label, event) { 35344 var enter, leave; 35345 35346 if (!previous && !label) { 35347 return; 35348 } 35349 35350 if (!previous) { 35351 enter = true; 35352 } else if (!label) { 35353 leave = true; 35354 } else if (previous !== label) { 35355 leave = enter = true; 35356 } 35357 35358 if (leave) { 35359 dispatchEvent(chart, listeners.leave, previous, event); 35360 } 35361 if (enter) { 35362 dispatchEvent(chart, listeners.enter, label, event); 35363 } 35364} 35365 35366function handleMoveEvents(chart, event) { 35367 var expando = chart[EXPANDO_KEY]; 35368 var listeners = expando._listeners; 35369 var previous, label; 35370 35371 if (!listeners.enter && !listeners.leave) { 35372 return; 35373 } 35374 35375 if (event.type === 'mousemove') { 35376 label = layout.lookup(expando._labels, event); 35377 } else if (event.type !== 'mouseout') { 35378 return; 35379 } 35380 35381 previous = expando._hovered; 35382 expando._hovered = label; 35383 dispatchMoveEvents(chart, listeners, previous, label, event); 35384} 35385 35386function handleClickEvents(chart, event) { 35387 var expando = chart[EXPANDO_KEY]; 35388 var handlers = expando._listeners.click; 35389 var label = handlers && layout.lookup(expando._labels, event); 35390 if (label) { 35391 dispatchEvent(chart, handlers, label, event); 35392 } 35393} 35394 35395var plugin = { 35396 id: 'datalabels', 35397 35398 defaults: defaults, 35399 35400 beforeInit: function(chart) { 35401 chart[EXPANDO_KEY] = { 35402 _actives: [] 35403 }; 35404 }, 35405 35406 beforeUpdate: function(chart) { 35407 var expando = chart[EXPANDO_KEY]; 35408 expando._listened = false; 35409 expando._listeners = {}; // {<event-type>: {<dataset-index>: {<label-key>: <fn>}}} 35410 expando._datasets = []; // per dataset labels: [Label[]] 35411 expando._labels = []; // layouted labels: Label[] 35412 }, 35413 35414 afterDatasetUpdate: function(chart, args, options) { 35415 var datasetIndex = args.index; 35416 var expando = chart[EXPANDO_KEY]; 35417 var labels = expando._datasets[datasetIndex] = []; 35418 var visible = chart.isDatasetVisible(datasetIndex); 35419 var dataset = chart.data.datasets[datasetIndex]; 35420 var config = configure(dataset, options); 35421 var elements = args.meta.data || []; 35422 var ctx = chart.ctx; 35423 var i, j, ilen, jlen, cfg, key, el, label; 35424 35425 ctx.save(); 35426 35427 for (i = 0, ilen = elements.length; i < ilen; ++i) { 35428 el = elements[i]; 35429 el[EXPANDO_KEY] = []; 35430 35431 if (visible && el && chart.getDataVisibility(i) && !el.skip) { 35432 for (j = 0, jlen = config.labels.length; j < jlen; ++j) { 35433 cfg = config.labels[j]; 35434 key = cfg._key; 35435 35436 label = new Label(cfg, ctx, el, i); 35437 label.$groups = { 35438 _set: datasetIndex, 35439 _key: key || DEFAULT_KEY 35440 }; 35441 label.$context = { 35442 active: false, 35443 chart: chart, 35444 dataIndex: i, 35445 dataset: dataset, 35446 datasetIndex: datasetIndex 35447 }; 35448 35449 label.update(label.$context); 35450 el[EXPANDO_KEY].push(label); 35451 labels.push(label); 35452 } 35453 } 35454 } 35455 35456 ctx.restore(); 35457 35458 // Store listeners at the chart level and per event type to optimize 35459 // cases where no listeners are registered for a specific event. 35460 helpers.merge(expando._listeners, config.listeners, { 35461 merger: function(event, target, source) { 35462 target[event] = target[event] || {}; 35463 target[event][args.index] = source[event]; 35464 expando._listened = true; 35465 } 35466 }); 35467 }, 35468 35469 afterUpdate: function(chart) { 35470 chart[EXPANDO_KEY]._labels = layout.prepare(chart[EXPANDO_KEY]._datasets); 35471 }, 35472 35473 // Draw labels on top of all dataset elements 35474 // https://github.com/chartjs/chartjs-plugin-datalabels/issues/29 35475 // https://github.com/chartjs/chartjs-plugin-datalabels/issues/32 35476 afterDatasetsDraw: function(chart) { 35477 layout.draw(chart, chart[EXPANDO_KEY]._labels); 35478 }, 35479 35480 beforeEvent: function(chart, args) { 35481 // If there is no listener registered for this chart, `listened` will be false, 35482 // meaning we can immediately ignore the incoming event and avoid useless extra 35483 // computation for users who don't implement label interactions. 35484 if (chart[EXPANDO_KEY]._listened) { 35485 var event = args.event; 35486 switch (event.type) { 35487 case 'mousemove': 35488 case 'mouseout': 35489 handleMoveEvents(chart, event); 35490 break; 35491 case 'click': 35492 handleClickEvents(chart, event); 35493 break; 35494 } 35495 } 35496 }, 35497 35498 afterEvent: function(chart) { 35499 var expando = chart[EXPANDO_KEY]; 35500 var previous = expando._actives; 35501 var actives = expando._actives = chart.getActiveElements(); 35502 var updates = utils.arrayDiff(previous, actives); 35503 var i, ilen, j, jlen, update, label, labels; 35504 35505 for (i = 0, ilen = updates.length; i < ilen; ++i) { 35506 update = updates[i]; 35507 if (update[1]) { 35508 labels = update[0].element[EXPANDO_KEY] || []; 35509 for (j = 0, jlen = labels.length; j < jlen; ++j) { 35510 label = labels[j]; 35511 label.$context.active = (update[1] === 1); 35512 label.update(label.$context); 35513 } 35514 } 35515 } 35516 35517 if (expando._dirty || updates.length) { 35518 layout.update(expando._labels); 35519 chart.render(); 35520 } 35521 35522 delete expando._dirty; 35523 } 35524}; 35525 35526return plugin; 35527 35528}));
35529 35530 35531 35532// chartjs-plugin-colorschemes-v3 ã«åé¡ããã helpers ãã°ãã¼ãã«å¤æ°ã¨ãã¦å®ç¾©ãã¦ãããªãã¨ãã©ã°ã¤ã³å ã§ã¨ã©ã¼ãçºçãã 35533// ç¾ç¶ colorschemes ãå©ç¨ãã¦ããç®æã¯ãªã¼ãã³ãã¼ã¿ã®ã°ã©ããã¬ãã¥ã¼ã®ã¿ 35534window.helpers = Chart.helpers; 35535/*! 35536 * chartjs-plugin-colorschemes-v3 v0.5.4 35537 * https://nagix.github.io/chartjs-plugin-colorschemes 35538 * (c) 2022 Akihiko Kusanagi 35539 * Released under the MIT license 35540 */ 35541(function (global, factory) { 35542typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('chart.js'), require('chart.js/helpers')) : 35543typeof define === 'function' && define.amd ? define(['chart.js', 'chart.js/helpers'], factory) : 35544(global = global || self, global.ChartColorSchemes = factory(global.Chart, global.helpers)); 35545}(this, (function (chart_js, helpers) { 'use strict
vendor: 54,309 bytes, lines 35545-36569
35545'; 35546 35547// eslint-disable-next-line one-var 35548var 35549 // Sequential 35550 YlGn3 = ['#f7fcb9', '#addd8e', '#31a354'], 35551 YlGn4 = ['#ffffcc', '#c2e699', '#78c679', '#238443'], 35552 YlGn5 = ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'], 35553 YlGn6 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'], 35554 YlGn7 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'], 35555 YlGn8 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'], 35556 YlGn9 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'], 35557 35558 YlGnBu3 = ['#edf8b1', '#7fcdbb', '#2c7fb8'], 35559 YlGnBu4 = ['#ffffcc', '#a1dab4', '#41b6c4', '#225ea8'], 35560 YlGnBu5 = ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'], 35561 YlGnBu6 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#2c7fb8', '#253494'], 35562 YlGnBu7 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'], 35563 YlGnBu8 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'], 35564 YlGnBu9 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'], 35565 35566 GnBu3 = ['#e0f3db', '#a8ddb5', '#43a2ca'], 35567 GnBu4 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#2b8cbe'], 35568 GnBu5 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#43a2ca', '#0868ac'], 35569 GnBu6 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#43a2ca', '#0868ac'], 35570 GnBu7 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'], 35571 GnBu8 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'], 35572 GnBu9 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'], 35573 35574 BuGn3 = ['#e5f5f9', '#99d8c9', '#2ca25f'], 35575 BuGn4 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#238b45'], 35576 BuGn5 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#2ca25f', '#006d2c'], 35577 BuGn6 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#2ca25f', '#006d2c'], 35578 BuGn7 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'], 35579 BuGn8 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'], 35580 BuGn9 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'], 35581 35582 PuBuGn3 = ['#ece2f0', '#a6bddb', '#1c9099'], 35583 PuBuGn4 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#02818a'], 35584 PuBuGn5 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#1c9099', '#016c59'], 35585 PuBuGn6 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#1c9099', '#016c59'], 35586 PuBuGn7 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'], 35587 PuBuGn8 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'], 35588 PuBuGn9 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'], 35589 35590 PuBu3 = ['#ece7f2', '#a6bddb', '#2b8cbe'], 35591 PuBu4 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#0570b0'], 35592 PuBu5 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#2b8cbe', '#045a8d'], 35593 PuBu6 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#2b8cbe', '#045a8d'], 35594 PuBu7 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'], 35595 PuBu8 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'], 35596 PuBu9 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'], 35597 35598 BuPu3 = ['#e0ecf4', '#9ebcda', '#8856a7'], 35599 BuPu4 = ['#edf8fb', '#b3cde3', '#8c96c6', '#88419d'], 35600 BuPu5 = ['#edf8fb', '#b3cde3', '#8c96c6', '#8856a7', '#810f7c'], 35601 BuPu6 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8856a7', '#810f7c'], 35602 BuPu7 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'], 35603 BuPu8 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'], 35604 BuPu9 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'], 35605 35606 RdPu3 = ['#fde0dd', '#fa9fb5', '#c51b8a'], 35607 RdPu4 = ['#feebe2', '#fbb4b9', '#f768a1', '#ae017e'], 35608 RdPu5 = ['#feebe2', '#fbb4b9', '#f768a1', '#c51b8a', '#7a0177'], 35609 RdPu6 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#c51b8a', '#7a0177'], 35610 RdPu7 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'], 35611 RdPu8 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'], 35612 RdPu9 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'], 35613 35614 PuRd3 = ['#e7e1ef', '#c994c7', '#dd1c77'], 35615 PuRd4 = ['#f1eef6', '#d7b5d8', '#df65b0', '#ce1256'], 35616 PuRd5 = ['#f1eef6', '#d7b5d8', '#df65b0', '#dd1c77', '#980043'], 35617 PuRd6 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#dd1c77', '#980043'], 35618 PuRd7 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'], 35619 PuRd8 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'], 35620 PuRd9 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'], 35621 35622 OrRd3 = ['#fee8c8', '#fdbb84', '#e34a33'], 35623 OrRd4 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#d7301f'], 35624 OrRd5 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#e34a33', '#b30000'], 35625 OrRd6 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#e34a33', '#b30000'], 35626 OrRd7 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'], 35627 OrRd8 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'], 35628 OrRd9 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'], 35629 35630 YlOrRd3 = ['#ffeda0', '#feb24c', '#f03b20'], 35631 YlOrRd4 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#e31a1c'], 35632 YlOrRd5 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#f03b20', '#bd0026'], 35633 YlOrRd6 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#f03b20', '#bd0026'], 35634 YlOrRd7 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'], 35635 YlOrRd8 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'], 35636 YlOrRd9 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'], 35637 35638 YlOrBr3 = ['#fff7bc', '#fec44f', '#d95f0e'], 35639 YlOrBr4 = ['#ffffd4', '#fed98e', '#fe9929', '#cc4c02'], 35640 YlOrBr5 = ['#ffffd4', '#fed98e', '#fe9929', '#d95f0e', '#993404'], 35641 YlOrBr6 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#d95f0e', '#993404'], 35642 YlOrBr7 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'], 35643 YlOrBr8 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'], 35644 YlOrBr9 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'], 35645 35646 Purples3 = ['#efedf5', '#bcbddc', '#756bb1'], 35647 Purples4 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#6a51a3'], 35648 Purples5 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#756bb1', '#54278f'], 35649 Purples6 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'], 35650 Purples7 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'], 35651 Purples8 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'], 35652 Purples9 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'], 35653 35654 Blues3 = ['#deebf7', '#9ecae1', '#3182bd'], 35655 Blues4 = ['#eff3ff', '#bdd7e7', '#6baed6', '#2171b5'], 35656 Blues5 = ['#eff3ff', '#bdd7e7', '#6baed6', '#3182bd', '#08519c'], 35657 Blues6 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#3182bd', '#08519c'], 35658 Blues7 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'], 35659 Blues8 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'], 35660 Blues9 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'], 35661 35662 Greens3 = ['#e5f5e0', '#a1d99b', '#31a354'], 35663 Greens4 = ['#edf8e9', '#bae4b3', '#74c476', '#238b45'], 35664 Greens5 = ['#edf8e9', '#bae4b3', '#74c476', '#31a354', '#006d2c'], 35665 Greens6 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#31a354', '#006d2c'], 35666 Greens7 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'], 35667 Greens8 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'], 35668 Greens9 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'], 35669 35670 Oranges3 = ['#fee6ce', '#fdae6b', '#e6550d'], 35671 Oranges4 = ['#feedde', '#fdbe85', '#fd8d3c', '#d94701'], 35672 Oranges5 = ['#feedde', '#fdbe85', '#fd8d3c', '#e6550d', '#a63603'], 35673 Oranges6 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#a63603'], 35674 Oranges7 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'], 35675 Oranges8 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'], 35676 Oranges9 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'], 35677 35678 Reds3 = ['#fee0d2', '#fc9272', '#de2d26'], 35679 Reds4 = ['#fee5d9', '#fcae91', '#fb6a4a', '#cb181d'], 35680 Reds5 = ['#fee5d9', '#fcae91', '#fb6a4a', '#de2d26', '#a50f15'], 35681 Reds6 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15'], 35682 Reds7 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'], 35683 Reds8 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'], 35684 Reds9 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'], 35685 35686 Greys3 = ['#f0f0f0', '#bdbdbd', '#636363'], 35687 Greys4 = ['#f7f7f7', '#cccccc', '#969696', '#525252'], 35688 Greys5 = ['#f7f7f7', '#cccccc', '#969696', '#636363', '#252525'], 35689 Greys6 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#636363', '#252525'], 35690 Greys7 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'], 35691 Greys8 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'], 35692 Greys9 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'], 35693 35694 // Diverging 35695 PuOr3 = ['#f1a340', '#f7f7f7', '#998ec3'], 35696 PuOr4 = ['#e66101', '#fdb863', '#b2abd2', '#5e3c99'], 35697 PuOr5 = ['#e66101', '#fdb863', '#f7f7f7', '#b2abd2', '#5e3c99'], 35698 PuOr6 = ['#b35806', '#f1a340', '#fee0b6', '#d8daeb', '#998ec3', '#542788'], 35699 PuOr7 = ['#b35806', '#f1a340', '#fee0b6', '#f7f7f7', '#d8daeb', '#998ec3', '#542788'], 35700 PuOr8 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788'], 35701 PuOr9 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788'], 35702 PuOr10 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'], 35703 PuOr11 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'], 35704 35705 BrBG3 = ['#d8b365', '#f5f5f5', '#5ab4ac'], 35706 BrBG4 = ['#a6611a', '#dfc27d', '#80cdc1', '#018571'], 35707 BrBG5 = ['#a6611a', '#dfc27d', '#f5f5f5', '#80cdc1', '#018571'], 35708 BrBG6 = ['#8c510a', '#d8b365', '#f6e8c3', '#c7eae5', '#5ab4ac', '#01665e'], 35709 BrBG7 = ['#8c510a', '#d8b365', '#f6e8c3', '#f5f5f5', '#c7eae5', '#5ab4ac', '#01665e'], 35710 BrBG8 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e'], 35711 BrBG9 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e'], 35712 BrBG10 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'], 35713 BrBG11 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'], 35714 35715 PRGn3 = ['#af8dc3', '#f7f7f7', '#7fbf7b'], 35716 PRGn4 = ['#7b3294', '#c2a5cf', '#a6dba0', '#008837'], 35717 PRGn5 = ['#7b3294', '#c2a5cf', '#f7f7f7', '#a6dba0', '#008837'], 35718 PRGn6 = ['#762a83', '#af8dc3', '#e7d4e8', '#d9f0d3', '#7fbf7b', '#1b7837'], 35719 PRGn7 = ['#762a83', '#af8dc3', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#7fbf7b', '#1b7837'], 35720 PRGn8 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'], 35721 PRGn9 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'], 35722 PRGn10 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'], 35723 PRGn11 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'], 35724 35725 PiYG3 = ['#e9a3c9', '#f7f7f7', '#a1d76a'], 35726 PiYG4 = ['#d01c8b', '#f1b6da', '#b8e186', '#4dac26'], 35727 PiYG5 = ['#d01c8b', '#f1b6da', '#f7f7f7', '#b8e186', '#4dac26'], 35728 PiYG6 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#e6f5d0', '#a1d76a', '#4d9221'], 35729 PiYG7 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#f7f7f7', '#e6f5d0', '#a1d76a', '#4d9221'], 35730 PiYG8 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'], 35731 PiYG9 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'], 35732 PiYG10 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'], 35733 PiYG11 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'], 35734 35735 RdBu3 = ['#ef8a62', '#f7f7f7', '#67a9cf'], 35736 RdBu4 = ['#ca0020', '#f4a582', '#92c5de', '#0571b0'], 35737 RdBu5 = ['#ca0020', '#f4a582', '#f7f7f7', '#92c5de', '#0571b0'], 35738 RdBu6 = ['#b2182b', '#ef8a62', '#fddbc7', '#d1e5f0', '#67a9cf', '#2166ac'], 35739 RdBu7 = ['#b2182b', '#ef8a62', '#fddbc7', '#f7f7f7', '#d1e5f0', '#67a9cf', '#2166ac'], 35740 RdBu8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'], 35741 RdBu9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'], 35742 RdBu10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'], 35743 RdBu11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'], 35744 35745 RdGy3 = ['#ef8a62', '#ffffff', '#999999'], 35746 RdGy4 = ['#ca0020', '#f4a582', '#bababa', '#404040'], 35747 RdGy5 = ['#ca0020', '#f4a582', '#ffffff', '#bababa', '#404040'], 35748 RdGy6 = ['#b2182b', '#ef8a62', '#fddbc7', '#e0e0e0', '#999999', '#4d4d4d'], 35749 RdGy7 = ['#b2182b', '#ef8a62', '#fddbc7', '#ffffff', '#e0e0e0', '#999999', '#4d4d4d'], 35750 RdGy8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'], 35751 RdGy9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'], 35752 RdGy10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'], 35753 RdGy11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'], 35754 35755 RdYlBu3 = ['#fc8d59', '#ffffbf', '#91bfdb'], 35756 RdYlBu4 = ['#d7191c', '#fdae61', '#abd9e9', '#2c7bb6'], 35757 RdYlBu5 = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'], 35758 RdYlBu6 = ['#d73027', '#fc8d59', '#fee090', '#e0f3f8', '#91bfdb', '#4575b4'], 35759 RdYlBu7 = ['#d73027', '#fc8d59', '#fee090', '#ffffbf', '#e0f3f8', '#91bfdb', '#4575b4'], 35760 RdYlBu8 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'], 35761 RdYlBu9 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'], 35762 RdYlBu10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'], 35763 RdYlBu11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'], 35764 35765 Spectral3 = ['#fc8d59', '#ffffbf', '#99d594'], 35766 Spectral4 = ['#d7191c', '#fdae61', '#abdda4', '#2b83ba'], 35767 Spectral5 = ['#d7191c', '#fdae61', '#ffffbf', '#abdda4', '#2b83ba'], 35768 Spectral6 = ['#d53e4f', '#fc8d59', '#fee08b', '#e6f598', '#99d594', '#3288bd'], 35769 Spectral7 = ['#d53e4f', '#fc8d59', '#fee08b', '#ffffbf', '#e6f598', '#99d594', '#3288bd'], 35770 Spectral8 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'], 35771 Spectral9 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'], 35772 Spectral10 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'], 35773 Spectral11 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'], 35774 35775 RdYlGn3 = ['#fc8d59', '#ffffbf', '#91cf60'], 35776 RdYlGn4 = ['#d7191c', '#fdae61', '#a6d96a', '#1a9641'], 35777 RdYlGn5 = ['#d7191c', '#fdae61', '#ffffbf', '#a6d96a', '#1a9641'], 35778 RdYlGn6 = ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850'], 35779 RdYlGn7 = ['#d73027', '#fc8d59', '#fee08b', '#ffffbf', '#d9ef8b', '#91cf60', '#1a9850'], 35780 RdYlGn8 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'], 35781 RdYlGn9 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'], 35782 RdYlGn10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'], 35783 RdYlGn11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'], 35784 35785 // Qualitative 35786 Accent3 = ['#7fc97f', '#beaed4', '#fdc086'], 35787 Accent4 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99'], 35788 Accent5 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0'], 35789 Accent6 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f'], 35790 Accent7 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17'], 35791 Accent8 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'], 35792 35793 DarkTwo3 = ['#1b9e77', '#d95f02', '#7570b3'], 35794 DarkTwo4 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a'], 35795 DarkTwo5 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e'], 35796 DarkTwo6 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'], 35797 DarkTwo7 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d'], 35798 DarkTwo8 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'], 35799 35800 Paired3 = ['#a6cee3', '#1f78b4', '#b2df8a'], 35801 Paired4 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c'], 35802 Paired5 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99'], 35803 Paired6 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c'], 35804 Paired7 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f'], 35805 Paired8 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00'], 35806 Paired9 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6'], 35807 Paired10 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a'], 35808 Paired11 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99'], 35809 Paired12 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'], 35810 35811 PastelOne3 = ['#fbb4ae', '#b3cde3', '#ccebc5'], 35812 PastelOne4 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4'], 35813 PastelOne5 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6'], 35814 PastelOne6 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc'], 35815 PastelOne7 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd'], 35816 PastelOne8 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec'], 35817 PastelOne9 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'], 35818 35819 PastelTwo3 = ['#b3e2cd', '#fdcdac', '#cbd5e8'], 35820 PastelTwo4 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4'], 35821 PastelTwo5 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9'], 35822 PastelTwo6 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae'], 35823 PastelTwo7 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc'], 35824 PastelTwo8 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'], 35825 35826 SetOne3 = ['#e41a1c', '#377eb8', '#4daf4a'], 35827 SetOne4 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3'], 35828 SetOne5 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00'], 35829 SetOne6 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33'], 35830 SetOne7 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628'], 35831 SetOne8 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf'], 35832 SetOne9 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'], 35833 35834 SetTwo3 = ['#66c2a5', '#fc8d62', '#8da0cb'], 35835 SetTwo4 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3'], 35836 SetTwo5 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854'], 35837 SetTwo6 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f'], 35838 SetTwo7 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494'], 35839 SetTwo8 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'], 35840 35841 SetThree3 = ['#8dd3c7', '#ffffb3', '#bebada'], 35842 SetThree4 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072'], 35843 SetThree5 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3'], 35844 SetThree6 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462'], 35845 SetThree7 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69'], 35846 SetThree8 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5'], 35847 SetThree9 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9'], 35848 SetThree10 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd'], 35849 SetThree11 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5'], 35850 SetThree12 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f']; 35851 35852var brewer = /*#__PURE__*/Object.freeze({ 35853__proto__: null, 35854YlGn3: YlGn3, 35855YlGn4: YlGn4, 35856YlGn5: YlGn5, 35857YlGn6: YlGn6, 35858YlGn7: YlGn7, 35859YlGn8: YlGn8, 35860YlGn9: YlGn9, 35861YlGnBu3: YlGnBu3, 35862YlGnBu4: YlGnBu4, 35863YlGnBu5: YlGnBu5, 35864YlGnBu6: YlGnBu6, 35865YlGnBu7: YlGnBu7, 35866YlGnBu8: YlGnBu8, 35867YlGnBu9: YlGnBu9, 35868GnBu3: GnBu3, 35869GnBu4: GnBu4, 35870GnBu5: GnBu5, 35871GnBu6: GnBu6, 35872GnBu7: GnBu7, 35873GnBu8: GnBu8, 35874GnBu9: GnBu9, 35875BuGn3: BuGn3, 35876BuGn4: BuGn4, 35877BuGn5: BuGn5, 35878BuGn6: BuGn6, 35879BuGn7: BuGn7, 35880BuGn8: BuGn8, 35881BuGn9: BuGn9, 35882PuBuGn3: PuBuGn3, 35883PuBuGn4: PuBuGn4, 35884PuBuGn5: PuBuGn5, 35885PuBuGn6: PuBuGn6, 35886PuBuGn7: PuBuGn7, 35887PuBuGn8: PuBuGn8, 35888PuBuGn9: PuBuGn9, 35889PuBu3: PuBu3, 35890PuBu4: PuBu4, 35891PuBu5: PuBu5, 35892PuBu6: PuBu6, 35893PuBu7: PuBu7, 35894PuBu8: PuBu8, 35895PuBu9: PuBu9, 35896BuPu3: BuPu3, 35897BuPu4: BuPu4, 35898BuPu5: BuPu5, 35899BuPu6: BuPu6, 35900BuPu7: BuPu7, 35901BuPu8: BuPu8, 35902BuPu9: BuPu9, 35903RdPu3: RdPu3, 35904RdPu4: RdPu4, 35905RdPu5: RdPu5, 35906RdPu6: RdPu6, 35907RdPu7: RdPu7, 35908RdPu8: RdPu8, 35909RdPu9: RdPu9, 35910PuRd3: PuRd3, 35911PuRd4: PuRd4, 35912PuRd5: PuRd5, 35913PuRd6: PuRd6, 35914PuRd7: PuRd7, 35915PuRd8: PuRd8, 35916PuRd9: PuRd9, 35917OrRd3: OrRd3, 35918OrRd4: OrRd4, 35919OrRd5: OrRd5, 35920OrRd6: OrRd6, 35921OrRd7: OrRd7, 35922OrRd8: OrRd8, 35923OrRd9: OrRd9, 35924YlOrRd3: YlOrRd3, 35925YlOrRd4: YlOrRd4, 35926YlOrRd5: YlOrRd5, 35927YlOrRd6: YlOrRd6, 35928YlOrRd7: YlOrRd7, 35929YlOrRd8: YlOrRd8, 35930YlOrRd9: YlOrRd9, 35931YlOrBr3: YlOrBr3, 35932YlOrBr4: YlOrBr4, 35933YlOrBr5: YlOrBr5, 35934YlOrBr6: YlOrBr6, 35935YlOrBr7: YlOrBr7, 35936YlOrBr8: YlOrBr8, 35937YlOrBr9: YlOrBr9, 35938Purples3: Purples3, 35939Purples4: Purples4, 35940Purples5: Purples5, 35941Purples6: Purples6, 35942Purples7: Purples7, 35943Purples8: Purples8, 35944Purples9: Purples9, 35945Blues3: Blues3, 35946Blues4: Blues4, 35947Blues5: Blues5, 35948Blues6: Blues6, 35949Blues7: Blues7, 35950Blues8: Blues8, 35951Blues9: Blues9, 35952Greens3: Greens3, 35953Greens4: Greens4, 35954Greens5: Greens5, 35955Greens6: Greens6, 35956Greens7: Greens7, 35957Greens8: Greens8, 35958Greens9: Greens9, 35959Oranges3: Oranges3, 35960Oranges4: Oranges4, 35961Oranges5: Oranges5, 35962Oranges6: Oranges6, 35963Oranges7: Oranges7, 35964Oranges8: Oranges8, 35965Oranges9: Oranges9, 35966Reds3: Reds3, 35967Reds4: Reds4, 35968Reds5: Reds5, 35969Reds6: Reds6, 35970Reds7: Reds7, 35971Reds8: Reds8, 35972Reds9: Reds9, 35973Greys3: Greys3, 35974Greys4: Greys4, 35975Greys5: Greys5, 35976Greys6: Greys6, 35977Greys7: Greys7, 35978Greys8: Greys8, 35979Greys9: Greys9, 35980PuOr3: PuOr3, 35981PuOr4: PuOr4, 35982PuOr5: PuOr5, 35983PuOr6: PuOr6, 35984PuOr7: PuOr7, 35985PuOr8: PuOr8, 35986PuOr9: PuOr9, 35987PuOr10: PuOr10, 35988PuOr11: PuOr11, 35989BrBG3: BrBG3, 35990BrBG4: BrBG4, 35991BrBG5: BrBG5, 35992BrBG6: BrBG6, 35993BrBG7: BrBG7, 35994BrBG8: BrBG8, 35995BrBG9: BrBG9, 35996BrBG10: BrBG10, 35997BrBG11: BrBG11, 35998PRGn3: PRGn3, 35999PRGn4: PRGn4, 36000PRGn5: PRGn5, 36001PRGn6: PRGn6, 36002PRGn7: PRGn7, 36003PRGn8: PRGn8, 36004PRGn9: PRGn9, 36005PRGn10: PRGn10, 36006PRGn11: PRGn11, 36007PiYG3: PiYG3, 36008PiYG4: PiYG4, 36009PiYG5: PiYG5, 36010PiYG6: PiYG6, 36011PiYG7: PiYG7, 36012PiYG8: PiYG8, 36013PiYG9: PiYG9, 36014PiYG10: PiYG10, 36015PiYG11: PiYG11, 36016RdBu3: RdBu3, 36017RdBu4: RdBu4, 36018RdBu5: RdBu5, 36019RdBu6: RdBu6, 36020RdBu7: RdBu7, 36021RdBu8: RdBu8, 36022RdBu9: RdBu9, 36023RdBu10: RdBu10, 36024RdBu11: RdBu11, 36025RdGy3: RdGy3, 36026RdGy4: RdGy4, 36027RdGy5: RdGy5, 36028RdGy6: RdGy6, 36029RdGy7: RdGy7, 36030RdGy8: RdGy8, 36031RdGy9: RdGy9, 36032RdGy10: RdGy10, 36033RdGy11: RdGy11, 36034RdYlBu3: RdYlBu3, 36035RdYlBu4: RdYlBu4, 36036RdYlBu5: RdYlBu5, 36037RdYlBu6: RdYlBu6, 36038RdYlBu7: RdYlBu7, 36039RdYlBu8: RdYlBu8, 36040RdYlBu9: RdYlBu9, 36041RdYlBu10: RdYlBu10, 36042RdYlBu11: RdYlBu11, 36043Spectral3: Spectral3, 36044Spectral4: Spectral4, 36045Spectral5: Spectral5, 36046Spectral6: Spectral6, 36047Spectral7: Spectral7, 36048Spectral8: Spectral8, 36049Spectral9: Spectral9, 36050Spectral10: Spectral10, 36051Spectral11: Spectral11, 36052RdYlGn3: RdYlGn3, 36053RdYlGn4: RdYlGn4, 36054RdYlGn5: RdYlGn5, 36055RdYlGn6: RdYlGn6, 36056RdYlGn7: RdYlGn7, 36057RdYlGn8: RdYlGn8, 36058RdYlGn9: RdYlGn9, 36059RdYlGn10: RdYlGn10, 36060RdYlGn11: RdYlGn11, 36061Accent3: Accent3, 36062Accent4: Accent4, 36063Accent5: Accent5, 36064Accent6: Accent6, 36065Accent7: Accent7, 36066Accent8: Accent8, 36067DarkTwo3: DarkTwo3, 36068DarkTwo4: DarkTwo4, 36069DarkTwo5: DarkTwo5, 36070DarkTwo6: DarkTwo6, 36071DarkTwo7: DarkTwo7, 36072DarkTwo8: DarkTwo8, 36073Paired3: Paired3, 36074Paired4: Paired4, 36075Paired5: Paired5, 36076Paired6: Paired6, 36077Paired7: Paired7, 36078Paired8: Paired8, 36079Paired9: Paired9, 36080Paired10: Paired10, 36081Paired11: Paired11, 36082Paired12: Paired12, 36083PastelOne3: PastelOne3, 36084PastelOne4: PastelOne4, 36085PastelOne5: PastelOne5, 36086PastelOne6: PastelOne6, 36087PastelOne7: PastelOne7, 36088PastelOne8: PastelOne8, 36089PastelOne9: PastelOne9, 36090PastelTwo3: PastelTwo3, 36091PastelTwo4: PastelTwo4, 36092PastelTwo5: PastelTwo5, 36093PastelTwo6: PastelTwo6, 36094PastelTwo7: PastelTwo7, 36095PastelTwo8: PastelTwo8, 36096SetOne3: SetOne3, 36097SetOne4: SetOne4, 36098SetOne5: SetOne5, 36099SetOne6: SetOne6, 36100SetOne7: SetOne7, 36101SetOne8: SetOne8, 36102SetOne9: SetOne9, 36103SetTwo3: SetTwo3, 36104SetTwo4: SetTwo4, 36105SetTwo5: SetTwo5, 36106SetTwo6: SetTwo6, 36107SetTwo7: SetTwo7, 36108SetTwo8: SetTwo8, 36109SetThree3: SetThree3, 36110SetThree4: SetThree4, 36111SetThree5: SetThree5, 36112SetThree6: SetThree6, 36113SetThree7: SetThree7, 36114SetThree8: SetThree8, 36115SetThree9: SetThree9, 36116SetThree10: SetThree10, 36117SetThree11: SetThree11, 36118SetThree12: SetThree12 36119}); 36120 36121// eslint-disable-next-line one-var 36122var 36123 Adjacency6 = ['#a9a57c', '#9cbebd', '#d2cb6c', '#95a39d', '#c89f5d', '#b1a089'], 36124 Advantage6 = ['#663366', '#330f42', '#666699', '#999966', '#f7901e', '#a3a101'], 36125 Angles6 = ['#797b7e', '#f96a1b', '#08a1d9', '#7c984a', '#c2ad8d', '#506e94'], 36126 Apex6 = ['#ceb966', '#9cb084', '#6bb1c9', '#6585cf', '#7e6bc9', '#a379bb'], 36127 Apothecary6 = ['#93a299', '#cf543f', '#b5ae53', '#848058', '#e8b54d', '#786c71'], 36128 Aspect6 = ['#f07f09', '#9f2936', '#1b587c', '#4e8542', '#604878', '#c19859'], 36129 Atlas6 = ['#f81b02', '#fc7715', '#afbf41', '#50c49f', '#3b95c4', '#b560d4'], 36130 Austin6 = ['#94c600', '#71685a', '#ff6700', '#909465', '#956b43', '#fea022'], 36131 Badge6 = ['#f8b323', '#656a59', '#46b2b5', '#8caa7e', '#d36f68', '#826276'], 36132 Banded6 = ['#ffc000', '#a5d028', '#08cc78', '#f24099', '#828288', '#f56617'], 36133 Basis6 = ['#f09415', '#c1b56b', '#4baf73', '#5aa6c0', '#d17df9', '#fa7e5c'], 36134 Berlin6 = ['#a6b727', '#df5327', '#fe9e00', '#418ab3', '#d7d447', '#818183'], 36135 BlackTie6 = ['#6f6f74', '#a7b789', '#beae98', '#92a9b9', '#9c8265', '#8d6974'], 36136 Blue6 = ['#0f6fc6', '#009dd9', '#0bd0d9', '#10cf9b', '#7cca62', '#a5c249'], 36137 BlueGreen6 = ['#3494ba', '#58b6c0', '#75bda7', '#7a8c8e', '#84acb6', '#2683c6'], 36138 BlueII6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'], 36139 BlueRed6 = ['#4a66ac', '#629dd1', '#297fd5', '#7f8fa9', '#5aa2ae', '#9d90a0'], 36140 BlueWarm6 = ['#4a66ac', '#629dd1', '#297fd5', '#7f8fa9', '#5aa2ae', '#9d90a0'], 36141 Breeze6 = ['#2c7c9f', '#244a58', '#e2751d', '#ffb400', '#7eb606', '#c00000'], 36142 Capital6 = ['#4b5a60', '#9c5238', '#504539', '#c1ad79', '#667559', '#bad6ad'], 36143 Celestial6 = ['#ac3ec1', '#477bd1', '#46b298', '#90ba4c', '#dd9d31', '#e25247'], 36144 Circuit6 = ['#9acd4c', '#faa93a', '#d35940', '#b258d3', '#63a0cc', '#8ac4a7'], 36145 Civic6 = ['#d16349', '#ccb400', '#8cadae', '#8c7b70', '#8fb08c', '#d19049'], 36146 Clarity6 = ['#93a299', '#ad8f67', '#726056', '#4c5a6a', '#808da0', '#79463d'], 36147 Codex6 = ['#990000', '#efab16', '#78ac35', '#35aca2', '#4083cf', '#0d335e'], 36148 Composite6 = ['#98c723', '#59b0b9', '#deae00', '#b77bb4', '#e0773c', '#a98d63'], 36149 Concourse6 = ['#2da2bf', '#da1f28', '#eb641b', '#39639d', '#474b78', '#7d3c4a'], 36150 Couture6 = ['#9e8e5c', '#a09781', '#85776d', '#aeafa9', '#8d878b', '#6b6149'], 36151 Crop6 = ['#8c8d86', '#e6c069', '#897b61', '#8dab8e', '#77a2bb', '#e28394'], 36152 Damask6 = ['#9ec544', '#50bea3', '#4a9ccc', '#9a66ca', '#c54f71', '#de9c3c'], 36153 Depth6 = ['#41aebd', '#97e9d5', '#a2cf49', '#608f3d', '#f4de3a', '#fcb11c'], 36154 Dividend6 = ['#4d1434', '#903163', '#b2324b', '#969fa7', '#66b1ce', '#40619d'], 36155 Droplet6 = ['#2fa3ee', '#4bcaad', '#86c157', '#d99c3f', '#ce6633', '#a35dd1'], 36156 Elemental6 = ['#629dd1', '#297fd5', '#7f8fa9', '#4a66ac', '#5aa2ae', '#9d90a0'], 36157 Equity6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'], 36158 Essential6 = ['#7a7a7a', '#f5c201', '#526db0', '#989aac', '#dc5924', '#b4b392'], 36159 Excel16 = ['#9999ff', '#993366', '#ffffcc', '#ccffff', '#660066', '#ff8080', '#0066cc', '#ccccff', '#000080', '#ff00ff', '#ffff00', '#0000ff', '#800080', '#800000', '#008080', '#0000ff'], 36160 Executive6 = ['#6076b4', '#9c5252', '#e68422', '#846648', '#63891f', '#758085'], 36161 Exhibit6 = ['#3399ff', '#69ffff', '#ccff33', '#3333ff', '#9933ff', '#ff33ff'], 36162 Expo6 = ['#fbc01e', '#efe1a2', '#fa8716', '#be0204', '#640f10', '#7e13e3'], 36163 Facet6 = ['#90c226', '#54a021', '#e6b91e', '#e76618', '#c42f1a', '#918655'], 36164 Feathered6 = ['#606372', '#79a8a4', '#b2ad8f', '#ad8082', '#dec18c', '#92a185'], 36165 Flow6 = ['#0f6fc6', '#009dd9', '#0bd0d9', '#10cf9b', '#7cca62', '#a5c249'], 36166 Focus6 = ['#ffb91d', '#f97817', '#6de304', '#ff0000', '#732bea', '#c913ad'], 36167 Folio6 = ['#294171', '#748cbc', '#8e887c', '#834736', '#5a1705', '#a0a16a'], 36168 Formal6 = ['#907f76', '#a46645', '#cd9c47', '#9a92cd', '#7d639b', '#733678'], 36169 Forte6 = ['#c70f0c', '#dd6b0d', '#faa700', '#93e50d', '#17c7ba', '#0a96e4'], 36170 Foundry6 = ['#72a376', '#b0ccb0', '#a8cdd7', '#c0beaf', '#cec597', '#e8b7b7'], 36171 Frame6 = ['#40bad2', '#fab900', '#90bb23', '#ee7008', '#1ab39f', '#d5393d'], 36172 Gallery6 = ['#b71e42', '#de478e', '#bc72f0', '#795faf', '#586ea6', '#6892a0'], 36173 Genesis6 = ['#80b606', '#e29f1d', '#2397e2', '#35aca2', '#5430bb', '#8d34e0'], 36174 Grayscale6 = ['#dddddd', '#b2b2b2', '#969696', '#808080', '#5f5f5f', '#4d4d4d'], 36175 Green6 = ['#549e39', '#8ab833', '#c0cf3a', '#029676', '#4ab5c4', '#0989b1'], 36176 GreenYellow6 = ['#99cb38', '#63a537', '#37a76f', '#44c1a3', '#4eb3cf', '#51c3f9'], 36177 Grid6 = ['#c66951', '#bf974d', '#928b70', '#87706b', '#94734e', '#6f777d'], 36178 Habitat6 = ['#f8c000', '#f88600', '#f83500', '#8b723d', '#818b3d', '#586215'], 36179 Hardcover6 = ['#873624', '#d6862d', '#d0be40', '#877f6c', '#972109', '#aeb795'], 36180 Headlines6 = ['#439eb7', '#e28b55', '#dcb64d', '#4ca198', '#835b82', '#645135'], 36181 Horizon6 = ['#7e97ad', '#cc8e60', '#7a6a60', '#b4936d', '#67787b', '#9d936f'], 36182 Infusion6 = ['#8c73d0', '#c2e8c4', '#c5a6e8', '#b45ec7', '#9fdafb', '#95c5b0'], 36183 Inkwell6 = ['#860908', '#4a0505', '#7a500a', '#c47810', '#827752', '#b5bb83'], 36184 Inspiration6 = ['#749805', '#bacc82', '#6e9ec2', '#2046a5', '#5039c6', '#7411d0'], 36185 Integral6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'], 36186 Ion6 = ['#b01513', '#ea6312', '#e6b729', '#6aac90', '#5f9c9d', '#9e5e9b'], 36187 IonBoardroom6 = ['#b31166', '#e33d6f', '#e45f3c', '#e9943a', '#9b6bf2', '#d53dd0'], 36188 Kilter6 = ['#76c5ef', '#fea022', '#ff6700', '#70a525', '#a5d848', '#20768c'], 36189 Madison6 = ['#a1d68b', '#5ec795', '#4dadcf', '#cdb756', '#e29c36', '#8ec0c1'], 36190 MainEvent6 = ['#b80e0f', '#a6987d', '#7f9a71', '#64969f', '#9b75b2', '#80737a'], 36191 Marquee6 = ['#418ab3', '#a6b727', '#f69200', '#838383', '#fec306', '#df5327'], 36192 Median6 = ['#94b6d2', '#dd8047', '#a5ab81', '#d8b25c', '#7ba79d', '#968c8c'], 36193 Mesh6 = ['#6f6f6f', '#bfbfa5', '#dcd084', '#e7bf5f', '#e9a039', '#cf7133'], 36194 Metail6 = ['#6283ad', '#324966', '#5b9ea4', '#1d5b57', '#1b4430', '#2f3c35'], 36195 Metro6 = ['#7fd13b', '#ea157a', '#feb80a', '#00addc', '#738ac8', '#1ab39f'], 36196 Metropolitan6 = ['#50b4c8', '#a8b97f', '#9b9256', '#657689', '#7a855d', '#84ac9d'], 36197 Module6 = ['#f0ad00', '#60b5cc', '#e66c7d', '#6bb76d', '#e88651', '#c64847'], 36198 NewsPrint6 = ['#ad0101', '#726056', '#ac956e', '#808da9', '#424e5b', '#730e00'], 36199 Office6 = ['#5b9bd5', '#ed7d31', '#a5a5a5', '#ffc000', '#4472c4', '#70ad47'], 36200 OfficeClassic6 = ['#4f81bd', '#c0504d', '#9bbb59', '#8064a2', '#4bacc6', '#f79646'], 36201 Opulent6 = ['#b83d68', '#ac66bb', '#de6c36', '#f9b639', '#cf6da4', '#fa8d3d'], 36202 Orange6 = ['#e48312', '#bd582c', '#865640', '#9b8357', '#c2bc80', '#94a088'], 36203 OrangeRed6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'], 36204 Orbit6 = ['#f2d908', '#9de61e', '#0d8be6', '#c61b1b', '#e26f08', '#8d35d1'], 36205 Organic6 = ['#83992a', '#3c9770', '#44709d', '#a23c33', '#d97828', '#deb340'], 36206 Oriel6 = ['#fe8637', '#7598d9', '#b32c16', '#f5cd2d', '#aebad5', '#777c84'], 36207 Origin6 = ['#727ca3', '#9fb8cd', '#d2da7a', '#fada7a', '#b88472', '#8e736a'], 36208 Paper6 = ['#a5b592', '#f3a447', '#e7bc29', '#d092a7', '#9c85c0', '#809ec2'], 36209 Parallax6 = ['#30acec', '#80c34f', '#e29d3e', '#d64a3b', '#d64787', '#a666e1'], 36210 Parcel6 = ['#f6a21d', '#9bafb5', '#c96731', '#9ca383', '#87795d', '#a0988c'], 36211 Perception6 = ['#a2c816', '#e07602', '#e4c402', '#7dc1ef', '#21449b', '#a2b170'], 36212 Perspective6 = ['#838d9b', '#d2610c', '#80716a', '#94147c', '#5d5ad2', '#6f6c7d'], 36213 Pixel6 = ['#ff7f01', '#f1b015', '#fbec85', '#d2c2f1', '#da5af4', '#9d09d1'], 36214 Plaza6 = ['#990000', '#580101', '#e94a00', '#eb8f00', '#a4a4a4', '#666666'], 36215 Precedent6 = ['#993232', '#9b6c34', '#736c5d', '#c9972b', '#c95f2b', '#8f7a05'], 36216 Pushpin6 = ['#fda023', '#aa2b1e', '#71685c', '#64a73b', '#eb5605', '#b9ca1a'], 36217 Quotable6 = ['#00c6bb', '#6feba0', '#b6df5e', '#efb251', '#ef755f', '#ed515c'], 36218 Red6 = ['#a5300f', '#d55816', '#e19825', '#b19c7d', '#7f5f52', '#b27d49'], 36219 RedOrange6 = ['#e84c22', '#ffbd47', '#b64926', '#ff8427', '#cc9900', '#b22600'], 36220 RedViolet6 = ['#e32d91', '#c830cc', '#4ea6dc', '#4775e7', '#8971e1', '#d54773'], 36221 Retrospect6 = ['#e48312', '#bd582c', '#865640', '#9b8357', '#c2bc80', '#94a088'], 36222 Revolution6 = ['#0c5986', '#ddf53d', '#508709', '#bf5e00', '#9c0001', '#660075'], 36223 Saddle6 = ['#c6b178', '#9c5b14', '#71b2bc', '#78aa5d', '#867099', '#4c6f75'], 36224 Savon6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'], 36225 Sketchbook6 = ['#a63212', '#e68230', '#9bb05e', '#6b9bc7', '#4e66b2', '#8976ac'], 36226 Sky6 = ['#073779', '#8fd9fb', '#ffcc00', '#eb6615', '#c76402', '#b523b4'], 36227 Slate6 = ['#bc451b', '#d3ba68', '#bb8640', '#ad9277', '#a55a43', '#ad9d7b'], 36228 Slice6 = ['#052f61', '#a50e82', '#14967c', '#6a9e1f', '#e87d37', '#c62324'], 36229 Slipstream6 = ['#4e67c8', '#5eccf3', '#a7ea52', '#5dceaf', '#ff8021', '#f14124'], 36230 SOHO6 = ['#61625e', '#964d2c', '#66553e', '#848058', '#afa14b', '#ad7d4d'], 36231 Solstice6 = ['#3891a7', '#feb80a', '#c32d2e', '#84aa33', '#964305', '#475a8d'], 36232 Spectrum6 = ['#990000', '#ff6600', '#ffba00', '#99cc00', '#528a02', '#333333'], 36233 Story6 = ['#1d86cd', '#732e9a', '#b50b1b', '#e8950e', '#55992b', '#2c9c89'], 36234 Studio6 = ['#f7901e', '#fec60b', '#9fe62f', '#4ea5d1', '#1c4596', '#542d90'], 36235 Summer6 = ['#51a6c2', '#51c2a9', '#7ec251', '#e1dc53', '#b54721', '#a16bb1'], 36236 Technic6 = ['#6ea0b0', '#ccaf0a', '#8d89a4', '#748560', '#9e9273', '#7e848d'], 36237 Thatch6 = ['#759aa5', '#cfc60d', '#99987f', '#90ac97', '#ffad1c', '#b9ab6f'], 36238 Tradition6 = ['#6b4a0b', '#790a14', '#908342', '#423e5c', '#641345', '#748a2f'], 36239 Travelogue6 = ['#b74d21', '#a32323', '#4576a3', '#615d9a', '#67924b', '#bf7b1b'], 36240 Trek6 = ['#f0a22e', '#a5644e', '#b58b80', '#c3986d', '#a19574', '#c17529'], 36241 Twilight6 = ['#e8bc4a', '#83c1c6', '#e78d35', '#909ce1', '#839c41', '#cc5439'], 36242 Urban6 = ['#53548a', '#438086', '#a04da3', '#c4652d', '#8b5d3d', '#5c92b5'], 36243 UrbanPop6 = ['#86ce24', '#00a2e6', '#fac810', '#7d8f8c', '#d06b20', '#958b8b'], 36244 VaporTrail6 = ['#df2e28', '#fe801a', '#e9bf35', '#81bb42', '#32c7a9', '#4a9bdc'], 36245 Venture6 = ['#9eb060', '#d09a08', '#f2ec86', '#824f1c', '#511818', '#553876'], 36246 Verve6 = ['#ff388c', '#e40059', '#9c007f', '#68007f', '#005bd3', '#00349e'], 36247 View6 = ['#6f6f74', '#92a9b9', '#a7b789', '#b9a489', '#8d6374', '#9b7362'], 36248 Violet6 = ['#ad84c6', '#8784c7', '#5d739a', '#6997af', '#84acb6', '#6f8183'], 36249 VioletII6 = ['#92278f', '#9b57d3', '#755dd9', '#665eb8', '#45a5ed', '#5982db'], 36250 Waveform6 = ['#31b6fd', '#4584d3', '#5bd078', '#a5d028', '#f5c040', '#05e0db'], 36251 Wisp6 = ['#a53010', '#de7e18', '#9f8351', '#728653', '#92aa4c', '#6aac91'], 36252 WoodType6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'], 36253 Yellow6 = ['#ffca08', '#f8931d', '#ce8d3e', '#ec7016', '#e64823', '#9c6a6a'], 36254 YellowOrange6 = ['#f0a22e', '#a5644e', '#b58b80', '#c3986d', '#a19574', '#c17529']; 36255 36256var office = /*#__PURE__*/Object.freeze({ 36257__proto__: null, 36258Adjacency6: Adjacency6, 36259Advantage6: Advantage6, 36260Angles6: Angles6, 36261Apex6: Apex6, 36262Apothecary6: Apothecary6, 36263Aspect6: Aspect6, 36264Atlas6: Atlas6, 36265Austin6: Austin6, 36266Badge6: Badge6, 36267Banded6: Banded6, 36268Basis6: Basis6, 36269Berlin6: Berlin6, 36270BlackTie6: BlackTie6, 36271Blue6: Blue6, 36272BlueGreen6: BlueGreen6, 36273BlueII6: BlueII6, 36274BlueRed6: BlueRed6, 36275BlueWarm6: BlueWarm6, 36276Breeze6: Breeze6, 36277Capital6: Capital6, 36278Celestial6: Celestial6, 36279Circuit6: Circuit6, 36280Civic6: Civic6, 36281Clarity6: Clarity6, 36282Codex6: Codex6, 36283Composite6: Composite6, 36284Concourse6: Concourse6, 36285Couture6: Couture6, 36286Crop6: Crop6, 36287Damask6: Damask6, 36288Depth6: Depth6, 36289Dividend6: Dividend6, 36290Droplet6: Droplet6, 36291Elemental6: Elemental6, 36292Equity6: Equity6, 36293Essential6: Essential6, 36294Excel16: Excel16, 36295Executive6: Executive6, 36296Exhibit6: Exhibit6, 36297Expo6: Expo6, 36298Facet6: Facet6, 36299Feathered6: Feathered6, 36300Flow6: Flow6, 36301Focus6: Focus6, 36302Folio6: Folio6, 36303Formal6: Formal6, 36304Forte6: Forte6, 36305Foundry6: Foundry6, 36306Frame6: Frame6, 36307Gallery6: Gallery6, 36308Genesis6: Genesis6, 36309Grayscale6: Grayscale6, 36310Green6: Green6, 36311GreenYellow6: GreenYellow6, 36312Grid6: Grid6, 36313Habitat6: Habitat6, 36314Hardcover6: Hardcover6, 36315Headlines6: Headlines6, 36316Horizon6: Horizon6, 36317Infusion6: Infusion6, 36318Inkwell6: Inkwell6, 36319Inspiration6: Inspiration6, 36320Integral6: Integral6, 36321Ion6: Ion6, 36322IonBoardroom6: IonBoardroom6, 36323Kilter6: Kilter6, 36324Madison6: Madison6, 36325MainEvent6: MainEvent6, 36326Marquee6: Marquee6, 36327Median6: Median6, 36328Mesh6: Mesh6, 36329Metail6: Metail6, 36330Metro6: Metro6, 36331Metropolitan6: Metropolitan6, 36332Module6: Module6, 36333NewsPrint6: NewsPrint6, 36334Office6: Office6, 36335OfficeClassic6: OfficeClassic6, 36336Opulent6: Opulent6, 36337Orange6: Orange6, 36338OrangeRed6: OrangeRed6, 36339Orbit6: Orbit6, 36340Organic6: Organic6, 36341Oriel6: Oriel6, 36342Origin6: Origin6, 36343Paper6: Paper6, 36344Parallax6: Parallax6, 36345Parcel6: Parcel6, 36346Perception6: Perception6, 36347Perspective6: Perspective6, 36348Pixel6: Pixel6, 36349Plaza6: Plaza6, 36350Precedent6: Precedent6, 36351Pushpin6: Pushpin6, 36352Quotable6: Quotable6, 36353Red6: Red6, 36354RedOrange6: RedOrange6, 36355RedViolet6: RedViolet6, 36356Retrospect6: Retrospect6, 36357Revolution6: Revolution6, 36358Saddle6: Saddle6, 36359Savon6: Savon6, 36360Sketchbook6: Sketchbook6, 36361Sky6: Sky6, 36362Slate6: Slate6, 36363Slice6: Slice6, 36364Slipstream6: Slipstream6, 36365SOHO6: SOHO6, 36366Solstice6: Solstice6, 36367Spectrum6: Spectrum6, 36368Story6: Story6, 36369Studio6: Studio6, 36370Summer6: Summer6, 36371Technic6: Technic6, 36372Thatch6: Thatch6, 36373Tradition6: Tradition6, 36374Travelogue6: Travelogue6, 36375Trek6: Trek6, 36376Twilight6: Twilight6, 36377Urban6: Urban6, 36378UrbanPop6: UrbanPop6, 36379VaporTrail6: VaporTrail6, 36380Venture6: Venture6, 36381Verve6: Verve6, 36382View6: View6, 36383Violet6: Violet6, 36384VioletII6: VioletII6, 36385Waveform6: Waveform6, 36386Wisp6: Wisp6, 36387WoodType6: WoodType6, 36388Yellow6: Yellow6, 36389YellowOrange6: YellowOrange6 36390}); 36391 36392// eslint-disable-next-line one-var 36393var 36394 // New 36395 Tableau10 = ['#4E79A7', '#F28E2B', '#E15759', '#76B7B2', '#59A14F', '#EDC948', '#B07AA1', '#FF9DA7', '#9C755F', '#BAB0AC'], 36396 Tableau20 = ['#4E79A7', '#A0CBE8', '#F28E2B', '#FFBE7D', '#59A14F', '#8CD17D', '#B6992D', '#F1CE63', '#499894', '#86BCB6', '#E15759', '#FF9D9A', '#79706E', '#BAB0AC', '#D37295', '#FABFD2', '#B07AA1', '#D4A6C8', '#9D7660', '#D7B5A6'], 36397 ColorBlind10 = ['#1170aa', '#fc7d0b', '#a3acb9', '#57606c', '#5fa2ce', '#c85200', '#7b848f', '#a3cce9', '#ffbc79', '#c8d0d9'], 36398 SeattleGrays5 = ['#767f8b', '#b3b7b8', '#5c6068', '#d3d3d3', '#989ca3'], 36399 Traffic9 = ['#b60a1c', '#e39802', '#309143', '#e03531', '#f0bd27', '#51b364', '#ff684c', '#ffda66', '#8ace7e'], 36400 MillerStone11 = ['#4f6980', '#849db1', '#a2ceaa', '#638b66', '#bfbb60', '#f47942', '#fbb04e', '#b66353', '#d7ce9f', '#b9aa97', '#7e756d'], 36401 SuperfishelStone10 = ['#6388b4', '#ffae34', '#ef6f6a', '#8cc2ca', '#55ad89', '#c3bc3f', '#bb7693', '#baa094', '#a9b5ae', '#767676'], 36402 NurielStone9 = ['#8175aa', '#6fb899', '#31a1b3', '#ccb22b', '#a39fc9', '#94d0c0', '#959c9e', '#027b8e', '#9f8f12'], 36403 JewelBright9 = ['#eb1e2c', '#fd6f30', '#f9a729', '#f9d23c', '#5fbb68', '#64cdcc', '#91dcea', '#a4a4d5', '#bbc9e5'], 36404 Summer8 = ['#bfb202', '#b9ca5d', '#cf3e53', '#f1788d', '#00a2b3', '#97cfd0', '#f3a546', '#f7c480'], 36405 Winter10 = ['#90728f', '#b9a0b4', '#9d983d', '#cecb76', '#e15759', '#ff9888', '#6b6b6b', '#bab2ae', '#aa8780', '#dab6af'], 36406 GreenOrangeTeal12 = ['#4e9f50', '#87d180', '#ef8a0c', '#fcc66d', '#3ca8bc', '#98d9e4', '#94a323', '#c3ce3d', '#a08400', '#f7d42a', '#26897e', '#8dbfa8'], 36407 RedBlueBrown12 = ['#466f9d', '#91b3d7', '#ed444a', '#feb5a2', '#9d7660', '#d7b5a6', '#3896c4', '#a0d4ee', '#ba7e45', '#39b87f', '#c8133b', '#ea8783'], 36408 PurplePinkGray12 = ['#8074a8', '#c6c1f0', '#c46487', '#ffbed1', '#9c9290', '#c5bfbe', '#9b93c9', '#ddb5d5', '#7c7270', '#f498b6', '#b173a0', '#c799bc'], 36409 HueCircle19 = ['#1ba3c6', '#2cb5c0', '#30bcad', '#21B087', '#33a65c', '#57a337', '#a2b627', '#d5bb21', '#f8b620', '#f89217', '#f06719', '#e03426', '#f64971', '#fc719e', '#eb73b3', '#ce69be', '#a26dc2', '#7873c0', '#4f7cba'], 36410 OrangeBlue7 = ['#9e3d22', '#d45b21', '#f69035', '#d9d5c9', '#77acd3', '#4f81af', '#2b5c8a'], 36411 RedGreen7 = ['#a3123a', '#e33f43', '#f8816b', '#ced7c3', '#73ba67', '#44914e', '#24693d'], 36412 GreenBlue7 = ['#24693d', '#45934d', '#75bc69', '#c9dad2', '#77a9cf', '#4e7fab', '#2a5783'], 36413 RedBlue7 = ['#a90c38', '#e03b42', '#f87f69', '#dfd4d1', '#7eaed3', '#5383af', '#2e5a87'], 36414 RedBlack7 = ['#ae123a', '#e33e43', '#f8816b', '#d9d9d9', '#a0a7a8', '#707c83', '#49525e'], 36415 GoldPurple7 = ['#ad9024', '#c1a33b', '#d4b95e', '#e3d8cf', '#d4a3c3', '#c189b0', '#ac7299'], 36416 RedGreenGold7 = ['#be2a3e', '#e25f48', '#f88f4d', '#f4d166', '#90b960', '#4b9b5f', '#22763f'], 36417 SunsetSunrise7 = ['#33608c', '#9768a5', '#e7718a', '#f6ba57', '#ed7846', '#d54c45', '#b81840'], 36418 OrangeBlueWhite7 = ['#9e3d22', '#e36621', '#fcad52', '#ffffff', '#95c5e1', '#5b8fbc', '#2b5c8a'], 36419 RedGreenWhite7 = ['#ae123a', '#ee574d', '#fdac9e', '#ffffff', '#91d183', '#539e52', '#24693d'], 36420 GreenBlueWhite7 = ['#24693d', '#529c51', '#8fd180', '#ffffff', '#95c1dd', '#598ab5', '#2a5783'], 36421 RedBlueWhite7 = ['#a90c38', '#ec534b', '#feaa9a', '#ffffff', '#9ac4e1', '#5c8db8', '#2e5a87'], 36422 RedBlackWhite7 = ['#ae123a', '#ee574d', '#fdac9d', '#ffffff', '#bdc0bf', '#7d888d', '#49525e'], 36423 OrangeBlueLight7 = ['#ffcc9e', '#f9d4b6', '#f0dccd', '#e5e5e5', '#dae1ea', '#cfdcef', '#c4d8f3'], 36424 Temperature7 = ['#529985', '#6c9e6e', '#99b059', '#dbcf47', '#ebc24b', '#e3a14f', '#c26b51'], 36425 BlueGreen7 = ['#feffd9', '#f2fabf', '#dff3b2', '#c4eab1', '#94d6b7', '#69c5be', '#41b7c4'], 36426 BlueLight7 = ['#e5e5e5', '#e0e3e8', '#dbe1ea', '#d5dfec', '#d0dcef', '#cadaf1', '#c4d8f3'], 36427 OrangeLight7 = ['#e5e5e5', '#ebe1d9', '#f0ddcd', '#f5d9c2', '#f9d4b6', '#fdd0aa', '#ffcc9e'], 36428 Blue20 = ['#b9ddf1', '#afd6ed', '#a5cfe9', '#9bc7e4', '#92c0df', '#89b8da', '#80b0d5', '#79aacf', '#72a3c9', '#6a9bc3', '#6394be', '#5b8cb8', '#5485b2', '#4e7fac', '#4878a6', '#437a9f', '#3d6a98', '#376491', '#305d8a', '#2a5783'], 36429 Orange20 = ['#ffc685', '#fcbe75', '#f9b665', '#f7ae54', '#f5a645', '#f59c3c', '#f49234', '#f2882d', '#f07e27', '#ee7422', '#e96b20', '#e36420', '#db5e20', '#d25921', '#ca5422', '#c14f22', '#b84b23', '#af4623', '#a64122', '#9e3d22'], 36430 Green20 = ['#b3e0a6', '#a5db96', '#98d687', '#8ed07f', '#85ca77', '#7dc370', '#75bc69', '#6eb663', '#67af5c', '#61a956', '#59a253', '#519c51', '#49964f', '#428f4d', '#398949', '#308344', '#2b7c40', '#27763d', '#256f3d', '#24693d'], 36431 Red20 = ['#ffbeb2', '#feb4a6', '#fdab9b', '#fca290', '#fb9984', '#fa8f79', '#f9856e', '#f77b66', '#f5715d', '#f36754', '#f05c4d', '#ec5049', '#e74545', '#e13b42', '#da323f', '#d3293d', '#ca223c', '#c11a3b', '#b8163a', '#ae123a'], 36432 Purple20 = ['#eec9e5', '#eac1df', '#e6b9d9', '#e0b2d2', '#daabcb', '#d5a4c4', '#cf9dbe', '#ca96b8', '#c48fb2', '#be89ac', '#b882a6', '#b27ba1', '#aa759d', '#a27099', '#9a6a96', '#926591', '#8c5f86', '#865986', '#81537f', '#7c4d79'], 36433 Brown20 = ['#eedbbd', '#ecd2ad', '#ebc994', '#eac085', '#e8b777', '#e5ae6c', '#e2a562', '#de9d5a', '#d99455', '#d38c54', '#ce8451', '#c9784d', '#c47247', '#c16941', '#bd6036', '#b85636', '#b34d34', '#ad4433', '#a63d32', '#9f3632'], 36434 Gray20 = ['#d5d5d5', '#cdcecd', '#c5c7c6', '#bcbfbe', '#b4b7b7', '#acb0b1', '#a4a9ab', '#9ca3a4', '#939c9e', '#8b9598', '#848e93', '#7c878d', '#758087', '#6e7a81', '#67737c', '#616c77', '#5b6570', '#555f6a', '#4f5864', '#49525e'], 36435 GrayWarm20 = ['#dcd4d0', '#d4ccc8', '#cdc4c0', '#c5bdb9', '#beb6b2', '#b7afab', '#b0a7a4', '#a9a09d', '#a29996', '#9b938f', '#948c88', '#8d8481', '#867e7b', '#807774', '#79706e', '#736967', '#6c6260', '#665c51', '#5f5654', '#59504e'], 36436 BlueTeal20 = ['#bce4d8', '#aedcd5', '#a1d5d2', '#95cecf', '#89c8cc', '#7ec1ca', '#72bac6', '#66b2c2', '#59acbe', '#4ba5ba', '#419eb6', '#3b96b2', '#358ead', '#3586a7', '#347ea1', '#32779b', '#316f96', '#2f6790', '#2d608a', '#2c5985'], 36437 OrangeGold20 = ['#f4d166', '#f6c760', '#f8bc58', '#f8b252', '#f7a84a', '#f69e41', '#f49538', '#f38b2f', '#f28026', '#f0751e', '#eb6c1c', '#e4641e', '#de5d1f', '#d75521', '#cf4f22', '#c64a22', '#bc4623', '#b24223', '#a83e24', '#9e3a26'], 36438 GreenGold20 = ['#f4d166', '#e3cd62', '#d3c95f', '#c3c55d', '#b2c25b', '#a3bd5a', '#93b958', '#84b457', '#76af56', '#67a956', '#5aa355', '#4f9e53', '#479751', '#40914f', '#3a8a4d', '#34844a', '#2d7d45', '#257740', '#1c713b', '#146c36'], 36439 RedGold21 = ['#f4d166', '#f5c75f', '#f6bc58', '#f7b254', '#f9a750', '#fa9d4f', '#fa9d4f', '#fb934d', '#f7894b', '#f47f4a', '#f0774a', '#eb6349', '#e66549', '#e15c48', '#dc5447', '#d64c45', '#d04344', '#ca3a42', '#c43141', '#bd273f', '#b71d3e'], 36440 36441 // Classic 36442 Classic10 = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], 36443 ClassicMedium10 = ['#729ece', '#ff9e4a', '#67bf5c', '#ed665d', '#ad8bc9', '#a8786e', '#ed97ca', '#a2a2a2', '#cdcc5d', '#6dccda'], 36444 ClassicLight10 = ['#aec7e8', '#ffbb78', '#98df8a', '#ff9896', '#c5b0d5', '#c49c94', '#f7b6d2', '#c7c7c7', '#dbdb8d', '#9edae5'], 36445 Classic20 = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'], 36446 ClassicGray5 = ['#60636a', '#a5acaf', '#414451', '#8f8782', '#cfcfcf'], 36447 ClassicColorBlind10 = ['#006ba4', '#ff800e', '#ababab', '#595959', '#5f9ed1', '#c85200', '#898989', '#a2c8ec', '#ffbc79', '#cfcfcf'], 36448 ClassicTrafficLight9 = ['#b10318', '#dba13a', '#309343', '#d82526', '#ffc156', '#69b764', '#f26c64', '#ffdd71', '#9fcd99'], 36449 ClassicPurpleGray6 = ['#7b66d2', '#dc5fbd', '#94917b', '#995688', '#d098ee', '#d7d5c5'], 36450 ClassicPurpleGray12 = ['#7b66d2', '#a699e8', '#dc5fbd', '#ffc0da', '#5f5a41', '#b4b19b', '#995688', '#d898ba', '#ab6ad5', '#d098ee', '#8b7c6e', '#dbd4c5'], 36451 ClassicGreenOrange6 = ['#32a251', '#ff7f0f', '#3cb7cc', '#ffd94a', '#39737c', '#b85a0d'], 36452 ClassicGreenOrange12 = ['#32a251', '#acd98d', '#ff7f0f', '#ffb977', '#3cb7cc', '#98d9e4', '#b85a0d', '#ffd94a', '#39737c', '#86b4a9', '#82853b', '#ccc94d'], 36453 ClassicBlueRed6 = ['#2c69b0', '#f02720', '#ac613c', '#6ba3d6', '#ea6b73', '#e9c39b'], 36454 ClassicBlueRed12 = ['#2c69b0', '#b5c8e2', '#f02720', '#ffb6b0', '#ac613c', '#e9c39b', '#6ba3d6', '#b5dffd', '#ac8763', '#ddc9b4', '#bd0a36', '#f4737a'], 36455 ClassicCyclic13 = ['#1f83b4', '#12a2a8', '#2ca030', '#78a641', '#bcbd22', '#ffbf50', '#ffaa0e', '#ff7f0e', '#d63a3a', '#c7519c', '#ba43b4', '#8a60b0', '#6f63bb'], 36456 ClassicGreen7 = ['#bccfb4', '#94bb83', '#69a761', '#339444', '#27823b', '#1a7232', '#09622a'], 36457 ClassicGray13 = ['#c3c3c3', '#b2b2b2', '#a2a2a2', '#929292', '#838383', '#747474', '#666666', '#585858', '#4b4b4b', '#3f3f3f', '#333333', '#282828', '#1e1e1e'], 36458 ClassicBlue7 = ['#b4d4da', '#7bc8e2', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'], 36459 ClassicRed9 = ['#eac0bd', '#f89a90', '#f57667', '#e35745', '#d8392c', '#cf1719', '#c21417', '#b10c1d', '#9c0824'], 36460 ClassicOrange7 = ['#f0c294', '#fdab67', '#fd8938', '#f06511', '#d74401', '#a33202', '#7b3014'], 36461 ClassicAreaRed11 = ['#f5cac7', '#fbb3ab', '#fd9c8f', '#fe8b7a', '#fd7864', '#f46b55', '#ea5e45', '#e04e35', '#d43e25', '#c92b14', '#bd1100'], 36462 ClassicAreaGreen11 = ['#dbe8b4', '#c3e394', '#acdc7a', '#9ad26d', '#8ac765', '#7abc5f', '#6cae59', '#60a24d', '#569735', '#4a8c1c', '#3c8200'], 36463 ClassicAreaBrown11 = ['#f3e0c2', '#f6d29c', '#f7c577', '#f0b763', '#e4aa63', '#d89c63', '#cc8f63', '#c08262', '#bb7359', '#bb6348', '#bb5137'], 36464 ClassicRedGreen11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#a2c18f', '#69a761', '#2f8e41', '#1e7735', '#09622a'], 36465 ClassicRedBlue11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'], 36466 ClassicRedBlack11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#9b9b9b', '#777777', '#565656', '#383838', '#1e1e1e'], 36467 ClassicAreaRedGreen21 = ['#bd1100', '#c82912', '#d23a21', '#dc4930', '#e6583e', '#ef654d', '#f7705b', '#fd7e6b', '#fe8e7e', '#fca294', '#e9dabe', '#c7e298', '#b1de7f', '#a0d571', '#90cb68', '#82c162', '#75b65d', '#69aa56', '#5ea049', '#559633', '#4a8c1c'], 36468 ClassicOrangeBlue13 = ['#7b3014', '#a33202', '#d74401', '#f06511', '#fd8938', '#fdab67', '#cacaca', '#7bc8e2', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'], 36469 ClassicGreenBlue11 = ['#09622a', '#1e7735', '#2f8e41', '#69a761', '#a2c18f', '#cacaca', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'], 36470 ClassicRedWhiteGreen11 = ['#9c0824', '#b41f27', '#cc312b', '#e86753', '#fcb4a5', '#ffffff', '#b9d7b7', '#74af72', '#428f49', '#297839', '#09622a'], 36471 ClassicRedWhiteBlack11 = ['#9c0824', '#b41f27', '#cc312b', '#e86753', '#fcb4a5', '#ffffff', '#bfbfbf', '#838383', '#575757', '#393939', '#1e1e1e'], 36472 ClassicOrangeWhiteBlue11 = ['#7b3014', '#a84415', '#d85a13', '#fb8547', '#ffc2a1', '#ffffff', '#b7cde2', '#6a9ec5', '#3679a8', '#2e5f8a', '#26456e'], 36473 ClassicRedWhiteBlackLight10 = ['#ffc2c5', '#ffd1d3', '#ffe0e1', '#fff0f0', '#ffffff', '#f3f3f3', '#e8e8e8', '#dddddd', '#d1d1d1', '#c6c6c6'], 36474 ClassicOrangeWhiteBlueLight11 = ['#ffcc9e', '#ffd6b1', '#ffe0c5', '#ffead8', '#fff5eb', '#ffffff', '#f3f7fd', '#e8effa', '#dce8f8', '#d0e0f6', '#c4d8f3'], 36475 ClassicRedWhiteGreenLight11 = ['#ffb2b6', '#ffc2c5', '#ffd1d3', '#ffe0e1', '#fff0f0', '#ffffff', '#f1faed', '#e3f5db', '#d5f0ca', '#c6ebb8', '#b7e6a7'], 36476 ClassicRedGreenLight11 = ['#ffb2b6', '#fcbdc0', '#f8c7c9', '#f2d1d2', '#ecdbdc', '#e5e5e5', '#dde6d9', '#d4e6cc', '#cae6c0', '#c1e6b4', '#b7e6a7']; 36477 36478var tableau = /*#__PURE__*/Object.freeze({ 36479__proto__: null, 36480Tableau10: Tableau10, 36481Tableau20: Tableau20, 36482ColorBlind10: ColorBlind10, 36483SeattleGrays5: SeattleGrays5, 36484Traffic9: Traffic9, 36485MillerStone11: MillerStone11, 36486SuperfishelStone10: SuperfishelStone10, 36487NurielStone9: NurielStone9, 36488JewelBright9: JewelBright9, 36489Summer8: Summer8, 36490Winter10: Winter10, 36491GreenOrangeTeal12: GreenOrangeTeal12, 36492RedBlueBrown12: RedBlueBrown12, 36493PurplePinkGray12: PurplePinkGray12, 36494HueCircle19: HueCircle19, 36495OrangeBlue7: OrangeBlue7, 36496RedGreen7: RedGreen7, 36497GreenBlue7: GreenBlue7, 36498RedBlue7: RedBlue7, 36499RedBlack7: RedBlack7, 36500GoldPurple7: GoldPurple7, 36501RedGreenGold7: RedGreenGold7, 36502SunsetSunrise7: SunsetSunrise7, 36503OrangeBlueWhite7: OrangeBlueWhite7, 36504RedGreenWhite7: RedGreenWhite7, 36505GreenBlueWhite7: GreenBlueWhite7, 36506RedBlueWhite7: RedBlueWhite7, 36507RedBlackWhite7: RedBlackWhite7, 36508OrangeBlueLight7: OrangeBlueLight7, 36509Temperature7: Temperature7, 36510BlueGreen7: BlueGreen7, 36511BlueLight7: BlueLight7, 36512OrangeLight7: OrangeLight7, 36513Blue20: Blue20, 36514Orange20: Orange20, 36515Green20: Green20, 36516Red20: Red20, 36517Purple20: Purple20, 36518Brown20: Brown20, 36519Gray20: Gray20, 36520GrayWarm20: GrayWarm20, 36521BlueTeal20: BlueTeal20, 36522OrangeGold20: OrangeGold20, 36523GreenGold20: GreenGold20, 36524RedGold21: RedGold21, 36525Classic10: Classic10, 36526ClassicMedium10: ClassicMedium10, 36527ClassicLight10: ClassicLight10, 36528Classic20: Classic20, 36529ClassicGray5: ClassicGray5, 36530ClassicColorBlind10: ClassicColorBlind10, 36531ClassicTrafficLight9: ClassicTrafficLight9, 36532ClassicPurpleGray6: ClassicPurpleGray6, 36533ClassicPurpleGray12: ClassicPurpleGray12, 36534ClassicGreenOrange6: ClassicGreenOrange6, 36535ClassicGreenOrange12: ClassicGreenOrange12, 36536ClassicBlueRed6: ClassicBlueRed6, 36537ClassicBlueRed12: ClassicBlueRed12, 36538ClassicCyclic13: ClassicCyclic13, 36539ClassicGreen7: ClassicGreen7, 36540ClassicGray13: ClassicGray13, 36541ClassicBlue7: ClassicBlue7, 36542ClassicRed9: ClassicRed9, 36543ClassicOrange7: ClassicOrange7, 36544ClassicAreaRed11: ClassicAreaRed11, 36545ClassicAreaGreen11: ClassicAreaGreen11, 36546ClassicAreaBrown11: ClassicAreaBrown11, 36547ClassicRedGreen11: ClassicRedGreen11, 36548ClassicRedBlue11: ClassicRedBlue11, 36549ClassicRedBlack11: ClassicRedBlack11, 36550ClassicAreaRedGreen21: ClassicAreaRedGreen21, 36551ClassicOrangeBlue13: ClassicOrangeBlue13, 36552ClassicGreenBlue11: ClassicGreenBlue11, 36553ClassicRedWhiteGreen11: ClassicRedWhiteGreen11, 36554ClassicRedWhiteBlack11: ClassicRedWhiteBlack11, 36555ClassicOrangeWhiteBlue11: ClassicOrangeWhiteBlue11, 36556ClassicRedWhiteBlackLight10: ClassicRedWhiteBlackLight10, 36557ClassicOrangeWhiteBlueLight11: ClassicOrangeWhiteBlueLight11, 36558ClassicRedWhiteGreenLight11: ClassicRedWhiteGreenLight11, 36559ClassicRedGreenLight11: ClassicRedGreenLight11 36560}); 36561 36562var colorschemes = { 36563 brewer: brewer, 36564 office: office, 36565 tableau: tableau 36566}; 36567 36568var EXPANDO_KEY = '$colorschemes'; 36569
vendor: 3,050 bytes, lines 36570-36663
36570// pluginBase snippet fixes the chartjs 3 incompatibility, and is backwards-compatible 36571// by Github user gebrits (https://github.com/gebrits/chartjs-plugin-colorschemes) 36572// 36573// Chartjs 2 => Chart.defaults.global 36574// Chartjs 3 => Chart.defaults 36575const pluginBase = chart_js.Chart.defaults.global || chart_js.Chart.defaults; 36576pluginBase.plugins.colorschemes = { 36577 scheme: 'brewer.Paired12', 36578 fillAlpha: 0.5, 36579 reverse: false, 36580 overrideExisting: false 36581}; 36582 36583function getScheme(scheme) { 36584 var colorschemes, matches, arr, category; 36585 36586 if (Array.isArray(scheme)) { 36587 return scheme; 36588 } else if (typeof scheme === 'string') { 36589 colorschemes = chart_js.Chart.colorschemes || {}; 36590 36591 // For backward compatibility 36592 matches = scheme.match(/^(brewer\.\w+)([1-3])-(\d+)$/); 36593 if (matches) { 36594 scheme = matches[1] + ['One', 'Two', 'Three'][matches[2] - 1] + matches[3]; 36595 } else if (scheme === 'office.Office2007-2010-6') { 36596 scheme = 'office.OfficeClassic6'; 36597 } 36598 36599 arr = scheme.split('.'); 36600 category = colorschemes[arr[0]]; 36601 if (category) { 36602 return category[arr[1]]; 36603 } 36604 } 36605} 36606 36607var ColorSchemesPlugin = { 36608 id: 'colorschemes', 36609 36610 beforeUpdate: function(chart, args, options) { 36611 // Please note that in v3, the args argument was added. It was not used before it was added, 36612 // so we just check if it is not actually our options object 36613 if (options === undefined) { 36614 options = args; 36615 } 36616 36617 var scheme = getScheme(options.scheme); 36618 var fillAlpha = options.fillAlpha; 36619 var reverse = options.reverse; 36620 var override = options.overrideExisting; 36621 var custom = options.custom; 36622 var schemeClone, customResult, length, colorIndex, newColor; 36623 36624 if (scheme) { 36625 36626 if (typeof custom === 'function') { 36627 // clone the original scheme 36628 schemeClone = scheme.slice(); 36629 36630 // Execute own custom color function 36631 customResult = custom(schemeClone); 36632 36633 // check if we really received a filled array; otherwise we keep and use the original scheme 36634 if (Array.isArray(customResult) && customResult.length) { 36635 scheme = customResult; 36636 } else if (Array.isArray(schemeClone) && schemeClone.length) { 36637 scheme = schemeClone; 36638 } 36639 } 36640 36641 length = scheme.length; 36642 36643 // Set scheme colors 36644 chart.config.data.datasets.forEach(function(dataset, datasetIndex) { 36645 colorIndex = datasetIndex % length; 36646 newColor = scheme[reverse ? length - colorIndex - 1 : colorIndex]; 36647 36648 // Object to store which color option is set 36649 dataset[EXPANDO_KEY] = {}; 36650 36651 switch (dataset.type || chart.config.type) { 36652 // For line, radar and scatter chart, borderColor and backgroundColor (50% transparent) are set 36653 case 'line': 36654 case 'radar': 36655 case 'scatter': 36656 if (typeof dataset.backgroundColor === 'undefined' || override) { 36657 dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor; 36658 dataset.backgroundColor = helpers.color(newColor).alpha(fillAlpha).rgbString(); 36659 } 36660 if (typeof dataset.borderColor === 'undefined' || override) { 36661 dataset[EXPANDO_KEY].borderColor = dataset.borderColor; 36662 dataset.borderColor = newColor; 36663 }
vendor: 2,176 bytes, lines 36664-36717
36664 if (typeof dataset.pointBackgroundColor === 'undefined' || override) { 36665 dataset[EXPANDO_KEY].pointBackgroundColor = dataset.pointBackgroundColor; 36666 dataset.pointBackgroundColor = helpers.color(newColor).alpha(fillAlpha).rgbString(); 36667 } 36668 if (typeof dataset.pointBorderColor === 'undefined' || override) { 36669 dataset[EXPANDO_KEY].pointBorderColor = dataset.pointBorderColor; 36670 dataset.pointBorderColor = newColor; 36671 } 36672 break; 36673 // For doughnut and pie chart, backgroundColor is set to an array of colors 36674 case 'doughnut': 36675 case 'pie': 36676 case 'polarArea': 36677 if (typeof dataset.backgroundColor === 'undefined' || override) { 36678 dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor; 36679 dataset.backgroundColor = dataset.data.map(function(data, dataIndex) { 36680 colorIndex = dataIndex % length; 36681 return scheme[reverse ? length - colorIndex - 1 : colorIndex]; 36682 }); 36683 } 36684 break; 36685 // For bar chart backgroundColor (including fillAlpha) and borderColor are set 36686 case 'bar': 36687 if (typeof dataset.backgroundColor === 'undefined' || override) { 36688 dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor; 36689 dataset.backgroundColor = helpers.color(newColor).alpha(fillAlpha).rgbString(); 36690 } 36691 if (typeof dataset.borderColor === 'undefined' || override) { 36692 dataset[EXPANDO_KEY].borderColor = dataset.borderColor; 36693 dataset.borderColor = newColor; 36694 } 36695 break; 36696 // For the other chart, only backgroundColor is set 36697 default: 36698 if (typeof dataset.backgroundColor === 'undefined' || override) { 36699 dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor; 36700 dataset.backgroundColor = newColor; 36701 } 36702 break; 36703 } 36704 }); 36705 } 36706 }, 36707 36708 afterUpdate: function(chart) { 36709 // Unset colors 36710 chart.config.data.datasets.forEach(function(dataset) { 36711 if (dataset[EXPANDO_KEY]) { 36712 if (dataset[EXPANDO_KEY].hasOwnProperty('backgroundColor')) { 36713 dataset.backgroundColor = dataset[EXPANDO_KEY].backgroundColor; 36714 } 36715 if (dataset[EXPANDO_KEY].hasOwnProperty('borderColor')) { 36716 dataset.borderColor = dataset[EXPANDO_KEY].borderColor; 36717 }
36718 if (dataset[EXPANDO_KEY].hasOwnProperty('pointBackgroundColor')) { 36719 dataset.pointBackgroundColor = dataset[EXPANDO_KEY].pointBackgroundColor; 36720 } 36721 if (dataset[EXPANDO_KEY].hasOwnProperty('pointBorderColor')) { 36722 dataset.pointBorderColor = dataset[EXPANDO_KEY].pointBorderColor; 36723 } 36724 delete dataset[EXPANDO_KEY]; 36725 } 36726 }); 36727 }, 36728 36729 beforeEvent: function(chart, event, options) { 36730 }, 36731 36732 afterEvent: function(chart) { 36733 } 36734}; 36735 36736if (chart_js.Chart.registry) { 36737 // Chartjs 3 36738 chart_js.Chart.register(ColorSchemesPlugin); 36739} else { 36740 // Chartjs 2 36741 chart_js.Chart.plugins.register(ColorSchemesPlugin); 36742} 36743 36744chart_js.Chart.colorschemes = colorschemes; 36745 36746return ColorSchemesPlugin; 36747 36748}))); 36749 36750 36751 36752 36753Opendata_Graph = function (canvas, controller) { 36754 this.$canvas = $(canvas); 36755 this.$container = $(canvas).parent("div"); 36756 this.$controller = $(controller); 36757 this.chart = null; 36758}; 36759 36760Opendata_Graph.prototype.render = function(type, name, labels, datasets, opts) { 36761 if (opts == null) { 36762 opts = {}; 36763 } 36764 36765 this.type = type; 36766 this.name = name; 36767 this.labels = labels; 36768 this.datasets = datasets; 36769 this.headerIndex = opts["headerIndex"]; 36770 36771 this.destroy(); 36772 if (this.headerIndex || this.headerIndex === 0) { 36773 var dataset = this.datasets[this.headerIndex]; 36774 if (dataset) { 36775 this.datasets = [dataset]; 36776 } 36777 } 36778 if (this.type === "bar") { 36779 this.drawBar(); 36780 } else if(this.type === "line") { 36781 this.drawLine(); 36782 } else if (this.type === "pie") { 36783 this.drawPie(); 36784 } 36785}; 36786 36787Opendata_Graph.prototype.resizeContainer = function(width) { 36788 var baseWidth = this.$container.data("baseWidth"); 36789 if (!baseWidth) { 36790 baseWidth = this.$container.width(); 36791 this.$container.data("baseWidth", baseWidth); 36792 } 36793 if (width > baseWidth) { 36794 this.$container.css("width", width + "px"); 36795 } else { 36796 this.$container.css("width", baseWidth + "px"); 36797 } 36798}; 36799 36800Opendata_Graph.prototype.datasetsMinWidth = function() { 36801 return (this.datasets.length * 12) * this.labels.length; 36802}; 36803 36804Opendata_Graph.prototype.drawBar = function() { 36805 var self = this; 36806 36807 this.resizeContainer(this.datasetsMinWidth()); 36808 this.chart = new Chart(this.$canvas, { 36809 type: 'bar', 36810 plugins: [ChartColorSchemes], 36811 responsive: true, 36812 maintainAspectRatio: false, 36813 data: { 36814 labels: this.labels, 36815 datasets: this.datasets, 36816 }, 36817 options: { 36818 title: { 36819 display: true, 36820 text: this.name, 36821 fontSize: 18 36822 }, 36823 legend: { 36824 display: true, 36825 position: 'bottom', 36826 onClick: function () { return false; } 36827 }, 36828 plugins: { 36829 colorschemes: { 36830 scheme: 'brewer.Paired12' 36831 } 36832 }, 36833 scales: { 36834 x: { 36835 ticks: { 36836 autoSkip: false 36837 } 36838 }, 36839 y: { 36840 ticks: { 36841 beginAtZero: true, 36842 callback: function (label, _index, _labels) { 36843 return label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); 36844 } 36845 } 36846 } 36847 }, 36848 animation: { 36849 onComplete: function() { 36850 self.$container.addClass("loaded"); 36851 } 36852 } 36853 } 36854 }); 36855}; 36856 36857Opendata_Graph.prototype.drawLine = function() { 36858 var self = this; 36859 36860 this.resizeContainer(this.datasetsMinWidth()); 36861 this.chart = new Chart(this.$canvas, { 36862 type: 'line', 36863 plugins: [ChartColorSchemes], 36864 responsive: true, 36865 maintainAspectRatio: false, 36866 data: { 36867 labels: this.labels, 36868 datasets: this.datasets, 36869 }, 36870 options: { 36871 title: { 36872 display: true, 36873 text: this.name, 36874 fontSize: 18 36875 }, 36876 legend: { 36877 display: true, 36878 position: 'bottom', 36879 onClick: function () { return false; } 36880 }, 36881 plugins: { 36882 colorschemes: { 36883 scheme: 'brewer.Paired12' 36884 } 36885 }, 36886 scales: { 36887 x: { 36888 ticks: { 36889 autoSkip: false 36890 } 36891 }, 36892 y: { 36893 ticks: { 36894 beginAtZero: true, 36895 callback: function(label, _index, _labels) { 36896 return label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); 36897 } 36898 } 36899 } 36900 }, 36901 animation: { 36902 onComplete: function() { 36903 self.$container.addClass("loaded"); 36904 } 36905 } 36906 } 36907 }); 36908}; 36909 36910Opendata_Graph.prototype.drawPie = function() { 36911 var self = this; 36912 36913 this.resizeContainer(0); 36914 this.chart = new Chart(this.$canvas, { 36915 type: 'pie', 36916 plugins: [ChartColorSchemes], 36917 responsive: true, 36918 maintainAspectRatio: false, 36919 data: { 36920 labels: this.labels, 36921 datasets: this.datasets, 36922 }, 36923 options: { 36924 title: { 36925 display: true, 36926 text: this.name, 36927 fontSize: 18 36928 }, 36929 legend: { 36930 display: true, 36931 position: 'bottom', 36932 onClick: function () { return false; } 36933 }, 36934 plugins: { 36935 colorschemes: { 36936 scheme: 'brewer.Paired12' 36937 } 36938 }, 36939 tooltips: { 36940 callbacks: { 36941 label: function(tooltipItem, data) { 36942 var label = data["labels"][tooltipItem["index"]]; 36943 var dataset = data["datasets"][tooltipItem["datasetIndex"]]; 36944 36945 data = dataset["data"][tooltipItem["index"]]; 36946 data = data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); 36947 36948 label = label + "ï¼" + dataset["label"] + "ï¼: " + data; 36949 return label; 36950 } 36951 } 36952 }, 36953 scales: { 36954 x: { display: false }, 36955 y: { display: false } 36956 }, 36957 animation: { 36958 onComplete: function() { 36959 self.$container.addClass("loaded"); 36960 } 36961 } 36962 } 36963 }); 36964}; 36965 36966Opendata_Graph.graphTypes = {"bar":"æ£ã°ã©ã","line":"ç·ã°ã©ã","pie":"åã°ã©ã"}; 36967 36968Opendata_Graph.prototype.renderController = function(types, headers, callback) { 36969 var self = this; 36970 this.types = types; 36971 this.headers = headers; 36972 this.$controller.html(""); 36973 36974 // type bottons 36975 var divTypes = $('<div class="graph-types"></div>'); 36976 $.each(this.types, function() { 36977 var type = this; 36978 var button = $('<button />', { type: "button", "data-type": type }).text(Opendata_Graph.graphTypes[type]); 36979 36980 if (self.type === type) { 36981 button.addClass("current"); 36982 } 36983 button.on("click", function() { 36984 callback(type); 36985 }) 36986 divTypes.append(button); 36987 }); 36988 this.$controller.append(divTypes); 36989 36990 // pie controller
36991 if (this.type === "pie" && this.headers && this.headers.length > 0) { 36992 var divHeader = $('<div class="graph-header-controller"></div>'); 36993 var select = $('<select class="select-header" name="header-index"></select>'); 36994 36995 $.each(this.headers, function(i) { 36996 if (self.headerIndex === i) { 36997 select.append($('<option />', { value: i, selected: "selected" }).text(this)); 36998 } else { 36999 select.append($('<option />', { value: i }).text(this)); 37000 } 37001 }); 37002 select.on("change", function() { 37003 callback("pie", select.val()); 37004 }); 37005 37006 divHeader.append(select); 37007 this.$controller.append(divHeader); 37008 } 37009 37010 this.$controller.show(); 37011}; 37012 37013Opendata_Graph.prototype.destroy = function() { 37014 if (this.chart) { 37015 this.chart.destroy(); 37016 } 37017 if (this.$controller) { 37018 this.$controller.html(""); 37019 } 37020}; 37021 37022this.Opendata_Dataset_Graph = (function () { 37023 function Opendata_Dataset_Graph() { 37024 } 37025 37026 Opendata_Dataset_Graph.graph = null; 37027 Opendata_Dataset_Graph.$canvas = null; 37028 Opendata_Dataset_Graph.$controller = null; 37029 37030 Opendata_Dataset_Graph.render = function (canvas, controller) { 37031 $(".dataset-search a#ajax-search").colorbox({ 37032 fixed: true, 37033 width: "90%", 37034 height: "90%" 37035 }); 37036 Opendata_Dataset_Graph.$canvas = $(canvas); 37037 Opendata_Dataset_Graph.$controller = $(controller); 37038 Opendata_Dataset_Graph.graph = new Opendata_Graph( 37039 Opendata_Dataset_Graph.$canvas, 37040 Opendata_Dataset_Graph.$controller 37041 ); 37042 } 37043 37044 Opendata_Dataset_Graph.renderGraph = function (type, header) { 37045 var ele = $('.selected-dataset [name="resource_id"]:checked:first'); 37046 37047 if (ele.length > 0) { 37048 var url = $(ele).data("url"); 37049 var name = $(ele).closest("li").find(".resource-name").text(); 37050 37051 if (type) { 37052 url += "?type=" + type; 37053 } 37054 $.ajax({ 37055 url: url, 37056 type: "GET", 37057 dataType: "json", 37058 success: function (data) { 37059 var type = data["type"]; 37060 var types = data["types"]; 37061 var datasets = data["datasets"]; 37062 var labels = data["labels"]; 37063 var headers = data["headers"]; 37064 37065 if (type == "pie") { 37066 if (!header) { 37067 header = 0; 37068 } 37069 name += "ï¼" + headers[header] + "ï¼"; 37070 } 37071 Opendata_Dataset_Graph.graph.render(type, name, labels, datasets, {headerIndex: header}); 37072 Opendata_Dataset_Graph.graph.renderController(types, headers, function (type, header) { 37073 Opendata_Dataset_Graph.renderGraph(type, header); 37074 }); 37075 } 37076 }); 37077 } else { 37078 Opendata_Dataset_Graph.graph.destroy(); 37079 } 37080 }; 37081 37082 Opendata_Dataset_Graph.selectItem = function (ele) { 37083 // var dataset_id = $(ele).attr("data-id"); 37084 var item = $(ele).find(".selected-item").clone(false); 37085 37086 // remove renderInBox class 37087 $(item).find("a").removeClass("cboxElement"); 37088 37089 $(item).find('[name="resource_id"]').each(function (_idx) { 37090 // var resource_id = $(this).val(); 37091 37092 // checkbox 37093 $(this).on("click", function () { 37094 $(this).closest('.selected-dataset').find('[name="resource_id"]').not(this).prop("checked", false); 37095 Opendata_Dataset_Graph.renderGraph(); 37096 Opendata_Dataset_Graph.toggleFirstNotice(); 37097 }); 37098 }); 37099 37100 // deselect button 37101 $(item).find(".deselect").on("click", function (_e) { 37102 $(this).closest(".selected-item").remove(); 37103 Opendata_Dataset_Graph.graph.destroy(); 37104 Opendata_Dataset_Graph.toggleFirstNotice(); 37105 return false; 37106 }); 37107 37108 // append and remove 37109 item.show(); 37110 $(".dataset-search .selected-dataset").append(item); 37111 var length = $(".dataset-search .selected-dataset .selected-item").length - 10; 37112 for (var i = 0; i < length; i++) { 37113 $(".dataset-search .selected-dataset .selected-item:first").remove(); 37114 } 37115 Opendata_Dataset_Graph.toggleFirstNotice(); 37116 37117 return item; 37118 } 37119 37120 Opendata_Dataset_Graph.toggleSelectButton = function () { 37121 if ($(".search-ui .items input:checked").size() > 0) { 37122 $(".select-items").parent("div").show(); 37123 } else { 37124 $(".select-items").parent("div").hide(); 37125 } 37126 }; 37127 37128 Opendata_Dataset_Graph.toggleFirstNotice = function () { 37129 if ($('.selected-dataset [name="resource_id"]:checked').length > 0) { 37130 $(".resource-graph .first-notice").hide(); 37131 } else { 37132 $(".resource-graph .first-notice").show(); 37133 } 37134 }; 37135 37136 Opendata_Dataset_Graph.modal = function () { 37137 // form search event 37138 $(".search-ui-form form.search").on("submit", function (_e) { 37139 $(this).ajaxSubmit({ 37140 url: $(this).attr("action"), 37141 success: function (data) { 37142 return $("#cboxLoadedContent").html(data); 37143 }, 37144 error: function (_data, _status) { 37145 return alert("== Error =="); 37146 } 37147 }); 37148 return false;
37149 }); 37150 37151 // select item event 37152 $(".search-ui a.select-item").on("click", function (_e) { 37153 var tr = $(this).closest("tr"); 37154 var article = Opendata_Dataset_Graph.selectItem(tr); 37155 37156 $.colorbox.close(); 37157 $(article).find(".set-graph:first").trigger("click"); 37158 37159 return false; 37160 }); 37161 37162 // select items event 37163 $(".search-ui-select .select-items").on("click", function (_e) { 37164 $(".search-ui .items .set-dataset:checked").each(function () { 37165 var tr = $(this).closest("tr"); 37166 Opendata_Dataset_Graph.selectItem(tr); 37167 }); 37168 $.colorbox.close(); 37169 return false; 37170 }); 37171 37172 // list-head checkbox event 37173 $(".search-ui .list-head input:checkbox").on("change", function (_e) { 37174 var chk = $(this).prop('checked'); 37175 $('.search-ui .list-item').each(function () { 37176 $(this).toggleClass('checked', chk); 37177 $(this).find('.set-dataset').prop('checked', chk); 37178 }); 37179 }); 37180 37181 // toggle select items button event 37182 $(".search-ui").on("change", function (_e) { 37183 Opendata_Dataset_Graph.toggleSelectButton(); 37184 }); 37185 37186 // disable selected items in modal 37187 $(".dataset-search .selected-dataset .selected-item").each(function () { 37188 var id = $(this).attr("data-id"); 37189 var tr = $(".items [data-id='" + id + "']"); 37190 tr.find("input[type=checkbox]").remove(); 37191 37192 var item = tr.find(".select-item").html(); 37193 tr.find(".select-item").replaceWith("<span class='select-item' style='color: #888'>" + item + "</span>"); 37194 }); 37195 } 37196 37197 return Opendata_Dataset_Graph; 37198})(); 37199this.Photolib_Bookmark = (function () { 37200 function Photolib_Bookmark() { 37201 } 37202 37203 Photolib_Bookmark.storageKey = "ss_photolib_bookmarks"; 37204 37205 Photolib_Bookmark.selector = ".photolib-bookmark[data-id]"; 37206 37207 Photolib_Bookmark.render = function () { 37208 var $selector = $(Photolib_Bookmark.selector); 37209 var items = Photolib_Bookmark.getItems(); 37210 37211 $selector.each(function (){ 37212 if ($(this).hasClass("bookmark-ready")) { 37213 return true; 37214 } 37215 37216 // addClass bookmark-on 37217 var dataId = $(this).data("id"); 37218 var found = items.find(function(item){ 37219 return parseInt(item.id) == parseInt(dataId); 37220 }); 37221 if (found) { 37222 $(this).addClass("bookmark-on"); 37223 } 37224 37225 // event 37226 $(this).on("click", function(){ 37227 var dataId = $(this).data("id"); 37228 var item = { id: dataId }; 37229 37230 // already exists? 37231 var items = Photolib_Bookmark.getItems(); 37232 var filtered = items.filter(function(item){ 37233 return parseInt(item.id) != parseInt(dataId); 37234 }); 37235 37236 if (items.length == filtered.length) { 37237 // push item 37238 if (items.length >= 20) { 37239 alert("ãæ°ã«å ¥ãç»é²ã¯20ä»¶ã¾ã§ã§ã") 37240 return false; 37241 } 37242 items.push(item); 37243 Photolib_Bookmark.setItems(items); 37244 $(this).addClass("bookmark-on"); 37245 } else { 37246 // delete item 37247 Photolib_Bookmark.setItems(filtered); 37248 $(this).removeClass("bookmark-on"); 37249 } 37250 return false; 37251 }); 37252 37253 $(this).addClass("bookmark-ready"); 37254 }); 37255 }; 37256 37257 Photolib_Bookmark.getItems = function () { 37258 var items = []; 37259 try { 37260 items = localStorage.getItem(Photolib_Bookmark.storageKey); 37261 items = (items) ? JSON.parse(items) : []; 37262 } catch (error) { 37263 console.warn(error); 37264 } 37265 return items; 37266 }; 37267 37268 Photolib_Bookmark.setItems = function (items) { 37269 try { 37270 localStorage.setItem(Photolib_Bookmark.storageKey, JSON.stringify(items)); 37271 } catch (error) { 37272 console.warn(error); 37273 } 37274 }; 37275 37276 return Photolib_Bookmark; 37277 37278})();
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.