@dan-uni/dan-any 1.2.2 → 1.2.5

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 (47) hide show
  1. package/README.md +1 -0
  2. package/dist/browser/17.min.js +2 -5
  3. package/dist/browser/705.min.js +77 -0
  4. package/dist/browser/plugins/bili.min.js +1 -0
  5. package/dist/browser/plugins/index.min.js +1 -1
  6. package/dist/browser/src/index.d.ts +1 -4
  7. package/dist/browser/src/plugins/bili/history-danmaku-fast-forward.d.ts +18 -0
  8. package/dist/browser/src/plugins/bili/index.d.ts +2 -0
  9. package/dist/browser/src/plugins/index.d.ts +1 -1
  10. package/dist/node/17.js +2 -5
  11. package/dist/node/705.js +77 -0
  12. package/dist/node/plugins/bili.js +1 -0
  13. package/dist/node/plugins/index.js +1 -1
  14. package/dist/node/src/index.d.ts +1 -4
  15. package/dist/node/src/plugins/bili/history-danmaku-fast-forward.d.ts +18 -0
  16. package/dist/node/src/plugins/bili/index.d.ts +2 -0
  17. package/dist/node/src/plugins/index.d.ts +1 -1
  18. package/dist/umd/index.umd.min.js +9 -7
  19. package/dist/umd/plugins/{bili-dedupe.umd.min.js → bili.umd.min.js} +4623 -12
  20. package/dist/umd/plugins/index.umd.min.js +4625 -14
  21. package/dist/umd/src/index.d.ts +1 -4
  22. package/dist/umd/src/plugins/bili/history-danmaku-fast-forward.d.ts +18 -0
  23. package/dist/umd/src/plugins/bili/index.d.ts +2 -0
  24. package/dist/umd/src/plugins/index.d.ts +1 -1
  25. package/package.json +4 -2
  26. package/rslib.config.ts +1 -1
  27. package/src/index.ts +1 -11
  28. package/src/plugins/bili/README.md +87 -0
  29. package/src/plugins/bili/history-danmaku-fast-forward.ts +86 -0
  30. package/src/plugins/bili/index.test.ts +129 -0
  31. package/src/plugins/bili/index.ts +2 -0
  32. package/src/plugins/index.ts +1 -1
  33. package/src/plugins/stats/README.md +44 -0
  34. package/src/plugins/stats/index.test.ts +1 -1
  35. package/dist/browser/157.min.js +0 -30
  36. package/dist/browser/plugins/bili-dedupe.min.js +0 -1
  37. package/dist/node/157.js +0 -30
  38. package/dist/node/plugins/bili-dedupe.js +0 -1
  39. package/src/plugins/bili-dedupe/index.test.ts +0 -43
  40. /package/dist/browser/src/plugins/{bili-dedupe/index.d.ts → bili/dedupe.d.ts} +0 -0
  41. /package/dist/browser/src/plugins/{bili-dedupe → bili}/index.test.d.ts +0 -0
  42. /package/dist/node/src/plugins/{bili-dedupe/index.d.ts → bili/dedupe.d.ts} +0 -0
  43. /package/dist/node/src/plugins/{bili-dedupe → bili}/index.test.d.ts +0 -0
  44. /package/dist/umd/plugins/{bili-dedupe.umd.min.js.LICENSE.txt → bili.umd.min.js.LICENSE.txt} +0 -0
  45. /package/dist/umd/src/plugins/{bili-dedupe/index.d.ts → bili/dedupe.d.ts} +0 -0
  46. /package/dist/umd/src/plugins/{bili-dedupe → bili}/index.test.d.ts +0 -0
  47. /package/src/plugins/{bili-dedupe/index.ts → bili/dedupe.ts} +0 -0
@@ -1,4 +1,4 @@
1
- /*! For license information please see bili-dedupe.umd.min.js.LICENSE.txt */
1
+ /*! For license information please see bili.umd.min.js.LICENSE.txt */
2
2
  (function(root, factory) {
3
3
  if ('object' == typeof exports && 'object' == typeof module) module.exports = factory();
4
4
  else if ('function' == typeof define && define.amd) define([], factory);
@@ -14398,11 +14398,11 @@
14398
14398
  },
14399
14399
  num_dec: {
14400
14400
  regex: /&#([0-9]{1,7});/g,
14401
- val: (_, str)=>String.fromCodePoint(Number.parseInt(str, 10))
14401
+ val: (_, str)=>fromCodePoint(str, 10, "&#")
14402
14402
  },
14403
14403
  num_hex: {
14404
14404
  regex: /&#x([0-9a-fA-F]{1,6});/g,
14405
- val: (_, str)=>String.fromCodePoint(Number.parseInt(str, 16))
14405
+ val: (_, str)=>fromCodePoint(str, 16, "&#x")
14406
14406
  }
14407
14407
  };
14408
14408
  this.addExternalEntities = addExternalEntities;
@@ -14778,6 +14778,11 @@
14778
14778
  if (isExist(val)) return val;
14779
14779
  return '';
14780
14780
  }
14781
+ function fromCodePoint(str, base, prefix) {
14782
+ const codePoint = Number.parseInt(str, base);
14783
+ if (codePoint >= 0 && codePoint <= 0x10FFFF) return String.fromCodePoint(codePoint);
14784
+ return prefix + str + ";";
14785
+ }
14781
14786
  const node2json_METADATA_SYMBOL = XmlNode.getMetaDataSymbol();
14782
14787
  function prettify(node, options) {
14783
14788
  return node2json_compress(node, options);
@@ -20334,7 +20339,7 @@
20334
20339
  function timestamp_timestampMs(timestamp) {
20335
20340
  return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
20336
20341
  }
20337
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.2.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
20342
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.2.5","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
20338
20343
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
20339
20344
  const decimalToHex = (n)=>color_pad(n.toString(16));
20340
20345
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -23763,10 +23768,7 @@
23763
23768
  if (false !== options.dedupe) options.dedupe = true;
23764
23769
  if (this.options.dedupe) this.dedupe();
23765
23770
  }
23766
- async pipe(fn) {
23767
- return fn(this);
23768
- }
23769
- pipeSync(fn) {
23771
+ pipe(fn) {
23770
23772
  return fn(this);
23771
23773
  }
23772
23774
  get shared() {
@@ -24997,14 +24999,20 @@ and limitations under the License.
24997
24999
  "use strict";
24998
25000
  __webpack_require__.r(__webpack_exports__);
24999
25001
  __webpack_require__.d(__webpack_exports__, {
25002
+ bili_dedupe: ()=>dedupe_namespaceObject,
25003
+ bili_history_fast_forward: ()=>bili_history_fast_forward
25004
+ });
25005
+ var dedupe_namespaceObject = {};
25006
+ __webpack_require__.r(dedupe_namespaceObject);
25007
+ __webpack_require__.d(dedupe_namespaceObject, {
25000
25008
  bili_dedupe: ()=>bili_dedupe,
25001
25009
  to_bili_deduped: ()=>to_bili_deduped
25002
25010
  });
25003
- var ___rspack_import_0 = __webpack_require__("./src/index.ts");
25004
- var _utils_platform__rspack_import_1 = __webpack_require__("./src/utils/platform.ts");
25011
+ var src = __webpack_require__("./src/index.ts");
25012
+ var platform = __webpack_require__("./src/utils/platform.ts");
25005
25013
  function main(that) {
25006
25014
  that.dans.forEach((d)=>{
25007
- if (d.platform !== _utils_platform__rspack_import_1.PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
25015
+ if (d.platform !== platform.PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
25008
25016
  if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
25009
25017
  });
25010
25018
  const map = new Map();
@@ -25013,7 +25021,7 @@ and limitations under the License.
25013
25021
  }
25014
25022
  function to_bili_deduped(that) {
25015
25023
  const map = main(that);
25016
- return new ___rspack_import_0.UniPool([
25024
+ return new src.UniPool([
25017
25025
  ...map.values()
25018
25026
  ], that.options, that.info);
25019
25027
  }
@@ -25023,6 +25031,4609 @@ and limitations under the License.
25023
25031
  ...map.values()
25024
25032
  ];
25025
25033
  }
25034
+ class LuxonError extends Error {
25035
+ }
25036
+ class InvalidDateTimeError extends LuxonError {
25037
+ constructor(reason){
25038
+ super(`Invalid DateTime: ${reason.toMessage()}`);
25039
+ }
25040
+ }
25041
+ class InvalidIntervalError extends LuxonError {
25042
+ constructor(reason){
25043
+ super(`Invalid Interval: ${reason.toMessage()}`);
25044
+ }
25045
+ }
25046
+ class InvalidDurationError extends LuxonError {
25047
+ constructor(reason){
25048
+ super(`Invalid Duration: ${reason.toMessage()}`);
25049
+ }
25050
+ }
25051
+ class ConflictingSpecificationError extends LuxonError {
25052
+ }
25053
+ class InvalidUnitError extends LuxonError {
25054
+ constructor(unit){
25055
+ super(`Invalid unit ${unit}`);
25056
+ }
25057
+ }
25058
+ class InvalidArgumentError extends LuxonError {
25059
+ }
25060
+ class ZoneIsAbstractError extends LuxonError {
25061
+ constructor(){
25062
+ super("Zone is an abstract class");
25063
+ }
25064
+ }
25065
+ const luxon_n = "numeric", luxon_s = "short", luxon_l = "long";
25066
+ const DATE_SHORT = {
25067
+ year: luxon_n,
25068
+ month: luxon_n,
25069
+ day: luxon_n
25070
+ };
25071
+ const DATE_MED = {
25072
+ year: luxon_n,
25073
+ month: luxon_s,
25074
+ day: luxon_n
25075
+ };
25076
+ const DATE_MED_WITH_WEEKDAY = {
25077
+ year: luxon_n,
25078
+ month: luxon_s,
25079
+ day: luxon_n,
25080
+ weekday: luxon_s
25081
+ };
25082
+ const DATE_FULL = {
25083
+ year: luxon_n,
25084
+ month: luxon_l,
25085
+ day: luxon_n
25086
+ };
25087
+ const DATE_HUGE = {
25088
+ year: luxon_n,
25089
+ month: luxon_l,
25090
+ day: luxon_n,
25091
+ weekday: luxon_l
25092
+ };
25093
+ const TIME_SIMPLE = {
25094
+ hour: luxon_n,
25095
+ minute: luxon_n
25096
+ };
25097
+ const TIME_WITH_SECONDS = {
25098
+ hour: luxon_n,
25099
+ minute: luxon_n,
25100
+ second: luxon_n
25101
+ };
25102
+ const TIME_WITH_SHORT_OFFSET = {
25103
+ hour: luxon_n,
25104
+ minute: luxon_n,
25105
+ second: luxon_n,
25106
+ timeZoneName: luxon_s
25107
+ };
25108
+ const TIME_WITH_LONG_OFFSET = {
25109
+ hour: luxon_n,
25110
+ minute: luxon_n,
25111
+ second: luxon_n,
25112
+ timeZoneName: luxon_l
25113
+ };
25114
+ const TIME_24_SIMPLE = {
25115
+ hour: luxon_n,
25116
+ minute: luxon_n,
25117
+ hourCycle: "h23"
25118
+ };
25119
+ const TIME_24_WITH_SECONDS = {
25120
+ hour: luxon_n,
25121
+ minute: luxon_n,
25122
+ second: luxon_n,
25123
+ hourCycle: "h23"
25124
+ };
25125
+ const TIME_24_WITH_SHORT_OFFSET = {
25126
+ hour: luxon_n,
25127
+ minute: luxon_n,
25128
+ second: luxon_n,
25129
+ hourCycle: "h23",
25130
+ timeZoneName: luxon_s
25131
+ };
25132
+ const TIME_24_WITH_LONG_OFFSET = {
25133
+ hour: luxon_n,
25134
+ minute: luxon_n,
25135
+ second: luxon_n,
25136
+ hourCycle: "h23",
25137
+ timeZoneName: luxon_l
25138
+ };
25139
+ const DATETIME_SHORT = {
25140
+ year: luxon_n,
25141
+ month: luxon_n,
25142
+ day: luxon_n,
25143
+ hour: luxon_n,
25144
+ minute: luxon_n
25145
+ };
25146
+ const DATETIME_SHORT_WITH_SECONDS = {
25147
+ year: luxon_n,
25148
+ month: luxon_n,
25149
+ day: luxon_n,
25150
+ hour: luxon_n,
25151
+ minute: luxon_n,
25152
+ second: luxon_n
25153
+ };
25154
+ const DATETIME_MED = {
25155
+ year: luxon_n,
25156
+ month: luxon_s,
25157
+ day: luxon_n,
25158
+ hour: luxon_n,
25159
+ minute: luxon_n
25160
+ };
25161
+ const DATETIME_MED_WITH_SECONDS = {
25162
+ year: luxon_n,
25163
+ month: luxon_s,
25164
+ day: luxon_n,
25165
+ hour: luxon_n,
25166
+ minute: luxon_n,
25167
+ second: luxon_n
25168
+ };
25169
+ const DATETIME_MED_WITH_WEEKDAY = {
25170
+ year: luxon_n,
25171
+ month: luxon_s,
25172
+ day: luxon_n,
25173
+ weekday: luxon_s,
25174
+ hour: luxon_n,
25175
+ minute: luxon_n
25176
+ };
25177
+ const DATETIME_FULL = {
25178
+ year: luxon_n,
25179
+ month: luxon_l,
25180
+ day: luxon_n,
25181
+ hour: luxon_n,
25182
+ minute: luxon_n,
25183
+ timeZoneName: luxon_s
25184
+ };
25185
+ const DATETIME_FULL_WITH_SECONDS = {
25186
+ year: luxon_n,
25187
+ month: luxon_l,
25188
+ day: luxon_n,
25189
+ hour: luxon_n,
25190
+ minute: luxon_n,
25191
+ second: luxon_n,
25192
+ timeZoneName: luxon_s
25193
+ };
25194
+ const DATETIME_HUGE = {
25195
+ year: luxon_n,
25196
+ month: luxon_l,
25197
+ day: luxon_n,
25198
+ weekday: luxon_l,
25199
+ hour: luxon_n,
25200
+ minute: luxon_n,
25201
+ timeZoneName: luxon_l
25202
+ };
25203
+ const DATETIME_HUGE_WITH_SECONDS = {
25204
+ year: luxon_n,
25205
+ month: luxon_l,
25206
+ day: luxon_n,
25207
+ weekday: luxon_l,
25208
+ hour: luxon_n,
25209
+ minute: luxon_n,
25210
+ second: luxon_n,
25211
+ timeZoneName: luxon_l
25212
+ };
25213
+ class Zone {
25214
+ get type() {
25215
+ throw new ZoneIsAbstractError();
25216
+ }
25217
+ get name() {
25218
+ throw new ZoneIsAbstractError();
25219
+ }
25220
+ get ianaName() {
25221
+ return this.name;
25222
+ }
25223
+ get isUniversal() {
25224
+ throw new ZoneIsAbstractError();
25225
+ }
25226
+ offsetName(ts, opts) {
25227
+ throw new ZoneIsAbstractError();
25228
+ }
25229
+ formatOffset(ts, format) {
25230
+ throw new ZoneIsAbstractError();
25231
+ }
25232
+ offset(ts) {
25233
+ throw new ZoneIsAbstractError();
25234
+ }
25235
+ equals(otherZone) {
25236
+ throw new ZoneIsAbstractError();
25237
+ }
25238
+ get isValid() {
25239
+ throw new ZoneIsAbstractError();
25240
+ }
25241
+ }
25242
+ let singleton$1 = null;
25243
+ class SystemZone extends Zone {
25244
+ static get instance() {
25245
+ if (null === singleton$1) singleton$1 = new SystemZone();
25246
+ return singleton$1;
25247
+ }
25248
+ get type() {
25249
+ return "system";
25250
+ }
25251
+ get name() {
25252
+ return new Intl.DateTimeFormat().resolvedOptions().timeZone;
25253
+ }
25254
+ get isUniversal() {
25255
+ return false;
25256
+ }
25257
+ offsetName(ts, { format, locale }) {
25258
+ return parseZoneInfo(ts, format, locale);
25259
+ }
25260
+ formatOffset(ts, format) {
25261
+ return luxon_formatOffset(this.offset(ts), format);
25262
+ }
25263
+ offset(ts) {
25264
+ return -new Date(ts).getTimezoneOffset();
25265
+ }
25266
+ equals(otherZone) {
25267
+ return "system" === otherZone.type;
25268
+ }
25269
+ get isValid() {
25270
+ return true;
25271
+ }
25272
+ }
25273
+ const dtfCache = new Map();
25274
+ function makeDTF(zoneName) {
25275
+ let dtf = dtfCache.get(zoneName);
25276
+ if (void 0 === dtf) {
25277
+ dtf = new Intl.DateTimeFormat("en-US", {
25278
+ hour12: false,
25279
+ timeZone: zoneName,
25280
+ year: "numeric",
25281
+ month: "2-digit",
25282
+ day: "2-digit",
25283
+ hour: "2-digit",
25284
+ minute: "2-digit",
25285
+ second: "2-digit",
25286
+ era: "short"
25287
+ });
25288
+ dtfCache.set(zoneName, dtf);
25289
+ }
25290
+ return dtf;
25291
+ }
25292
+ const typeToPos = {
25293
+ year: 0,
25294
+ month: 1,
25295
+ day: 2,
25296
+ era: 3,
25297
+ hour: 4,
25298
+ minute: 5,
25299
+ second: 6
25300
+ };
25301
+ function hackyOffset(dtf, date) {
25302
+ const formatted = dtf.format(date).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
25303
+ return [
25304
+ fYear,
25305
+ fMonth,
25306
+ fDay,
25307
+ fadOrBc,
25308
+ fHour,
25309
+ fMinute,
25310
+ fSecond
25311
+ ];
25312
+ }
25313
+ function partsOffset(dtf, date) {
25314
+ const formatted = dtf.formatToParts(date);
25315
+ const filled = [];
25316
+ for(let i = 0; i < formatted.length; i++){
25317
+ const { type, value } = formatted[i];
25318
+ const pos = typeToPos[type];
25319
+ if ("era" === type) filled[pos] = value;
25320
+ else if (!isUndefined(pos)) filled[pos] = parseInt(value, 10);
25321
+ }
25322
+ return filled;
25323
+ }
25324
+ const ianaZoneCache = new Map();
25325
+ class IANAZone extends Zone {
25326
+ static create(name) {
25327
+ let zone = ianaZoneCache.get(name);
25328
+ if (void 0 === zone) ianaZoneCache.set(name, zone = new IANAZone(name));
25329
+ return zone;
25330
+ }
25331
+ static resetCache() {
25332
+ ianaZoneCache.clear();
25333
+ dtfCache.clear();
25334
+ }
25335
+ static isValidSpecifier(s) {
25336
+ return this.isValidZone(s);
25337
+ }
25338
+ static isValidZone(zone) {
25339
+ if (!zone) return false;
25340
+ try {
25341
+ new Intl.DateTimeFormat("en-US", {
25342
+ timeZone: zone
25343
+ }).format();
25344
+ return true;
25345
+ } catch (e) {
25346
+ return false;
25347
+ }
25348
+ }
25349
+ constructor(name){
25350
+ super();
25351
+ this.zoneName = name;
25352
+ this.valid = IANAZone.isValidZone(name);
25353
+ }
25354
+ get type() {
25355
+ return "iana";
25356
+ }
25357
+ get name() {
25358
+ return this.zoneName;
25359
+ }
25360
+ get isUniversal() {
25361
+ return false;
25362
+ }
25363
+ offsetName(ts, { format, locale }) {
25364
+ return parseZoneInfo(ts, format, locale, this.name);
25365
+ }
25366
+ formatOffset(ts, format) {
25367
+ return luxon_formatOffset(this.offset(ts), format);
25368
+ }
25369
+ offset(ts) {
25370
+ if (!this.valid) return NaN;
25371
+ const date = new Date(ts);
25372
+ if (isNaN(date)) return NaN;
25373
+ const dtf = makeDTF(this.name);
25374
+ let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date);
25375
+ if ("BC" === adOrBc) year = -Math.abs(year) + 1;
25376
+ const adjustedHour = 24 === hour ? 0 : hour;
25377
+ const asUTC = objToLocalTS({
25378
+ year,
25379
+ month,
25380
+ day,
25381
+ hour: adjustedHour,
25382
+ minute,
25383
+ second,
25384
+ millisecond: 0
25385
+ });
25386
+ let asTS = +date;
25387
+ const over = asTS % 1000;
25388
+ asTS -= over >= 0 ? over : 1000 + over;
25389
+ return (asUTC - asTS) / 60000;
25390
+ }
25391
+ equals(otherZone) {
25392
+ return "iana" === otherZone.type && otherZone.name === this.name;
25393
+ }
25394
+ get isValid() {
25395
+ return this.valid;
25396
+ }
25397
+ }
25398
+ let intlLFCache = {};
25399
+ function getCachedLF(locString, opts = {}) {
25400
+ const key = JSON.stringify([
25401
+ locString,
25402
+ opts
25403
+ ]);
25404
+ let dtf = intlLFCache[key];
25405
+ if (!dtf) {
25406
+ dtf = new Intl.ListFormat(locString, opts);
25407
+ intlLFCache[key] = dtf;
25408
+ }
25409
+ return dtf;
25410
+ }
25411
+ const intlDTCache = new Map();
25412
+ function getCachedDTF(locString, opts = {}) {
25413
+ const key = JSON.stringify([
25414
+ locString,
25415
+ opts
25416
+ ]);
25417
+ let dtf = intlDTCache.get(key);
25418
+ if (void 0 === dtf) {
25419
+ dtf = new Intl.DateTimeFormat(locString, opts);
25420
+ intlDTCache.set(key, dtf);
25421
+ }
25422
+ return dtf;
25423
+ }
25424
+ const intlNumCache = new Map();
25425
+ function getCachedINF(locString, opts = {}) {
25426
+ const key = JSON.stringify([
25427
+ locString,
25428
+ opts
25429
+ ]);
25430
+ let inf = intlNumCache.get(key);
25431
+ if (void 0 === inf) {
25432
+ inf = new Intl.NumberFormat(locString, opts);
25433
+ intlNumCache.set(key, inf);
25434
+ }
25435
+ return inf;
25436
+ }
25437
+ const intlRelCache = new Map();
25438
+ function getCachedRTF(locString, opts = {}) {
25439
+ const { base, ...cacheKeyOpts } = opts;
25440
+ const key = JSON.stringify([
25441
+ locString,
25442
+ cacheKeyOpts
25443
+ ]);
25444
+ let inf = intlRelCache.get(key);
25445
+ if (void 0 === inf) {
25446
+ inf = new Intl.RelativeTimeFormat(locString, opts);
25447
+ intlRelCache.set(key, inf);
25448
+ }
25449
+ return inf;
25450
+ }
25451
+ let sysLocaleCache = null;
25452
+ function systemLocale() {
25453
+ if (sysLocaleCache) return sysLocaleCache;
25454
+ sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
25455
+ return sysLocaleCache;
25456
+ }
25457
+ const intlResolvedOptionsCache = new Map();
25458
+ function getCachedIntResolvedOptions(locString) {
25459
+ let opts = intlResolvedOptionsCache.get(locString);
25460
+ if (void 0 === opts) {
25461
+ opts = new Intl.DateTimeFormat(locString).resolvedOptions();
25462
+ intlResolvedOptionsCache.set(locString, opts);
25463
+ }
25464
+ return opts;
25465
+ }
25466
+ const weekInfoCache = new Map();
25467
+ function getCachedWeekInfo(locString) {
25468
+ let data = weekInfoCache.get(locString);
25469
+ if (!data) {
25470
+ const locale = new Intl.Locale(locString);
25471
+ data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
25472
+ if (!("minimalDays" in data)) data = {
25473
+ ...fallbackWeekSettings,
25474
+ ...data
25475
+ };
25476
+ weekInfoCache.set(locString, data);
25477
+ }
25478
+ return data;
25479
+ }
25480
+ function parseLocaleString(localeStr) {
25481
+ const xIndex = localeStr.indexOf("-x-");
25482
+ if (-1 !== xIndex) localeStr = localeStr.substring(0, xIndex);
25483
+ const uIndex = localeStr.indexOf("-u-");
25484
+ if (-1 === uIndex) return [
25485
+ localeStr
25486
+ ];
25487
+ {
25488
+ let options;
25489
+ let selectedStr;
25490
+ try {
25491
+ options = getCachedDTF(localeStr).resolvedOptions();
25492
+ selectedStr = localeStr;
25493
+ } catch (e) {
25494
+ const smaller = localeStr.substring(0, uIndex);
25495
+ options = getCachedDTF(smaller).resolvedOptions();
25496
+ selectedStr = smaller;
25497
+ }
25498
+ const { numberingSystem, calendar } = options;
25499
+ return [
25500
+ selectedStr,
25501
+ numberingSystem,
25502
+ calendar
25503
+ ];
25504
+ }
25505
+ }
25506
+ function intlConfigString(localeStr, numberingSystem, outputCalendar) {
25507
+ if (!outputCalendar && !numberingSystem) return localeStr;
25508
+ if (!localeStr.includes("-u-")) localeStr += "-u";
25509
+ if (outputCalendar) localeStr += `-ca-${outputCalendar}`;
25510
+ if (numberingSystem) localeStr += `-nu-${numberingSystem}`;
25511
+ return localeStr;
25512
+ }
25513
+ function mapMonths(f) {
25514
+ const ms = [];
25515
+ for(let i = 1; i <= 12; i++){
25516
+ const dt = DateTime.utc(2009, i, 1);
25517
+ ms.push(f(dt));
25518
+ }
25519
+ return ms;
25520
+ }
25521
+ function mapWeekdays(f) {
25522
+ const ms = [];
25523
+ for(let i = 1; i <= 7; i++){
25524
+ const dt = DateTime.utc(2016, 11, 13 + i);
25525
+ ms.push(f(dt));
25526
+ }
25527
+ return ms;
25528
+ }
25529
+ function listStuff(loc, length, englishFn, intlFn) {
25530
+ const mode = loc.listingMode();
25531
+ if ("error" === mode) return null;
25532
+ if ("en" === mode) return englishFn(length);
25533
+ return intlFn(length);
25534
+ }
25535
+ function supportsFastNumbers(loc) {
25536
+ if (loc.numberingSystem && "latn" !== loc.numberingSystem) return false;
25537
+ return "latn" === loc.numberingSystem || !loc.locale || loc.locale.startsWith("en") || "latn" === getCachedIntResolvedOptions(loc.locale).numberingSystem;
25538
+ }
25539
+ class PolyNumberFormatter {
25540
+ constructor(intl, forceSimple, opts){
25541
+ this.padTo = opts.padTo || 0;
25542
+ this.floor = opts.floor || false;
25543
+ const { padTo, floor, ...otherOpts } = opts;
25544
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
25545
+ const intlOpts = {
25546
+ useGrouping: false,
25547
+ ...opts
25548
+ };
25549
+ if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
25550
+ this.inf = getCachedINF(intl, intlOpts);
25551
+ }
25552
+ }
25553
+ format(i) {
25554
+ if (this.inf) {
25555
+ const fixed = this.floor ? Math.floor(i) : i;
25556
+ return this.inf.format(fixed);
25557
+ }
25558
+ {
25559
+ const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);
25560
+ return padStart(fixed, this.padTo);
25561
+ }
25562
+ }
25563
+ }
25564
+ class PolyDateFormatter {
25565
+ constructor(dt, intl, opts){
25566
+ this.opts = opts;
25567
+ this.originalZone = void 0;
25568
+ let z;
25569
+ if (this.opts.timeZone) this.dt = dt;
25570
+ else if ("fixed" === dt.zone.type) {
25571
+ const gmtOffset = -1 * (dt.offset / 60);
25572
+ const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
25573
+ if (0 !== dt.offset && IANAZone.create(offsetZ).valid) {
25574
+ z = offsetZ;
25575
+ this.dt = dt;
25576
+ } else {
25577
+ z = "UTC";
25578
+ this.dt = 0 === dt.offset ? dt : dt.setZone("UTC").plus({
25579
+ minutes: dt.offset
25580
+ });
25581
+ this.originalZone = dt.zone;
25582
+ }
25583
+ } else if ("system" === dt.zone.type) this.dt = dt;
25584
+ else if ("iana" === dt.zone.type) {
25585
+ this.dt = dt;
25586
+ z = dt.zone.name;
25587
+ } else {
25588
+ z = "UTC";
25589
+ this.dt = dt.setZone("UTC").plus({
25590
+ minutes: dt.offset
25591
+ });
25592
+ this.originalZone = dt.zone;
25593
+ }
25594
+ const intlOpts = {
25595
+ ...this.opts
25596
+ };
25597
+ intlOpts.timeZone = intlOpts.timeZone || z;
25598
+ this.dtf = getCachedDTF(intl, intlOpts);
25599
+ }
25600
+ format() {
25601
+ if (this.originalZone) return this.formatToParts().map(({ value })=>value).join("");
25602
+ return this.dtf.format(this.dt.toJSDate());
25603
+ }
25604
+ formatToParts() {
25605
+ const parts = this.dtf.formatToParts(this.dt.toJSDate());
25606
+ if (this.originalZone) return parts.map((part)=>{
25607
+ if ("timeZoneName" !== part.type) return part;
25608
+ {
25609
+ const offsetName = this.originalZone.offsetName(this.dt.ts, {
25610
+ locale: this.dt.locale,
25611
+ format: this.opts.timeZoneName
25612
+ });
25613
+ return {
25614
+ ...part,
25615
+ value: offsetName
25616
+ };
25617
+ }
25618
+ });
25619
+ return parts;
25620
+ }
25621
+ resolvedOptions() {
25622
+ return this.dtf.resolvedOptions();
25623
+ }
25624
+ }
25625
+ class PolyRelFormatter {
25626
+ constructor(intl, isEnglish, opts){
25627
+ this.opts = {
25628
+ style: "long",
25629
+ ...opts
25630
+ };
25631
+ if (!isEnglish && hasRelative()) this.rtf = getCachedRTF(intl, opts);
25632
+ }
25633
+ format(count, unit) {
25634
+ if (this.rtf) return this.rtf.format(count, unit);
25635
+ return formatRelativeTime(unit, count, this.opts.numeric, "long" !== this.opts.style);
25636
+ }
25637
+ formatToParts(count, unit) {
25638
+ if (this.rtf) return this.rtf.formatToParts(count, unit);
25639
+ return [];
25640
+ }
25641
+ }
25642
+ const fallbackWeekSettings = {
25643
+ firstDay: 1,
25644
+ minimalDays: 4,
25645
+ weekend: [
25646
+ 6,
25647
+ 7
25648
+ ]
25649
+ };
25650
+ class Locale {
25651
+ static fromOpts(opts) {
25652
+ return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
25653
+ }
25654
+ static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
25655
+ const specifiedLocale = locale || Settings.defaultLocale;
25656
+ const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
25657
+ const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
25658
+ const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
25659
+ const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
25660
+ return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
25661
+ }
25662
+ static resetCache() {
25663
+ sysLocaleCache = null;
25664
+ intlDTCache.clear();
25665
+ intlNumCache.clear();
25666
+ intlRelCache.clear();
25667
+ intlResolvedOptionsCache.clear();
25668
+ weekInfoCache.clear();
25669
+ }
25670
+ static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {
25671
+ return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
25672
+ }
25673
+ constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale){
25674
+ const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
25675
+ this.locale = parsedLocale;
25676
+ this.numberingSystem = numbering || parsedNumberingSystem || null;
25677
+ this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
25678
+ this.weekSettings = weekSettings;
25679
+ this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
25680
+ this.weekdaysCache = {
25681
+ format: {},
25682
+ standalone: {}
25683
+ };
25684
+ this.monthsCache = {
25685
+ format: {},
25686
+ standalone: {}
25687
+ };
25688
+ this.meridiemCache = null;
25689
+ this.eraCache = {};
25690
+ this.specifiedLocale = specifiedLocale;
25691
+ this.fastNumbersCached = null;
25692
+ }
25693
+ get fastNumbers() {
25694
+ if (null == this.fastNumbersCached) this.fastNumbersCached = supportsFastNumbers(this);
25695
+ return this.fastNumbersCached;
25696
+ }
25697
+ listingMode() {
25698
+ const isActuallyEn = this.isEnglish();
25699
+ const hasNoWeirdness = (null === this.numberingSystem || "latn" === this.numberingSystem) && (null === this.outputCalendar || "gregory" === this.outputCalendar);
25700
+ return isActuallyEn && hasNoWeirdness ? "en" : "intl";
25701
+ }
25702
+ clone(alts) {
25703
+ if (!alts || 0 === Object.getOwnPropertyNames(alts).length) return this;
25704
+ return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
25705
+ }
25706
+ redefaultToEN(alts = {}) {
25707
+ return this.clone({
25708
+ ...alts,
25709
+ defaultToEN: true
25710
+ });
25711
+ }
25712
+ redefaultToSystem(alts = {}) {
25713
+ return this.clone({
25714
+ ...alts,
25715
+ defaultToEN: false
25716
+ });
25717
+ }
25718
+ months(length, format = false) {
25719
+ return listStuff(this, length, months, ()=>{
25720
+ const monthSpecialCase = "ja" === this.intl || this.intl.startsWith("ja-");
25721
+ format &= !monthSpecialCase;
25722
+ const intl = format ? {
25723
+ month: length,
25724
+ day: "numeric"
25725
+ } : {
25726
+ month: length
25727
+ }, formatStr = format ? "format" : "standalone";
25728
+ if (!this.monthsCache[formatStr][length]) {
25729
+ const mapper = monthSpecialCase ? (dt)=>this.dtFormatter(dt, intl).format() : (dt)=>this.extract(dt, intl, "month");
25730
+ this.monthsCache[formatStr][length] = mapMonths(mapper);
25731
+ }
25732
+ return this.monthsCache[formatStr][length];
25733
+ });
25734
+ }
25735
+ weekdays(length, format = false) {
25736
+ return listStuff(this, length, weekdays, ()=>{
25737
+ const intl = format ? {
25738
+ weekday: length,
25739
+ year: "numeric",
25740
+ month: "long",
25741
+ day: "numeric"
25742
+ } : {
25743
+ weekday: length
25744
+ }, formatStr = format ? "format" : "standalone";
25745
+ if (!this.weekdaysCache[formatStr][length]) this.weekdaysCache[formatStr][length] = mapWeekdays((dt)=>this.extract(dt, intl, "weekday"));
25746
+ return this.weekdaysCache[formatStr][length];
25747
+ });
25748
+ }
25749
+ meridiems() {
25750
+ return listStuff(this, void 0, ()=>meridiems, ()=>{
25751
+ if (!this.meridiemCache) {
25752
+ const intl = {
25753
+ hour: "numeric",
25754
+ hourCycle: "h12"
25755
+ };
25756
+ this.meridiemCache = [
25757
+ DateTime.utc(2016, 11, 13, 9),
25758
+ DateTime.utc(2016, 11, 13, 19)
25759
+ ].map((dt)=>this.extract(dt, intl, "dayperiod"));
25760
+ }
25761
+ return this.meridiemCache;
25762
+ });
25763
+ }
25764
+ eras(length) {
25765
+ return listStuff(this, length, eras, ()=>{
25766
+ const intl = {
25767
+ era: length
25768
+ };
25769
+ if (!this.eraCache[length]) this.eraCache[length] = [
25770
+ DateTime.utc(-40, 1, 1),
25771
+ DateTime.utc(2017, 1, 1)
25772
+ ].map((dt)=>this.extract(dt, intl, "era"));
25773
+ return this.eraCache[length];
25774
+ });
25775
+ }
25776
+ extract(dt, intlOpts, field) {
25777
+ const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m)=>m.type.toLowerCase() === field);
25778
+ return matching ? matching.value : null;
25779
+ }
25780
+ numberFormatter(opts = {}) {
25781
+ return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);
25782
+ }
25783
+ dtFormatter(dt, intlOpts = {}) {
25784
+ return new PolyDateFormatter(dt, this.intl, intlOpts);
25785
+ }
25786
+ relFormatter(opts = {}) {
25787
+ return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
25788
+ }
25789
+ listFormatter(opts = {}) {
25790
+ return getCachedLF(this.intl, opts);
25791
+ }
25792
+ isEnglish() {
25793
+ return "en" === this.locale || "en-us" === this.locale.toLowerCase() || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us");
25794
+ }
25795
+ getWeekSettings() {
25796
+ if (this.weekSettings) return this.weekSettings;
25797
+ if (!hasLocaleWeekInfo()) return fallbackWeekSettings;
25798
+ return getCachedWeekInfo(this.locale);
25799
+ }
25800
+ getStartOfWeek() {
25801
+ return this.getWeekSettings().firstDay;
25802
+ }
25803
+ getMinDaysInFirstWeek() {
25804
+ return this.getWeekSettings().minimalDays;
25805
+ }
25806
+ getWeekendDays() {
25807
+ return this.getWeekSettings().weekend;
25808
+ }
25809
+ equals(other) {
25810
+ return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
25811
+ }
25812
+ toString() {
25813
+ return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
25814
+ }
25815
+ }
25816
+ let singleton = null;
25817
+ class FixedOffsetZone extends Zone {
25818
+ static get utcInstance() {
25819
+ if (null === singleton) singleton = new FixedOffsetZone(0);
25820
+ return singleton;
25821
+ }
25822
+ static instance(offset) {
25823
+ return 0 === offset ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
25824
+ }
25825
+ static parseSpecifier(s) {
25826
+ if (s) {
25827
+ const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
25828
+ if (r) return new FixedOffsetZone(signedOffset(r[1], r[2]));
25829
+ }
25830
+ return null;
25831
+ }
25832
+ constructor(offset){
25833
+ super();
25834
+ this.fixed = offset;
25835
+ }
25836
+ get type() {
25837
+ return "fixed";
25838
+ }
25839
+ get name() {
25840
+ return 0 === this.fixed ? "UTC" : `UTC${luxon_formatOffset(this.fixed, "narrow")}`;
25841
+ }
25842
+ get ianaName() {
25843
+ if (0 === this.fixed) return "Etc/UTC";
25844
+ return `Etc/GMT${luxon_formatOffset(-this.fixed, "narrow")}`;
25845
+ }
25846
+ offsetName() {
25847
+ return this.name;
25848
+ }
25849
+ formatOffset(ts, format) {
25850
+ return luxon_formatOffset(this.fixed, format);
25851
+ }
25852
+ get isUniversal() {
25853
+ return true;
25854
+ }
25855
+ offset() {
25856
+ return this.fixed;
25857
+ }
25858
+ equals(otherZone) {
25859
+ return "fixed" === otherZone.type && otherZone.fixed === this.fixed;
25860
+ }
25861
+ get isValid() {
25862
+ return true;
25863
+ }
25864
+ }
25865
+ class InvalidZone extends Zone {
25866
+ constructor(zoneName){
25867
+ super();
25868
+ this.zoneName = zoneName;
25869
+ }
25870
+ get type() {
25871
+ return "invalid";
25872
+ }
25873
+ get name() {
25874
+ return this.zoneName;
25875
+ }
25876
+ get isUniversal() {
25877
+ return false;
25878
+ }
25879
+ offsetName() {
25880
+ return null;
25881
+ }
25882
+ formatOffset() {
25883
+ return "";
25884
+ }
25885
+ offset() {
25886
+ return NaN;
25887
+ }
25888
+ equals() {
25889
+ return false;
25890
+ }
25891
+ get isValid() {
25892
+ return false;
25893
+ }
25894
+ }
25895
+ function normalizeZone(input, defaultZone) {
25896
+ if (isUndefined(input) || null === input) return defaultZone;
25897
+ if (input instanceof Zone) return input;
25898
+ if (isString(input)) {
25899
+ const lowered = input.toLowerCase();
25900
+ if ("default" === lowered) return defaultZone;
25901
+ if ("local" === lowered || "system" === lowered) return SystemZone.instance;
25902
+ if ("utc" === lowered || "gmt" === lowered) return FixedOffsetZone.utcInstance;
25903
+ else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
25904
+ }
25905
+ if (isNumber(input)) return FixedOffsetZone.instance(input);
25906
+ if ("object" == typeof input && "offset" in input && "function" == typeof input.offset) return input;
25907
+ else return new InvalidZone(input);
25908
+ }
25909
+ const numberingSystems = {
25910
+ arab: "[\u0660-\u0669]",
25911
+ arabext: "[\u06F0-\u06F9]",
25912
+ bali: "[\u1B50-\u1B59]",
25913
+ beng: "[\u09E6-\u09EF]",
25914
+ deva: "[\u0966-\u096F]",
25915
+ fullwide: "[\uFF10-\uFF19]",
25916
+ gujr: "[\u0AE6-\u0AEF]",
25917
+ hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
25918
+ khmr: "[\u17E0-\u17E9]",
25919
+ knda: "[\u0CE6-\u0CEF]",
25920
+ laoo: "[\u0ED0-\u0ED9]",
25921
+ limb: "[\u1946-\u194F]",
25922
+ mlym: "[\u0D66-\u0D6F]",
25923
+ mong: "[\u1810-\u1819]",
25924
+ mymr: "[\u1040-\u1049]",
25925
+ orya: "[\u0B66-\u0B6F]",
25926
+ tamldec: "[\u0BE6-\u0BEF]",
25927
+ telu: "[\u0C66-\u0C6F]",
25928
+ thai: "[\u0E50-\u0E59]",
25929
+ tibt: "[\u0F20-\u0F29]",
25930
+ latn: "\\d"
25931
+ };
25932
+ const numberingSystemsUTF16 = {
25933
+ arab: [
25934
+ 1632,
25935
+ 1641
25936
+ ],
25937
+ arabext: [
25938
+ 1776,
25939
+ 1785
25940
+ ],
25941
+ bali: [
25942
+ 6992,
25943
+ 7001
25944
+ ],
25945
+ beng: [
25946
+ 2534,
25947
+ 2543
25948
+ ],
25949
+ deva: [
25950
+ 2406,
25951
+ 2415
25952
+ ],
25953
+ fullwide: [
25954
+ 65296,
25955
+ 65303
25956
+ ],
25957
+ gujr: [
25958
+ 2790,
25959
+ 2799
25960
+ ],
25961
+ khmr: [
25962
+ 6112,
25963
+ 6121
25964
+ ],
25965
+ knda: [
25966
+ 3302,
25967
+ 3311
25968
+ ],
25969
+ laoo: [
25970
+ 3792,
25971
+ 3801
25972
+ ],
25973
+ limb: [
25974
+ 6470,
25975
+ 6479
25976
+ ],
25977
+ mlym: [
25978
+ 3430,
25979
+ 3439
25980
+ ],
25981
+ mong: [
25982
+ 6160,
25983
+ 6169
25984
+ ],
25985
+ mymr: [
25986
+ 4160,
25987
+ 4169
25988
+ ],
25989
+ orya: [
25990
+ 2918,
25991
+ 2927
25992
+ ],
25993
+ tamldec: [
25994
+ 3046,
25995
+ 3055
25996
+ ],
25997
+ telu: [
25998
+ 3174,
25999
+ 3183
26000
+ ],
26001
+ thai: [
26002
+ 3664,
26003
+ 3673
26004
+ ],
26005
+ tibt: [
26006
+ 3872,
26007
+ 3881
26008
+ ]
26009
+ };
26010
+ const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
26011
+ function parseDigits(str) {
26012
+ let value = parseInt(str, 10);
26013
+ if (!isNaN(value)) return value;
26014
+ value = "";
26015
+ for(let i = 0; i < str.length; i++){
26016
+ const code = str.charCodeAt(i);
26017
+ if (-1 !== str[i].search(numberingSystems.hanidec)) value += hanidecChars.indexOf(str[i]);
26018
+ else for(const key in numberingSystemsUTF16){
26019
+ const [min, max] = numberingSystemsUTF16[key];
26020
+ if (code >= min && code <= max) value += code - min;
26021
+ }
26022
+ }
26023
+ return parseInt(value, 10);
26024
+ }
26025
+ const digitRegexCache = new Map();
26026
+ function resetDigitRegexCache() {
26027
+ digitRegexCache.clear();
26028
+ }
26029
+ function digitRegex({ numberingSystem }, append = "") {
26030
+ const ns = numberingSystem || "latn";
26031
+ let appendCache = digitRegexCache.get(ns);
26032
+ if (void 0 === appendCache) {
26033
+ appendCache = new Map();
26034
+ digitRegexCache.set(ns, appendCache);
26035
+ }
26036
+ let regex = appendCache.get(append);
26037
+ if (void 0 === regex) {
26038
+ regex = new RegExp(`${numberingSystems[ns]}${append}`);
26039
+ appendCache.set(append, regex);
26040
+ }
26041
+ return regex;
26042
+ }
26043
+ let now = ()=>Date.now(), luxon_defaultZone = "system", defaultLocale = null, defaultNumberingSystem = null, defaultOutputCalendar = null, twoDigitCutoffYear = 60, throwOnInvalid, defaultWeekSettings = null;
26044
+ class Settings {
26045
+ static get now() {
26046
+ return now;
26047
+ }
26048
+ static set now(n) {
26049
+ now = n;
26050
+ }
26051
+ static set defaultZone(zone) {
26052
+ luxon_defaultZone = zone;
26053
+ }
26054
+ static get defaultZone() {
26055
+ return normalizeZone(luxon_defaultZone, SystemZone.instance);
26056
+ }
26057
+ static get defaultLocale() {
26058
+ return defaultLocale;
26059
+ }
26060
+ static set defaultLocale(locale) {
26061
+ defaultLocale = locale;
26062
+ }
26063
+ static get defaultNumberingSystem() {
26064
+ return defaultNumberingSystem;
26065
+ }
26066
+ static set defaultNumberingSystem(numberingSystem) {
26067
+ defaultNumberingSystem = numberingSystem;
26068
+ }
26069
+ static get defaultOutputCalendar() {
26070
+ return defaultOutputCalendar;
26071
+ }
26072
+ static set defaultOutputCalendar(outputCalendar) {
26073
+ defaultOutputCalendar = outputCalendar;
26074
+ }
26075
+ static get defaultWeekSettings() {
26076
+ return defaultWeekSettings;
26077
+ }
26078
+ static set defaultWeekSettings(weekSettings) {
26079
+ defaultWeekSettings = validateWeekSettings(weekSettings);
26080
+ }
26081
+ static get twoDigitCutoffYear() {
26082
+ return twoDigitCutoffYear;
26083
+ }
26084
+ static set twoDigitCutoffYear(cutoffYear) {
26085
+ twoDigitCutoffYear = cutoffYear % 100;
26086
+ }
26087
+ static get throwOnInvalid() {
26088
+ return throwOnInvalid;
26089
+ }
26090
+ static set throwOnInvalid(t) {
26091
+ throwOnInvalid = t;
26092
+ }
26093
+ static resetCaches() {
26094
+ Locale.resetCache();
26095
+ IANAZone.resetCache();
26096
+ DateTime.resetCache();
26097
+ resetDigitRegexCache();
26098
+ }
26099
+ }
26100
+ class Invalid {
26101
+ constructor(reason, explanation){
26102
+ this.reason = reason;
26103
+ this.explanation = explanation;
26104
+ }
26105
+ toMessage() {
26106
+ if (this.explanation) return `${this.reason}: ${this.explanation}`;
26107
+ return this.reason;
26108
+ }
26109
+ }
26110
+ const nonLeapLadder = [
26111
+ 0,
26112
+ 31,
26113
+ 59,
26114
+ 90,
26115
+ 120,
26116
+ 151,
26117
+ 181,
26118
+ 212,
26119
+ 243,
26120
+ 273,
26121
+ 304,
26122
+ 334
26123
+ ], leapLadder = [
26124
+ 0,
26125
+ 31,
26126
+ 60,
26127
+ 91,
26128
+ 121,
26129
+ 152,
26130
+ 182,
26131
+ 213,
26132
+ 244,
26133
+ 274,
26134
+ 305,
26135
+ 335
26136
+ ];
26137
+ function unitOutOfRange(unit, value) {
26138
+ return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
26139
+ }
26140
+ function dayOfWeek(year, month, day) {
26141
+ const d = new Date(Date.UTC(year, month - 1, day));
26142
+ if (year < 100 && year >= 0) d.setUTCFullYear(d.getUTCFullYear() - 1900);
26143
+ const js = d.getUTCDay();
26144
+ return 0 === js ? 7 : js;
26145
+ }
26146
+ function computeOrdinal(year, month, day) {
26147
+ return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
26148
+ }
26149
+ function uncomputeOrdinal(year, ordinal) {
26150
+ const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i)=>i < ordinal), day = ordinal - table[month0];
26151
+ return {
26152
+ month: month0 + 1,
26153
+ day
26154
+ };
26155
+ }
26156
+ function isoWeekdayToLocal(isoWeekday, startOfWeek) {
26157
+ return (isoWeekday - startOfWeek + 7) % 7 + 1;
26158
+ }
26159
+ function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
26160
+ const { year, month, day } = gregObj, ordinal = computeOrdinal(year, month, day), weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
26161
+ let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), weekYear;
26162
+ if (weekNumber < 1) {
26163
+ weekYear = year - 1;
26164
+ weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
26165
+ } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
26166
+ weekYear = year + 1;
26167
+ weekNumber = 1;
26168
+ } else weekYear = year;
26169
+ return {
26170
+ weekYear,
26171
+ weekNumber,
26172
+ weekday,
26173
+ ...timeObject(gregObj)
26174
+ };
26175
+ }
26176
+ function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
26177
+ const { weekYear, weekNumber, weekday } = weekData, weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), yearInDays = daysInYear(weekYear);
26178
+ let ordinal = 7 * weekNumber + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, year;
26179
+ if (ordinal < 1) {
26180
+ year = weekYear - 1;
26181
+ ordinal += daysInYear(year);
26182
+ } else if (ordinal > yearInDays) {
26183
+ year = weekYear + 1;
26184
+ ordinal -= daysInYear(weekYear);
26185
+ } else year = weekYear;
26186
+ const { month, day } = uncomputeOrdinal(year, ordinal);
26187
+ return {
26188
+ year,
26189
+ month,
26190
+ day,
26191
+ ...timeObject(weekData)
26192
+ };
26193
+ }
26194
+ function gregorianToOrdinal(gregData) {
26195
+ const { year, month, day } = gregData;
26196
+ const ordinal = computeOrdinal(year, month, day);
26197
+ return {
26198
+ year,
26199
+ ordinal,
26200
+ ...timeObject(gregData)
26201
+ };
26202
+ }
26203
+ function ordinalToGregorian(ordinalData) {
26204
+ const { year, ordinal } = ordinalData;
26205
+ const { month, day } = uncomputeOrdinal(year, ordinal);
26206
+ return {
26207
+ year,
26208
+ month,
26209
+ day,
26210
+ ...timeObject(ordinalData)
26211
+ };
26212
+ }
26213
+ function usesLocalWeekValues(obj, loc) {
26214
+ const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
26215
+ if (!hasLocaleWeekData) return {
26216
+ minDaysInFirstWeek: 4,
26217
+ startOfWeek: 1
26218
+ };
26219
+ {
26220
+ const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
26221
+ if (hasIsoWeekData) throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
26222
+ if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
26223
+ if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
26224
+ if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
26225
+ delete obj.localWeekday;
26226
+ delete obj.localWeekNumber;
26227
+ delete obj.localWeekYear;
26228
+ return {
26229
+ minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
26230
+ startOfWeek: loc.getStartOfWeek()
26231
+ };
26232
+ }
26233
+ }
26234
+ function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
26235
+ const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), validWeekday = integerBetween(obj.weekday, 1, 7);
26236
+ if (!validYear) return unitOutOfRange("weekYear", obj.weekYear);
26237
+ if (!validWeek) return unitOutOfRange("week", obj.weekNumber);
26238
+ if (!validWeekday) return unitOutOfRange("weekday", obj.weekday);
26239
+ return false;
26240
+ }
26241
+ function hasInvalidOrdinalData(obj) {
26242
+ const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
26243
+ if (!validYear) return unitOutOfRange("year", obj.year);
26244
+ if (!validOrdinal) return unitOutOfRange("ordinal", obj.ordinal);
26245
+ return false;
26246
+ }
26247
+ function hasInvalidGregorianData(obj) {
26248
+ const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
26249
+ if (!validYear) return unitOutOfRange("year", obj.year);
26250
+ if (!validMonth) return unitOutOfRange("month", obj.month);
26251
+ if (!validDay) return unitOutOfRange("day", obj.day);
26252
+ return false;
26253
+ }
26254
+ function hasInvalidTimeData(obj) {
26255
+ const { hour, minute, second, millisecond } = obj;
26256
+ const validHour = integerBetween(hour, 0, 23) || 24 === hour && 0 === minute && 0 === second && 0 === millisecond, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999);
26257
+ if (!validHour) return unitOutOfRange("hour", hour);
26258
+ if (!validMinute) return unitOutOfRange("minute", minute);
26259
+ if (!validSecond) return unitOutOfRange("second", second);
26260
+ if (!validMillisecond) return unitOutOfRange("millisecond", millisecond);
26261
+ return false;
26262
+ }
26263
+ function isUndefined(o) {
26264
+ return void 0 === o;
26265
+ }
26266
+ function isNumber(o) {
26267
+ return "number" == typeof o;
26268
+ }
26269
+ function isInteger(o) {
26270
+ return "number" == typeof o && o % 1 === 0;
26271
+ }
26272
+ function isString(o) {
26273
+ return "string" == typeof o;
26274
+ }
26275
+ function isDate(o) {
26276
+ return "[object Date]" === Object.prototype.toString.call(o);
26277
+ }
26278
+ function hasRelative() {
26279
+ try {
26280
+ return "u" > typeof Intl && !!Intl.RelativeTimeFormat;
26281
+ } catch (e) {
26282
+ return false;
26283
+ }
26284
+ }
26285
+ function hasLocaleWeekInfo() {
26286
+ try {
26287
+ return "u" > typeof Intl && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
26288
+ } catch (e) {
26289
+ return false;
26290
+ }
26291
+ }
26292
+ function maybeArray(thing) {
26293
+ return Array.isArray(thing) ? thing : [
26294
+ thing
26295
+ ];
26296
+ }
26297
+ function bestBy(arr, by, compare) {
26298
+ if (0 === arr.length) return;
26299
+ return arr.reduce((best, next)=>{
26300
+ const pair = [
26301
+ by(next),
26302
+ next
26303
+ ];
26304
+ if (!best) return pair;
26305
+ if (compare(best[0], pair[0]) === best[0]) return best;
26306
+ return pair;
26307
+ }, null)[1];
26308
+ }
26309
+ function pick(obj, keys) {
26310
+ return keys.reduce((a, k)=>{
26311
+ a[k] = obj[k];
26312
+ return a;
26313
+ }, {});
26314
+ }
26315
+ function luxon_hasOwnProperty(obj, prop) {
26316
+ return Object.prototype.hasOwnProperty.call(obj, prop);
26317
+ }
26318
+ function validateWeekSettings(settings) {
26319
+ if (null == settings) return null;
26320
+ if ("object" != typeof settings) throw new InvalidArgumentError("Week settings must be an object");
26321
+ if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some((v)=>!integerBetween(v, 1, 7))) throw new InvalidArgumentError("Invalid week settings");
26322
+ return {
26323
+ firstDay: settings.firstDay,
26324
+ minimalDays: settings.minimalDays,
26325
+ weekend: Array.from(settings.weekend)
26326
+ };
26327
+ }
26328
+ function integerBetween(thing, bottom, top) {
26329
+ return isInteger(thing) && thing >= bottom && thing <= top;
26330
+ }
26331
+ function floorMod(x, n) {
26332
+ return x - n * Math.floor(x / n);
26333
+ }
26334
+ function padStart(input, n = 2) {
26335
+ const isNeg = input < 0;
26336
+ let padded;
26337
+ padded = isNeg ? "-" + ("" + -input).padStart(n, "0") : ("" + input).padStart(n, "0");
26338
+ return padded;
26339
+ }
26340
+ function parseInteger(string) {
26341
+ if (isUndefined(string) || null === string || "" === string) return;
26342
+ return parseInt(string, 10);
26343
+ }
26344
+ function parseFloating(string) {
26345
+ if (isUndefined(string) || null === string || "" === string) return;
26346
+ return parseFloat(string);
26347
+ }
26348
+ function parseMillis(fraction) {
26349
+ if (isUndefined(fraction) || null === fraction || "" === fraction) return;
26350
+ {
26351
+ const f = 1000 * parseFloat("0." + fraction);
26352
+ return Math.floor(f);
26353
+ }
26354
+ }
26355
+ function roundTo(number, digits, rounding = "round") {
26356
+ const factor = 10 ** digits;
26357
+ switch(rounding){
26358
+ case "expand":
26359
+ return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor;
26360
+ case "trunc":
26361
+ return Math.trunc(number * factor) / factor;
26362
+ case "round":
26363
+ return Math.round(number * factor) / factor;
26364
+ case "floor":
26365
+ return Math.floor(number * factor) / factor;
26366
+ case "ceil":
26367
+ return Math.ceil(number * factor) / factor;
26368
+ default:
26369
+ throw new RangeError(`Value rounding ${rounding} is out of range`);
26370
+ }
26371
+ }
26372
+ function isLeapYear(year) {
26373
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
26374
+ }
26375
+ function daysInYear(year) {
26376
+ return isLeapYear(year) ? 366 : 365;
26377
+ }
26378
+ function daysInMonth(year, month) {
26379
+ const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12;
26380
+ if (2 === modMonth) return isLeapYear(modYear) ? 29 : 28;
26381
+ return [
26382
+ 31,
26383
+ null,
26384
+ 31,
26385
+ 30,
26386
+ 31,
26387
+ 30,
26388
+ 31,
26389
+ 31,
26390
+ 30,
26391
+ 31,
26392
+ 30,
26393
+ 31
26394
+ ][modMonth - 1];
26395
+ }
26396
+ function objToLocalTS(obj) {
26397
+ let d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
26398
+ if (obj.year < 100 && obj.year >= 0) {
26399
+ d = new Date(d);
26400
+ d.setUTCFullYear(obj.year, obj.month - 1, obj.day);
26401
+ }
26402
+ return +d;
26403
+ }
26404
+ function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
26405
+ const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
26406
+ return -fwdlw + minDaysInFirstWeek - 1;
26407
+ }
26408
+ function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {
26409
+ const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
26410
+ const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
26411
+ return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
26412
+ }
26413
+ function untruncateYear(year) {
26414
+ if (year > 99) return year;
26415
+ return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;
26416
+ }
26417
+ function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {
26418
+ const date = new Date(ts), intlOpts = {
26419
+ hourCycle: "h23",
26420
+ year: "numeric",
26421
+ month: "2-digit",
26422
+ day: "2-digit",
26423
+ hour: "2-digit",
26424
+ minute: "2-digit"
26425
+ };
26426
+ if (timeZone) intlOpts.timeZone = timeZone;
26427
+ const modified = {
26428
+ timeZoneName: offsetFormat,
26429
+ ...intlOpts
26430
+ };
26431
+ const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find((m)=>"timezonename" === m.type.toLowerCase());
26432
+ return parsed ? parsed.value : null;
26433
+ }
26434
+ function signedOffset(offHourStr, offMinuteStr) {
26435
+ let offHour = parseInt(offHourStr, 10);
26436
+ if (Number.isNaN(offHour)) offHour = 0;
26437
+ const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;
26438
+ return 60 * offHour + offMinSigned;
26439
+ }
26440
+ function asNumber(value) {
26441
+ const numericValue = Number(value);
26442
+ if ("boolean" == typeof value || "" === value || !Number.isFinite(numericValue)) throw new InvalidArgumentError(`Invalid unit value ${value}`);
26443
+ return numericValue;
26444
+ }
26445
+ function normalizeObject(obj, normalizer) {
26446
+ const normalized = {};
26447
+ for(const u in obj)if (luxon_hasOwnProperty(obj, u)) {
26448
+ const v = obj[u];
26449
+ if (null == v) continue;
26450
+ normalized[normalizer(u)] = asNumber(v);
26451
+ }
26452
+ return normalized;
26453
+ }
26454
+ function luxon_formatOffset(offset, format) {
26455
+ const hours = Math.trunc(Math.abs(offset / 60)), minutes = Math.trunc(Math.abs(offset % 60)), sign = offset >= 0 ? "+" : "-";
26456
+ switch(format){
26457
+ case "short":
26458
+ return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;
26459
+ case "narrow":
26460
+ return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`;
26461
+ case "techie":
26462
+ return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;
26463
+ default:
26464
+ throw new RangeError(`Value format ${format} is out of range for property format`);
26465
+ }
26466
+ }
26467
+ function timeObject(obj) {
26468
+ return pick(obj, [
26469
+ "hour",
26470
+ "minute",
26471
+ "second",
26472
+ "millisecond"
26473
+ ]);
26474
+ }
26475
+ const monthsLong = [
26476
+ "January",
26477
+ "February",
26478
+ "March",
26479
+ "April",
26480
+ "May",
26481
+ "June",
26482
+ "July",
26483
+ "August",
26484
+ "September",
26485
+ "October",
26486
+ "November",
26487
+ "December"
26488
+ ];
26489
+ const monthsShort = [
26490
+ "Jan",
26491
+ "Feb",
26492
+ "Mar",
26493
+ "Apr",
26494
+ "May",
26495
+ "Jun",
26496
+ "Jul",
26497
+ "Aug",
26498
+ "Sep",
26499
+ "Oct",
26500
+ "Nov",
26501
+ "Dec"
26502
+ ];
26503
+ const monthsNarrow = [
26504
+ "J",
26505
+ "F",
26506
+ "M",
26507
+ "A",
26508
+ "M",
26509
+ "J",
26510
+ "J",
26511
+ "A",
26512
+ "S",
26513
+ "O",
26514
+ "N",
26515
+ "D"
26516
+ ];
26517
+ function months(length) {
26518
+ switch(length){
26519
+ case "narrow":
26520
+ return [
26521
+ ...monthsNarrow
26522
+ ];
26523
+ case "short":
26524
+ return [
26525
+ ...monthsShort
26526
+ ];
26527
+ case "long":
26528
+ return [
26529
+ ...monthsLong
26530
+ ];
26531
+ case "numeric":
26532
+ return [
26533
+ "1",
26534
+ "2",
26535
+ "3",
26536
+ "4",
26537
+ "5",
26538
+ "6",
26539
+ "7",
26540
+ "8",
26541
+ "9",
26542
+ "10",
26543
+ "11",
26544
+ "12"
26545
+ ];
26546
+ case "2-digit":
26547
+ return [
26548
+ "01",
26549
+ "02",
26550
+ "03",
26551
+ "04",
26552
+ "05",
26553
+ "06",
26554
+ "07",
26555
+ "08",
26556
+ "09",
26557
+ "10",
26558
+ "11",
26559
+ "12"
26560
+ ];
26561
+ default:
26562
+ return null;
26563
+ }
26564
+ }
26565
+ const weekdaysLong = [
26566
+ "Monday",
26567
+ "Tuesday",
26568
+ "Wednesday",
26569
+ "Thursday",
26570
+ "Friday",
26571
+ "Saturday",
26572
+ "Sunday"
26573
+ ];
26574
+ const weekdaysShort = [
26575
+ "Mon",
26576
+ "Tue",
26577
+ "Wed",
26578
+ "Thu",
26579
+ "Fri",
26580
+ "Sat",
26581
+ "Sun"
26582
+ ];
26583
+ const weekdaysNarrow = [
26584
+ "M",
26585
+ "T",
26586
+ "W",
26587
+ "T",
26588
+ "F",
26589
+ "S",
26590
+ "S"
26591
+ ];
26592
+ function weekdays(length) {
26593
+ switch(length){
26594
+ case "narrow":
26595
+ return [
26596
+ ...weekdaysNarrow
26597
+ ];
26598
+ case "short":
26599
+ return [
26600
+ ...weekdaysShort
26601
+ ];
26602
+ case "long":
26603
+ return [
26604
+ ...weekdaysLong
26605
+ ];
26606
+ case "numeric":
26607
+ return [
26608
+ "1",
26609
+ "2",
26610
+ "3",
26611
+ "4",
26612
+ "5",
26613
+ "6",
26614
+ "7"
26615
+ ];
26616
+ default:
26617
+ return null;
26618
+ }
26619
+ }
26620
+ const meridiems = [
26621
+ "AM",
26622
+ "PM"
26623
+ ];
26624
+ const erasLong = [
26625
+ "Before Christ",
26626
+ "Anno Domini"
26627
+ ];
26628
+ const erasShort = [
26629
+ "BC",
26630
+ "AD"
26631
+ ];
26632
+ const erasNarrow = [
26633
+ "B",
26634
+ "A"
26635
+ ];
26636
+ function eras(length) {
26637
+ switch(length){
26638
+ case "narrow":
26639
+ return [
26640
+ ...erasNarrow
26641
+ ];
26642
+ case "short":
26643
+ return [
26644
+ ...erasShort
26645
+ ];
26646
+ case "long":
26647
+ return [
26648
+ ...erasLong
26649
+ ];
26650
+ default:
26651
+ return null;
26652
+ }
26653
+ }
26654
+ function meridiemForDateTime(dt) {
26655
+ return meridiems[dt.hour < 12 ? 0 : 1];
26656
+ }
26657
+ function weekdayForDateTime(dt, length) {
26658
+ return weekdays(length)[dt.weekday - 1];
26659
+ }
26660
+ function monthForDateTime(dt, length) {
26661
+ return months(length)[dt.month - 1];
26662
+ }
26663
+ function eraForDateTime(dt, length) {
26664
+ return eras(length)[dt.year < 0 ? 0 : 1];
26665
+ }
26666
+ function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
26667
+ const units = {
26668
+ years: [
26669
+ "year",
26670
+ "yr."
26671
+ ],
26672
+ quarters: [
26673
+ "quarter",
26674
+ "qtr."
26675
+ ],
26676
+ months: [
26677
+ "month",
26678
+ "mo."
26679
+ ],
26680
+ weeks: [
26681
+ "week",
26682
+ "wk."
26683
+ ],
26684
+ days: [
26685
+ "day",
26686
+ "day",
26687
+ "days"
26688
+ ],
26689
+ hours: [
26690
+ "hour",
26691
+ "hr."
26692
+ ],
26693
+ minutes: [
26694
+ "minute",
26695
+ "min."
26696
+ ],
26697
+ seconds: [
26698
+ "second",
26699
+ "sec."
26700
+ ]
26701
+ };
26702
+ const lastable = -1 === [
26703
+ "hours",
26704
+ "minutes",
26705
+ "seconds"
26706
+ ].indexOf(unit);
26707
+ if ("auto" === numeric && lastable) {
26708
+ const isDay = "days" === unit;
26709
+ switch(count){
26710
+ case 1:
26711
+ return isDay ? "tomorrow" : `next ${units[unit][0]}`;
26712
+ case -1:
26713
+ return isDay ? "yesterday" : `last ${units[unit][0]}`;
26714
+ case 0:
26715
+ return isDay ? "today" : `this ${units[unit][0]}`;
26716
+ }
26717
+ }
26718
+ const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = 1 === fmtValue, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit;
26719
+ return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
26720
+ }
26721
+ function stringifyTokens(splits, tokenToString) {
26722
+ let s = "";
26723
+ for (const token of splits)if (token.literal) s += token.val;
26724
+ else s += tokenToString(token.val);
26725
+ return s;
26726
+ }
26727
+ const macroTokenToFormatOpts = {
26728
+ D: DATE_SHORT,
26729
+ DD: DATE_MED,
26730
+ DDD: DATE_FULL,
26731
+ DDDD: DATE_HUGE,
26732
+ t: TIME_SIMPLE,
26733
+ tt: TIME_WITH_SECONDS,
26734
+ ttt: TIME_WITH_SHORT_OFFSET,
26735
+ tttt: TIME_WITH_LONG_OFFSET,
26736
+ T: TIME_24_SIMPLE,
26737
+ TT: TIME_24_WITH_SECONDS,
26738
+ TTT: TIME_24_WITH_SHORT_OFFSET,
26739
+ TTTT: TIME_24_WITH_LONG_OFFSET,
26740
+ f: DATETIME_SHORT,
26741
+ ff: DATETIME_MED,
26742
+ fff: DATETIME_FULL,
26743
+ ffff: DATETIME_HUGE,
26744
+ F: DATETIME_SHORT_WITH_SECONDS,
26745
+ FF: DATETIME_MED_WITH_SECONDS,
26746
+ FFF: DATETIME_FULL_WITH_SECONDS,
26747
+ FFFF: DATETIME_HUGE_WITH_SECONDS
26748
+ };
26749
+ class Formatter {
26750
+ static create(locale, opts = {}) {
26751
+ return new Formatter(locale, opts);
26752
+ }
26753
+ static parseFormat(fmt) {
26754
+ let current = null, currentFull = "", bracketed = false;
26755
+ const splits = [];
26756
+ for(let i = 0; i < fmt.length; i++){
26757
+ const c = fmt.charAt(i);
26758
+ if ("'" === c) {
26759
+ if (currentFull.length > 0 || bracketed) splits.push({
26760
+ literal: bracketed || /^\s+$/.test(currentFull),
26761
+ val: "" === currentFull ? "'" : currentFull
26762
+ });
26763
+ current = null;
26764
+ currentFull = "";
26765
+ bracketed = !bracketed;
26766
+ } else if (bracketed) currentFull += c;
26767
+ else if (c === current) currentFull += c;
26768
+ else {
26769
+ if (currentFull.length > 0) splits.push({
26770
+ literal: /^\s+$/.test(currentFull),
26771
+ val: currentFull
26772
+ });
26773
+ currentFull = c;
26774
+ current = c;
26775
+ }
26776
+ }
26777
+ if (currentFull.length > 0) splits.push({
26778
+ literal: bracketed || /^\s+$/.test(currentFull),
26779
+ val: currentFull
26780
+ });
26781
+ return splits;
26782
+ }
26783
+ static macroTokenToFormatOpts(token) {
26784
+ return macroTokenToFormatOpts[token];
26785
+ }
26786
+ constructor(locale, formatOpts){
26787
+ this.opts = formatOpts;
26788
+ this.loc = locale;
26789
+ this.systemLoc = null;
26790
+ }
26791
+ formatWithSystemDefault(dt, opts) {
26792
+ if (null === this.systemLoc) this.systemLoc = this.loc.redefaultToSystem();
26793
+ const df = this.systemLoc.dtFormatter(dt, {
26794
+ ...this.opts,
26795
+ ...opts
26796
+ });
26797
+ return df.format();
26798
+ }
26799
+ dtFormatter(dt, opts = {}) {
26800
+ return this.loc.dtFormatter(dt, {
26801
+ ...this.opts,
26802
+ ...opts
26803
+ });
26804
+ }
26805
+ formatDateTime(dt, opts) {
26806
+ return this.dtFormatter(dt, opts).format();
26807
+ }
26808
+ formatDateTimeParts(dt, opts) {
26809
+ return this.dtFormatter(dt, opts).formatToParts();
26810
+ }
26811
+ formatInterval(interval, opts) {
26812
+ const df = this.dtFormatter(interval.start, opts);
26813
+ return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
26814
+ }
26815
+ resolvedOptions(dt, opts) {
26816
+ return this.dtFormatter(dt, opts).resolvedOptions();
26817
+ }
26818
+ num(n, p = 0, signDisplay) {
26819
+ if (this.opts.forceSimple) return padStart(n, p);
26820
+ const opts = {
26821
+ ...this.opts
26822
+ };
26823
+ if (p > 0) opts.padTo = p;
26824
+ if (signDisplay) opts.signDisplay = signDisplay;
26825
+ return this.loc.numberFormatter(opts).format(n);
26826
+ }
26827
+ formatDateTimeFromString(dt, fmt) {
26828
+ const knownEnglish = "en" === this.loc.listingMode(), useDateTimeFormatter = this.loc.outputCalendar && "gregory" !== this.loc.outputCalendar, string = (opts, extract)=>this.loc.extract(dt, opts, extract), formatOffset = (opts)=>{
26829
+ if (dt.isOffsetFixed && 0 === dt.offset && opts.allowZ) return "Z";
26830
+ return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : "";
26831
+ }, meridiem = ()=>knownEnglish ? meridiemForDateTime(dt) : string({
26832
+ hour: "numeric",
26833
+ hourCycle: "h12"
26834
+ }, "dayperiod"), month = (length, standalone)=>knownEnglish ? monthForDateTime(dt, length) : string(standalone ? {
26835
+ month: length
26836
+ } : {
26837
+ month: length,
26838
+ day: "numeric"
26839
+ }, "month"), weekday = (length, standalone)=>knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? {
26840
+ weekday: length
26841
+ } : {
26842
+ weekday: length,
26843
+ month: "long",
26844
+ day: "numeric"
26845
+ }, "weekday"), maybeMacro = (token)=>{
26846
+ const formatOpts = Formatter.macroTokenToFormatOpts(token);
26847
+ if (formatOpts) return this.formatWithSystemDefault(dt, formatOpts);
26848
+ return token;
26849
+ }, era = (length)=>knownEnglish ? eraForDateTime(dt, length) : string({
26850
+ era: length
26851
+ }, "era"), tokenToString = (token)=>{
26852
+ switch(token){
26853
+ case "S":
26854
+ return this.num(dt.millisecond);
26855
+ case "u":
26856
+ case "SSS":
26857
+ return this.num(dt.millisecond, 3);
26858
+ case "s":
26859
+ return this.num(dt.second);
26860
+ case "ss":
26861
+ return this.num(dt.second, 2);
26862
+ case "uu":
26863
+ return this.num(Math.floor(dt.millisecond / 10), 2);
26864
+ case "uuu":
26865
+ return this.num(Math.floor(dt.millisecond / 100));
26866
+ case "m":
26867
+ return this.num(dt.minute);
26868
+ case "mm":
26869
+ return this.num(dt.minute, 2);
26870
+ case "h":
26871
+ return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
26872
+ case "hh":
26873
+ return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
26874
+ case "H":
26875
+ return this.num(dt.hour);
26876
+ case "HH":
26877
+ return this.num(dt.hour, 2);
26878
+ case "Z":
26879
+ return formatOffset({
26880
+ format: "narrow",
26881
+ allowZ: this.opts.allowZ
26882
+ });
26883
+ case "ZZ":
26884
+ return formatOffset({
26885
+ format: "short",
26886
+ allowZ: this.opts.allowZ
26887
+ });
26888
+ case "ZZZ":
26889
+ return formatOffset({
26890
+ format: "techie",
26891
+ allowZ: this.opts.allowZ
26892
+ });
26893
+ case "ZZZZ":
26894
+ return dt.zone.offsetName(dt.ts, {
26895
+ format: "short",
26896
+ locale: this.loc.locale
26897
+ });
26898
+ case "ZZZZZ":
26899
+ return dt.zone.offsetName(dt.ts, {
26900
+ format: "long",
26901
+ locale: this.loc.locale
26902
+ });
26903
+ case "z":
26904
+ return dt.zoneName;
26905
+ case "a":
26906
+ return meridiem();
26907
+ case "d":
26908
+ return useDateTimeFormatter ? string({
26909
+ day: "numeric"
26910
+ }, "day") : this.num(dt.day);
26911
+ case "dd":
26912
+ return useDateTimeFormatter ? string({
26913
+ day: "2-digit"
26914
+ }, "day") : this.num(dt.day, 2);
26915
+ case "c":
26916
+ return this.num(dt.weekday);
26917
+ case "ccc":
26918
+ return weekday("short", true);
26919
+ case "cccc":
26920
+ return weekday("long", true);
26921
+ case "ccccc":
26922
+ return weekday("narrow", true);
26923
+ case "E":
26924
+ return this.num(dt.weekday);
26925
+ case "EEE":
26926
+ return weekday("short", false);
26927
+ case "EEEE":
26928
+ return weekday("long", false);
26929
+ case "EEEEE":
26930
+ return weekday("narrow", false);
26931
+ case "L":
26932
+ return useDateTimeFormatter ? string({
26933
+ month: "numeric",
26934
+ day: "numeric"
26935
+ }, "month") : this.num(dt.month);
26936
+ case "LL":
26937
+ return useDateTimeFormatter ? string({
26938
+ month: "2-digit",
26939
+ day: "numeric"
26940
+ }, "month") : this.num(dt.month, 2);
26941
+ case "LLL":
26942
+ return month("short", true);
26943
+ case "LLLL":
26944
+ return month("long", true);
26945
+ case "LLLLL":
26946
+ return month("narrow", true);
26947
+ case "M":
26948
+ return useDateTimeFormatter ? string({
26949
+ month: "numeric"
26950
+ }, "month") : this.num(dt.month);
26951
+ case "MM":
26952
+ return useDateTimeFormatter ? string({
26953
+ month: "2-digit"
26954
+ }, "month") : this.num(dt.month, 2);
26955
+ case "MMM":
26956
+ return month("short", false);
26957
+ case "MMMM":
26958
+ return month("long", false);
26959
+ case "MMMMM":
26960
+ return month("narrow", false);
26961
+ case "y":
26962
+ return useDateTimeFormatter ? string({
26963
+ year: "numeric"
26964
+ }, "year") : this.num(dt.year);
26965
+ case "yy":
26966
+ return useDateTimeFormatter ? string({
26967
+ year: "2-digit"
26968
+ }, "year") : this.num(dt.year.toString().slice(-2), 2);
26969
+ case "yyyy":
26970
+ return useDateTimeFormatter ? string({
26971
+ year: "numeric"
26972
+ }, "year") : this.num(dt.year, 4);
26973
+ case "yyyyyy":
26974
+ return useDateTimeFormatter ? string({
26975
+ year: "numeric"
26976
+ }, "year") : this.num(dt.year, 6);
26977
+ case "G":
26978
+ return era("short");
26979
+ case "GG":
26980
+ return era("long");
26981
+ case "GGGGG":
26982
+ return era("narrow");
26983
+ case "kk":
26984
+ return this.num(dt.weekYear.toString().slice(-2), 2);
26985
+ case "kkkk":
26986
+ return this.num(dt.weekYear, 4);
26987
+ case "W":
26988
+ return this.num(dt.weekNumber);
26989
+ case "WW":
26990
+ return this.num(dt.weekNumber, 2);
26991
+ case "n":
26992
+ return this.num(dt.localWeekNumber);
26993
+ case "nn":
26994
+ return this.num(dt.localWeekNumber, 2);
26995
+ case "ii":
26996
+ return this.num(dt.localWeekYear.toString().slice(-2), 2);
26997
+ case "iiii":
26998
+ return this.num(dt.localWeekYear, 4);
26999
+ case "o":
27000
+ return this.num(dt.ordinal);
27001
+ case "ooo":
27002
+ return this.num(dt.ordinal, 3);
27003
+ case "q":
27004
+ return this.num(dt.quarter);
27005
+ case "qq":
27006
+ return this.num(dt.quarter, 2);
27007
+ case "X":
27008
+ return this.num(Math.floor(dt.ts / 1000));
27009
+ case "x":
27010
+ return this.num(dt.ts);
27011
+ default:
27012
+ return maybeMacro(token);
27013
+ }
27014
+ };
27015
+ return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
27016
+ }
27017
+ formatDurationFromString(dur, fmt) {
27018
+ const invertLargest = "negativeLargestOnly" === this.opts.signMode ? -1 : 1;
27019
+ const tokenToField = (token)=>{
27020
+ switch(token[0]){
27021
+ case "S":
27022
+ return "milliseconds";
27023
+ case "s":
27024
+ return "seconds";
27025
+ case "m":
27026
+ return "minutes";
27027
+ case "h":
27028
+ return "hours";
27029
+ case "d":
27030
+ return "days";
27031
+ case "w":
27032
+ return "weeks";
27033
+ case "M":
27034
+ return "months";
27035
+ case "y":
27036
+ return "years";
27037
+ default:
27038
+ return null;
27039
+ }
27040
+ }, tokenToString = (lildur, info)=>(token)=>{
27041
+ const mapped = tokenToField(token);
27042
+ if (!mapped) return token;
27043
+ {
27044
+ const inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
27045
+ let signDisplay;
27046
+ signDisplay = "negativeLargestOnly" === this.opts.signMode && mapped !== info.largestUnit ? "never" : "all" === this.opts.signMode ? "always" : "auto";
27047
+ return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
27048
+ }
27049
+ }, tokens = Formatter.parseFormat(fmt), realTokens = tokens.reduce((found, { literal, val })=>literal ? found : found.concat(val), []), collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t)=>t)), durationInfo = {
27050
+ isNegativeDuration: collapsed < 0,
27051
+ largestUnit: Object.keys(collapsed.values)[0]
27052
+ };
27053
+ return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
27054
+ }
27055
+ }
27056
+ const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
27057
+ function combineRegexes(...regexes) {
27058
+ const full = regexes.reduce((f, r)=>f + r.source, "");
27059
+ return RegExp(`^${full}$`);
27060
+ }
27061
+ function combineExtractors(...extractors) {
27062
+ return (m)=>extractors.reduce(([mergedVals, mergedZone, cursor], ex)=>{
27063
+ const [val, zone, next] = ex(m, cursor);
27064
+ return [
27065
+ {
27066
+ ...mergedVals,
27067
+ ...val
27068
+ },
27069
+ zone || mergedZone,
27070
+ next
27071
+ ];
27072
+ }, [
27073
+ {},
27074
+ null,
27075
+ 1
27076
+ ]).slice(0, 2);
27077
+ }
27078
+ function parse(s, ...patterns) {
27079
+ if (null == s) return [
27080
+ null,
27081
+ null
27082
+ ];
27083
+ for (const [regex, extractor] of patterns){
27084
+ const m = regex.exec(s);
27085
+ if (m) return extractor(m);
27086
+ }
27087
+ return [
27088
+ null,
27089
+ null
27090
+ ];
27091
+ }
27092
+ function simpleParse(...keys) {
27093
+ return (match, cursor)=>{
27094
+ const ret = {};
27095
+ let i;
27096
+ for(i = 0; i < keys.length; i++)ret[keys[i]] = parseInteger(match[cursor + i]);
27097
+ return [
27098
+ ret,
27099
+ null,
27100
+ cursor + i
27101
+ ];
27102
+ };
27103
+ }
27104
+ const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
27105
+ const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
27106
+ const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
27107
+ const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
27108
+ const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
27109
+ const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
27110
+ const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
27111
+ const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
27112
+ const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
27113
+ const extractISOOrdinalData = simpleParse("year", "ordinal");
27114
+ const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
27115
+ const sqlTimeRegex = RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`);
27116
+ const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
27117
+ function luxon_int(match, pos, fallback) {
27118
+ const m = match[pos];
27119
+ return isUndefined(m) ? fallback : parseInteger(m);
27120
+ }
27121
+ function extractISOYmd(match, cursor) {
27122
+ const item = {
27123
+ year: luxon_int(match, cursor),
27124
+ month: luxon_int(match, cursor + 1, 1),
27125
+ day: luxon_int(match, cursor + 2, 1)
27126
+ };
27127
+ return [
27128
+ item,
27129
+ null,
27130
+ cursor + 3
27131
+ ];
27132
+ }
27133
+ function extractISOTime(match, cursor) {
27134
+ const item = {
27135
+ hours: luxon_int(match, cursor, 0),
27136
+ minutes: luxon_int(match, cursor + 1, 0),
27137
+ seconds: luxon_int(match, cursor + 2, 0),
27138
+ milliseconds: parseMillis(match[cursor + 3])
27139
+ };
27140
+ return [
27141
+ item,
27142
+ null,
27143
+ cursor + 4
27144
+ ];
27145
+ }
27146
+ function extractISOOffset(match, cursor) {
27147
+ const local = !match[cursor] && !match[cursor + 1], fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset);
27148
+ return [
27149
+ {},
27150
+ zone,
27151
+ cursor + 3
27152
+ ];
27153
+ }
27154
+ function extractIANAZone(match, cursor) {
27155
+ const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;
27156
+ return [
27157
+ {},
27158
+ zone,
27159
+ cursor + 1
27160
+ ];
27161
+ }
27162
+ const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
27163
+ const isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
27164
+ function extractISODuration(match) {
27165
+ const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match;
27166
+ const hasNegativePrefix = "-" === s[0];
27167
+ const negativeSeconds = secondStr && "-" === secondStr[0];
27168
+ const maybeNegate = (num, force = false)=>void 0 !== num && (force || num && hasNegativePrefix) ? -num : num;
27169
+ return [
27170
+ {
27171
+ years: maybeNegate(parseFloating(yearStr)),
27172
+ months: maybeNegate(parseFloating(monthStr)),
27173
+ weeks: maybeNegate(parseFloating(weekStr)),
27174
+ days: maybeNegate(parseFloating(dayStr)),
27175
+ hours: maybeNegate(parseFloating(hourStr)),
27176
+ minutes: maybeNegate(parseFloating(minuteStr)),
27177
+ seconds: maybeNegate(parseFloating(secondStr), "-0" === secondStr),
27178
+ milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
27179
+ }
27180
+ ];
27181
+ }
27182
+ const obsOffsets = {
27183
+ GMT: 0,
27184
+ EDT: -240,
27185
+ EST: -300,
27186
+ CDT: -300,
27187
+ CST: -360,
27188
+ MDT: -360,
27189
+ MST: -420,
27190
+ PDT: -420,
27191
+ PST: -480
27192
+ };
27193
+ function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
27194
+ const result = {
27195
+ year: 2 === yearStr.length ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
27196
+ month: monthsShort.indexOf(monthStr) + 1,
27197
+ day: parseInteger(dayStr),
27198
+ hour: parseInteger(hourStr),
27199
+ minute: parseInteger(minuteStr)
27200
+ };
27201
+ if (secondStr) result.second = parseInteger(secondStr);
27202
+ if (weekdayStr) result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
27203
+ return result;
27204
+ }
27205
+ const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
27206
+ function extractRFC2822(match) {
27207
+ const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr, obsOffset, milOffset, offHourStr, offMinuteStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
27208
+ let offset;
27209
+ offset = obsOffset ? obsOffsets[obsOffset] : milOffset ? 0 : signedOffset(offHourStr, offMinuteStr);
27210
+ return [
27211
+ result,
27212
+ new FixedOffsetZone(offset)
27213
+ ];
27214
+ }
27215
+ function preprocessRFC2822(s) {
27216
+ return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
27217
+ }
27218
+ const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
27219
+ function extractRFC1123Or850(match) {
27220
+ const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
27221
+ return [
27222
+ result,
27223
+ FixedOffsetZone.utcInstance
27224
+ ];
27225
+ }
27226
+ function extractASCII(match) {
27227
+ const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
27228
+ return [
27229
+ result,
27230
+ FixedOffsetZone.utcInstance
27231
+ ];
27232
+ }
27233
+ const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
27234
+ const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
27235
+ const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
27236
+ const isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
27237
+ const extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
27238
+ const extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone);
27239
+ const extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone);
27240
+ const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
27241
+ function parseISODate(s) {
27242
+ return parse(s, [
27243
+ isoYmdWithTimeExtensionRegex,
27244
+ extractISOYmdTimeAndOffset
27245
+ ], [
27246
+ isoWeekWithTimeExtensionRegex,
27247
+ extractISOWeekTimeAndOffset
27248
+ ], [
27249
+ isoOrdinalWithTimeExtensionRegex,
27250
+ extractISOOrdinalDateAndTime
27251
+ ], [
27252
+ isoTimeCombinedRegex,
27253
+ extractISOTimeAndOffset
27254
+ ]);
27255
+ }
27256
+ function parseRFC2822Date(s) {
27257
+ return parse(preprocessRFC2822(s), [
27258
+ rfc2822,
27259
+ extractRFC2822
27260
+ ]);
27261
+ }
27262
+ function parseHTTPDate(s) {
27263
+ return parse(s, [
27264
+ rfc1123,
27265
+ extractRFC1123Or850
27266
+ ], [
27267
+ rfc850,
27268
+ extractRFC1123Or850
27269
+ ], [
27270
+ ascii,
27271
+ extractASCII
27272
+ ]);
27273
+ }
27274
+ function parseISODuration(s) {
27275
+ return parse(s, [
27276
+ isoDuration,
27277
+ extractISODuration
27278
+ ]);
27279
+ }
27280
+ const extractISOTimeOnly = combineExtractors(extractISOTime);
27281
+ function parseISOTimeOnly(s) {
27282
+ return parse(s, [
27283
+ isoTimeOnly,
27284
+ extractISOTimeOnly
27285
+ ]);
27286
+ }
27287
+ const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
27288
+ const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
27289
+ const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
27290
+ function parseSQL(s) {
27291
+ return parse(s, [
27292
+ sqlYmdWithTimeExtensionRegex,
27293
+ extractISOYmdTimeAndOffset
27294
+ ], [
27295
+ sqlTimeCombinedRegex,
27296
+ extractISOTimeOffsetAndIANAZone
27297
+ ]);
27298
+ }
27299
+ const INVALID$2 = "Invalid Duration";
27300
+ const lowOrderMatrix = {
27301
+ weeks: {
27302
+ days: 7,
27303
+ hours: 168,
27304
+ minutes: 10080,
27305
+ seconds: 604800,
27306
+ milliseconds: 604800000
27307
+ },
27308
+ days: {
27309
+ hours: 24,
27310
+ minutes: 1440,
27311
+ seconds: 86400,
27312
+ milliseconds: 86400000
27313
+ },
27314
+ hours: {
27315
+ minutes: 60,
27316
+ seconds: 3600,
27317
+ milliseconds: 3600000
27318
+ },
27319
+ minutes: {
27320
+ seconds: 60,
27321
+ milliseconds: 60000
27322
+ },
27323
+ seconds: {
27324
+ milliseconds: 1000
27325
+ }
27326
+ }, casualMatrix = {
27327
+ years: {
27328
+ quarters: 4,
27329
+ months: 12,
27330
+ weeks: 52,
27331
+ days: 365,
27332
+ hours: 8760,
27333
+ minutes: 525600,
27334
+ seconds: 31536000,
27335
+ milliseconds: 31536000000
27336
+ },
27337
+ quarters: {
27338
+ months: 3,
27339
+ weeks: 13,
27340
+ days: 91,
27341
+ hours: 2184,
27342
+ minutes: 131040,
27343
+ seconds: 7862400,
27344
+ milliseconds: 7862400000
27345
+ },
27346
+ months: {
27347
+ weeks: 4,
27348
+ days: 30,
27349
+ hours: 720,
27350
+ minutes: 43200,
27351
+ seconds: 2592000,
27352
+ milliseconds: 2592000000
27353
+ },
27354
+ ...lowOrderMatrix
27355
+ }, daysInYearAccurate = 365.2425, daysInMonthAccurate = 30.436875, accurateMatrix = {
27356
+ years: {
27357
+ quarters: 4,
27358
+ months: 12,
27359
+ weeks: daysInYearAccurate / 7,
27360
+ days: daysInYearAccurate,
27361
+ hours: 24 * daysInYearAccurate,
27362
+ minutes: 24 * daysInYearAccurate * 60,
27363
+ seconds: 24 * daysInYearAccurate * 3600,
27364
+ milliseconds: 24 * daysInYearAccurate * 3600000
27365
+ },
27366
+ quarters: {
27367
+ months: 3,
27368
+ weeks: daysInYearAccurate / 28,
27369
+ days: daysInYearAccurate / 4,
27370
+ hours: 24 * daysInYearAccurate / 4,
27371
+ minutes: 24 * daysInYearAccurate * 60 / 4,
27372
+ seconds: 24 * daysInYearAccurate * 3600 / 4,
27373
+ milliseconds: 24 * daysInYearAccurate * 3600000 / 4
27374
+ },
27375
+ months: {
27376
+ weeks: daysInMonthAccurate / 7,
27377
+ days: daysInMonthAccurate,
27378
+ hours: 24 * daysInMonthAccurate,
27379
+ minutes: 24 * daysInMonthAccurate * 60,
27380
+ seconds: 24 * daysInMonthAccurate * 3600,
27381
+ milliseconds: 24 * daysInMonthAccurate * 3600000
27382
+ },
27383
+ ...lowOrderMatrix
27384
+ };
27385
+ const orderedUnits$1 = [
27386
+ "years",
27387
+ "quarters",
27388
+ "months",
27389
+ "weeks",
27390
+ "days",
27391
+ "hours",
27392
+ "minutes",
27393
+ "seconds",
27394
+ "milliseconds"
27395
+ ];
27396
+ const reverseUnits = orderedUnits$1.slice(0).reverse();
27397
+ function clone$1(dur, alts, clear = false) {
27398
+ const conf = {
27399
+ values: clear ? alts.values : {
27400
+ ...dur.values,
27401
+ ...alts.values || {}
27402
+ },
27403
+ loc: dur.loc.clone(alts.loc),
27404
+ conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
27405
+ matrix: alts.matrix || dur.matrix
27406
+ };
27407
+ return new Duration(conf);
27408
+ }
27409
+ function durationToMillis(matrix, vals) {
27410
+ let sum = vals.milliseconds ?? 0;
27411
+ for (const unit of reverseUnits.slice(1))if (vals[unit]) sum += vals[unit] * matrix[unit]["milliseconds"];
27412
+ return sum;
27413
+ }
27414
+ function normalizeValues(matrix, vals) {
27415
+ const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
27416
+ orderedUnits$1.reduceRight((previous, current)=>{
27417
+ if (isUndefined(vals[current])) return previous;
27418
+ if (previous) {
27419
+ const previousVal = vals[previous] * factor;
27420
+ const conv = matrix[current][previous];
27421
+ const rollUp = Math.floor(previousVal / conv);
27422
+ vals[current] += rollUp * factor;
27423
+ vals[previous] -= rollUp * conv * factor;
27424
+ }
27425
+ return current;
27426
+ }, null);
27427
+ orderedUnits$1.reduce((previous, current)=>{
27428
+ if (isUndefined(vals[current])) return previous;
27429
+ if (previous) {
27430
+ const fraction = vals[previous] % 1;
27431
+ vals[previous] -= fraction;
27432
+ vals[current] += fraction * matrix[previous][current];
27433
+ }
27434
+ return current;
27435
+ }, null);
27436
+ }
27437
+ function removeZeroes(vals) {
27438
+ const newVals = {};
27439
+ for (const [key, value] of Object.entries(vals))if (0 !== value) newVals[key] = value;
27440
+ return newVals;
27441
+ }
27442
+ class Duration {
27443
+ constructor(config){
27444
+ const accurate = "longterm" === config.conversionAccuracy || false;
27445
+ let matrix = accurate ? accurateMatrix : casualMatrix;
27446
+ if (config.matrix) matrix = config.matrix;
27447
+ this.values = config.values;
27448
+ this.loc = config.loc || Locale.create();
27449
+ this.conversionAccuracy = accurate ? "longterm" : "casual";
27450
+ this.invalid = config.invalid || null;
27451
+ this.matrix = matrix;
27452
+ this.isLuxonDuration = true;
27453
+ }
27454
+ static fromMillis(count, opts) {
27455
+ return Duration.fromObject({
27456
+ milliseconds: count
27457
+ }, opts);
27458
+ }
27459
+ static fromObject(obj, opts = {}) {
27460
+ if (null == obj || "object" != typeof obj) throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${null === obj ? "null" : typeof obj}`);
27461
+ return new Duration({
27462
+ values: normalizeObject(obj, Duration.normalizeUnit),
27463
+ loc: Locale.fromObject(opts),
27464
+ conversionAccuracy: opts.conversionAccuracy,
27465
+ matrix: opts.matrix
27466
+ });
27467
+ }
27468
+ static fromDurationLike(durationLike) {
27469
+ if (isNumber(durationLike)) return Duration.fromMillis(durationLike);
27470
+ if (Duration.isDuration(durationLike)) return durationLike;
27471
+ if ("object" == typeof durationLike) return Duration.fromObject(durationLike);
27472
+ throw new InvalidArgumentError(`Unknown duration argument ${durationLike} of type ${typeof durationLike}`);
27473
+ }
27474
+ static fromISO(text, opts) {
27475
+ const [parsed] = parseISODuration(text);
27476
+ if (parsed) return Duration.fromObject(parsed, opts);
27477
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
27478
+ }
27479
+ static fromISOTime(text, opts) {
27480
+ const [parsed] = parseISOTimeOnly(text);
27481
+ if (parsed) return Duration.fromObject(parsed, opts);
27482
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
27483
+ }
27484
+ static invalid(reason, explanation = null) {
27485
+ if (!reason) throw new InvalidArgumentError("need to specify a reason the Duration is invalid");
27486
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
27487
+ if (!Settings.throwOnInvalid) return new Duration({
27488
+ invalid
27489
+ });
27490
+ throw new InvalidDurationError(invalid);
27491
+ }
27492
+ static normalizeUnit(unit) {
27493
+ const normalized = {
27494
+ year: "years",
27495
+ years: "years",
27496
+ quarter: "quarters",
27497
+ quarters: "quarters",
27498
+ month: "months",
27499
+ months: "months",
27500
+ week: "weeks",
27501
+ weeks: "weeks",
27502
+ day: "days",
27503
+ days: "days",
27504
+ hour: "hours",
27505
+ hours: "hours",
27506
+ minute: "minutes",
27507
+ minutes: "minutes",
27508
+ second: "seconds",
27509
+ seconds: "seconds",
27510
+ millisecond: "milliseconds",
27511
+ milliseconds: "milliseconds"
27512
+ }[unit ? unit.toLowerCase() : unit];
27513
+ if (!normalized) throw new InvalidUnitError(unit);
27514
+ return normalized;
27515
+ }
27516
+ static isDuration(o) {
27517
+ return o && o.isLuxonDuration || false;
27518
+ }
27519
+ get locale() {
27520
+ return this.isValid ? this.loc.locale : null;
27521
+ }
27522
+ get numberingSystem() {
27523
+ return this.isValid ? this.loc.numberingSystem : null;
27524
+ }
27525
+ toFormat(fmt, opts = {}) {
27526
+ const fmtOpts = {
27527
+ ...opts,
27528
+ floor: false !== opts.round && false !== opts.floor
27529
+ };
27530
+ return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
27531
+ }
27532
+ toHuman(opts = {}) {
27533
+ if (!this.isValid) return INVALID$2;
27534
+ const showZeros = false !== opts.showZeros;
27535
+ const l = orderedUnits$1.map((unit)=>{
27536
+ const val = this.values[unit];
27537
+ if (isUndefined(val) || 0 === val && !showZeros) return null;
27538
+ return this.loc.numberFormatter({
27539
+ style: "unit",
27540
+ unitDisplay: "long",
27541
+ ...opts,
27542
+ unit: unit.slice(0, -1)
27543
+ }).format(val);
27544
+ }).filter((n)=>n);
27545
+ return this.loc.listFormatter({
27546
+ type: "conjunction",
27547
+ style: opts.listStyle || "narrow",
27548
+ ...opts
27549
+ }).format(l);
27550
+ }
27551
+ toObject() {
27552
+ if (!this.isValid) return {};
27553
+ return {
27554
+ ...this.values
27555
+ };
27556
+ }
27557
+ toISO() {
27558
+ if (!this.isValid) return null;
27559
+ let s = "P";
27560
+ if (0 !== this.years) s += this.years + "Y";
27561
+ if (0 !== this.months || 0 !== this.quarters) s += this.months + 3 * this.quarters + "M";
27562
+ if (0 !== this.weeks) s += this.weeks + "W";
27563
+ if (0 !== this.days) s += this.days + "D";
27564
+ if (0 !== this.hours || 0 !== this.minutes || 0 !== this.seconds || 0 !== this.milliseconds) s += "T";
27565
+ if (0 !== this.hours) s += this.hours + "H";
27566
+ if (0 !== this.minutes) s += this.minutes + "M";
27567
+ if (0 !== this.seconds || 0 !== this.milliseconds) s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S";
27568
+ if ("P" === s) s += "T0S";
27569
+ return s;
27570
+ }
27571
+ toISOTime(opts = {}) {
27572
+ if (!this.isValid) return null;
27573
+ const millis = this.toMillis();
27574
+ if (millis < 0 || millis >= 86400000) return null;
27575
+ opts = {
27576
+ suppressMilliseconds: false,
27577
+ suppressSeconds: false,
27578
+ includePrefix: false,
27579
+ format: "extended",
27580
+ ...opts,
27581
+ includeOffset: false
27582
+ };
27583
+ const dateTime = DateTime.fromMillis(millis, {
27584
+ zone: "UTC"
27585
+ });
27586
+ return dateTime.toISOTime(opts);
27587
+ }
27588
+ toJSON() {
27589
+ return this.toISO();
27590
+ }
27591
+ toString() {
27592
+ return this.toISO();
27593
+ }
27594
+ [Symbol.for("nodejs.util.inspect.custom")]() {
27595
+ if (this.isValid) return `Duration { values: ${JSON.stringify(this.values)} }`;
27596
+ return `Duration { Invalid, reason: ${this.invalidReason} }`;
27597
+ }
27598
+ toMillis() {
27599
+ if (!this.isValid) return NaN;
27600
+ return durationToMillis(this.matrix, this.values);
27601
+ }
27602
+ valueOf() {
27603
+ return this.toMillis();
27604
+ }
27605
+ plus(duration) {
27606
+ if (!this.isValid) return this;
27607
+ const dur = Duration.fromDurationLike(duration), result = {};
27608
+ for (const k of orderedUnits$1)if (luxon_hasOwnProperty(dur.values, k) || luxon_hasOwnProperty(this.values, k)) result[k] = dur.get(k) + this.get(k);
27609
+ return clone$1(this, {
27610
+ values: result
27611
+ }, true);
27612
+ }
27613
+ minus(duration) {
27614
+ if (!this.isValid) return this;
27615
+ const dur = Duration.fromDurationLike(duration);
27616
+ return this.plus(dur.negate());
27617
+ }
27618
+ mapUnits(fn) {
27619
+ if (!this.isValid) return this;
27620
+ const result = {};
27621
+ for (const k of Object.keys(this.values))result[k] = asNumber(fn(this.values[k], k));
27622
+ return clone$1(this, {
27623
+ values: result
27624
+ }, true);
27625
+ }
27626
+ get(unit) {
27627
+ return this[Duration.normalizeUnit(unit)];
27628
+ }
27629
+ set(values) {
27630
+ if (!this.isValid) return this;
27631
+ const mixed = {
27632
+ ...this.values,
27633
+ ...normalizeObject(values, Duration.normalizeUnit)
27634
+ };
27635
+ return clone$1(this, {
27636
+ values: mixed
27637
+ });
27638
+ }
27639
+ reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {
27640
+ const loc = this.loc.clone({
27641
+ locale,
27642
+ numberingSystem
27643
+ });
27644
+ const opts = {
27645
+ loc,
27646
+ matrix,
27647
+ conversionAccuracy
27648
+ };
27649
+ return clone$1(this, opts);
27650
+ }
27651
+ as(unit) {
27652
+ return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
27653
+ }
27654
+ normalize() {
27655
+ if (!this.isValid) return this;
27656
+ const vals = this.toObject();
27657
+ normalizeValues(this.matrix, vals);
27658
+ return clone$1(this, {
27659
+ values: vals
27660
+ }, true);
27661
+ }
27662
+ rescale() {
27663
+ if (!this.isValid) return this;
27664
+ const vals = removeZeroes(this.normalize().shiftToAll().toObject());
27665
+ return clone$1(this, {
27666
+ values: vals
27667
+ }, true);
27668
+ }
27669
+ shiftTo(...units) {
27670
+ if (!this.isValid) return this;
27671
+ if (0 === units.length) return this;
27672
+ units = units.map((u)=>Duration.normalizeUnit(u));
27673
+ const built = {}, accumulated = {}, vals = this.toObject();
27674
+ let lastUnit;
27675
+ for (const k of orderedUnits$1)if (units.indexOf(k) >= 0) {
27676
+ lastUnit = k;
27677
+ let own = 0;
27678
+ for(const ak in accumulated){
27679
+ own += this.matrix[ak][k] * accumulated[ak];
27680
+ accumulated[ak] = 0;
27681
+ }
27682
+ if (isNumber(vals[k])) own += vals[k];
27683
+ const i = Math.trunc(own);
27684
+ built[k] = i;
27685
+ accumulated[k] = (1000 * own - 1000 * i) / 1000;
27686
+ } else if (isNumber(vals[k])) accumulated[k] = vals[k];
27687
+ for(const key in accumulated)if (0 !== accumulated[key]) built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
27688
+ normalizeValues(this.matrix, built);
27689
+ return clone$1(this, {
27690
+ values: built
27691
+ }, true);
27692
+ }
27693
+ shiftToAll() {
27694
+ if (!this.isValid) return this;
27695
+ return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds");
27696
+ }
27697
+ negate() {
27698
+ if (!this.isValid) return this;
27699
+ const negated = {};
27700
+ for (const k of Object.keys(this.values))negated[k] = 0 === this.values[k] ? 0 : -this.values[k];
27701
+ return clone$1(this, {
27702
+ values: negated
27703
+ }, true);
27704
+ }
27705
+ removeZeros() {
27706
+ if (!this.isValid) return this;
27707
+ const vals = removeZeroes(this.values);
27708
+ return clone$1(this, {
27709
+ values: vals
27710
+ }, true);
27711
+ }
27712
+ get years() {
27713
+ return this.isValid ? this.values.years || 0 : NaN;
27714
+ }
27715
+ get quarters() {
27716
+ return this.isValid ? this.values.quarters || 0 : NaN;
27717
+ }
27718
+ get months() {
27719
+ return this.isValid ? this.values.months || 0 : NaN;
27720
+ }
27721
+ get weeks() {
27722
+ return this.isValid ? this.values.weeks || 0 : NaN;
27723
+ }
27724
+ get days() {
27725
+ return this.isValid ? this.values.days || 0 : NaN;
27726
+ }
27727
+ get hours() {
27728
+ return this.isValid ? this.values.hours || 0 : NaN;
27729
+ }
27730
+ get minutes() {
27731
+ return this.isValid ? this.values.minutes || 0 : NaN;
27732
+ }
27733
+ get seconds() {
27734
+ return this.isValid ? this.values.seconds || 0 : NaN;
27735
+ }
27736
+ get milliseconds() {
27737
+ return this.isValid ? this.values.milliseconds || 0 : NaN;
27738
+ }
27739
+ get isValid() {
27740
+ return null === this.invalid;
27741
+ }
27742
+ get invalidReason() {
27743
+ return this.invalid ? this.invalid.reason : null;
27744
+ }
27745
+ get invalidExplanation() {
27746
+ return this.invalid ? this.invalid.explanation : null;
27747
+ }
27748
+ equals(other) {
27749
+ if (!this.isValid || !other.isValid) return false;
27750
+ if (!this.loc.equals(other.loc)) return false;
27751
+ function eq(v1, v2) {
27752
+ if (void 0 === v1 || 0 === v1) return void 0 === v2 || 0 === v2;
27753
+ return v1 === v2;
27754
+ }
27755
+ for (const u of orderedUnits$1)if (!eq(this.values[u], other.values[u])) return false;
27756
+ return true;
27757
+ }
27758
+ }
27759
+ const INVALID$1 = "Invalid Interval";
27760
+ function validateStartEnd(start, end) {
27761
+ if (!start || !start.isValid) return Interval.invalid("missing or invalid start");
27762
+ if (!end || !end.isValid) return Interval.invalid("missing or invalid end");
27763
+ if (end < start) return Interval.invalid("end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`);
27764
+ return null;
27765
+ }
27766
+ class Interval {
27767
+ constructor(config){
27768
+ this.s = config.start;
27769
+ this.e = config.end;
27770
+ this.invalid = config.invalid || null;
27771
+ this.isLuxonInterval = true;
27772
+ }
27773
+ static invalid(reason, explanation = null) {
27774
+ if (!reason) throw new InvalidArgumentError("need to specify a reason the Interval is invalid");
27775
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
27776
+ if (!Settings.throwOnInvalid) return new Interval({
27777
+ invalid
27778
+ });
27779
+ throw new InvalidIntervalError(invalid);
27780
+ }
27781
+ static fromDateTimes(start, end) {
27782
+ const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end);
27783
+ const validateError = validateStartEnd(builtStart, builtEnd);
27784
+ if (null == validateError) return new Interval({
27785
+ start: builtStart,
27786
+ end: builtEnd
27787
+ });
27788
+ return validateError;
27789
+ }
27790
+ static after(start, duration) {
27791
+ const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(start);
27792
+ return Interval.fromDateTimes(dt, dt.plus(dur));
27793
+ }
27794
+ static before(end, duration) {
27795
+ const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(end);
27796
+ return Interval.fromDateTimes(dt.minus(dur), dt);
27797
+ }
27798
+ static fromISO(text, opts) {
27799
+ const [s, e] = (text || "").split("/", 2);
27800
+ if (s && e) {
27801
+ let start, startIsValid;
27802
+ try {
27803
+ start = DateTime.fromISO(s, opts);
27804
+ startIsValid = start.isValid;
27805
+ } catch (e) {
27806
+ startIsValid = false;
27807
+ }
27808
+ let end, endIsValid;
27809
+ try {
27810
+ end = DateTime.fromISO(e, opts);
27811
+ endIsValid = end.isValid;
27812
+ } catch (e) {
27813
+ endIsValid = false;
27814
+ }
27815
+ if (startIsValid && endIsValid) return Interval.fromDateTimes(start, end);
27816
+ if (startIsValid) {
27817
+ const dur = Duration.fromISO(e, opts);
27818
+ if (dur.isValid) return Interval.after(start, dur);
27819
+ } else if (endIsValid) {
27820
+ const dur = Duration.fromISO(s, opts);
27821
+ if (dur.isValid) return Interval.before(end, dur);
27822
+ }
27823
+ }
27824
+ return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
27825
+ }
27826
+ static isInterval(o) {
27827
+ return o && o.isLuxonInterval || false;
27828
+ }
27829
+ get start() {
27830
+ return this.isValid ? this.s : null;
27831
+ }
27832
+ get end() {
27833
+ return this.isValid ? this.e : null;
27834
+ }
27835
+ get lastDateTime() {
27836
+ return this.isValid ? this.e ? this.e.minus(1) : null : null;
27837
+ }
27838
+ get isValid() {
27839
+ return null === this.invalidReason;
27840
+ }
27841
+ get invalidReason() {
27842
+ return this.invalid ? this.invalid.reason : null;
27843
+ }
27844
+ get invalidExplanation() {
27845
+ return this.invalid ? this.invalid.explanation : null;
27846
+ }
27847
+ length(unit = "milliseconds") {
27848
+ return this.isValid ? this.toDuration(unit).get(unit) : NaN;
27849
+ }
27850
+ count(unit = "milliseconds", opts) {
27851
+ if (!this.isValid) return NaN;
27852
+ const start = this.start.startOf(unit, opts);
27853
+ let end;
27854
+ end = opts?.useLocaleWeeks ? this.end.reconfigure({
27855
+ locale: start.locale
27856
+ }) : this.end;
27857
+ end = end.startOf(unit, opts);
27858
+ return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
27859
+ }
27860
+ hasSame(unit) {
27861
+ return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
27862
+ }
27863
+ isEmpty() {
27864
+ return this.s.valueOf() === this.e.valueOf();
27865
+ }
27866
+ isAfter(dateTime) {
27867
+ if (!this.isValid) return false;
27868
+ return this.s > dateTime;
27869
+ }
27870
+ isBefore(dateTime) {
27871
+ if (!this.isValid) return false;
27872
+ return this.e <= dateTime;
27873
+ }
27874
+ contains(dateTime) {
27875
+ if (!this.isValid) return false;
27876
+ return this.s <= dateTime && this.e > dateTime;
27877
+ }
27878
+ set({ start, end } = {}) {
27879
+ if (!this.isValid) return this;
27880
+ return Interval.fromDateTimes(start || this.s, end || this.e);
27881
+ }
27882
+ splitAt(...dateTimes) {
27883
+ if (!this.isValid) return [];
27884
+ const sorted = dateTimes.map(friendlyDateTime).filter((d)=>this.contains(d)).sort((a, b)=>a.toMillis() - b.toMillis()), results = [];
27885
+ let { s } = this, i = 0;
27886
+ while(s < this.e){
27887
+ const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added;
27888
+ results.push(Interval.fromDateTimes(s, next));
27889
+ s = next;
27890
+ i += 1;
27891
+ }
27892
+ return results;
27893
+ }
27894
+ splitBy(duration) {
27895
+ const dur = Duration.fromDurationLike(duration);
27896
+ if (!this.isValid || !dur.isValid || 0 === dur.as("milliseconds")) return [];
27897
+ let { s } = this, idx = 1, next;
27898
+ const results = [];
27899
+ while(s < this.e){
27900
+ const added = this.start.plus(dur.mapUnits((x)=>x * idx));
27901
+ next = +added > +this.e ? this.e : added;
27902
+ results.push(Interval.fromDateTimes(s, next));
27903
+ s = next;
27904
+ idx += 1;
27905
+ }
27906
+ return results;
27907
+ }
27908
+ divideEqually(numberOfParts) {
27909
+ if (!this.isValid) return [];
27910
+ return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
27911
+ }
27912
+ overlaps(other) {
27913
+ return this.e > other.s && this.s < other.e;
27914
+ }
27915
+ abutsStart(other) {
27916
+ if (!this.isValid) return false;
27917
+ return +this.e === +other.s;
27918
+ }
27919
+ abutsEnd(other) {
27920
+ if (!this.isValid) return false;
27921
+ return +other.e === +this.s;
27922
+ }
27923
+ engulfs(other) {
27924
+ if (!this.isValid) return false;
27925
+ return this.s <= other.s && this.e >= other.e;
27926
+ }
27927
+ equals(other) {
27928
+ if (!this.isValid || !other.isValid) return false;
27929
+ return this.s.equals(other.s) && this.e.equals(other.e);
27930
+ }
27931
+ intersection(other) {
27932
+ if (!this.isValid) return this;
27933
+ const s = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e;
27934
+ if (s >= e) return null;
27935
+ return Interval.fromDateTimes(s, e);
27936
+ }
27937
+ union(other) {
27938
+ if (!this.isValid) return this;
27939
+ const s = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e;
27940
+ return Interval.fromDateTimes(s, e);
27941
+ }
27942
+ static merge(intervals) {
27943
+ const [found, final] = intervals.sort((a, b)=>a.s - b.s).reduce(([sofar, current], item)=>{
27944
+ if (!current) return [
27945
+ sofar,
27946
+ item
27947
+ ];
27948
+ if (current.overlaps(item) || current.abutsStart(item)) return [
27949
+ sofar,
27950
+ current.union(item)
27951
+ ];
27952
+ return [
27953
+ sofar.concat([
27954
+ current
27955
+ ]),
27956
+ item
27957
+ ];
27958
+ }, [
27959
+ [],
27960
+ null
27961
+ ]);
27962
+ if (final) found.push(final);
27963
+ return found;
27964
+ }
27965
+ static xor(intervals) {
27966
+ let start = null, currentCount = 0;
27967
+ const results = [], ends = intervals.map((i)=>[
27968
+ {
27969
+ time: i.s,
27970
+ type: "s"
27971
+ },
27972
+ {
27973
+ time: i.e,
27974
+ type: "e"
27975
+ }
27976
+ ]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a, b)=>a.time - b.time);
27977
+ for (const i of arr){
27978
+ currentCount += "s" === i.type ? 1 : -1;
27979
+ if (1 === currentCount) start = i.time;
27980
+ else {
27981
+ if (start && +start !== +i.time) results.push(Interval.fromDateTimes(start, i.time));
27982
+ start = null;
27983
+ }
27984
+ }
27985
+ return Interval.merge(results);
27986
+ }
27987
+ difference(...intervals) {
27988
+ return Interval.xor([
27989
+ this
27990
+ ].concat(intervals)).map((i)=>this.intersection(i)).filter((i)=>i && !i.isEmpty());
27991
+ }
27992
+ toString() {
27993
+ if (!this.isValid) return INVALID$1;
27994
+ return `[${this.s.toISO()} – ${this.e.toISO()})`;
27995
+ }
27996
+ [Symbol.for("nodejs.util.inspect.custom")]() {
27997
+ if (this.isValid) return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
27998
+ return `Interval { Invalid, reason: ${this.invalidReason} }`;
27999
+ }
28000
+ toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
28001
+ return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1;
28002
+ }
28003
+ toISO(opts) {
28004
+ if (!this.isValid) return INVALID$1;
28005
+ return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;
28006
+ }
28007
+ toISODate() {
28008
+ if (!this.isValid) return INVALID$1;
28009
+ return `${this.s.toISODate()}/${this.e.toISODate()}`;
28010
+ }
28011
+ toISOTime(opts) {
28012
+ if (!this.isValid) return INVALID$1;
28013
+ return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;
28014
+ }
28015
+ toFormat(dateFormat, { separator = " – " } = {}) {
28016
+ if (!this.isValid) return INVALID$1;
28017
+ return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;
28018
+ }
28019
+ toDuration(unit, opts) {
28020
+ if (!this.isValid) return Duration.invalid(this.invalidReason);
28021
+ return this.e.diff(this.s, unit, opts);
28022
+ }
28023
+ mapEndpoints(mapFn) {
28024
+ return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
28025
+ }
28026
+ }
28027
+ class Info {
28028
+ static hasDST(zone = Settings.defaultZone) {
28029
+ const proto = DateTime.now().setZone(zone).set({
28030
+ month: 12
28031
+ });
28032
+ return !zone.isUniversal && proto.offset !== proto.set({
28033
+ month: 6
28034
+ }).offset;
28035
+ }
28036
+ static isValidIANAZone(zone) {
28037
+ return IANAZone.isValidZone(zone);
28038
+ }
28039
+ static normalizeZone(input) {
28040
+ return normalizeZone(input, Settings.defaultZone);
28041
+ }
28042
+ static getStartOfWeek({ locale = null, locObj = null } = {}) {
28043
+ return (locObj || Locale.create(locale)).getStartOfWeek();
28044
+ }
28045
+ static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {
28046
+ return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
28047
+ }
28048
+ static getWeekendWeekdays({ locale = null, locObj = null } = {}) {
28049
+ return (locObj || Locale.create(locale)).getWeekendDays().slice();
28050
+ }
28051
+ static months(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
28052
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
28053
+ }
28054
+ static monthsFormat(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
28055
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
28056
+ }
28057
+ static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
28058
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
28059
+ }
28060
+ static weekdaysFormat(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
28061
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
28062
+ }
28063
+ static meridiems({ locale = null } = {}) {
28064
+ return Locale.create(locale).meridiems();
28065
+ }
28066
+ static eras(length = "short", { locale = null } = {}) {
28067
+ return Locale.create(locale, null, "gregory").eras(length);
28068
+ }
28069
+ static features() {
28070
+ return {
28071
+ relative: hasRelative(),
28072
+ localeWeek: hasLocaleWeekInfo()
28073
+ };
28074
+ }
28075
+ }
28076
+ function dayDiff(earlier, later) {
28077
+ const utcDayStart = (dt)=>dt.toUTC(0, {
28078
+ keepLocalTime: true
28079
+ }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
28080
+ return Math.floor(Duration.fromMillis(ms).as("days"));
28081
+ }
28082
+ function highOrderDiffs(cursor, later, units) {
28083
+ const differs = [
28084
+ [
28085
+ "years",
28086
+ (a, b)=>b.year - a.year
28087
+ ],
28088
+ [
28089
+ "quarters",
28090
+ (a, b)=>b.quarter - a.quarter + (b.year - a.year) * 4
28091
+ ],
28092
+ [
28093
+ "months",
28094
+ (a, b)=>b.month - a.month + (b.year - a.year) * 12
28095
+ ],
28096
+ [
28097
+ "weeks",
28098
+ (a, b)=>{
28099
+ const days = dayDiff(a, b);
28100
+ return (days - days % 7) / 7;
28101
+ }
28102
+ ],
28103
+ [
28104
+ "days",
28105
+ dayDiff
28106
+ ]
28107
+ ];
28108
+ const results = {};
28109
+ const earlier = cursor;
28110
+ let lowestOrder, highWater;
28111
+ for (const [unit, differ] of differs)if (units.indexOf(unit) >= 0) {
28112
+ lowestOrder = unit;
28113
+ results[unit] = differ(cursor, later);
28114
+ highWater = earlier.plus(results);
28115
+ if (highWater > later) {
28116
+ results[unit]--;
28117
+ cursor = earlier.plus(results);
28118
+ if (cursor > later) {
28119
+ highWater = cursor;
28120
+ results[unit]--;
28121
+ cursor = earlier.plus(results);
28122
+ }
28123
+ } else cursor = highWater;
28124
+ }
28125
+ return [
28126
+ cursor,
28127
+ results,
28128
+ highWater,
28129
+ lowestOrder
28130
+ ];
28131
+ }
28132
+ function diff(earlier, later, units, opts) {
28133
+ let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);
28134
+ const remainingMillis = later - cursor;
28135
+ const lowerOrderUnits = units.filter((u)=>[
28136
+ "hours",
28137
+ "minutes",
28138
+ "seconds",
28139
+ "milliseconds"
28140
+ ].indexOf(u) >= 0);
28141
+ if (0 === lowerOrderUnits.length) {
28142
+ if (highWater < later) highWater = cursor.plus({
28143
+ [lowestOrder]: 1
28144
+ });
28145
+ if (highWater !== cursor) results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
28146
+ }
28147
+ const duration = Duration.fromObject(results, opts);
28148
+ if (lowerOrderUnits.length > 0) return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration);
28149
+ return duration;
28150
+ }
28151
+ const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
28152
+ function intUnit(regex, post = (i)=>i) {
28153
+ return {
28154
+ regex,
28155
+ deser: ([s])=>post(parseDigits(s))
28156
+ };
28157
+ }
28158
+ const NBSP = String.fromCharCode(160);
28159
+ const spaceOrNBSP = `[ ${NBSP}]`;
28160
+ const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
28161
+ function fixListRegex(s) {
28162
+ return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
28163
+ }
28164
+ function stripInsensitivities(s) {
28165
+ return s.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
28166
+ }
28167
+ function oneOf(strings, startIndex) {
28168
+ if (null === strings) return null;
28169
+ return {
28170
+ regex: RegExp(strings.map(fixListRegex).join("|")),
28171
+ deser: ([s])=>strings.findIndex((i)=>stripInsensitivities(s) === stripInsensitivities(i)) + startIndex
28172
+ };
28173
+ }
28174
+ function luxon_offset(regex, groups) {
28175
+ return {
28176
+ regex,
28177
+ deser: ([, h, m])=>signedOffset(h, m),
28178
+ groups
28179
+ };
28180
+ }
28181
+ function simple(regex) {
28182
+ return {
28183
+ regex,
28184
+ deser: ([s])=>s
28185
+ };
28186
+ }
28187
+ function escapeToken(value) {
28188
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
28189
+ }
28190
+ function unitForToken(token, loc) {
28191
+ const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t)=>({
28192
+ regex: RegExp(escapeToken(t.val)),
28193
+ deser: ([s])=>s,
28194
+ literal: true
28195
+ }), unitate = (t)=>{
28196
+ if (token.literal) return literal(t);
28197
+ switch(t.val){
28198
+ case "G":
28199
+ return oneOf(loc.eras("short"), 0);
28200
+ case "GG":
28201
+ return oneOf(loc.eras("long"), 0);
28202
+ case "y":
28203
+ return intUnit(oneToSix);
28204
+ case "yy":
28205
+ return intUnit(twoToFour, untruncateYear);
28206
+ case "yyyy":
28207
+ return intUnit(four);
28208
+ case "yyyyy":
28209
+ return intUnit(fourToSix);
28210
+ case "yyyyyy":
28211
+ return intUnit(six);
28212
+ case "M":
28213
+ return intUnit(oneOrTwo);
28214
+ case "MM":
28215
+ return intUnit(two);
28216
+ case "MMM":
28217
+ return oneOf(loc.months("short", true), 1);
28218
+ case "MMMM":
28219
+ return oneOf(loc.months("long", true), 1);
28220
+ case "L":
28221
+ return intUnit(oneOrTwo);
28222
+ case "LL":
28223
+ return intUnit(two);
28224
+ case "LLL":
28225
+ return oneOf(loc.months("short", false), 1);
28226
+ case "LLLL":
28227
+ return oneOf(loc.months("long", false), 1);
28228
+ case "d":
28229
+ return intUnit(oneOrTwo);
28230
+ case "dd":
28231
+ return intUnit(two);
28232
+ case "o":
28233
+ return intUnit(oneToThree);
28234
+ case "ooo":
28235
+ return intUnit(three);
28236
+ case "HH":
28237
+ return intUnit(two);
28238
+ case "H":
28239
+ return intUnit(oneOrTwo);
28240
+ case "hh":
28241
+ return intUnit(two);
28242
+ case "h":
28243
+ return intUnit(oneOrTwo);
28244
+ case "mm":
28245
+ return intUnit(two);
28246
+ case "m":
28247
+ return intUnit(oneOrTwo);
28248
+ case "q":
28249
+ return intUnit(oneOrTwo);
28250
+ case "qq":
28251
+ return intUnit(two);
28252
+ case "s":
28253
+ return intUnit(oneOrTwo);
28254
+ case "ss":
28255
+ return intUnit(two);
28256
+ case "S":
28257
+ return intUnit(oneToThree);
28258
+ case "SSS":
28259
+ return intUnit(three);
28260
+ case "u":
28261
+ return simple(oneToNine);
28262
+ case "uu":
28263
+ return simple(oneOrTwo);
28264
+ case "uuu":
28265
+ return intUnit(one);
28266
+ case "a":
28267
+ return oneOf(loc.meridiems(), 0);
28268
+ case "kkkk":
28269
+ return intUnit(four);
28270
+ case "kk":
28271
+ return intUnit(twoToFour, untruncateYear);
28272
+ case "W":
28273
+ return intUnit(oneOrTwo);
28274
+ case "WW":
28275
+ return intUnit(two);
28276
+ case "E":
28277
+ case "c":
28278
+ return intUnit(one);
28279
+ case "EEE":
28280
+ return oneOf(loc.weekdays("short", false), 1);
28281
+ case "EEEE":
28282
+ return oneOf(loc.weekdays("long", false), 1);
28283
+ case "ccc":
28284
+ return oneOf(loc.weekdays("short", true), 1);
28285
+ case "cccc":
28286
+ return oneOf(loc.weekdays("long", true), 1);
28287
+ case "Z":
28288
+ case "ZZ":
28289
+ return luxon_offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);
28290
+ case "ZZZ":
28291
+ return luxon_offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);
28292
+ case "z":
28293
+ return simple(/[a-z_+-/]{1,256}?/i);
28294
+ case " ":
28295
+ return simple(/[^\S\n\r]/);
28296
+ default:
28297
+ return literal(t);
28298
+ }
28299
+ };
28300
+ const unit = unitate(token) || {
28301
+ invalidReason: MISSING_FTP
28302
+ };
28303
+ unit.token = token;
28304
+ return unit;
28305
+ }
28306
+ const partTypeStyleToTokenVal = {
28307
+ year: {
28308
+ "2-digit": "yy",
28309
+ numeric: "yyyyy"
28310
+ },
28311
+ month: {
28312
+ numeric: "M",
28313
+ "2-digit": "MM",
28314
+ short: "MMM",
28315
+ long: "MMMM"
28316
+ },
28317
+ day: {
28318
+ numeric: "d",
28319
+ "2-digit": "dd"
28320
+ },
28321
+ weekday: {
28322
+ short: "EEE",
28323
+ long: "EEEE"
28324
+ },
28325
+ dayperiod: "a",
28326
+ dayPeriod: "a",
28327
+ hour12: {
28328
+ numeric: "h",
28329
+ "2-digit": "hh"
28330
+ },
28331
+ hour24: {
28332
+ numeric: "H",
28333
+ "2-digit": "HH"
28334
+ },
28335
+ minute: {
28336
+ numeric: "m",
28337
+ "2-digit": "mm"
28338
+ },
28339
+ second: {
28340
+ numeric: "s",
28341
+ "2-digit": "ss"
28342
+ },
28343
+ timeZoneName: {
28344
+ long: "ZZZZZ",
28345
+ short: "ZZZ"
28346
+ }
28347
+ };
28348
+ function tokenForPart(part, formatOpts, resolvedOpts) {
28349
+ const { type, value } = part;
28350
+ if ("literal" === type) {
28351
+ const isSpace = /^\s+$/.test(value);
28352
+ return {
28353
+ literal: !isSpace,
28354
+ val: isSpace ? " " : value
28355
+ };
28356
+ }
28357
+ const style = formatOpts[type];
28358
+ let actualType = type;
28359
+ if ("hour" === type) actualType = null != formatOpts.hour12 ? formatOpts.hour12 ? "hour12" : "hour24" : null != formatOpts.hourCycle ? "h11" === formatOpts.hourCycle || "h12" === formatOpts.hourCycle ? "hour12" : "hour24" : resolvedOpts.hour12 ? "hour12" : "hour24";
28360
+ let val = partTypeStyleToTokenVal[actualType];
28361
+ if ("object" == typeof val) val = val[style];
28362
+ if (val) return {
28363
+ literal: false,
28364
+ val
28365
+ };
28366
+ }
28367
+ function buildRegex(units) {
28368
+ const re = units.map((u)=>u.regex).reduce((f, r)=>`${f}(${r.source})`, "");
28369
+ return [
28370
+ `^${re}$`,
28371
+ units
28372
+ ];
28373
+ }
28374
+ function luxon_match(input, regex, handlers) {
28375
+ const matches = input.match(regex);
28376
+ if (!matches) return [
28377
+ matches,
28378
+ {}
28379
+ ];
28380
+ {
28381
+ const all = {};
28382
+ let matchIndex = 1;
28383
+ for(const i in handlers)if (luxon_hasOwnProperty(handlers, i)) {
28384
+ const h = handlers[i], groups = h.groups ? h.groups + 1 : 1;
28385
+ if (!h.literal && h.token) all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));
28386
+ matchIndex += groups;
28387
+ }
28388
+ return [
28389
+ matches,
28390
+ all
28391
+ ];
28392
+ }
28393
+ }
28394
+ function dateTimeFromMatches(matches) {
28395
+ const toField = (token)=>{
28396
+ switch(token){
28397
+ case "S":
28398
+ return "millisecond";
28399
+ case "s":
28400
+ return "second";
28401
+ case "m":
28402
+ return "minute";
28403
+ case "h":
28404
+ case "H":
28405
+ return "hour";
28406
+ case "d":
28407
+ return "day";
28408
+ case "o":
28409
+ return "ordinal";
28410
+ case "L":
28411
+ case "M":
28412
+ return "month";
28413
+ case "y":
28414
+ return "year";
28415
+ case "E":
28416
+ case "c":
28417
+ return "weekday";
28418
+ case "W":
28419
+ return "weekNumber";
28420
+ case "k":
28421
+ return "weekYear";
28422
+ case "q":
28423
+ return "quarter";
28424
+ default:
28425
+ return null;
28426
+ }
28427
+ };
28428
+ let zone = null;
28429
+ let specificOffset;
28430
+ if (!isUndefined(matches.z)) zone = IANAZone.create(matches.z);
28431
+ if (!isUndefined(matches.Z)) {
28432
+ if (!zone) zone = new FixedOffsetZone(matches.Z);
28433
+ specificOffset = matches.Z;
28434
+ }
28435
+ if (!isUndefined(matches.q)) matches.M = (matches.q - 1) * 3 + 1;
28436
+ if (!isUndefined(matches.h)) {
28437
+ if (matches.h < 12 && 1 === matches.a) matches.h += 12;
28438
+ else if (12 === matches.h && 0 === matches.a) matches.h = 0;
28439
+ }
28440
+ if (0 === matches.G && matches.y) matches.y = -matches.y;
28441
+ if (!isUndefined(matches.u)) matches.S = parseMillis(matches.u);
28442
+ const vals = Object.keys(matches).reduce((r, k)=>{
28443
+ const f = toField(k);
28444
+ if (f) r[f] = matches[k];
28445
+ return r;
28446
+ }, {});
28447
+ return [
28448
+ vals,
28449
+ zone,
28450
+ specificOffset
28451
+ ];
28452
+ }
28453
+ let dummyDateTimeCache = null;
28454
+ function getDummyDateTime() {
28455
+ if (!dummyDateTimeCache) dummyDateTimeCache = DateTime.fromMillis(1555555555555);
28456
+ return dummyDateTimeCache;
28457
+ }
28458
+ function maybeExpandMacroToken(token, locale) {
28459
+ if (token.literal) return token;
28460
+ const formatOpts = Formatter.macroTokenToFormatOpts(token.val);
28461
+ const tokens = formatOptsToTokens(formatOpts, locale);
28462
+ if (null == tokens || tokens.includes(void 0)) return token;
28463
+ return tokens;
28464
+ }
28465
+ function expandMacroTokens(tokens, locale) {
28466
+ return Array.prototype.concat(...tokens.map((t)=>maybeExpandMacroToken(t, locale)));
28467
+ }
28468
+ class TokenParser {
28469
+ constructor(locale, format){
28470
+ this.locale = locale;
28471
+ this.format = format;
28472
+ this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);
28473
+ this.units = this.tokens.map((t)=>unitForToken(t, locale));
28474
+ this.disqualifyingUnit = this.units.find((t)=>t.invalidReason);
28475
+ if (!this.disqualifyingUnit) {
28476
+ const [regexString, handlers] = buildRegex(this.units);
28477
+ this.regex = RegExp(regexString, "i");
28478
+ this.handlers = handlers;
28479
+ }
28480
+ }
28481
+ explainFromTokens(input) {
28482
+ if (!this.isValid) return {
28483
+ input,
28484
+ tokens: this.tokens,
28485
+ invalidReason: this.invalidReason
28486
+ };
28487
+ {
28488
+ const [rawMatches, matches] = luxon_match(input, this.regex, this.handlers), [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [
28489
+ null,
28490
+ null,
28491
+ void 0
28492
+ ];
28493
+ if (luxon_hasOwnProperty(matches, "a") && luxon_hasOwnProperty(matches, "H")) throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");
28494
+ return {
28495
+ input,
28496
+ tokens: this.tokens,
28497
+ regex: this.regex,
28498
+ rawMatches,
28499
+ matches,
28500
+ result,
28501
+ zone,
28502
+ specificOffset
28503
+ };
28504
+ }
28505
+ }
28506
+ get isValid() {
28507
+ return !this.disqualifyingUnit;
28508
+ }
28509
+ get invalidReason() {
28510
+ return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;
28511
+ }
28512
+ }
28513
+ function explainFromTokens(locale, input, format) {
28514
+ const parser = new TokenParser(locale, format);
28515
+ return parser.explainFromTokens(input);
28516
+ }
28517
+ function parseFromTokens(locale, input, format) {
28518
+ const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);
28519
+ return [
28520
+ result,
28521
+ zone,
28522
+ specificOffset,
28523
+ invalidReason
28524
+ ];
28525
+ }
28526
+ function formatOptsToTokens(formatOpts, locale) {
28527
+ if (!formatOpts) return null;
28528
+ const formatter = Formatter.create(locale, formatOpts);
28529
+ const df = formatter.dtFormatter(getDummyDateTime());
28530
+ const parts = df.formatToParts();
28531
+ const resolvedOpts = df.resolvedOptions();
28532
+ return parts.map((p)=>tokenForPart(p, formatOpts, resolvedOpts));
28533
+ }
28534
+ const INVALID = "Invalid DateTime";
28535
+ const MAX_DATE = 8.64e15;
28536
+ function unsupportedZone(zone) {
28537
+ return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
28538
+ }
28539
+ function possiblyCachedWeekData(dt) {
28540
+ if (null === dt.weekData) dt.weekData = gregorianToWeek(dt.c);
28541
+ return dt.weekData;
28542
+ }
28543
+ function possiblyCachedLocalWeekData(dt) {
28544
+ if (null === dt.localWeekData) dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
28545
+ return dt.localWeekData;
28546
+ }
28547
+ function clone(inst, alts) {
28548
+ const current = {
28549
+ ts: inst.ts,
28550
+ zone: inst.zone,
28551
+ c: inst.c,
28552
+ o: inst.o,
28553
+ loc: inst.loc,
28554
+ invalid: inst.invalid
28555
+ };
28556
+ return new DateTime({
28557
+ ...current,
28558
+ ...alts,
28559
+ old: current
28560
+ });
28561
+ }
28562
+ function fixOffset(localTS, o, tz) {
28563
+ let utcGuess = localTS - 60 * o * 1000;
28564
+ const o2 = tz.offset(utcGuess);
28565
+ if (o === o2) return [
28566
+ utcGuess,
28567
+ o
28568
+ ];
28569
+ utcGuess -= (o2 - o) * 60000;
28570
+ const o3 = tz.offset(utcGuess);
28571
+ if (o2 === o3) return [
28572
+ utcGuess,
28573
+ o2
28574
+ ];
28575
+ return [
28576
+ localTS - 60 * Math.min(o2, o3) * 1000,
28577
+ Math.max(o2, o3)
28578
+ ];
28579
+ }
28580
+ function tsToObj(ts, offset) {
28581
+ ts += 60 * offset * 1000;
28582
+ const d = new Date(ts);
28583
+ return {
28584
+ year: d.getUTCFullYear(),
28585
+ month: d.getUTCMonth() + 1,
28586
+ day: d.getUTCDate(),
28587
+ hour: d.getUTCHours(),
28588
+ minute: d.getUTCMinutes(),
28589
+ second: d.getUTCSeconds(),
28590
+ millisecond: d.getUTCMilliseconds()
28591
+ };
28592
+ }
28593
+ function objToTS(obj, offset, zone) {
28594
+ return fixOffset(objToLocalTS(obj), offset, zone);
28595
+ }
28596
+ function adjustTime(inst, dur) {
28597
+ const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + 3 * Math.trunc(dur.quarters), c = {
28598
+ ...inst.c,
28599
+ year,
28600
+ month,
28601
+ day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + 7 * Math.trunc(dur.weeks)
28602
+ }, millisToAdd = Duration.fromObject({
28603
+ years: dur.years - Math.trunc(dur.years),
28604
+ quarters: dur.quarters - Math.trunc(dur.quarters),
28605
+ months: dur.months - Math.trunc(dur.months),
28606
+ weeks: dur.weeks - Math.trunc(dur.weeks),
28607
+ days: dur.days - Math.trunc(dur.days),
28608
+ hours: dur.hours,
28609
+ minutes: dur.minutes,
28610
+ seconds: dur.seconds,
28611
+ milliseconds: dur.milliseconds
28612
+ }).as("milliseconds"), localTS = objToLocalTS(c);
28613
+ let [ts, o] = fixOffset(localTS, oPre, inst.zone);
28614
+ if (0 !== millisToAdd) {
28615
+ ts += millisToAdd;
28616
+ o = inst.zone.offset(ts);
28617
+ }
28618
+ return {
28619
+ ts,
28620
+ o
28621
+ };
28622
+ }
28623
+ function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {
28624
+ const { setZone, zone } = opts;
28625
+ if ((!parsed || 0 === Object.keys(parsed).length) && !parsedZone) return DateTime.invalid(new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`));
28626
+ {
28627
+ const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, {
28628
+ ...opts,
28629
+ zone: interpretationZone,
28630
+ specificOffset
28631
+ });
28632
+ return setZone ? inst : inst.setZone(zone);
28633
+ }
28634
+ }
28635
+ function toTechFormat(dt, format, allowZ = true) {
28636
+ return dt.isValid ? Formatter.create(Locale.create("en-US"), {
28637
+ allowZ,
28638
+ forceSimple: true
28639
+ }).formatDateTimeFromString(dt, format) : null;
28640
+ }
28641
+ function toISODate(o, extended, precision) {
28642
+ const longFormat = o.c.year > 9999 || o.c.year < 0;
28643
+ let c = "";
28644
+ if (longFormat && o.c.year >= 0) c += "+";
28645
+ c += padStart(o.c.year, longFormat ? 6 : 4);
28646
+ if ("year" === precision) return c;
28647
+ if (extended) {
28648
+ c += "-";
28649
+ c += padStart(o.c.month);
28650
+ if ("month" === precision) return c;
28651
+ c += "-";
28652
+ } else {
28653
+ c += padStart(o.c.month);
28654
+ if ("month" === precision) return c;
28655
+ }
28656
+ c += padStart(o.c.day);
28657
+ return c;
28658
+ }
28659
+ function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) {
28660
+ let showSeconds = !suppressSeconds || 0 !== o.c.millisecond || 0 !== o.c.second, c = "";
28661
+ switch(precision){
28662
+ case "day":
28663
+ case "month":
28664
+ case "year":
28665
+ break;
28666
+ default:
28667
+ c += padStart(o.c.hour);
28668
+ if ("hour" === precision) break;
28669
+ if (extended) {
28670
+ c += ":";
28671
+ c += padStart(o.c.minute);
28672
+ if ("minute" === precision) break;
28673
+ if (showSeconds) {
28674
+ c += ":";
28675
+ c += padStart(o.c.second);
28676
+ }
28677
+ } else {
28678
+ c += padStart(o.c.minute);
28679
+ if ("minute" === precision) break;
28680
+ if (showSeconds) c += padStart(o.c.second);
28681
+ }
28682
+ if ("second" === precision) break;
28683
+ if (showSeconds && (!suppressMilliseconds || 0 !== o.c.millisecond)) {
28684
+ c += ".";
28685
+ c += padStart(o.c.millisecond, 3);
28686
+ }
28687
+ }
28688
+ if (includeOffset) if (o.isOffsetFixed && 0 === o.offset && !extendedZone) c += "Z";
28689
+ else if (o.o < 0) {
28690
+ c += "-";
28691
+ c += padStart(Math.trunc(-o.o / 60));
28692
+ c += ":";
28693
+ c += padStart(Math.trunc(-o.o % 60));
28694
+ } else {
28695
+ c += "+";
28696
+ c += padStart(Math.trunc(o.o / 60));
28697
+ c += ":";
28698
+ c += padStart(Math.trunc(o.o % 60));
28699
+ }
28700
+ if (extendedZone) c += "[" + o.zone.ianaName + "]";
28701
+ return c;
28702
+ }
28703
+ const defaultUnitValues = {
28704
+ month: 1,
28705
+ day: 1,
28706
+ hour: 0,
28707
+ minute: 0,
28708
+ second: 0,
28709
+ millisecond: 0
28710
+ }, defaultWeekUnitValues = {
28711
+ weekNumber: 1,
28712
+ weekday: 1,
28713
+ hour: 0,
28714
+ minute: 0,
28715
+ second: 0,
28716
+ millisecond: 0
28717
+ }, defaultOrdinalUnitValues = {
28718
+ ordinal: 1,
28719
+ hour: 0,
28720
+ minute: 0,
28721
+ second: 0,
28722
+ millisecond: 0
28723
+ };
28724
+ const orderedUnits = [
28725
+ "year",
28726
+ "month",
28727
+ "day",
28728
+ "hour",
28729
+ "minute",
28730
+ "second",
28731
+ "millisecond"
28732
+ ], orderedWeekUnits = [
28733
+ "weekYear",
28734
+ "weekNumber",
28735
+ "weekday",
28736
+ "hour",
28737
+ "minute",
28738
+ "second",
28739
+ "millisecond"
28740
+ ], orderedOrdinalUnits = [
28741
+ "year",
28742
+ "ordinal",
28743
+ "hour",
28744
+ "minute",
28745
+ "second",
28746
+ "millisecond"
28747
+ ];
28748
+ function normalizeUnit(unit) {
28749
+ const normalized = {
28750
+ year: "year",
28751
+ years: "year",
28752
+ month: "month",
28753
+ months: "month",
28754
+ day: "day",
28755
+ days: "day",
28756
+ hour: "hour",
28757
+ hours: "hour",
28758
+ minute: "minute",
28759
+ minutes: "minute",
28760
+ quarter: "quarter",
28761
+ quarters: "quarter",
28762
+ second: "second",
28763
+ seconds: "second",
28764
+ millisecond: "millisecond",
28765
+ milliseconds: "millisecond",
28766
+ weekday: "weekday",
28767
+ weekdays: "weekday",
28768
+ weeknumber: "weekNumber",
28769
+ weeksnumber: "weekNumber",
28770
+ weeknumbers: "weekNumber",
28771
+ weekyear: "weekYear",
28772
+ weekyears: "weekYear",
28773
+ ordinal: "ordinal"
28774
+ }[unit.toLowerCase()];
28775
+ if (!normalized) throw new InvalidUnitError(unit);
28776
+ return normalized;
28777
+ }
28778
+ function normalizeUnitWithLocalWeeks(unit) {
28779
+ switch(unit.toLowerCase()){
28780
+ case "localweekday":
28781
+ case "localweekdays":
28782
+ return "localWeekday";
28783
+ case "localweeknumber":
28784
+ case "localweeknumbers":
28785
+ return "localWeekNumber";
28786
+ case "localweekyear":
28787
+ case "localweekyears":
28788
+ return "localWeekYear";
28789
+ default:
28790
+ return normalizeUnit(unit);
28791
+ }
28792
+ }
28793
+ function guessOffsetForZone(zone) {
28794
+ if (void 0 === zoneOffsetTs) zoneOffsetTs = Settings.now();
28795
+ if ("iana" !== zone.type) return zone.offset(zoneOffsetTs);
28796
+ const zoneName = zone.name;
28797
+ let offsetGuess = zoneOffsetGuessCache.get(zoneName);
28798
+ if (void 0 === offsetGuess) {
28799
+ offsetGuess = zone.offset(zoneOffsetTs);
28800
+ zoneOffsetGuessCache.set(zoneName, offsetGuess);
28801
+ }
28802
+ return offsetGuess;
28803
+ }
28804
+ function quickDT(obj, opts) {
28805
+ const zone = normalizeZone(opts.zone, Settings.defaultZone);
28806
+ if (!zone.isValid) return DateTime.invalid(unsupportedZone(zone));
28807
+ const loc = Locale.fromObject(opts);
28808
+ let ts, o;
28809
+ if (isUndefined(obj.year)) ts = Settings.now();
28810
+ else {
28811
+ for (const u of orderedUnits)if (isUndefined(obj[u])) obj[u] = defaultUnitValues[u];
28812
+ const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
28813
+ if (invalid) return DateTime.invalid(invalid);
28814
+ const offsetProvis = guessOffsetForZone(zone);
28815
+ [ts, o] = objToTS(obj, offsetProvis, zone);
28816
+ }
28817
+ return new DateTime({
28818
+ ts,
28819
+ zone,
28820
+ loc,
28821
+ o
28822
+ });
28823
+ }
28824
+ function diffRelative(start, end, opts) {
28825
+ const round = isUndefined(opts.round) ? true : opts.round, rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, format = (c, unit)=>{
28826
+ c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
28827
+ const formatter = end.loc.clone(opts).relFormatter(opts);
28828
+ return formatter.format(c, unit);
28829
+ }, differ = (unit)=>{
28830
+ if (!opts.calendary) return end.diff(start, unit).get(unit);
28831
+ if (!end.hasSame(start, unit)) return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);
28832
+ return 0;
28833
+ };
28834
+ if (opts.unit) return format(differ(opts.unit), opts.unit);
28835
+ for (const unit of opts.units){
28836
+ const count = differ(unit);
28837
+ if (Math.abs(count) >= 1) return format(count, unit);
28838
+ }
28839
+ return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
28840
+ }
28841
+ function lastOpts(argList) {
28842
+ let opts = {}, args;
28843
+ if (argList.length > 0 && "object" == typeof argList[argList.length - 1]) {
28844
+ opts = argList[argList.length - 1];
28845
+ args = Array.from(argList).slice(0, argList.length - 1);
28846
+ } else args = Array.from(argList);
28847
+ return [
28848
+ opts,
28849
+ args
28850
+ ];
28851
+ }
28852
+ let zoneOffsetTs;
28853
+ const zoneOffsetGuessCache = new Map();
28854
+ class DateTime {
28855
+ constructor(config){
28856
+ const zone = config.zone || Settings.defaultZone;
28857
+ let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (zone.isValid ? null : unsupportedZone(zone));
28858
+ this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
28859
+ let c = null, o = null;
28860
+ if (!invalid) {
28861
+ const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
28862
+ if (unchanged) [c, o] = [
28863
+ config.old.c,
28864
+ config.old.o
28865
+ ];
28866
+ else {
28867
+ const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);
28868
+ c = tsToObj(this.ts, ot);
28869
+ invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null;
28870
+ c = invalid ? null : c;
28871
+ o = invalid ? null : ot;
28872
+ }
28873
+ }
28874
+ this._zone = zone;
28875
+ this.loc = config.loc || Locale.create();
28876
+ this.invalid = invalid;
28877
+ this.weekData = null;
28878
+ this.localWeekData = null;
28879
+ this.c = c;
28880
+ this.o = o;
28881
+ this.isLuxonDateTime = true;
28882
+ }
28883
+ static now() {
28884
+ return new DateTime({});
28885
+ }
28886
+ static local() {
28887
+ const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
28888
+ return quickDT({
28889
+ year,
28890
+ month,
28891
+ day,
28892
+ hour,
28893
+ minute,
28894
+ second,
28895
+ millisecond
28896
+ }, opts);
28897
+ }
28898
+ static utc() {
28899
+ const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
28900
+ opts.zone = FixedOffsetZone.utcInstance;
28901
+ return quickDT({
28902
+ year,
28903
+ month,
28904
+ day,
28905
+ hour,
28906
+ minute,
28907
+ second,
28908
+ millisecond
28909
+ }, opts);
28910
+ }
28911
+ static fromJSDate(date, options = {}) {
28912
+ const ts = isDate(date) ? date.valueOf() : NaN;
28913
+ if (Number.isNaN(ts)) return DateTime.invalid("invalid input");
28914
+ const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
28915
+ if (!zoneToUse.isValid) return DateTime.invalid(unsupportedZone(zoneToUse));
28916
+ return new DateTime({
28917
+ ts: ts,
28918
+ zone: zoneToUse,
28919
+ loc: Locale.fromObject(options)
28920
+ });
28921
+ }
28922
+ static fromMillis(milliseconds, options = {}) {
28923
+ if (isNumber(milliseconds)) if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) return DateTime.invalid("Timestamp out of range");
28924
+ else return new DateTime({
28925
+ ts: milliseconds,
28926
+ zone: normalizeZone(options.zone, Settings.defaultZone),
28927
+ loc: Locale.fromObject(options)
28928
+ });
28929
+ throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`);
28930
+ }
28931
+ static fromSeconds(seconds, options = {}) {
28932
+ if (isNumber(seconds)) return new DateTime({
28933
+ ts: 1000 * seconds,
28934
+ zone: normalizeZone(options.zone, Settings.defaultZone),
28935
+ loc: Locale.fromObject(options)
28936
+ });
28937
+ throw new InvalidArgumentError("fromSeconds requires a numerical input");
28938
+ }
28939
+ static fromObject(obj, opts = {}) {
28940
+ obj = obj || {};
28941
+ const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);
28942
+ if (!zoneToUse.isValid) return DateTime.invalid(unsupportedZone(zoneToUse));
28943
+ const loc = Locale.fromObject(opts);
28944
+ const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
28945
+ const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);
28946
+ const tsNow = Settings.now(), offsetProvis = isUndefined(opts.specificOffset) ? zoneToUse.offset(tsNow) : opts.specificOffset, containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
28947
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
28948
+ if (containsGregorMD && containsOrdinal) throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
28949
+ const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
28950
+ let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis);
28951
+ if (useWeekData) {
28952
+ units = orderedWeekUnits;
28953
+ defaultValues = defaultWeekUnitValues;
28954
+ objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
28955
+ } else if (containsOrdinal) {
28956
+ units = orderedOrdinalUnits;
28957
+ defaultValues = defaultOrdinalUnitValues;
28958
+ objNow = gregorianToOrdinal(objNow);
28959
+ } else {
28960
+ units = orderedUnits;
28961
+ defaultValues = defaultUnitValues;
28962
+ }
28963
+ let foundFirst = false;
28964
+ for (const u of units){
28965
+ const v = normalized[u];
28966
+ if (isUndefined(v)) if (foundFirst) normalized[u] = defaultValues[u];
28967
+ else normalized[u] = objNow[u];
28968
+ else foundFirst = true;
28969
+ }
28970
+ const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
28971
+ if (invalid) return DateTime.invalid(invalid);
28972
+ const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({
28973
+ ts: tsFinal,
28974
+ zone: zoneToUse,
28975
+ o: offsetFinal,
28976
+ loc
28977
+ });
28978
+ if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) return DateTime.invalid("mismatched weekday", `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`);
28979
+ if (!inst.isValid) return DateTime.invalid(inst.invalid);
28980
+ return inst;
28981
+ }
28982
+ static fromISO(text, opts = {}) {
28983
+ const [vals, parsedZone] = parseISODate(text);
28984
+ return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text);
28985
+ }
28986
+ static fromRFC2822(text, opts = {}) {
28987
+ const [vals, parsedZone] = parseRFC2822Date(text);
28988
+ return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text);
28989
+ }
28990
+ static fromHTTP(text, opts = {}) {
28991
+ const [vals, parsedZone] = parseHTTPDate(text);
28992
+ return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
28993
+ }
28994
+ static fromFormat(text, fmt, opts = {}) {
28995
+ if (isUndefined(text) || isUndefined(fmt)) throw new InvalidArgumentError("fromFormat requires an input string and a format");
28996
+ const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
28997
+ locale,
28998
+ numberingSystem,
28999
+ defaultToEN: true
29000
+ }), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);
29001
+ if (invalid) return DateTime.invalid(invalid);
29002
+ return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);
29003
+ }
29004
+ static fromString(text, fmt, opts = {}) {
29005
+ return DateTime.fromFormat(text, fmt, opts);
29006
+ }
29007
+ static fromSQL(text, opts = {}) {
29008
+ const [vals, parsedZone] = parseSQL(text);
29009
+ return parseDataToDateTime(vals, parsedZone, opts, "SQL", text);
29010
+ }
29011
+ static invalid(reason, explanation = null) {
29012
+ if (!reason) throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");
29013
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
29014
+ if (!Settings.throwOnInvalid) return new DateTime({
29015
+ invalid
29016
+ });
29017
+ throw new InvalidDateTimeError(invalid);
29018
+ }
29019
+ static isDateTime(o) {
29020
+ return o && o.isLuxonDateTime || false;
29021
+ }
29022
+ static parseFormatForOpts(formatOpts, localeOpts = {}) {
29023
+ const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
29024
+ return tokenList ? tokenList.map((t)=>t ? t.val : null).join("") : null;
29025
+ }
29026
+ static expandFormat(fmt, localeOpts = {}) {
29027
+ const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
29028
+ return expanded.map((t)=>t.val).join("");
29029
+ }
29030
+ static resetCache() {
29031
+ zoneOffsetTs = void 0;
29032
+ zoneOffsetGuessCache.clear();
29033
+ }
29034
+ get(unit) {
29035
+ return this[unit];
29036
+ }
29037
+ get isValid() {
29038
+ return null === this.invalid;
29039
+ }
29040
+ get invalidReason() {
29041
+ return this.invalid ? this.invalid.reason : null;
29042
+ }
29043
+ get invalidExplanation() {
29044
+ return this.invalid ? this.invalid.explanation : null;
29045
+ }
29046
+ get locale() {
29047
+ return this.isValid ? this.loc.locale : null;
29048
+ }
29049
+ get numberingSystem() {
29050
+ return this.isValid ? this.loc.numberingSystem : null;
29051
+ }
29052
+ get outputCalendar() {
29053
+ return this.isValid ? this.loc.outputCalendar : null;
29054
+ }
29055
+ get zone() {
29056
+ return this._zone;
29057
+ }
29058
+ get zoneName() {
29059
+ return this.isValid ? this.zone.name : null;
29060
+ }
29061
+ get year() {
29062
+ return this.isValid ? this.c.year : NaN;
29063
+ }
29064
+ get quarter() {
29065
+ return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
29066
+ }
29067
+ get month() {
29068
+ return this.isValid ? this.c.month : NaN;
29069
+ }
29070
+ get day() {
29071
+ return this.isValid ? this.c.day : NaN;
29072
+ }
29073
+ get hour() {
29074
+ return this.isValid ? this.c.hour : NaN;
29075
+ }
29076
+ get minute() {
29077
+ return this.isValid ? this.c.minute : NaN;
29078
+ }
29079
+ get second() {
29080
+ return this.isValid ? this.c.second : NaN;
29081
+ }
29082
+ get millisecond() {
29083
+ return this.isValid ? this.c.millisecond : NaN;
29084
+ }
29085
+ get weekYear() {
29086
+ return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
29087
+ }
29088
+ get weekNumber() {
29089
+ return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
29090
+ }
29091
+ get weekday() {
29092
+ return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
29093
+ }
29094
+ get isWeekend() {
29095
+ return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
29096
+ }
29097
+ get localWeekday() {
29098
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
29099
+ }
29100
+ get localWeekNumber() {
29101
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
29102
+ }
29103
+ get localWeekYear() {
29104
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
29105
+ }
29106
+ get ordinal() {
29107
+ return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
29108
+ }
29109
+ get monthShort() {
29110
+ return this.isValid ? Info.months("short", {
29111
+ locObj: this.loc
29112
+ })[this.month - 1] : null;
29113
+ }
29114
+ get monthLong() {
29115
+ return this.isValid ? Info.months("long", {
29116
+ locObj: this.loc
29117
+ })[this.month - 1] : null;
29118
+ }
29119
+ get weekdayShort() {
29120
+ return this.isValid ? Info.weekdays("short", {
29121
+ locObj: this.loc
29122
+ })[this.weekday - 1] : null;
29123
+ }
29124
+ get weekdayLong() {
29125
+ return this.isValid ? Info.weekdays("long", {
29126
+ locObj: this.loc
29127
+ })[this.weekday - 1] : null;
29128
+ }
29129
+ get offset() {
29130
+ return this.isValid ? +this.o : NaN;
29131
+ }
29132
+ get offsetNameShort() {
29133
+ if (this.isValid) return this.zone.offsetName(this.ts, {
29134
+ format: "short",
29135
+ locale: this.locale
29136
+ });
29137
+ return null;
29138
+ }
29139
+ get offsetNameLong() {
29140
+ if (this.isValid) return this.zone.offsetName(this.ts, {
29141
+ format: "long",
29142
+ locale: this.locale
29143
+ });
29144
+ return null;
29145
+ }
29146
+ get isOffsetFixed() {
29147
+ return this.isValid ? this.zone.isUniversal : null;
29148
+ }
29149
+ get isInDST() {
29150
+ if (this.isOffsetFixed) return false;
29151
+ return this.offset > this.set({
29152
+ month: 1,
29153
+ day: 1
29154
+ }).offset || this.offset > this.set({
29155
+ month: 5
29156
+ }).offset;
29157
+ }
29158
+ getPossibleOffsets() {
29159
+ if (!this.isValid || this.isOffsetFixed) return [
29160
+ this
29161
+ ];
29162
+ const dayMs = 86400000;
29163
+ const minuteMs = 60000;
29164
+ const localTS = objToLocalTS(this.c);
29165
+ const oEarlier = this.zone.offset(localTS - dayMs);
29166
+ const oLater = this.zone.offset(localTS + dayMs);
29167
+ const o1 = this.zone.offset(localTS - oEarlier * minuteMs);
29168
+ const o2 = this.zone.offset(localTS - oLater * minuteMs);
29169
+ if (o1 === o2) return [
29170
+ this
29171
+ ];
29172
+ const ts1 = localTS - o1 * minuteMs;
29173
+ const ts2 = localTS - o2 * minuteMs;
29174
+ const c1 = tsToObj(ts1, o1);
29175
+ const c2 = tsToObj(ts2, o2);
29176
+ if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) return [
29177
+ clone(this, {
29178
+ ts: ts1
29179
+ }),
29180
+ clone(this, {
29181
+ ts: ts2
29182
+ })
29183
+ ];
29184
+ return [
29185
+ this
29186
+ ];
29187
+ }
29188
+ get isInLeapYear() {
29189
+ return isLeapYear(this.year);
29190
+ }
29191
+ get daysInMonth() {
29192
+ return daysInMonth(this.year, this.month);
29193
+ }
29194
+ get daysInYear() {
29195
+ return this.isValid ? daysInYear(this.year) : NaN;
29196
+ }
29197
+ get weeksInWeekYear() {
29198
+ return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
29199
+ }
29200
+ get weeksInLocalWeekYear() {
29201
+ return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
29202
+ }
29203
+ resolvedLocaleOptions(opts = {}) {
29204
+ const { locale, numberingSystem, calendar } = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this);
29205
+ return {
29206
+ locale,
29207
+ numberingSystem,
29208
+ outputCalendar: calendar
29209
+ };
29210
+ }
29211
+ toUTC(offset = 0, opts = {}) {
29212
+ return this.setZone(FixedOffsetZone.instance(offset), opts);
29213
+ }
29214
+ toLocal() {
29215
+ return this.setZone(Settings.defaultZone);
29216
+ }
29217
+ setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {
29218
+ zone = normalizeZone(zone, Settings.defaultZone);
29219
+ if (zone.equals(this.zone)) return this;
29220
+ {
29221
+ if (!zone.isValid) return DateTime.invalid(unsupportedZone(zone));
29222
+ let newTS = this.ts;
29223
+ if (keepLocalTime || keepCalendarTime) {
29224
+ const offsetGuess = zone.offset(this.ts);
29225
+ const asObj = this.toObject();
29226
+ [newTS] = objToTS(asObj, offsetGuess, zone);
29227
+ }
29228
+ return clone(this, {
29229
+ ts: newTS,
29230
+ zone
29231
+ });
29232
+ }
29233
+ }
29234
+ reconfigure({ locale, numberingSystem, outputCalendar } = {}) {
29235
+ const loc = this.loc.clone({
29236
+ locale,
29237
+ numberingSystem,
29238
+ outputCalendar
29239
+ });
29240
+ return clone(this, {
29241
+ loc
29242
+ });
29243
+ }
29244
+ setLocale(locale) {
29245
+ return this.reconfigure({
29246
+ locale
29247
+ });
29248
+ }
29249
+ set(values) {
29250
+ if (!this.isValid) return this;
29251
+ const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
29252
+ const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);
29253
+ const settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
29254
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
29255
+ if (containsGregorMD && containsOrdinal) throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
29256
+ let mixed;
29257
+ if (settingWeekStuff) mixed = weekToGregorian({
29258
+ ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek),
29259
+ ...normalized
29260
+ }, minDaysInFirstWeek, startOfWeek);
29261
+ else if (isUndefined(normalized.ordinal)) {
29262
+ mixed = {
29263
+ ...this.toObject(),
29264
+ ...normalized
29265
+ };
29266
+ if (isUndefined(normalized.day)) mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
29267
+ } else mixed = ordinalToGregorian({
29268
+ ...gregorianToOrdinal(this.c),
29269
+ ...normalized
29270
+ });
29271
+ const [ts, o] = objToTS(mixed, this.o, this.zone);
29272
+ return clone(this, {
29273
+ ts,
29274
+ o
29275
+ });
29276
+ }
29277
+ plus(duration) {
29278
+ if (!this.isValid) return this;
29279
+ const dur = Duration.fromDurationLike(duration);
29280
+ return clone(this, adjustTime(this, dur));
29281
+ }
29282
+ minus(duration) {
29283
+ if (!this.isValid) return this;
29284
+ const dur = Duration.fromDurationLike(duration).negate();
29285
+ return clone(this, adjustTime(this, dur));
29286
+ }
29287
+ startOf(unit, { useLocaleWeeks = false } = {}) {
29288
+ if (!this.isValid) return this;
29289
+ const o = {}, normalizedUnit = Duration.normalizeUnit(unit);
29290
+ switch(normalizedUnit){
29291
+ case "years":
29292
+ o.month = 1;
29293
+ case "quarters":
29294
+ case "months":
29295
+ o.day = 1;
29296
+ case "weeks":
29297
+ case "days":
29298
+ o.hour = 0;
29299
+ case "hours":
29300
+ o.minute = 0;
29301
+ case "minutes":
29302
+ o.second = 0;
29303
+ case "seconds":
29304
+ o.millisecond = 0;
29305
+ break;
29306
+ }
29307
+ if ("weeks" === normalizedUnit) if (useLocaleWeeks) {
29308
+ const startOfWeek = this.loc.getStartOfWeek();
29309
+ const { weekday } = this;
29310
+ if (weekday < startOfWeek) o.weekNumber = this.weekNumber - 1;
29311
+ o.weekday = startOfWeek;
29312
+ } else o.weekday = 1;
29313
+ if ("quarters" === normalizedUnit) {
29314
+ const q = Math.ceil(this.month / 3);
29315
+ o.month = (q - 1) * 3 + 1;
29316
+ }
29317
+ return this.set(o);
29318
+ }
29319
+ endOf(unit, opts) {
29320
+ return this.isValid ? this.plus({
29321
+ [unit]: 1
29322
+ }).startOf(unit, opts).minus(1) : this;
29323
+ }
29324
+ toFormat(fmt, opts = {}) {
29325
+ return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID;
29326
+ }
29327
+ toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
29328
+ return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID;
29329
+ }
29330
+ toLocaleParts(opts = {}) {
29331
+ return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
29332
+ }
29333
+ toISO({ format = "extended", suppressSeconds = false, suppressMilliseconds = false, includeOffset = true, extendedZone = false, precision = "milliseconds" } = {}) {
29334
+ if (!this.isValid) return null;
29335
+ precision = normalizeUnit(precision);
29336
+ const ext = "extended" === format;
29337
+ let c = toISODate(this, ext, precision);
29338
+ if (orderedUnits.indexOf(precision) >= 3) c += "T";
29339
+ c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
29340
+ return c;
29341
+ }
29342
+ toISODate({ format = "extended", precision = "day" } = {}) {
29343
+ if (!this.isValid) return null;
29344
+ return toISODate(this, "extended" === format, normalizeUnit(precision));
29345
+ }
29346
+ toISOWeekDate() {
29347
+ return toTechFormat(this, "kkkk-'W'WW-c");
29348
+ }
29349
+ toISOTime({ suppressMilliseconds = false, suppressSeconds = false, includeOffset = true, includePrefix = false, extendedZone = false, format = "extended", precision = "milliseconds" } = {}) {
29350
+ if (!this.isValid) return null;
29351
+ precision = normalizeUnit(precision);
29352
+ let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
29353
+ return c + toISOTime(this, "extended" === format, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
29354
+ }
29355
+ toRFC2822() {
29356
+ return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
29357
+ }
29358
+ toHTTP() {
29359
+ return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
29360
+ }
29361
+ toSQLDate() {
29362
+ if (!this.isValid) return null;
29363
+ return toISODate(this, true);
29364
+ }
29365
+ toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {
29366
+ let fmt = "HH:mm:ss.SSS";
29367
+ if (includeZone || includeOffset) {
29368
+ if (includeOffsetSpace) fmt += " ";
29369
+ if (includeZone) fmt += "z";
29370
+ else if (includeOffset) fmt += "ZZ";
29371
+ }
29372
+ return toTechFormat(this, fmt, true);
29373
+ }
29374
+ toSQL(opts = {}) {
29375
+ if (!this.isValid) return null;
29376
+ return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;
29377
+ }
29378
+ toString() {
29379
+ return this.isValid ? this.toISO() : INVALID;
29380
+ }
29381
+ [Symbol.for("nodejs.util.inspect.custom")]() {
29382
+ if (this.isValid) return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
29383
+ return `DateTime { Invalid, reason: ${this.invalidReason} }`;
29384
+ }
29385
+ valueOf() {
29386
+ return this.toMillis();
29387
+ }
29388
+ toMillis() {
29389
+ return this.isValid ? this.ts : NaN;
29390
+ }
29391
+ toSeconds() {
29392
+ return this.isValid ? this.ts / 1000 : NaN;
29393
+ }
29394
+ toUnixInteger() {
29395
+ return this.isValid ? Math.floor(this.ts / 1000) : NaN;
29396
+ }
29397
+ toJSON() {
29398
+ return this.toISO();
29399
+ }
29400
+ toBSON() {
29401
+ return this.toJSDate();
29402
+ }
29403
+ toObject(opts = {}) {
29404
+ if (!this.isValid) return {};
29405
+ const base = {
29406
+ ...this.c
29407
+ };
29408
+ if (opts.includeConfig) {
29409
+ base.outputCalendar = this.outputCalendar;
29410
+ base.numberingSystem = this.loc.numberingSystem;
29411
+ base.locale = this.loc.locale;
29412
+ }
29413
+ return base;
29414
+ }
29415
+ toJSDate() {
29416
+ return new Date(this.isValid ? this.ts : NaN);
29417
+ }
29418
+ diff(otherDateTime, unit = "milliseconds", opts = {}) {
29419
+ if (!this.isValid || !otherDateTime.isValid) return Duration.invalid("created by diffing an invalid DateTime");
29420
+ const durOpts = {
29421
+ locale: this.locale,
29422
+ numberingSystem: this.numberingSystem,
29423
+ ...opts
29424
+ };
29425
+ const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = diff(earlier, later, units, durOpts);
29426
+ return otherIsLater ? diffed.negate() : diffed;
29427
+ }
29428
+ diffNow(unit = "milliseconds", opts = {}) {
29429
+ return this.diff(DateTime.now(), unit, opts);
29430
+ }
29431
+ until(otherDateTime) {
29432
+ return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
29433
+ }
29434
+ hasSame(otherDateTime, unit, opts) {
29435
+ if (!this.isValid) return false;
29436
+ const inputMs = otherDateTime.valueOf();
29437
+ const adjustedToZone = this.setZone(otherDateTime.zone, {
29438
+ keepLocalTime: true
29439
+ });
29440
+ return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
29441
+ }
29442
+ equals(other) {
29443
+ return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
29444
+ }
29445
+ toRelative(options = {}) {
29446
+ if (!this.isValid) return null;
29447
+ const base = options.base || DateTime.fromObject({}, {
29448
+ zone: this.zone
29449
+ }), padding = options.padding ? this < base ? -options.padding : options.padding : 0;
29450
+ let units = [
29451
+ "years",
29452
+ "months",
29453
+ "days",
29454
+ "hours",
29455
+ "minutes",
29456
+ "seconds"
29457
+ ];
29458
+ let unit = options.unit;
29459
+ if (Array.isArray(options.unit)) {
29460
+ units = options.unit;
29461
+ unit = void 0;
29462
+ }
29463
+ return diffRelative(base, this.plus(padding), {
29464
+ ...options,
29465
+ numeric: "always",
29466
+ units,
29467
+ unit
29468
+ });
29469
+ }
29470
+ toRelativeCalendar(options = {}) {
29471
+ if (!this.isValid) return null;
29472
+ return diffRelative(options.base || DateTime.fromObject({}, {
29473
+ zone: this.zone
29474
+ }), this, {
29475
+ ...options,
29476
+ numeric: "auto",
29477
+ units: [
29478
+ "years",
29479
+ "months",
29480
+ "days"
29481
+ ],
29482
+ calendary: true
29483
+ });
29484
+ }
29485
+ static min(...dateTimes) {
29486
+ if (!dateTimes.every(DateTime.isDateTime)) throw new InvalidArgumentError("min requires all arguments be DateTimes");
29487
+ return bestBy(dateTimes, (i)=>i.valueOf(), Math.min);
29488
+ }
29489
+ static max(...dateTimes) {
29490
+ if (!dateTimes.every(DateTime.isDateTime)) throw new InvalidArgumentError("max requires all arguments be DateTimes");
29491
+ return bestBy(dateTimes, (i)=>i.valueOf(), Math.max);
29492
+ }
29493
+ static fromFormatExplain(text, fmt, options = {}) {
29494
+ const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
29495
+ locale,
29496
+ numberingSystem,
29497
+ defaultToEN: true
29498
+ });
29499
+ return explainFromTokens(localeToUse, text, fmt);
29500
+ }
29501
+ static fromStringExplain(text, fmt, options = {}) {
29502
+ return DateTime.fromFormatExplain(text, fmt, options);
29503
+ }
29504
+ static buildFormatParser(fmt, options = {}) {
29505
+ const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
29506
+ locale,
29507
+ numberingSystem,
29508
+ defaultToEN: true
29509
+ });
29510
+ return new TokenParser(localeToUse, fmt);
29511
+ }
29512
+ static fromFormatParser(text, formatParser, opts = {}) {
29513
+ if (isUndefined(text) || isUndefined(formatParser)) throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");
29514
+ const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
29515
+ locale,
29516
+ numberingSystem,
29517
+ defaultToEN: true
29518
+ });
29519
+ if (!localeToUse.equals(formatParser.locale)) throw new InvalidArgumentError(`fromFormatParser called with a locale of ${localeToUse}, but the format parser was created for ${formatParser.locale}`);
29520
+ const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);
29521
+ if (invalidReason) return DateTime.invalid(invalidReason);
29522
+ return parseDataToDateTime(result, zone, opts, `format ${formatParser.format}`, text, specificOffset);
29523
+ }
29524
+ static get DATE_SHORT() {
29525
+ return DATE_SHORT;
29526
+ }
29527
+ static get DATE_MED() {
29528
+ return DATE_MED;
29529
+ }
29530
+ static get DATE_MED_WITH_WEEKDAY() {
29531
+ return DATE_MED_WITH_WEEKDAY;
29532
+ }
29533
+ static get DATE_FULL() {
29534
+ return DATE_FULL;
29535
+ }
29536
+ static get DATE_HUGE() {
29537
+ return DATE_HUGE;
29538
+ }
29539
+ static get TIME_SIMPLE() {
29540
+ return TIME_SIMPLE;
29541
+ }
29542
+ static get TIME_WITH_SECONDS() {
29543
+ return TIME_WITH_SECONDS;
29544
+ }
29545
+ static get TIME_WITH_SHORT_OFFSET() {
29546
+ return TIME_WITH_SHORT_OFFSET;
29547
+ }
29548
+ static get TIME_WITH_LONG_OFFSET() {
29549
+ return TIME_WITH_LONG_OFFSET;
29550
+ }
29551
+ static get TIME_24_SIMPLE() {
29552
+ return TIME_24_SIMPLE;
29553
+ }
29554
+ static get TIME_24_WITH_SECONDS() {
29555
+ return TIME_24_WITH_SECONDS;
29556
+ }
29557
+ static get TIME_24_WITH_SHORT_OFFSET() {
29558
+ return TIME_24_WITH_SHORT_OFFSET;
29559
+ }
29560
+ static get TIME_24_WITH_LONG_OFFSET() {
29561
+ return TIME_24_WITH_LONG_OFFSET;
29562
+ }
29563
+ static get DATETIME_SHORT() {
29564
+ return DATETIME_SHORT;
29565
+ }
29566
+ static get DATETIME_SHORT_WITH_SECONDS() {
29567
+ return DATETIME_SHORT_WITH_SECONDS;
29568
+ }
29569
+ static get DATETIME_MED() {
29570
+ return DATETIME_MED;
29571
+ }
29572
+ static get DATETIME_MED_WITH_SECONDS() {
29573
+ return DATETIME_MED_WITH_SECONDS;
29574
+ }
29575
+ static get DATETIME_MED_WITH_WEEKDAY() {
29576
+ return DATETIME_MED_WITH_WEEKDAY;
29577
+ }
29578
+ static get DATETIME_FULL() {
29579
+ return DATETIME_FULL;
29580
+ }
29581
+ static get DATETIME_FULL_WITH_SECONDS() {
29582
+ return DATETIME_FULL_WITH_SECONDS;
29583
+ }
29584
+ static get DATETIME_HUGE() {
29585
+ return DATETIME_HUGE;
29586
+ }
29587
+ static get DATETIME_HUGE_WITH_SECONDS() {
29588
+ return DATETIME_HUGE_WITH_SECONDS;
29589
+ }
29590
+ }
29591
+ function friendlyDateTime(dateTimeish) {
29592
+ if (DateTime.isDateTime(dateTimeish)) return dateTimeish;
29593
+ if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) return DateTime.fromJSDate(dateTimeish);
29594
+ if (dateTimeish && "object" == typeof dateTimeish) return DateTime.fromObject(dateTimeish);
29595
+ throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`);
29596
+ }
29597
+ function history_danmaku_fast_forward_main(that, query_history_date) {
29598
+ const qhd = DateTime.fromFormat(query_history_date, 'yyyy-MM-dd', {
29599
+ zone: 'Asia/Shanghai'
29600
+ }).setZone('Asia/Shanghai');
29601
+ if (!qhd.isValid) throw new Error('Invalid query_history_date');
29602
+ const s = qhd.startOf('day');
29603
+ const before = that.dans.filter((d)=>d.ctime < s.toJSDate());
29604
+ if (0 === before.length) return {
29605
+ earliest: null,
29606
+ FastForward: [],
29607
+ skip: [],
29608
+ SpecificDate: qhd.toFormat('yyyy-MM-dd')
29609
+ };
29610
+ const earliestCtime = before.toSorted((a, b)=>a.ctime.getTime() - b.ctime.getTime())[0].ctime;
29611
+ const earliestDate = DateTime.fromJSDate(earliestCtime).setZone('Asia/Shanghai').startOf('day');
29612
+ const datesWithDanmaku = new Set();
29613
+ for (const dan of before){
29614
+ const dateStr = DateTime.fromJSDate(dan.ctime).setZone('Asia/Shanghai').toFormat('yyyy-MM-dd');
29615
+ datesWithDanmaku.add(dateStr);
29616
+ }
29617
+ let current = earliestDate;
29618
+ const allDates = [];
29619
+ while(current < s){
29620
+ allDates.push(current.toFormat('yyyy-MM-dd'));
29621
+ current = current.plus({
29622
+ days: 1
29623
+ });
29624
+ }
29625
+ const FastForward = allDates.filter((d)=>datesWithDanmaku.has(d));
29626
+ const skip = allDates.filter((d)=>!datesWithDanmaku.has(d));
29627
+ return {
29628
+ earliest: earliestDate.toFormat('yyyy-MM-dd'),
29629
+ FastForward,
29630
+ skip,
29631
+ SpecificDate: qhd.toFormat('yyyy-MM-dd')
29632
+ };
29633
+ }
29634
+ function bili_history_fast_forward(query_history_date) {
29635
+ return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
29636
+ }
25026
29637
  })();
25027
29638
  return __webpack_exports__;
25028
29639
  })());