PageSourceSearch

https://vam-prodam.ru/resources/view/web/assets/vendors/moment/moment.js

js vam-prodam.ru collected 2026-10-10 02:23:14 UTC 182,117 bytes, 5,686 lines download raw bytes

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

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.