1(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[20],{ 2 3/***/ 403: 4/***/ (function(module, exports, __webpack_require__) { 5 6var isarray = __webpack_require__(774); 7/** 8 * Expose `pathToRegexp`. 9 */ 10 11 12module.exports = pathToRegexp; 13module.exports.parse = parse; 14module.exports.compile = compile; 15module.exports.tokensToFunction = tokensToFunction; 16module.exports.tokensToRegExp = tokensToRegExp; 17/** 18 * The main path matching regexp utility. 19 * 20 * @type {RegExp} 21 */ 22 23var PATH_REGEXP = new RegExp([// Match escaped characters that would otherwise appear in future matches. 24// This allows the user to escape special characters that won't transform. 25'(\\\\.)', // Match Express-style parameters and un-named parameters with a prefix 26// and optional suffixes. Matches appear as: 27// 28// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] 29// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] 30// "/*" => ["/", undefined, undefined, undefined, undefined, "*"] 31'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g'); 32/** 33 * Parse a string for the raw tokens. 34 * 35 * @param {string} str 36 * @param {Object=} options 37 * @return {!Array} 38 */ 39 40function parse(str, options) { 41 var tokens = []; 42 var key = 0; 43 var index = 0; 44 var path = ''; 45 var defaultDelimiter = options && options.delimiter || '/'; 46 var res; 47 48 while ((res = PATH_REGEXP.exec(str)) != null) { 49 var m = res[0]; 50 var escaped = res[1]; 51 var offset = res.index; 52 path += str.slice(index, offset); 53 index = offset + m.length; // Ignore already escaped sequences. 54 55 if (escaped) { 56 path += escaped[1]; 57 continue; 58 } 59 60 var next = str[index]; 61 var prefix = res[2]; 62 var name = res[3]; 63 var capture = res[4]; 64 var group = res[5]; 65 var modifier = res[6]; 66 var asterisk = res[7]; // Push the current path onto the tokens. 67 68 if (path) { 69 tokens.push(path); 70 path = ''; 71 } 72 73 var partial = prefix != null && next != null && next !== prefix; 74 var repeat = modifier === '+' || modifier === '*'; 75 var optional = modifier === '?' || modifier === '*'; 76 var delimiter = res[2] || defaultDelimiter; 77 var pattern = capture || group; 78 tokens.push({ 79 name: name || key++, 80 prefix: prefix || '', 81 delimiter: delimiter, 82 optional: optional, 83 repeat: repeat, 84 partial: partial, 85 asterisk: !!asterisk, 86 pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?' 87 }); 88 } // Match any characters still remaining. 89 90 91 if (index < str.length) { 92 path += str.substr(index); 93 } // If the path exists, push it onto the end. 94 95 96 if (path) { 97 tokens.push(path); 98 } 99 100 return tokens; 101} 102/** 103 * Compile a string to a template function for the path. 104 * 105 * @param {string} str 106 * @param {Object=} options 107 * @return {!function(Object=, Object=)} 108 */ 109 110 111function compile(str, options) { 112 return tokensToFunction(parse(str, options), options); 113} 114/** 115 * Prettier encoding of URI path segments. 116 * 117 * @param {string} 118 * @return {string} 119 */ 120 121 122function encodeURIComponentPretty(str) { 123 return encodeURI(str).replace(/[\/?#]/g, function (c) { 124 return '%' + c.charCodeAt(0).toString(16).toUpperCase(); 125 }); 126} 127/** 128 * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. 129 * 130 * @param {string} 131 * @return {string} 132 */ 133 134 135function encodeAsterisk(str) { 136 return encodeURI(str).replace(/[?#]/g, function (c) { 137 return '%' + c.charCodeAt(0).toString(16).toUpperCase(); 138 }); 139} 140/** 141 * Expose a method for transforming tokens into the path function. 142 */ 143 144 145function tokensToFunction(tokens, options) { 146 // Compile all the tokens into regexps. 147 var matches = new Array(tokens.length); // Compile all the patterns before compilation. 148 149 for (var i = 0; i < tokens.length; i++) { 150 if (typeof tokens[i] === 'object') { 151 matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options)); 152 } 153 } 154 155 return function (obj, opts) { 156 var path = ''; 157 var data = obj || {}; 158 var options = opts || {}; 159 var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent; 160 161 for (var i = 0; i < tokens.length; i++) { 162 var token = tokens[i]; 163 164 if (typeof token === 'string') { 165 path += token; 166 continue; 167 } 168 169 var value = data[token.name]; 170 var segment; 171 172 if (value == null) { 173 if (token.optional) { 174 // Prepend partial segment prefixes. 175 if (token.partial) { 176 path += token.prefix; 177 } 178 179 continue; 180 } else { 181 throw new TypeError('Expected "' + token.name + '" to be defined'); 182 } 183 } 184 185 if (isarray(value)) { 186 if (!token.repeat) { 187 throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`'); 188 } 189 190 if (value.length === 0) { 191 if (token.optional) { 192 continue; 193 } else { 194 throw new TypeError('Expected "' + token.name + '" to not be empty'); 195 } 196 } 197 198 for (var j = 0; j < value.length; j++) { 199 segment = encode(value[j]); 200 201 if (!matches[i].test(segment)) { 202 throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`'); 203 } 204 205 path += (j === 0 ? token.prefix : token.delimiter) + segment; 206 } 207 208 continue; 209 } 210 211 segment = token.asterisk ? encodeAsterisk(value) : encode(value); 212 213 if (!matches[i].test(segment)) { 214 throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"'); 215 } 216 217 path += token.prefix + segment; 218 } 219 220 return path; 221 }; 222} 223/** 224 * Escape a regular expression string. 225 * 226 * @param {string} str 227 * @return {string} 228 */ 229 230 231function escapeString(str) { 232 return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1'); 233} 234/** 235 * Escape the capturing group by escaping special characters and meaning. 236 * 237 * @param {string} group 238 * @return {string} 239 */ 240 241 242function escapeGroup(group) { 243 return group.replace(/([=!:$\/()])/g, '\\$1'); 244} 245/** 246 * Attach the keys as a property of the regexp. 247 * 248 * @param {!RegExp} re 249 * @param {Array} keys 250 * @return {!RegExp} 251 */ 252 253 254function attachKeys(re, keys) { 255 re.keys = keys; 256 return re; 257} 258/** 259 * Get the flags for a regexp from the options. 260 * 261 * @param {Object} options 262 * @return {string} 263 */ 264 265 266function flags(options) { 267 return options && options.sensitive ? '' : 'i'; 268} 269/** 270 * Pull out keys from a regexp. 271 * 272 * @param {!RegExp} path 273 * @param {!Array} keys 274 * @return {!RegExp} 275 */ 276 277 278function regexpToRegexp(path, keys) { 279 // Use a negative lookahead to match only capturing groups. 280 var groups = path.source.match(/\((?!\?)/g); 281 282 if (groups) { 283 for (var i = 0; i < groups.length; i++) { 284 keys.push({ 285 name: i, 286 prefix: null, 287 delimiter: null, 288 optional: false, 289 repeat: false, 290 partial: false, 291 asterisk: false, 292 pattern: null 293 }); 294 } 295 } 296 297 return attachKeys(path, keys); 298} 299/** 300 * Transform an array into a regexp. 301 * 302 * @param {!Array} path 303 * @param {Array} keys 304 * @param {!Object} options 305 * @return {!RegExp} 306 */ 307 308 309function arrayToRegexp(path, keys, options) { 310 var parts = []; 311 312 for (var i = 0; i < path.length; i++) { 313 parts.push(pathToRegexp(path[i], keys, options).source); 314 } 315 316 var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); 317 return attachKeys(regexp, keys); 318} 319/** 320 * Create a path regexp from string input. 321 * 322 * @param {string} path 323 * @param {!Array} keys 324 * @param {!Object} options 325 * @return {!RegExp} 326 */ 327 328 329function stringToRegexp(path, keys, options) { 330 return tokensToRegExp(parse(path, options), keys, options); 331} 332/** 333 * Expose a function for taking tokens and returning a RegExp. 334 * 335 * @param {!Array} tokens 336 * @param {(Array|Object)=} keys 337 * @param {Object=} options 338 * @return {!RegExp} 339 */ 340 341 342function tokensToRegExp(tokens, keys, options) { 343 if (!isarray(keys)) { 344 options =
345 /** @type {!Object} */ 346 keys || options; 347 keys = []; 348 } 349 350 options = options || {}; 351 var strict = options.strict; 352 var end = options.end !== false; 353 var route = ''; // Iterate over the tokens and create our regexp string. 354 355 for (var i = 0; i < tokens.length; i++) { 356 var token = tokens[i]; 357 358 if (typeof token === 'string') { 359 route += escapeString(token); 360 } else { 361 var prefix = escapeString(token.prefix); 362 var capture = '(?:' + token.pattern + ')'; 363 keys.push(token); 364 365 if (token.repeat) { 366 capture += '(?:' + prefix + capture + ')*'; 367 } 368 369 if (token.optional) { 370 if (!token.partial) { 371 capture = '(?:' + prefix + '(' + capture + '))?'; 372 } else { 373 capture = prefix + '(' + capture + ')?'; 374 } 375 } else { 376 capture = prefix + '(' + capture + ')'; 377 } 378 379 route += capture; 380 } 381 } 382 383 var delimiter = escapeString(options.delimiter || '/'); 384 var endsWithDelimiter = route.slice(-delimiter.length) === delimiter; // In non-strict mode we allow a slash at the end of match. If the path to 385 // match already ends with a slash, we remove it for consistency. The slash 386 // is valid at the end of a path match, not in the middle. This is important 387 // in non-ending mode, where "/test/" shouldn't match "/test//route". 388 389 if (!strict) { 390 route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'; 391 } 392 393 if (end) { 394 route += '$'; 395 } else { 396 // In non-ending mode, we need the capturing groups to match as much as 397 // possible by using a positive lookahead to the end or next path segment. 398 route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'; 399 } 400 401 return attachKeys(new RegExp('^' + route, flags(options)), keys); 402} 403/** 404 * Normalize the given path string, returning a regular expression. 405 * 406 * An empty array can be passed in for the keys, which will hold the 407 * placeholder key descriptions. For example, using `/user/:id`, `keys` will 408 * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. 409 * 410 * @param {(string|RegExp|Array)} path 411 * @param {(Array|Object)=} keys 412 * @param {Object=} options 413 * @return {!RegExp} 414 */ 415 416 417function pathToRegexp(path, keys, options) { 418 if (!isarray(keys)) { 419 options = 420 /** @type {!Object} */ 421 keys || options; 422 keys = []; 423 } 424 425 options = options || {}; 426 427 if (path instanceof RegExp) { 428 return regexpToRegexp(path, 429 /** @type {!Array} */ 430 keys); 431 } 432 433 if (isarray(path)) { 434 return arrayToRegexp( 435 /** @type {!Array} */ 436 path, 437 /** @type {!Array} */ 438 keys, options); 439 } 440 441 return stringToRegexp( 442 /** @type {string} */ 443 path, 444 /** @type {!Array} */ 445 keys, options); 446} 447 448/***/ }), 449 450/***/ 44: 451/***/ (function(module, exports, __webpack_require__) { 452 453/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js 454//! version : 2.29.4 455//! authors : Tim Wood, Iskren Chernev, Moment.js contributors 456//! license : MIT 457//! momentjs.com 458; 459 460(function (global, factory) { 461 true ? module.exports = factory() : undefined; 462})(this, function () { 463 'use strict'; 464 465 var hookCallback; 466 467 function hooks() { 468 return hookCallback.apply(null, arguments); 469 } // This is done to register the method called with moment() 470 // without creating circular dependencies. 471 472 473 function setHookCallback(callback) { 474 hookCallback = callback; 475 } 476 477 function isArray(input) { 478 return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; 479 } 480 481 function isObject(input) { 482 // IE8 will treat undefined and null as object if it wasn't for 483 // input != null 484 return input != null && Object.prototype.toString.call(input) === '[object Object]'; 485 } 486 487 function hasOwnProp(a, b) { 488 return Object.prototype.hasOwnProperty.call(a, b); 489 } 490 491 function isObjectEmpty(obj) { 492 if (Object.getOwnPropertyNames) { 493 return Object.getOwnPropertyNames(obj).length === 0; 494 } else { 495 var k; 496 497 for (k in obj) { 498 if (hasOwnProp(obj, k)) { 499 return false;
vendor: 4,757 bytes, lines 500-716
500 } 501 } 502 503 return true; 504 } 505 } 506 507 function isUndefined(input) { 508 return input === void 0; 509 } 510 511 function isNumber(input) { 512 return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; 513 } 514 515 function isDate(input) { 516 return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; 517 } 518 519 function map(arr, fn) { 520 var res = [], 521 i, 522 arrLen = arr.length; 523 524 for (i = 0; i < arrLen; ++i) { 525 res.push(fn(arr[i], i)); 526 } 527 528 return res; 529 } 530 531 function extend(a, b) { 532 for (var i in b) { 533 if (hasOwnProp(b, i)) { 534 a[i] = b[i]; 535 } 536 } 537 538 if (hasOwnProp(b, 'toString')) { 539 a.toString = b.toString; 540 } 541 542 if (hasOwnProp(b, 'valueOf')) { 543 a.valueOf = b.valueOf; 544 } 545 546 return a; 547 } 548 549 function createUTC(input, format, locale, strict) { 550 return createLocalOrUTC(input, format, locale, strict, true).utc(); 551 } 552 553 function defaultParsingFlags() { 554 // We need to deep clone this object. 555 return { 556 empty: false, 557 unusedTokens: [], 558 unusedInput: [], 559 overflow: -2, 560 charsLeftOver: 0, 561 nullInput: false, 562 invalidEra: null, 563 invalidMonth: null, 564 invalidFormat: false, 565 userInvalidated: false, 566 iso: false, 567 parsedDateParts: [], 568 era: null, 569 meridiem: null, 570 rfc2822: false, 571 weekdayMismatch: false 572 }; 573 } 574 575 function getParsingFlags(m) { 576 if (m._pf == null) { 577 m._pf = defaultParsingFlags(); 578 } 579 580 return m._pf; 581 } 582 583 var some; 584 585 if (Array.prototype.some) { 586 some = Array.prototype.some; 587 } else { 588 some = function some(fun) { 589 var t = Object(this), 590 len = t.length >>> 0, 591 i; 592 593 for (i = 0; i < len; i++) { 594 if (i in t && fun.call(this, t[i], i, t)) { 595 return true; 596 } 597 } 598 599 return false; 600 }; 601 } 602 603 function isValid(m) { 604 if (m._isValid == null) { 605 var flags = getParsingFlags(m), 606 parsedParts = some.call(flags.parsedDateParts, function (i) { 607 return i != null; 608 }), 609 isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts); 610 611 if (m._strict) { 612 isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; 613 } 614 615 if (Object.isFrozen == null || !Object.isFrozen(m)) { 616 m._isValid = isNowValid; 617 } else { 618 return isNowValid; 619 } 620 } 621 622 return m._isValid; 623 } 624 625 function createInvalid(flags) { 626 var m = createUTC(NaN); 627 628 if (flags != null) { 629 extend(getParsingFlags(m), flags); 630 } else { 631 getParsingFlags(m).userInvalidated = true; 632 } 633 634 return m; 635 } // Plugins that add properties should also add the key here (null value), 636 // so we can properly clone ourselves. 637 638 639 var momentProperties = hooks.momentProperties = [], 640 updateInProgress = false; 641 642 function copyConfig(to, from) { 643 var i, 644 prop, 645 val, 646 momentPropertiesLen = momentProperties.length; 647 648 if (!isUndefined(from._isAMomentObject)) { 649 to._isAMomentObject = from._isAMomentObject; 650 } 651 652 if (!isUndefined(from._i)) { 653 to._i = from._i; 654 } 655 656 if (!isUndefined(from._f)) { 657 to._f = from._f; 658 } 659 660 if (!isUndefined(from._l)) { 661 to._l = from._l; 662 } 663 664 if (!isUndefined(from._strict)) { 665 to._strict = from._strict; 666 } 667 668 if (!isUndefined(from._tzm)) { 669 to._tzm = from._tzm; 670 } 671 672 if (!isUndefined(from._isUTC)) { 673 to._isUTC = from._isUTC; 674 } 675 676 if (!isUndefined(from._offset)) { 677 to._offset = from._offset; 678 } 679 680 if (!isUndefined(from._pf)) { 681 to._pf = getParsingFlags(from); 682 } 683 684 if (!isUndefined(from._locale)) { 685 to._locale = from._locale; 686 } 687 688 if (momentPropertiesLen > 0) { 689 for (i = 0; i < momentPropertiesLen; i++) { 690 prop = momentProperties[i]; 691 val = from[prop]; 692 693 if (!isUndefined(val)) { 694 to[prop] = val; 695 } 696 } 697 } 698 699 return to; 700 } // Moment prototype object 701 702 703 function Moment(config) { 704 copyConfig(this, config); 705 this._d = new Date(config._d != null ? config._d.getTime() : NaN); 706 707 if (!this.isValid()) { 708 this._d = new Date(NaN); 709 } // Prevent infinite loop in case updateOffset creates new moment 710 // objects. 711 712 713 if (updateInProgress === false) { 714 updateInProgress = true; 715 hooks.updateOffset(this); 716 updateInProgress = false;
717 } 718 } 719 720 function isMoment(obj) { 721 return obj instanceof Moment || obj != null && obj._isAMomentObject != null; 722 } 723 724 function warn(msg) { 725 if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) { 726 console.warn('Deprecation warning: ' + msg); 727 } 728 } 729 730 function deprecate(msg, fn) { 731 var firstTime = true; 732 return extend(function () { 733 if (hooks.deprecationHandler != null) { 734 hooks.deprecationHandler(null, msg); 735 } 736 737 if (firstTime) { 738 var args = [], 739 arg, 740 i, 741 key, 742 argLen = arguments.length; 743 744 for (i = 0; i < argLen; i++) { 745 arg = ''; 746 747 if (typeof arguments[i] === 'object') { 748 arg += '\n[' + i + '] '; 749 750 for (key in arguments[0]) { 751 if (hasOwnProp(arguments[0], key)) { 752 arg += key + ': ' + arguments[0][key] + ', '; 753 } 754 } 755 756 arg = arg.slice(0, -2); // Remove trailing comma and space 757 } else { 758 arg = arguments[i]; 759 } 760 761 args.push(arg); 762 } 763 764 warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack); 765 firstTime = false; 766 } 767 768 return fn.apply(this, arguments); 769 }, fn); 770 } 771 772 var deprecations = {}; 773 774 function deprecateSimple(name, msg) { 775 if (hooks.deprecationHandler != null) { 776 hooks.deprecationHandler(name, msg); 777 } 778 779 if (!deprecations[name]) { 780 warn(msg); 781 deprecations[name] = true; 782 } 783 } 784 785 hooks.suppressDeprecationWarnings = false; 786 hooks.deprecationHandler = null; 787 788 function isFunction(input) { 789 return typeof Function !== 'undefined' && input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; 790 } 791 792 function set(config) { 793 var prop, i; 794 795 for (i in config) { 796 if (hasOwnProp(config, i)) { 797 prop = config[i]; 798 799 if (isFunction(prop)) { 800 this[i] = prop; 801 } else { 802 this['_' + i] = prop; 803 } 804 } 805 } 806 807 this._config = config; // Lenient ordinal parsing accepts just a number in addition to 808 // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. 809 // TODO: Remove "ordinalParse" fallback in next major release. 810 811 this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source); 812 } 813 814 function mergeConfigs(parentConfig, childConfig) { 815 var res = extend({}, parentConfig), 816 prop; 817 818 for (prop in childConfig) { 819 if (hasOwnProp(childConfig, prop)) { 820 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { 821 res[prop] = {}; 822 extend(res[prop], parentConfig[prop]); 823 extend(res[prop], childConfig[prop]); 824 } else if (childConfig[prop] != null) { 825 res[prop] = childConfig[prop]; 826 } else { 827 delete res[prop]; 828 } 829 } 830 } 831 832 for (prop in parentConfig) { 833 if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) { 834 // make sure changes to properties don't modify parent config 835 res[prop] = extend({}, res[prop]); 836 } 837 } 838 839 return res; 840 } 841 842 function Locale(config) { 843 if (config != null) { 844 this.set(config); 845 } 846 } 847 848 var keys; 849 850 if (Object.keys) { 851 keys = Object.keys; 852 } else { 853 keys = function keys(obj) { 854 var i, 855 res = []; 856 857 for (i in obj) { 858 if (hasOwnProp(obj, i)) { 859 res.push(i); 860 } 861 } 862 863 return res; 864 }; 865 } 866 867 var defaultCalendar = { 868 sameDay: '[Today at] LT', 869 nextDay: '[Tomorrow at] LT', 870 nextWeek: 'dddd [at] LT', 871 lastDay: '[Yesterday at] LT', 872 lastWeek: '[Last] dddd [at] LT', 873 sameElse: 'L' 874 }; 875 876 function calendar(key, mom, now) { 877 var output = this._calendar[key] || this._calendar['sameElse']; 878 return isFunction(output) ? output.call(mom, now) : output; 879 } 880 881 function zeroFill(number, targetLength, forceSign) { 882 var absNumber = '' + Math.abs(number), 883 zerosToFill = targetLength - absNumber.length, 884 sign = number >= 0; 885 return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; 886 } 887 888 var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}
vendor: 21,102 bytes, lines 888-1680
888|x|X|zz?|ZZ?|.)/g, 889 localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, 890 formatFunctions = {}, 891 formatTokenFunctions = {}; // token: 'M' 892 // padded: ['MM', 2] 893 // ordinal: 'Mo' 894 // callback: function () { this.month() + 1 } 895 896 function addFormatToken(token, padded, ordinal, callback) { 897 var func = callback; 898 899 if (typeof callback === 'string') { 900 func = function func() { 901 return this[callback](); 902 }; 903 } 904 905 if (token) { 906 formatTokenFunctions[token] = func; 907 } 908 909 if (padded) { 910 formatTokenFunctions[padded[0]] = function () { 911 return zeroFill(func.apply(this, arguments), padded[1], padded[2]); 912 }; 913 } 914 915 if (ordinal) { 916 formatTokenFunctions[ordinal] = function () { 917 return this.localeData().ordinal(func.apply(this, arguments), token); 918 }; 919 } 920 } 921 922 function removeFormattingTokens(input) { 923 if (input.match(/\[[\s\S]/)) { 924 return input.replace(/^\[|\]$/g, ''); 925 } 926 927 return input.replace(/\\/g, ''); 928 } 929 930 function makeFormatFunction(format) { 931 var array = format.match(formattingTokens), 932 i, 933 length; 934 935 for (i = 0, length = array.length; i < length; i++) { 936 if (formatTokenFunctions[array[i]]) { 937 array[i] = formatTokenFunctions[array[i]]; 938 } else { 939 array[i] = removeFormattingTokens(array[i]); 940 } 941 } 942 943 return function (mom) { 944 var output = '', 945 i; 946 947 for (i = 0; i < length; i++) { 948 output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; 949 } 950 951 return output; 952 }; 953 } // format date using native date object 954 955 956 function formatMoment(m, format) { 957 if (!m.isValid()) { 958 return m.localeData().invalidDate(); 959 } 960 961 format = expandFormat(format, m.localeData()); 962 formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); 963 return formatFunctions[format](m); 964 } 965 966 function expandFormat(format, locale) { 967 var i = 5; 968 969 function replaceLongDateFormatTokens(input) { 970 return locale.longDateFormat(input) || input; 971 } 972 973 localFormattingTokens.lastIndex = 0; 974 975 while (i >= 0 && localFormattingTokens.test(format)) { 976 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); 977 localFormattingTokens.lastIndex = 0; 978 i -= 1; 979 } 980 981 return format; 982 } 983 984 var defaultLongDateFormat = { 985 LTS: 'h:mm:ss A', 986 LT: 'h:mm A', 987 L: 'MM/DD/YYYY', 988 LL: 'MMMM D, YYYY', 989 LLL: 'MMMM D, YYYY h:mm A', 990 LLLL: 'dddd, MMMM D, YYYY h:mm A' 991 }; 992 993 function longDateFormat(key) { 994 var format = this._longDateFormat[key], 995 formatUpper = this._longDateFormat[key.toUpperCase()]; 996 997 if (format || !formatUpper) { 998 return format; 999 } 1000 1001 this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function (tok) { 1002 if (tok === 'MMMM' || tok === 'MM' || tok === 'DD' || tok === 'dddd') { 1003 return tok.slice(1); 1004 } 1005 1006 return tok; 1007 }).join(''); 1008 return this._longDateFormat[key]; 1009 } 1010 1011 var defaultInvalidDate = 'Invalid date'; 1012 1013 function invalidDate() { 1014 return this._invalidDate; 1015 } 1016 1017 var defaultOrdinal = '%d', 1018 defaultDayOfMonthOrdinalParse = /\d{1,2}/; 1019 1020 function ordinal(number) { 1021 return this._ordinal.replace('%d', number); 1022 } 1023 1024 var defaultRelativeTime = { 1025 future: 'in %s', 1026 past: '%s ago', 1027 s: 'a few seconds', 1028 ss: '%d seconds', 1029 m: 'a minute', 1030 mm: '%d minutes', 1031 h: 'an hour', 1032 hh: '%d hours', 1033 d: 'a day', 1034 dd: '%d days', 1035 w: 'a week', 1036 ww: '%d weeks', 1037 M: 'a month', 1038 MM: '%d months', 1039 y: 'a year', 1040 yy: '%d years' 1041 }; 1042 1043 function relativeTime(number, withoutSuffix, string, isFuture) { 1044 var output = this._relativeTime[string]; 1045 return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); 1046 } 1047 1048 function pastFuture(diff, output) { 1049 var format = this._relativeTime[diff > 0 ? 'future' : 'past']; 1050 return isFunction(format) ? format(output) : format.replace(/%s/i, output); 1051 } 1052 1053 var aliases = {}; 1054 1055 function addUnitAlias(unit, shorthand) { 1056 var lowerCase = unit.toLowerCase(); 1057 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; 1058 } 1059 1060 function normalizeUnits(units) { 1061 return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; 1062 } 1063 1064 function normalizeObjectUnits(inputObject) { 1065 var normalizedInput = {}, 1066 normalizedProp, 1067 prop; 1068 1069 for (prop in inputObject) { 1070 if (hasOwnProp(inputObject, prop)) { 1071 normalizedProp = normalizeUnits(prop); 1072 1073 if (normalizedProp) { 1074 normalizedInput[normalizedProp] = inputObject[prop]; 1075 } 1076 } 1077 } 1078 1079 return normalizedInput; 1080 } 1081 1082 var priorities = {}; 1083 1084 function addUnitPriority(unit, priority) { 1085 priorities[unit] = priority; 1086 } 1087 1088 function getPrioritizedUnits(unitsObj) { 1089 var units = [], 1090 u; 1091 1092 for (u in unitsObj) { 1093 if (hasOwnProp(unitsObj, u)) { 1094 units.push({ 1095 unit: u, 1096 priority: priorities[u] 1097 }); 1098 } 1099 } 1100 1101 units.sort(function (a, b) { 1102 return a.priority - b.priority; 1103 }); 1104 return units; 1105 } 1106 1107 function isLeapYear(year) { 1108 return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; 1109 } 1110 1111 function absFloor(number) { 1112 if (number < 0) { 1113 // -0 -> 0 1114 return Math.ceil(number) || 0; 1115 } else { 1116 return Math.floor(number); 1117 } 1118 } 1119 1120 function toInt(argumentForCoercion) { 1121 var coercedNumber = +argumentForCoercion, 1122 value = 0; 1123 1124 if (coercedNumber !== 0 && isFinite(coercedNumber)) { 1125 value = absFloor(coercedNumber); 1126 } 1127 1128 return value; 1129 } 1130 1131 function makeGetSet(unit, keepTime) { 1132 return function (value) { 1133 if (value != null) { 1134 set$1(this, unit, value); 1135 hooks.updateOffset(this, keepTime); 1136 return this; 1137 } else { 1138 return get(this, unit); 1139 } 1140 }; 1141 } 1142 1143 function get(mom, unit) { 1144 return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; 1145 } 1146 1147 function set$1(mom, unit, value) { 1148 if (mom.isValid() && !isNaN(value)) { 1149 if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { 1150 value = toInt(value); 1151 1152 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); 1153 } else { 1154 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); 1155 } 1156 } 1157 } // MOMENTS 1158 1159 1160 function stringGet(units) { 1161 units = normalizeUnits(units); 1162 1163 if (isFunction(this[units])) { 1164 return this[units](); 1165 } 1166 1167 return this; 1168 } 1169 1170 function stringSet(units, value) { 1171 if (typeof units === 'object') { 1172 units = normalizeObjectUnits(units); 1173 var prioritized = getPrioritizedUnits(units), 1174 i, 1175 prioritizedLen = prioritized.length; 1176 1177 for (i = 0; i < prioritizedLen; i++) { 1178 this[prioritized[i].unit](units[prioritized[i].unit]); 1179 } 1180 } else { 1181 units = normalizeUnits(units); 1182 1183 if (isFunction(this[units])) { 1184 return this[units](value); 1185 } 1186 } 1187 1188 return this; 1189 } 1190 1191 var match1 = /\d/, 1192 // 0 - 9 1193 match2 = /\d\d/, 1194 // 00 - 99 1195 match3 = /\d{3}/, 1196 // 000 - 999 1197 match4 = /\d{4}/, 1198 // 0000 - 9999 1199 match6 = /[+-]?\d{6}/, 1200 // -999999 - 999999 1201 match1to2 = /\d\d?/, 1202 // 0 - 99 1203 match3to4 = /\d\d\d\d?/, 1204 // 999 - 9999 1205 match5to6 = /\d\d\d\d\d\d?/, 1206 // 99999 - 999999 1207 match1to3 = /\d{1,3}/, 1208 // 0 - 999 1209 match1to4 = /\d{1,4}/, 1210 // 0 - 9999 1211 match1to6 = /[+-]?\d{1,6}/, 1212 // -999999 - 999999 1213 matchUnsigned = /\d+/, 1214 // 0 - inf 1215 matchSigned = /[+-]?\d+/, 1216 // -inf - inf 1217 matchOffset = /Z|[+-]\d\d:?\d\d/gi, 1218 // +00:00 -00:00 +0000 -0000 or Z 1219 matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, 1220 // +00 -00 +00:00 -00:00 +0000 -0000 or Z 1221 matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, 1222 // 123456789 123456789.123 1223 // any word (or two) characters or numbers including two/three word month in arabic. 1224 // includes scottish gaelic two word and hyphenated months 1225 matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, 1226 regexes; 1227 regexes = {}; 1228 1229 function addRegexToken(token, regex, strictRegex) { 1230 regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { 1231 return isStrict && strictRegex ? strictRegex : regex; 1232 }; 1233 } 1234 1235 function getParseRegexForToken(token, config) { 1236 if (!hasOwnProp(regexes, token)) { 1237 return new RegExp(unescapeFormat(token)); 1238 } 1239 1240 return regexes[token](config._strict, config._locale); 1241 } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript 1242 1243 1244 function unescapeFormat(s) { 1245 return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { 1246 return p1 || p2 || p3 || p4; 1247 })); 1248 } 1249 1250 function regexEscape(s) { 1251 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 1252 } 1253 1254 var tokens = {}; 1255 1256 function addParseToken(token, callback) { 1257 var i, 1258 func = callback, 1259 tokenLen; 1260 1261 if (typeof token === 'string') { 1262 token = [token]; 1263 } 1264 1265 if (isNumber(callback)) { 1266 func = function func(input, array) { 1267 array[callback] = toInt(input); 1268 }; 1269 } 1270 1271 tokenLen = token.length; 1272 1273 for (i = 0; i < tokenLen; i++) { 1274 tokens[token[i]] = func; 1275 } 1276 } 1277 1278 function addWeekParseToken(token, callback) { 1279 addParseToken(token, function (input, array, config, token) { 1280 config._w = config._w || {}; 1281 callback(input, config._w, config, token); 1282 }); 1283 } 1284 1285 function addTimeToArrayFromToken(token, input, config) { 1286 if (input != null && hasOwnProp(tokens, token)) { 1287 tokens[token](input, config._a, config, token); 1288 } 1289 } 1290 1291 var YEAR = 0, 1292 MONTH = 1, 1293 DATE = 2, 1294 HOUR = 3, 1295 MINUTE = 4, 1296 SECOND = 5, 1297 MILLISECOND = 6, 1298 WEEK = 7, 1299 WEEKDAY = 8; 1300 1301 function mod(n, x) { 1302 return (n % x + x) % x; 1303 } 1304 1305 var indexOf; 1306 1307 if (Array.prototype.indexOf) { 1308 indexOf = Array.prototype.indexOf; 1309 } else { 1310 indexOf = function indexOf(o) { 1311 // I know 1312 var i; 1313 1314 for (i = 0; i < this.length; ++i) { 1315 if (this[i] === o) { 1316 return i; 1317 } 1318 } 1319 1320 return -1; 1321 }; 1322 } 1323 1324 function daysInMonth(year, month) { 1325 if (isNaN(year) || isNaN(month)) { 1326 return NaN; 1327 } 1328 1329 var modMonth = mod(month, 12); 1330 year += (month - modMonth) / 12; 1331 return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2; 1332 } // FORMATTING 1333 1334 1335 addFormatToken('M', ['MM', 2], 'Mo', function () { 1336 return this.month() + 1; 1337 }); 1338 addFormatToken('MMM', 0, 0, function (format) { 1339 return this.localeData().monthsShort(this, format); 1340 }); 1341 addFormatToken('MMMM', 0, 0, function (format) { 1342 return this.localeData().months(this, format); 1343 }); // ALIASES 1344 1345 addUnitAlias('month', 'M'); // PRIORITY 1346 1347 addUnitPriority('month', 8); // PARSING 1348 1349 addRegexToken('M', match1to2); 1350 addRegexToken('MM', match1to2, match2); 1351 addRegexToken('MMM', function (isStrict, locale) { 1352 return locale.monthsShortRegex(isStrict); 1353 }); 1354 addRegexToken('MMMM', function (isStrict, locale) { 1355 return locale.monthsRegex(isStrict); 1356 }); 1357 addParseToken(['M', 'MM'], function (input, array) { 1358 array[MONTH] = toInt(input) - 1; 1359 }); 1360 addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { 1361 var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. 1362 1363 1364 if (month != null) { 1365 array[MONTH] = month; 1366 } else { 1367 getParsingFlags(config).invalidMonth = input; 1368 } 1369 }); // LOCALES 1370 1371 var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), 1372 defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), 1373 MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, 1374 defaultMonthsShortRegex = matchWord, 1375 defaultMonthsRegex = matchWord; 1376 1377 function localeMonths(m, format) { 1378 if (!m) { 1379 return isArray(this._months) ? this._months : this._months['standalone']; 1380 } 1381 1382 return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; 1383 } 1384 1385 function localeMonthsShort(m, format) { 1386 if (!m) { 1387 return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; 1388 } 1389 1390 return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; 1391 } 1392 1393 function handleStrictParse(monthName, format, strict) { 1394 var i, 1395 ii, 1396 mom, 1397 llc = monthName.toLocaleLowerCase(); 1398 1399 if (!this._monthsParse) { 1400 // this is not used 1401 this._monthsParse = []; 1402 this._longMonthsParse = []; 1403 this._shortMonthsParse = []; 1404 1405 for (i = 0; i < 12; ++i) { 1406 mom = createUTC([2000, i]); 1407 this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); 1408 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); 1409 } 1410 } 1411 1412 if (strict) { 1413 if (format === 'MMM') { 1414 ii = indexOf.call(this._shortMonthsParse, llc); 1415 return ii !== -1 ? ii : null; 1416 } else { 1417 ii = indexOf.call(this._longMonthsParse, llc); 1418 return ii !== -1 ? ii : null; 1419 } 1420 } else { 1421 if (format === 'MMM') { 1422 ii = indexOf.call(this._shortMonthsParse, llc); 1423 1424 if (ii !== -1) { 1425 return ii; 1426 } 1427 1428 ii = indexOf.call(this._longMonthsParse, llc); 1429 return ii !== -1 ? ii : null; 1430 } else { 1431 ii = indexOf.call(this._longMonthsParse, llc); 1432 1433 if (ii !== -1) { 1434 return ii; 1435 } 1436 1437 ii = indexOf.call(this._shortMonthsParse, llc); 1438 return ii !== -1 ? ii : null; 1439 } 1440 } 1441 } 1442 1443 function localeMonthsParse(monthName, format, strict) { 1444 var i, mom, regex; 1445 1446 if (this._monthsParseExact) { 1447 return handleStrictParse.call(this, monthName, format, strict); 1448 } 1449 1450 if (!this._monthsParse) { 1451 this._monthsParse = []; 1452 this._longMonthsParse = []; 1453 this._shortMonthsParse = []; 1454 } // TODO: add sorting 1455 // Sorting makes sure if one month (or abbr) is a prefix of another 1456 // see sorting in computeMonthsParse 1457 1458 1459 for (i = 0; i < 12; i++) { 1460 // make the regex if we don't have it already 1461 mom = createUTC([2000, i]); 1462 1463 if (strict && !this._longMonthsParse[i]) { 1464 this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); 1465 this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); 1466 } 1467 1468 if (!strict && !this._monthsParse[i]) { 1469 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); 1470 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); 1471 } // test the regex 1472 1473 1474 if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { 1475 return i; 1476 } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { 1477 return i; 1478 } else if (!strict && this._monthsParse[i].test(monthName)) { 1479 return i; 1480 } 1481 } 1482 } // MOMENTS 1483 1484 1485 function setMonth(mom, value) { 1486 var dayOfMonth; 1487 1488 if (!mom.isValid()) { 1489 // No op 1490 return mom; 1491 } 1492 1493 if (typeof value === 'string') { 1494 if (/^\d+$/.test(value)) { 1495 value = toInt(value); 1496 } else { 1497 value = mom.localeData().monthsParse(value); // TODO: Another silent failure? 1498 1499 if (!isNumber(value)) { 1500 return mom; 1501 } 1502 } 1503 } 1504 1505 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); 1506 1507 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); 1508 1509 return mom; 1510 } 1511 1512 function getSetMonth(value) { 1513 if (value != null) { 1514 setMonth(this, value); 1515 hooks.updateOffset(this, true); 1516 return this; 1517 } else { 1518 return get(this, 'Month'); 1519 } 1520 } 1521 1522 function getDaysInMonth() { 1523 return daysInMonth(this.year(), this.month()); 1524 } 1525 1526 function monthsShortRegex(isStrict) { 1527 if (this._monthsParseExact) { 1528 if (!hasOwnProp(this, '_monthsRegex')) { 1529 computeMonthsParse.call(this); 1530 } 1531 1532 if (isStrict) { 1533 return this._monthsShortStrictRegex; 1534 } else { 1535 return this._monthsShortRegex; 1536 } 1537 } else { 1538 if (!hasOwnProp(this, '_monthsShortRegex')) { 1539 this._monthsShortRegex = defaultMonthsShortRegex; 1540 } 1541 1542 return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; 1543 } 1544 } 1545 1546 function monthsRegex(isStrict) { 1547 if (this._monthsParseExact) { 1548 if (!hasOwnProp(this, '_monthsRegex')) { 1549 computeMonthsParse.call(this); 1550 } 1551 1552 if (isStrict) { 1553 return this._monthsStrictRegex; 1554 } else { 1555 return this._monthsRegex; 1556 } 1557 } else { 1558 if (!hasOwnProp(this, '_monthsRegex')) { 1559 this._monthsRegex = defaultMonthsRegex; 1560 } 1561 1562 return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; 1563 } 1564 } 1565 1566 function computeMonthsParse() { 1567 function cmpLenRev(a, b) { 1568 return b.length - a.length; 1569 } 1570 1571 var shortPieces = [], 1572 longPieces = [], 1573 mixedPieces = [], 1574 i, 1575 mom; 1576 1577 for (i = 0; i < 12; i++) { 1578 // make the regex if we don't have it already 1579 mom = createUTC([2000, i]); 1580 shortPieces.push(this.monthsShort(mom, '')); 1581 longPieces.push(this.months(mom, '')); 1582 mixedPieces.push(this.months(mom, '')); 1583 mixedPieces.push(this.monthsShort(mom, '')); 1584 } // Sorting makes sure if one month (or abbr) is a prefix of another it 1585 // will match the longer piece. 1586 1587 1588 shortPieces.sort(cmpLenRev); 1589 longPieces.sort(cmpLenRev); 1590 mixedPieces.sort(cmpLenRev); 1591 1592 for (i = 0; i < 12; i++) { 1593 shortPieces[i] = regexEscape(shortPieces[i]); 1594 longPieces[i] = regexEscape(longPieces[i]); 1595 } 1596 1597 for (i = 0; i < 24; i++) { 1598 mixedPieces[i] = regexEscape(mixedPieces[i]); 1599 } 1600 1601 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 1602 this._monthsShortRegex = this._monthsRegex; 1603 this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); 1604 this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); 1605 } // FORMATTING 1606 1607 1608 addFormatToken('Y', 0, 0, function () { 1609 var y = this.year(); 1610 return y <= 9999 ? zeroFill(y, 4) : '+' + y; 1611 }); 1612 addFormatToken(0, ['YY', 2], 0, function () { 1613 return this.year() % 100; 1614 }); 1615 addFormatToken(0, ['YYYY', 4], 0, 'year'); 1616 addFormatToken(0, ['YYYYY', 5], 0, 'year'); 1617 addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES 1618 1619 addUnitAlias('year', 'y'); // PRIORITIES 1620 1621 addUnitPriority('year', 1); // PARSING 1622 1623 addRegexToken('Y', matchSigned); 1624 addRegexToken('YY', match1to2, match2); 1625 addRegexToken('YYYY', match1to4, match4); 1626 addRegexToken('YYYYY', match1to6, match6); 1627 addRegexToken('YYYYYY', match1to6, match6); 1628 addParseToken(['YYYYY', 'YYYYYY'], YEAR); 1629 addParseToken('YYYY', function (input, array) { 1630 array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); 1631 }); 1632 addParseToken('YY', function (input, array) { 1633 array[YEAR] = hooks.parseTwoDigitYear(input); 1634 }); 1635 addParseToken('Y', function (input, array) { 1636 array[YEAR] = parseInt(input, 10); 1637 }); // HELPERS 1638 1639 function daysInYear(year) { 1640 return isLeapYear(year) ? 366 : 365; 1641 } // HOOKS 1642 1643 1644 hooks.parseTwoDigitYear = function (input) { 1645 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); 1646 }; // MOMENTS 1647 1648 1649 var getSetYear = makeGetSet('FullYear', true); 1650 1651 function getIsLeapYear() { 1652 return isLeapYear(this.year()); 1653 } 1654 1655 function createDate(y, m, d, h, M, s, ms) { 1656 // can't just apply() to create a date: 1657 // https://stackoverflow.com/q/181348 1658 var date; // the date constructor remaps years 0-99 to 1900-1999 1659 1660 if (y < 100 && y >= 0) { 1661 // preserve leap years using a full 400 year cycle, then reset 1662 date = new Date(y + 400, m, d, h, M, s, ms); 1663 1664 if (isFinite(date.getFullYear())) { 1665 date.setFullYear(y); 1666 } 1667 } else { 1668 date = new Date(y, m, d, h, M, s, ms); 1669 } 1670 1671 return date; 1672 } 1673 1674 function createUTCDate(y) { 1675 var date, args; // the Date.UTC function remaps years 0-99 to 1900-1999 1676 1677 if (y < 100 && y >= 0) { 1678 args = Array.prototype.slice.call(arguments); // preserve leap years using a full 400 year cycle, then reset 1679 1680 args[0] = y + 400;
vendor: 4,781 bytes, lines 1681-1840
1681 date = new Date(Date.UTC.apply(null, args)); 1682 1683 if (isFinite(date.getUTCFullYear())) { 1684 date.setUTCFullYear(y); 1685 } 1686 } else { 1687 date = new Date(Date.UTC.apply(null, arguments)); 1688 } 1689 1690 return date; 1691 } // start-of-first-week - start-of-year 1692 1693 1694 function firstWeekOffset(year, dow, doy) { 1695 var // first-week day -- which january is always in the first week (4 for iso, 1 for other) 1696 fwd = 7 + dow - doy, 1697 // first-week day local weekday -- which local weekday is fwd 1698 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; 1699 return -fwdlw + fwd - 1; 1700 } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday 1701 1702 1703 function dayOfYearFromWeeks(year, week, weekday, dow, doy) { 1704 var localWeekday = (7 + weekday - dow) % 7, 1705 weekOffset = firstWeekOffset(year, dow, doy), 1706 dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, 1707 resYear, 1708 resDayOfYear; 1709 1710 if (dayOfYear <= 0) { 1711 resYear = year - 1; 1712 resDayOfYear = daysInYear(resYear) + dayOfYear; 1713 } else if (dayOfYear > daysInYear(year)) { 1714 resYear = year + 1; 1715 resDayOfYear = dayOfYear - daysInYear(year); 1716 } else { 1717 resYear = year; 1718 resDayOfYear = dayOfYear; 1719 } 1720 1721 return { 1722 year: resYear, 1723 dayOfYear: resDayOfYear 1724 }; 1725 } 1726 1727 function weekOfYear(mom, dow, doy) { 1728 var weekOffset = firstWeekOffset(mom.year(), dow, doy), 1729 week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, 1730 resWeek, 1731 resYear; 1732 1733 if (week < 1) { 1734 resYear = mom.year() - 1; 1735 resWeek = week + weeksInYear(resYear, dow, doy); 1736 } else if (week > weeksInYear(mom.year(), dow, doy)) { 1737 resWeek = week - weeksInYear(mom.year(), dow, doy); 1738 resYear = mom.year() + 1; 1739 } else { 1740 resYear = mom.year(); 1741 resWeek = week; 1742 } 1743 1744 return { 1745 week: resWeek, 1746 year: resYear 1747 }; 1748 } 1749 1750 function weeksInYear(year, dow, doy) { 1751 var weekOffset = firstWeekOffset(year, dow, doy), 1752 weekOffsetNext = firstWeekOffset(year + 1, dow, doy); 1753 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; 1754 } // FORMATTING 1755 1756 1757 addFormatToken('w', ['ww', 2], 'wo', 'week'); 1758 addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES 1759 1760 addUnitAlias('week', 'w'); 1761 addUnitAlias('isoWeek', 'W'); // PRIORITIES 1762 1763 addUnitPriority('week', 5); 1764 addUnitPriority('isoWeek', 5); // PARSING 1765 1766 addRegexToken('w', match1to2); 1767 addRegexToken('ww', match1to2, match2); 1768 addRegexToken('W', match1to2); 1769 addRegexToken('WW', match1to2, match2); 1770 addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { 1771 week[token.substr(0, 1)] = toInt(input); 1772 }); // HELPERS 1773 // LOCALES 1774 1775 function localeWeek(mom) { 1776 return weekOfYear(mom, this._week.dow, this._week.doy).week; 1777 } 1778 1779 var defaultLocaleWeek = { 1780 dow: 0, 1781 // Sunday is the first day of the week. 1782 doy: 6 // The week that contains Jan 6th is the first week of the year. 1783 1784 }; 1785 1786 function localeFirstDayOfWeek() { 1787 return this._week.dow; 1788 } 1789 1790 function localeFirstDayOfYear() { 1791 return this._week.doy; 1792 } // MOMENTS 1793 1794 1795 function getSetWeek(input) { 1796 var week = this.localeData().week(this); 1797 return input == null ? week : this.add((input - week) * 7, 'd'); 1798 } 1799 1800 function getSetISOWeek(input) { 1801 var week = weekOfYear(this, 1, 4).week; 1802 return input == null ? week : this.add((input - week) * 7, 'd'); 1803 } // FORMATTING 1804 1805 1806 addFormatToken('d', 0, 'do', 'day'); 1807 addFormatToken('dd', 0, 0, function (format) { 1808 return this.localeData().weekdaysMin(this, format); 1809 }); 1810 addFormatToken('ddd', 0, 0, function (format) { 1811 return this.localeData().weekdaysShort(this, format); 1812 }); 1813 addFormatToken('dddd', 0, 0, function (format) { 1814 return this.localeData().weekdays(this, format); 1815 }); 1816 addFormatToken('e', 0, 0, 'weekday'); 1817 addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES 1818 1819 addUnitAlias('day', 'd'); 1820 addUnitAlias('weekday', 'e'); 1821 addUnitAlias('isoWeekday', 'E'); // PRIORITY 1822 1823 addUnitPriority('day', 11); 1824 addUnitPriority('weekday', 11); 1825 addUnitPriority('isoWeekday', 11); // PARSING 1826 1827 addRegexToken('d', match1to2); 1828 addRegexToken('e', match1to2); 1829 addRegexToken('E', match1to2); 1830 addRegexToken('dd', function (isStrict, locale) { 1831 return locale.weekdaysMinRegex(isStrict); 1832 }); 1833 addRegexToken('ddd', function (isStrict, locale) { 1834 return locale.weekdaysShortRegex(isStrict); 1835 }); 1836 addRegexToken('dddd', function (isStrict, locale) { 1837 return locale.weekdaysRegex(isStrict); 1838 }); 1839 addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { 1840 var weekday = config._locale.weekdaysParse(input, token, config._strict);
vendor: 13,077 bytes, lines 1840-2265
1840 // if we didn't get a weekday name, mark the date as invalid 1841 1842 1843 if (weekday != null) { 1844 week.d = weekday; 1845 } else { 1846 getParsingFlags(config).invalidWeekday = input; 1847 } 1848 }); 1849 addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { 1850 week[token] = toInt(input); 1851 }); // HELPERS 1852 1853 function parseWeekday(input, locale) { 1854 if (typeof input !== 'string') { 1855 return input; 1856 } 1857 1858 if (!isNaN(input)) { 1859 return parseInt(input, 10); 1860 } 1861 1862 input = locale.weekdaysParse(input); 1863 1864 if (typeof input === 'number') { 1865 return input; 1866 } 1867 1868 return null; 1869 } 1870 1871 function parseIsoWeekday(input, locale) { 1872 if (typeof input === 'string') { 1873 return locale.weekdaysParse(input) % 7 || 7; 1874 } 1875 1876 return isNaN(input) ? null : input; 1877 } // LOCALES 1878 1879 1880 function shiftWeekdays(ws, n) { 1881 return ws.slice(n, 7).concat(ws.slice(0, n)); 1882 } 1883 1884 var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), 1885 defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), 1886 defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), 1887 defaultWeekdaysRegex = matchWord, 1888 defaultWeekdaysShortRegex = matchWord, 1889 defaultWeekdaysMinRegex = matchWord; 1890 1891 function localeWeekdays(m, format) { 1892 var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone']; 1893 return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays; 1894 } 1895 1896 function localeWeekdaysShort(m) { 1897 return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort; 1898 } 1899 1900 function localeWeekdaysMin(m) { 1901 return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin; 1902 } 1903 1904 function handleStrictParse$1(weekdayName, format, strict) { 1905 var i, 1906 ii, 1907 mom, 1908 llc = weekdayName.toLocaleLowerCase(); 1909 1910 if (!this._weekdaysParse) { 1911 this._weekdaysParse = []; 1912 this._shortWeekdaysParse = []; 1913 this._minWeekdaysParse = []; 1914 1915 for (i = 0; i < 7; ++i) { 1916 mom = createUTC([2000, 1]).day(i); 1917 this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); 1918 this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); 1919 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); 1920 } 1921 } 1922 1923 if (strict) { 1924 if (format === 'dddd') { 1925 ii = indexOf.call(this._weekdaysParse, llc); 1926 return ii !== -1 ? ii : null; 1927 } else if (format === 'ddd') { 1928 ii = indexOf.call(this._shortWeekdaysParse, llc); 1929 return ii !== -1 ? ii : null; 1930 } else { 1931 ii = indexOf.call(this._minWeekdaysParse, llc); 1932 return ii !== -1 ? ii : null; 1933 } 1934 } else { 1935 if (format === 'dddd') { 1936 ii = indexOf.call(this._weekdaysParse, llc); 1937 1938 if (ii !== -1) { 1939 return ii; 1940 } 1941 1942 ii = indexOf.call(this._shortWeekdaysParse, llc); 1943 1944 if (ii !== -1) { 1945 return ii; 1946 } 1947 1948 ii = indexOf.call(this._minWeekdaysParse, llc); 1949 return ii !== -1 ? ii : null; 1950 } else if (format === 'ddd') { 1951 ii = indexOf.call(this._shortWeekdaysParse, llc); 1952 1953 if (ii !== -1) { 1954 return ii; 1955 } 1956 1957 ii = indexOf.call(this._weekdaysParse, llc); 1958 1959 if (ii !== -1) { 1960 return ii; 1961 } 1962 1963 ii = indexOf.call(this._minWeekdaysParse, llc); 1964 return ii !== -1 ? ii : null; 1965 } else { 1966 ii = indexOf.call(this._minWeekdaysParse, llc); 1967 1968 if (ii !== -1) { 1969 return ii; 1970 } 1971 1972 ii = indexOf.call(this._weekdaysParse, llc); 1973 1974 if (ii !== -1) { 1975 return ii; 1976 } 1977 1978 ii = indexOf.call(this._shortWeekdaysParse, llc); 1979 return ii !== -1 ? ii : null; 1980 } 1981 } 1982 } 1983 1984 function localeWeekdaysParse(weekdayName, format, strict) { 1985 var i, mom, regex; 1986 1987 if (this._weekdaysParseExact) { 1988 return handleStrictParse$1.call(this, weekdayName, format, strict); 1989 } 1990 1991 if (!this._weekdaysParse) { 1992 this._weekdaysParse = []; 1993 this._minWeekdaysParse = []; 1994 this._shortWeekdaysParse = []; 1995 this._fullWeekdaysParse = []; 1996 } 1997 1998 for (i = 0; i < 7; i++) { 1999 // make the regex if we don't have it already 2000 mom = createUTC([2000, 1]).day(i); 2001 2002 if (strict && !this._fullWeekdaysParse[i]) { 2003 this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); 2004 this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); 2005 this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); 2006 } 2007 2008 if (!this._weekdaysParse[i]) { 2009 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); 2010 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); 2011 } // test the regex 2012 2013 2014 if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { 2015 return i; 2016 } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { 2017 return i; 2018 } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { 2019 return i; 2020 } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { 2021 return i; 2022 } 2023 } 2024 } // MOMENTS 2025 2026 2027 function getSetDayOfWeek(input) { 2028 if (!this.isValid()) { 2029 return input != null ? this : NaN; 2030 } 2031 2032 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); 2033 2034 if (input != null) { 2035 input = parseWeekday(input, this.localeData()); 2036 return this.add(input - day, 'd'); 2037 } else { 2038 return day; 2039 } 2040 } 2041 2042 function getSetLocaleDayOfWeek(input) { 2043 if (!this.isValid()) { 2044 return input != null ? this : NaN; 2045 } 2046 2047 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; 2048 return input == null ? weekday : this.add(input - weekday, 'd'); 2049 } 2050 2051 function getSetISODayOfWeek(input) { 2052 if (!this.isValid()) { 2053 return input != null ? this : NaN; 2054 } // behaves the same as moment#day except 2055 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) 2056 // as a setter, sunday should belong to the previous week. 2057 2058 2059 if (input != null) { 2060 var weekday = parseIsoWeekday(input, this.localeData()); 2061 return this.day(this.day() % 7 ? weekday : weekday - 7); 2062 } else { 2063 return this.day() || 7; 2064 } 2065 } 2066 2067 function weekdaysRegex(isStrict) { 2068 if (this._weekdaysParseExact) { 2069 if (!hasOwnProp(this, '_weekdaysRegex')) { 2070 computeWeekdaysParse.call(this); 2071 } 2072 2073 if (isStrict) { 2074 return this._weekdaysStrictRegex; 2075 } else { 2076 return this._weekdaysRegex; 2077 } 2078 } else { 2079 if (!hasOwnProp(this, '_weekdaysRegex')) { 2080 this._weekdaysRegex = defaultWeekdaysRegex; 2081 } 2082 2083 return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; 2084 } 2085 } 2086 2087 function weekdaysShortRegex(isStrict) { 2088 if (this._weekdaysParseExact) { 2089 if (!hasOwnProp(this, '_weekdaysRegex')) { 2090 computeWeekdaysParse.call(this); 2091 } 2092 2093 if (isStrict) { 2094 return this._weekdaysShortStrictRegex; 2095 } else { 2096 return this._weekdaysShortRegex; 2097 } 2098 } else { 2099 if (!hasOwnProp(this, '_weekdaysShortRegex')) { 2100 this._weekdaysShortRegex = defaultWeekdaysShortRegex; 2101 } 2102 2103 return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; 2104 } 2105 } 2106 2107 function weekdaysMinRegex(isStrict) { 2108 if (this._weekdaysParseExact) { 2109 if (!hasOwnProp(this, '_weekdaysRegex')) { 2110 computeWeekdaysParse.call(this); 2111 } 2112 2113 if (isStrict) { 2114 return this._weekdaysMinStrictRegex; 2115 } else { 2116 return this._weekdaysMinRegex; 2117 } 2118 } else { 2119 if (!hasOwnProp(this, '_weekdaysMinRegex')) { 2120 this._weekdaysMinRegex = defaultWeekdaysMinRegex; 2121 } 2122 2123 return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; 2124 } 2125 } 2126 2127 function computeWeekdaysParse() { 2128 function cmpLenRev(a, b) { 2129 return b.length - a.length; 2130 } 2131 2132 var minPieces = [], 2133 shortPieces = [], 2134 longPieces = [], 2135 mixedPieces = [], 2136 i, 2137 mom, 2138 minp, 2139 shortp, 2140 longp; 2141 2142 for (i = 0; i < 7; i++) { 2143 // make the regex if we don't have it already 2144 mom = createUTC([2000, 1]).day(i); 2145 minp = regexEscape(this.weekdaysMin(mom, '')); 2146 shortp = regexEscape(this.weekdaysShort(mom, '')); 2147 longp = regexEscape(this.weekdays(mom, '')); 2148 minPieces.push(minp); 2149 shortPieces.push(shortp); 2150 longPieces.push(longp); 2151 mixedPieces.push(minp); 2152 mixedPieces.push(shortp); 2153 mixedPieces.push(longp); 2154 } // Sorting makes sure if one weekday (or abbr) is a prefix of another it 2155 // will match the longer piece. 2156 2157 2158 minPieces.sort(cmpLenRev); 2159 shortPieces.sort(cmpLenRev); 2160 longPieces.sort(cmpLenRev); 2161 mixedPieces.sort(cmpLenRev); 2162 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 2163 this._weekdaysShortRegex = this._weekdaysRegex; 2164 this._weekdaysMinRegex = this._weekdaysRegex; 2165 this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); 2166 this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); 2167 this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); 2168 } // FORMATTING 2169 2170 2171 function hFormat() { 2172 return this.hours() % 12 || 12; 2173 } 2174 2175 function kFormat() { 2176 return this.hours() || 24; 2177 } 2178 2179 addFormatToken('H', ['HH', 2], 0, 'hour'); 2180 addFormatToken('h', ['hh', 2], 0, hFormat); 2181 addFormatToken('k', ['kk', 2], 0, kFormat); 2182 addFormatToken('hmm', 0, 0, function () { 2183 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); 2184 }); 2185 addFormatToken('hmmss', 0, 0, function () { 2186 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); 2187 }); 2188 addFormatToken('Hmm', 0, 0, function () { 2189 return '' + this.hours() + zeroFill(this.minutes(), 2); 2190 }); 2191 addFormatToken('Hmmss', 0, 0, function () { 2192 return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); 2193 }); 2194 2195 function meridiem(token, lowercase) { 2196 addFormatToken(token, 0, 0, function () { 2197 return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); 2198 }); 2199 } 2200 2201 meridiem('a', true); 2202 meridiem('A', false); // ALIASES 2203 2204 addUnitAlias('hour', 'h'); // PRIORITY 2205 2206 addUnitPriority('hour', 13); // PARSING 2207 2208 function matchMeridiem(isStrict, locale) { 2209 return locale._meridiemParse; 2210 } 2211 2212 addRegexToken('a', matchMeridiem); 2213 addRegexToken('A', matchMeridiem); 2214 addRegexToken('H', match1to2); 2215 addRegexToken('h', match1to2); 2216 addRegexToken('k', match1to2); 2217 addRegexToken('HH', match1to2, match2); 2218 addRegexToken('hh', match1to2, match2); 2219 addRegexToken('kk', match1to2, match2); 2220 addRegexToken('hmm', match3to4); 2221 addRegexToken('hmmss', match5to6); 2222 addRegexToken('Hmm', match3to4); 2223 addRegexToken('Hmmss', match5to6); 2224 addParseToken(['H', 'HH'], HOUR); 2225 addParseToken(['k', 'kk'], function (input, array, config) { 2226 var kInput = toInt(input); 2227 array[HOUR] = kInput === 24 ? 0 : kInput; 2228 }); 2229 addParseToken(['a', 'A'], function (input, array, config) { 2230 config._isPm = config._locale.isPM(input); 2231 config._meridiem = input; 2232 }); 2233 addParseToken(['h', 'hh'], function (input, array, config) { 2234 array[HOUR] = toInt(input); 2235 getParsingFlags(config).bigHour = true; 2236 }); 2237 addParseToken('hmm', function (input, array, config) { 2238 var pos = input.length - 2; 2239 array[HOUR] = toInt(input.substr(0, pos)); 2240 array[MINUTE] = toInt(input.substr(pos)); 2241 getParsingFlags(config).bigHour = true; 2242 }); 2243 addParseToken('hmmss', function (input, array, config) { 2244 var pos1 = input.length - 4, 2245 pos2 = input.length - 2; 2246 array[HOUR] = toInt(input.substr(0, pos1)); 2247 array[MINUTE] = toInt(input.substr(pos1, 2)); 2248 array[SECOND] = toInt(input.substr(pos2)); 2249 getParsingFlags(config).bigHour = true; 2250 }); 2251 addParseToken('Hmm', function (input, array, config) { 2252 var pos = input.length - 2; 2253 array[HOUR] = toInt(input.substr(0, pos)); 2254 array[MINUTE] = toInt(input.substr(pos)); 2255 }); 2256 addParseToken('Hmmss', function (input, array, config) { 2257 var pos1 = input.length - 4, 2258 pos2 = input.length - 2; 2259 array[HOUR] = toInt(input.substr(0, pos1)); 2260 array[MINUTE] = toInt(input.substr(pos1, 2)); 2261 array[SECOND] = toInt(input.substr(pos2)); 2262 }); // LOCALES 2263 2264 function localeIsPM(input) { 2265 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing str
vendor: 20,074 bytes, lines 2265-2904
2265ings like arrays 2266 // Using charAt should be more compatible. 2267 return (input + '').toLowerCase().charAt(0) === 'p'; 2268 } 2269 2270 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, 2271 // Setting the hour should keep the time, because the user explicitly 2272 // specified which hour they want. So trying to maintain the same hour (in 2273 // a new timezone) makes sense. Adding/subtracting hours does not follow 2274 // this rule. 2275 getSetHour = makeGetSet('Hours', true); 2276 2277 function localeMeridiem(hours, minutes, isLower) { 2278 if (hours > 11) { 2279 return isLower ? 'pm' : 'PM'; 2280 } else { 2281 return isLower ? 'am' : 'AM'; 2282 } 2283 } 2284 2285 var baseConfig = { 2286 calendar: defaultCalendar, 2287 longDateFormat: defaultLongDateFormat, 2288 invalidDate: defaultInvalidDate, 2289 ordinal: defaultOrdinal, 2290 dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, 2291 relativeTime: defaultRelativeTime, 2292 months: defaultLocaleMonths, 2293 monthsShort: defaultLocaleMonthsShort, 2294 week: defaultLocaleWeek, 2295 weekdays: defaultLocaleWeekdays, 2296 weekdaysMin: defaultLocaleWeekdaysMin, 2297 weekdaysShort: defaultLocaleWeekdaysShort, 2298 meridiemParse: defaultLocaleMeridiemParse 2299 }; // internal storage for locale config files 2300 2301 var locales = {}, 2302 localeFamilies = {}, 2303 globalLocale; 2304 2305 function commonPrefix(arr1, arr2) { 2306 var i, 2307 minl = Math.min(arr1.length, arr2.length); 2308 2309 for (i = 0; i < minl; i += 1) { 2310 if (arr1[i] !== arr2[i]) { 2311 return i; 2312 } 2313 } 2314 2315 return minl; 2316 } 2317 2318 function normalizeLocale(key) { 2319 return key ? key.toLowerCase().replace('_', '-') : key; 2320 } // pick the locale from the array 2321 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each 2322 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root 2323 2324 2325 function chooseLocale(names) { 2326 var i = 0, 2327 j, 2328 next, 2329 locale, 2330 split; 2331 2332 while (i < names.length) { 2333 split = normalizeLocale(names[i]).split('-'); 2334 j = split.length; 2335 next = normalizeLocale(names[i + 1]); 2336 next = next ? next.split('-') : null; 2337 2338 while (j > 0) { 2339 locale = loadLocale(split.slice(0, j).join('-')); 2340 2341 if (locale) { 2342 return locale; 2343 } 2344 2345 if (next && next.length >= j && commonPrefix(split, next) >= j - 1) { 2346 //the next array item is better than a shallower substring of this one 2347 break; 2348 } 2349 2350 j--; 2351 } 2352 2353 i++; 2354 } 2355 2356 return globalLocale; 2357 } 2358 2359 function isLocaleNameSane(name) { 2360 // Prevent names that look like filesystem paths, i.e contain '/' or '\' 2361 return name.match('^[^/\\\\]*$') != null; 2362 } 2363 2364 function loadLocale(name) { 2365 var oldLocale = null, 2366 aliasedRequire; // TODO: Find a better way to register and load all the locales in Node 2367 2368 if (locales[name] === undefined && typeof module !== 'undefined' && module && module.exports && isLocaleNameSane(name)) { 2369 try { 2370 oldLocale = globalLocale._abbr; 2371 aliasedRequire = require; 2372 !(function webpackMissingModule() { var e = new Error("Cannot find module 'undefined'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()); 2373 getSetGlobalLocale(oldLocale); 2374 } catch (e) { 2375 // mark as not found to avoid repeating expensive file require call causing high CPU 2376 // when trying to find en-US, en_US, en-us for every format call 2377 locales[name] = null; // null means not found 2378 } 2379 } 2380 2381 return locales[name]; 2382 } // This function will load locale and then set the global locale. If 2383 // no arguments are passed in, it will simply return the current global 2384 // locale key. 2385 2386 2387 function getSetGlobalLocale(key, values) { 2388 var data; 2389 2390 if (key) { 2391 if (isUndefined(values)) { 2392 data = getLocale(key); 2393 } else { 2394 data = defineLocale(key, values); 2395 } 2396 2397 if (data) { 2398 // moment.duration._locale = moment._locale = data; 2399 globalLocale = data; 2400 } else { 2401 if (typeof console !== 'undefined' && console.warn) { 2402 //warn user if arguments are passed but the locale could not be set 2403 console.warn('Locale ' + key + ' not found. Did you forget to load it?'); 2404 } 2405 } 2406 } 2407 2408 return globalLocale._abbr; 2409 } 2410 2411 function defineLocale(name, config) { 2412 if (config !== null) { 2413 var locale, 2414 parentConfig = baseConfig; 2415 config.abbr = name; 2416 2417 if (locales[name] != null) { 2418 deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); 2419 parentConfig = locales[name]._config; 2420 } else if (config.parentLocale != null) { 2421 if (locales[config.parentLocale] != null) { 2422 parentConfig = locales[config.parentLocale]._config; 2423 } else { 2424 locale = loadLocale(config.parentLocale); 2425 2426 if (locale != null) { 2427 parentConfig = locale._config; 2428 } else { 2429 if (!localeFamilies[config.parentLocale]) { 2430 localeFamilies[config.parentLocale] = []; 2431 } 2432 2433 localeFamilies[config.parentLocale].push({ 2434 name: name, 2435 config: config 2436 }); 2437 return null; 2438 } 2439 } 2440 } 2441 2442 locales[name] = new Locale(mergeConfigs(parentConfig, config)); 2443 2444 if (localeFamilies[name]) { 2445 localeFamilies[name].forEach(function (x) { 2446 defineLocale(x.name, x.config); 2447 }); 2448 } // backwards compat for now: also set the locale 2449 // make sure we set the locale AFTER all child locales have been 2450 // created, so we won't end up with the child locale set. 2451 2452 2453 getSetGlobalLocale(name); 2454 return locales[name]; 2455 } else { 2456 // useful for testing 2457 delete locales[name]; 2458 return null; 2459 } 2460 } 2461 2462 function updateLocale(name, config) { 2463 if (config != null) { 2464 var locale, 2465 tmpLocale, 2466 parentConfig = baseConfig; 2467 2468 if (locales[name] != null && locales[name].parentLocale != null) { 2469 // Update existing child locale in-place to avoid memory-leaks 2470 locales[name].set(mergeConfigs(locales[name]._config, config)); 2471 } else { 2472 // MERGE 2473 tmpLocale = loadLocale(name); 2474 2475 if (tmpLocale != null) { 2476 parentConfig = tmpLocale._config; 2477 } 2478 2479 config = mergeConfigs(parentConfig, config); 2480 2481 if (tmpLocale == null) { 2482 // updateLocale is called for creating a new locale 2483 // Set abbr so it will have a name (getters return 2484 // undefined otherwise). 2485 config.abbr = name; 2486 } 2487 2488 locale = new Locale(config); 2489 locale.parentLocale = locales[name]; 2490 locales[name] = locale; 2491 } // backwards compat for now: also set the locale 2492 2493 2494 getSetGlobalLocale(name); 2495 } else { 2496 // pass null for config to unupdate, useful for tests 2497 if (locales[name] != null) { 2498 if (locales[name].parentLocale != null) { 2499 locales[name] = locales[name].parentLocale; 2500 2501 if (name === getSetGlobalLocale()) { 2502 getSetGlobalLocale(name); 2503 } 2504 } else if (locales[name] != null) { 2505 delete locales[name]; 2506 } 2507 } 2508 } 2509 2510 return locales[name]; 2511 } // returns locale data 2512 2513 2514 function getLocale(key) { 2515 var locale; 2516 2517 if (key && key._locale && key._locale._abbr) { 2518 key = key._locale._abbr; 2519 } 2520 2521 if (!key) { 2522 return globalLocale; 2523 } 2524 2525 if (!isArray(key)) { 2526 //short-circuit everything else 2527 locale = loadLocale(key); 2528 2529 if (locale) { 2530 return locale; 2531 } 2532 2533 key = [key]; 2534 } 2535 2536 return chooseLocale(key); 2537 } 2538 2539 function listLocales() { 2540 return keys(locales); 2541 } 2542 2543 function checkOverflow(m) { 2544 var overflow, 2545 a = m._a; 2546 2547 if (a && getParsingFlags(m).overflow === -2) { 2548 overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; 2549 2550 if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { 2551 overflow = DATE; 2552 } 2553 2554 if (getParsingFlags(m)._overflowWeeks && overflow === -1) { 2555 overflow = WEEK; 2556 } 2557 2558 if (getParsingFlags(m)._overflowWeekday && overflow === -1) { 2559 overflow = WEEKDAY; 2560 } 2561 2562 getParsingFlags(m).overflow = overflow; 2563 } 2564 2565 return m; 2566 } // iso 8601 regex 2567 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) 2568 2569 2570 var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, 2571 basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, 2572 tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, 2573 isoDates = [['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/], ['YYYYMM', /\d{6}/, false], ['YYYY', /\d{4}/, false]], 2574 // iso time formats and regexes 2575 isoTimes = [['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/]], 2576 aspNetJsonRegex = /^\/?Date\((-?\d+)/i, 2577 // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 2578 rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, 2579 obsOffsets = { 2580 UT: 0, 2581 GMT: 0, 2582 EDT: -4 * 60, 2583 EST: -5 * 60, 2584 CDT: -5 * 60, 2585 CST: -6 * 60, 2586 MDT: -6 * 60, 2587 MST: -7 * 60, 2588 PDT: -7 * 60, 2589 PST: -8 * 60 2590 }; // date from iso format 2591 2592 function configFromISO(config) { 2593 var i, 2594 l, 2595 string = config._i, 2596 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), 2597 allowTime, 2598 dateFormat, 2599 timeFormat, 2600 tzFormat, 2601 isoDatesLen = isoDates.length, 2602 isoTimesLen = isoTimes.length; 2603 2604 if (match) { 2605 getParsingFlags(config).iso = true; 2606 2607 for (i = 0, l = isoDatesLen; i < l; i++) { 2608 if (isoDates[i][1].exec(match[1])) { 2609 dateFormat = isoDates[i][0]; 2610 allowTime = isoDates[i][2] !== false; 2611 break; 2612 } 2613 } 2614 2615 if (dateFormat == null) { 2616 config._isValid = false; 2617 return; 2618 } 2619 2620 if (match[3]) { 2621 for (i = 0, l = isoTimesLen; i < l; i++) { 2622 if (isoTimes[i][1].exec(match[3])) { 2623 // match[2] should be 'T' or space 2624 timeFormat = (match[2] || ' ') + isoTimes[i][0]; 2625 break; 2626 } 2627 } 2628 2629 if (timeFormat == null) { 2630 config._isValid = false; 2631 return; 2632 } 2633 } 2634 2635 if (!allowTime && timeFormat != null) { 2636 config._isValid = false; 2637 return; 2638 } 2639 2640 if (match[4]) { 2641 if (tzRegex.exec(match[4])) { 2642 tzFormat = 'Z'; 2643 } else { 2644 config._isValid = false; 2645 return; 2646 } 2647 } 2648 2649 config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); 2650 configFromStringAndFormat(config); 2651 } else { 2652 config._isValid = false; 2653 } 2654 } 2655 2656 function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { 2657 var result = [untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10)]; 2658 2659 if (secondStr) { 2660 result.push(parseInt(secondStr, 10)); 2661 } 2662 2663 return result; 2664 } 2665 2666 function untruncateYear(yearStr) { 2667 var year = parseInt(yearStr, 10); 2668 2669 if (year <= 49) { 2670 return 2000 + year; 2671 } else if (year <= 999) { 2672 return 1900 + year; 2673 } 2674 2675 return year; 2676 } 2677 2678 function preprocessRFC2822(s) { 2679 // Remove comments and folding whitespace and replace multiple-spaces with a single space 2680 return s.replace(/\([^()]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 2681 } 2682 2683 function checkWeekday(weekdayStr, parsedInput, config) { 2684 if (weekdayStr) { 2685 // TODO: Replace the vanilla JS Date object with an independent day-of-week check. 2686 var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), 2687 weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); 2688 2689 if (weekdayProvided !== weekdayActual) { 2690 getParsingFlags(config).weekdayMismatch = true; 2691 config._isValid = false; 2692 return false; 2693 } 2694 } 2695 2696 return true; 2697 } 2698 2699 function calculateOffset(obsOffset, militaryOffset, numOffset) { 2700 if (obsOffset) { 2701 return obsOffsets[obsOffset]; 2702 } else if (militaryOffset) { 2703 // the only allowed military tz is Z 2704 return 0; 2705 } else { 2706 var hm = parseInt(numOffset, 10), 2707 m = hm % 100, 2708 h = (hm - m) / 100; 2709 return h * 60 + m; 2710 } 2711 } // date and time from ref 2822 format 2712 2713 2714 function configFromRFC2822(config) { 2715 var match = rfc2822.exec(preprocessRFC2822(config._i)), 2716 parsedArray; 2717 2718 if (match) { 2719 parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); 2720 2721 if (!checkWeekday(match[1], parsedArray, config)) { 2722 return; 2723 } 2724 2725 config._a = parsedArray; 2726 config._tzm = calculateOffset(match[8], match[9], match[10]); 2727 config._d = createUTCDate.apply(null, config._a); 2728 2729 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 2730 2731 getParsingFlags(config).rfc2822 = true; 2732 } else { 2733 config._isValid = false; 2734 } 2735 } // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict 2736 2737 2738 function configFromString(config) { 2739 var matched = aspNetJsonRegex.exec(config._i); 2740 2741 if (matched !== null) { 2742 config._d = new Date(+matched[1]); 2743 return; 2744 } 2745 2746 configFromISO(config); 2747 2748 if (config._isValid === false) { 2749 delete config._isValid; 2750 } else { 2751 return; 2752 } 2753 2754 configFromRFC2822(config); 2755 2756 if (config._isValid === false) { 2757 delete config._isValid; 2758 } else { 2759 return; 2760 } 2761 2762 if (config._strict) { 2763 config._isValid = false; 2764 } else { 2765 // Final attempt, use Input Fallback 2766 hooks.createFromInputFallback(config); 2767 } 2768 } 2769 2770 hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) { 2771 config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); 2772 }); // Pick the first defined of two or three arguments. 2773 2774 function defaults(a, b, c) { 2775 if (a != null) { 2776 return a; 2777 } 2778 2779 if (b != null) { 2780 return b; 2781 } 2782 2783 return c; 2784 } 2785 2786 function currentDateArray(config) { 2787 // hooks is actually the exported moment object 2788 var nowValue = new Date(hooks.now()); 2789 2790 if (config._useUTC) { 2791 return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; 2792 } 2793 2794 return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; 2795 } // convert an array to a date. 2796 // the array should mirror the parameters below 2797 // note: all values past the year are optional and will default to the lowest possible value. 2798 // [year, month, day , hour, minute, second, millisecond] 2799 2800 2801 function configFromArray(config) { 2802 var i, 2803 date, 2804 input = [], 2805 currentDate, 2806 expectedWeekday, 2807 yearToUse; 2808 2809 if (config._d) { 2810 return; 2811 } 2812 2813 currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays 2814 2815 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { 2816 dayOfYearFromWeekInfo(config); 2817 } //if the day of the year is set, figure out what it is 2818 2819 2820 if (config._dayOfYear != null) { 2821 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); 2822 2823 if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { 2824 getParsingFlags(config)._overflowDayOfYear = true; 2825 } 2826 2827 date = createUTCDate(yearToUse, 0, config._dayOfYear); 2828 config._a[MONTH] = date.getUTCMonth(); 2829 config._a[DATE] = date.getUTCDate(); 2830 } // Default to current date. 2831 // * if no year, month, day of month are given, default to today 2832 // * if day of month is given, default month and year 2833 // * if month is given, default only year 2834 // * if year is given, don't default anything 2835 2836 2837 for (i = 0; i < 3 && config._a[i] == null; ++i) { 2838 config._a[i] = input[i] = currentDate[i]; 2839 } // Zero out whatever was not defaulted, including time 2840 2841 2842 for (; i < 7; i++) { 2843 config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i]; 2844 } // Check for 24:00:00.000 2845 2846 2847 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { 2848 config._nextDay = true; 2849 config._a[HOUR] = 0; 2850 } 2851 2852 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); 2853 expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed 2854 // with parseZone. 2855 2856 if (config._tzm != null) { 2857 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 2858 } 2859 2860 if (config._nextDay) { 2861 config._a[HOUR] = 24; 2862 } // check for mismatching day of week 2863 2864 2865 if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { 2866 getParsingFlags(config).weekdayMismatch = true; 2867 } 2868 } 2869 2870 function dayOfYearFromWeekInfo(config) { 2871 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; 2872 w = config._w; 2873 2874 if (w.GG != null || w.W != null || w.E != null) { 2875 dow = 1; 2876 doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on 2877 // how we interpret now (local, utc, fixed offset). So create 2878 // a now version of current config (take local/utc/offset flags, and 2879 // create now). 2880 2881 weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); 2882 week = defaults(w.W, 1); 2883 weekday = defaults(w.E, 1); 2884 2885 if (weekday < 1 || weekday > 7) { 2886 weekdayOverflow = true; 2887 } 2888 } else { 2889 dow = config._locale._week.dow; 2890 doy = config._locale._week.doy; 2891 curWeek = weekOfYear(createLocal(), dow, doy); 2892 weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week. 2893 2894 week = defaults(w.w, curWeek.week); 2895 2896 if (w.d != null) { 2897 // weekday -- low day numbers are considered next week 2898 weekday = w.d; 2899 2900 if (weekday < 0 || weekday > 6) { 2901 weekdayOverflow = true; 2902 } 2903 } else if (w.e != null) { 2904 // local weekday -- counting starts from beginning of week
vendor: 8,684 bytes, lines 2905-3224
2905 weekday = w.e + dow; 2906 2907 if (w.e < 0 || w.e > 6) { 2908 weekdayOverflow = true; 2909 } 2910 } else { 2911 // default to beginning of week 2912 weekday = dow; 2913 } 2914 } 2915 2916 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { 2917 getParsingFlags(config)._overflowWeeks = true; 2918 } else if (weekdayOverflow != null) { 2919 getParsingFlags(config)._overflowWeekday = true; 2920 } else { 2921 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); 2922 config._a[YEAR] = temp.year; 2923 config._dayOfYear = temp.dayOfYear; 2924 } 2925 } // constant that refers to the ISO standard 2926 2927 2928 hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form 2929 2930 2931 hooks.RFC_2822 = function () {}; // date from string and format string 2932 2933 2934 function configFromStringAndFormat(config) { 2935 // TODO: Move this to another part of the creation flow to prevent circular deps 2936 if (config._f === hooks.ISO_8601) { 2937 configFromISO(config); 2938 return; 2939 } 2940 2941 if (config._f === hooks.RFC_2822) { 2942 configFromRFC2822(config); 2943 return; 2944 } 2945 2946 config._a = []; 2947 getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` 2948 2949 var string = '' + config._i, 2950 i, 2951 parsedInput, 2952 tokens, 2953 token, 2954 skipped, 2955 stringLength = string.length, 2956 totalParsedInputLength = 0, 2957 era, 2958 tokenLen; 2959 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; 2960 tokenLen = tokens.length; 2961 2962 for (i = 0; i < tokenLen; i++) { 2963 token = tokens[i]; 2964 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; 2965 2966 if (parsedInput) { 2967 skipped = string.substr(0, string.indexOf(parsedInput)); 2968 2969 if (skipped.length > 0) { 2970 getParsingFlags(config).unusedInput.push(skipped); 2971 } 2972 2973 string = string.slice(string.indexOf(parsedInput) + parsedInput.length); 2974 totalParsedInputLength += parsedInput.length; 2975 } // don't parse if it's not a known token 2976 2977 2978 if (formatTokenFunctions[token]) { 2979 if (parsedInput) { 2980 getParsingFlags(config).empty = false; 2981 } else { 2982 getParsingFlags(config).unusedTokens.push(token); 2983 } 2984 2985 addTimeToArrayFromToken(token, parsedInput, config); 2986 } else if (config._strict && !parsedInput) { 2987 getParsingFlags(config).unusedTokens.push(token); 2988 } 2989 } // add remaining unparsed input length to the string 2990 2991 2992 getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; 2993 2994 if (string.length > 0) { 2995 getParsingFlags(config).unusedInput.push(string); 2996 } // clear _12h flag if hour is <= 12 2997 2998 2999 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { 3000 getParsingFlags(config).bigHour = undefined; 3001 } 3002 3003 getParsingFlags(config).parsedDateParts = config._a.slice(0); 3004 getParsingFlags(config).meridiem = config._meridiem; // handle meridiem 3005 3006 config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); // handle era 3007 3008 era = getParsingFlags(config).era; 3009 3010 if (era !== null) { 3011 config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); 3012 } 3013 3014 configFromArray(config); 3015 checkOverflow(config); 3016 } 3017 3018 function meridiemFixWrap(locale, hour, meridiem) { 3019 var isPm; 3020 3021 if (meridiem == null) { 3022 // nothing to do 3023 return hour; 3024 } 3025 3026 if (locale.meridiemHour != null) { 3027 return locale.meridiemHour(hour, meridiem); 3028 } else if (locale.isPM != null) { 3029 // Fallback 3030 isPm = locale.isPM(meridiem); 3031 3032 if (isPm && hour < 12) { 3033 hour += 12; 3034 } 3035 3036 if (!isPm && hour === 12) { 3037 hour = 0; 3038 } 3039 3040 return hour; 3041 } else { 3042 // this is not supposed to happen 3043 return hour; 3044 } 3045 } // date from string and array of format strings 3046 3047 3048 function configFromStringAndArray(config) { 3049 var tempConfig, 3050 bestMoment, 3051 scoreToBeat, 3052 i, 3053 currentScore, 3054 validFormatFound, 3055 bestFormatIsValid = false, 3056 configfLen = config._f.length; 3057 3058 if (configfLen === 0) { 3059 getParsingFlags(config).invalidFormat = true; 3060 config._d = new Date(NaN); 3061 return; 3062 } 3063 3064 for (i = 0; i < configfLen; i++) { 3065 currentScore = 0; 3066 validFormatFound = false; 3067 tempConfig = copyConfig({}, config); 3068 3069 if (config._useUTC != null) { 3070 tempConfig._useUTC = config._useUTC; 3071 } 3072 3073 tempConfig._f = config._f[i]; 3074 configFromStringAndFormat(tempConfig); 3075 3076 if (isValid(tempConfig)) { 3077 validFormatFound = true; 3078 } // if there is any input that was not parsed add a penalty for that format 3079 3080 3081 currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens 3082 3083 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; 3084 getParsingFlags(tempConfig).score = currentScore; 3085 3086 if (!bestFormatIsValid) { 3087 if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) { 3088 scoreToBeat = currentScore; 3089 bestMoment = tempConfig; 3090 3091 if (validFormatFound) { 3092 bestFormatIsValid = true; 3093 } 3094 } 3095 } else { 3096 if (currentScore < scoreToBeat) { 3097 scoreToBeat = currentScore; 3098 bestMoment = tempConfig; 3099 } 3100 } 3101 } 3102 3103 extend(config, bestMoment || tempConfig); 3104 } 3105 3106 function configFromObject(config) { 3107 if (config._d) { 3108 return; 3109 } 3110 3111 var i = normalizeObjectUnits(config._i), 3112 dayOrDate = i.day === undefined ? i.date : i.day; 3113 config._a = map([i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function (obj) { 3114 return obj && parseInt(obj, 10); 3115 }); 3116 configFromArray(config); 3117 } 3118 3119 function createFromConfig(config) { 3120 var res = new Moment(checkOverflow(prepareConfig(config))); 3121 3122 if (res._nextDay) { 3123 // Adding is smart enough around DST 3124 res.add(1, 'd'); 3125 res._nextDay = undefined; 3126 } 3127 3128 return res; 3129 } 3130 3131 function prepareConfig(config) { 3132 var input = config._i, 3133 format = config._f; 3134 config._locale = config._locale || getLocale(config._l); 3135 3136 if (input === null || format === undefined && input === '') { 3137 return createInvalid({ 3138 nullInput: true 3139 }); 3140 } 3141 3142 if (typeof input === 'string') { 3143 config._i = input = config._locale.preparse(input); 3144 } 3145 3146 if (isMoment(input)) { 3147 return new Moment(checkOverflow(input)); 3148 } else if (isDate(input)) { 3149 config._d = input; 3150 } else if (isArray(format)) { 3151 configFromStringAndArray(config); 3152 } else if (format) { 3153 configFromStringAndFormat(config); 3154 } else { 3155 configFromInput(config); 3156 } 3157 3158 if (!isValid(config)) { 3159 config._d = null; 3160 } 3161 3162 return config; 3163 } 3164 3165 function configFromInput(config) { 3166 var input = config._i; 3167 3168 if (isUndefined(input)) { 3169 config._d = new Date(hooks.now()); 3170 } else if (isDate(input)) { 3171 config._d = new Date(input.valueOf()); 3172 } else if (typeof input === 'string') { 3173 configFromString(config); 3174 } else if (isArray(input)) { 3175 config._a = map(input.slice(0), function (obj) { 3176 return parseInt(obj, 10); 3177 }); 3178 configFromArray(config); 3179 } else if (isObject(input)) { 3180 configFromObject(config); 3181 } else if (isNumber(input)) { 3182 // from milliseconds 3183 config._d = new Date(input); 3184 } else { 3185 hooks.createFromInputFallback(config); 3186 } 3187 } 3188 3189 function createLocalOrUTC(input, format, locale, strict, isUTC) { 3190 var c = {}; 3191 3192 if (format === true || format === false) { 3193 strict = format; 3194 format = undefined; 3195 } 3196 3197 if (locale === true || locale === false) { 3198 strict = locale; 3199 locale = undefined; 3200 } 3201 3202 if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) { 3203 input = undefined; 3204 } // object construction must be done this way. 3205 // https://github.com/moment/moment/issues/1423 3206 3207 3208 c._isAMomentObject = true; 3209 c._useUTC = c._isUTC = isUTC; 3210 c._l = locale; 3211 c._i = input; 3212 c._f = format; 3213 c._strict = strict; 3214 return createFromConfig(c); 3215 } 3216 3217 function createLocal(input, format, locale, strict) { 3218 return createLocalOrUTC(input, format, locale, strict, false); 3219 } 3220 3221 var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () { 3222 var other = createLocal.apply(null, arguments); 3223 3224 if (this.isValid() && other.isValid()) {
vendor: 6,742 bytes, lines 3225-3454
3225 return other < this ? this : other; 3226 } else { 3227 return createInvalid(); 3228 } 3229 }), 3230 prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () { 3231 var other = createLocal.apply(null, arguments); 3232 3233 if (this.isValid() && other.isValid()) { 3234 return other > this ? this : other; 3235 } else { 3236 return createInvalid(); 3237 } 3238 }); // Pick a moment m from moments so that m[fn](other) is true for all 3239 // other. This relies on the function fn to be transitive. 3240 // 3241 // moments should either be an array of moment objects or an array, whose 3242 // first element is an array of moment objects. 3243 3244 function pickBy(fn, moments) { 3245 var res, i; 3246 3247 if (moments.length === 1 && isArray(moments[0])) { 3248 moments = moments[0]; 3249 } 3250 3251 if (!moments.length) { 3252 return createLocal(); 3253 } 3254 3255 res = moments[0]; 3256 3257 for (i = 1; i < moments.length; ++i) { 3258 if (!moments[i].isValid() || moments[i][fn](res)) { 3259 res = moments[i]; 3260 } 3261 } 3262 3263 return res; 3264 } // TODO: Use [].sort instead? 3265 3266 3267 function min() { 3268 var args = [].slice.call(arguments, 0); 3269 return pickBy('isBefore', args); 3270 } 3271 3272 function max() { 3273 var args = [].slice.call(arguments, 0); 3274 return pickBy('isAfter', args); 3275 } 3276 3277 var now = function now() { 3278 return Date.now ? Date.now() : +new Date(); 3279 }; 3280 3281 var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; 3282 3283 function isDurationValid(m) { 3284 var key, 3285 unitHasDecimal = false, 3286 i, 3287 orderLen = ordering.length; 3288 3289 for (key in m) { 3290 if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { 3291 return false; 3292 } 3293 } 3294 3295 for (i = 0; i < orderLen; ++i) { 3296 if (m[ordering[i]]) { 3297 if (unitHasDecimal) { 3298 return false; // only allow non-integers for smallest unit 3299 } 3300 3301 if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { 3302 unitHasDecimal = true; 3303 } 3304 } 3305 } 3306 3307 return true; 3308 } 3309 3310 function isValid$1() { 3311 return this._isValid; 3312 } 3313 3314 function createInvalid$1() { 3315 return createDuration(NaN); 3316 } 3317 3318 function Duration(duration) { 3319 var normalizedInput = normalizeObjectUnits(duration), 3320 years = normalizedInput.year || 0, 3321 quarters = normalizedInput.quarter || 0, 3322 months = normalizedInput.month || 0, 3323 weeks = normalizedInput.week || normalizedInput.isoWeek || 0, 3324 days = normalizedInput.day || 0, 3325 hours = normalizedInput.hour || 0, 3326 minutes = normalizedInput.minute || 0, 3327 seconds = normalizedInput.second || 0, 3328 milliseconds = normalizedInput.millisecond || 0; 3329 this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove 3330 3331 this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 3332 minutes * 6e4 + // 1000 * 60 3333 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 3334 // Because of dateAddRemove treats 24 hours as different from a 3335 // day when working around DST, we need to store them separately 3336 3337 this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing 3338 // which months you are are talking about, so we have to store 3339 // it separately. 3340 3341 this._months = +months + quarters * 3 + years * 12; 3342 this._data = {}; 3343 this._locale = getLocale(); 3344 3345 this._bubble(); 3346 } 3347 3348 function isDuration(obj) { 3349 return obj instanceof Duration; 3350 } 3351 3352 function absRound(number) { 3353 if (number < 0) { 3354 return Math.round(-1 * number) * -1; 3355 } else { 3356 return Math.round(number); 3357 } 3358 } // compare two arrays, return the number of differences 3359 3360 3361 function compareArrays(array1, array2, dontConvert) { 3362 var len = Math.min(array1.length, array2.length), 3363 lengthDiff = Math.abs(array1.length - array2.length), 3364 diffs = 0, 3365 i; 3366 3367 for (i = 0; i < len; i++) { 3368 if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) { 3369 diffs++; 3370 } 3371 } 3372 3373 return diffs + lengthDiff; 3374 } // FORMATTING 3375 3376 3377 function offset(token, separator) { 3378 addFormatToken(token, 0, 0, function () { 3379 var offset = this.utcOffset(), 3380 sign = '+'; 3381 3382 if (offset < 0) { 3383 offset = -offset; 3384 sign = '-'; 3385 } 3386 3387 return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2); 3388 }); 3389 } 3390 3391 offset('Z', ':'); 3392 offset('ZZ', ''); // PARSING 3393 3394 addRegexToken('Z', matchShortOffset); 3395 addRegexToken('ZZ', matchShortOffset); 3396 addParseToken(['Z', 'ZZ'], function (input, array, config) { 3397 config._useUTC = true; 3398 config._tzm = offsetFromString(matchShortOffset, input); 3399 }); // HELPERS 3400 // timezone chunker 3401 // '+10:00' > ['10', '00'] 3402 // '-1530' > ['-15', '30'] 3403 3404 var chunkOffset = /([\+\-]|\d\d)/gi; 3405 3406 function offsetFromString(matcher, string) { 3407 var matches = (string || '').match(matcher), 3408 chunk, 3409 parts, 3410 minutes; 3411 3412 if (matches === null) { 3413 return null; 3414 } 3415 3416 chunk = matches[matches.length - 1] || []; 3417 parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; 3418 minutes = +(parts[1] * 60) + toInt(parts[2]); 3419 return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; 3420 } // Return a moment from input, that is local/utc/zone equivalent to model. 3421 3422 3423 function cloneWithOffset(input, model) { 3424 var res, diff; 3425 3426 if (model._isUTC) { 3427 res = model.clone(); 3428 diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. 3429 3430 res._d.setTime(res._d.valueOf() + diff); 3431 3432 hooks.updateOffset(res, false); 3433 return res; 3434 } else { 3435 return createLocal(input).local(); 3436 } 3437 } 3438 3439 function getDateOffset(m) { 3440 // On Firefox.24 Date#getTimezoneOffset returns a floating point. 3441 // https://github.com/moment/moment/pull/1871 3442 return -Math.round(m._d.getTimezoneOffset()); 3443 } // HOOKS 3444 // This function will be called whenever a moment is mutated. 3445 // It is intended to keep the offset in sync with the timezone. 3446 3447 3448 hooks.updateOffset = function () {}; // MOMENTS 3449 // keepLocalTime = true means only change the timezone, without 3450 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> 3451 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset 3452 // +0200, so we adjust the time as needed, to be valid. 3453 // 3454 // Keeping the time actually adds/subtracts (one hour)
vendor: 6,003 bytes, lines 3455-3672
3455 // from the actual represented time. That is why we call updateOffset 3456 // a second time. In case it wants us to change the offset again 3457 // _changeInProgress == true case, then we have to adjust, because 3458 // there is no such time in the given timezone. 3459 3460 3461 function getSetOffset(input, keepLocalTime, keepMinutes) { 3462 var offset = this._offset || 0, 3463 localAdjust; 3464 3465 if (!this.isValid()) { 3466 return input != null ? this : NaN; 3467 } 3468 3469 if (input != null) { 3470 if (typeof input === 'string') { 3471 input = offsetFromString(matchShortOffset, input); 3472 3473 if (input === null) { 3474 return this; 3475 } 3476 } else if (Math.abs(input) < 16 && !keepMinutes) { 3477 input = input * 60; 3478 } 3479 3480 if (!this._isUTC && keepLocalTime) { 3481 localAdjust = getDateOffset(this); 3482 } 3483 3484 this._offset = input; 3485 this._isUTC = true; 3486 3487 if (localAdjust != null) { 3488 this.add(localAdjust, 'm'); 3489 } 3490 3491 if (offset !== input) { 3492 if (!keepLocalTime || this._changeInProgress) { 3493 addSubtract(this, createDuration(input - offset, 'm'), 1, false); 3494 } else if (!this._changeInProgress) { 3495 this._changeInProgress = true; 3496 hooks.updateOffset(this, true); 3497 this._changeInProgress = null; 3498 } 3499 } 3500 3501 return this; 3502 } else { 3503 return this._isUTC ? offset : getDateOffset(this); 3504 } 3505 } 3506 3507 function getSetZone(input, keepLocalTime) { 3508 if (input != null) { 3509 if (typeof input !== 'string') { 3510 input = -input; 3511 } 3512 3513 this.utcOffset(input, keepLocalTime); 3514 return this; 3515 } else { 3516 return -this.utcOffset(); 3517 } 3518 } 3519 3520 function setOffsetToUTC(keepLocalTime) { 3521 return this.utcOffset(0, keepLocalTime); 3522 } 3523 3524 function setOffsetToLocal(keepLocalTime) { 3525 if (this._isUTC) { 3526 this.utcOffset(0, keepLocalTime); 3527 this._isUTC = false; 3528 3529 if (keepLocalTime) { 3530 this.subtract(getDateOffset(this), 'm'); 3531 } 3532 } 3533 3534 return this; 3535 } 3536 3537 function setOffsetToParsedOffset() { 3538 if (this._tzm != null) { 3539 this.utcOffset(this._tzm, false, true); 3540 } else if (typeof this._i === 'string') { 3541 var tZone = offsetFromString(matchOffset, this._i); 3542 3543 if (tZone != null) { 3544 this.utcOffset(tZone); 3545 } else { 3546 this.utcOffset(0, true); 3547 } 3548 } 3549 3550 return this; 3551 } 3552 3553 function hasAlignedHourOffset(input) { 3554 if (!this.isValid()) { 3555 return false; 3556 } 3557 3558 input = input ? createLocal(input).utcOffset() : 0; 3559 return (this.utcOffset() - input) % 60 === 0; 3560 } 3561 3562 function isDaylightSavingTime() { 3563 return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); 3564 } 3565 3566 function isDaylightSavingTimeShifted() { 3567 if (!isUndefined(this._isDSTShifted)) { 3568 return this._isDSTShifted; 3569 } 3570 3571 var c = {}, 3572 other; 3573 copyConfig(c, this); 3574 c = prepareConfig(c); 3575 3576 if (c._a) { 3577 other = c._isUTC ? createUTC(c._a) : createLocal(c._a); 3578 this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; 3579 } else { 3580 this._isDSTShifted = false; 3581 } 3582 3583 return this._isDSTShifted; 3584 } 3585 3586 function isLocal() { 3587 return this.isValid() ? !this._isUTC : false; 3588 } 3589 3590 function isUtcOffset() { 3591 return this.isValid() ? this._isUTC : false; 3592 } 3593 3594 function isUtc() { 3595 return this.isValid() ? this._isUTC && this._offset === 0 : false; 3596 } // ASP.NET json date format regex 3597 3598 3599 var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, 3600 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html 3601 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere 3602 // and further modified to allow for strings containing both week and day 3603 isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; 3604 3605 function createDuration(input, key) { 3606 var duration = input, 3607 // matching against regexp is expensive, do it on demand 3608 match = null, 3609 sign, 3610 ret, 3611 diffRes; 3612 3613 if (isDuration(input)) { 3614 duration = { 3615 ms: input._milliseconds, 3616 d: input._days, 3617 M: input._months 3618 }; 3619 } else if (isNumber(input) || !isNaN(+input)) { 3620 duration = {}; 3621 3622 if (key) { 3623 duration[key] = +input; 3624 } else { 3625 duration.milliseconds = +input; 3626 } 3627 } else if (match = aspNetRegex.exec(input)) { 3628 sign = match[1] === '-' ? -1 : 1; 3629 duration = { 3630 y: 0, 3631 d: toInt(match[DATE]) * sign, 3632 h: toInt(match[HOUR]) * sign, 3633 m: toInt(match[MINUTE]) * sign, 3634 s: toInt(match[SECOND]) * sign, 3635 ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match 3636 3637 }; 3638 } else if (match = isoRegex.exec(input)) { 3639 sign = match[1] === '-' ? -1 : 1; 3640 duration = { 3641 y: parseIso(match[2], sign), 3642 M: parseIso(match[3], sign), 3643 w: parseIso(match[4], sign), 3644 d: parseIso(match[5], sign), 3645 h: parseIso(match[6], sign), 3646 m: parseIso(match[7], sign), 3647 s: parseIso(match[8], sign) 3648 }; 3649 } else if (duration == null) { 3650 // checks for null or undefined 3651 duration = {}; 3652 } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { 3653 diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); 3654 duration = {}; 3655 duration.ms = diffRes.milliseconds; 3656 duration.M = diffRes.months; 3657 } 3658 3659 ret = new Duration(duration); 3660 3661 if (isDuration(input) && hasOwnProp(input, '_locale')) { 3662 ret._locale = input._locale; 3663 } 3664 3665 if (isDuration(input) && hasOwnProp(input, '_isValid')) { 3666 ret._isValid = input._isValid; 3667 } 3668 3669 return ret; 3670 } 3671 3672 createDuration.fn = Duration.prototype;
vendor: 11,174 bytes, lines 3673-4053
3673 createDuration.invalid = createInvalid$1; 3674 3675 function parseIso(inp, sign) { 3676 // We'd normally use ~~inp for this, but unfortunately it also 3677 // converts floats to ints. 3678 // inp may be undefined, so careful calling replace on it. 3679 var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it 3680 3681 return (isNaN(res) ? 0 : res) * sign; 3682 } 3683 3684 function positiveMomentsDifference(base, other) { 3685 var res = {}; 3686 res.months = other.month() - base.month() + (other.year() - base.year()) * 12; 3687 3688 if (base.clone().add(res.months, 'M').isAfter(other)) { 3689 --res.months; 3690 } 3691 3692 res.milliseconds = +other - +base.clone().add(res.months, 'M'); 3693 return res; 3694 } 3695 3696 function momentsDifference(base, other) { 3697 var res; 3698 3699 if (!(base.isValid() && other.isValid())) { 3700 return { 3701 milliseconds: 0, 3702 months: 0 3703 }; 3704 } 3705 3706 other = cloneWithOffset(other, base); 3707 3708 if (base.isBefore(other)) { 3709 res = positiveMomentsDifference(base, other); 3710 } else { 3711 res = positiveMomentsDifference(other, base); 3712 res.milliseconds = -res.milliseconds; 3713 res.months = -res.months; 3714 } 3715 3716 return res; 3717 } // TODO: remove 'name' arg after deprecation is removed 3718 3719 3720 function createAdder(direction, name) { 3721 return function (val, period) { 3722 var dur, tmp; //invert the arguments, but complain about it 3723 3724 if (period !== null && !isNaN(+period)) { 3725 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); 3726 tmp = val; 3727 val = period; 3728 period = tmp; 3729 } 3730 3731 dur = createDuration(val, period); 3732 addSubtract(this, dur, direction); 3733 return this; 3734 }; 3735 } 3736 3737 function addSubtract(mom, duration, isAdding, updateOffset) { 3738 var milliseconds = duration._milliseconds, 3739 days = absRound(duration._days), 3740 months = absRound(duration._months); 3741 3742 if (!mom.isValid()) { 3743 // No op 3744 return; 3745 } 3746 3747 updateOffset = updateOffset == null ? true : updateOffset; 3748 3749 if (months) { 3750 setMonth(mom, get(mom, 'Month') + months * isAdding); 3751 } 3752 3753 if (days) { 3754 set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); 3755 } 3756 3757 if (milliseconds) { 3758 mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); 3759 } 3760 3761 if (updateOffset) { 3762 hooks.updateOffset(mom, days || months); 3763 } 3764 } 3765 3766 var add = createAdder(1, 'add'), 3767 subtract = createAdder(-1, 'subtract'); 3768 3769 function isString(input) { 3770 return typeof input === 'string' || input instanceof String; 3771 } // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined 3772 3773 3774 function isMomentInput(input) { 3775 return isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === undefined; 3776 } 3777 3778 function isMomentInputObject(input) { 3779 var objectTest = isObject(input) && !isObjectEmpty(input), 3780 propertyTest = false, 3781 properties = ['years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms'], 3782 i, 3783 property, 3784 propertyLen = properties.length; 3785 3786 for (i = 0; i < propertyLen; i += 1) { 3787 property = properties[i]; 3788 propertyTest = propertyTest || hasOwnProp(input, property); 3789 } 3790 3791 return objectTest && propertyTest; 3792 } 3793 3794 function isNumberOrStringArray(input) { 3795 var arrayTest = isArray(input), 3796 dataTypeTest = false; 3797 3798 if (arrayTest) { 3799 dataTypeTest = input.filter(function (item) { 3800 return !isNumber(item) && isString(input); 3801 }).length === 0; 3802 } 3803 3804 return arrayTest && dataTypeTest; 3805 } 3806 3807 function isCalendarSpec(input) { 3808 var objectTest = isObject(input) && !isObjectEmpty(input), 3809 propertyTest = false, 3810 properties = ['sameDay', 'nextDay', 'lastDay', 'nextWeek', 'lastWeek', 'sameElse'], 3811 i, 3812 property; 3813 3814 for (i = 0; i < properties.length; i += 1) { 3815 property = properties[i]; 3816 propertyTest = propertyTest || hasOwnProp(input, property); 3817 } 3818 3819 return objectTest && propertyTest; 3820 } 3821 3822 function getCalendarFormat(myMoment, now) { 3823 var diff = myMoment.diff(now, 'days', true); 3824 return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; 3825 } 3826 3827 function calendar$1(time, formats) { 3828 // Support for single parameter, formats only overload to the calendar function 3829 if (arguments.length === 1) { 3830 if (!arguments[0]) { 3831 time = undefined; 3832 formats = undefined; 3833 } else if (isMomentInput(arguments[0])) { 3834 time = arguments[0]; 3835 formats = undefined; 3836 } else if (isCalendarSpec(arguments[0])) { 3837 formats = arguments[0]; 3838 time = undefined; 3839 } 3840 } // We want to compare the start of today, vs this. 3841 // Getting start-of-today depends on whether we're local/utc/offset or not. 3842 3843 3844 var now = time || createLocal(), 3845 sod = cloneWithOffset(now, this).startOf('day'), 3846 format = hooks.calendarFormat(this, sod) || 'sameElse', 3847 output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); 3848 return this.format(output || this.localeData().calendar(format, this, createLocal(now))); 3849 } 3850 3851 function clone() { 3852 return new Moment(this); 3853 } 3854 3855 function isAfter(input, units) { 3856 var localInput = isMoment(input) ? input : createLocal(input); 3857 3858 if (!(this.isValid() && localInput.isValid())) { 3859 return false; 3860 } 3861 3862 units = normalizeUnits(units) || 'millisecond'; 3863 3864 if (units === 'millisecond') { 3865 return this.valueOf() > localInput.valueOf(); 3866 } else { 3867 return localInput.valueOf() < this.clone().startOf(units).valueOf(); 3868 } 3869 } 3870 3871 function isBefore(input, units) { 3872 var localInput = isMoment(input) ? input : createLocal(input); 3873 3874 if (!(this.isValid() && localInput.isValid())) { 3875 return false; 3876 } 3877 3878 units = normalizeUnits(units) || 'millisecond'; 3879 3880 if (units === 'millisecond') { 3881 return this.valueOf() < localInput.valueOf(); 3882 } else { 3883 return this.clone().endOf(units).valueOf() < localInput.valueOf(); 3884 } 3885 } 3886 3887 function isBetween(from, to, units, inclusivity) { 3888 var localFrom = isMoment(from) ? from : createLocal(from), 3889 localTo = isMoment(to) ? to : createLocal(to); 3890 3891 if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { 3892 return false; 3893 } 3894 3895 inclusivity = inclusivity || '()'; 3896 return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)); 3897 } 3898 3899 function isSame(input, units) { 3900 var localInput = isMoment(input) ? input : createLocal(input), 3901 inputMs; 3902 3903 if (!(this.isValid() && localInput.isValid())) { 3904 return false; 3905 } 3906 3907 units = normalizeUnits(units) || 'millisecond'; 3908 3909 if (units === 'millisecond') { 3910 return this.valueOf() === localInput.valueOf(); 3911 } else { 3912 inputMs = localInput.valueOf(); 3913 return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); 3914 } 3915 } 3916 3917 function isSameOrAfter(input, units) { 3918 return this.isSame(input, units) || this.isAfter(input, units); 3919 } 3920 3921 function isSameOrBefore(input, units) { 3922 return this.isSame(input, units) || this.isBefore(input, units); 3923 } 3924 3925 function diff(input, units, asFloat) { 3926 var that, zoneDelta, output; 3927 3928 if (!this.isValid()) { 3929 return NaN; 3930 } 3931 3932 that = cloneWithOffset(input, this); 3933 3934 if (!that.isValid()) { 3935 return NaN; 3936 } 3937 3938 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; 3939 units = normalizeUnits(units); 3940 3941 switch (units) { 3942 case 'year': 3943 output = monthDiff(this, that) / 12; 3944 break; 3945 3946 case 'month': 3947 output = monthDiff(this, that); 3948 break; 3949 3950 case 'quarter': 3951 output = monthDiff(this, that) / 3; 3952 break; 3953 3954 case 'second': 3955 output = (this - that) / 1e3; 3956 break; 3957 // 1000 3958 3959 case 'minute': 3960 output = (this - that) / 6e4; 3961 break; 3962 // 1000 * 60 3963 3964 case 'hour': 3965 output = (this - that) / 36e5; 3966 break; 3967 // 1000 * 60 * 60 3968 3969 case 'day': 3970 output = (this - that - zoneDelta) / 864e5; 3971 break; 3972 // 1000 * 60 * 60 * 24, negate dst 3973 3974 case 'week': 3975 output = (this - that - zoneDelta) / 6048e5; 3976 break; 3977 // 1000 * 60 * 60 * 24 * 7, negate dst 3978 3979 default: 3980 output = this - that; 3981 } 3982 3983 return asFloat ? output : absFloor(output); 3984 } 3985 3986 function monthDiff(a, b) { 3987 if (a.date() < b.date()) { 3988 // end-of-month calculations work correct when the start month has more 3989 // days than the end month. 3990 return -monthDiff(b, a); 3991 } // difference in months 3992 3993 3994 var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), 3995 // b is in (anchor - 1 month, anchor + 1 month) 3996 anchor = a.clone().add(wholeMonthDiff, 'months'), 3997 anchor2, 3998 adjust; 3999 4000 if (b - anchor < 0) { 4001 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month 4002 4003 adjust = (b - anchor) / (anchor - anchor2); 4004 } else { 4005 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month 4006 4007 adjust = (b - anchor) / (anchor2 - anchor); 4008 } //check for negative zero, return zero if negative zero 4009 4010 4011 return -(wholeMonthDiff + adjust) || 0; 4012 } 4013 4014 hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; 4015 hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; 4016 4017 function toString() { 4018 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); 4019 } 4020 4021 function toISOString(keepOffset) { 4022 if (!this.isValid()) { 4023 return null; 4024 } 4025 4026 var utc = keepOffset !== true, 4027 m = utc ? this.clone().utc() : this; 4028 4029 if (m.year() < 0 || m.year() > 9999) { 4030 return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); 4031 } 4032 4033 if (isFunction(Date.prototype.toISOString)) { 4034 // native implementation is ~50x faster, use it when we can 4035 if (utc) { 4036 return this.toDate().toISOString(); 4037 } else { 4038 return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z')); 4039 } 4040 } 4041 4042 return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); 4043 } 4044 /** 4045 * Return a human readable representation of a moment that can 4046 * also be evaluated to get a new moment which is the same 4047 * 4048 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects 4049 */ 4050 4051 4052 function inspect() { 4053 if (!this.isValid()) {
vendor: 7,214 bytes, lines 4054-4333
4054 return 'moment.invalid(/* ' + this._i + ' */)'; 4055 } 4056 4057 var func = 'moment', 4058 zone = '', 4059 prefix, 4060 year, 4061 datetime, 4062 suffix; 4063 4064 if (!this.isLocal()) { 4065 func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; 4066 zone = 'Z'; 4067 } 4068 4069 prefix = '[' + func + '("]'; 4070 year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; 4071 datetime = '-MM-DD[T]HH:mm:ss.SSS'; 4072 suffix = zone + '[")]'; 4073 return this.format(prefix + year + datetime + suffix); 4074 } 4075 4076 function format(inputString) { 4077 if (!inputString) { 4078 inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; 4079 } 4080 4081 var output = formatMoment(this, inputString); 4082 return this.localeData().postformat(output); 4083 } 4084 4085 function from(time, withoutSuffix) { 4086 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { 4087 return createDuration({ 4088 to: this, 4089 from: time 4090 }).locale(this.locale()).humanize(!withoutSuffix); 4091 } else { 4092 return this.localeData().invalidDate(); 4093 } 4094 } 4095 4096 function fromNow(withoutSuffix) { 4097 return this.from(createLocal(), withoutSuffix); 4098 } 4099 4100 function to(time, withoutSuffix) { 4101 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { 4102 return createDuration({ 4103 from: this, 4104 to: time 4105 }).locale(this.locale()).humanize(!withoutSuffix); 4106 } else { 4107 return this.localeData().invalidDate(); 4108 } 4109 } 4110 4111 function toNow(withoutSuffix) { 4112 return this.to(createLocal(), withoutSuffix); 4113 } // If passed a locale key, it will set the locale for this 4114 // instance. Otherwise, it will return the locale configuration 4115 // variables for this instance. 4116 4117 4118 function locale(key) { 4119 var newLocaleData; 4120 4121 if (key === undefined) { 4122 return this._locale._abbr; 4123 } else { 4124 newLocaleData = getLocale(key); 4125 4126 if (newLocaleData != null) { 4127 this._locale = newLocaleData; 4128 } 4129 4130 return this; 4131 } 4132 } 4133 4134 var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) { 4135 if (key === undefined) { 4136 return this.localeData(); 4137 } else { 4138 return this.locale(key); 4139 } 4140 }); 4141 4142 function localeData() { 4143 return this._locale; 4144 } 4145 4146 var MS_PER_SECOND = 1000, 4147 MS_PER_MINUTE = 60 * MS_PER_SECOND, 4148 MS_PER_HOUR = 60 * MS_PER_MINUTE, 4149 MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970): 4150 4151 function mod$1(dividend, divisor) { 4152 return (dividend % divisor + divisor) % divisor; 4153 } 4154 4155 function localStartOfDate(y, m, d) { 4156 // the date constructor remaps years 0-99 to 1900-1999 4157 if (y < 100 && y >= 0) { 4158 // preserve leap years using a full 400 year cycle, then reset 4159 return new Date(y + 400, m, d) - MS_PER_400_YEARS; 4160 } else { 4161 return new Date(y, m, d).valueOf(); 4162 } 4163 } 4164 4165 function utcStartOfDate(y, m, d) { 4166 // Date.UTC remaps years 0-99 to 1900-1999 4167 if (y < 100 && y >= 0) { 4168 // preserve leap years using a full 400 year cycle, then reset 4169 return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; 4170 } else { 4171 return Date.UTC(y, m, d); 4172 } 4173 } 4174 4175 function startOf(units) { 4176 var time, startOfDate; 4177 units = normalizeUnits(units); 4178 4179 if (units === undefined || units === 'millisecond' || !this.isValid()) { 4180 return this; 4181 } 4182 4183 startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; 4184 4185 switch (units) { 4186 case 'year': 4187 time = startOfDate(this.year(), 0, 1); 4188 break; 4189 4190 case 'quarter': 4191 time = startOfDate(this.year(), this.month() - this.month() % 3, 1); 4192 break; 4193 4194 case 'month': 4195 time = startOfDate(this.year(), this.month(), 1); 4196 break; 4197 4198 case 'week': 4199 time = startOfDate(this.year(), this.month(), this.date() - this.weekday()); 4200 break; 4201 4202 case 'isoWeek': 4203 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); 4204 break; 4205 4206 case 'day': 4207 case 'date': 4208 time = startOfDate(this.year(), this.month(), this.date()); 4209 break; 4210 4211 case 'hour': 4212 time = this._d.valueOf(); 4213 time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR); 4214 break; 4215 4216 case 'minute': 4217 time = this._d.valueOf(); 4218 time -= mod$1(time, MS_PER_MINUTE); 4219 break; 4220 4221 case 'second': 4222 time = this._d.valueOf(); 4223 time -= mod$1(time, MS_PER_SECOND); 4224 break; 4225 } 4226 4227 this._d.setTime(time); 4228 4229 hooks.updateOffset(this, true); 4230 return this; 4231 } 4232 4233 function endOf(units) { 4234 var time, startOfDate; 4235 units = normalizeUnits(units); 4236 4237 if (units === undefined || units === 'millisecond' || !this.isValid()) { 4238 return this; 4239 } 4240 4241 startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; 4242 4243 switch (units) { 4244 case 'year': 4245 time = startOfDate(this.year() + 1, 0, 1) - 1; 4246 break; 4247 4248 case 'quarter': 4249 time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; 4250 break; 4251 4252 case 'month': 4253 time = startOfDate(this.year(), this.month() + 1, 1) - 1; 4254 break; 4255 4256 case 'week': 4257 time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; 4258 break; 4259 4260 case 'isoWeek': 4261 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; 4262 break; 4263 4264 case 'day': 4265 case 'date': 4266 time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; 4267 break; 4268 4269 case 'hour': 4270 time = this._d.valueOf(); 4271 time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1; 4272 break; 4273 4274 case 'minute': 4275 time = this._d.valueOf(); 4276 time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; 4277 break; 4278 4279 case 'second': 4280 time = this._d.valueOf(); 4281 time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; 4282 break; 4283 } 4284 4285 this._d.setTime(time); 4286 4287 hooks.updateOffset(this, true); 4288 return this; 4289 } 4290 4291 function valueOf() { 4292 return this._d.valueOf() - (this._offset || 0) * 60000; 4293 } 4294 4295 function unix() { 4296 return Math.floor(this.valueOf() / 1000); 4297 } 4298 4299 function toDate() { 4300 return new Date(this.valueOf()); 4301 } 4302 4303 function toArray() { 4304 var m = this; 4305 return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; 4306 } 4307 4308 function toObject() { 4309 var m = this; 4310 return { 4311 years: m.year(), 4312 months: m.month(), 4313 date: m.date(), 4314 hours: m.hours(), 4315 minutes: m.minutes(), 4316 seconds: m.seconds(), 4317 milliseconds: m.milliseconds() 4318 }; 4319 } 4320 4321 function toJSON() { 4322 // new Date(NaN).toJSON() === null 4323 return this.isValid() ? this.toISOString() : null; 4324 } 4325 4326 function isValid$2() { 4327 return isValid(this); 4328 } 4329 4330 function parsingFlags() { 4331 return extend({}, getParsingFlags(this)); 4332 } 4333
vendor: 15,611 bytes, lines 4334-4903
4334 function invalidAt() { 4335 return getParsingFlags(this).overflow; 4336 } 4337 4338 function creationData() { 4339 return { 4340 input: this._i, 4341 format: this._f, 4342 locale: this._locale, 4343 isUTC: this._isUTC, 4344 strict: this._strict 4345 }; 4346 } 4347 4348 addFormatToken('N', 0, 0, 'eraAbbr'); 4349 addFormatToken('NN', 0, 0, 'eraAbbr'); 4350 addFormatToken('NNN', 0, 0, 'eraAbbr'); 4351 addFormatToken('NNNN', 0, 0, 'eraName'); 4352 addFormatToken('NNNNN', 0, 0, 'eraNarrow'); 4353 addFormatToken('y', ['y', 1], 'yo', 'eraYear'); 4354 addFormatToken('y', ['yy', 2], 0, 'eraYear'); 4355 addFormatToken('y', ['yyy', 3], 0, 'eraYear'); 4356 addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); 4357 addRegexToken('N', matchEraAbbr); 4358 addRegexToken('NN', matchEraAbbr); 4359 addRegexToken('NNN', matchEraAbbr); 4360 addRegexToken('NNNN', matchEraName); 4361 addRegexToken('NNNNN', matchEraNarrow); 4362 addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (input, array, config, token) { 4363 var era = config._locale.erasParse(input, token, config._strict); 4364 4365 if (era) { 4366 getParsingFlags(config).era = era; 4367 } else { 4368 getParsingFlags(config).invalidEra = input; 4369 } 4370 }); 4371 addRegexToken('y', matchUnsigned); 4372 addRegexToken('yy', matchUnsigned); 4373 addRegexToken('yyy', matchUnsigned); 4374 addRegexToken('yyyy', matchUnsigned); 4375 addRegexToken('yo', matchEraYearOrdinal); 4376 addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); 4377 addParseToken(['yo'], function (input, array, config, token) { 4378 var match; 4379 4380 if (config._locale._eraYearOrdinalRegex) { 4381 match = input.match(config._locale._eraYearOrdinalRegex); 4382 } 4383 4384 if (config._locale.eraYearOrdinalParse) { 4385 array[YEAR] = config._locale.eraYearOrdinalParse(input, match); 4386 } else { 4387 array[YEAR] = parseInt(input, 10); 4388 } 4389 }); 4390 4391 function localeEras(m, format) { 4392 var i, 4393 l, 4394 date, 4395 eras = this._eras || getLocale('en')._eras; 4396 4397 for (i = 0, l = eras.length; i < l; ++i) { 4398 switch (typeof eras[i].since) { 4399 case 'string': 4400 // truncate time 4401 date = hooks(eras[i].since).startOf('day'); 4402 eras[i].since = date.valueOf(); 4403 break; 4404 } 4405 4406 switch (typeof eras[i].until) { 4407 case 'undefined': 4408 eras[i].until = +Infinity; 4409 break; 4410 4411 case 'string': 4412 // truncate time 4413 date = hooks(eras[i].until).startOf('day').valueOf(); 4414 eras[i].until = date.valueOf(); 4415 break; 4416 } 4417 } 4418 4419 return eras; 4420 } 4421 4422 function localeErasParse(eraName, format, strict) { 4423 var i, 4424 l, 4425 eras = this.eras(), 4426 name, 4427 abbr, 4428 narrow; 4429 eraName = eraName.toUpperCase(); 4430 4431 for (i = 0, l = eras.length; i < l; ++i) { 4432 name = eras[i].name.toUpperCase(); 4433 abbr = eras[i].abbr.toUpperCase(); 4434 narrow = eras[i].narrow.toUpperCase(); 4435 4436 if (strict) { 4437 switch (format) { 4438 case 'N': 4439 case 'NN': 4440 case 'NNN': 4441 if (abbr === eraName) { 4442 return eras[i]; 4443 } 4444 4445 break; 4446 4447 case 'NNNN': 4448 if (name === eraName) { 4449 return eras[i]; 4450 } 4451 4452 break; 4453 4454 case 'NNNNN': 4455 if (narrow === eraName) { 4456 return eras[i]; 4457 } 4458 4459 break; 4460 } 4461 } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { 4462 return eras[i]; 4463 } 4464 } 4465 } 4466 4467 function localeErasConvertYear(era, year) { 4468 var dir = era.since <= era.until ? +1 : -1; 4469 4470 if (year === undefined) { 4471 return hooks(era.since).year(); 4472 } else { 4473 return hooks(era.since).year() + (year - era.offset) * dir; 4474 } 4475 } 4476 4477 function getEraName() { 4478 var i, 4479 l, 4480 val, 4481 eras = this.localeData().eras(); 4482 4483 for (i = 0, l = eras.length; i < l; ++i) { 4484 // truncate time 4485 val = this.clone().startOf('day').valueOf(); 4486 4487 if (eras[i].since <= val && val <= eras[i].until) { 4488 return eras[i].name; 4489 } 4490 4491 if (eras[i].until <= val && val <= eras[i].since) { 4492 return eras[i].name; 4493 } 4494 } 4495 4496 return ''; 4497 } 4498 4499 function getEraNarrow() { 4500 var i, 4501 l, 4502 val, 4503 eras = this.localeData().eras(); 4504 4505 for (i = 0, l = eras.length; i < l; ++i) { 4506 // truncate time 4507 val = this.clone().startOf('day').valueOf(); 4508 4509 if (eras[i].since <= val && val <= eras[i].until) { 4510 return eras[i].narrow; 4511 } 4512 4513 if (eras[i].until <= val && val <= eras[i].since) { 4514 return eras[i].narrow; 4515 } 4516 } 4517 4518 return ''; 4519 } 4520 4521 function getEraAbbr() { 4522 var i, 4523 l, 4524 val, 4525 eras = this.localeData().eras(); 4526 4527 for (i = 0, l = eras.length; i < l; ++i) { 4528 // truncate time 4529 val = this.clone().startOf('day').valueOf(); 4530 4531 if (eras[i].since <= val && val <= eras[i].until) { 4532 return eras[i].abbr; 4533 } 4534 4535 if (eras[i].until <= val && val <= eras[i].since) { 4536 return eras[i].abbr; 4537 } 4538 } 4539 4540 return ''; 4541 } 4542 4543 function getEraYear() { 4544 var i, 4545 l, 4546 dir, 4547 val, 4548 eras = this.localeData().eras(); 4549 4550 for (i = 0, l = eras.length; i < l; ++i) { 4551 dir = eras[i].since <= eras[i].until ? +1 : -1; // truncate time 4552 4553 val = this.clone().startOf('day').valueOf(); 4554 4555 if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) { 4556 return (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset; 4557 } 4558 } 4559 4560 return this.year(); 4561 } 4562 4563 function erasNameRegex(isStrict) { 4564 if (!hasOwnProp(this, '_erasNameRegex')) { 4565 computeErasParse.call(this); 4566 } 4567 4568 return isStrict ? this._erasNameRegex : this._erasRegex; 4569 } 4570 4571 function erasAbbrRegex(isStrict) { 4572 if (!hasOwnProp(this, '_erasAbbrRegex')) { 4573 computeErasParse.call(this); 4574 } 4575 4576 return isStrict ? this._erasAbbrRegex : this._erasRegex; 4577 } 4578 4579 function erasNarrowRegex(isStrict) { 4580 if (!hasOwnProp(this, '_erasNarrowRegex')) { 4581 computeErasParse.call(this); 4582 } 4583 4584 return isStrict ? this._erasNarrowRegex : this._erasRegex; 4585 } 4586 4587 function matchEraAbbr(isStrict, locale) { 4588 return locale.erasAbbrRegex(isStrict); 4589 } 4590 4591 function matchEraName(isStrict, locale) { 4592 return locale.erasNameRegex(isStrict); 4593 } 4594 4595 function matchEraNarrow(isStrict, locale) { 4596 return locale.erasNarrowRegex(isStrict); 4597 } 4598 4599 function matchEraYearOrdinal(isStrict, locale) { 4600 return locale._eraYearOrdinalRegex || matchUnsigned; 4601 } 4602 4603 function computeErasParse() { 4604 var abbrPieces = [], 4605 namePieces = [], 4606 narrowPieces = [], 4607 mixedPieces = [], 4608 i, 4609 l, 4610 eras = this.eras(); 4611 4612 for (i = 0, l = eras.length; i < l; ++i) { 4613 namePieces.push(regexEscape(eras[i].name)); 4614 abbrPieces.push(regexEscape(eras[i].abbr)); 4615 narrowPieces.push(regexEscape(eras[i].narrow)); 4616 mixedPieces.push(regexEscape(eras[i].name)); 4617 mixedPieces.push(regexEscape(eras[i].abbr)); 4618 mixedPieces.push(regexEscape(eras[i].narrow)); 4619 } 4620 4621 this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 4622 this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); 4623 this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); 4624 this._erasNarrowRegex = new RegExp('^(' + narrowPieces.join('|') + ')', 'i'); 4625 } // FORMATTING 4626 4627 4628 addFormatToken(0, ['gg', 2], 0, function () { 4629 return this.weekYear() % 100; 4630 }); 4631 addFormatToken(0, ['GG', 2], 0, function () { 4632 return this.isoWeekYear() % 100; 4633 }); 4634 4635 function addWeekYearFormatToken(token, getter) { 4636 addFormatToken(0, [token, token.length], 0, getter); 4637 } 4638 4639 addWeekYearFormatToken('gggg', 'weekYear'); 4640 addWeekYearFormatToken('ggggg', 'weekYear'); 4641 addWeekYearFormatToken('GGGG', 'isoWeekYear'); 4642 addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES 4643 4644 addUnitAlias('weekYear', 'gg'); 4645 addUnitAlias('isoWeekYear', 'GG'); // PRIORITY 4646 4647 addUnitPriority('weekYear', 1); 4648 addUnitPriority('isoWeekYear', 1); // PARSING 4649 4650 addRegexToken('G', matchSigned); 4651 addRegexToken('g', matchSigned); 4652 addRegexToken('GG', match1to2, match2); 4653 addRegexToken('gg', match1to2, match2); 4654 addRegexToken('GGGG', match1to4, match4); 4655 addRegexToken('gggg', match1to4, match4); 4656 addRegexToken('GGGGG', match1to6, match6); 4657 addRegexToken('ggggg', match1to6, match6); 4658 addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { 4659 week[token.substr(0, 2)] = toInt(input); 4660 }); 4661 addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { 4662 week[token] = hooks.parseTwoDigitYear(input); 4663 }); // MOMENTS 4664 4665 function getSetWeekYear(input) { 4666 return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); 4667 } 4668 4669 function getSetISOWeekYear(input) { 4670 return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); 4671 } 4672 4673 function getISOWeeksInYear() { 4674 return weeksInYear(this.year(), 1, 4); 4675 } 4676 4677 function getISOWeeksInISOWeekYear() { 4678 return weeksInYear(this.isoWeekYear(), 1, 4); 4679 } 4680 4681 function getWeeksInYear() { 4682 var weekInfo = this.localeData()._week; 4683 4684 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); 4685 } 4686 4687 function getWeeksInWeekYear() { 4688 var weekInfo = this.localeData()._week; 4689 4690 return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); 4691 } 4692 4693 function getSetWeekYearHelper(input, week, weekday, dow, doy) { 4694 var weeksTarget; 4695 4696 if (input == null) { 4697 return weekOfYear(this, dow, doy).year; 4698 } else { 4699 weeksTarget = weeksInYear(input, dow, doy); 4700 4701 if (week > weeksTarget) { 4702 week = weeksTarget; 4703 } 4704 4705 return setWeekAll.call(this, input, week, weekday, dow, doy); 4706 } 4707 } 4708 4709 function setWeekAll(weekYear, week, weekday, dow, doy) { 4710 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), 4711 date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); 4712 this.year(date.getUTCFullYear()); 4713 this.month(date.getUTCMonth()); 4714 this.date(date.getUTCDate()); 4715 return this; 4716 } // FORMATTING 4717 4718 4719 addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES 4720 4721 addUnitAlias('quarter', 'Q'); // PRIORITY 4722 4723 addUnitPriority('quarter', 7); // PARSING 4724 4725 addRegexToken('Q', match1); 4726 addParseToken('Q', function (input, array) { 4727 array[MONTH] = (toInt(input) - 1) * 3; 4728 }); // MOMENTS 4729 4730 function getSetQuarter(input) { 4731 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); 4732 } // FORMATTING 4733 4734 4735 addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES 4736 4737 addUnitAlias('date', 'D'); // PRIORITY 4738 4739 addUnitPriority('date', 9); // PARSING 4740 4741 addRegexToken('D', match1to2); 4742 addRegexToken('DD', match1to2, match2); 4743 addRegexToken('Do', function (isStrict, locale) { 4744 // TODO: Remove "ordinalParse" fallback in next major release. 4745 return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; 4746 }); 4747 addParseToken(['D', 'DD'], DATE); 4748 addParseToken('Do', function (input, array) { 4749 array[DATE] = toInt(input.match(match1to2)[0]); 4750 }); // MOMENTS 4751 4752 var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING 4753 4754 addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES 4755 4756 addUnitAlias('dayOfYear', 'DDD'); // PRIORITY 4757 4758 addUnitPriority('dayOfYear', 4); // PARSING 4759 4760 addRegexToken('DDD', match1to3); 4761 addRegexToken('DDDD', match3); 4762 addParseToken(['DDD', 'DDDD'], function (input, array, config) { 4763 config._dayOfYear = toInt(input); 4764 }); // HELPERS 4765 // MOMENTS 4766 4767 function getSetDayOfYear(input) { 4768 var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; 4769 return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); 4770 } // FORMATTING 4771 4772 4773 addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES 4774 4775 addUnitAlias('minute', 'm'); // PRIORITY 4776 4777 addUnitPriority('minute', 14); // PARSING 4778 4779 addRegexToken('m', match1to2); 4780 addRegexToken('mm', match1to2, match2); 4781 addParseToken(['m', 'mm'], MINUTE); // MOMENTS 4782 4783 var getSetMinute = makeGetSet('Minutes', false); // FORMATTING 4784 4785 addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES 4786 4787 addUnitAlias('second', 's'); // PRIORITY 4788 4789 addUnitPriority('second', 15); // PARSING 4790 4791 addRegexToken('s', match1to2); 4792 addRegexToken('ss', match1to2, match2); 4793 addParseToken(['s', 'ss'], SECOND); // MOMENTS 4794 4795 var getSetSecond = makeGetSet('Seconds', false); // FORMATTING 4796 4797 addFormatToken('S', 0, 0, function () { 4798 return ~~(this.millisecond() / 100); 4799 }); 4800 addFormatToken(0, ['SS', 2], 0, function () { 4801 return ~~(this.millisecond() / 10); 4802 }); 4803 addFormatToken(0, ['SSS', 3], 0, 'millisecond'); 4804 addFormatToken(0, ['SSSS', 4], 0, function () { 4805 return this.millisecond() * 10; 4806 }); 4807 addFormatToken(0, ['SSSSS', 5], 0, function () { 4808 return this.millisecond() * 100; 4809 }); 4810 addFormatToken(0, ['SSSSSS', 6], 0, function () { 4811 return this.millisecond() * 1000; 4812 }); 4813 addFormatToken(0, ['SSSSSSS', 7], 0, function () { 4814 return this.millisecond() * 10000; 4815 }); 4816 addFormatToken(0, ['SSSSSSSS', 8], 0, function () { 4817 return this.millisecond() * 100000; 4818 }); 4819 addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { 4820 return this.millisecond() * 1000000; 4821 }); // ALIASES 4822 4823 addUnitAlias('millisecond', 'ms'); // PRIORITY 4824 4825 addUnitPriority('millisecond', 16); // PARSING 4826 4827 addRegexToken('S', match1to3, match1); 4828 addRegexToken('SS', match1to3, match2); 4829 addRegexToken('SSS', match1to3, match3); 4830 var token, getSetMillisecond; 4831 4832 for (token = 'SSSS'; token.length <= 9; token += 'S') { 4833 addRegexToken(token, matchUnsigned); 4834 } 4835 4836 function parseMs(input, array) { 4837 array[MILLISECOND] = toInt(('0.' + input) * 1000); 4838 } 4839 4840 for (token = 'S'; token.length <= 9; token += 'S') { 4841 addParseToken(token, parseMs); 4842 } 4843 4844 getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING 4845 4846 addFormatToken('z', 0, 0, 'zoneAbbr'); 4847 addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS 4848 4849 function getZoneAbbr() { 4850 return this._isUTC ? 'UTC' : ''; 4851 } 4852 4853 function getZoneName() { 4854 return this._isUTC ? 'Coordinated Universal Time' : ''; 4855 } 4856 4857 var proto = Moment.prototype; 4858 proto.add = add; 4859 proto.calendar = calendar$1; 4860 proto.clone = clone; 4861 proto.diff = diff; 4862 proto.endOf = endOf; 4863 proto.format = format; 4864 proto.from = from; 4865 proto.fromNow = fromNow; 4866 proto.to = to; 4867 proto.toNow = toNow; 4868 proto.get = stringGet; 4869 proto.invalidAt = invalidAt; 4870 proto.isAfter = isAfter; 4871 proto.isBefore = isBefore; 4872 proto.isBetween = isBetween; 4873 proto.isSame = isSame; 4874 proto.isSameOrAfter = isSameOrAfter; 4875 proto.isSameOrBefore = isSameOrBefore; 4876 proto.isValid = isValid$2; 4877 proto.lang = lang; 4878 proto.locale = locale; 4879 proto.localeData = localeData; 4880 proto.max = prototypeMax; 4881 proto.min = prototypeMin; 4882 proto.parsingFlags = parsingFlags; 4883 proto.set = stringSet; 4884 proto.startOf = startOf; 4885 proto.subtract = subtract; 4886 proto.toArray = toArray; 4887 proto.toObject = toObject; 4888 proto.toDate = toDate; 4889 proto.toISOString = toISOString; 4890 proto.inspect = inspect; 4891 4892 if (typeof Symbol !== 'undefined' && Symbol.for != null) { 4893 proto[Symbol.for('nodejs.util.inspect.custom')] = function () { 4894 return 'Moment<' + this.format() + '>'; 4895 }; 4896 } 4897 4898 proto.toJSON = toJSON; 4899 proto.toString = toString; 4900 proto.unix = unix; 4901 proto.valueOf = valueOf; 4902 proto.creationData = creationData; 4903 proto.eraName = getEraName;
vendor: 4,539 bytes, lines 4904-5040
4904 proto.eraNarrow = getEraNarrow; 4905 proto.eraAbbr = getEraAbbr; 4906 proto.eraYear = getEraYear; 4907 proto.year = getSetYear; 4908 proto.isLeapYear = getIsLeapYear; 4909 proto.weekYear = getSetWeekYear; 4910 proto.isoWeekYear = getSetISOWeekYear; 4911 proto.quarter = proto.quarters = getSetQuarter; 4912 proto.month = getSetMonth; 4913 proto.daysInMonth = getDaysInMonth; 4914 proto.week = proto.weeks = getSetWeek; 4915 proto.isoWeek = proto.isoWeeks = getSetISOWeek; 4916 proto.weeksInYear = getWeeksInYear; 4917 proto.weeksInWeekYear = getWeeksInWeekYear; 4918 proto.isoWeeksInYear = getISOWeeksInYear; 4919 proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; 4920 proto.date = getSetDayOfMonth; 4921 proto.day = proto.days = getSetDayOfWeek; 4922 proto.weekday = getSetLocaleDayOfWeek; 4923 proto.isoWeekday = getSetISODayOfWeek; 4924 proto.dayOfYear = getSetDayOfYear; 4925 proto.hour = proto.hours = getSetHour; 4926 proto.minute = proto.minutes = getSetMinute; 4927 proto.second = proto.seconds = getSetSecond; 4928 proto.millisecond = proto.milliseconds = getSetMillisecond; 4929 proto.utcOffset = getSetOffset; 4930 proto.utc = setOffsetToUTC; 4931 proto.local = setOffsetToLocal; 4932 proto.parseZone = setOffsetToParsedOffset; 4933 proto.hasAlignedHourOffset = hasAlignedHourOffset; 4934 proto.isDST = isDaylightSavingTime; 4935 proto.isLocal = isLocal; 4936 proto.isUtcOffset = isUtcOffset; 4937 proto.isUtc = isUtc; 4938 proto.isUTC = isUtc; 4939 proto.zoneAbbr = getZoneAbbr; 4940 proto.zoneName = getZoneName; 4941 proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); 4942 proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); 4943 proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); 4944 proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); 4945 proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); 4946 4947 function createUnix(input) { 4948 return createLocal(input * 1000); 4949 } 4950 4951 function createInZone() { 4952 return createLocal.apply(null, arguments).parseZone(); 4953 } 4954 4955 function preParsePostFormat(string) { 4956 return string; 4957 } 4958 4959 var proto$1 = Locale.prototype; 4960 proto$1.calendar = calendar; 4961 proto$1.longDateFormat = longDateFormat; 4962 proto$1.invalidDate = invalidDate; 4963 proto$1.ordinal = ordinal; 4964 proto$1.preparse = preParsePostFormat; 4965 proto$1.postformat = preParsePostFormat; 4966 proto$1.relativeTime = relativeTime; 4967 proto$1.pastFuture = pastFuture; 4968 proto$1.set = set; 4969 proto$1.eras = localeEras; 4970 proto$1.erasParse = localeErasParse; 4971 proto$1.erasConvertYear = localeErasConvertYear; 4972 proto$1.erasAbbrRegex = erasAbbrRegex; 4973 proto$1.erasNameRegex = erasNameRegex; 4974 proto$1.erasNarrowRegex = erasNarrowRegex; 4975 proto$1.months = localeMonths; 4976 proto$1.monthsShort = localeMonthsShort; 4977 proto$1.monthsParse = localeMonthsParse; 4978 proto$1.monthsRegex = monthsRegex; 4979 proto$1.monthsShortRegex = monthsShortRegex; 4980 proto$1.week = localeWeek; 4981 proto$1.firstDayOfYear = localeFirstDayOfYear; 4982 proto$1.firstDayOfWeek = localeFirstDayOfWeek; 4983 proto$1.weekdays = localeWeekdays; 4984 proto$1.weekdaysMin = localeWeekdaysMin; 4985 proto$1.weekdaysShort = localeWeekdaysShort; 4986 proto$1.weekdaysParse = localeWeekdaysParse; 4987 proto$1.weekdaysRegex = weekdaysRegex; 4988 proto$1.weekdaysShortRegex = weekdaysShortRegex; 4989 proto$1.weekdaysMinRegex = weekdaysMinRegex; 4990 proto$1.isPM = localeIsPM; 4991 proto$1.meridiem = localeMeridiem; 4992 4993 function get$1(format, index, field, setter) { 4994 var locale = getLocale(), 4995 utc = createUTC().set(setter, index); 4996 return locale[field](utc, format); 4997 } 4998 4999 function listMonthsImpl(format, index, field) { 5000 if (isNumber(format)) { 5001 index = format; 5002 format = undefined; 5003 } 5004 5005 format = format || ''; 5006 5007 if (index != null) { 5008 return get$1(format, index, field, 'month'); 5009 } 5010 5011 var i, 5012 out = []; 5013 5014 for (i = 0; i < 12; i++) { 5015 out[i] = get$1(format, i, field, 'month'); 5016 } 5017 5018 return out; 5019 } // () 5020 // (5) 5021 // (fmt, 5) 5022 // (fmt) 5023 // (true) 5024 // (true, 5) 5025 // (true, fmt, 5) 5026 // (true, fmt) 5027 5028 5029 function listWeekdaysImpl(localeSorted, format, index, field) { 5030 if (typeof localeSorted === 'boolean') { 5031 if (isNumber(format)) { 5032 index = format; 5033 format = undefined; 5034 } 5035 5036 format = format || ''; 5037 } else { 5038 format = localeSorted; 5039 index = format; 5040 localeSorted = false;
vendor: 9,019 bytes, lines 5041-5356
5041 5042 if (isNumber(format)) { 5043 index = format; 5044 format = undefined; 5045 } 5046 5047 format = format || ''; 5048 } 5049 5050 var locale = getLocale(), 5051 shift = localeSorted ? locale._week.dow : 0, 5052 i, 5053 out = []; 5054 5055 if (index != null) { 5056 return get$1(format, (index + shift) % 7, field, 'day'); 5057 } 5058 5059 for (i = 0; i < 7; i++) { 5060 out[i] = get$1(format, (i + shift) % 7, field, 'day'); 5061 } 5062 5063 return out; 5064 } 5065 5066 function listMonths(format, index) { 5067 return listMonthsImpl(format, index, 'months'); 5068 } 5069 5070 function listMonthsShort(format, index) { 5071 return listMonthsImpl(format, index, 'monthsShort'); 5072 } 5073 5074 function listWeekdays(localeSorted, format, index) { 5075 return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); 5076 } 5077 5078 function listWeekdaysShort(localeSorted, format, index) { 5079 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); 5080 } 5081 5082 function listWeekdaysMin(localeSorted, format, index) { 5083 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); 5084 } 5085 5086 getSetGlobalLocale('en', { 5087 eras: [{ 5088 since: '0001-01-01', 5089 until: +Infinity, 5090 offset: 1, 5091 name: 'Anno Domini', 5092 narrow: 'AD', 5093 abbr: 'AD' 5094 }, { 5095 since: '0000-12-31', 5096 until: -Infinity, 5097 offset: 1, 5098 name: 'Before Christ', 5099 narrow: 'BC', 5100 abbr: 'BC' 5101 }], 5102 dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, 5103 ordinal: function ordinal(number) { 5104 var b = number % 10, 5105 output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; 5106 return number + output; 5107 } 5108 }); // Side effect imports 5109 5110 hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); 5111 hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); 5112 var mathAbs = Math.abs; 5113 5114 function abs() { 5115 var data = this._data; 5116 this._milliseconds = mathAbs(this._milliseconds); 5117 this._days = mathAbs(this._days); 5118 this._months = mathAbs(this._months); 5119 data.milliseconds = mathAbs(data.milliseconds); 5120 data.seconds = mathAbs(data.seconds); 5121 data.minutes = mathAbs(data.minutes); 5122 data.hours = mathAbs(data.hours); 5123 data.months = mathAbs(data.months); 5124 data.years = mathAbs(data.years); 5125 return this; 5126 } 5127 5128 function addSubtract$1(duration, input, value, direction) { 5129 var other = createDuration(input, value); 5130 duration._milliseconds += direction * other._milliseconds; 5131 duration._days += direction * other._days; 5132 duration._months += direction * other._months; 5133 return duration._bubble(); 5134 } // supports only 2.0-style add(1, 's') or add(duration) 5135 5136 5137 function add$1(input, value) { 5138 return addSubtract$1(this, input, value, 1); 5139 } // supports only 2.0-style subtract(1, 's') or subtract(duration) 5140 5141 5142 function subtract$1(input, value) { 5143 return addSubtract$1(this, input, value, -1); 5144 } 5145 5146 function absCeil(number) { 5147 if (number < 0) { 5148 return Math.floor(number); 5149 } else { 5150 return Math.ceil(number); 5151 } 5152 } 5153 5154 function bubble() { 5155 var milliseconds = this._milliseconds, 5156 days = this._days, 5157 months = this._months, 5158 data = this._data, 5159 seconds, 5160 minutes, 5161 hours, 5162 years, 5163 monthsFromDays; // if we have a mix of positive and negative values, bubble down first 5164 // check: https://github.com/moment/moment/issues/2166 5165 5166 if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) { 5167 milliseconds += absCeil(monthsToDays(months) + days) * 864e5; 5168 days = 0; 5169 months = 0; 5170 } // The following code bubbles up values, see the tests for 5171 // examples of what that means. 5172 5173 5174 data.milliseconds = milliseconds % 1000; 5175 seconds = absFloor(milliseconds / 1000); 5176 data.seconds = seconds % 60; 5177 minutes = absFloor(seconds / 60); 5178 data.minutes = minutes % 60; 5179 hours = absFloor(minutes / 60); 5180 data.hours = hours % 24; 5181 days += absFloor(hours / 24); // convert days to months 5182 5183 monthsFromDays = absFloor(daysToMonths(days)); 5184 months += monthsFromDays; 5185 days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year 5186 5187 years = absFloor(months / 12); 5188 months %= 12; 5189 data.days = days; 5190 data.months = months; 5191 data.years = years; 5192 return this; 5193 } 5194 5195 function daysToMonths(days) { 5196 // 400 years have 146097 days (taking into account leap year rules) 5197 // 400 years have 12 months === 4800 5198 return days * 4800 / 146097; 5199 } 5200 5201 function monthsToDays(months) { 5202 // the reverse of daysToMonths 5203 return months * 146097 / 4800; 5204 } 5205 5206 function as(units) { 5207 if (!this.isValid()) { 5208 return NaN; 5209 } 5210 5211 var days, 5212 months, 5213 milliseconds = this._milliseconds; 5214 units = normalizeUnits(units); 5215 5216 if (units === 'month' || units === 'quarter' || units === 'year') { 5217 days = this._days + milliseconds / 864e5; 5218 months = this._months + daysToMonths(days); 5219 5220 switch (units) { 5221 case 'month': 5222 return months; 5223 5224 case 'quarter': 5225 return months / 3; 5226 5227 case 'year': 5228 return months / 12; 5229 } 5230 } else { 5231 // handle milliseconds separately because of floating point math errors (issue #1867) 5232 days = this._days + Math.round(monthsToDays(this._months)); 5233 5234 switch (units) { 5235 case 'week': 5236 return days / 7 + milliseconds / 6048e5; 5237 5238 case 'day': 5239 return days + milliseconds / 864e5; 5240 5241 case 'hour': 5242 return days * 24 + milliseconds / 36e5; 5243 5244 case 'minute': 5245 return days * 1440 + milliseconds / 6e4; 5246 5247 case 'second': 5248 return days * 86400 + milliseconds / 1000; 5249 // Math.floor prevents floating point math errors here 5250 5251 case 'millisecond': 5252 return Math.floor(days * 864e5) + milliseconds; 5253 5254 default: 5255 throw new Error('Unknown unit ' + units); 5256 } 5257 } 5258 } // TODO: Use this.as('ms')? 5259 5260 5261 function valueOf$1() { 5262 if (!this.isValid()) { 5263 return NaN; 5264 } 5265 5266 return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6; 5267 } 5268 5269 function makeAs(alias) { 5270 return function () { 5271 return this.as(alias); 5272 }; 5273 } 5274 5275 var asMilliseconds = makeAs('ms'), 5276 asSeconds = makeAs('s'), 5277 asMinutes = makeAs('m'), 5278 asHours = makeAs('h'), 5279 asDays = makeAs('d'), 5280 asWeeks = makeAs('w'), 5281 asMonths = makeAs('M'), 5282 asQuarters = makeAs('Q'), 5283 asYears = makeAs('y'); 5284 5285 function clone$1() { 5286 return createDuration(this); 5287 } 5288 5289 function get$2(units) { 5290 units = normalizeUnits(units); 5291 return this.isValid() ? this[units + 's']() : NaN; 5292 } 5293 5294 function makeGetter(name) { 5295 return function () { 5296 return this.isValid() ? this._data[name] : NaN; 5297 }; 5298 } 5299 5300 var milliseconds = makeGetter('milliseconds'), 5301 seconds = makeGetter('seconds'), 5302 minutes = makeGetter('minutes'), 5303 hours = makeGetter('hours'), 5304 days = makeGetter('days'), 5305 months = makeGetter('months'), 5306 years = makeGetter('years'); 5307 5308 function weeks() { 5309 return absFloor(this.days() / 7); 5310 } 5311 5312 var round = Math.round, 5313 thresholds = { 5314 ss: 44, 5315 // a few seconds to seconds 5316 s: 45, 5317 // seconds to minute 5318 m: 45, 5319 // minutes to hour 5320 h: 22, 5321 // hours to day 5322 d: 26, 5323 // days to month/week 5324 w: null, 5325 // weeks to month 5326 M: 11 // months to year 5327 5328 }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize 5329 5330 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { 5331 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); 5332 } 5333 5334 function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { 5335 var duration = createDuration(posNegDuration).abs(), 5336 seconds = round(duration.as('s')), 5337 minutes = round(duration.as('m')), 5338 hours = round(duration.as('h')), 5339 days = round(duration.as('d')), 5340 months = round(duration.as('M')), 5341 weeks = round(duration.as('w')), 5342 years = round(duration.as('y')), 5343 a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days]; 5344 5345 if (thresholds.w != null) { 5346 a = a || weeks <= 1 && ['w'] || weeks < thresholds.w && ['ww', weeks]; 5347 } 5348 5349 a = a || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years]; 5350 a[2] = withoutSuffix; 5351 a[3] = +posNegDuration > 0; 5352 a[4] = locale; 5353 return substituteTimeAgo.apply(null, a); 5354 } // This function allows you to set the rounding function for relative time strings 5355 5356
vendor: 8,386 bytes, lines 5357-5628
5357 function getSetRelativeTimeRounding(roundingFunction) { 5358 if (roundingFunction === undefined) { 5359 return round; 5360 } 5361 5362 if (typeof roundingFunction === 'function') { 5363 round = roundingFunction; 5364 return true; 5365 } 5366 5367 return false; 5368 } // This function allows you to set a threshold for relative time strings 5369 5370 5371 function getSetRelativeTimeThreshold(threshold, limit) { 5372 if (thresholds[threshold] === undefined) { 5373 return false; 5374 } 5375 5376 if (limit === undefined) { 5377 return thresholds[threshold]; 5378 } 5379 5380 thresholds[threshold] = limit; 5381 5382 if (threshold === 's') { 5383 thresholds.ss = limit - 1; 5384 } 5385 5386 return true; 5387 } 5388 5389 function humanize(argWithSuffix, argThresholds) { 5390 if (!this.isValid()) { 5391 return this.localeData().invalidDate(); 5392 } 5393 5394 var withSuffix = false, 5395 th = thresholds, 5396 locale, 5397 output; 5398 5399 if (typeof argWithSuffix === 'object') { 5400 argThresholds = argWithSuffix; 5401 argWithSuffix = false; 5402 } 5403 5404 if (typeof argWithSuffix === 'boolean') { 5405 withSuffix = argWithSuffix; 5406 } 5407 5408 if (typeof argThresholds === 'object') { 5409 th = Object.assign({}, thresholds, argThresholds); 5410 5411 if (argThresholds.s != null && argThresholds.ss == null) { 5412 th.ss = argThresholds.s - 1; 5413 } 5414 } 5415 5416 locale = this.localeData(); 5417 output = relativeTime$1(this, !withSuffix, th, locale); 5418 5419 if (withSuffix) { 5420 output = locale.pastFuture(+this, output); 5421 } 5422 5423 return locale.postformat(output); 5424 } 5425 5426 var abs$1 = Math.abs; 5427 5428 function sign(x) { 5429 return (x > 0) - (x < 0) || +x; 5430 } 5431 5432 function toISOString$1() { 5433 // for ISO strings we do not use the normal bubbling rules: 5434 // * milliseconds bubble up until they become hours 5435 // * days do not bubble at all 5436 // * months bubble up until they become years 5437 // This is because there is no context-free conversion between hours and days 5438 // (think of clock changes) 5439 // and also not between days and months (28-31 days per month) 5440 if (!this.isValid()) { 5441 return this.localeData().invalidDate(); 5442 } 5443 5444 var seconds = abs$1(this._milliseconds) / 1000, 5445 days = abs$1(this._days), 5446 months = abs$1(this._months), 5447 minutes, 5448 hours, 5449 years, 5450 s, 5451 total = this.asSeconds(), 5452 totalSign, 5453 ymSign, 5454 daysSign, 5455 hmsSign; 5456 5457 if (!total) { 5458 // this is the same as C#'s (Noda) and python (isodate)... 5459 // but not other JS (goog.date) 5460 return 'P0D'; 5461 } // 3600 seconds -> 60 minutes -> 1 hour 5462 5463 5464 minutes = absFloor(seconds / 60); 5465 hours = absFloor(minutes / 60); 5466 seconds %= 60; 5467 minutes %= 60; // 12 months -> 1 year 5468 5469 years = absFloor(months / 12); 5470 months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js 5471 5472 s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; 5473 totalSign = total < 0 ? '-' : ''; 5474 ymSign = sign(this._months) !== sign(total) ? '-' : ''; 5475 daysSign = sign(this._days) !== sign(total) ? '-' : ''; 5476 hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; 5477 return totalSign + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : ''); 5478 } 5479 5480 var proto$2 = Duration.prototype; 5481 proto$2.isValid = isValid$1; 5482 proto$2.abs = abs; 5483 proto$2.add = add$1; 5484 proto$2.subtract = subtract$1; 5485 proto$2.as = as; 5486 proto$2.asMilliseconds = asMilliseconds; 5487 proto$2.asSeconds = asSeconds; 5488 proto$2.asMinutes = asMinutes; 5489 proto$2.asHours = asHours; 5490 proto$2.asDays = asDays; 5491 proto$2.asWeeks = asWeeks; 5492 proto$2.asMonths = asMonths; 5493 proto$2.asQuarters = asQuarters; 5494 proto$2.asYears = asYears; 5495 proto$2.valueOf = valueOf$1; 5496 proto$2._bubble = bubble; 5497 proto$2.clone = clone$1; 5498 proto$2.get = get$2; 5499 proto$2.milliseconds = milliseconds; 5500 proto$2.seconds = seconds; 5501 proto$2.minutes = minutes; 5502 proto$2.hours = hours; 5503 proto$2.days = days; 5504 proto$2.weeks = weeks; 5505 proto$2.months = months; 5506 proto$2.years = years; 5507 proto$2.humanize = humanize; 5508 proto$2.toISOString = toISOString$1; 5509 proto$2.toString = toISOString$1; 5510 proto$2.toJSON = toISOString$1; 5511 proto$2.locale = locale; 5512 proto$2.localeData = localeData; 5513 proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); 5514 proto$2.lang = lang; // FORMATTING 5515 5516 addFormatToken('X', 0, 0, 'unix'); 5517 addFormatToken('x', 0, 0, 'valueOf'); // PARSING 5518 5519 addRegexToken('x', matchSigned); 5520 addRegexToken('X', matchTimestamp); 5521 addParseToken('X', function (input, array, config) { 5522 config._d = new Date(parseFloat(input) * 1000); 5523 }); 5524 addParseToken('x', function (input, array, config) { 5525 config._d = new Date(toInt(input)); 5526 }); //! moment.js 5527 5528 hooks.version = '2.29.4'; 5529 setHookCallback(createLocal); 5530 hooks.fn = proto; 5531 hooks.min = min; 5532 hooks.max = max; 5533 hooks.now = now; 5534 hooks.utc = createUTC; 5535 hooks.unix = createUnix; 5536 hooks.months = listMonths; 5537 hooks.isDate = isDate; 5538 hooks.locale = getSetGlobalLocale; 5539 hooks.invalid = createInvalid; 5540 hooks.duration = createDuration; 5541 hooks.isMoment = isMoment; 5542 hooks.weekdays = listWeekdays; 5543 hooks.parseZone = createInZone; 5544 hooks.localeData = getLocale; 5545 hooks.isDuration = isDuration; 5546 hooks.monthsShort = listMonthsShort; 5547 hooks.weekdaysMin = listWeekdaysMin; 5548 hooks.defineLocale = defineLocale; 5549 hooks.updateLocale = updateLocale; 5550 hooks.locales = listLocales; 5551 hooks.weekdaysShort = listWeekdaysShort; 5552 hooks.normalizeUnits = normalizeUnits; 5553 hooks.relativeTimeRounding = getSetRelativeTimeRounding; 5554 hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; 5555 hooks.calendarFormat = getCalendarFormat; 5556 hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats 5557 5558 hooks.HTML5_FMT = { 5559 DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', 5560 // <input type="datetime-local" /> 5561 DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', 5562 // <input type="datetime-local" step="1" /> 5563 DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', 5564 // <input type="datetime-local" step="0.001" /> 5565 DATE: 'YYYY-MM-DD', 5566 // <input type="date" /> 5567 TIME: 'HH:mm', 5568 // <input type="time" /> 5569 TIME_SECONDS: 'HH:mm:ss', 5570 // <input type="time" step="1" /> 5571 TIME_MS: 'HH:mm:ss.SSS', 5572 // <input type="time" step="0.001" /> 5573 WEEK: 'GGGG-[W]WW', 5574 // <input type="week" /> 5575 MONTH: 'YYYY-MM' // <input type="month" /> 5576 5577 }; 5578 return hooks; 5579}); 5580/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(486)(module))) 5581 5582/***/ }), 5583 5584/***/ 564: 5585/***/ (function(module, __webpack_exports__, __webpack_require__) { 5586 5587"use strict"; 5588/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); 5589/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 5590/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(54); 5591/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2); 5592/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); 5593 5594 5595 5596 5597var MAX_SIGNED_31_BIT_INT = 1073741823; 5598var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; 5599 5600function getUniqueId() { 5601 var key = '__global_unique_id__'; 5602 return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1; 5603} 5604 5605function objectIs(x, y) { 5606 if (x === y) { 5607 return x !== 0 || 1 / x === 1 / y; 5608 } else { 5609 return x !== x && y !== y; 5610 } 5611} 5612 5613function createEventEmitter(value) { 5614 var handlers = []; 5615 return { 5616 on: function on(handler) { 5617 handlers.push(handler); 5618 }, 5619 off: function off(handler) { 5620 handlers = handlers.filter(function (h) { 5621 return h !== handler; 5622 }); 5623 }, 5624 get: function get() { 5625 return value; 5626 }, 5627 set: function set(newValue, changedBits) { 5628 value = newValue;
5629 handlers.forEach(function (handler) { 5630 return handler(value, changedBits); 5631 }); 5632 } 5633 }; 5634} 5635 5636function onlyChild(children) { 5637 return Array.isArray(children) ? children[0] : children; 5638} 5639 5640function createReactContext(defaultValue, calculateChangedBits) { 5641 var _Provider$childContex, _Consumer$contextType; 5642 5643 var contextProp = '__create-react-context-' + getUniqueId() + '__'; 5644 5645 var Provider = /*#__PURE__*/function (_Component) { 5646 Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Provider, _Component); 5647 5648 function Provider() { 5649 var _this; 5650 5651 _this = _Component.apply(this, arguments) || this; 5652 _this.emitter = createEventEmitter(_this.props.value); 5653 return _this; 5654 } 5655 5656 var _proto = Provider.prototype; 5657 5658 _proto.getChildContext = function getChildContext() { 5659 var _ref; 5660 5661 return _ref = {}, _ref[contextProp] = this.emitter, _ref; 5662 }; 5663 5664 _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { 5665 if (this.props.value !== nextProps.value) { 5666 var oldValue = this.props.value; 5667 var newValue = nextProps.value; 5668 var changedBits; 5669 5670 if (objectIs(oldValue, newValue)) { 5671 changedBits = 0; 5672 } else { 5673 changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; 5674 5675 if (false) {} 5676 5677 changedBits |= 0; 5678 5679 if (changedBits !== 0) { 5680 this.emitter.set(nextProps.value, changedBits); 5681 } 5682 } 5683 } 5684 }; 5685 5686 _proto.render = function render() { 5687 return this.props.children; 5688 }; 5689 5690 return Provider; 5691 }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); 5692 5693 Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object.isRequired, _Provider$childContex); 5694 5695 var Consumer = /*#__PURE__*/function (_Component2) { 5696 Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Consumer, _Component2); 5697 5698 function Consumer() { 5699 var _this2; 5700 5701 _this2 = _Component2.apply(this, arguments) || this; 5702 _this2.state = { 5703 value: _this2.getValue() 5704 }; 5705 5706 _this2.onUpdate = function (newValue, changedBits) { 5707 var observedBits = _this2.observedBits | 0; 5708 5709 if ((observedBits & changedBits) !== 0) { 5710 _this2.setState({ 5711 value: _this2.getValue() 5712 }); 5713 } 5714 }; 5715 5716 return _this2; 5717 } 5718 5719 var _proto2 = Consumer.prototype; 5720 5721 _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { 5722 var observedBits = nextProps.observedBits; 5723 this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; 5724 }; 5725 5726 _proto2.componentDidMount = function componentDidMount() { 5727 if (this.context[contextProp]) { 5728 this.context[contextProp].on(this.onUpdate); 5729 } 5730 5731 var observedBits = this.props.observedBits; 5732 this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; 5733 }; 5734 5735 _proto2.componentWillUnmount = function componentWillUnmount() { 5736 if (this.context[contextProp]) { 5737 this.context[contextProp].off(this.onUpdate); 5738 } 5739 }; 5740 5741 _proto2.getValue = function getValue() { 5742 if (this.context[contextProp]) { 5743 return this.context[contextProp].get(); 5744 } else { 5745 return defaultValue; 5746 } 5747 }; 5748 5749 _proto2.render = function render() { 5750 return onlyChild(this.props.children)(this.state.value); 5751 }; 5752 5753 return Consumer; 5754 }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); 5755 5756 Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object, _Consumer$contextType); 5757 return { 5758 Provider: Provider, 5759 Consumer: Consumer 5760 }; 5761} 5762 5763var index = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext || createReactContext; 5764/* harmony default export */ __webpack_exports__["a"] = (index); 5765/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(108))) 5766 5767/***/ }), 5768 5769/***/ 764: 5770/***/ (function(module, exports, __webpack_require__) { 5771 5772// extracted by mini-css-extract-plugin 5773 5774/***/ }), 5775 5776/***/ 774:
vendor: 2,478 bytes, lines 5777-5887
5777/***/ (function(module, exports) { 5778 5779module.exports = Array.isArray || function (arr) { 5780 return Object.prototype.toString.call(arr) == '[object Array]'; 5781}; 5782 5783/***/ }), 5784 5785/***/ 96: 5786/***/ (function(module, exports, __webpack_require__) { 5787 5788"use strict"; 5789/* 5790object-assign 5791(c) Sindre Sorhus 5792@license MIT 5793*/ 5794 5795/* eslint-disable no-unused-vars */ 5796 5797var getOwnPropertySymbols = Object.getOwnPropertySymbols; 5798var hasOwnProperty = Object.prototype.hasOwnProperty; 5799var propIsEnumerable = Object.prototype.propertyIsEnumerable; 5800 5801function toObject(val) { 5802 if (val === null || val === undefined) { 5803 throw new TypeError('Object.assign cannot be called with null or undefined'); 5804 } 5805 5806 return Object(val); 5807} 5808 5809function shouldUseNative() { 5810 try { 5811 if (!Object.assign) { 5812 return false; 5813 } // Detect buggy property enumeration order in older V8 versions. 5814 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 5815 5816 5817 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 5818 5819 test1[5] = 'de'; 5820 5821 if (Object.getOwnPropertyNames(test1)[0] === '5') { 5822 return false; 5823 } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 5824 5825 5826 var test2 = {}; 5827 5828 for (var i = 0; i < 10; i++) { 5829 test2['_' + String.fromCharCode(i)] = i; 5830 } 5831 5832 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 5833 return test2[n]; 5834 }); 5835 5836 if (order2.join('') !== '0123456789') { 5837 return false; 5838 } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 5839 5840 5841 var test3 = {}; 5842 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 5843 test3[letter] = letter; 5844 }); 5845 5846 if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { 5847 return false; 5848 } 5849 5850 return true; 5851 } catch (err) { 5852 // We don't expect any of the above to throw, but better to be safe. 5853 return false; 5854 } 5855} 5856 5857module.exports = shouldUseNative() ? Object.assign : function (target, source) { 5858 var from; 5859 var to = toObject(target); 5860 var symbols; 5861 5862 for (var s = 1; s < arguments.length; s++) { 5863 from = Object(arguments[s]); 5864 5865 for (var key in from) { 5866 if (hasOwnProperty.call(from, key)) { 5867 to[key] = from[key]; 5868 } 5869 } 5870 5871 if (getOwnPropertySymbols) { 5872 symbols = getOwnPropertySymbols(from); 5873 5874 for (var i = 0; i < symbols.length; i++) { 5875 if (propIsEnumerable.call(from, symbols[i])) { 5876 to[symbols[i]] = from[symbols[i]]; 5877 } 5878 } 5879 } 5880 } 5881 5882 return to; 5883}; 5884 5885/***/ }) 5886 5887}]);
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.