opengate-js 16.2.0 → 16.3.0

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.
Files changed (40) hide show
  1. package/README.md +84 -8
  2. package/dist/{opengate-api-bower-16.2.0.js → opengate-api-bower-16.3.0.js} +1006 -665
  3. package/dist/opengate-api-bower-16.3.0.js.map +6 -0
  4. package/dist/opengate-api-bower-16.3.0.min.js +117 -0
  5. package/dist/opengate-api-bower-16.3.0.min.js.map +6 -0
  6. package/dist/opengate-api-npm.js +4 -0
  7. package/dist/opengate-api-npm.js.map +1 -1
  8. package/dist/opengate-api-npm.mjs +133 -21
  9. package/dist/opengate-api-npm.mjs.map +1 -1
  10. package/dist/src/InternalOpenGateAPI.js +38 -2
  11. package/dist/src/InternalOpenGateAPI.js.map +1 -1
  12. package/dist/src/searching/AssetSearch.js +1 -1
  13. package/dist/src/searching/AssetSearch.js.map +1 -1
  14. package/dist/src/searching/BaseSearch.js +3 -3
  15. package/dist/src/searching/DeviceSearch.js +1 -1
  16. package/dist/src/searching/DeviceSearch.js.map +1 -1
  17. package/dist/src/searching/EntitySearch.js +1 -1
  18. package/dist/src/searching/EntitySearch.js.map +1 -1
  19. package/dist/src/searching/WPSearch.js +1 -1
  20. package/dist/src/searching/WPSearch.js.map +1 -1
  21. package/dist/src/util/NorthAmpliaREST.js +77 -2
  22. package/dist/src/util/NorthAmpliaREST.js.map +1 -1
  23. package/dist/src/util/http/RequestSpec.js +21 -10
  24. package/dist/src/util/http/RequestSpec.js.map +1 -1
  25. package/opengate-api-npm.js +6 -0
  26. package/package.json +2 -2
  27. package/src/InternalOpenGateAPI.js +46 -2
  28. package/src/searching/AssetSearch.js +1 -1
  29. package/src/searching/BaseSearch.js +3 -3
  30. package/src/searching/DeviceSearch.js +1 -1
  31. package/src/searching/EntitySearch.js +1 -1
  32. package/src/searching/WPSearch.js +1 -1
  33. package/src/util/NorthAmpliaREST.js +87 -2
  34. package/src/util/http/RequestSpec.js +29 -10
  35. package/types/opengate-api-npm.d.ts +7 -1
  36. package/types/src/InternalOpenGateAPI.d.ts +103 -8
  37. package/types/src/util/NorthAmpliaREST.d.ts +25 -0
  38. package/dist/opengate-api-bower-16.2.0.js.map +0 -6
  39. package/dist/opengate-api-bower-16.2.0.min.js +0 -116
  40. package/dist/opengate-api-bower-16.2.0.min.js.map +0 -6
@@ -7058,6 +7058,7 @@
7058
7058
  nullInput: false,
7059
7059
  invalidEra: null,
7060
7060
  invalidMonth: null,
7061
+ invalidOffset: null,
7061
7062
  invalidFormat: false,
7062
7063
  userInvalidated: false,
7063
7064
  iso: false,
@@ -7088,23 +7089,26 @@
7088
7089
  return false;
7089
7090
  };
7090
7091
  }
7091
- function isValid(m) {
7092
- if (m._isValid == null) {
7093
- var flags = getParsingFlags(m), parsedParts = some.call(flags.parsedDateParts, function(i) {
7092
+ function isValid$2(m) {
7093
+ var flags = null, parsedParts = false, isNowValid = m._d && !isNaN(m._d.getTime());
7094
+ if (isNowValid) {
7095
+ flags = getParsingFlags(m);
7096
+ parsedParts = some.call(flags.parsedDateParts, function(i) {
7094
7097
  return i != null;
7095
- }), isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
7098
+ });
7099
+ isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidOffset && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
7096
7100
  if (m._strict) {
7097
7101
  isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
7098
7102
  }
7099
- if (Object.isFrozen == null || !Object.isFrozen(m)) {
7100
- m._isValid = isNowValid;
7101
- } else {
7102
- return isNowValid;
7103
- }
7103
+ }
7104
+ if (Object.isFrozen == null || !Object.isFrozen(m)) {
7105
+ m._isValid = isNowValid;
7106
+ } else {
7107
+ return isNowValid;
7104
7108
  }
7105
7109
  return m._isValid;
7106
7110
  }
7107
- function createInvalid(flags) {
7111
+ function createInvalid$1(flags) {
7108
7112
  var m = createUTC(NaN);
7109
7113
  if (flags != null) {
7110
7114
  extend(getParsingFlags(m), flags);
@@ -7214,7 +7218,7 @@
7214
7218
  hooks2.deprecationHandler(name, msg);
7215
7219
  }
7216
7220
  if (!deprecations[name]) {
7217
- warn(msg);
7221
+ warn(msg + "\n" + new Error().stack);
7218
7222
  deprecations[name] = true;
7219
7223
  }
7220
7224
  }
@@ -7223,81 +7227,106 @@
7223
7227
  function isFunction(input) {
7224
7228
  return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]";
7225
7229
  }
7226
- function set(config) {
7227
- var prop, i;
7228
- for (i in config) {
7229
- if (hasOwnProp(config, i)) {
7230
- prop = config[i];
7231
- if (isFunction(prop)) {
7232
- this[i] = prop;
7233
- } else {
7234
- this["_" + i] = prop;
7235
- }
7236
- }
7237
- }
7238
- this._config = config;
7239
- this._dayOfMonthOrdinalParseLenient = new RegExp(
7240
- (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
7241
- );
7230
+ var aliases = {
7231
+ D: "date",
7232
+ dates: "date",
7233
+ date: "date",
7234
+ d: "day",
7235
+ days: "day",
7236
+ day: "day",
7237
+ e: "weekday",
7238
+ weekdays: "weekday",
7239
+ weekday: "weekday",
7240
+ E: "isoWeekday",
7241
+ isoweekdays: "isoWeekday",
7242
+ isoweekday: "isoWeekday",
7243
+ DDD: "dayOfYear",
7244
+ dayofyears: "dayOfYear",
7245
+ dayofyear: "dayOfYear",
7246
+ h: "hour",
7247
+ hours: "hour",
7248
+ hour: "hour",
7249
+ ms: "millisecond",
7250
+ milliseconds: "millisecond",
7251
+ millisecond: "millisecond",
7252
+ m: "minute",
7253
+ minutes: "minute",
7254
+ minute: "minute",
7255
+ M: "month",
7256
+ months: "month",
7257
+ month: "month",
7258
+ Q: "quarter",
7259
+ quarters: "quarter",
7260
+ quarter: "quarter",
7261
+ s: "second",
7262
+ seconds: "second",
7263
+ second: "second",
7264
+ gg: "weekYear",
7265
+ weekyears: "weekYear",
7266
+ weekyear: "weekYear",
7267
+ GG: "isoWeekYear",
7268
+ isoweekyears: "isoWeekYear",
7269
+ isoweekyear: "isoWeekYear",
7270
+ w: "week",
7271
+ weeks: "week",
7272
+ week: "week",
7273
+ W: "isoWeek",
7274
+ isoweeks: "isoWeek",
7275
+ isoweek: "isoWeek",
7276
+ y: "year",
7277
+ years: "year",
7278
+ year: "year"
7279
+ };
7280
+ function normalizeUnits(units) {
7281
+ return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
7242
7282
  }
7243
- function mergeConfigs(parentConfig, childConfig) {
7244
- var res = extend({}, parentConfig), prop;
7245
- for (prop in childConfig) {
7246
- if (hasOwnProp(childConfig, prop)) {
7247
- if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
7248
- res[prop] = {};
7249
- extend(res[prop], parentConfig[prop]);
7250
- extend(res[prop], childConfig[prop]);
7251
- } else if (childConfig[prop] != null) {
7252
- res[prop] = childConfig[prop];
7253
- } else {
7254
- delete res[prop];
7283
+ function normalizeObjectUnits(inputObject) {
7284
+ var normalizedInput = {}, normalizedProp, prop;
7285
+ for (prop in inputObject) {
7286
+ if (hasOwnProp(inputObject, prop)) {
7287
+ normalizedProp = normalizeUnits(prop);
7288
+ if (normalizedProp) {
7289
+ normalizedInput[normalizedProp] = inputObject[prop];
7255
7290
  }
7256
7291
  }
7257
7292
  }
7258
- for (prop in parentConfig) {
7259
- if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
7260
- res[prop] = extend({}, res[prop]);
7261
- }
7262
- }
7263
- return res;
7264
- }
7265
- function Locale(config) {
7266
- if (config != null) {
7267
- this.set(config);
7268
- }
7269
- }
7270
- var keys;
7271
- if (Object.keys) {
7272
- keys = Object.keys;
7273
- } else {
7274
- keys = function(obj) {
7275
- var i, res = [];
7276
- for (i in obj) {
7277
- if (hasOwnProp(obj, i)) {
7278
- res.push(i);
7279
- }
7280
- }
7281
- return res;
7282
- };
7293
+ return normalizedInput;
7283
7294
  }
7284
- var defaultCalendar = {
7285
- sameDay: "[Today at] LT",
7286
- nextDay: "[Tomorrow at] LT",
7287
- nextWeek: "dddd [at] LT",
7288
- lastDay: "[Yesterday at] LT",
7289
- lastWeek: "[Last] dddd [at] LT",
7290
- sameElse: "L"
7295
+ var priorities = {
7296
+ date: 9,
7297
+ day: 11,
7298
+ weekday: 11,
7299
+ isoWeekday: 11,
7300
+ dayOfYear: 4,
7301
+ hour: 13,
7302
+ millisecond: 16,
7303
+ minute: 14,
7304
+ month: 8,
7305
+ quarter: 7,
7306
+ second: 15,
7307
+ weekYear: 1,
7308
+ isoWeekYear: 1,
7309
+ week: 5,
7310
+ isoWeek: 5,
7311
+ year: 1
7291
7312
  };
7292
- function calendar(key2, mom, now2) {
7293
- var output = this._calendar[key2] || this._calendar["sameElse"];
7294
- return isFunction(output) ? output.call(mom, now2) : output;
7313
+ function getPrioritizedUnits(unitsObj) {
7314
+ var units = [], u;
7315
+ for (u in unitsObj) {
7316
+ if (hasOwnProp(unitsObj, u)) {
7317
+ units.push({ unit: u, priority: priorities[u] });
7318
+ }
7319
+ }
7320
+ units.sort(function(a, b) {
7321
+ return a.priority - b.priority;
7322
+ });
7323
+ return units;
7295
7324
  }
7296
7325
  function zeroFill(number, targetLength, forceSign) {
7297
7326
  var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign2 = number >= 0;
7298
7327
  return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
7299
7328
  }
7300
- var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
7329
+ var formattingTokens = /(\[[^\[]*\])|(\\e)|(\\)?(eHHmm|[Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
7301
7330
  function addFormatToken(token2, padded, ordinal2, callback) {
7302
7331
  var func = callback;
7303
7332
  if (typeof callback === "string") {
@@ -7350,8 +7379,11 @@
7350
7379
  return m.localeData().invalidDate();
7351
7380
  }
7352
7381
  format2 = expandFormat(format2, m.localeData());
7353
- formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2);
7354
- return formatFunctions[format2](m);
7382
+ var cacheKey = "$" + format2;
7383
+ if (!hasOwnProp(formatFunctions, cacheKey)) {
7384
+ formatFunctions[cacheKey] = makeFormatFunction(format2);
7385
+ }
7386
+ return formatFunctions[cacheKey](m);
7355
7387
  }
7356
7388
  function expandFormat(format2, locale2) {
7357
7389
  var i = 5;
@@ -7369,99 +7401,31 @@
7369
7401
  }
7370
7402
  return format2;
7371
7403
  }
7372
- var defaultLongDateFormat = {
7373
- LTS: "h:mm:ss A",
7374
- LT: "h:mm A",
7375
- L: "MM/DD/YYYY",
7376
- LL: "MMMM D, YYYY",
7377
- LLL: "MMMM D, YYYY h:mm A",
7378
- LLLL: "dddd, MMMM D, YYYY h:mm A"
7379
- };
7380
- function longDateFormat(key2) {
7381
- var format2 = this._longDateFormat[key2], formatUpper = this._longDateFormat[key2.toUpperCase()];
7382
- if (format2 || !formatUpper) {
7383
- return format2;
7384
- }
7385
- this._longDateFormat[key2] = formatUpper.match(formattingTokens).map(function(tok) {
7386
- if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
7387
- return tok.slice(1);
7388
- }
7389
- return tok;
7390
- }).join("");
7391
- return this._longDateFormat[key2];
7392
- }
7393
- var defaultInvalidDate = "Invalid date";
7394
- function invalidDate() {
7395
- return this._invalidDate;
7396
- }
7397
- var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
7398
- function ordinal(number) {
7399
- return this._ordinal.replace("%d", number);
7400
- }
7401
- var defaultRelativeTime = {
7402
- future: "in %s",
7403
- past: "%s ago",
7404
- s: "a few seconds",
7405
- ss: "%d seconds",
7406
- m: "a minute",
7407
- mm: "%d minutes",
7408
- h: "an hour",
7409
- hh: "%d hours",
7410
- d: "a day",
7411
- dd: "%d days",
7412
- w: "a week",
7413
- ww: "%d weeks",
7414
- M: "a month",
7415
- MM: "%d months",
7416
- y: "a year",
7417
- yy: "%d years"
7418
- };
7419
- function relativeTime(number, withoutSuffix, string, isFuture) {
7420
- var output = this._relativeTime[string];
7421
- return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
7422
- }
7423
- function pastFuture(diff2, output) {
7424
- var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
7425
- return isFunction(format2) ? format2(output) : format2.replace(/%s/i, output);
7426
- }
7427
- var aliases = {};
7428
- function addUnitAlias(unit, shorthand) {
7429
- var lowerCase = unit.toLowerCase();
7430
- aliases[lowerCase] = aliases[lowerCase + "s"] = aliases[shorthand] = unit;
7431
- }
7432
- function normalizeUnits(units) {
7433
- return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
7404
+ var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero = /^[1-9]\d?/, match1to2HasZero = /^([1-9]\d|\d)/, regexes;
7405
+ regexes = {};
7406
+ function addRegexToken(token2, regex, strictRegex) {
7407
+ regexes[token2] = isFunction(regex) ? regex : function(isStrict, localeData2) {
7408
+ return isStrict && strictRegex ? strictRegex : regex;
7409
+ };
7434
7410
  }
7435
- function normalizeObjectUnits(inputObject) {
7436
- var normalizedInput = {}, normalizedProp, prop;
7437
- for (prop in inputObject) {
7438
- if (hasOwnProp(inputObject, prop)) {
7439
- normalizedProp = normalizeUnits(prop);
7440
- if (normalizedProp) {
7441
- normalizedInput[normalizedProp] = inputObject[prop];
7442
- }
7443
- }
7411
+ function getParseRegexForToken(token2, config) {
7412
+ if (!hasOwnProp(regexes, token2)) {
7413
+ return new RegExp(unescapeFormat(token2));
7444
7414
  }
7445
- return normalizedInput;
7446
- }
7447
- var priorities = {};
7448
- function addUnitPriority(unit, priority) {
7449
- priorities[unit] = priority;
7415
+ return regexes[token2](config._strict, config._locale);
7450
7416
  }
7451
- function getPrioritizedUnits(unitsObj) {
7452
- var units = [], u;
7453
- for (u in unitsObj) {
7454
- if (hasOwnProp(unitsObj, u)) {
7455
- units.push({ unit: u, priority: priorities[u] });
7456
- }
7457
- }
7458
- units.sort(function(a, b) {
7459
- return a.priority - b.priority;
7460
- });
7461
- return units;
7417
+ function unescapeFormat(s) {
7418
+ return regexEscape(
7419
+ s.replace("\\", "").replace(
7420
+ /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
7421
+ function(matched, p1, p2, p3, p4) {
7422
+ return p1 || p2 || p3 || p4;
7423
+ }
7424
+ )
7425
+ );
7462
7426
  }
7463
- function isLeapYear(year) {
7464
- return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
7427
+ function regexEscape(s) {
7428
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
7465
7429
  }
7466
7430
  function absFloor(number) {
7467
7431
  if (number < 0) {
@@ -7477,6 +7441,72 @@
7477
7441
  }
7478
7442
  return value;
7479
7443
  }
7444
+ var tokens = {};
7445
+ function addParseToken(token2, callback) {
7446
+ var i, func = callback, tokenLen;
7447
+ if (typeof token2 === "string") {
7448
+ token2 = [token2];
7449
+ }
7450
+ if (isNumber(callback)) {
7451
+ func = function(input, array) {
7452
+ array[callback] = toInt(input);
7453
+ };
7454
+ }
7455
+ tokenLen = token2.length;
7456
+ for (i = 0; i < tokenLen; i++) {
7457
+ tokens[token2[i]] = func;
7458
+ }
7459
+ }
7460
+ function addWeekParseToken(token2, callback) {
7461
+ addParseToken(token2, function(input, array, config, token3) {
7462
+ config._w = config._w || {};
7463
+ callback(input, config._w, config, token3);
7464
+ });
7465
+ }
7466
+ function addTimeToArrayFromToken(token2, input, config) {
7467
+ if (input != null && hasOwnProp(tokens, token2)) {
7468
+ tokens[token2](input, config._a, config, token2);
7469
+ }
7470
+ }
7471
+ function isLeapYear(year) {
7472
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
7473
+ }
7474
+ var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
7475
+ addFormatToken("Y", 0, 0, function() {
7476
+ var y = this.year();
7477
+ return y <= 9999 ? zeroFill(y, 4) : "+" + y;
7478
+ });
7479
+ addFormatToken(0, ["YY", 2], 0, function() {
7480
+ return this.year() % 100;
7481
+ });
7482
+ addFormatToken(0, ["YYYY", 4], 0, "year");
7483
+ addFormatToken(0, ["YYYYY", 5], 0, "year");
7484
+ addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
7485
+ addRegexToken("Y", matchSigned);
7486
+ addRegexToken("YY", match1to2, match2);
7487
+ addRegexToken("YYYY", match1to4, match4);
7488
+ addRegexToken("YYYYY", match1to6, match6);
7489
+ addRegexToken("YYYYYY", match1to6, match6);
7490
+ addParseToken(["YYYYY", "YYYYYY"], YEAR);
7491
+ addParseToken("YYYY", function(input, array) {
7492
+ array[YEAR] = input.length === 2 ? hooks2.parseTwoDigitYear(input) : toInt(input);
7493
+ });
7494
+ addParseToken("YY", function(input, array) {
7495
+ array[YEAR] = hooks2.parseTwoDigitYear(input);
7496
+ });
7497
+ addParseToken("Y", function(input, array) {
7498
+ array[YEAR] = parseInt(input, 10);
7499
+ });
7500
+ function daysInYear(year) {
7501
+ return isLeapYear(year) ? 366 : 365;
7502
+ }
7503
+ hooks2.parseTwoDigitYear = function(input) {
7504
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
7505
+ };
7506
+ var getSetYear = makeGetSet("FullYear", true);
7507
+ function getIsLeapYear() {
7508
+ return isLeapYear(this.year());
7509
+ }
7480
7510
  function makeGetSet(unit, keepTime) {
7481
7511
  return function(value) {
7482
7512
  if (value != null) {
@@ -7484,26 +7514,69 @@
7484
7514
  hooks2.updateOffset(this, keepTime);
7485
7515
  return this;
7486
7516
  } else {
7487
- return get(this, unit);
7517
+ return get$2(this, unit);
7488
7518
  }
7489
7519
  };
7490
7520
  }
7491
- function get(mom, unit) {
7492
- return mom.isValid() ? mom._d["get" + (mom._isUTC ? "UTC" : "") + unit]() : NaN;
7521
+ function get$2(mom, unit) {
7522
+ if (!mom.isValid()) {
7523
+ return NaN;
7524
+ }
7525
+ var d = mom._d, isUTC = mom._isUTC;
7526
+ switch (unit) {
7527
+ case "Milliseconds":
7528
+ return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
7529
+ case "Seconds":
7530
+ return isUTC ? d.getUTCSeconds() : d.getSeconds();
7531
+ case "Minutes":
7532
+ return isUTC ? d.getUTCMinutes() : d.getMinutes();
7533
+ case "Hours":
7534
+ return isUTC ? d.getUTCHours() : d.getHours();
7535
+ case "Date":
7536
+ return isUTC ? d.getUTCDate() : d.getDate();
7537
+ case "Day":
7538
+ return isUTC ? d.getUTCDay() : d.getDay();
7539
+ case "Month":
7540
+ return isUTC ? d.getUTCMonth() : d.getMonth();
7541
+ case "FullYear":
7542
+ return isUTC ? d.getUTCFullYear() : d.getFullYear();
7543
+ default:
7544
+ return NaN;
7545
+ }
7493
7546
  }
7494
7547
  function set$1(mom, unit, value) {
7495
- if (mom.isValid() && !isNaN(value)) {
7496
- if (unit === "FullYear" && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
7497
- value = toInt(value);
7498
- mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](
7499
- value,
7500
- mom.month(),
7501
- daysInMonth(value, mom.month())
7502
- );
7503
- } else {
7504
- mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value);
7505
- }
7548
+ var d, isUTC, year, month, date;
7549
+ if (!mom.isValid() || isNaN(value)) {
7550
+ return;
7551
+ }
7552
+ d = mom._d;
7553
+ isUTC = mom._isUTC;
7554
+ switch (unit) {
7555
+ case "Milliseconds":
7556
+ return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value));
7557
+ case "Seconds":
7558
+ return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
7559
+ case "Minutes":
7560
+ return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
7561
+ case "Hours":
7562
+ return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
7563
+ case "Date":
7564
+ return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
7565
+ // case 'Day': // Not real
7566
+ // return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
7567
+ // case 'Month': // Not used because we need to pass two variables
7568
+ // return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
7569
+ case "FullYear":
7570
+ break;
7571
+ // See below ...
7572
+ default:
7573
+ return;
7506
7574
  }
7575
+ year = value;
7576
+ month = mom.month();
7577
+ date = mom.date();
7578
+ date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
7579
+ void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
7507
7580
  }
7508
7581
  function stringGet(units) {
7509
7582
  units = normalizeUnits(units);
@@ -7527,61 +7600,7 @@
7527
7600
  }
7528
7601
  return this;
7529
7602
  }
7530
- var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, regexes;
7531
- regexes = {};
7532
- function addRegexToken(token2, regex, strictRegex) {
7533
- regexes[token2] = isFunction(regex) ? regex : function(isStrict, localeData2) {
7534
- return isStrict && strictRegex ? strictRegex : regex;
7535
- };
7536
- }
7537
- function getParseRegexForToken(token2, config) {
7538
- if (!hasOwnProp(regexes, token2)) {
7539
- return new RegExp(unescapeFormat(token2));
7540
- }
7541
- return regexes[token2](config._strict, config._locale);
7542
- }
7543
- function unescapeFormat(s) {
7544
- return regexEscape(
7545
- s.replace("\\", "").replace(
7546
- /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
7547
- function(matched, p1, p2, p3, p4) {
7548
- return p1 || p2 || p3 || p4;
7549
- }
7550
- )
7551
- );
7552
- }
7553
- function regexEscape(s) {
7554
- return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
7555
- }
7556
- var tokens = {};
7557
- function addParseToken(token2, callback) {
7558
- var i, func = callback, tokenLen;
7559
- if (typeof token2 === "string") {
7560
- token2 = [token2];
7561
- }
7562
- if (isNumber(callback)) {
7563
- func = function(input, array) {
7564
- array[callback] = toInt(input);
7565
- };
7566
- }
7567
- tokenLen = token2.length;
7568
- for (i = 0; i < tokenLen; i++) {
7569
- tokens[token2[i]] = func;
7570
- }
7571
- }
7572
- function addWeekParseToken(token2, callback) {
7573
- addParseToken(token2, function(input, array, config, token3) {
7574
- config._w = config._w || {};
7575
- callback(input, config._w, config, token3);
7576
- });
7577
- }
7578
- function addTimeToArrayFromToken(token2, input, config) {
7579
- if (input != null && hasOwnProp(tokens, token2)) {
7580
- tokens[token2](input, config._a, config, token2);
7581
- }
7582
- }
7583
- var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
7584
- function mod(n, x) {
7603
+ function mod$1(n, x) {
7585
7604
  return (n % x + x) % x;
7586
7605
  }
7587
7606
  var indexOf;
@@ -7602,7 +7621,7 @@
7602
7621
  if (isNaN(year) || isNaN(month)) {
7603
7622
  return NaN;
7604
7623
  }
7605
- var modMonth = mod(month, 12);
7624
+ var modMonth = mod$1(month, 12);
7606
7625
  year += (month - modMonth) / 12;
7607
7626
  return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
7608
7627
  }
@@ -7615,9 +7634,7 @@
7615
7634
  addFormatToken("MMMM", 0, 0, function(format2) {
7616
7635
  return this.localeData().months(this, format2);
7617
7636
  });
7618
- addUnitAlias("month", "M");
7619
- addUnitPriority("month", 8);
7620
- addRegexToken("M", match1to2);
7637
+ addRegexToken("M", match1to2, match1to2NoLeadingZero);
7621
7638
  addRegexToken("MM", match1to2, match2);
7622
7639
  addRegexToken("MMM", function(isStrict, locale2) {
7623
7640
  return locale2.monthsShortRegex(isStrict);
@@ -7638,7 +7655,24 @@
7638
7655
  });
7639
7656
  var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split(
7640
7657
  "_"
7641
- ), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord;
7658
+ ), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord, monthsParseProperties = [
7659
+ "monthsParse",
7660
+ "longMonthsParse",
7661
+ "shortMonthsParse",
7662
+ "monthsRegex",
7663
+ "monthsShortRegex",
7664
+ "monthsStrictRegex",
7665
+ "monthsShortStrictRegex"
7666
+ ];
7667
+ function clearMonthsParseCache(locale2, config) {
7668
+ var i, prop;
7669
+ for (i = 0; i < monthsParseProperties.length; i++) {
7670
+ prop = monthsParseProperties[i];
7671
+ if (!hasOwnProp(config, prop)) {
7672
+ delete locale2["_" + prop];
7673
+ }
7674
+ }
7675
+ }
7642
7676
  function localeMonths(m, format2) {
7643
7677
  if (!m) {
7644
7678
  return isArray(this._months) ? this._months : this._months["standalone"];
@@ -7651,7 +7685,7 @@
7651
7685
  }
7652
7686
  return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m.month()];
7653
7687
  }
7654
- function handleStrictParse(monthName, format2, strict) {
7688
+ function handleStrictParse$1(monthName, format2, strict) {
7655
7689
  var i, ii, mom, llc = monthName.toLocaleLowerCase();
7656
7690
  if (!this._monthsParse) {
7657
7691
  this._monthsParse = [];
@@ -7695,7 +7729,7 @@
7695
7729
  function localeMonthsParse(monthName, format2, strict) {
7696
7730
  var i, mom, regex;
7697
7731
  if (this._monthsParseExact) {
7698
- return handleStrictParse.call(this, monthName, format2, strict);
7732
+ return handleStrictParse$1.call(this, monthName, format2, strict);
7699
7733
  }
7700
7734
  if (!this._monthsParse) {
7701
7735
  this._monthsParse = [];
@@ -7728,7 +7762,6 @@
7728
7762
  }
7729
7763
  }
7730
7764
  function setMonth(mom, value) {
7731
- var dayOfMonth;
7732
7765
  if (!mom.isValid()) {
7733
7766
  return mom;
7734
7767
  }
@@ -7742,8 +7775,9 @@
7742
7775
  }
7743
7776
  }
7744
7777
  }
7745
- dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
7746
- mom._d["set" + (mom._isUTC ? "UTC" : "") + "Month"](value, dayOfMonth);
7778
+ var month = value, date = mom.date();
7779
+ date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
7780
+ void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
7747
7781
  return mom;
7748
7782
  }
7749
7783
  function getSetMonth(value) {
@@ -7752,7 +7786,7 @@
7752
7786
  hooks2.updateOffset(this, true);
7753
7787
  return this;
7754
7788
  } else {
7755
- return get(this, "Month");
7789
+ return get$2(this, "Month");
7756
7790
  }
7757
7791
  }
7758
7792
  function getDaysInMonth() {
@@ -7796,24 +7830,19 @@
7796
7830
  function cmpLenRev(a, b) {
7797
7831
  return b.length - a.length;
7798
7832
  }
7799
- var shortPieces = [], longPieces = [], mixedPieces = [], i, mom;
7833
+ var shortPieces = [], longPieces = [], mixedPieces = [], i, mom, shortP, longP;
7800
7834
  for (i = 0; i < 12; i++) {
7801
7835
  mom = createUTC([2e3, i]);
7802
- shortPieces.push(this.monthsShort(mom, ""));
7803
- longPieces.push(this.months(mom, ""));
7804
- mixedPieces.push(this.months(mom, ""));
7805
- mixedPieces.push(this.monthsShort(mom, ""));
7836
+ shortP = regexEscape(this.monthsShort(mom, ""));
7837
+ longP = regexEscape(this.months(mom, ""));
7838
+ shortPieces.push(shortP);
7839
+ longPieces.push(longP);
7840
+ mixedPieces.push(longP);
7841
+ mixedPieces.push(shortP);
7806
7842
  }
7807
7843
  shortPieces.sort(cmpLenRev);
7808
7844
  longPieces.sort(cmpLenRev);
7809
7845
  mixedPieces.sort(cmpLenRev);
7810
- for (i = 0; i < 12; i++) {
7811
- shortPieces[i] = regexEscape(shortPieces[i]);
7812
- longPieces[i] = regexEscape(longPieces[i]);
7813
- }
7814
- for (i = 0; i < 24; i++) {
7815
- mixedPieces[i] = regexEscape(mixedPieces[i]);
7816
- }
7817
7846
  this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
7818
7847
  this._monthsShortRegex = this._monthsRegex;
7819
7848
  this._monthsStrictRegex = new RegExp(
@@ -7825,150 +7854,6 @@
7825
7854
  "i"
7826
7855
  );
7827
7856
  }
7828
- addFormatToken("Y", 0, 0, function() {
7829
- var y = this.year();
7830
- return y <= 9999 ? zeroFill(y, 4) : "+" + y;
7831
- });
7832
- addFormatToken(0, ["YY", 2], 0, function() {
7833
- return this.year() % 100;
7834
- });
7835
- addFormatToken(0, ["YYYY", 4], 0, "year");
7836
- addFormatToken(0, ["YYYYY", 5], 0, "year");
7837
- addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
7838
- addUnitAlias("year", "y");
7839
- addUnitPriority("year", 1);
7840
- addRegexToken("Y", matchSigned);
7841
- addRegexToken("YY", match1to2, match2);
7842
- addRegexToken("YYYY", match1to4, match4);
7843
- addRegexToken("YYYYY", match1to6, match6);
7844
- addRegexToken("YYYYYY", match1to6, match6);
7845
- addParseToken(["YYYYY", "YYYYYY"], YEAR);
7846
- addParseToken("YYYY", function(input, array) {
7847
- array[YEAR] = input.length === 2 ? hooks2.parseTwoDigitYear(input) : toInt(input);
7848
- });
7849
- addParseToken("YY", function(input, array) {
7850
- array[YEAR] = hooks2.parseTwoDigitYear(input);
7851
- });
7852
- addParseToken("Y", function(input, array) {
7853
- array[YEAR] = parseInt(input, 10);
7854
- });
7855
- function daysInYear(year) {
7856
- return isLeapYear(year) ? 366 : 365;
7857
- }
7858
- hooks2.parseTwoDigitYear = function(input) {
7859
- return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
7860
- };
7861
- var getSetYear = makeGetSet("FullYear", true);
7862
- function getIsLeapYear() {
7863
- return isLeapYear(this.year());
7864
- }
7865
- function createDate(y, m, d, h, M, s, ms) {
7866
- var date;
7867
- if (y < 100 && y >= 0) {
7868
- date = new Date(y + 400, m, d, h, M, s, ms);
7869
- if (isFinite(date.getFullYear())) {
7870
- date.setFullYear(y);
7871
- }
7872
- } else {
7873
- date = new Date(y, m, d, h, M, s, ms);
7874
- }
7875
- return date;
7876
- }
7877
- function createUTCDate(y) {
7878
- var date, args;
7879
- if (y < 100 && y >= 0) {
7880
- args = Array.prototype.slice.call(arguments);
7881
- args[0] = y + 400;
7882
- date = new Date(Date.UTC.apply(null, args));
7883
- if (isFinite(date.getUTCFullYear())) {
7884
- date.setUTCFullYear(y);
7885
- }
7886
- } else {
7887
- date = new Date(Date.UTC.apply(null, arguments));
7888
- }
7889
- return date;
7890
- }
7891
- function firstWeekOffset(year, dow, doy) {
7892
- var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
7893
- return -fwdlw + fwd - 1;
7894
- }
7895
- function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
7896
- var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
7897
- if (dayOfYear <= 0) {
7898
- resYear = year - 1;
7899
- resDayOfYear = daysInYear(resYear) + dayOfYear;
7900
- } else if (dayOfYear > daysInYear(year)) {
7901
- resYear = year + 1;
7902
- resDayOfYear = dayOfYear - daysInYear(year);
7903
- } else {
7904
- resYear = year;
7905
- resDayOfYear = dayOfYear;
7906
- }
7907
- return {
7908
- year: resYear,
7909
- dayOfYear: resDayOfYear
7910
- };
7911
- }
7912
- function weekOfYear(mom, dow, doy) {
7913
- var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
7914
- if (week < 1) {
7915
- resYear = mom.year() - 1;
7916
- resWeek = week + weeksInYear(resYear, dow, doy);
7917
- } else if (week > weeksInYear(mom.year(), dow, doy)) {
7918
- resWeek = week - weeksInYear(mom.year(), dow, doy);
7919
- resYear = mom.year() + 1;
7920
- } else {
7921
- resYear = mom.year();
7922
- resWeek = week;
7923
- }
7924
- return {
7925
- week: resWeek,
7926
- year: resYear
7927
- };
7928
- }
7929
- function weeksInYear(year, dow, doy) {
7930
- var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
7931
- return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
7932
- }
7933
- addFormatToken("w", ["ww", 2], "wo", "week");
7934
- addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
7935
- addUnitAlias("week", "w");
7936
- addUnitAlias("isoWeek", "W");
7937
- addUnitPriority("week", 5);
7938
- addUnitPriority("isoWeek", 5);
7939
- addRegexToken("w", match1to2);
7940
- addRegexToken("ww", match1to2, match2);
7941
- addRegexToken("W", match1to2);
7942
- addRegexToken("WW", match1to2, match2);
7943
- addWeekParseToken(
7944
- ["w", "ww", "W", "WW"],
7945
- function(input, week, config, token2) {
7946
- week[token2.substr(0, 1)] = toInt(input);
7947
- }
7948
- );
7949
- function localeWeek(mom) {
7950
- return weekOfYear(mom, this._week.dow, this._week.doy).week;
7951
- }
7952
- var defaultLocaleWeek = {
7953
- dow: 0,
7954
- // Sunday is the first day of the week.
7955
- doy: 6
7956
- // The week that contains Jan 6th is the first week of the year.
7957
- };
7958
- function localeFirstDayOfWeek() {
7959
- return this._week.dow;
7960
- }
7961
- function localeFirstDayOfYear() {
7962
- return this._week.doy;
7963
- }
7964
- function getSetWeek(input) {
7965
- var week = this.localeData().week(this);
7966
- return input == null ? week : this.add((input - week) * 7, "d");
7967
- }
7968
- function getSetISOWeek(input) {
7969
- var week = weekOfYear(this, 1, 4).week;
7970
- return input == null ? week : this.add((input - week) * 7, "d");
7971
- }
7972
7857
  addFormatToken("d", 0, "do", "day");
7973
7858
  addFormatToken("dd", 0, 0, function(format2) {
7974
7859
  return this.localeData().weekdaysMin(this, format2);
@@ -7981,15 +7866,13 @@
7981
7866
  });
7982
7867
  addFormatToken("e", 0, 0, "weekday");
7983
7868
  addFormatToken("E", 0, 0, "isoWeekday");
7984
- addUnitAlias("day", "d");
7985
- addUnitAlias("weekday", "e");
7986
- addUnitAlias("isoWeekday", "E");
7987
- addUnitPriority("day", 11);
7988
- addUnitPriority("weekday", 11);
7989
- addUnitPriority("isoWeekday", 11);
7869
+ addFormatToken("eHHmm", 0, 0, function() {
7870
+ return "" + this.weekday() + zeroFill(this.hours(), 2) + zeroFill(this.minutes(), 2);
7871
+ });
7990
7872
  addRegexToken("d", match1to2);
7991
7873
  addRegexToken("e", match1to2);
7992
7874
  addRegexToken("E", match1to2);
7875
+ addRegexToken("eHHmm", match5to6);
7993
7876
  addRegexToken("dd", function(isStrict, locale2) {
7994
7877
  return locale2.weekdaysMinRegex(isStrict);
7995
7878
  });
@@ -8010,6 +7893,12 @@
8010
7893
  addWeekParseToken(["d", "e", "E"], function(input, week, config, token2) {
8011
7894
  week[token2] = toInt(input);
8012
7895
  });
7896
+ addWeekParseToken("eHHmm", function(input, week, config) {
7897
+ var weekdayEnd = input.length - 4;
7898
+ week.e = toInt(input.substr(0, weekdayEnd));
7899
+ config._a[HOUR] = toInt(input.substr(weekdayEnd, 2));
7900
+ config._a[MINUTE] = toInt(input.substr(weekdayEnd + 2));
7901
+ });
8013
7902
  function parseWeekday(input, locale2) {
8014
7903
  if (typeof input !== "string") {
8015
7904
  return input;
@@ -8032,7 +7921,27 @@
8032
7921
  function shiftWeekdays(ws, n) {
8033
7922
  return ws.slice(n, 7).concat(ws.slice(0, n));
8034
7923
  }
8035
- var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord;
7924
+ var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord, weekdaysParseProperties = [
7925
+ "weekdaysParse",
7926
+ "fullWeekdaysParse",
7927
+ "shortWeekdaysParse",
7928
+ "minWeekdaysParse",
7929
+ "weekdaysRegex",
7930
+ "weekdaysShortRegex",
7931
+ "weekdaysMinRegex",
7932
+ "weekdaysStrictRegex",
7933
+ "weekdaysShortStrictRegex",
7934
+ "weekdaysMinStrictRegex"
7935
+ ];
7936
+ function clearWeekdaysParseCache(locale2, config) {
7937
+ var i, prop;
7938
+ for (i = 0; i < weekdaysParseProperties.length; i++) {
7939
+ prop = weekdaysParseProperties[i];
7940
+ if (!hasOwnProp(config, prop)) {
7941
+ delete locale2["_" + prop];
7942
+ }
7943
+ }
7944
+ }
8036
7945
  function localeWeekdays(m, format2) {
8037
7946
  var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"];
8038
7947
  return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
@@ -8043,7 +7952,7 @@
8043
7952
  function localeWeekdaysMin(m) {
8044
7953
  return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
8045
7954
  }
8046
- function handleStrictParse$1(weekdayName, format2, strict) {
7955
+ function handleStrictParse(weekdayName, format2, strict) {
8047
7956
  var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
8048
7957
  if (!this._weekdaysParse) {
8049
7958
  this._weekdaysParse = [];
@@ -8113,7 +8022,7 @@
8113
8022
  function localeWeekdaysParse(weekdayName, format2, strict) {
8114
8023
  var i, mom, regex;
8115
8024
  if (this._weekdaysParseExact) {
8116
- return handleStrictParse$1.call(this, weekdayName, format2, strict);
8025
+ return handleStrictParse.call(this, weekdayName, format2, strict);
8117
8026
  }
8118
8027
  if (!this._weekdaysParse) {
8119
8028
  this._weekdaysParse = [];
@@ -8156,7 +8065,7 @@
8156
8065
  if (!this.isValid()) {
8157
8066
  return input != null ? this : NaN;
8158
8067
  }
8159
- var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
8068
+ var day = get$2(this, "Day");
8160
8069
  if (input != null) {
8161
8070
  input = parseWeekday(input, this.localeData());
8162
8071
  return this.add(input - day, "d");
@@ -8270,6 +8179,271 @@
8270
8179
  "i"
8271
8180
  );
8272
8181
  }
8182
+ function set(config) {
8183
+ var prop, i;
8184
+ clearMonthsParseCache(this, config);
8185
+ clearWeekdaysParseCache(this, config);
8186
+ for (i in config) {
8187
+ if (hasOwnProp(config, i)) {
8188
+ prop = config[i];
8189
+ if (isFunction(prop)) {
8190
+ this[i] = prop;
8191
+ } else {
8192
+ this["_" + i] = prop;
8193
+ }
8194
+ }
8195
+ }
8196
+ this._config = config;
8197
+ this._dayOfMonthOrdinalParseLenient = new RegExp(
8198
+ (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
8199
+ );
8200
+ }
8201
+ function mergeConfigs(parentConfig, childConfig) {
8202
+ var res = extend({}, parentConfig), prop;
8203
+ for (prop in childConfig) {
8204
+ if (hasOwnProp(childConfig, prop)) {
8205
+ if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
8206
+ res[prop] = {};
8207
+ extend(res[prop], parentConfig[prop]);
8208
+ extend(res[prop], childConfig[prop]);
8209
+ } else if (childConfig[prop] != null) {
8210
+ res[prop] = childConfig[prop];
8211
+ } else {
8212
+ delete res[prop];
8213
+ }
8214
+ }
8215
+ }
8216
+ for (prop in parentConfig) {
8217
+ if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
8218
+ res[prop] = extend({}, res[prop]);
8219
+ }
8220
+ }
8221
+ return res;
8222
+ }
8223
+ function Locale(config) {
8224
+ if (config != null) {
8225
+ this.set(config);
8226
+ }
8227
+ }
8228
+ var keys;
8229
+ if (Object.keys) {
8230
+ keys = Object.keys;
8231
+ } else {
8232
+ keys = function(obj) {
8233
+ var i, res = [];
8234
+ for (i in obj) {
8235
+ if (hasOwnProp(obj, i)) {
8236
+ res.push(i);
8237
+ }
8238
+ }
8239
+ return res;
8240
+ };
8241
+ }
8242
+ var defaultCalendar = {
8243
+ sameDay: "[Today at] LT",
8244
+ nextDay: "[Tomorrow at] LT",
8245
+ nextWeek: "dddd [at] LT",
8246
+ lastDay: "[Yesterday at] LT",
8247
+ lastWeek: "[Last] dddd [at] LT",
8248
+ sameElse: "L"
8249
+ };
8250
+ function calendar$1(key2, mom, now2) {
8251
+ var output = this._calendar[key2] || this._calendar["sameElse"];
8252
+ return isFunction(output) ? output.call(mom, now2) : output;
8253
+ }
8254
+ var defaultLongDateFormat = {
8255
+ LTS: "h:mm:ss A",
8256
+ LT: "h:mm A",
8257
+ L: "MM/DD/YYYY",
8258
+ LL: "MMMM D, YYYY",
8259
+ LLL: "MMMM D, YYYY h:mm A",
8260
+ LLLL: "dddd, MMMM D, YYYY h:mm A"
8261
+ };
8262
+ function longDateFormat(key2) {
8263
+ var format2 = this._longDateFormat[key2], formatUpper = this._longDateFormat[key2.toUpperCase()], formatCache = this._longDateFormatCache;
8264
+ if (format2 || !formatUpper) {
8265
+ return format2;
8266
+ }
8267
+ if (formatCache && formatCache[key2] && formatCache[key2].formatUpper === formatUpper) {
8268
+ return formatCache[key2].format;
8269
+ }
8270
+ format2 = formatUpper.match(formattingTokens).map(function(tok) {
8271
+ if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
8272
+ return tok.slice(1);
8273
+ }
8274
+ return tok;
8275
+ }).join("");
8276
+ if (!formatCache) {
8277
+ formatCache = this._longDateFormatCache = {};
8278
+ }
8279
+ formatCache[key2] = {
8280
+ formatUpper,
8281
+ format: format2
8282
+ };
8283
+ return format2;
8284
+ }
8285
+ var defaultInvalidDate = "Invalid date";
8286
+ function invalidDate() {
8287
+ return this._invalidDate;
8288
+ }
8289
+ var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
8290
+ function ordinal(number) {
8291
+ return this._ordinal.replace("%d", number);
8292
+ }
8293
+ var defaultRelativeTime = {
8294
+ future: "in %s",
8295
+ past: "%s ago",
8296
+ s: "a few seconds",
8297
+ ss: "%d seconds",
8298
+ m: "a minute",
8299
+ mm: "%d minutes",
8300
+ h: "an hour",
8301
+ hh: "%d hours",
8302
+ d: "a day",
8303
+ dd: "%d days",
8304
+ w: "a week",
8305
+ ww: "%d weeks",
8306
+ M: "a month",
8307
+ MM: "%d months",
8308
+ y: "a year",
8309
+ yy: "%d years"
8310
+ };
8311
+ function relativeTimeWithoutPostformat(number, withoutSuffix, string, isFuture) {
8312
+ var output = this._relativeTime[string];
8313
+ return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
8314
+ }
8315
+ function relativeTime$1(number, withoutSuffix, string, isFuture) {
8316
+ return this.postformat(
8317
+ relativeTimeWithoutPostformat.call(
8318
+ this,
8319
+ number,
8320
+ withoutSuffix,
8321
+ string,
8322
+ isFuture
8323
+ )
8324
+ );
8325
+ }
8326
+ function pastFutureWithoutPostformat(diff2, output) {
8327
+ var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
8328
+ return isFunction(format2) ? format2(output) : format2.replace(/%s/i, output);
8329
+ }
8330
+ function pastFuture(diff2, output) {
8331
+ return this.postformat(
8332
+ pastFutureWithoutPostformat.call(this, diff2, output)
8333
+ );
8334
+ }
8335
+ function createDate(y, m, d, h, M, s, ms) {
8336
+ var date;
8337
+ if (y < 100 && y >= 0) {
8338
+ date = new Date(y + 400, m, d, h, M, s, ms);
8339
+ if (isFinite(date.getFullYear())) {
8340
+ date.setFullYear(y);
8341
+ }
8342
+ } else {
8343
+ date = new Date(y, m, d, h, M, s, ms);
8344
+ }
8345
+ return date;
8346
+ }
8347
+ function createUTCDate(y) {
8348
+ var date, args;
8349
+ if (y < 100 && y >= 0) {
8350
+ args = Array.prototype.slice.call(arguments);
8351
+ args[0] = y + 400;
8352
+ date = new Date(Date.UTC.apply(null, args));
8353
+ if (isFinite(date.getUTCFullYear())) {
8354
+ date.setUTCFullYear(y);
8355
+ }
8356
+ } else {
8357
+ date = new Date(Date.UTC.apply(null, arguments));
8358
+ }
8359
+ return date;
8360
+ }
8361
+ function firstWeekOffset(year, dow, doy) {
8362
+ var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
8363
+ return -fwdlw + fwd - 1;
8364
+ }
8365
+ function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
8366
+ var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
8367
+ if (dayOfYear <= 0) {
8368
+ resYear = year - 1;
8369
+ resDayOfYear = daysInYear(resYear) + dayOfYear;
8370
+ } else if (dayOfYear > daysInYear(year)) {
8371
+ resYear = year + 1;
8372
+ resDayOfYear = dayOfYear - daysInYear(year);
8373
+ } else {
8374
+ resYear = year;
8375
+ resDayOfYear = dayOfYear;
8376
+ }
8377
+ return {
8378
+ year: resYear,
8379
+ dayOfYear: resDayOfYear
8380
+ };
8381
+ }
8382
+ function weekOfYearFromDayOfYear(year, dayOfYear, dow, doy) {
8383
+ var weekOffset = firstWeekOffset(year, dow, doy), week = Math.floor((dayOfYear - weekOffset - 1) / 7) + 1, resWeek, resYear;
8384
+ if (week < 1) {
8385
+ resYear = year - 1;
8386
+ resWeek = week + weeksInYear(resYear, dow, doy);
8387
+ } else if (week > weeksInYear(year, dow, doy)) {
8388
+ resWeek = week - weeksInYear(year, dow, doy);
8389
+ resYear = year + 1;
8390
+ } else {
8391
+ resYear = year;
8392
+ resWeek = week;
8393
+ }
8394
+ return {
8395
+ week: resWeek,
8396
+ year: resYear
8397
+ };
8398
+ }
8399
+ function weekOfYear(mom, dow, doy) {
8400
+ return weekOfYearFromDayOfYear(mom.year(), mom.dayOfYear(), dow, doy);
8401
+ }
8402
+ function weekOfYearFromDate(year, month, date, dow, doy) {
8403
+ var dayOfYear = Math.round(
8404
+ (createUTCDate(year, month, date) - createUTCDate(year, 0, 1)) / 864e5
8405
+ ) + 1;
8406
+ return weekOfYearFromDayOfYear(year, dayOfYear, dow, doy);
8407
+ }
8408
+ function weeksInYear(year, dow, doy) {
8409
+ var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
8410
+ return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
8411
+ }
8412
+ addFormatToken("w", ["ww", 2], "wo", "week");
8413
+ addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
8414
+ addRegexToken("w", match1to2, match1to2NoLeadingZero);
8415
+ addRegexToken("ww", match1to2, match2);
8416
+ addRegexToken("W", match1to2, match1to2NoLeadingZero);
8417
+ addRegexToken("WW", match1to2, match2);
8418
+ addWeekParseToken(
8419
+ ["w", "ww", "W", "WW"],
8420
+ function(input, week, config, token2) {
8421
+ week[token2.substr(0, 1)] = toInt(input);
8422
+ }
8423
+ );
8424
+ function localeWeek(mom) {
8425
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
8426
+ }
8427
+ var defaultLocaleWeek = {
8428
+ dow: 0,
8429
+ // Sunday is the first day of the week.
8430
+ doy: 6
8431
+ // The week that contains Jan 6th is the first week of the year.
8432
+ };
8433
+ function localeFirstDayOfWeek() {
8434
+ return this._week.dow;
8435
+ }
8436
+ function localeFirstDayOfYear() {
8437
+ return this._week.doy;
8438
+ }
8439
+ function getSetWeek(input) {
8440
+ var week = this.localeData().week(this);
8441
+ return input == null ? week : this.add((input - week) * 7, "d");
8442
+ }
8443
+ function getSetISOWeek(input) {
8444
+ var week = weekOfYear(this, 1, 4).week;
8445
+ return input == null ? week : this.add((input - week) * 7, "d");
8446
+ }
8273
8447
  function hFormat() {
8274
8448
  return this.hours() % 12 || 12;
8275
8449
  }
@@ -8302,16 +8476,14 @@
8302
8476
  }
8303
8477
  meridiem("a", true);
8304
8478
  meridiem("A", false);
8305
- addUnitAlias("hour", "h");
8306
- addUnitPriority("hour", 13);
8307
8479
  function matchMeridiem(isStrict, locale2) {
8308
8480
  return locale2._meridiemParse;
8309
8481
  }
8310
8482
  addRegexToken("a", matchMeridiem);
8311
8483
  addRegexToken("A", matchMeridiem);
8312
- addRegexToken("H", match1to2);
8313
- addRegexToken("h", match1to2);
8314
- addRegexToken("k", match1to2);
8484
+ addRegexToken("H", match1to2, match1to2HasZero);
8485
+ addRegexToken("h", match1to2, match1to2NoLeadingZero);
8486
+ addRegexToken("k", match1to2, match1to2NoLeadingZero);
8315
8487
  addRegexToken("HH", match1to2, match2);
8316
8488
  addRegexToken("hh", match1to2, match2);
8317
8489
  addRegexToken("kk", match1to2, match2);
@@ -8417,21 +8589,30 @@
8417
8589
  return globalLocale;
8418
8590
  }
8419
8591
  function isLocaleNameSane(name) {
8420
- return name.match("^[^/\\\\]*$") != null;
8592
+ return typeof name === "string" && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name);
8421
8593
  }
8422
8594
  function loadLocale(name) {
8423
- var oldLocale = null, aliasedRequire;
8424
- if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) {
8595
+ var oldLocale = null, aliasedRequire, normalizedName;
8596
+ if (hasOwnProp(locales, name)) {
8597
+ return locales[name];
8598
+ }
8599
+ normalizedName = normalizeLocale(name);
8600
+ if (hasOwnProp(locales, normalizedName)) {
8601
+ return locales[normalizedName];
8602
+ }
8603
+ if (typeof module !== "undefined" && module && module.exports && isLocaleNameSane(normalizedName)) {
8425
8604
  try {
8426
8605
  oldLocale = globalLocale._abbr;
8427
8606
  aliasedRequire = __require;
8428
- aliasedRequire("./locale/" + name);
8607
+ aliasedRequire("./locale/" + normalizedName);
8429
8608
  getSetGlobalLocale(oldLocale);
8430
8609
  } catch (e) {
8431
- locales[name] = null;
8610
+ locales[normalizedName] = null;
8432
8611
  }
8433
8612
  }
8434
- return locales[name];
8613
+ if (hasOwnProp(locales, normalizedName)) {
8614
+ return locales[normalizedName];
8615
+ }
8435
8616
  }
8436
8617
  function getSetGlobalLocale(key2, values) {
8437
8618
  var data;
@@ -8496,12 +8677,14 @@
8496
8677
  }
8497
8678
  }
8498
8679
  function updateLocale(name, config) {
8680
+ var locale2, tmpLocale = loadLocale(name), parentConfig = baseConfig;
8681
+ if (tmpLocale != null) {
8682
+ name = tmpLocale._abbr;
8683
+ }
8499
8684
  if (config != null) {
8500
- var locale2, tmpLocale, parentConfig = baseConfig;
8501
8685
  if (locales[name] != null && locales[name].parentLocale != null) {
8502
8686
  locales[name].set(mergeConfigs(locales[name]._config, config));
8503
8687
  } else {
8504
- tmpLocale = loadLocale(name);
8505
8688
  if (tmpLocale != null) {
8506
8689
  parentConfig = tmpLocale._config;
8507
8690
  }
@@ -8758,8 +8941,38 @@
8758
8941
  }
8759
8942
  return c;
8760
8943
  }
8761
- function currentDateArray(config) {
8762
- var nowValue = new Date(hooks2.now());
8944
+ function currentDateArray(config, now2, forWeek) {
8945
+ var hadWeekContext = Object.prototype.hasOwnProperty.call(
8946
+ config,
8947
+ "_isDefaultDatePartsForWeek"
8948
+ ), weekContext = config._isDefaultDatePartsForWeek;
8949
+ config._isDefaultDatePartsForWeek = !!forWeek;
8950
+ try {
8951
+ return hooks2._getDefaultDateParts(config, now2, forWeek);
8952
+ } finally {
8953
+ if (hadWeekContext) {
8954
+ config._isDefaultDatePartsForWeek = weekContext;
8955
+ } else {
8956
+ delete config._isDefaultDatePartsForWeek;
8957
+ }
8958
+ }
8959
+ }
8960
+ function currentDateNow(config) {
8961
+ var now2 = config._defaultDatePartsNow;
8962
+ if (!now2) {
8963
+ return hooks2.now();
8964
+ }
8965
+ if (!now2.hasValue) {
8966
+ now2.value = hooks2.now();
8967
+ now2.hasValue = true;
8968
+ }
8969
+ return now2.value;
8970
+ }
8971
+ function getDefaultDateParts(config, now2, forWeek) {
8972
+ var useWeekDefaults = forWeek || config._isDefaultDatePartsForWeek, nowValue = useWeekDefaults ? createLocal(now2) : new Date(now2);
8973
+ if (useWeekDefaults) {
8974
+ return [nowValue.year(), nowValue.month(), nowValue.date()];
8975
+ }
8763
8976
  if (config._useUTC) {
8764
8977
  return [
8765
8978
  nowValue.getUTCFullYear(),
@@ -8769,17 +8982,21 @@
8769
8982
  }
8770
8983
  return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
8771
8984
  }
8985
+ hooks2._getDefaultDateParts = getDefaultDateParts;
8772
8986
  function configFromArray(config) {
8773
- var i, date, input = [], currentDate, expectedWeekday, yearToUse;
8987
+ var i, date, input = [], now2, currentDate, expectedWeekday, yearToUse, dateIsDefaulted;
8774
8988
  if (config._d) {
8775
8989
  return;
8776
8990
  }
8777
- currentDate = currentDateArray(config);
8991
+ if (config._a[YEAR] == null || config._a[MONTH] == null || config._a[DATE] == null) {
8992
+ now2 = currentDateNow(config);
8993
+ currentDate = currentDateArray(config, now2);
8994
+ }
8778
8995
  if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
8779
- dayOfYearFromWeekInfo(config);
8996
+ dayOfYearFromWeekInfo(config, currentDateArray(config, now2, true));
8780
8997
  }
8781
8998
  if (config._dayOfYear != null) {
8782
- yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
8999
+ yearToUse = config._a[YEAR] != null ? config._a[YEAR] : currentDate[YEAR];
8783
9000
  if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
8784
9001
  getParsingFlags(config)._overflowDayOfYear = true;
8785
9002
  }
@@ -8787,6 +9004,7 @@
8787
9004
  config._a[MONTH] = date.getUTCMonth();
8788
9005
  config._a[DATE] = date.getUTCDate();
8789
9006
  }
9007
+ dateIsDefaulted = config._a[YEAR] == null || config._a[MONTH] == null || config._a[DATE] == null;
8790
9008
  for (i = 0; i < 3 && config._a[i] == null; ++i) {
8791
9009
  config._a[i] = input[i] = currentDate[i];
8792
9010
  }
@@ -8808,11 +9026,11 @@
8808
9026
  if (config._nextDay) {
8809
9027
  config._a[HOUR] = 24;
8810
9028
  }
8811
- if (config._w && typeof config._w.d !== "undefined" && config._w.d !== expectedWeekday) {
9029
+ if (config._w && typeof config._w.d !== "undefined" && !dateIsDefaulted && config._w.d !== expectedWeekday) {
8812
9030
  getParsingFlags(config).weekdayMismatch = true;
8813
9031
  }
8814
9032
  }
8815
- function dayOfYearFromWeekInfo(config) {
9033
+ function dayOfYearFromWeekInfo(config, currentDate) {
8816
9034
  var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
8817
9035
  w = config._w;
8818
9036
  if (w.GG != null || w.W != null || w.E != null) {
@@ -8821,7 +9039,13 @@
8821
9039
  weekYear = defaults(
8822
9040
  w.GG,
8823
9041
  config._a[YEAR],
8824
- weekOfYear(createLocal(), 1, 4).year
9042
+ weekOfYearFromDate(
9043
+ currentDate[YEAR],
9044
+ currentDate[MONTH],
9045
+ currentDate[DATE],
9046
+ 1,
9047
+ 4
9048
+ ).year
8825
9049
  );
8826
9050
  week = defaults(w.W, 1);
8827
9051
  weekday = defaults(w.E, 1);
@@ -8831,7 +9055,13 @@
8831
9055
  } else {
8832
9056
  dow = config._locale._week.dow;
8833
9057
  doy = config._locale._week.doy;
8834
- curWeek = weekOfYear(createLocal(), dow, doy);
9058
+ curWeek = weekOfYearFromDate(
9059
+ currentDate[YEAR],
9060
+ currentDate[MONTH],
9061
+ currentDate[DATE],
9062
+ dow,
9063
+ doy
9064
+ );
8835
9065
  weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
8836
9066
  week = defaults(w.w, curWeek.week);
8837
9067
  if (w.d != null) {
@@ -8942,7 +9172,7 @@
8942
9172
  }
8943
9173
  }
8944
9174
  function configFromStringAndArray(config) {
8945
- var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length;
9175
+ var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, defaultDatePartsNow = {}, configfLen = config._f.length;
8946
9176
  if (configfLen === 0) {
8947
9177
  getParsingFlags(config).invalidFormat = true;
8948
9178
  config._d = /* @__PURE__ */ new Date(NaN);
@@ -8955,9 +9185,10 @@
8955
9185
  if (config._useUTC != null) {
8956
9186
  tempConfig._useUTC = config._useUTC;
8957
9187
  }
9188
+ tempConfig._defaultDatePartsNow = defaultDatePartsNow;
8958
9189
  tempConfig._f = config._f[i];
8959
9190
  configFromStringAndFormat(tempConfig);
8960
- if (isValid(tempConfig)) {
9191
+ if (isValid$2(tempConfig)) {
8961
9192
  validFormatFound = true;
8962
9193
  }
8963
9194
  currentScore += getParsingFlags(tempConfig).charsLeftOver;
@@ -9005,7 +9236,7 @@
9005
9236
  var input = config._i, format2 = config._f;
9006
9237
  config._locale = config._locale || getLocale(config._l);
9007
9238
  if (input === null || format2 === void 0 && input === "") {
9008
- return createInvalid({ nullInput: true });
9239
+ return createInvalid$1({ nullInput: true });
9009
9240
  }
9010
9241
  if (typeof input === "string") {
9011
9242
  config._i = input = config._locale.preparse(input);
@@ -9021,7 +9252,7 @@
9021
9252
  } else {
9022
9253
  configFromInput(config);
9023
9254
  }
9024
- if (!isValid(config)) {
9255
+ if (!isValid$2(config)) {
9025
9256
  config._d = null;
9026
9257
  }
9027
9258
  return config;
@@ -9078,7 +9309,7 @@
9078
9309
  if (this.isValid() && other.isValid()) {
9079
9310
  return other < this ? this : other;
9080
9311
  } else {
9081
- return createInvalid();
9312
+ return createInvalid$1();
9082
9313
  }
9083
9314
  }
9084
9315
  ), prototypeMax = deprecate(
@@ -9088,7 +9319,7 @@
9088
9319
  if (this.isValid() && other.isValid()) {
9089
9320
  return other > this ? this : other;
9090
9321
  } else {
9091
- return createInvalid();
9322
+ return createInvalid$1();
9092
9323
  }
9093
9324
  }
9094
9325
  );
@@ -9100,9 +9331,17 @@
9100
9331
  if (!moments.length) {
9101
9332
  return createLocal();
9102
9333
  }
9103
- res = moments[0];
9104
- for (i = 1; i < moments.length; ++i) {
9105
- if (!moments[i].isValid() || moments[i][fn](res)) {
9334
+ for (i = 0; i < moments.length; ++i) {
9335
+ if (isMoment(moments[i])) {
9336
+ res = moments[i];
9337
+ break;
9338
+ }
9339
+ }
9340
+ if (!res) {
9341
+ return createInvalid$1();
9342
+ }
9343
+ for (++i; i < moments.length; ++i) {
9344
+ if (isMoment(moments[i]) && (!moments[i].isValid() || moments[i][fn](res))) {
9106
9345
  res = moments[i];
9107
9346
  }
9108
9347
  }
@@ -9152,7 +9391,7 @@
9152
9391
  function isValid$1() {
9153
9392
  return this._isValid;
9154
9393
  }
9155
- function createInvalid$1() {
9394
+ function createInvalid() {
9156
9395
  return createDuration(NaN);
9157
9396
  }
9158
9397
  function Duration(duration) {
@@ -9180,7 +9419,7 @@
9180
9419
  function compareArrays(array1, array2, dontConvert) {
9181
9420
  var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i;
9182
9421
  for (i = 0; i < len; i++) {
9183
- if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
9422
+ if (toInt(array1[i]) !== toInt(array2[i])) {
9184
9423
  diffs++;
9185
9424
  }
9186
9425
  }
@@ -9201,8 +9440,12 @@
9201
9440
  addRegexToken("Z", matchShortOffset);
9202
9441
  addRegexToken("ZZ", matchShortOffset);
9203
9442
  addParseToken(["Z", "ZZ"], function(input, array, config) {
9443
+ var offset2 = offsetFromString(matchShortOffset, input);
9204
9444
  config._useUTC = true;
9205
- config._tzm = offsetFromString(matchShortOffset, input);
9445
+ config._tzm = offset2;
9446
+ if (offset2 === null) {
9447
+ getParsingFlags(config).invalidOffset = input;
9448
+ }
9206
9449
  });
9207
9450
  var chunkOffset = /([\+\-]|\d\d)/gi;
9208
9451
  function offsetFromString(matcher, string) {
@@ -9213,6 +9456,9 @@
9213
9456
  chunk = matches[matches.length - 1] || [];
9214
9457
  parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
9215
9458
  minutes2 = +(parts[1] * 60) + toInt(parts[2]);
9459
+ if (toInt(parts[2]) > 59 || (parts[0] === "+" ? minutes2 > 14 * 60 : minutes2 > 12 * 60)) {
9460
+ return null;
9461
+ }
9216
9462
  return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2;
9217
9463
  }
9218
9464
  function cloneWithOffset(input, model) {
@@ -9256,7 +9502,7 @@
9256
9502
  }
9257
9503
  if (offset2 !== input) {
9258
9504
  if (!keepLocalTime || this._changeInProgress) {
9259
- addSubtract(
9505
+ addSubtract$1(
9260
9506
  this,
9261
9507
  createDuration(input - offset2, "m"),
9262
9508
  1,
@@ -9403,7 +9649,7 @@
9403
9649
  return ret;
9404
9650
  }
9405
9651
  createDuration.fn = Duration.prototype;
9406
- createDuration.invalid = createInvalid$1;
9652
+ createDuration.invalid = createInvalid;
9407
9653
  function parseIso(inp, sign2) {
9408
9654
  var res = inp && parseFloat(inp.replace(",", "."));
9409
9655
  return (isNaN(res) ? 0 : res) * sign2;
@@ -9445,21 +9691,21 @@
9445
9691
  period = tmp;
9446
9692
  }
9447
9693
  dur = createDuration(val, period);
9448
- addSubtract(this, dur, direction);
9694
+ addSubtract$1(this, dur, direction);
9449
9695
  return this;
9450
9696
  };
9451
9697
  }
9452
- function addSubtract(mom, duration, isAdding, updateOffset) {
9698
+ function addSubtract$1(mom, duration, isAdding, updateOffset) {
9453
9699
  var milliseconds2 = duration._milliseconds, days2 = absRound(duration._days), months2 = absRound(duration._months);
9454
9700
  if (!mom.isValid()) {
9455
9701
  return;
9456
9702
  }
9457
9703
  updateOffset = updateOffset == null ? true : updateOffset;
9458
9704
  if (months2) {
9459
- setMonth(mom, get(mom, "Month") + months2 * isAdding);
9705
+ setMonth(mom, get$2(mom, "Month") + months2 * isAdding);
9460
9706
  }
9461
9707
  if (days2) {
9462
- set$1(mom, "Date", get(mom, "Date") + days2 * isAdding);
9708
+ set$1(mom, "Date", get$2(mom, "Date") + days2 * isAdding);
9463
9709
  }
9464
9710
  if (milliseconds2) {
9465
9711
  mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding);
@@ -9468,7 +9714,7 @@
9468
9714
  hooks2.updateOffset(mom, days2 || months2);
9469
9715
  }
9470
9716
  }
9471
- var add = createAdder(1, "add"), subtract = createAdder(-1, "subtract");
9717
+ var add$1 = createAdder(1, "add"), subtract$1 = createAdder(-1, "subtract");
9472
9718
  function isString(input) {
9473
9719
  return typeof input === "string" || input instanceof String;
9474
9720
  }
@@ -9536,7 +9782,7 @@
9536
9782
  var diff2 = myMoment.diff(now2, "days", true);
9537
9783
  return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse";
9538
9784
  }
9539
- function calendar$1(time, formats) {
9785
+ function calendar(time, formats) {
9540
9786
  if (arguments.length === 1) {
9541
9787
  if (!arguments[0]) {
9542
9788
  time = void 0;
@@ -9554,7 +9800,7 @@
9554
9800
  output || this.localeData().calendar(format2, this, createLocal(now2))
9555
9801
  );
9556
9802
  }
9557
- function clone() {
9803
+ function clone$1() {
9558
9804
  return new Moment(this);
9559
9805
  }
9560
9806
  function isAfter(input, units) {
@@ -9673,7 +9919,7 @@
9673
9919
  function toString() {
9674
9920
  return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
9675
9921
  }
9676
- function toISOString(keepOffset) {
9922
+ function toISOString$1(keepOffset) {
9677
9923
  if (!this.isValid()) {
9678
9924
  return null;
9679
9925
  }
@@ -9764,7 +10010,7 @@
9764
10010
  return this._locale;
9765
10011
  }
9766
10012
  var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
9767
- function mod$1(dividend, divisor) {
10013
+ function mod(dividend, divisor) {
9768
10014
  return (dividend % divisor + divisor) % divisor;
9769
10015
  }
9770
10016
  function localStartOfDate(y, m, d) {
@@ -9822,18 +10068,18 @@
9822
10068
  break;
9823
10069
  case "hour":
9824
10070
  time = this._d.valueOf();
9825
- time -= mod$1(
10071
+ time -= mod(
9826
10072
  time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
9827
10073
  MS_PER_HOUR
9828
10074
  );
9829
10075
  break;
9830
10076
  case "minute":
9831
10077
  time = this._d.valueOf();
9832
- time -= mod$1(time, MS_PER_MINUTE);
10078
+ time -= mod(time, MS_PER_MINUTE);
9833
10079
  break;
9834
10080
  case "second":
9835
10081
  time = this._d.valueOf();
9836
- time -= mod$1(time, MS_PER_SECOND);
10082
+ time -= mod(time, MS_PER_SECOND);
9837
10083
  break;
9838
10084
  }
9839
10085
  this._d.setTime(time);
@@ -9881,25 +10127,25 @@
9881
10127
  break;
9882
10128
  case "hour":
9883
10129
  time = this._d.valueOf();
9884
- time += MS_PER_HOUR - mod$1(
10130
+ time += MS_PER_HOUR - mod(
9885
10131
  time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
9886
10132
  MS_PER_HOUR
9887
10133
  ) - 1;
9888
10134
  break;
9889
10135
  case "minute":
9890
10136
  time = this._d.valueOf();
9891
- time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
10137
+ time += MS_PER_MINUTE - mod(time, MS_PER_MINUTE) - 1;
9892
10138
  break;
9893
10139
  case "second":
9894
10140
  time = this._d.valueOf();
9895
- time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
10141
+ time += MS_PER_SECOND - mod(time, MS_PER_SECOND) - 1;
9896
10142
  break;
9897
10143
  }
9898
10144
  this._d.setTime(time);
9899
10145
  hooks2.updateOffset(this, true);
9900
10146
  return this;
9901
10147
  }
9902
- function valueOf() {
10148
+ function valueOf$1() {
9903
10149
  return this._d.valueOf() - (this._offset || 0) * 6e4;
9904
10150
  }
9905
10151
  function unix() {
@@ -9935,8 +10181,8 @@
9935
10181
  function toJSON() {
9936
10182
  return this.isValid() ? this.toISOString() : null;
9937
10183
  }
9938
- function isValid$2() {
9939
- return isValid(this);
10184
+ function isValid() {
10185
+ return isValid$2(this);
9940
10186
  }
9941
10187
  function parsingFlags() {
9942
10188
  return extend({}, getParsingFlags(this));
@@ -10137,14 +10383,17 @@
10137
10383
  return locale2._eraYearOrdinalRegex || matchUnsigned;
10138
10384
  }
10139
10385
  function computeErasParse() {
10140
- var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, eras = this.eras();
10386
+ var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, erasName, erasAbbr, erasNarrow, eras = this.eras();
10141
10387
  for (i = 0, l = eras.length; i < l; ++i) {
10142
- namePieces.push(regexEscape(eras[i].name));
10143
- abbrPieces.push(regexEscape(eras[i].abbr));
10144
- narrowPieces.push(regexEscape(eras[i].narrow));
10145
- mixedPieces.push(regexEscape(eras[i].name));
10146
- mixedPieces.push(regexEscape(eras[i].abbr));
10147
- mixedPieces.push(regexEscape(eras[i].narrow));
10388
+ erasName = regexEscape(eras[i].name);
10389
+ erasAbbr = regexEscape(eras[i].abbr);
10390
+ erasNarrow = regexEscape(eras[i].narrow);
10391
+ namePieces.push(erasName);
10392
+ abbrPieces.push(erasAbbr);
10393
+ narrowPieces.push(erasNarrow);
10394
+ mixedPieces.push(erasName);
10395
+ mixedPieces.push(erasAbbr);
10396
+ mixedPieces.push(erasNarrow);
10148
10397
  }
10149
10398
  this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
10150
10399
  this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
@@ -10167,10 +10416,6 @@
10167
10416
  addWeekYearFormatToken("ggggg", "weekYear");
10168
10417
  addWeekYearFormatToken("GGGG", "isoWeekYear");
10169
10418
  addWeekYearFormatToken("GGGGG", "isoWeekYear");
10170
- addUnitAlias("weekYear", "gg");
10171
- addUnitAlias("isoWeekYear", "GG");
10172
- addUnitPriority("weekYear", 1);
10173
- addUnitPriority("isoWeekYear", 1);
10174
10419
  addRegexToken("G", matchSigned);
10175
10420
  addRegexToken("g", matchSigned);
10176
10421
  addRegexToken("GG", match1to2, match2);
@@ -10193,7 +10438,7 @@
10193
10438
  this,
10194
10439
  input,
10195
10440
  this.week(),
10196
- this.weekday(),
10441
+ this.weekday() + this.localeData()._week.dow,
10197
10442
  this.localeData()._week.dow,
10198
10443
  this.localeData()._week.doy
10199
10444
  );
@@ -10242,8 +10487,6 @@
10242
10487
  return this;
10243
10488
  }
10244
10489
  addFormatToken("Q", 0, "Qo", "quarter");
10245
- addUnitAlias("quarter", "Q");
10246
- addUnitPriority("quarter", 7);
10247
10490
  addRegexToken("Q", match1);
10248
10491
  addParseToken("Q", function(input, array) {
10249
10492
  array[MONTH] = (toInt(input) - 1) * 3;
@@ -10252,9 +10495,7 @@
10252
10495
  return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
10253
10496
  }
10254
10497
  addFormatToken("D", ["DD", 2], "Do", "date");
10255
- addUnitAlias("date", "D");
10256
- addUnitPriority("date", 9);
10257
- addRegexToken("D", match1to2);
10498
+ addRegexToken("D", match1to2, match1to2NoLeadingZero);
10258
10499
  addRegexToken("DD", match1to2, match2);
10259
10500
  addRegexToken("Do", function(isStrict, locale2) {
10260
10501
  return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient;
@@ -10265,8 +10506,6 @@
10265
10506
  });
10266
10507
  var getSetDayOfMonth = makeGetSet("Date", true);
10267
10508
  addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
10268
- addUnitAlias("dayOfYear", "DDD");
10269
- addUnitPriority("dayOfYear", 4);
10270
10509
  addRegexToken("DDD", match1to3);
10271
10510
  addRegexToken("DDDD", match3);
10272
10511
  addParseToken(["DDD", "DDDD"], function(input, array, config) {
@@ -10279,16 +10518,12 @@
10279
10518
  return input == null ? dayOfYear : this.add(input - dayOfYear, "d");
10280
10519
  }
10281
10520
  addFormatToken("m", ["mm", 2], 0, "minute");
10282
- addUnitAlias("minute", "m");
10283
- addUnitPriority("minute", 14);
10284
- addRegexToken("m", match1to2);
10521
+ addRegexToken("m", match1to2, match1to2HasZero);
10285
10522
  addRegexToken("mm", match1to2, match2);
10286
10523
  addParseToken(["m", "mm"], MINUTE);
10287
10524
  var getSetMinute = makeGetSet("Minutes", false);
10288
10525
  addFormatToken("s", ["ss", 2], 0, "second");
10289
- addUnitAlias("second", "s");
10290
- addUnitPriority("second", 15);
10291
- addRegexToken("s", match1to2);
10526
+ addRegexToken("s", match1to2, match1to2HasZero);
10292
10527
  addRegexToken("ss", match1to2, match2);
10293
10528
  addParseToken(["s", "ss"], SECOND);
10294
10529
  var getSetSecond = makeGetSet("Seconds", false);
@@ -10317,8 +10552,6 @@
10317
10552
  addFormatToken(0, ["SSSSSSSSS", 9], 0, function() {
10318
10553
  return this.millisecond() * 1e6;
10319
10554
  });
10320
- addUnitAlias("millisecond", "ms");
10321
- addUnitPriority("millisecond", 16);
10322
10555
  addRegexToken("S", match1to3, match1);
10323
10556
  addRegexToken("SS", match1to3, match2);
10324
10557
  addRegexToken("SSS", match1to3, match3);
@@ -10341,105 +10574,105 @@
10341
10574
  function getZoneName() {
10342
10575
  return this._isUTC ? "Coordinated Universal Time" : "";
10343
10576
  }
10344
- var proto = Moment.prototype;
10345
- proto.add = add;
10346
- proto.calendar = calendar$1;
10347
- proto.clone = clone;
10348
- proto.diff = diff;
10349
- proto.endOf = endOf;
10350
- proto.format = format;
10351
- proto.from = from;
10352
- proto.fromNow = fromNow;
10353
- proto.to = to;
10354
- proto.toNow = toNow;
10355
- proto.get = stringGet;
10356
- proto.invalidAt = invalidAt;
10357
- proto.isAfter = isAfter;
10358
- proto.isBefore = isBefore;
10359
- proto.isBetween = isBetween;
10360
- proto.isSame = isSame;
10361
- proto.isSameOrAfter = isSameOrAfter;
10362
- proto.isSameOrBefore = isSameOrBefore;
10363
- proto.isValid = isValid$2;
10364
- proto.lang = lang;
10365
- proto.locale = locale;
10366
- proto.localeData = localeData;
10367
- proto.max = prototypeMax;
10368
- proto.min = prototypeMin;
10369
- proto.parsingFlags = parsingFlags;
10370
- proto.set = stringSet;
10371
- proto.startOf = startOf;
10372
- proto.subtract = subtract;
10373
- proto.toArray = toArray;
10374
- proto.toObject = toObject;
10375
- proto.toDate = toDate;
10376
- proto.toISOString = toISOString;
10377
- proto.inspect = inspect;
10577
+ var proto$2 = Moment.prototype;
10578
+ proto$2.add = add$1;
10579
+ proto$2.calendar = calendar;
10580
+ proto$2.clone = clone$1;
10581
+ proto$2.diff = diff;
10582
+ proto$2.endOf = endOf;
10583
+ proto$2.format = format;
10584
+ proto$2.from = from;
10585
+ proto$2.fromNow = fromNow;
10586
+ proto$2.to = to;
10587
+ proto$2.toNow = toNow;
10588
+ proto$2.get = stringGet;
10589
+ proto$2.invalidAt = invalidAt;
10590
+ proto$2.isAfter = isAfter;
10591
+ proto$2.isBefore = isBefore;
10592
+ proto$2.isBetween = isBetween;
10593
+ proto$2.isSame = isSame;
10594
+ proto$2.isSameOrAfter = isSameOrAfter;
10595
+ proto$2.isSameOrBefore = isSameOrBefore;
10596
+ proto$2.isValid = isValid;
10597
+ proto$2.lang = lang;
10598
+ proto$2.locale = locale;
10599
+ proto$2.localeData = localeData;
10600
+ proto$2.max = prototypeMax;
10601
+ proto$2.min = prototypeMin;
10602
+ proto$2.parsingFlags = parsingFlags;
10603
+ proto$2.set = stringSet;
10604
+ proto$2.startOf = startOf;
10605
+ proto$2.subtract = subtract$1;
10606
+ proto$2.toArray = toArray;
10607
+ proto$2.toObject = toObject;
10608
+ proto$2.toDate = toDate;
10609
+ proto$2.toISOString = toISOString$1;
10610
+ proto$2.inspect = inspect;
10378
10611
  if (typeof Symbol !== "undefined" && Symbol.for != null) {
10379
- proto[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = function() {
10612
+ proto$2[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = function() {
10380
10613
  return "Moment<" + this.format() + ">";
10381
10614
  };
10382
10615
  }
10383
- proto.toJSON = toJSON;
10384
- proto.toString = toString;
10385
- proto.unix = unix;
10386
- proto.valueOf = valueOf;
10387
- proto.creationData = creationData;
10388
- proto.eraName = getEraName;
10389
- proto.eraNarrow = getEraNarrow;
10390
- proto.eraAbbr = getEraAbbr;
10391
- proto.eraYear = getEraYear;
10392
- proto.year = getSetYear;
10393
- proto.isLeapYear = getIsLeapYear;
10394
- proto.weekYear = getSetWeekYear;
10395
- proto.isoWeekYear = getSetISOWeekYear;
10396
- proto.quarter = proto.quarters = getSetQuarter;
10397
- proto.month = getSetMonth;
10398
- proto.daysInMonth = getDaysInMonth;
10399
- proto.week = proto.weeks = getSetWeek;
10400
- proto.isoWeek = proto.isoWeeks = getSetISOWeek;
10401
- proto.weeksInYear = getWeeksInYear;
10402
- proto.weeksInWeekYear = getWeeksInWeekYear;
10403
- proto.isoWeeksInYear = getISOWeeksInYear;
10404
- proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
10405
- proto.date = getSetDayOfMonth;
10406
- proto.day = proto.days = getSetDayOfWeek;
10407
- proto.weekday = getSetLocaleDayOfWeek;
10408
- proto.isoWeekday = getSetISODayOfWeek;
10409
- proto.dayOfYear = getSetDayOfYear;
10410
- proto.hour = proto.hours = getSetHour;
10411
- proto.minute = proto.minutes = getSetMinute;
10412
- proto.second = proto.seconds = getSetSecond;
10413
- proto.millisecond = proto.milliseconds = getSetMillisecond;
10414
- proto.utcOffset = getSetOffset;
10415
- proto.utc = setOffsetToUTC;
10416
- proto.local = setOffsetToLocal;
10417
- proto.parseZone = setOffsetToParsedOffset;
10418
- proto.hasAlignedHourOffset = hasAlignedHourOffset;
10419
- proto.isDST = isDaylightSavingTime;
10420
- proto.isLocal = isLocal;
10421
- proto.isUtcOffset = isUtcOffset;
10422
- proto.isUtc = isUtc;
10423
- proto.isUTC = isUtc;
10424
- proto.zoneAbbr = getZoneAbbr;
10425
- proto.zoneName = getZoneName;
10426
- proto.dates = deprecate(
10616
+ proto$2.toJSON = toJSON;
10617
+ proto$2.toString = toString;
10618
+ proto$2.unix = unix;
10619
+ proto$2.valueOf = valueOf$1;
10620
+ proto$2.creationData = creationData;
10621
+ proto$2.eraName = getEraName;
10622
+ proto$2.eraNarrow = getEraNarrow;
10623
+ proto$2.eraAbbr = getEraAbbr;
10624
+ proto$2.eraYear = getEraYear;
10625
+ proto$2.year = getSetYear;
10626
+ proto$2.isLeapYear = getIsLeapYear;
10627
+ proto$2.weekYear = getSetWeekYear;
10628
+ proto$2.isoWeekYear = getSetISOWeekYear;
10629
+ proto$2.quarter = proto$2.quarters = getSetQuarter;
10630
+ proto$2.month = getSetMonth;
10631
+ proto$2.daysInMonth = getDaysInMonth;
10632
+ proto$2.week = proto$2.weeks = getSetWeek;
10633
+ proto$2.isoWeek = proto$2.isoWeeks = getSetISOWeek;
10634
+ proto$2.weeksInYear = getWeeksInYear;
10635
+ proto$2.weeksInWeekYear = getWeeksInWeekYear;
10636
+ proto$2.isoWeeksInYear = getISOWeeksInYear;
10637
+ proto$2.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
10638
+ proto$2.date = getSetDayOfMonth;
10639
+ proto$2.day = proto$2.days = getSetDayOfWeek;
10640
+ proto$2.weekday = getSetLocaleDayOfWeek;
10641
+ proto$2.isoWeekday = getSetISODayOfWeek;
10642
+ proto$2.dayOfYear = getSetDayOfYear;
10643
+ proto$2.hour = proto$2.hours = getSetHour;
10644
+ proto$2.minute = proto$2.minutes = getSetMinute;
10645
+ proto$2.second = proto$2.seconds = getSetSecond;
10646
+ proto$2.millisecond = proto$2.milliseconds = getSetMillisecond;
10647
+ proto$2.utcOffset = getSetOffset;
10648
+ proto$2.utc = setOffsetToUTC;
10649
+ proto$2.local = setOffsetToLocal;
10650
+ proto$2.parseZone = setOffsetToParsedOffset;
10651
+ proto$2.hasAlignedHourOffset = hasAlignedHourOffset;
10652
+ proto$2.isDST = isDaylightSavingTime;
10653
+ proto$2.isLocal = isLocal;
10654
+ proto$2.isUtcOffset = isUtcOffset;
10655
+ proto$2.isUtc = isUtc;
10656
+ proto$2.isUTC = isUtc;
10657
+ proto$2.zoneAbbr = getZoneAbbr;
10658
+ proto$2.zoneName = getZoneName;
10659
+ proto$2.dates = deprecate(
10427
10660
  "dates accessor is deprecated. Use date instead.",
10428
10661
  getSetDayOfMonth
10429
10662
  );
10430
- proto.months = deprecate(
10663
+ proto$2.months = deprecate(
10431
10664
  "months accessor is deprecated. Use month instead",
10432
10665
  getSetMonth
10433
10666
  );
10434
- proto.years = deprecate(
10667
+ proto$2.years = deprecate(
10435
10668
  "years accessor is deprecated. Use year instead",
10436
10669
  getSetYear
10437
10670
  );
10438
- proto.zone = deprecate(
10671
+ proto$2.zone = deprecate(
10439
10672
  "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
10440
10673
  getSetZone
10441
10674
  );
10442
- proto.isDSTShifted = deprecate(
10675
+ proto$2.isDSTShifted = deprecate(
10443
10676
  "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
10444
10677
  isDaylightSavingTimeShifted
10445
10678
  );
@@ -10453,13 +10686,13 @@
10453
10686
  return string;
10454
10687
  }
10455
10688
  var proto$1 = Locale.prototype;
10456
- proto$1.calendar = calendar;
10689
+ proto$1.calendar = calendar$1;
10457
10690
  proto$1.longDateFormat = longDateFormat;
10458
10691
  proto$1.invalidDate = invalidDate;
10459
10692
  proto$1.ordinal = ordinal;
10460
10693
  proto$1.preparse = preParsePostFormat;
10461
10694
  proto$1.postformat = preParsePostFormat;
10462
- proto$1.relativeTime = relativeTime;
10695
+ proto$1.relativeTime = relativeTime$1;
10463
10696
  proto$1.pastFuture = pastFuture;
10464
10697
  proto$1.set = set;
10465
10698
  proto$1.eras = localeEras;
@@ -10579,7 +10812,7 @@
10579
10812
  getLocale
10580
10813
  );
10581
10814
  var mathAbs = Math.abs;
10582
- function abs() {
10815
+ function abs$1() {
10583
10816
  var data = this._data;
10584
10817
  this._milliseconds = mathAbs(this._milliseconds);
10585
10818
  this._days = mathAbs(this._days);
@@ -10592,18 +10825,18 @@
10592
10825
  data.years = mathAbs(data.years);
10593
10826
  return this;
10594
10827
  }
10595
- function addSubtract$1(duration, input, value, direction) {
10828
+ function addSubtract(duration, input, value, direction) {
10596
10829
  var other = createDuration(input, value);
10597
10830
  duration._milliseconds += direction * other._milliseconds;
10598
10831
  duration._days += direction * other._days;
10599
10832
  duration._months += direction * other._months;
10600
10833
  return duration._bubble();
10601
10834
  }
10602
- function add$1(input, value) {
10603
- return addSubtract$1(this, input, value, 1);
10835
+ function add(input, value) {
10836
+ return addSubtract(this, input, value, 1);
10604
10837
  }
10605
- function subtract$1(input, value) {
10606
- return addSubtract$1(this, input, value, -1);
10838
+ function subtract(input, value) {
10839
+ return addSubtract(this, input, value, -1);
10607
10840
  }
10608
10841
  function absCeil(number) {
10609
10842
  if (number < 0) {
@@ -10681,22 +10914,16 @@
10681
10914
  }
10682
10915
  }
10683
10916
  }
10684
- function valueOf$1() {
10685
- if (!this.isValid()) {
10686
- return NaN;
10687
- }
10688
- return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6;
10689
- }
10690
10917
  function makeAs(alias) {
10691
10918
  return function() {
10692
10919
  return this.as(alias);
10693
10920
  };
10694
10921
  }
10695
- var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y");
10696
- function clone$1() {
10922
+ var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"), valueOf = asMilliseconds;
10923
+ function clone() {
10697
10924
  return createDuration(this);
10698
10925
  }
10699
- function get$2(units) {
10926
+ function get(units) {
10700
10927
  units = normalizeUnits(units);
10701
10928
  return this.isValid() ? this[units + "s"]() : NaN;
10702
10929
  }
@@ -10726,9 +10953,15 @@
10726
10953
  // months to year
10727
10954
  };
10728
10955
  function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale2) {
10729
- return locale2.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
10956
+ return relativeTimeWithoutPostformat.call(
10957
+ locale2,
10958
+ number || 1,
10959
+ !!withoutSuffix,
10960
+ string,
10961
+ isFuture
10962
+ );
10730
10963
  }
10731
- function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) {
10964
+ function relativeTime(posNegDuration, withoutSuffix, thresholds2, locale2) {
10732
10965
  var duration = createDuration(posNegDuration).abs(), seconds2 = round(duration.as("s")), minutes2 = round(duration.as("m")), hours2 = round(duration.as("h")), days2 = round(duration.as("d")), months2 = round(duration.as("M")), weeks2 = round(duration.as("w")), years2 = round(duration.as("y")), a = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2];
10733
10966
  if (thresholds2.w != null) {
10734
10967
  a = a || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2];
@@ -10775,27 +11008,27 @@
10775
11008
  withSuffix = argWithSuffix;
10776
11009
  }
10777
11010
  if (typeof argThresholds === "object") {
10778
- th = Object.assign({}, thresholds, argThresholds);
11011
+ th = extend(extend({}, thresholds), argThresholds || {});
10779
11012
  if (argThresholds.s != null && argThresholds.ss == null) {
10780
11013
  th.ss = argThresholds.s - 1;
10781
11014
  }
10782
11015
  }
10783
11016
  locale2 = this.localeData();
10784
- output = relativeTime$1(this, !withSuffix, th, locale2);
11017
+ output = relativeTime(this, !withSuffix, th, locale2);
10785
11018
  if (withSuffix) {
10786
- output = locale2.pastFuture(+this, output);
11019
+ output = pastFutureWithoutPostformat.call(locale2, +this, output);
10787
11020
  }
10788
11021
  return locale2.postformat(output);
10789
11022
  }
10790
- var abs$1 = Math.abs;
11023
+ var abs = Math.abs;
10791
11024
  function sign(x) {
10792
11025
  return (x > 0) - (x < 0) || +x;
10793
11026
  }
10794
- function toISOString$1() {
11027
+ function toISOString() {
10795
11028
  if (!this.isValid()) {
10796
11029
  return this.localeData().invalidDate();
10797
11030
  }
10798
- var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
11031
+ var seconds2 = abs(this._milliseconds) / 1e3, days2 = abs(this._days), months2 = abs(this._months), minutes2, hours2, years2, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
10799
11032
  if (!total) {
10800
11033
  return "P0D";
10801
11034
  }
@@ -10812,44 +11045,44 @@
10812
11045
  hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "";
10813
11046
  return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s + "S" : "");
10814
11047
  }
10815
- var proto$2 = Duration.prototype;
10816
- proto$2.isValid = isValid$1;
10817
- proto$2.abs = abs;
10818
- proto$2.add = add$1;
10819
- proto$2.subtract = subtract$1;
10820
- proto$2.as = as;
10821
- proto$2.asMilliseconds = asMilliseconds;
10822
- proto$2.asSeconds = asSeconds;
10823
- proto$2.asMinutes = asMinutes;
10824
- proto$2.asHours = asHours;
10825
- proto$2.asDays = asDays;
10826
- proto$2.asWeeks = asWeeks;
10827
- proto$2.asMonths = asMonths;
10828
- proto$2.asQuarters = asQuarters;
10829
- proto$2.asYears = asYears;
10830
- proto$2.valueOf = valueOf$1;
10831
- proto$2._bubble = bubble;
10832
- proto$2.clone = clone$1;
10833
- proto$2.get = get$2;
10834
- proto$2.milliseconds = milliseconds;
10835
- proto$2.seconds = seconds;
10836
- proto$2.minutes = minutes;
10837
- proto$2.hours = hours;
10838
- proto$2.days = days;
10839
- proto$2.weeks = weeks;
10840
- proto$2.months = months;
10841
- proto$2.years = years;
10842
- proto$2.humanize = humanize;
10843
- proto$2.toISOString = toISOString$1;
10844
- proto$2.toString = toISOString$1;
10845
- proto$2.toJSON = toISOString$1;
10846
- proto$2.locale = locale;
10847
- proto$2.localeData = localeData;
10848
- proto$2.toIsoString = deprecate(
11048
+ var proto = Duration.prototype;
11049
+ proto.isValid = isValid$1;
11050
+ proto.abs = abs$1;
11051
+ proto.add = add;
11052
+ proto.subtract = subtract;
11053
+ proto.as = as;
11054
+ proto.asMilliseconds = asMilliseconds;
11055
+ proto.asSeconds = asSeconds;
11056
+ proto.asMinutes = asMinutes;
11057
+ proto.asHours = asHours;
11058
+ proto.asDays = asDays;
11059
+ proto.asWeeks = asWeeks;
11060
+ proto.asMonths = asMonths;
11061
+ proto.asQuarters = asQuarters;
11062
+ proto.asYears = asYears;
11063
+ proto.valueOf = valueOf;
11064
+ proto._bubble = bubble;
11065
+ proto.clone = clone;
11066
+ proto.get = get;
11067
+ proto.milliseconds = milliseconds;
11068
+ proto.seconds = seconds;
11069
+ proto.minutes = minutes;
11070
+ proto.hours = hours;
11071
+ proto.days = days;
11072
+ proto.weeks = weeks;
11073
+ proto.months = months;
11074
+ proto.years = years;
11075
+ proto.humanize = humanize;
11076
+ proto.toISOString = toISOString;
11077
+ proto.toString = toISOString;
11078
+ proto.toJSON = toISOString;
11079
+ proto.locale = locale;
11080
+ proto.localeData = localeData;
11081
+ proto.toIsoString = deprecate(
10849
11082
  "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
10850
- toISOString$1
11083
+ toISOString
10851
11084
  );
10852
- proto$2.lang = lang;
11085
+ proto.lang = lang;
10853
11086
  addFormatToken("X", 0, 0, "unix");
10854
11087
  addFormatToken("x", 0, 0, "valueOf");
10855
11088
  addRegexToken("x", matchSigned);
@@ -10860,9 +11093,9 @@
10860
11093
  addParseToken("x", function(input, array, config) {
10861
11094
  config._d = new Date(toInt(input));
10862
11095
  });
10863
- hooks2.version = "2.29.4";
11096
+ hooks2.version = "2.31.0";
10864
11097
  setHookCallback(createLocal);
10865
- hooks2.fn = proto;
11098
+ hooks2.fn = proto$2;
10866
11099
  hooks2.min = min;
10867
11100
  hooks2.max = max;
10868
11101
  hooks2.now = now;
@@ -10871,7 +11104,7 @@
10871
11104
  hooks2.months = listMonths;
10872
11105
  hooks2.isDate = isDate;
10873
11106
  hooks2.locale = getSetGlobalLocale;
10874
- hooks2.invalid = createInvalid;
11107
+ hooks2.invalid = createInvalid$1;
10875
11108
  hooks2.duration = createDuration;
10876
11109
  hooks2.isMoment = isMoment;
10877
11110
  hooks2.weekdays = listWeekdays;
@@ -10888,7 +11121,7 @@
10888
11121
  hooks2.relativeTimeRounding = getSetRelativeTimeRounding;
10889
11122
  hooks2.relativeTimeThreshold = getSetRelativeTimeThreshold;
10890
11123
  hooks2.calendarFormat = getCalendarFormat;
10891
- hooks2.prototype = proto;
11124
+ hooks2.prototype = proto$2;
10892
11125
  hooks2.HTML5_FMT = {
10893
11126
  DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
10894
11127
  // <input type="datetime-local" />
@@ -35127,7 +35360,7 @@
35127
35360
  execute() {
35128
35361
  var defered = import_q9.default.defer();
35129
35362
  var promise = defered.promise;
35130
- this._ogapi.Napi.post(
35363
+ this._ogapi.Napi._searchPost(
35131
35364
  this._resource,
35132
35365
  this._filter(),
35133
35366
  this._timeout,
@@ -35190,7 +35423,7 @@
35190
35423
  this._setExtraHeaders({
35191
35424
  Accept: "text/plain"
35192
35425
  });
35193
- this._ogapi.Napi.post(
35426
+ this._ogapi.Napi._searchPost(
35194
35427
  this._resource,
35195
35428
  filter,
35196
35429
  this._timeout,
@@ -35242,7 +35475,7 @@
35242
35475
  statusCode: 403
35243
35476
  });
35244
35477
  } else {
35245
- _this._ogapi.Napi.post(
35478
+ _this._ogapi.Napi._searchPost(
35246
35479
  _this._resource,
35247
35480
  filter,
35248
35481
  _this._timeout,
@@ -36778,7 +37011,7 @@
36778
37011
  statusCode: 403
36779
37012
  });
36780
37013
  } else {
36781
- _this._ogapi.Napi.post(_this._resource, filter, _this._timeout, _this._getExtraHeaders(), _this._getUrlParameters()).then((response) => {
37014
+ _this._ogapi.Napi._searchPost(_this._resource, filter, _this._timeout, _this._getExtraHeaders(), _this._getUrlParameters()).then((response) => {
36782
37015
  let statusCode = response.statusCode;
36783
37016
  let body = response.body;
36784
37017
  if (!body && response.text) {
@@ -40139,7 +40372,7 @@
40139
40372
  var defered = import_q25.default.defer();
40140
40373
  var promise = defered.promise;
40141
40374
  var parameters = this._getUrlParameters();
40142
- this._ogapi.Napi.post(this._resource, this._filter(), this._timeout, this._getExtraHeaders(), parameters).then((response) => {
40375
+ this._ogapi.Napi._searchPost(this._resource, this._filter(), this._timeout, this._getExtraHeaders(), parameters).then((response) => {
40143
40376
  let resultQuery = response.body;
40144
40377
  let statusCode = response.statusCode;
40145
40378
  if (statusCode === 200 && resultQuery.entities) {
@@ -40485,7 +40718,7 @@
40485
40718
  var defered = import_q26.default.defer();
40486
40719
  var promise = defered.promise;
40487
40720
  var parameters = this._getUrlParameters();
40488
- this._ogapi.Napi.post(this._resource, this._filter(), this._timeout, this._getExtraHeaders(), parameters).then((response) => {
40721
+ this._ogapi.Napi._searchPost(this._resource, this._filter(), this._timeout, this._getExtraHeaders(), parameters).then((response) => {
40489
40722
  let resultQuery = response.body;
40490
40723
  let statusCode = response.statusCode;
40491
40724
  if (statusCode === 200) {
@@ -52180,7 +52413,7 @@
52180
52413
  var defered = import_q40.default.defer();
52181
52414
  var promise = defered.promise;
52182
52415
  var parameters = this._getUrlParameters();
52183
- this._ogapi.Napi.post(this._resource, this._filter(), this._timeout, this._getExtraHeaders(), parameters).then((response) => {
52416
+ this._ogapi.Napi._searchPost(this._resource, this._filter(), this._timeout, this._getExtraHeaders(), parameters).then((response) => {
52184
52417
  let resultQuery = response.body;
52185
52418
  let statusCode = response.statusCode;
52186
52419
  if (statusCode === 200 && resultQuery.entities && resultQuery.entities.length > 0) {
@@ -53504,6 +53737,15 @@
53504
53737
  }
53505
53738
 
53506
53739
  // src/util/http/RequestSpec.js
53740
+ function transportError(message, reason) {
53741
+ const error = new Error(message);
53742
+ error.reason = reason;
53743
+ if (reason === "timeout") {
53744
+ error.timeout = true;
53745
+ error.code = "ECONNABORTED";
53746
+ }
53747
+ return error;
53748
+ }
53507
53749
  var beforeStart;
53508
53750
  function setBeforeStart(callback) {
53509
53751
  beforeStart = callback;
@@ -53789,7 +54031,7 @@
53789
54031
  this.aborted = true;
53790
54032
  this.clearTimeout();
53791
54033
  if (this._xhr) this._xhr.abort();
53792
- else if (this._controller) this._controller.abort(new Error("Request aborted"));
54034
+ else if (this._controller) this._controller.abort(transportError("Request aborted", "aborted"));
53793
54035
  this.emit("abort");
53794
54036
  return this;
53795
54037
  }
@@ -54083,7 +54325,7 @@
54083
54325
  }
54084
54326
  _execute() {
54085
54327
  return __async(this, null, function* () {
54086
- if (this.aborted) throw new Error("Request aborted");
54328
+ if (this.aborted) throw transportError("Request aborted", "aborted");
54087
54329
  const mocked = match(this.method, this.url);
54088
54330
  if (mocked) {
54089
54331
  const lowerCased = {};
@@ -54177,9 +54419,7 @@
54177
54419
  let expire;
54178
54420
  const promise = new Promise((resolve, reject) => {
54179
54421
  expire = (message) => {
54180
- const error = new Error(message);
54181
- error.timeout = true;
54182
- error.code = "ECONNABORTED";
54422
+ const error = transportError(message, "timeout");
54183
54423
  this.timedout = true;
54184
54424
  if (this._xhr) this._xhr.abort();
54185
54425
  else if (this._controller) this._controller.abort(error);
@@ -54201,7 +54441,11 @@
54201
54441
  if (duplex) init.duplex = duplex;
54202
54442
  if (controller) init.signal = controller.signal;
54203
54443
  if (this._withCredentials) init.credentials = "include";
54204
- const raw = yield Promise.race([fetch(this.url, init), expiry.promise]);
54444
+ const sent = fetch(this.url, init).catch((error) => {
54445
+ if (error && typeof error === "object" && !error.reason) error.reason = "network";
54446
+ throw error;
54447
+ });
54448
+ const raw = yield Promise.race([sent, expiry.promise]);
54205
54449
  if (this._responseTimer) {
54206
54450
  clearTimeout(this._responseTimer);
54207
54451
  this._responseTimer = null;
@@ -54243,7 +54487,7 @@
54243
54487
  const xhr = new XMLHttpRequest();
54244
54488
  this._xhr = xhr;
54245
54489
  if (this.aborted) {
54246
- reject(new Error("Request aborted"));
54490
+ reject(transportError("Request aborted", "aborted"));
54247
54491
  return;
54248
54492
  }
54249
54493
  const expiry = this._expiry();
@@ -54287,9 +54531,9 @@
54287
54531
  if (!this._isResponseOK(response)) reject(toError(response));
54288
54532
  else resolve(response);
54289
54533
  };
54290
- xhr.onerror = () => reject(new Error("Network error"));
54291
- xhr.ontimeout = () => reject(new Error("Timeout of " + this._timeout + "ms exceeded"));
54292
- xhr.onabort = () => reject(new Error("Request aborted"));
54534
+ xhr.onerror = () => reject(transportError("Network error", "network"));
54535
+ xhr.ontimeout = () => reject(transportError("Timeout of " + this._timeout + "ms exceeded", "timeout"));
54536
+ xhr.onabort = () => reject(transportError("Request aborted", "aborted"));
54293
54537
  xhr.send(body === void 0 ? null : body);
54294
54538
  });
54295
54539
  }
@@ -57735,8 +57979,9 @@
57735
57979
  var InternalOpenGateAPI = class _InternalOpenGateAPI {
57736
57980
  /**
57737
57981
  * Constructor
57738
- * @param {{ url: string,port: string,version: string,apiKey: string}} _options - this is configuration about Opengate North API.
57739
- * @param {AmpliaREST} ampliaREST - this is a backend selected to manage a request to Opengate North API.
57982
+ * @param {object} northAmpliaREST - the client that sends requests to the North API.
57983
+ * @param {object} southAmpliaREST - the client that sends requests to the South API.
57984
+ * @param {OpenGateOptions & Record<string, unknown>} _options - the client's configuration.
57740
57985
  */
57741
57986
  constructor(northAmpliaREST, southAmpliaREST, _options) {
57742
57987
  if (this.constructor === _InternalOpenGateAPI) {
@@ -57754,6 +57999,7 @@
57754
57999
  if (_options.hooks && _options.hooks.beforeStart && typeof _options.hooks.beforeStart === "function") {
57755
58000
  registerBeforeStartHook(_options.hooks.beforeStart);
57756
58001
  }
58002
+ Object.defineProperty(this, "_options", { value: Object.freeze(__spreadValues({}, _options)) });
57757
58003
  this.Napi = northAmpliaREST;
57758
58004
  this.Sapi = southAmpliaREST;
57759
58005
  this.EX = Expression;
@@ -57762,6 +58008,26 @@
57762
58008
  this.alarms = new AlarmActions(this);
57763
58009
  this.entityBuilder = new EntityBuilder(this);
57764
58010
  }
58011
+ /**
58012
+ * A new client with this one's options, and the given ones on top. The merge is shallow: an
58013
+ * override of `south` replaces the whole object.
58014
+ *
58015
+ * A clone of a read-only client is read-only too, and asking for `readOnly: false` throws: code
58016
+ * handed a read-only client cannot widen it this way. `logger` and `hooks` are process-wide, so
58017
+ * overriding them in a clone changes them for every client.
58018
+ * @example
58019
+ * const widgetApi = ogapi.clone({ readOnly: true });
58020
+ * @param {Partial<OpenGateOptions> & Record<string, unknown>} [overrides] - the options to change.
58021
+ * @return {this}
58022
+ */
58023
+ clone(overrides = {}) {
58024
+ if (this._options.readOnly && "readOnly" in overrides && !overrides.readOnly) {
58025
+ throw new Error("OGAPI: a clone of a read-only client is read-only too");
58026
+ }
58027
+ const options = __spreadValues(__spreadValues({}, this._options), overrides);
58028
+ if (this._options.readOnly) options.readOnly = true;
58029
+ return new this.constructor(options);
58030
+ }
57765
58031
  /**
57766
58032
  * This returns a util to find a user
57767
58033
  * @return {UserFinder}
@@ -58882,6 +59148,8 @@
58882
59148
  * @return {Promise}
58883
59149
  */
58884
59150
  get(url, timeout, headers, parameters, asBlob, serviceBaseURL) {
59151
+ const rejected = this._guard("GET", url, serviceBaseURL);
59152
+ if (rejected) return rejected;
58885
59153
  const _url = this._createUrl(url, parameters, serviceBaseURL);
58886
59154
  logger_default.info("GET", _url);
58887
59155
  var req = new RequestSpec("GET", _url);
@@ -58898,6 +59166,8 @@
58898
59166
  * @return {Promise}
58899
59167
  */
58900
59168
  patch(url, data, timeout, headers, parameters, serviceBaseURL) {
59169
+ const rejected = this._guard("PATCH", url, serviceBaseURL);
59170
+ if (rejected) return rejected;
58901
59171
  const _url = this._createUrl(url, parameters, serviceBaseURL);
58902
59172
  logger_default.info("PATCH", _url);
58903
59173
  var req = new RequestSpec("PATCH", _url).send(data);
@@ -58914,6 +59184,8 @@
58914
59184
  * @return {Promise}
58915
59185
  */
58916
59186
  post(url, data, timeout, headers, parameters, serviceBaseURL) {
59187
+ const rejected = this._guard("POST", url, serviceBaseURL);
59188
+ if (rejected) return rejected;
58917
59189
  const _url = this._createUrl(url, parameters, serviceBaseURL);
58918
59190
  logger_default.info("POST", _url);
58919
59191
  var req = new RequestSpec("POST", _url).send(data);
@@ -58931,6 +59203,8 @@
58931
59203
  * @return {Promise}
58932
59204
  */
58933
59205
  post_multipart(url, formData, events, timeout, headers, parameters, serviceBaseURL) {
59206
+ const rejected = this._guard("POST", url, serviceBaseURL);
59207
+ if (rejected) return rejected;
58934
59208
  const _url = this._createUrl(url, parameters, serviceBaseURL);
58935
59209
  logger_default.info("POST_MULTIPART", _url);
58936
59210
  let req = new RequestSpec("POST", _url);
@@ -58948,6 +59222,8 @@
58948
59222
  * @return {Promise}
58949
59223
  */
58950
59224
  put(url, data, timeout, headers, parameters, serviceBaseURL) {
59225
+ const rejected = this._guard("PUT", url, serviceBaseURL);
59226
+ if (rejected) return rejected;
58951
59227
  const _url = this._createUrl(url, parameters, serviceBaseURL);
58952
59228
  logger_default.info("PUT", _url);
58953
59229
  var req = new RequestSpec("PUT", _url).send(data);
@@ -58972,6 +59248,8 @@
58972
59248
  * @return {Promise}
58973
59249
  */
58974
59250
  put_multipart(url, formData, events, timeout, headers, parameters, serviceBaseURL) {
59251
+ const rejected = this._guard("PUT", url, serviceBaseURL);
59252
+ if (rejected) return rejected;
58975
59253
  const _url = this._createUrl(url, parameters, serviceBaseURL);
58976
59254
  logger_default.info("PUT_MULTIPART", _url);
58977
59255
  let req = new RequestSpec("PUT", _url);
@@ -59045,6 +59323,8 @@
59045
59323
  * @return {Promise}
59046
59324
  */
59047
59325
  delete(url, timeout, headers, parameters, body, serviceBaseURL) {
59326
+ const rejected = this._guard("DELETE", url, serviceBaseURL);
59327
+ if (rejected) return rejected;
59048
59328
  const _url = this._createUrl(url, parameters, serviceBaseURL);
59049
59329
  logger_default.info("DELETE", _url);
59050
59330
  var req;
@@ -59082,6 +59362,62 @@
59082
59362
  });
59083
59363
  return this._url(this._options) + "/" + this._getDefaultBaseURL(serviceBaseURL) + "/" + encode.join("/");
59084
59364
  }
59365
+ /**
59366
+ * POST for a search, which reads. The search layer calls this instead of `post` so that a
59367
+ * read-only client lets it through; the mark lasts only for the synchronous guard inside `post`.
59368
+ * @return {Promise}
59369
+ */
59370
+ _searchPost(url, data, timeout, headers, parameters, serviceBaseURL) {
59371
+ this._searchIntent = true;
59372
+ try {
59373
+ return this.post(url, data, timeout, headers, parameters, serviceBaseURL);
59374
+ } finally {
59375
+ this._searchIntent = false;
59376
+ }
59377
+ }
59378
+ /** @return {Promise|null} a rejection to return before sending, or null to go ahead. */
59379
+ _guard(method, url, serviceBaseURL) {
59380
+ return this._rejectDuplicatedBase(url, serviceBaseURL) || this._rejectWrite(method, url);
59381
+ }
59382
+ /**
59383
+ * With `readOnly`, everything but GET and search POSTs is refused before it leaves: the search
59384
+ * builders, and a free `post` to a `search/...` path. It guards against mistakes, not against
59385
+ * code that holds the client and means harm -- `_searchPost` and `fetch` are one call away. The
59386
+ * server, or a proxy in front of it, remains the boundary.
59387
+ * @return {Promise|null}
59388
+ */
59389
+ _rejectWrite(method, url) {
59390
+ if (!this._options.readOnly || method === "GET") return null;
59391
+ const isSearch = this._searchIntent || typeof url === "string" && /^\/*search\//.test(url);
59392
+ if (method === "POST" && isSearch) return null;
59393
+ const message = "OGAPI: read-only client refused " + method + " " + url;
59394
+ return import_q50.default.reject({
59395
+ statusCode: 403,
59396
+ data: { errors: [{ code: 403, message }] },
59397
+ reason: "read-only",
59398
+ cause: new Error(message)
59399
+ });
59400
+ }
59401
+ /**
59402
+ * The default base (`north/v80`, or `v80` on South) is prepended to every path, so a path that
59403
+ * repeats it, such as `/north/v80/provision/...`, used to reach `north/v80//north/v80/...` and
59404
+ * fail with a misleading error. Such a call never worked, so refusing it breaks nothing. A
59405
+ * caller-given `serviceBaseURL` is left alone: its paths are its own business.
59406
+ * @return {Promise|null} a rejection to return, or null when the path is fine.
59407
+ */
59408
+ _rejectDuplicatedBase(url, serviceBaseURL) {
59409
+ if (serviceBaseURL || typeof url !== "string") return null;
59410
+ const base = this._getDefaultBaseURL();
59411
+ const firstSegment = base.split("/")[0];
59412
+ if (url.replace(/^\/+/, "").split("/")[0] !== firstSegment) return null;
59413
+ const message = 'OGAPI: the path "' + url + '" already starts with "' + firstSegment + '/", but "' + base + '/" is prepended to every path. Pass the path relative to it, or give a serviceBaseURL.';
59414
+ return import_q50.default.reject({
59415
+ statusCode: 400,
59416
+ data: { errors: [{ code: 400, message }] },
59417
+ reason: "invalid-path",
59418
+ cause: new Error(message)
59419
+ });
59420
+ }
59085
59421
  _getDefaultBaseURL(serviceBaseURL) {
59086
59422
  if (!serviceBaseURL) {
59087
59423
  if (this._isSouth) {
@@ -59149,11 +59485,16 @@
59149
59485
  status = 408;
59150
59486
  }
59151
59487
  }
59152
- defered.reject({
59488
+ const rejection = {
59153
59489
  statusCode: status,
59154
59490
  data,
59155
59491
  headers: headers2
59156
- });
59492
+ };
59493
+ if (typeof err.response === "undefined") {
59494
+ rejection.reason = err.reason || "unknown";
59495
+ rejection.cause = err;
59496
+ }
59497
+ defered.reject(rejection);
59157
59498
  } else {
59158
59499
  defered.resolve(res);
59159
59500
  }
@@ -59229,7 +59570,7 @@ q/q.js:
59229
59570
 
59230
59571
  moment/moment.js:
59231
59572
  (*! moment.js *)
59232
- (*! version : 2.29.4 *)
59573
+ (*! version : 2.31.0 *)
59233
59574
  (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
59234
59575
  (*! license : MIT *)
59235
59576
  (*! momentjs.com *)
@@ -59267,4 +59608,4 @@ buffer/index.js:
59267
59608
  safe-buffer/index.js:
59268
59609
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
59269
59610
  */
59270
- //# sourceMappingURL=opengate-api-bower-16.2.0.js.map
59611
+ //# sourceMappingURL=opengate-api-bower-16.3.0.js.map