@ms-atlas/datastudio 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @ms-atlas/datastudio might be problematic. Click here for more details.

Files changed (39) hide show
  1. package/ExternalLibraries/Monaco/vs/loader.js +2166 -0
  2. package/ExternalLibraries/URI.min.js +1901 -0
  3. package/ExternalLibraries/crossroads.min.js +453 -0
  4. package/ExternalLibraries/css.js +165 -0
  5. package/ExternalLibraries/d3.min.js +10857 -0
  6. package/ExternalLibraries/es6-promise.min.js +363 -0
  7. package/ExternalLibraries/hammer.js +2224 -0
  8. package/ExternalLibraries/hull.js +444 -0
  9. package/ExternalLibraries/i18n.min.js +115 -0
  10. package/ExternalLibraries/jquery-ui-timepicker-addon.min.css +76 -0
  11. package/ExternalLibraries/jquery-ui-timepicker-addon.min.js +1918 -0
  12. package/ExternalLibraries/jquery-ui.js +17201 -0
  13. package/ExternalLibraries/jquery-ui.min.css +1454 -0
  14. package/ExternalLibraries/jquery.history.js +2173 -0
  15. package/ExternalLibraries/jquery.min.js +5168 -0
  16. package/ExternalLibraries/jquery.mockjax.min.js +445 -0
  17. package/ExternalLibraries/jquery.modal.js +173 -0
  18. package/ExternalLibraries/jstree.js +10086 -0
  19. package/ExternalLibraries/jstree.style.css +1048 -0
  20. package/ExternalLibraries/jwt-decode.min.js +142 -0
  21. package/ExternalLibraries/knockout-latest.debug.js +7375 -0
  22. package/ExternalLibraries/knockout.mapping.min.js +534 -0
  23. package/ExternalLibraries/moment.js +3389 -0
  24. package/ExternalLibraries/q.js +1974 -0
  25. package/ExternalLibraries/require.js +2230 -0
  26. package/ExternalLibraries/signals.min.js +179 -0
  27. package/ExternalLibraries/text.js +445 -0
  28. package/ExternalLibraries/uuid.js +274 -0
  29. package/app-main.js +1 -0
  30. package/datastudio.application.mainpage.js +1502 -0
  31. package/datastudio.application.shared.js +626 -0
  32. package/datastudio.bootstrapper.js +517 -0
  33. package/fonts.css +14 -0
  34. package/nls/resx.js +1 -0
  35. package/nls/root/resx.js +22 -0
  36. package/package.json +22 -0
  37. package/scripts/application/sourceMapper.js +15 -0
  38. package/scripts/libs/adal/adal.js +720 -0
  39. package/stylesheets/main.css +8879 -0
@@ -0,0 +1,3389 @@
1
+ //! moment.js
2
+ //! version : 2.10.3
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"
9
+ ? (module.exports = factory())
10
+ : typeof define === "function" && define.amd
11
+ ? define(factory)
12
+ : (global.moment = factory());
13
+ })(this, function () {
14
+ "use strict";
15
+
16
+ var hookCallback;
17
+
18
+ function utils_hooks__hooks() {
19
+ return hookCallback.apply(null, arguments);
20
+ }
21
+
22
+ // This is done to register the method called with moment()
23
+ // without creating circular dependencies.
24
+ function setHookCallback(callback) {
25
+ hookCallback = callback;
26
+ }
27
+
28
+ function isArray(input) {
29
+ return Object.prototype.toString.call(input) === "[object Array]";
30
+ }
31
+
32
+ function isDate(input) {
33
+ return (
34
+ input instanceof Date ||
35
+ Object.prototype.toString.call(input) === "[object Date]"
36
+ );
37
+ }
38
+
39
+ function map(arr, fn) {
40
+ var res = [],
41
+ i;
42
+ for (i = 0; i < arr.length; ++i) {
43
+ res.push(fn(arr[i], i));
44
+ }
45
+ return res;
46
+ }
47
+
48
+ function hasOwnProp(a, b) {
49
+ return Object.prototype.hasOwnProperty.call(a, b);
50
+ }
51
+
52
+ function extend(a, b) {
53
+ for (var i in b) {
54
+ if (hasOwnProp(b, i)) {
55
+ a[i] = b[i];
56
+ }
57
+ }
58
+
59
+ if (hasOwnProp(b, "toString")) {
60
+ a.toString = b.toString;
61
+ }
62
+
63
+ if (hasOwnProp(b, "valueOf")) {
64
+ a.valueOf = b.valueOf;
65
+ }
66
+
67
+ return a;
68
+ }
69
+
70
+ function create_utc__createUTC(input, format, locale, strict) {
71
+ return createLocalOrUTC(input, format, locale, strict, true).utc();
72
+ }
73
+
74
+ function defaultParsingFlags() {
75
+ // We need to deep clone this object.
76
+ return {
77
+ empty: false,
78
+ unusedTokens: [],
79
+ unusedInput: [],
80
+ overflow: -2,
81
+ charsLeftOver: 0,
82
+ nullInput: false,
83
+ invalidMonth: null,
84
+ invalidFormat: false,
85
+ userInvalidated: false,
86
+ iso: false,
87
+ };
88
+ }
89
+
90
+ function getParsingFlags(m) {
91
+ if (m._pf == null) {
92
+ m._pf = defaultParsingFlags();
93
+ }
94
+ return m._pf;
95
+ }
96
+
97
+ function valid__isValid(m) {
98
+ if (m._isValid == null) {
99
+ var flags = getParsingFlags(m);
100
+ m._isValid =
101
+ !isNaN(m._d.getTime()) &&
102
+ flags.overflow < 0 &&
103
+ !flags.empty &&
104
+ !flags.invalidMonth &&
105
+ !flags.nullInput &&
106
+ !flags.invalidFormat &&
107
+ !flags.userInvalidated;
108
+
109
+ if (m._strict) {
110
+ m._isValid =
111
+ m._isValid &&
112
+ flags.charsLeftOver === 0 &&
113
+ flags.unusedTokens.length === 0 &&
114
+ flags.bigHour === undefined;
115
+ }
116
+ }
117
+ return m._isValid;
118
+ }
119
+
120
+ function valid__createInvalid(flags) {
121
+ var m = create_utc__createUTC(NaN);
122
+ if (flags != null) {
123
+ extend(getParsingFlags(m), flags);
124
+ } else {
125
+ getParsingFlags(m).userInvalidated = true;
126
+ }
127
+
128
+ return m;
129
+ }
130
+
131
+ var momentProperties = (utils_hooks__hooks.momentProperties = []);
132
+
133
+ function copyConfig(to, from) {
134
+ var i, prop, val;
135
+
136
+ if (typeof from._isAMomentObject !== "undefined") {
137
+ to._isAMomentObject = from._isAMomentObject;
138
+ }
139
+ if (typeof from._i !== "undefined") {
140
+ to._i = from._i;
141
+ }
142
+ if (typeof from._f !== "undefined") {
143
+ to._f = from._f;
144
+ }
145
+ if (typeof from._l !== "undefined") {
146
+ to._l = from._l;
147
+ }
148
+ if (typeof from._strict !== "undefined") {
149
+ to._strict = from._strict;
150
+ }
151
+ if (typeof from._tzm !== "undefined") {
152
+ to._tzm = from._tzm;
153
+ }
154
+ if (typeof from._isUTC !== "undefined") {
155
+ to._isUTC = from._isUTC;
156
+ }
157
+ if (typeof from._offset !== "undefined") {
158
+ to._offset = from._offset;
159
+ }
160
+ if (typeof from._pf !== "undefined") {
161
+ to._pf = getParsingFlags(from);
162
+ }
163
+ if (typeof from._locale !== "undefined") {
164
+ to._locale = from._locale;
165
+ }
166
+
167
+ if (momentProperties.length > 0) {
168
+ for (i in momentProperties) {
169
+ prop = momentProperties[i];
170
+ val = from[prop];
171
+ if (typeof val !== "undefined") {
172
+ to[prop] = val;
173
+ }
174
+ }
175
+ }
176
+
177
+ return to;
178
+ }
179
+
180
+ var updateInProgress = false;
181
+
182
+ // Moment prototype object
183
+ function Moment(config) {
184
+ copyConfig(this, config);
185
+ this._d = new Date(+config._d);
186
+ // Prevent infinite loop in case updateOffset creates new moment
187
+ // objects.
188
+ if (updateInProgress === false) {
189
+ updateInProgress = true;
190
+ utils_hooks__hooks.updateOffset(this);
191
+ updateInProgress = false;
192
+ }
193
+ }
194
+
195
+ function isMoment(obj) {
196
+ return (
197
+ obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
198
+ );
199
+ }
200
+
201
+ function toInt(argumentForCoercion) {
202
+ var coercedNumber = +argumentForCoercion,
203
+ value = 0;
204
+
205
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
206
+ if (coercedNumber >= 0) {
207
+ value = Math.floor(coercedNumber);
208
+ } else {
209
+ value = Math.ceil(coercedNumber);
210
+ }
211
+ }
212
+
213
+ return value;
214
+ }
215
+
216
+ function compareArrays(array1, array2, dontConvert) {
217
+ var len = Math.min(array1.length, array2.length),
218
+ lengthDiff = Math.abs(array1.length - array2.length),
219
+ diffs = 0,
220
+ i;
221
+ for (i = 0; i < len; i++) {
222
+ if (
223
+ (dontConvert && array1[i] !== array2[i]) ||
224
+ (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
225
+ ) {
226
+ diffs++;
227
+ }
228
+ }
229
+ return diffs + lengthDiff;
230
+ }
231
+
232
+ function Locale() {}
233
+
234
+ var locales = {};
235
+ var globalLocale;
236
+
237
+ function normalizeLocale(key) {
238
+ return key ? key.toLowerCase().replace("_", "-") : key;
239
+ }
240
+
241
+ // pick the locale from the array
242
+ // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
243
+ // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
244
+ function chooseLocale(names) {
245
+ var i = 0,
246
+ j,
247
+ next,
248
+ locale,
249
+ split;
250
+
251
+ while (i < names.length) {
252
+ split = normalizeLocale(names[i]).split("-");
253
+ j = split.length;
254
+ next = normalizeLocale(names[i + 1]);
255
+ next = next ? next.split("-") : null;
256
+ while (j > 0) {
257
+ locale = loadLocale(split.slice(0, j).join("-"));
258
+ if (locale) {
259
+ return locale;
260
+ }
261
+ if (
262
+ next &&
263
+ next.length >= j &&
264
+ compareArrays(split, next, true) >= j - 1
265
+ ) {
266
+ //the next array item is better than a shallower substring of this one
267
+ break;
268
+ }
269
+ j--;
270
+ }
271
+ i++;
272
+ }
273
+ return null;
274
+ }
275
+
276
+ function loadLocale(name) {
277
+ var oldLocale = null;
278
+ // TODO: Find a better way to register and load all the locales in Node
279
+ if (
280
+ !locales[name] &&
281
+ typeof module !== "undefined" &&
282
+ module &&
283
+ module.exports
284
+ ) {
285
+ try {
286
+ oldLocale = globalLocale._abbr;
287
+ require("./locale/" + name);
288
+ // because defineLocale currently also sets the global locale, we
289
+ // want to undo that for lazy loaded locales
290
+ locale_locales__getSetGlobalLocale(oldLocale);
291
+ } catch (e) {}
292
+ }
293
+ return locales[name];
294
+ }
295
+
296
+ // This function will load locale and then set the global locale. If
297
+ // no arguments are passed in, it will simply return the current global
298
+ // locale key.
299
+ function locale_locales__getSetGlobalLocale(key, values) {
300
+ var data;
301
+ if (key) {
302
+ if (typeof values === "undefined") {
303
+ data = locale_locales__getLocale(key);
304
+ } else {
305
+ data = defineLocale(key, values);
306
+ }
307
+
308
+ if (data) {
309
+ // moment.duration._locale = moment._locale = data;
310
+ globalLocale = data;
311
+ }
312
+ }
313
+
314
+ return globalLocale._abbr;
315
+ }
316
+
317
+ function defineLocale(name, values) {
318
+ if (values !== null) {
319
+ values.abbr = name;
320
+ if (!locales[name]) {
321
+ locales[name] = new Locale();
322
+ }
323
+ locales[name].set(values);
324
+
325
+ // backwards compat for now: also set the locale
326
+ locale_locales__getSetGlobalLocale(name);
327
+
328
+ return locales[name];
329
+ } else {
330
+ // useful for testing
331
+ delete locales[name];
332
+ return null;
333
+ }
334
+ }
335
+
336
+ // returns locale data
337
+ function locale_locales__getLocale(key) {
338
+ var locale;
339
+
340
+ if (key && key._locale && key._locale._abbr) {
341
+ key = key._locale._abbr;
342
+ }
343
+
344
+ if (!key) {
345
+ return globalLocale;
346
+ }
347
+
348
+ if (!isArray(key)) {
349
+ //short-circuit everything else
350
+ locale = loadLocale(key);
351
+ if (locale) {
352
+ return locale;
353
+ }
354
+ key = [key];
355
+ }
356
+
357
+ return chooseLocale(key);
358
+ }
359
+
360
+ var aliases = {};
361
+
362
+ function addUnitAlias(unit, shorthand) {
363
+ var lowerCase = unit.toLowerCase();
364
+ aliases[lowerCase] = aliases[lowerCase + "s"] = aliases[shorthand] = unit;
365
+ }
366
+
367
+ function normalizeUnits(units) {
368
+ return typeof units === "string"
369
+ ? aliases[units] || aliases[units.toLowerCase()]
370
+ : undefined;
371
+ }
372
+
373
+ function normalizeObjectUnits(inputObject) {
374
+ var normalizedInput = {},
375
+ normalizedProp,
376
+ prop;
377
+
378
+ for (prop in inputObject) {
379
+ if (hasOwnProp(inputObject, prop)) {
380
+ normalizedProp = normalizeUnits(prop);
381
+ if (normalizedProp) {
382
+ normalizedInput[normalizedProp] = inputObject[prop];
383
+ }
384
+ }
385
+ }
386
+
387
+ return normalizedInput;
388
+ }
389
+
390
+ function makeGetSet(unit, keepTime) {
391
+ return function (value) {
392
+ if (value != null) {
393
+ get_set__set(this, unit, value);
394
+ utils_hooks__hooks.updateOffset(this, keepTime);
395
+ return this;
396
+ } else {
397
+ return get_set__get(this, unit);
398
+ }
399
+ };
400
+ }
401
+
402
+ function get_set__get(mom, unit) {
403
+ return mom._d["get" + (mom._isUTC ? "UTC" : "") + unit]();
404
+ }
405
+
406
+ function get_set__set(mom, unit, value) {
407
+ return mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value);
408
+ }
409
+
410
+ // MOMENTS
411
+
412
+ function getSet(units, value) {
413
+ var unit;
414
+ if (typeof units === "object") {
415
+ for (unit in units) {
416
+ this.set(unit, units[unit]);
417
+ }
418
+ } else {
419
+ units = normalizeUnits(units);
420
+ if (typeof this[units] === "function") {
421
+ return this[units](value);
422
+ }
423
+ }
424
+ return this;
425
+ }
426
+
427
+ function zeroFill(number, targetLength, forceSign) {
428
+ var output = "" + Math.abs(number),
429
+ sign = number >= 0;
430
+
431
+ while (output.length < targetLength) {
432
+ output = "0" + output;
433
+ }
434
+ return (sign ? (forceSign ? "+" : "") : "-") + output;
435
+ }
436
+
437
+ var formattingTokens =
438
+ /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g;
439
+
440
+ var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
441
+
442
+ var formatFunctions = {};
443
+
444
+ var formatTokenFunctions = {};
445
+
446
+ // token: 'M'
447
+ // padded: ['MM', 2]
448
+ // ordinal: 'Mo'
449
+ // callback: function () { this.month() + 1 }
450
+ function addFormatToken(token, padded, ordinal, callback) {
451
+ var func = callback;
452
+ if (typeof callback === "string") {
453
+ func = function () {
454
+ return this[callback]();
455
+ };
456
+ }
457
+ if (token) {
458
+ formatTokenFunctions[token] = func;
459
+ }
460
+ if (padded) {
461
+ formatTokenFunctions[padded[0]] = function () {
462
+ return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
463
+ };
464
+ }
465
+ if (ordinal) {
466
+ formatTokenFunctions[ordinal] = function () {
467
+ return this.localeData().ordinal(func.apply(this, arguments), token);
468
+ };
469
+ }
470
+ }
471
+
472
+ function removeFormattingTokens(input) {
473
+ if (input.match(/\[[\s\S]/)) {
474
+ return input.replace(/^\[|\]$/g, "");
475
+ }
476
+ return input.replace(/\\/g, "");
477
+ }
478
+
479
+ function makeFormatFunction(format) {
480
+ var array = format.match(formattingTokens),
481
+ i,
482
+ length;
483
+
484
+ for (i = 0, length = array.length; i < length; i++) {
485
+ if (formatTokenFunctions[array[i]]) {
486
+ array[i] = formatTokenFunctions[array[i]];
487
+ } else {
488
+ array[i] = removeFormattingTokens(array[i]);
489
+ }
490
+ }
491
+
492
+ return function (mom) {
493
+ var output = "";
494
+ for (i = 0; i < length; i++) {
495
+ output +=
496
+ array[i] instanceof Function ? array[i].call(mom, format) : array[i];
497
+ }
498
+ return output;
499
+ };
500
+ }
501
+
502
+ // format date using native date object
503
+ function formatMoment(m, format) {
504
+ if (!m.isValid()) {
505
+ return m.localeData().invalidDate();
506
+ }
507
+
508
+ format = expandFormat(format, m.localeData());
509
+
510
+ if (!formatFunctions[format]) {
511
+ formatFunctions[format] = makeFormatFunction(format);
512
+ }
513
+
514
+ return formatFunctions[format](m);
515
+ }
516
+
517
+ function expandFormat(format, locale) {
518
+ var i = 5;
519
+
520
+ function replaceLongDateFormatTokens(input) {
521
+ return locale.longDateFormat(input) || input;
522
+ }
523
+
524
+ localFormattingTokens.lastIndex = 0;
525
+ while (i >= 0 && localFormattingTokens.test(format)) {
526
+ format = format.replace(
527
+ localFormattingTokens,
528
+ replaceLongDateFormatTokens
529
+ );
530
+ localFormattingTokens.lastIndex = 0;
531
+ i -= 1;
532
+ }
533
+
534
+ return format;
535
+ }
536
+
537
+ var match1 = /\d/; // 0 - 9
538
+ var match2 = /\d\d/; // 00 - 99
539
+ var match3 = /\d{3}/; // 000 - 999
540
+ var match4 = /\d{4}/; // 0000 - 9999
541
+ var match6 = /[+-]?\d{6}/; // -999999 - 999999
542
+ var match1to2 = /\d\d?/; // 0 - 99
543
+ var match1to3 = /\d{1,3}/; // 0 - 999
544
+ var match1to4 = /\d{1,4}/; // 0 - 9999
545
+ var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
546
+
547
+ var matchUnsigned = /\d+/; // 0 - inf
548
+ var matchSigned = /[+-]?\d+/; // -inf - inf
549
+
550
+ var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
551
+
552
+ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
553
+
554
+ // any word (or two) characters or numbers including two/three word month in arabic.
555
+ var matchWord =
556
+ /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
557
+
558
+ var regexes = {};
559
+
560
+ function addRegexToken(token, regex, strictRegex) {
561
+ regexes[token] =
562
+ typeof regex === "function"
563
+ ? regex
564
+ : function (isStrict) {
565
+ return isStrict && strictRegex ? strictRegex : regex;
566
+ };
567
+ }
568
+
569
+ function getParseRegexForToken(token, config) {
570
+ if (!hasOwnProp(regexes, token)) {
571
+ return new RegExp(unescapeFormat(token));
572
+ }
573
+
574
+ return regexes[token](config._strict, config._locale);
575
+ }
576
+
577
+ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
578
+ function unescapeFormat(s) {
579
+ return s
580
+ .replace("\\", "")
581
+ .replace(
582
+ /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
583
+ function (matched, p1, p2, p3, p4) {
584
+ return p1 || p2 || p3 || p4;
585
+ }
586
+ )
587
+ .replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
588
+ }
589
+
590
+ var tokens = {};
591
+
592
+ function addParseToken(token, callback) {
593
+ var i,
594
+ func = callback;
595
+ if (typeof token === "string") {
596
+ token = [token];
597
+ }
598
+ if (typeof callback === "number") {
599
+ func = function (input, array) {
600
+ array[callback] = toInt(input);
601
+ };
602
+ }
603
+ for (i = 0; i < token.length; i++) {
604
+ tokens[token[i]] = func;
605
+ }
606
+ }
607
+
608
+ function addWeekParseToken(token, callback) {
609
+ addParseToken(token, function (input, array, config, token) {
610
+ config._w = config._w || {};
611
+ callback(input, config._w, config, token);
612
+ });
613
+ }
614
+
615
+ function addTimeToArrayFromToken(token, input, config) {
616
+ if (input != null && hasOwnProp(tokens, token)) {
617
+ tokens[token](input, config._a, config, token);
618
+ }
619
+ }
620
+
621
+ var YEAR = 0;
622
+ var MONTH = 1;
623
+ var DATE = 2;
624
+ var HOUR = 3;
625
+ var MINUTE = 4;
626
+ var SECOND = 5;
627
+ var MILLISECOND = 6;
628
+
629
+ function daysInMonth(year, month) {
630
+ return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
631
+ }
632
+
633
+ // FORMATTING
634
+
635
+ addFormatToken("M", ["MM", 2], "Mo", function () {
636
+ return this.month() + 1;
637
+ });
638
+
639
+ addFormatToken("MMM", 0, 0, function (format) {
640
+ return this.localeData().monthsShort(this, format);
641
+ });
642
+
643
+ addFormatToken("MMMM", 0, 0, function (format) {
644
+ return this.localeData().months(this, format);
645
+ });
646
+
647
+ // ALIASES
648
+
649
+ addUnitAlias("month", "M");
650
+
651
+ // PARSING
652
+
653
+ addRegexToken("M", match1to2);
654
+ addRegexToken("MM", match1to2, match2);
655
+ addRegexToken("MMM", matchWord);
656
+ addRegexToken("MMMM", matchWord);
657
+
658
+ addParseToken(["M", "MM"], function (input, array) {
659
+ array[MONTH] = toInt(input) - 1;
660
+ });
661
+
662
+ addParseToken(["MMM", "MMMM"], function (input, array, config, token) {
663
+ var month = config._locale.monthsParse(input, token, config._strict);
664
+ // if we didn't find a month name, mark the date as invalid.
665
+ if (month != null) {
666
+ array[MONTH] = month;
667
+ } else {
668
+ getParsingFlags(config).invalidMonth = input;
669
+ }
670
+ });
671
+
672
+ // LOCALES
673
+
674
+ var defaultLocaleMonths =
675
+ "January_February_March_April_May_June_July_August_September_October_November_December".split(
676
+ "_"
677
+ );
678
+ function localeMonths(m) {
679
+ return this._months[m.month()];
680
+ }
681
+
682
+ var defaultLocaleMonthsShort =
683
+ "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");
684
+ function localeMonthsShort(m) {
685
+ return this._monthsShort[m.month()];
686
+ }
687
+
688
+ function localeMonthsParse(monthName, format, strict) {
689
+ var i, mom, regex;
690
+
691
+ if (!this._monthsParse) {
692
+ this._monthsParse = [];
693
+ this._longMonthsParse = [];
694
+ this._shortMonthsParse = [];
695
+ }
696
+
697
+ for (i = 0; i < 12; i++) {
698
+ // make the regex if we don't have it already
699
+ mom = create_utc__createUTC([2000, i]);
700
+ if (strict && !this._longMonthsParse[i]) {
701
+ this._longMonthsParse[i] = new RegExp(
702
+ "^" + this.months(mom, "").replace(".", "") + "$",
703
+ "i"
704
+ );
705
+ this._shortMonthsParse[i] = new RegExp(
706
+ "^" + this.monthsShort(mom, "").replace(".", "") + "$",
707
+ "i"
708
+ );
709
+ }
710
+ if (!strict && !this._monthsParse[i]) {
711
+ regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
712
+ this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i");
713
+ }
714
+ // test the regex
715
+ if (
716
+ strict &&
717
+ format === "MMMM" &&
718
+ this._longMonthsParse[i].test(monthName)
719
+ ) {
720
+ return i;
721
+ } else if (
722
+ strict &&
723
+ format === "MMM" &&
724
+ this._shortMonthsParse[i].test(monthName)
725
+ ) {
726
+ return i;
727
+ } else if (!strict && this._monthsParse[i].test(monthName)) {
728
+ return i;
729
+ }
730
+ }
731
+ }
732
+
733
+ // MOMENTS
734
+
735
+ function setMonth(mom, value) {
736
+ var dayOfMonth;
737
+
738
+ // TODO: Move this out of here!
739
+ if (typeof value === "string") {
740
+ value = mom.localeData().monthsParse(value);
741
+ // TODO: Another silent failure?
742
+ if (typeof value !== "number") {
743
+ return mom;
744
+ }
745
+ }
746
+
747
+ dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
748
+ mom._d["set" + (mom._isUTC ? "UTC" : "") + "Month"](value, dayOfMonth);
749
+ return mom;
750
+ }
751
+
752
+ function getSetMonth(value) {
753
+ if (value != null) {
754
+ setMonth(this, value);
755
+ utils_hooks__hooks.updateOffset(this, true);
756
+ return this;
757
+ } else {
758
+ return get_set__get(this, "Month");
759
+ }
760
+ }
761
+
762
+ function getDaysInMonth() {
763
+ return daysInMonth(this.year(), this.month());
764
+ }
765
+
766
+ function checkOverflow(m) {
767
+ var overflow;
768
+ var a = m._a;
769
+
770
+ if (a && getParsingFlags(m).overflow === -2) {
771
+ overflow =
772
+ a[MONTH] < 0 || a[MONTH] > 11
773
+ ? MONTH
774
+ : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
775
+ ? DATE
776
+ : a[HOUR] < 0 ||
777
+ a[HOUR] > 24 ||
778
+ (a[HOUR] === 24 &&
779
+ (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0))
780
+ ? HOUR
781
+ : a[MINUTE] < 0 || a[MINUTE] > 59
782
+ ? MINUTE
783
+ : a[SECOND] < 0 || a[SECOND] > 59
784
+ ? SECOND
785
+ : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
786
+ ? MILLISECOND
787
+ : -1;
788
+
789
+ if (
790
+ getParsingFlags(m)._overflowDayOfYear &&
791
+ (overflow < YEAR || overflow > DATE)
792
+ ) {
793
+ overflow = DATE;
794
+ }
795
+
796
+ getParsingFlags(m).overflow = overflow;
797
+ }
798
+
799
+ return m;
800
+ }
801
+
802
+ function warn(msg) {
803
+ if (
804
+ utils_hooks__hooks.suppressDeprecationWarnings === false &&
805
+ typeof console !== "undefined" &&
806
+ console.warn
807
+ ) {
808
+ console.warn("Deprecation warning: " + msg);
809
+ }
810
+ }
811
+
812
+ function deprecate(msg, fn) {
813
+ var firstTime = true,
814
+ msgWithStack = msg + "\n" + new Error().stack;
815
+
816
+ return extend(function () {
817
+ if (firstTime) {
818
+ warn(msgWithStack);
819
+ firstTime = false;
820
+ }
821
+ return fn.apply(this, arguments);
822
+ }, fn);
823
+ }
824
+
825
+ var deprecations = {};
826
+
827
+ function deprecateSimple(name, msg) {
828
+ if (!deprecations[name]) {
829
+ warn(msg);
830
+ deprecations[name] = true;
831
+ }
832
+ }
833
+
834
+ utils_hooks__hooks.suppressDeprecationWarnings = false;
835
+
836
+ var from_string__isoRegex =
837
+ /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
838
+
839
+ var isoDates = [
840
+ ["YYYYYY-MM-DD", /[+-]\d{6}-\d{2}-\d{2}/],
841
+ ["YYYY-MM-DD", /\d{4}-\d{2}-\d{2}/],
842
+ ["GGGG-[W]WW-E", /\d{4}-W\d{2}-\d/],
843
+ ["GGGG-[W]WW", /\d{4}-W\d{2}/],
844
+ ["YYYY-DDD", /\d{4}-\d{3}/],
845
+ ];
846
+
847
+ // iso time formats and regexes
848
+ var isoTimes = [
849
+ ["HH:mm:ss.SSSS", /(T| )\d\d:\d\d:\d\d\.\d+/],
850
+ ["HH:mm:ss", /(T| )\d\d:\d\d:\d\d/],
851
+ ["HH:mm", /(T| )\d\d:\d\d/],
852
+ ["HH", /(T| )\d\d/],
853
+ ];
854
+
855
+ var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
856
+
857
+ // date from iso format
858
+ function configFromISO(config) {
859
+ var i,
860
+ l,
861
+ string = config._i,
862
+ match = from_string__isoRegex.exec(string);
863
+
864
+ if (match) {
865
+ getParsingFlags(config).iso = true;
866
+ for (i = 0, l = isoDates.length; i < l; i++) {
867
+ if (isoDates[i][1].exec(string)) {
868
+ // match[5] should be 'T' or undefined
869
+ config._f = isoDates[i][0] + (match[6] || " ");
870
+ break;
871
+ }
872
+ }
873
+ for (i = 0, l = isoTimes.length; i < l; i++) {
874
+ if (isoTimes[i][1].exec(string)) {
875
+ config._f += isoTimes[i][0];
876
+ break;
877
+ }
878
+ }
879
+ if (string.match(matchOffset)) {
880
+ config._f += "Z";
881
+ }
882
+ configFromStringAndFormat(config);
883
+ } else {
884
+ config._isValid = false;
885
+ }
886
+ }
887
+
888
+ // date from iso format or fallback
889
+ function configFromString(config) {
890
+ var matched = aspNetJsonRegex.exec(config._i);
891
+
892
+ if (matched !== null) {
893
+ config._d = new Date(+matched[1]);
894
+ return;
895
+ }
896
+
897
+ configFromISO(config);
898
+ if (config._isValid === false) {
899
+ delete config._isValid;
900
+ utils_hooks__hooks.createFromInputFallback(config);
901
+ }
902
+ }
903
+
904
+ utils_hooks__hooks.createFromInputFallback = deprecate(
905
+ "moment construction falls back to js Date. This is " +
906
+ "discouraged and will be removed in upcoming major " +
907
+ "release. Please refer to " +
908
+ "https://github.com/moment/moment/issues/1407 for more info.",
909
+ function (config) {
910
+ config._d = new Date(config._i + (config._useUTC ? " UTC" : ""));
911
+ }
912
+ );
913
+
914
+ function createDate(y, m, d, h, M, s, ms) {
915
+ //can't just apply() to create a date:
916
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
917
+ var date = new Date(y, m, d, h, M, s, ms);
918
+
919
+ //the date constructor doesn't accept years < 1970
920
+ if (y < 1970) {
921
+ date.setFullYear(y);
922
+ }
923
+ return date;
924
+ }
925
+
926
+ function createUTCDate(y) {
927
+ var date = new Date(Date.UTC.apply(null, arguments));
928
+ if (y < 1970) {
929
+ date.setUTCFullYear(y);
930
+ }
931
+ return date;
932
+ }
933
+
934
+ addFormatToken(0, ["YY", 2], 0, function () {
935
+ return this.year() % 100;
936
+ });
937
+
938
+ addFormatToken(0, ["YYYY", 4], 0, "year");
939
+ addFormatToken(0, ["YYYYY", 5], 0, "year");
940
+ addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
941
+
942
+ // ALIASES
943
+
944
+ addUnitAlias("year", "y");
945
+
946
+ // PARSING
947
+
948
+ addRegexToken("Y", matchSigned);
949
+ addRegexToken("YY", match1to2, match2);
950
+ addRegexToken("YYYY", match1to4, match4);
951
+ addRegexToken("YYYYY", match1to6, match6);
952
+ addRegexToken("YYYYYY", match1to6, match6);
953
+
954
+ addParseToken(["YYYY", "YYYYY", "YYYYYY"], YEAR);
955
+ addParseToken("YY", function (input, array) {
956
+ array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
957
+ });
958
+
959
+ // HELPERS
960
+
961
+ function daysInYear(year) {
962
+ return isLeapYear(year) ? 366 : 365;
963
+ }
964
+
965
+ function isLeapYear(year) {
966
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
967
+ }
968
+
969
+ // HOOKS
970
+
971
+ utils_hooks__hooks.parseTwoDigitYear = function (input) {
972
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
973
+ };
974
+
975
+ // MOMENTS
976
+
977
+ var getSetYear = makeGetSet("FullYear", false);
978
+
979
+ function getIsLeapYear() {
980
+ return isLeapYear(this.year());
981
+ }
982
+
983
+ addFormatToken("w", ["ww", 2], "wo", "week");
984
+ addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
985
+
986
+ // ALIASES
987
+
988
+ addUnitAlias("week", "w");
989
+ addUnitAlias("isoWeek", "W");
990
+
991
+ // PARSING
992
+
993
+ addRegexToken("w", match1to2);
994
+ addRegexToken("ww", match1to2, match2);
995
+ addRegexToken("W", match1to2);
996
+ addRegexToken("WW", match1to2, match2);
997
+
998
+ addWeekParseToken(
999
+ ["w", "ww", "W", "WW"],
1000
+ function (input, week, config, token) {
1001
+ week[token.substr(0, 1)] = toInt(input);
1002
+ }
1003
+ );
1004
+
1005
+ // HELPERS
1006
+
1007
+ // firstDayOfWeek 0 = sun, 6 = sat
1008
+ // the day of the week that starts the week
1009
+ // (usually sunday or monday)
1010
+ // firstDayOfWeekOfYear 0 = sun, 6 = sat
1011
+ // the first week is the week that contains the first
1012
+ // of this day of the week
1013
+ // (eg. ISO weeks use thursday (4))
1014
+ function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
1015
+ var end = firstDayOfWeekOfYear - firstDayOfWeek,
1016
+ daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
1017
+ adjustedMoment;
1018
+
1019
+ if (daysToDayOfWeek > end) {
1020
+ daysToDayOfWeek -= 7;
1021
+ }
1022
+
1023
+ if (daysToDayOfWeek < end - 7) {
1024
+ daysToDayOfWeek += 7;
1025
+ }
1026
+
1027
+ adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, "d");
1028
+ return {
1029
+ week: Math.ceil(adjustedMoment.dayOfYear() / 7),
1030
+ year: adjustedMoment.year(),
1031
+ };
1032
+ }
1033
+
1034
+ // LOCALES
1035
+
1036
+ function localeWeek(mom) {
1037
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
1038
+ }
1039
+
1040
+ var defaultLocaleWeek = {
1041
+ dow: 0, // Sunday is the first day of the week.
1042
+ doy: 6, // The week that contains Jan 1st is the first week of the year.
1043
+ };
1044
+
1045
+ function localeFirstDayOfWeek() {
1046
+ return this._week.dow;
1047
+ }
1048
+
1049
+ function localeFirstDayOfYear() {
1050
+ return this._week.doy;
1051
+ }
1052
+
1053
+ // MOMENTS
1054
+
1055
+ function getSetWeek(input) {
1056
+ var week = this.localeData().week(this);
1057
+ return input == null ? week : this.add((input - week) * 7, "d");
1058
+ }
1059
+
1060
+ function getSetISOWeek(input) {
1061
+ var week = weekOfYear(this, 1, 4).week;
1062
+ return input == null ? week : this.add((input - week) * 7, "d");
1063
+ }
1064
+
1065
+ addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
1066
+
1067
+ // ALIASES
1068
+
1069
+ addUnitAlias("dayOfYear", "DDD");
1070
+
1071
+ // PARSING
1072
+
1073
+ addRegexToken("DDD", match1to3);
1074
+ addRegexToken("DDDD", match3);
1075
+ addParseToken(["DDD", "DDDD"], function (input, array, config) {
1076
+ config._dayOfYear = toInt(input);
1077
+ });
1078
+
1079
+ // HELPERS
1080
+
1081
+ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1082
+ function dayOfYearFromWeeks(
1083
+ year,
1084
+ week,
1085
+ weekday,
1086
+ firstDayOfWeekOfYear,
1087
+ firstDayOfWeek
1088
+ ) {
1089
+ var d = createUTCDate(year, 0, 1).getUTCDay();
1090
+ var daysToAdd;
1091
+ var dayOfYear;
1092
+
1093
+ d = d === 0 ? 7 : d;
1094
+ weekday = weekday != null ? weekday : firstDayOfWeek;
1095
+ daysToAdd =
1096
+ firstDayOfWeek -
1097
+ d +
1098
+ (d > firstDayOfWeekOfYear ? 7 : 0) -
1099
+ (d < firstDayOfWeek ? 7 : 0);
1100
+ dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
1101
+
1102
+ return {
1103
+ year: dayOfYear > 0 ? year : year - 1,
1104
+ dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear,
1105
+ };
1106
+ }
1107
+
1108
+ // MOMENTS
1109
+
1110
+ function getSetDayOfYear(input) {
1111
+ var dayOfYear =
1112
+ Math.round(
1113
+ (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
1114
+ ) + 1;
1115
+ return input == null ? dayOfYear : this.add(input - dayOfYear, "d");
1116
+ }
1117
+
1118
+ // Pick the first defined of two or three arguments.
1119
+ function defaults(a, b, c) {
1120
+ if (a != null) {
1121
+ return a;
1122
+ }
1123
+ if (b != null) {
1124
+ return b;
1125
+ }
1126
+ return c;
1127
+ }
1128
+
1129
+ function currentDateArray(config) {
1130
+ var now = new Date();
1131
+ if (config._useUTC) {
1132
+ return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
1133
+ }
1134
+ return [now.getFullYear(), now.getMonth(), now.getDate()];
1135
+ }
1136
+
1137
+ // convert an array to a date.
1138
+ // the array should mirror the parameters below
1139
+ // note: all values past the year are optional and will default to the lowest possible value.
1140
+ // [year, month, day , hour, minute, second, millisecond]
1141
+ function configFromArray(config) {
1142
+ var i,
1143
+ date,
1144
+ input = [],
1145
+ currentDate,
1146
+ yearToUse;
1147
+
1148
+ if (config._d) {
1149
+ return;
1150
+ }
1151
+
1152
+ currentDate = currentDateArray(config);
1153
+
1154
+ //compute day of the year from weeks and weekdays
1155
+ if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
1156
+ dayOfYearFromWeekInfo(config);
1157
+ }
1158
+
1159
+ //if the day of the year is set, figure out what it is
1160
+ if (config._dayOfYear) {
1161
+ yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
1162
+
1163
+ if (config._dayOfYear > daysInYear(yearToUse)) {
1164
+ getParsingFlags(config)._overflowDayOfYear = true;
1165
+ }
1166
+
1167
+ date = createUTCDate(yearToUse, 0, config._dayOfYear);
1168
+ config._a[MONTH] = date.getUTCMonth();
1169
+ config._a[DATE] = date.getUTCDate();
1170
+ }
1171
+
1172
+ // Default to current date.
1173
+ // * if no year, month, day of month are given, default to today
1174
+ // * if day of month is given, default month and year
1175
+ // * if month is given, default only year
1176
+ // * if year is given, don't default anything
1177
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
1178
+ config._a[i] = input[i] = currentDate[i];
1179
+ }
1180
+
1181
+ // Zero out whatever was not defaulted, including time
1182
+ for (; i < 7; i++) {
1183
+ config._a[i] = input[i] =
1184
+ config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
1185
+ }
1186
+
1187
+ // Check for 24:00:00.000
1188
+ if (
1189
+ config._a[HOUR] === 24 &&
1190
+ config._a[MINUTE] === 0 &&
1191
+ config._a[SECOND] === 0 &&
1192
+ config._a[MILLISECOND] === 0
1193
+ ) {
1194
+ config._nextDay = true;
1195
+ config._a[HOUR] = 0;
1196
+ }
1197
+
1198
+ config._d = (config._useUTC ? createUTCDate : createDate).apply(
1199
+ null,
1200
+ input
1201
+ );
1202
+ // Apply timezone offset from input. The actual utcOffset can be changed
1203
+ // with parseZone.
1204
+ if (config._tzm != null) {
1205
+ config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
1206
+ }
1207
+
1208
+ if (config._nextDay) {
1209
+ config._a[HOUR] = 24;
1210
+ }
1211
+ }
1212
+
1213
+ function dayOfYearFromWeekInfo(config) {
1214
+ var w, weekYear, week, weekday, dow, doy, temp;
1215
+
1216
+ w = config._w;
1217
+ if (w.GG != null || w.W != null || w.E != null) {
1218
+ dow = 1;
1219
+ doy = 4;
1220
+
1221
+ // TODO: We need to take the current isoWeekYear, but that depends on
1222
+ // how we interpret now (local, utc, fixed offset). So create
1223
+ // a now version of current config (take local/utc/offset flags, and
1224
+ // create now).
1225
+ weekYear = defaults(
1226
+ w.GG,
1227
+ config._a[YEAR],
1228
+ weekOfYear(local__createLocal(), 1, 4).year
1229
+ );
1230
+ week = defaults(w.W, 1);
1231
+ weekday = defaults(w.E, 1);
1232
+ } else {
1233
+ dow = config._locale._week.dow;
1234
+ doy = config._locale._week.doy;
1235
+
1236
+ weekYear = defaults(
1237
+ w.gg,
1238
+ config._a[YEAR],
1239
+ weekOfYear(local__createLocal(), dow, doy).year
1240
+ );
1241
+ week = defaults(w.w, 1);
1242
+
1243
+ if (w.d != null) {
1244
+ // weekday -- low day numbers are considered next week
1245
+ weekday = w.d;
1246
+ if (weekday < dow) {
1247
+ ++week;
1248
+ }
1249
+ } else if (w.e != null) {
1250
+ // local weekday -- counting starts from begining of week
1251
+ weekday = w.e + dow;
1252
+ } else {
1253
+ // default to begining of week
1254
+ weekday = dow;
1255
+ }
1256
+ }
1257
+ temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
1258
+
1259
+ config._a[YEAR] = temp.year;
1260
+ config._dayOfYear = temp.dayOfYear;
1261
+ }
1262
+
1263
+ utils_hooks__hooks.ISO_8601 = function () {};
1264
+
1265
+ // date from string and format string
1266
+ function configFromStringAndFormat(config) {
1267
+ // TODO: Move this to another part of the creation flow to prevent circular deps
1268
+ if (config._f === utils_hooks__hooks.ISO_8601) {
1269
+ configFromISO(config);
1270
+ return;
1271
+ }
1272
+
1273
+ config._a = [];
1274
+ getParsingFlags(config).empty = true;
1275
+
1276
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
1277
+ var string = "" + config._i,
1278
+ i,
1279
+ parsedInput,
1280
+ tokens,
1281
+ token,
1282
+ skipped,
1283
+ stringLength = string.length,
1284
+ totalParsedInputLength = 0;
1285
+
1286
+ tokens =
1287
+ expandFormat(config._f, config._locale).match(formattingTokens) || [];
1288
+
1289
+ for (i = 0; i < tokens.length; i++) {
1290
+ token = tokens[i];
1291
+ parsedInput = (string.match(getParseRegexForToken(token, config)) ||
1292
+ [])[0];
1293
+ if (parsedInput) {
1294
+ skipped = string.substr(0, string.indexOf(parsedInput));
1295
+ if (skipped.length > 0) {
1296
+ getParsingFlags(config).unusedInput.push(skipped);
1297
+ }
1298
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
1299
+ totalParsedInputLength += parsedInput.length;
1300
+ }
1301
+ // don't parse if it's not a known token
1302
+ if (formatTokenFunctions[token]) {
1303
+ if (parsedInput) {
1304
+ getParsingFlags(config).empty = false;
1305
+ } else {
1306
+ getParsingFlags(config).unusedTokens.push(token);
1307
+ }
1308
+ addTimeToArrayFromToken(token, parsedInput, config);
1309
+ } else if (config._strict && !parsedInput) {
1310
+ getParsingFlags(config).unusedTokens.push(token);
1311
+ }
1312
+ }
1313
+
1314
+ // add remaining unparsed input length to the string
1315
+ getParsingFlags(config).charsLeftOver =
1316
+ stringLength - totalParsedInputLength;
1317
+ if (string.length > 0) {
1318
+ getParsingFlags(config).unusedInput.push(string);
1319
+ }
1320
+
1321
+ // clear _12h flag if hour is <= 12
1322
+ if (
1323
+ getParsingFlags(config).bigHour === true &&
1324
+ config._a[HOUR] <= 12 &&
1325
+ config._a[HOUR] > 0
1326
+ ) {
1327
+ getParsingFlags(config).bigHour = undefined;
1328
+ }
1329
+ // handle meridiem
1330
+ config._a[HOUR] = meridiemFixWrap(
1331
+ config._locale,
1332
+ config._a[HOUR],
1333
+ config._meridiem
1334
+ );
1335
+
1336
+ configFromArray(config);
1337
+ checkOverflow(config);
1338
+ }
1339
+
1340
+ function meridiemFixWrap(locale, hour, meridiem) {
1341
+ var isPm;
1342
+
1343
+ if (meridiem == null) {
1344
+ // nothing to do
1345
+ return hour;
1346
+ }
1347
+ if (locale.meridiemHour != null) {
1348
+ return locale.meridiemHour(hour, meridiem);
1349
+ } else if (locale.isPM != null) {
1350
+ // Fallback
1351
+ isPm = locale.isPM(meridiem);
1352
+ if (isPm && hour < 12) {
1353
+ hour += 12;
1354
+ }
1355
+ if (!isPm && hour === 12) {
1356
+ hour = 0;
1357
+ }
1358
+ return hour;
1359
+ } else {
1360
+ // this is not supposed to happen
1361
+ return hour;
1362
+ }
1363
+ }
1364
+
1365
+ function configFromStringAndArray(config) {
1366
+ var tempConfig, bestMoment, scoreToBeat, i, currentScore;
1367
+
1368
+ if (config._f.length === 0) {
1369
+ getParsingFlags(config).invalidFormat = true;
1370
+ config._d = new Date(NaN);
1371
+ return;
1372
+ }
1373
+
1374
+ for (i = 0; i < config._f.length; i++) {
1375
+ currentScore = 0;
1376
+ tempConfig = copyConfig({}, config);
1377
+ if (config._useUTC != null) {
1378
+ tempConfig._useUTC = config._useUTC;
1379
+ }
1380
+ tempConfig._f = config._f[i];
1381
+ configFromStringAndFormat(tempConfig);
1382
+
1383
+ if (!valid__isValid(tempConfig)) {
1384
+ continue;
1385
+ }
1386
+
1387
+ // if there is any input that was not parsed add a penalty for that format
1388
+ currentScore += getParsingFlags(tempConfig).charsLeftOver;
1389
+
1390
+ //or tokens
1391
+ currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
1392
+
1393
+ getParsingFlags(tempConfig).score = currentScore;
1394
+
1395
+ if (scoreToBeat == null || currentScore < scoreToBeat) {
1396
+ scoreToBeat = currentScore;
1397
+ bestMoment = tempConfig;
1398
+ }
1399
+ }
1400
+
1401
+ extend(config, bestMoment || tempConfig);
1402
+ }
1403
+
1404
+ function configFromObject(config) {
1405
+ if (config._d) {
1406
+ return;
1407
+ }
1408
+
1409
+ var i = normalizeObjectUnits(config._i);
1410
+ config._a = [
1411
+ i.year,
1412
+ i.month,
1413
+ i.day || i.date,
1414
+ i.hour,
1415
+ i.minute,
1416
+ i.second,
1417
+ i.millisecond,
1418
+ ];
1419
+
1420
+ configFromArray(config);
1421
+ }
1422
+
1423
+ function createFromConfig(config) {
1424
+ var input = config._i,
1425
+ format = config._f,
1426
+ res;
1427
+
1428
+ config._locale = config._locale || locale_locales__getLocale(config._l);
1429
+
1430
+ if (input === null || (format === undefined && input === "")) {
1431
+ return valid__createInvalid({ nullInput: true });
1432
+ }
1433
+
1434
+ if (typeof input === "string") {
1435
+ config._i = input = config._locale.preparse(input);
1436
+ }
1437
+
1438
+ if (isMoment(input)) {
1439
+ return new Moment(checkOverflow(input));
1440
+ } else if (isArray(format)) {
1441
+ configFromStringAndArray(config);
1442
+ } else if (format) {
1443
+ configFromStringAndFormat(config);
1444
+ } else if (isDate(input)) {
1445
+ config._d = input;
1446
+ } else {
1447
+ configFromInput(config);
1448
+ }
1449
+
1450
+ res = new Moment(checkOverflow(config));
1451
+ if (res._nextDay) {
1452
+ // Adding is smart enough around DST
1453
+ res.add(1, "d");
1454
+ res._nextDay = undefined;
1455
+ }
1456
+
1457
+ return res;
1458
+ }
1459
+
1460
+ function configFromInput(config) {
1461
+ var input = config._i;
1462
+ if (input === undefined) {
1463
+ config._d = new Date();
1464
+ } else if (isDate(input)) {
1465
+ config._d = new Date(+input);
1466
+ } else if (typeof input === "string") {
1467
+ configFromString(config);
1468
+ } else if (isArray(input)) {
1469
+ config._a = map(input.slice(0), function (obj) {
1470
+ return parseInt(obj, 10);
1471
+ });
1472
+ configFromArray(config);
1473
+ } else if (typeof input === "object") {
1474
+ configFromObject(config);
1475
+ } else if (typeof input === "number") {
1476
+ // from milliseconds
1477
+ config._d = new Date(input);
1478
+ } else {
1479
+ utils_hooks__hooks.createFromInputFallback(config);
1480
+ }
1481
+ }
1482
+
1483
+ function createLocalOrUTC(input, format, locale, strict, isUTC) {
1484
+ var c = {};
1485
+
1486
+ if (typeof locale === "boolean") {
1487
+ strict = locale;
1488
+ locale = undefined;
1489
+ }
1490
+ // object construction must be done this way.
1491
+ // https://github.com/moment/moment/issues/1423
1492
+ c._isAMomentObject = true;
1493
+ c._useUTC = c._isUTC = isUTC;
1494
+ c._l = locale;
1495
+ c._i = input;
1496
+ c._f = format;
1497
+ c._strict = strict;
1498
+
1499
+ return createFromConfig(c);
1500
+ }
1501
+
1502
+ function local__createLocal(input, format, locale, strict) {
1503
+ return createLocalOrUTC(input, format, locale, strict, false);
1504
+ }
1505
+
1506
+ var prototypeMin = deprecate(
1507
+ "moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",
1508
+ function () {
1509
+ var other = local__createLocal.apply(null, arguments);
1510
+ return other < this ? this : other;
1511
+ }
1512
+ );
1513
+
1514
+ var prototypeMax = deprecate(
1515
+ "moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",
1516
+ function () {
1517
+ var other = local__createLocal.apply(null, arguments);
1518
+ return other > this ? this : other;
1519
+ }
1520
+ );
1521
+
1522
+ // Pick a moment m from moments so that m[fn](other) is true for all
1523
+ // other. This relies on the function fn to be transitive.
1524
+ //
1525
+ // moments should either be an array of moment objects or an array, whose
1526
+ // first element is an array of moment objects.
1527
+ function pickBy(fn, moments) {
1528
+ var res, i;
1529
+ if (moments.length === 1 && isArray(moments[0])) {
1530
+ moments = moments[0];
1531
+ }
1532
+ if (!moments.length) {
1533
+ return local__createLocal();
1534
+ }
1535
+ res = moments[0];
1536
+ for (i = 1; i < moments.length; ++i) {
1537
+ if (moments[i][fn](res)) {
1538
+ res = moments[i];
1539
+ }
1540
+ }
1541
+ return res;
1542
+ }
1543
+
1544
+ // TODO: Use [].sort instead?
1545
+ function min() {
1546
+ var args = [].slice.call(arguments, 0);
1547
+
1548
+ return pickBy("isBefore", args);
1549
+ }
1550
+
1551
+ function max() {
1552
+ var args = [].slice.call(arguments, 0);
1553
+
1554
+ return pickBy("isAfter", args);
1555
+ }
1556
+
1557
+ function Duration(duration) {
1558
+ var normalizedInput = normalizeObjectUnits(duration),
1559
+ years = normalizedInput.year || 0,
1560
+ quarters = normalizedInput.quarter || 0,
1561
+ months = normalizedInput.month || 0,
1562
+ weeks = normalizedInput.week || 0,
1563
+ days = normalizedInput.day || 0,
1564
+ hours = normalizedInput.hour || 0,
1565
+ minutes = normalizedInput.minute || 0,
1566
+ seconds = normalizedInput.second || 0,
1567
+ milliseconds = normalizedInput.millisecond || 0;
1568
+
1569
+ // representation for dateAddRemove
1570
+ this._milliseconds =
1571
+ +milliseconds +
1572
+ seconds * 1e3 + // 1000
1573
+ minutes * 6e4 + // 1000 * 60
1574
+ hours * 36e5; // 1000 * 60 * 60
1575
+ // Because of dateAddRemove treats 24 hours as different from a
1576
+ // day when working around DST, we need to store them separately
1577
+ this._days = +days + weeks * 7;
1578
+ // It is impossible translate months into days without knowing
1579
+ // which months you are are talking about, so we have to store
1580
+ // it separately.
1581
+ this._months = +months + quarters * 3 + years * 12;
1582
+
1583
+ this._data = {};
1584
+
1585
+ this._locale = locale_locales__getLocale();
1586
+
1587
+ this._bubble();
1588
+ }
1589
+
1590
+ function isDuration(obj) {
1591
+ return obj instanceof Duration;
1592
+ }
1593
+
1594
+ function offset(token, separator) {
1595
+ addFormatToken(token, 0, 0, function () {
1596
+ var offset = this.utcOffset();
1597
+ var sign = "+";
1598
+ if (offset < 0) {
1599
+ offset = -offset;
1600
+ sign = "-";
1601
+ }
1602
+ return (
1603
+ sign +
1604
+ zeroFill(~~(offset / 60), 2) +
1605
+ separator +
1606
+ zeroFill(~~offset % 60, 2)
1607
+ );
1608
+ });
1609
+ }
1610
+
1611
+ offset("Z", ":");
1612
+ offset("ZZ", "");
1613
+
1614
+ // PARSING
1615
+
1616
+ addRegexToken("Z", matchOffset);
1617
+ addRegexToken("ZZ", matchOffset);
1618
+ addParseToken(["Z", "ZZ"], function (input, array, config) {
1619
+ config._useUTC = true;
1620
+ config._tzm = offsetFromString(input);
1621
+ });
1622
+
1623
+ // HELPERS
1624
+
1625
+ // timezone chunker
1626
+ // '+10:00' > ['10', '00']
1627
+ // '-1530' > ['-15', '30']
1628
+ var chunkOffset = /([\+\-]|\d\d)/gi;
1629
+
1630
+ function offsetFromString(string) {
1631
+ var matches = (string || "").match(matchOffset) || [];
1632
+ var chunk = matches[matches.length - 1] || [];
1633
+ var parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
1634
+ var minutes = +(parts[1] * 60) + toInt(parts[2]);
1635
+
1636
+ return parts[0] === "+" ? minutes : -minutes;
1637
+ }
1638
+
1639
+ // Return a moment from input, that is local/utc/zone equivalent to model.
1640
+ function cloneWithOffset(input, model) {
1641
+ var res, diff;
1642
+ if (model._isUTC) {
1643
+ res = model.clone();
1644
+ diff =
1645
+ (isMoment(input) || isDate(input)
1646
+ ? +input
1647
+ : +local__createLocal(input)) - +res;
1648
+ // Use low-level api, because this fn is low-level api.
1649
+ res._d.setTime(+res._d + diff);
1650
+ utils_hooks__hooks.updateOffset(res, false);
1651
+ return res;
1652
+ } else {
1653
+ return local__createLocal(input).local();
1654
+ }
1655
+ return model._isUTC
1656
+ ? local__createLocal(input).zone(model._offset || 0)
1657
+ : local__createLocal(input).local();
1658
+ }
1659
+
1660
+ function getDateOffset(m) {
1661
+ // On Firefox.24 Date#getTimezoneOffset returns a floating point.
1662
+ // https://github.com/moment/moment/pull/1871
1663
+ return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
1664
+ }
1665
+
1666
+ // HOOKS
1667
+
1668
+ // This function will be called whenever a moment is mutated.
1669
+ // It is intended to keep the offset in sync with the timezone.
1670
+ utils_hooks__hooks.updateOffset = function () {};
1671
+
1672
+ // MOMENTS
1673
+
1674
+ // keepLocalTime = true means only change the timezone, without
1675
+ // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
1676
+ // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
1677
+ // +0200, so we adjust the time as needed, to be valid.
1678
+ //
1679
+ // Keeping the time actually adds/subtracts (one hour)
1680
+ // from the actual represented time. That is why we call updateOffset
1681
+ // a second time. In case it wants us to change the offset again
1682
+ // _changeInProgress == true case, then we have to adjust, because
1683
+ // there is no such time in the given timezone.
1684
+ function getSetOffset(input, keepLocalTime) {
1685
+ var offset = this._offset || 0,
1686
+ localAdjust;
1687
+ if (input != null) {
1688
+ if (typeof input === "string") {
1689
+ input = offsetFromString(input);
1690
+ }
1691
+ if (Math.abs(input) < 16) {
1692
+ input = input * 60;
1693
+ }
1694
+ if (!this._isUTC && keepLocalTime) {
1695
+ localAdjust = getDateOffset(this);
1696
+ }
1697
+ this._offset = input;
1698
+ this._isUTC = true;
1699
+ if (localAdjust != null) {
1700
+ this.add(localAdjust, "m");
1701
+ }
1702
+ if (offset !== input) {
1703
+ if (!keepLocalTime || this._changeInProgress) {
1704
+ add_subtract__addSubtract(
1705
+ this,
1706
+ create__createDuration(input - offset, "m"),
1707
+ 1,
1708
+ false
1709
+ );
1710
+ } else if (!this._changeInProgress) {
1711
+ this._changeInProgress = true;
1712
+ utils_hooks__hooks.updateOffset(this, true);
1713
+ this._changeInProgress = null;
1714
+ }
1715
+ }
1716
+ return this;
1717
+ } else {
1718
+ return this._isUTC ? offset : getDateOffset(this);
1719
+ }
1720
+ }
1721
+
1722
+ function getSetZone(input, keepLocalTime) {
1723
+ if (input != null) {
1724
+ if (typeof input !== "string") {
1725
+ input = -input;
1726
+ }
1727
+
1728
+ this.utcOffset(input, keepLocalTime);
1729
+
1730
+ return this;
1731
+ } else {
1732
+ return -this.utcOffset();
1733
+ }
1734
+ }
1735
+
1736
+ function setOffsetToUTC(keepLocalTime) {
1737
+ return this.utcOffset(0, keepLocalTime);
1738
+ }
1739
+
1740
+ function setOffsetToLocal(keepLocalTime) {
1741
+ if (this._isUTC) {
1742
+ this.utcOffset(0, keepLocalTime);
1743
+ this._isUTC = false;
1744
+
1745
+ if (keepLocalTime) {
1746
+ this.subtract(getDateOffset(this), "m");
1747
+ }
1748
+ }
1749
+ return this;
1750
+ }
1751
+
1752
+ function setOffsetToParsedOffset() {
1753
+ if (this._tzm) {
1754
+ this.utcOffset(this._tzm);
1755
+ } else if (typeof this._i === "string") {
1756
+ this.utcOffset(offsetFromString(this._i));
1757
+ }
1758
+ return this;
1759
+ }
1760
+
1761
+ function hasAlignedHourOffset(input) {
1762
+ if (!input) {
1763
+ input = 0;
1764
+ } else {
1765
+ input = local__createLocal(input).utcOffset();
1766
+ }
1767
+
1768
+ return (this.utcOffset() - input) % 60 === 0;
1769
+ }
1770
+
1771
+ function isDaylightSavingTime() {
1772
+ return (
1773
+ this.utcOffset() > this.clone().month(0).utcOffset() ||
1774
+ this.utcOffset() > this.clone().month(5).utcOffset()
1775
+ );
1776
+ }
1777
+
1778
+ function isDaylightSavingTimeShifted() {
1779
+ if (this._a) {
1780
+ var other = this._isUTC
1781
+ ? create_utc__createUTC(this._a)
1782
+ : local__createLocal(this._a);
1783
+ return this.isValid() && compareArrays(this._a, other.toArray()) > 0;
1784
+ }
1785
+
1786
+ return false;
1787
+ }
1788
+
1789
+ function isLocal() {
1790
+ return !this._isUTC;
1791
+ }
1792
+
1793
+ function isUtcOffset() {
1794
+ return this._isUTC;
1795
+ }
1796
+
1797
+ function isUtc() {
1798
+ return this._isUTC && this._offset === 0;
1799
+ }
1800
+
1801
+ var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
1802
+
1803
+ // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
1804
+ // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
1805
+ var create__isoRegex =
1806
+ /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
1807
+
1808
+ function create__createDuration(input, key) {
1809
+ var duration = input,
1810
+ // matching against regexp is expensive, do it on demand
1811
+ match = null,
1812
+ sign,
1813
+ ret,
1814
+ diffRes;
1815
+
1816
+ if (isDuration(input)) {
1817
+ duration = {
1818
+ ms: input._milliseconds,
1819
+ d: input._days,
1820
+ M: input._months,
1821
+ };
1822
+ } else if (typeof input === "number") {
1823
+ duration = {};
1824
+ if (key) {
1825
+ duration[key] = input;
1826
+ } else {
1827
+ duration.milliseconds = input;
1828
+ }
1829
+ } else if (!!(match = aspNetRegex.exec(input))) {
1830
+ sign = match[1] === "-" ? -1 : 1;
1831
+ duration = {
1832
+ y: 0,
1833
+ d: toInt(match[DATE]) * sign,
1834
+ h: toInt(match[HOUR]) * sign,
1835
+ m: toInt(match[MINUTE]) * sign,
1836
+ s: toInt(match[SECOND]) * sign,
1837
+ ms: toInt(match[MILLISECOND]) * sign,
1838
+ };
1839
+ } else if (!!(match = create__isoRegex.exec(input))) {
1840
+ sign = match[1] === "-" ? -1 : 1;
1841
+ duration = {
1842
+ y: parseIso(match[2], sign),
1843
+ M: parseIso(match[3], sign),
1844
+ d: parseIso(match[4], sign),
1845
+ h: parseIso(match[5], sign),
1846
+ m: parseIso(match[6], sign),
1847
+ s: parseIso(match[7], sign),
1848
+ w: parseIso(match[8], sign),
1849
+ };
1850
+ } else if (duration == null) {
1851
+ // checks for null or undefined
1852
+ duration = {};
1853
+ } else if (
1854
+ typeof duration === "object" &&
1855
+ ("from" in duration || "to" in duration)
1856
+ ) {
1857
+ diffRes = momentsDifference(
1858
+ local__createLocal(duration.from),
1859
+ local__createLocal(duration.to)
1860
+ );
1861
+
1862
+ duration = {};
1863
+ duration.ms = diffRes.milliseconds;
1864
+ duration.M = diffRes.months;
1865
+ }
1866
+
1867
+ ret = new Duration(duration);
1868
+
1869
+ if (isDuration(input) && hasOwnProp(input, "_locale")) {
1870
+ ret._locale = input._locale;
1871
+ }
1872
+
1873
+ return ret;
1874
+ }
1875
+
1876
+ create__createDuration.fn = Duration.prototype;
1877
+
1878
+ function parseIso(inp, sign) {
1879
+ // We'd normally use ~~inp for this, but unfortunately it also
1880
+ // converts floats to ints.
1881
+ // inp may be undefined, so careful calling replace on it.
1882
+ var res = inp && parseFloat(inp.replace(",", "."));
1883
+ // apply sign while we're at it
1884
+ return (isNaN(res) ? 0 : res) * sign;
1885
+ }
1886
+
1887
+ function positiveMomentsDifference(base, other) {
1888
+ var res = { milliseconds: 0, months: 0 };
1889
+
1890
+ res.months =
1891
+ other.month() - base.month() + (other.year() - base.year()) * 12;
1892
+ if (base.clone().add(res.months, "M").isAfter(other)) {
1893
+ --res.months;
1894
+ }
1895
+
1896
+ res.milliseconds = +other - +base.clone().add(res.months, "M");
1897
+
1898
+ return res;
1899
+ }
1900
+
1901
+ function momentsDifference(base, other) {
1902
+ var res;
1903
+ other = cloneWithOffset(other, base);
1904
+ if (base.isBefore(other)) {
1905
+ res = positiveMomentsDifference(base, other);
1906
+ } else {
1907
+ res = positiveMomentsDifference(other, base);
1908
+ res.milliseconds = -res.milliseconds;
1909
+ res.months = -res.months;
1910
+ }
1911
+
1912
+ return res;
1913
+ }
1914
+
1915
+ function createAdder(direction, name) {
1916
+ return function (val, period) {
1917
+ var dur, tmp;
1918
+ //invert the arguments, but complain about it
1919
+ if (period !== null && !isNaN(+period)) {
1920
+ deprecateSimple(
1921
+ name,
1922
+ "moment()." +
1923
+ name +
1924
+ "(period, number) is deprecated. Please use moment()." +
1925
+ name +
1926
+ "(number, period)."
1927
+ );
1928
+ tmp = val;
1929
+ val = period;
1930
+ period = tmp;
1931
+ }
1932
+
1933
+ val = typeof val === "string" ? +val : val;
1934
+ dur = create__createDuration(val, period);
1935
+ add_subtract__addSubtract(this, dur, direction);
1936
+ return this;
1937
+ };
1938
+ }
1939
+
1940
+ function add_subtract__addSubtract(mom, duration, isAdding, updateOffset) {
1941
+ var milliseconds = duration._milliseconds,
1942
+ days = duration._days,
1943
+ months = duration._months;
1944
+ updateOffset = updateOffset == null ? true : updateOffset;
1945
+
1946
+ if (milliseconds) {
1947
+ mom._d.setTime(+mom._d + milliseconds * isAdding);
1948
+ }
1949
+ if (days) {
1950
+ get_set__set(mom, "Date", get_set__get(mom, "Date") + days * isAdding);
1951
+ }
1952
+ if (months) {
1953
+ setMonth(mom, get_set__get(mom, "Month") + months * isAdding);
1954
+ }
1955
+ if (updateOffset) {
1956
+ utils_hooks__hooks.updateOffset(mom, days || months);
1957
+ }
1958
+ }
1959
+
1960
+ var add_subtract__add = createAdder(1, "add");
1961
+ var add_subtract__subtract = createAdder(-1, "subtract");
1962
+
1963
+ function moment_calendar__calendar(time) {
1964
+ // We want to compare the start of today, vs this.
1965
+ // Getting start-of-today depends on whether we're local/utc/offset or not.
1966
+ var now = time || local__createLocal(),
1967
+ sod = cloneWithOffset(now, this).startOf("day"),
1968
+ diff = this.diff(sod, "days", true),
1969
+ format =
1970
+ diff < -6
1971
+ ? "sameElse"
1972
+ : diff < -1
1973
+ ? "lastWeek"
1974
+ : diff < 0
1975
+ ? "lastDay"
1976
+ : diff < 1
1977
+ ? "sameDay"
1978
+ : diff < 2
1979
+ ? "nextDay"
1980
+ : diff < 7
1981
+ ? "nextWeek"
1982
+ : "sameElse";
1983
+ return this.format(
1984
+ this.localeData().calendar(format, this, local__createLocal(now))
1985
+ );
1986
+ }
1987
+
1988
+ function clone() {
1989
+ return new Moment(this);
1990
+ }
1991
+
1992
+ function isAfter(input, units) {
1993
+ var inputMs;
1994
+ units = normalizeUnits(
1995
+ typeof units !== "undefined" ? units : "millisecond"
1996
+ );
1997
+ if (units === "millisecond") {
1998
+ input = isMoment(input) ? input : local__createLocal(input);
1999
+ return +this > +input;
2000
+ } else {
2001
+ inputMs = isMoment(input) ? +input : +local__createLocal(input);
2002
+ return inputMs < +this.clone().startOf(units);
2003
+ }
2004
+ }
2005
+
2006
+ function isBefore(input, units) {
2007
+ var inputMs;
2008
+ units = normalizeUnits(
2009
+ typeof units !== "undefined" ? units : "millisecond"
2010
+ );
2011
+ if (units === "millisecond") {
2012
+ input = isMoment(input) ? input : local__createLocal(input);
2013
+ return +this < +input;
2014
+ } else {
2015
+ inputMs = isMoment(input) ? +input : +local__createLocal(input);
2016
+ return +this.clone().endOf(units) < inputMs;
2017
+ }
2018
+ }
2019
+
2020
+ function isBetween(from, to, units) {
2021
+ return this.isAfter(from, units) && this.isBefore(to, units);
2022
+ }
2023
+
2024
+ function isSame(input, units) {
2025
+ var inputMs;
2026
+ units = normalizeUnits(units || "millisecond");
2027
+ if (units === "millisecond") {
2028
+ input = isMoment(input) ? input : local__createLocal(input);
2029
+ return +this === +input;
2030
+ } else {
2031
+ inputMs = +local__createLocal(input);
2032
+ return (
2033
+ +this.clone().startOf(units) <= inputMs &&
2034
+ inputMs <= +this.clone().endOf(units)
2035
+ );
2036
+ }
2037
+ }
2038
+
2039
+ function absFloor(number) {
2040
+ if (number < 0) {
2041
+ return Math.ceil(number);
2042
+ } else {
2043
+ return Math.floor(number);
2044
+ }
2045
+ }
2046
+
2047
+ function diff(input, units, asFloat) {
2048
+ var that = cloneWithOffset(input, this),
2049
+ zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
2050
+ delta,
2051
+ output;
2052
+
2053
+ units = normalizeUnits(units);
2054
+
2055
+ if (units === "year" || units === "month" || units === "quarter") {
2056
+ output = monthDiff(this, that);
2057
+ if (units === "quarter") {
2058
+ output = output / 3;
2059
+ } else if (units === "year") {
2060
+ output = output / 12;
2061
+ }
2062
+ } else {
2063
+ delta = this - that;
2064
+ output =
2065
+ units === "second"
2066
+ ? delta / 1e3 // 1000
2067
+ : units === "minute"
2068
+ ? delta / 6e4 // 1000 * 60
2069
+ : units === "hour"
2070
+ ? delta / 36e5 // 1000 * 60 * 60
2071
+ : units === "day"
2072
+ ? (delta - zoneDelta) / 864e5 // 1000 * 60 * 60 * 24, negate dst
2073
+ : units === "week"
2074
+ ? (delta - zoneDelta) / 6048e5 // 1000 * 60 * 60 * 24 * 7, negate dst
2075
+ : delta;
2076
+ }
2077
+ return asFloat ? output : absFloor(output);
2078
+ }
2079
+
2080
+ function monthDiff(a, b) {
2081
+ // difference in months
2082
+ var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
2083
+ // b is in (anchor - 1 month, anchor + 1 month)
2084
+ anchor = a.clone().add(wholeMonthDiff, "months"),
2085
+ anchor2,
2086
+ adjust;
2087
+
2088
+ if (b - anchor < 0) {
2089
+ anchor2 = a.clone().add(wholeMonthDiff - 1, "months");
2090
+ // linear across the month
2091
+ adjust = (b - anchor) / (anchor - anchor2);
2092
+ } else {
2093
+ anchor2 = a.clone().add(wholeMonthDiff + 1, "months");
2094
+ // linear across the month
2095
+ adjust = (b - anchor) / (anchor2 - anchor);
2096
+ }
2097
+
2098
+ return -(wholeMonthDiff + adjust);
2099
+ }
2100
+
2101
+ utils_hooks__hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
2102
+
2103
+ function toString() {
2104
+ return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
2105
+ }
2106
+
2107
+ function moment_format__toISOString() {
2108
+ var m = this.clone().utc();
2109
+ if (0 < m.year() && m.year() <= 9999) {
2110
+ if ("function" === typeof Date.prototype.toISOString) {
2111
+ // native implementation is ~50x faster, use it when we can
2112
+ return this.toDate().toISOString();
2113
+ } else {
2114
+ return formatMoment(m, "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]");
2115
+ }
2116
+ } else {
2117
+ return formatMoment(m, "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]");
2118
+ }
2119
+ }
2120
+
2121
+ function format(inputString) {
2122
+ var output = formatMoment(
2123
+ this,
2124
+ inputString || utils_hooks__hooks.defaultFormat
2125
+ );
2126
+ return this.localeData().postformat(output);
2127
+ }
2128
+
2129
+ function from(time, withoutSuffix) {
2130
+ if (!this.isValid()) {
2131
+ return this.localeData().invalidDate();
2132
+ }
2133
+ return create__createDuration({ to: this, from: time })
2134
+ .locale(this.locale())
2135
+ .humanize(!withoutSuffix);
2136
+ }
2137
+
2138
+ function fromNow(withoutSuffix) {
2139
+ return this.from(local__createLocal(), withoutSuffix);
2140
+ }
2141
+
2142
+ function to(time, withoutSuffix) {
2143
+ if (!this.isValid()) {
2144
+ return this.localeData().invalidDate();
2145
+ }
2146
+ return create__createDuration({ from: this, to: time })
2147
+ .locale(this.locale())
2148
+ .humanize(!withoutSuffix);
2149
+ }
2150
+
2151
+ function toNow(withoutSuffix) {
2152
+ return this.to(local__createLocal(), withoutSuffix);
2153
+ }
2154
+
2155
+ function locale(key) {
2156
+ var newLocaleData;
2157
+
2158
+ if (key === undefined) {
2159
+ return this._locale._abbr;
2160
+ } else {
2161
+ newLocaleData = locale_locales__getLocale(key);
2162
+ if (newLocaleData != null) {
2163
+ this._locale = newLocaleData;
2164
+ }
2165
+ return this;
2166
+ }
2167
+ }
2168
+
2169
+ var lang = deprecate(
2170
+ "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
2171
+ function (key) {
2172
+ if (key === undefined) {
2173
+ return this.localeData();
2174
+ } else {
2175
+ return this.locale(key);
2176
+ }
2177
+ }
2178
+ );
2179
+
2180
+ function localeData() {
2181
+ return this._locale;
2182
+ }
2183
+
2184
+ function startOf(units) {
2185
+ units = normalizeUnits(units);
2186
+ // the following switch intentionally omits break keywords
2187
+ // to utilize falling through the cases.
2188
+ switch (units) {
2189
+ case "year":
2190
+ this.month(0);
2191
+ /* falls through */
2192
+ case "quarter":
2193
+ case "month":
2194
+ this.date(1);
2195
+ /* falls through */
2196
+ case "week":
2197
+ case "isoWeek":
2198
+ case "day":
2199
+ this.hours(0);
2200
+ /* falls through */
2201
+ case "hour":
2202
+ this.minutes(0);
2203
+ /* falls through */
2204
+ case "minute":
2205
+ this.seconds(0);
2206
+ /* falls through */
2207
+ case "second":
2208
+ this.milliseconds(0);
2209
+ }
2210
+
2211
+ // weeks are a special case
2212
+ if (units === "week") {
2213
+ this.weekday(0);
2214
+ }
2215
+ if (units === "isoWeek") {
2216
+ this.isoWeekday(1);
2217
+ }
2218
+
2219
+ // quarters are also special
2220
+ if (units === "quarter") {
2221
+ this.month(Math.floor(this.month() / 3) * 3);
2222
+ }
2223
+
2224
+ return this;
2225
+ }
2226
+
2227
+ function endOf(units) {
2228
+ units = normalizeUnits(units);
2229
+ if (units === undefined || units === "millisecond") {
2230
+ return this;
2231
+ }
2232
+ return this.startOf(units)
2233
+ .add(1, units === "isoWeek" ? "week" : units)
2234
+ .subtract(1, "ms");
2235
+ }
2236
+
2237
+ function to_type__valueOf() {
2238
+ return +this._d - (this._offset || 0) * 60000;
2239
+ }
2240
+
2241
+ function unix() {
2242
+ return Math.floor(+this / 1000);
2243
+ }
2244
+
2245
+ function toDate() {
2246
+ return this._offset ? new Date(+this) : this._d;
2247
+ }
2248
+
2249
+ function toArray() {
2250
+ var m = this;
2251
+ return [
2252
+ m.year(),
2253
+ m.month(),
2254
+ m.date(),
2255
+ m.hour(),
2256
+ m.minute(),
2257
+ m.second(),
2258
+ m.millisecond(),
2259
+ ];
2260
+ }
2261
+
2262
+ function moment_valid__isValid() {
2263
+ return valid__isValid(this);
2264
+ }
2265
+
2266
+ function parsingFlags() {
2267
+ return extend({}, getParsingFlags(this));
2268
+ }
2269
+
2270
+ function invalidAt() {
2271
+ return getParsingFlags(this).overflow;
2272
+ }
2273
+
2274
+ addFormatToken(0, ["gg", 2], 0, function () {
2275
+ return this.weekYear() % 100;
2276
+ });
2277
+
2278
+ addFormatToken(0, ["GG", 2], 0, function () {
2279
+ return this.isoWeekYear() % 100;
2280
+ });
2281
+
2282
+ function addWeekYearFormatToken(token, getter) {
2283
+ addFormatToken(0, [token, token.length], 0, getter);
2284
+ }
2285
+
2286
+ addWeekYearFormatToken("gggg", "weekYear");
2287
+ addWeekYearFormatToken("ggggg", "weekYear");
2288
+ addWeekYearFormatToken("GGGG", "isoWeekYear");
2289
+ addWeekYearFormatToken("GGGGG", "isoWeekYear");
2290
+
2291
+ // ALIASES
2292
+
2293
+ addUnitAlias("weekYear", "gg");
2294
+ addUnitAlias("isoWeekYear", "GG");
2295
+
2296
+ // PARSING
2297
+
2298
+ addRegexToken("G", matchSigned);
2299
+ addRegexToken("g", matchSigned);
2300
+ addRegexToken("GG", match1to2, match2);
2301
+ addRegexToken("gg", match1to2, match2);
2302
+ addRegexToken("GGGG", match1to4, match4);
2303
+ addRegexToken("gggg", match1to4, match4);
2304
+ addRegexToken("GGGGG", match1to6, match6);
2305
+ addRegexToken("ggggg", match1to6, match6);
2306
+
2307
+ addWeekParseToken(
2308
+ ["gggg", "ggggg", "GGGG", "GGGGG"],
2309
+ function (input, week, config, token) {
2310
+ week[token.substr(0, 2)] = toInt(input);
2311
+ }
2312
+ );
2313
+
2314
+ addWeekParseToken(["gg", "GG"], function (input, week, config, token) {
2315
+ week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
2316
+ });
2317
+
2318
+ // HELPERS
2319
+
2320
+ function weeksInYear(year, dow, doy) {
2321
+ return weekOfYear(
2322
+ local__createLocal([year, 11, 31 + dow - doy]),
2323
+ dow,
2324
+ doy
2325
+ ).week;
2326
+ }
2327
+
2328
+ // MOMENTS
2329
+
2330
+ function getSetWeekYear(input) {
2331
+ var year = weekOfYear(
2332
+ this,
2333
+ this.localeData()._week.dow,
2334
+ this.localeData()._week.doy
2335
+ ).year;
2336
+ return input == null ? year : this.add(input - year, "y");
2337
+ }
2338
+
2339
+ function getSetISOWeekYear(input) {
2340
+ var year = weekOfYear(this, 1, 4).year;
2341
+ return input == null ? year : this.add(input - year, "y");
2342
+ }
2343
+
2344
+ function getISOWeeksInYear() {
2345
+ return weeksInYear(this.year(), 1, 4);
2346
+ }
2347
+
2348
+ function getWeeksInYear() {
2349
+ var weekInfo = this.localeData()._week;
2350
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
2351
+ }
2352
+
2353
+ addFormatToken("Q", 0, 0, "quarter");
2354
+
2355
+ // ALIASES
2356
+
2357
+ addUnitAlias("quarter", "Q");
2358
+
2359
+ // PARSING
2360
+
2361
+ addRegexToken("Q", match1);
2362
+ addParseToken("Q", function (input, array) {
2363
+ array[MONTH] = (toInt(input) - 1) * 3;
2364
+ });
2365
+
2366
+ // MOMENTS
2367
+
2368
+ function getSetQuarter(input) {
2369
+ return input == null
2370
+ ? Math.ceil((this.month() + 1) / 3)
2371
+ : this.month((input - 1) * 3 + (this.month() % 3));
2372
+ }
2373
+
2374
+ addFormatToken("D", ["DD", 2], "Do", "date");
2375
+
2376
+ // ALIASES
2377
+
2378
+ addUnitAlias("date", "D");
2379
+
2380
+ // PARSING
2381
+
2382
+ addRegexToken("D", match1to2);
2383
+ addRegexToken("DD", match1to2, match2);
2384
+ addRegexToken("Do", function (isStrict, locale) {
2385
+ return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
2386
+ });
2387
+
2388
+ addParseToken(["D", "DD"], DATE);
2389
+ addParseToken("Do", function (input, array) {
2390
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
2391
+ });
2392
+
2393
+ // MOMENTS
2394
+
2395
+ var getSetDayOfMonth = makeGetSet("Date", true);
2396
+
2397
+ addFormatToken("d", 0, "do", "day");
2398
+
2399
+ addFormatToken("dd", 0, 0, function (format) {
2400
+ return this.localeData().weekdaysMin(this, format);
2401
+ });
2402
+
2403
+ addFormatToken("ddd", 0, 0, function (format) {
2404
+ return this.localeData().weekdaysShort(this, format);
2405
+ });
2406
+
2407
+ addFormatToken("dddd", 0, 0, function (format) {
2408
+ return this.localeData().weekdays(this, format);
2409
+ });
2410
+
2411
+ addFormatToken("e", 0, 0, "weekday");
2412
+ addFormatToken("E", 0, 0, "isoWeekday");
2413
+
2414
+ // ALIASES
2415
+
2416
+ addUnitAlias("day", "d");
2417
+ addUnitAlias("weekday", "e");
2418
+ addUnitAlias("isoWeekday", "E");
2419
+
2420
+ // PARSING
2421
+
2422
+ addRegexToken("d", match1to2);
2423
+ addRegexToken("e", match1to2);
2424
+ addRegexToken("E", match1to2);
2425
+ addRegexToken("dd", matchWord);
2426
+ addRegexToken("ddd", matchWord);
2427
+ addRegexToken("dddd", matchWord);
2428
+
2429
+ addWeekParseToken(["dd", "ddd", "dddd"], function (input, week, config) {
2430
+ var weekday = config._locale.weekdaysParse(input);
2431
+ // if we didn't get a weekday name, mark the date as invalid
2432
+ if (weekday != null) {
2433
+ week.d = weekday;
2434
+ } else {
2435
+ getParsingFlags(config).invalidWeekday = input;
2436
+ }
2437
+ });
2438
+
2439
+ addWeekParseToken(["d", "e", "E"], function (input, week, config, token) {
2440
+ week[token] = toInt(input);
2441
+ });
2442
+
2443
+ // HELPERS
2444
+
2445
+ function parseWeekday(input, locale) {
2446
+ if (typeof input === "string") {
2447
+ if (!isNaN(input)) {
2448
+ input = parseInt(input, 10);
2449
+ } else {
2450
+ input = locale.weekdaysParse(input);
2451
+ if (typeof input !== "number") {
2452
+ return null;
2453
+ }
2454
+ }
2455
+ }
2456
+ return input;
2457
+ }
2458
+
2459
+ // LOCALES
2460
+
2461
+ var defaultLocaleWeekdays =
2462
+ "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");
2463
+ function localeWeekdays(m) {
2464
+ return this._weekdays[m.day()];
2465
+ }
2466
+
2467
+ var defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");
2468
+ function localeWeekdaysShort(m) {
2469
+ return this._weekdaysShort[m.day()];
2470
+ }
2471
+
2472
+ var defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_");
2473
+ function localeWeekdaysMin(m) {
2474
+ return this._weekdaysMin[m.day()];
2475
+ }
2476
+
2477
+ function localeWeekdaysParse(weekdayName) {
2478
+ var i, mom, regex;
2479
+
2480
+ if (!this._weekdaysParse) {
2481
+ this._weekdaysParse = [];
2482
+ }
2483
+
2484
+ for (i = 0; i < 7; i++) {
2485
+ // make the regex if we don't have it already
2486
+ if (!this._weekdaysParse[i]) {
2487
+ mom = local__createLocal([2000, 1]).day(i);
2488
+ regex =
2489
+ "^" +
2490
+ this.weekdays(mom, "") +
2491
+ "|^" +
2492
+ this.weekdaysShort(mom, "") +
2493
+ "|^" +
2494
+ this.weekdaysMin(mom, "");
2495
+ this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i");
2496
+ }
2497
+ // test the regex
2498
+ if (this._weekdaysParse[i].test(weekdayName)) {
2499
+ return i;
2500
+ }
2501
+ }
2502
+ }
2503
+
2504
+ // MOMENTS
2505
+
2506
+ function getSetDayOfWeek(input) {
2507
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
2508
+ if (input != null) {
2509
+ input = parseWeekday(input, this.localeData());
2510
+ return this.add(input - day, "d");
2511
+ } else {
2512
+ return day;
2513
+ }
2514
+ }
2515
+
2516
+ function getSetLocaleDayOfWeek(input) {
2517
+ var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
2518
+ return input == null ? weekday : this.add(input - weekday, "d");
2519
+ }
2520
+
2521
+ function getSetISODayOfWeek(input) {
2522
+ // behaves the same as moment#day except
2523
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
2524
+ // as a setter, sunday should belong to the previous week.
2525
+ return input == null
2526
+ ? this.day() || 7
2527
+ : this.day(this.day() % 7 ? input : input - 7);
2528
+ }
2529
+
2530
+ addFormatToken("H", ["HH", 2], 0, "hour");
2531
+ addFormatToken("h", ["hh", 2], 0, function () {
2532
+ return this.hours() % 12 || 12;
2533
+ });
2534
+
2535
+ function meridiem(token, lowercase) {
2536
+ addFormatToken(token, 0, 0, function () {
2537
+ return this.localeData().meridiem(
2538
+ this.hours(),
2539
+ this.minutes(),
2540
+ lowercase
2541
+ );
2542
+ });
2543
+ }
2544
+
2545
+ meridiem("a", true);
2546
+ meridiem("A", false);
2547
+
2548
+ // ALIASES
2549
+
2550
+ addUnitAlias("hour", "h");
2551
+
2552
+ // PARSING
2553
+
2554
+ function matchMeridiem(isStrict, locale) {
2555
+ return locale._meridiemParse;
2556
+ }
2557
+
2558
+ addRegexToken("a", matchMeridiem);
2559
+ addRegexToken("A", matchMeridiem);
2560
+ addRegexToken("H", match1to2);
2561
+ addRegexToken("h", match1to2);
2562
+ addRegexToken("HH", match1to2, match2);
2563
+ addRegexToken("hh", match1to2, match2);
2564
+
2565
+ addParseToken(["H", "HH"], HOUR);
2566
+ addParseToken(["a", "A"], function (input, array, config) {
2567
+ config._isPm = config._locale.isPM(input);
2568
+ config._meridiem = input;
2569
+ });
2570
+ addParseToken(["h", "hh"], function (input, array, config) {
2571
+ array[HOUR] = toInt(input);
2572
+ getParsingFlags(config).bigHour = true;
2573
+ });
2574
+
2575
+ // LOCALES
2576
+
2577
+ function localeIsPM(input) {
2578
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
2579
+ // Using charAt should be more compatible.
2580
+ return (input + "").toLowerCase().charAt(0) === "p";
2581
+ }
2582
+
2583
+ var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
2584
+ function localeMeridiem(hours, minutes, isLower) {
2585
+ if (hours > 11) {
2586
+ return isLower ? "pm" : "PM";
2587
+ } else {
2588
+ return isLower ? "am" : "AM";
2589
+ }
2590
+ }
2591
+
2592
+ // MOMENTS
2593
+
2594
+ // Setting the hour should keep the time, because the user explicitly
2595
+ // specified which hour he wants. So trying to maintain the same hour (in
2596
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
2597
+ // this rule.
2598
+ var getSetHour = makeGetSet("Hours", true);
2599
+
2600
+ addFormatToken("m", ["mm", 2], 0, "minute");
2601
+
2602
+ // ALIASES
2603
+
2604
+ addUnitAlias("minute", "m");
2605
+
2606
+ // PARSING
2607
+
2608
+ addRegexToken("m", match1to2);
2609
+ addRegexToken("mm", match1to2, match2);
2610
+ addParseToken(["m", "mm"], MINUTE);
2611
+
2612
+ // MOMENTS
2613
+
2614
+ var getSetMinute = makeGetSet("Minutes", false);
2615
+
2616
+ addFormatToken("s", ["ss", 2], 0, "second");
2617
+
2618
+ // ALIASES
2619
+
2620
+ addUnitAlias("second", "s");
2621
+
2622
+ // PARSING
2623
+
2624
+ addRegexToken("s", match1to2);
2625
+ addRegexToken("ss", match1to2, match2);
2626
+ addParseToken(["s", "ss"], SECOND);
2627
+
2628
+ // MOMENTS
2629
+
2630
+ var getSetSecond = makeGetSet("Seconds", false);
2631
+
2632
+ addFormatToken("S", 0, 0, function () {
2633
+ return ~~(this.millisecond() / 100);
2634
+ });
2635
+
2636
+ addFormatToken(0, ["SS", 2], 0, function () {
2637
+ return ~~(this.millisecond() / 10);
2638
+ });
2639
+
2640
+ function millisecond__milliseconds(token) {
2641
+ addFormatToken(0, [token, 3], 0, "millisecond");
2642
+ }
2643
+
2644
+ millisecond__milliseconds("SSS");
2645
+ millisecond__milliseconds("SSSS");
2646
+
2647
+ // ALIASES
2648
+
2649
+ addUnitAlias("millisecond", "ms");
2650
+
2651
+ // PARSING
2652
+
2653
+ addRegexToken("S", match1to3, match1);
2654
+ addRegexToken("SS", match1to3, match2);
2655
+ addRegexToken("SSS", match1to3, match3);
2656
+ addRegexToken("SSSS", matchUnsigned);
2657
+ addParseToken(["S", "SS", "SSS", "SSSS"], function (input, array) {
2658
+ array[MILLISECOND] = toInt(("0." + input) * 1000);
2659
+ });
2660
+
2661
+ // MOMENTS
2662
+
2663
+ var getSetMillisecond = makeGetSet("Milliseconds", false);
2664
+
2665
+ addFormatToken("z", 0, 0, "zoneAbbr");
2666
+ addFormatToken("zz", 0, 0, "zoneName");
2667
+
2668
+ // MOMENTS
2669
+
2670
+ function getZoneAbbr() {
2671
+ return this._isUTC ? "UTC" : "";
2672
+ }
2673
+
2674
+ function getZoneName() {
2675
+ return this._isUTC ? "Coordinated Universal Time" : "";
2676
+ }
2677
+
2678
+ var momentPrototype__proto = Moment.prototype;
2679
+
2680
+ momentPrototype__proto.add = add_subtract__add;
2681
+ momentPrototype__proto.calendar = moment_calendar__calendar;
2682
+ momentPrototype__proto.clone = clone;
2683
+ momentPrototype__proto.diff = diff;
2684
+ momentPrototype__proto.endOf = endOf;
2685
+ momentPrototype__proto.format = format;
2686
+ momentPrototype__proto.from = from;
2687
+ momentPrototype__proto.fromNow = fromNow;
2688
+ momentPrototype__proto.to = to;
2689
+ momentPrototype__proto.toNow = toNow;
2690
+ momentPrototype__proto.get = getSet;
2691
+ momentPrototype__proto.invalidAt = invalidAt;
2692
+ momentPrototype__proto.isAfter = isAfter;
2693
+ momentPrototype__proto.isBefore = isBefore;
2694
+ momentPrototype__proto.isBetween = isBetween;
2695
+ momentPrototype__proto.isSame = isSame;
2696
+ momentPrototype__proto.isValid = moment_valid__isValid;
2697
+ momentPrototype__proto.lang = lang;
2698
+ momentPrototype__proto.locale = locale;
2699
+ momentPrototype__proto.localeData = localeData;
2700
+ momentPrototype__proto.max = prototypeMax;
2701
+ momentPrototype__proto.min = prototypeMin;
2702
+ momentPrototype__proto.parsingFlags = parsingFlags;
2703
+ momentPrototype__proto.set = getSet;
2704
+ momentPrototype__proto.startOf = startOf;
2705
+ momentPrototype__proto.subtract = add_subtract__subtract;
2706
+ momentPrototype__proto.toArray = toArray;
2707
+ momentPrototype__proto.toDate = toDate;
2708
+ momentPrototype__proto.toISOString = moment_format__toISOString;
2709
+ momentPrototype__proto.toJSON = moment_format__toISOString;
2710
+ momentPrototype__proto.toString = toString;
2711
+ momentPrototype__proto.unix = unix;
2712
+ momentPrototype__proto.valueOf = to_type__valueOf;
2713
+
2714
+ // Year
2715
+ momentPrototype__proto.year = getSetYear;
2716
+ momentPrototype__proto.isLeapYear = getIsLeapYear;
2717
+
2718
+ // Week Year
2719
+ momentPrototype__proto.weekYear = getSetWeekYear;
2720
+ momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
2721
+
2722
+ // Quarter
2723
+ momentPrototype__proto.quarter = momentPrototype__proto.quarters =
2724
+ getSetQuarter;
2725
+
2726
+ // Month
2727
+ momentPrototype__proto.month = getSetMonth;
2728
+ momentPrototype__proto.daysInMonth = getDaysInMonth;
2729
+
2730
+ // Week
2731
+ momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
2732
+ momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks =
2733
+ getSetISOWeek;
2734
+ momentPrototype__proto.weeksInYear = getWeeksInYear;
2735
+ momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
2736
+
2737
+ // Day
2738
+ momentPrototype__proto.date = getSetDayOfMonth;
2739
+ momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
2740
+ momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
2741
+ momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
2742
+ momentPrototype__proto.dayOfYear = getSetDayOfYear;
2743
+
2744
+ // Hour
2745
+ momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
2746
+
2747
+ // Minute
2748
+ momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
2749
+
2750
+ // Second
2751
+ momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
2752
+
2753
+ // Millisecond
2754
+ momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds =
2755
+ getSetMillisecond;
2756
+
2757
+ // Offset
2758
+ momentPrototype__proto.utcOffset = getSetOffset;
2759
+ momentPrototype__proto.utc = setOffsetToUTC;
2760
+ momentPrototype__proto.local = setOffsetToLocal;
2761
+ momentPrototype__proto.parseZone = setOffsetToParsedOffset;
2762
+ momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
2763
+ momentPrototype__proto.isDST = isDaylightSavingTime;
2764
+ momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
2765
+ momentPrototype__proto.isLocal = isLocal;
2766
+ momentPrototype__proto.isUtcOffset = isUtcOffset;
2767
+ momentPrototype__proto.isUtc = isUtc;
2768
+ momentPrototype__proto.isUTC = isUtc;
2769
+
2770
+ // Timezone
2771
+ momentPrototype__proto.zoneAbbr = getZoneAbbr;
2772
+ momentPrototype__proto.zoneName = getZoneName;
2773
+
2774
+ // Deprecations
2775
+ momentPrototype__proto.dates = deprecate(
2776
+ "dates accessor is deprecated. Use date instead.",
2777
+ getSetDayOfMonth
2778
+ );
2779
+ momentPrototype__proto.months = deprecate(
2780
+ "months accessor is deprecated. Use month instead",
2781
+ getSetMonth
2782
+ );
2783
+ momentPrototype__proto.years = deprecate(
2784
+ "years accessor is deprecated. Use year instead",
2785
+ getSetYear
2786
+ );
2787
+ momentPrototype__proto.zone = deprecate(
2788
+ "moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",
2789
+ getSetZone
2790
+ );
2791
+
2792
+ var momentPrototype = momentPrototype__proto;
2793
+
2794
+ function moment__createUnix(input) {
2795
+ return local__createLocal(input * 1000);
2796
+ }
2797
+
2798
+ function moment__createInZone() {
2799
+ return local__createLocal.apply(null, arguments).parseZone();
2800
+ }
2801
+
2802
+ var defaultCalendar = {
2803
+ sameDay: "[Today at] LT",
2804
+ nextDay: "[Tomorrow at] LT",
2805
+ nextWeek: "dddd [at] LT",
2806
+ lastDay: "[Yesterday at] LT",
2807
+ lastWeek: "[Last] dddd [at] LT",
2808
+ sameElse: "L",
2809
+ };
2810
+
2811
+ function locale_calendar__calendar(key, mom, now) {
2812
+ var output = this._calendar[key];
2813
+ return typeof output === "function" ? output.call(mom, now) : output;
2814
+ }
2815
+
2816
+ var defaultLongDateFormat = {
2817
+ LTS: "h:mm:ss A",
2818
+ LT: "h:mm A",
2819
+ L: "MM/DD/YYYY",
2820
+ LL: "MMMM D, YYYY",
2821
+ LLL: "MMMM D, YYYY LT",
2822
+ LLLL: "dddd, MMMM D, YYYY LT",
2823
+ };
2824
+
2825
+ function longDateFormat(key) {
2826
+ var output = this._longDateFormat[key];
2827
+ if (!output && this._longDateFormat[key.toUpperCase()]) {
2828
+ output = this._longDateFormat[key.toUpperCase()].replace(
2829
+ /MMMM|MM|DD|dddd/g,
2830
+ function (val) {
2831
+ return val.slice(1);
2832
+ }
2833
+ );
2834
+ this._longDateFormat[key] = output;
2835
+ }
2836
+ return output;
2837
+ }
2838
+
2839
+ var defaultInvalidDate = "Invalid date";
2840
+
2841
+ function invalidDate() {
2842
+ return this._invalidDate;
2843
+ }
2844
+
2845
+ var defaultOrdinal = "%d";
2846
+ var defaultOrdinalParse = /\d{1,2}/;
2847
+
2848
+ function ordinal(number) {
2849
+ return this._ordinal.replace("%d", number);
2850
+ }
2851
+
2852
+ function preParsePostFormat(string) {
2853
+ return string;
2854
+ }
2855
+
2856
+ var defaultRelativeTime = {
2857
+ future: "in %s",
2858
+ past: "%s ago",
2859
+ s: "a few seconds",
2860
+ m: "a minute",
2861
+ mm: "%d minutes",
2862
+ h: "an hour",
2863
+ hh: "%d hours",
2864
+ d: "a day",
2865
+ dd: "%d days",
2866
+ M: "a month",
2867
+ MM: "%d months",
2868
+ y: "a year",
2869
+ yy: "%d years",
2870
+ };
2871
+
2872
+ function relative__relativeTime(number, withoutSuffix, string, isFuture) {
2873
+ var output = this._relativeTime[string];
2874
+ return typeof output === "function"
2875
+ ? output(number, withoutSuffix, string, isFuture)
2876
+ : output.replace(/%d/i, number);
2877
+ }
2878
+
2879
+ function pastFuture(diff, output) {
2880
+ var format = this._relativeTime[diff > 0 ? "future" : "past"];
2881
+ return typeof format === "function"
2882
+ ? format(output)
2883
+ : format.replace(/%s/i, output);
2884
+ }
2885
+
2886
+ function locale_set__set(config) {
2887
+ var prop, i;
2888
+ for (i in config) {
2889
+ prop = config[i];
2890
+ if (typeof prop === "function") {
2891
+ this[i] = prop;
2892
+ } else {
2893
+ this["_" + i] = prop;
2894
+ }
2895
+ }
2896
+ // Lenient ordinal parsing accepts just a number in addition to
2897
+ // number + (possibly) stuff coming from _ordinalParseLenient.
2898
+ this._ordinalParseLenient = new RegExp(
2899
+ this._ordinalParse.source + "|" + /\d{1,2}/.source
2900
+ );
2901
+ }
2902
+
2903
+ var prototype__proto = Locale.prototype;
2904
+
2905
+ prototype__proto._calendar = defaultCalendar;
2906
+ prototype__proto.calendar = locale_calendar__calendar;
2907
+ prototype__proto._longDateFormat = defaultLongDateFormat;
2908
+ prototype__proto.longDateFormat = longDateFormat;
2909
+ prototype__proto._invalidDate = defaultInvalidDate;
2910
+ prototype__proto.invalidDate = invalidDate;
2911
+ prototype__proto._ordinal = defaultOrdinal;
2912
+ prototype__proto.ordinal = ordinal;
2913
+ prototype__proto._ordinalParse = defaultOrdinalParse;
2914
+ prototype__proto.preparse = preParsePostFormat;
2915
+ prototype__proto.postformat = preParsePostFormat;
2916
+ prototype__proto._relativeTime = defaultRelativeTime;
2917
+ prototype__proto.relativeTime = relative__relativeTime;
2918
+ prototype__proto.pastFuture = pastFuture;
2919
+ prototype__proto.set = locale_set__set;
2920
+
2921
+ // Month
2922
+ prototype__proto.months = localeMonths;
2923
+ prototype__proto._months = defaultLocaleMonths;
2924
+ prototype__proto.monthsShort = localeMonthsShort;
2925
+ prototype__proto._monthsShort = defaultLocaleMonthsShort;
2926
+ prototype__proto.monthsParse = localeMonthsParse;
2927
+
2928
+ // Week
2929
+ prototype__proto.week = localeWeek;
2930
+ prototype__proto._week = defaultLocaleWeek;
2931
+ prototype__proto.firstDayOfYear = localeFirstDayOfYear;
2932
+ prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
2933
+
2934
+ // Day of Week
2935
+ prototype__proto.weekdays = localeWeekdays;
2936
+ prototype__proto._weekdays = defaultLocaleWeekdays;
2937
+ prototype__proto.weekdaysMin = localeWeekdaysMin;
2938
+ prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
2939
+ prototype__proto.weekdaysShort = localeWeekdaysShort;
2940
+ prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
2941
+ prototype__proto.weekdaysParse = localeWeekdaysParse;
2942
+
2943
+ // Hours
2944
+ prototype__proto.isPM = localeIsPM;
2945
+ prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
2946
+ prototype__proto.meridiem = localeMeridiem;
2947
+
2948
+ function lists__get(format, index, field, setter) {
2949
+ var locale = locale_locales__getLocale();
2950
+ var utc = create_utc__createUTC().set(setter, index);
2951
+ return locale[field](utc, format);
2952
+ }
2953
+
2954
+ function list(format, index, field, count, setter) {
2955
+ if (typeof format === "number") {
2956
+ index = format;
2957
+ format = undefined;
2958
+ }
2959
+
2960
+ format = format || "";
2961
+
2962
+ if (index != null) {
2963
+ return lists__get(format, index, field, setter);
2964
+ }
2965
+
2966
+ var i;
2967
+ var out = [];
2968
+ for (i = 0; i < count; i++) {
2969
+ out[i] = lists__get(format, i, field, setter);
2970
+ }
2971
+ return out;
2972
+ }
2973
+
2974
+ function lists__listMonths(format, index) {
2975
+ return list(format, index, "months", 12, "month");
2976
+ }
2977
+
2978
+ function lists__listMonthsShort(format, index) {
2979
+ return list(format, index, "monthsShort", 12, "month");
2980
+ }
2981
+
2982
+ function lists__listWeekdays(format, index) {
2983
+ return list(format, index, "weekdays", 7, "day");
2984
+ }
2985
+
2986
+ function lists__listWeekdaysShort(format, index) {
2987
+ return list(format, index, "weekdaysShort", 7, "day");
2988
+ }
2989
+
2990
+ function lists__listWeekdaysMin(format, index) {
2991
+ return list(format, index, "weekdaysMin", 7, "day");
2992
+ }
2993
+
2994
+ locale_locales__getSetGlobalLocale("en", {
2995
+ ordinalParse: /\d{1,2}(th|st|nd|rd)/,
2996
+ ordinal: function (number) {
2997
+ var b = number % 10,
2998
+ output =
2999
+ toInt((number % 100) / 10) === 1
3000
+ ? "th"
3001
+ : b === 1
3002
+ ? "st"
3003
+ : b === 2
3004
+ ? "nd"
3005
+ : b === 3
3006
+ ? "rd"
3007
+ : "th";
3008
+ return number + output;
3009
+ },
3010
+ });
3011
+
3012
+ // Side effect imports
3013
+ utils_hooks__hooks.lang = deprecate(
3014
+ "moment.lang is deprecated. Use moment.locale instead.",
3015
+ locale_locales__getSetGlobalLocale
3016
+ );
3017
+ utils_hooks__hooks.langData = deprecate(
3018
+ "moment.langData is deprecated. Use moment.localeData instead.",
3019
+ locale_locales__getLocale
3020
+ );
3021
+
3022
+ var mathAbs = Math.abs;
3023
+
3024
+ function duration_abs__abs() {
3025
+ var data = this._data;
3026
+
3027
+ this._milliseconds = mathAbs(this._milliseconds);
3028
+ this._days = mathAbs(this._days);
3029
+ this._months = mathAbs(this._months);
3030
+
3031
+ data.milliseconds = mathAbs(data.milliseconds);
3032
+ data.seconds = mathAbs(data.seconds);
3033
+ data.minutes = mathAbs(data.minutes);
3034
+ data.hours = mathAbs(data.hours);
3035
+ data.months = mathAbs(data.months);
3036
+ data.years = mathAbs(data.years);
3037
+
3038
+ return this;
3039
+ }
3040
+
3041
+ function duration_add_subtract__addSubtract(
3042
+ duration,
3043
+ input,
3044
+ value,
3045
+ direction
3046
+ ) {
3047
+ var other = create__createDuration(input, value);
3048
+
3049
+ duration._milliseconds += direction * other._milliseconds;
3050
+ duration._days += direction * other._days;
3051
+ duration._months += direction * other._months;
3052
+
3053
+ return duration._bubble();
3054
+ }
3055
+
3056
+ // supports only 2.0-style add(1, 's') or add(duration)
3057
+ function duration_add_subtract__add(input, value) {
3058
+ return duration_add_subtract__addSubtract(this, input, value, 1);
3059
+ }
3060
+
3061
+ // supports only 2.0-style subtract(1, 's') or subtract(duration)
3062
+ function duration_add_subtract__subtract(input, value) {
3063
+ return duration_add_subtract__addSubtract(this, input, value, -1);
3064
+ }
3065
+
3066
+ function bubble() {
3067
+ var milliseconds = this._milliseconds;
3068
+ var days = this._days;
3069
+ var months = this._months;
3070
+ var data = this._data;
3071
+ var seconds,
3072
+ minutes,
3073
+ hours,
3074
+ years = 0;
3075
+
3076
+ // The following code bubbles up values, see the tests for
3077
+ // examples of what that means.
3078
+ data.milliseconds = milliseconds % 1000;
3079
+
3080
+ seconds = absFloor(milliseconds / 1000);
3081
+ data.seconds = seconds % 60;
3082
+
3083
+ minutes = absFloor(seconds / 60);
3084
+ data.minutes = minutes % 60;
3085
+
3086
+ hours = absFloor(minutes / 60);
3087
+ data.hours = hours % 24;
3088
+
3089
+ days += absFloor(hours / 24);
3090
+
3091
+ // Accurately convert days to years, assume start from year 0.
3092
+ years = absFloor(daysToYears(days));
3093
+ days -= absFloor(yearsToDays(years));
3094
+
3095
+ // 30 days to a month
3096
+ // TODO (iskren): Use anchor date (like 1st Jan) to compute this.
3097
+ months += absFloor(days / 30);
3098
+ days %= 30;
3099
+
3100
+ // 12 months -> 1 year
3101
+ years += absFloor(months / 12);
3102
+ months %= 12;
3103
+
3104
+ data.days = days;
3105
+ data.months = months;
3106
+ data.years = years;
3107
+
3108
+ return this;
3109
+ }
3110
+
3111
+ function daysToYears(days) {
3112
+ // 400 years have 146097 days (taking into account leap year rules)
3113
+ return (days * 400) / 146097;
3114
+ }
3115
+
3116
+ function yearsToDays(years) {
3117
+ // years * 365 + absFloor(years / 4) -
3118
+ // absFloor(years / 100) + absFloor(years / 400);
3119
+ return (years * 146097) / 400;
3120
+ }
3121
+
3122
+ function as(units) {
3123
+ var days;
3124
+ var months;
3125
+ var milliseconds = this._milliseconds;
3126
+
3127
+ units = normalizeUnits(units);
3128
+
3129
+ if (units === "month" || units === "year") {
3130
+ days = this._days + milliseconds / 864e5;
3131
+ months = this._months + daysToYears(days) * 12;
3132
+ return units === "month" ? months : months / 12;
3133
+ } else {
3134
+ // handle milliseconds separately because of floating point math errors (issue #1867)
3135
+ days = this._days + Math.round(yearsToDays(this._months / 12));
3136
+ switch (units) {
3137
+ case "week":
3138
+ return days / 7 + milliseconds / 6048e5;
3139
+ case "day":
3140
+ return days + milliseconds / 864e5;
3141
+ case "hour":
3142
+ return days * 24 + milliseconds / 36e5;
3143
+ case "minute":
3144
+ return days * 1440 + milliseconds / 6e4;
3145
+ case "second":
3146
+ return days * 86400 + milliseconds / 1000;
3147
+ // Math.floor prevents floating point math errors here
3148
+ case "millisecond":
3149
+ return Math.floor(days * 864e5) + milliseconds;
3150
+ default:
3151
+ throw new Error("Unknown unit " + units);
3152
+ }
3153
+ }
3154
+ }
3155
+
3156
+ // TODO: Use this.as('ms')?
3157
+ function duration_as__valueOf() {
3158
+ return (
3159
+ this._milliseconds +
3160
+ this._days * 864e5 +
3161
+ (this._months % 12) * 2592e6 +
3162
+ toInt(this._months / 12) * 31536e6
3163
+ );
3164
+ }
3165
+
3166
+ function makeAs(alias) {
3167
+ return function () {
3168
+ return this.as(alias);
3169
+ };
3170
+ }
3171
+
3172
+ var asMilliseconds = makeAs("ms");
3173
+ var asSeconds = makeAs("s");
3174
+ var asMinutes = makeAs("m");
3175
+ var asHours = makeAs("h");
3176
+ var asDays = makeAs("d");
3177
+ var asWeeks = makeAs("w");
3178
+ var asMonths = makeAs("M");
3179
+ var asYears = makeAs("y");
3180
+
3181
+ function duration_get__get(units) {
3182
+ units = normalizeUnits(units);
3183
+ return this[units + "s"]();
3184
+ }
3185
+
3186
+ function makeGetter(name) {
3187
+ return function () {
3188
+ return this._data[name];
3189
+ };
3190
+ }
3191
+
3192
+ var duration_get__milliseconds = makeGetter("milliseconds");
3193
+ var seconds = makeGetter("seconds");
3194
+ var minutes = makeGetter("minutes");
3195
+ var hours = makeGetter("hours");
3196
+ var days = makeGetter("days");
3197
+ var months = makeGetter("months");
3198
+ var years = makeGetter("years");
3199
+
3200
+ function weeks() {
3201
+ return absFloor(this.days() / 7);
3202
+ }
3203
+
3204
+ var round = Math.round;
3205
+ var thresholds = {
3206
+ s: 45, // seconds to minute
3207
+ m: 45, // minutes to hour
3208
+ h: 22, // hours to day
3209
+ d: 26, // days to month
3210
+ M: 11, // months to year
3211
+ };
3212
+
3213
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
3214
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
3215
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
3216
+ }
3217
+
3218
+ function duration_humanize__relativeTime(
3219
+ posNegDuration,
3220
+ withoutSuffix,
3221
+ locale
3222
+ ) {
3223
+ var duration = create__createDuration(posNegDuration).abs();
3224
+ var seconds = round(duration.as("s"));
3225
+ var minutes = round(duration.as("m"));
3226
+ var hours = round(duration.as("h"));
3227
+ var days = round(duration.as("d"));
3228
+ var months = round(duration.as("M"));
3229
+ var years = round(duration.as("y"));
3230
+
3231
+ var a = (seconds < thresholds.s && ["s", seconds]) ||
3232
+ (minutes === 1 && ["m"]) ||
3233
+ (minutes < thresholds.m && ["mm", minutes]) ||
3234
+ (hours === 1 && ["h"]) ||
3235
+ (hours < thresholds.h && ["hh", hours]) ||
3236
+ (days === 1 && ["d"]) ||
3237
+ (days < thresholds.d && ["dd", days]) ||
3238
+ (months === 1 && ["M"]) ||
3239
+ (months < thresholds.M && ["MM", months]) ||
3240
+ (years === 1 && ["y"]) || ["yy", years];
3241
+
3242
+ a[2] = withoutSuffix;
3243
+ a[3] = +posNegDuration > 0;
3244
+ a[4] = locale;
3245
+ return substituteTimeAgo.apply(null, a);
3246
+ }
3247
+
3248
+ // This function allows you to set a threshold for relative time strings
3249
+ function duration_humanize__getSetRelativeTimeThreshold(threshold, limit) {
3250
+ if (thresholds[threshold] === undefined) {
3251
+ return false;
3252
+ }
3253
+ if (limit === undefined) {
3254
+ return thresholds[threshold];
3255
+ }
3256
+ thresholds[threshold] = limit;
3257
+ return true;
3258
+ }
3259
+
3260
+ function humanize(withSuffix) {
3261
+ var locale = this.localeData();
3262
+ var output = duration_humanize__relativeTime(this, !withSuffix, locale);
3263
+
3264
+ if (withSuffix) {
3265
+ output = locale.pastFuture(+this, output);
3266
+ }
3267
+
3268
+ return locale.postformat(output);
3269
+ }
3270
+
3271
+ var iso_string__abs = Math.abs;
3272
+
3273
+ function iso_string__toISOString() {
3274
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
3275
+ var Y = iso_string__abs(this.years());
3276
+ var M = iso_string__abs(this.months());
3277
+ var D = iso_string__abs(this.days());
3278
+ var h = iso_string__abs(this.hours());
3279
+ var m = iso_string__abs(this.minutes());
3280
+ var s = iso_string__abs(this.seconds() + this.milliseconds() / 1000);
3281
+ var total = this.asSeconds();
3282
+
3283
+ if (!total) {
3284
+ // this is the same as C#'s (Noda) and python (isodate)...
3285
+ // but not other JS (goog.date)
3286
+ return "P0D";
3287
+ }
3288
+
3289
+ return (
3290
+ (total < 0 ? "-" : "") +
3291
+ "P" +
3292
+ (Y ? Y + "Y" : "") +
3293
+ (M ? M + "M" : "") +
3294
+ (D ? D + "D" : "") +
3295
+ (h || m || s ? "T" : "") +
3296
+ (h ? h + "H" : "") +
3297
+ (m ? m + "M" : "") +
3298
+ (s ? s + "S" : "")
3299
+ );
3300
+ }
3301
+
3302
+ var duration_prototype__proto = Duration.prototype;
3303
+
3304
+ duration_prototype__proto.abs = duration_abs__abs;
3305
+ duration_prototype__proto.add = duration_add_subtract__add;
3306
+ duration_prototype__proto.subtract = duration_add_subtract__subtract;
3307
+ duration_prototype__proto.as = as;
3308
+ duration_prototype__proto.asMilliseconds = asMilliseconds;
3309
+ duration_prototype__proto.asSeconds = asSeconds;
3310
+ duration_prototype__proto.asMinutes = asMinutes;
3311
+ duration_prototype__proto.asHours = asHours;
3312
+ duration_prototype__proto.asDays = asDays;
3313
+ duration_prototype__proto.asWeeks = asWeeks;
3314
+ duration_prototype__proto.asMonths = asMonths;
3315
+ duration_prototype__proto.asYears = asYears;
3316
+ duration_prototype__proto.valueOf = duration_as__valueOf;
3317
+ duration_prototype__proto._bubble = bubble;
3318
+ duration_prototype__proto.get = duration_get__get;
3319
+ duration_prototype__proto.milliseconds = duration_get__milliseconds;
3320
+ duration_prototype__proto.seconds = seconds;
3321
+ duration_prototype__proto.minutes = minutes;
3322
+ duration_prototype__proto.hours = hours;
3323
+ duration_prototype__proto.days = days;
3324
+ duration_prototype__proto.weeks = weeks;
3325
+ duration_prototype__proto.months = months;
3326
+ duration_prototype__proto.years = years;
3327
+ duration_prototype__proto.humanize = humanize;
3328
+ duration_prototype__proto.toISOString = iso_string__toISOString;
3329
+ duration_prototype__proto.toString = iso_string__toISOString;
3330
+ duration_prototype__proto.toJSON = iso_string__toISOString;
3331
+ duration_prototype__proto.locale = locale;
3332
+ duration_prototype__proto.localeData = localeData;
3333
+
3334
+ // Deprecations
3335
+ duration_prototype__proto.toIsoString = deprecate(
3336
+ "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
3337
+ iso_string__toISOString
3338
+ );
3339
+ duration_prototype__proto.lang = lang;
3340
+
3341
+ // Side effect imports
3342
+
3343
+ addFormatToken("X", 0, 0, "unix");
3344
+ addFormatToken("x", 0, 0, "valueOf");
3345
+
3346
+ // PARSING
3347
+
3348
+ addRegexToken("x", matchSigned);
3349
+ addRegexToken("X", matchTimestamp);
3350
+ addParseToken("X", function (input, array, config) {
3351
+ config._d = new Date(parseFloat(input, 10) * 1000);
3352
+ });
3353
+ addParseToken("x", function (input, array, config) {
3354
+ config._d = new Date(toInt(input));
3355
+ });
3356
+
3357
+ // Side effect imports
3358
+
3359
+ utils_hooks__hooks.version = "2.10.3";
3360
+
3361
+ setHookCallback(local__createLocal);
3362
+
3363
+ utils_hooks__hooks.fn = momentPrototype;
3364
+ utils_hooks__hooks.min = min;
3365
+ utils_hooks__hooks.max = max;
3366
+ utils_hooks__hooks.utc = create_utc__createUTC;
3367
+ utils_hooks__hooks.unix = moment__createUnix;
3368
+ utils_hooks__hooks.months = lists__listMonths;
3369
+ utils_hooks__hooks.isDate = isDate;
3370
+ utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
3371
+ utils_hooks__hooks.invalid = valid__createInvalid;
3372
+ utils_hooks__hooks.duration = create__createDuration;
3373
+ utils_hooks__hooks.isMoment = isMoment;
3374
+ utils_hooks__hooks.weekdays = lists__listWeekdays;
3375
+ utils_hooks__hooks.parseZone = moment__createInZone;
3376
+ utils_hooks__hooks.localeData = locale_locales__getLocale;
3377
+ utils_hooks__hooks.isDuration = isDuration;
3378
+ utils_hooks__hooks.monthsShort = lists__listMonthsShort;
3379
+ utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
3380
+ utils_hooks__hooks.defineLocale = defineLocale;
3381
+ utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
3382
+ utils_hooks__hooks.normalizeUnits = normalizeUnits;
3383
+ utils_hooks__hooks.relativeTimeThreshold =
3384
+ duration_humanize__getSetRelativeTimeThreshold;
3385
+
3386
+ var _moment = utils_hooks__hooks;
3387
+
3388
+ return _moment;
3389
+ });