@uipath/rules-tool 1.204.0 → 1.205.0-preview.258

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 +7 -5
  2. package/dist/DmnFactory-L7MABUC6-98k17dkr.js +46 -0
  3. package/dist/{KieDmnMarshaller-6TTUU5B4-47q50gk4.js → KieDmnMarshaller-LGE63WDG-3vemswef.js} +2 -2
  4. package/dist/THIRD-PARTY-NOTICES.md +26 -9
  5. package/dist/{business-rules-bnr581tz.js → business-rules-pm96sefm.js} +4 -4
  6. package/dist/{constants-9pa118cj.js → constants-cnn0jfw6.js} +18 -17
  7. package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
  8. package/dist/hitPolicyResult-CGCR73CW-9bmc4nsr.js +36 -0
  9. package/dist/index-52h8rpew.js +21 -0
  10. package/dist/index-bhjt1h5c.js +227 -0
  11. package/dist/{index-2hzp9b97.js → index-cpm94vee.js} +21 -5
  12. package/dist/index-x9msn1dj.js +85 -0
  13. package/dist/{index-4c4exdzw.js → index-ybrgtfsg.js} +576 -285
  14. package/dist/index.js +2 -2
  15. package/dist/rule-catalog-10fhgevc.js +74 -0
  16. package/dist/{rules-command-error-20gp2dv9.js → rules-command-error-k6kxwfn7.js} +2 -2
  17. package/dist/{rules-debug-service-qd3aqcg1.js → rules-debug-service-86e47tv4.js} +19 -13
  18. package/dist/{rules-init-service-xsh7mx96.js → rules-init-service-3z07e0v8.js} +7 -7
  19. package/dist/{rules-refresh-service-jgk2kq9d.js → rules-refresh-service-jn6my893.js} +3 -3
  20. package/dist/{rules-validate-service-mr2fk58k.js → rules-validate-service-hfw8m3dm.js} +7 -7
  21. package/dist/{tool-pm3ewdxc.js → tool-1pccj6q3.js} +4 -3
  22. package/dist/{tool-jpwm68hm.js → tool-5zs9eywg.js} +103 -63
  23. package/dist/tool-86f1xpxn.js +51 -0
  24. package/dist/{tool-75esv9bk.js → tool-a4r4a9be.js} +17 -7
  25. package/dist/tool-cfrcyxgm.js +26 -0
  26. package/dist/{tool-av4mmsef.js → tool-fbmxx07c.js} +2 -2
  27. package/dist/{tool-2cky8jwp.js → tool-fbxe48wd.js} +1071 -208
  28. package/dist/tool-fk8rznma.js +827 -0
  29. package/dist/{tool-mkn83w88.js → tool-gkbr01gc.js} +3 -3
  30. package/dist/{tool-8h4er38s.js → tool-h7gn1rar.js} +3 -3
  31. package/dist/{tool-8qy8pkp4.js → tool-t4k013ex.js} +8 -5
  32. package/dist/tool-tjcg2xje.js +4616 -0
  33. package/dist/{tool-eymjx05p.js → tool-txp5th7j.js} +760 -3395
  34. package/dist/{tool-tkcx6png.js → tool-wf2qkrye.js} +25 -5
  35. package/dist/{tool-wmh645tm.js → tool-yq5jph4h.js} +169 -119
  36. package/dist/tool-z1ay3csx.js +176 -0
  37. package/dist/tool.js +2 -2
  38. package/package.json +2 -2
  39. package/dist/DmnFactory-VWZOSZHH-jkpbxz3n.js +0 -42
  40. package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +0 -33
  41. package/dist/index-34pj9f36.js +0 -48
  42. package/dist/index-fs1nd5ap.js +0 -200
  43. package/dist/index-t4mx1a5e.js +0 -17
  44. package/dist/rule-catalog-5gzpe93c.js +0 -46
  45. package/dist/tool-19b4ect0.js +0 -754
  46. package/dist/tool-4dfpdepw.js +0 -55
  47. package/dist/tool-m41px07w.js +0 -49
@@ -0,0 +1,4616 @@
1
+ import {
2
+ ae,
3
+ c,
4
+ ne,
5
+ oe
6
+ } from "./tool-yq5jph4h.js";
7
+ import {
8
+ R
9
+ } from "./tool-z1ay3csx.js";
10
+
11
+ // ../../node_modules/luxon/build/es6/luxon.mjs
12
+ class LuxonError extends Error {
13
+ }
14
+
15
+ class InvalidDateTimeError extends LuxonError {
16
+ constructor(reason) {
17
+ super(`Invalid DateTime: ${reason.toMessage()}`);
18
+ }
19
+ }
20
+
21
+ class InvalidIntervalError extends LuxonError {
22
+ constructor(reason) {
23
+ super(`Invalid Interval: ${reason.toMessage()}`);
24
+ }
25
+ }
26
+
27
+ class InvalidDurationError extends LuxonError {
28
+ constructor(reason) {
29
+ super(`Invalid Duration: ${reason.toMessage()}`);
30
+ }
31
+ }
32
+
33
+ class ConflictingSpecificationError extends LuxonError {
34
+ }
35
+
36
+ class InvalidUnitError extends LuxonError {
37
+ constructor(unit) {
38
+ super(`Invalid unit ${unit}`);
39
+ }
40
+ }
41
+
42
+ class InvalidArgumentError extends LuxonError {
43
+ }
44
+
45
+ class ZoneIsAbstractError extends LuxonError {
46
+ constructor() {
47
+ super("Zone is an abstract class");
48
+ }
49
+ }
50
+ var n = "numeric";
51
+ var s = "short";
52
+ var l = "long";
53
+ var DATE_SHORT = {
54
+ year: n,
55
+ month: n,
56
+ day: n
57
+ };
58
+ var DATE_MED = {
59
+ year: n,
60
+ month: s,
61
+ day: n
62
+ };
63
+ var DATE_MED_WITH_WEEKDAY = {
64
+ year: n,
65
+ month: s,
66
+ day: n,
67
+ weekday: s
68
+ };
69
+ var DATE_FULL = {
70
+ year: n,
71
+ month: l,
72
+ day: n
73
+ };
74
+ var DATE_HUGE = {
75
+ year: n,
76
+ month: l,
77
+ day: n,
78
+ weekday: l
79
+ };
80
+ var TIME_SIMPLE = {
81
+ hour: n,
82
+ minute: n
83
+ };
84
+ var TIME_WITH_SECONDS = {
85
+ hour: n,
86
+ minute: n,
87
+ second: n
88
+ };
89
+ var TIME_WITH_SHORT_OFFSET = {
90
+ hour: n,
91
+ minute: n,
92
+ second: n,
93
+ timeZoneName: s
94
+ };
95
+ var TIME_WITH_LONG_OFFSET = {
96
+ hour: n,
97
+ minute: n,
98
+ second: n,
99
+ timeZoneName: l
100
+ };
101
+ var TIME_24_SIMPLE = {
102
+ hour: n,
103
+ minute: n,
104
+ hourCycle: "h23"
105
+ };
106
+ var TIME_24_WITH_SECONDS = {
107
+ hour: n,
108
+ minute: n,
109
+ second: n,
110
+ hourCycle: "h23"
111
+ };
112
+ var TIME_24_WITH_SHORT_OFFSET = {
113
+ hour: n,
114
+ minute: n,
115
+ second: n,
116
+ hourCycle: "h23",
117
+ timeZoneName: s
118
+ };
119
+ var TIME_24_WITH_LONG_OFFSET = {
120
+ hour: n,
121
+ minute: n,
122
+ second: n,
123
+ hourCycle: "h23",
124
+ timeZoneName: l
125
+ };
126
+ var DATETIME_SHORT = {
127
+ year: n,
128
+ month: n,
129
+ day: n,
130
+ hour: n,
131
+ minute: n
132
+ };
133
+ var DATETIME_SHORT_WITH_SECONDS = {
134
+ year: n,
135
+ month: n,
136
+ day: n,
137
+ hour: n,
138
+ minute: n,
139
+ second: n
140
+ };
141
+ var DATETIME_MED = {
142
+ year: n,
143
+ month: s,
144
+ day: n,
145
+ hour: n,
146
+ minute: n
147
+ };
148
+ var DATETIME_MED_WITH_SECONDS = {
149
+ year: n,
150
+ month: s,
151
+ day: n,
152
+ hour: n,
153
+ minute: n,
154
+ second: n
155
+ };
156
+ var DATETIME_MED_WITH_WEEKDAY = {
157
+ year: n,
158
+ month: s,
159
+ day: n,
160
+ weekday: s,
161
+ hour: n,
162
+ minute: n
163
+ };
164
+ var DATETIME_FULL = {
165
+ year: n,
166
+ month: l,
167
+ day: n,
168
+ hour: n,
169
+ minute: n,
170
+ timeZoneName: s
171
+ };
172
+ var DATETIME_FULL_WITH_SECONDS = {
173
+ year: n,
174
+ month: l,
175
+ day: n,
176
+ hour: n,
177
+ minute: n,
178
+ second: n,
179
+ timeZoneName: s
180
+ };
181
+ var DATETIME_HUGE = {
182
+ year: n,
183
+ month: l,
184
+ day: n,
185
+ weekday: l,
186
+ hour: n,
187
+ minute: n,
188
+ timeZoneName: l
189
+ };
190
+ var DATETIME_HUGE_WITH_SECONDS = {
191
+ year: n,
192
+ month: l,
193
+ day: n,
194
+ weekday: l,
195
+ hour: n,
196
+ minute: n,
197
+ second: n,
198
+ timeZoneName: l
199
+ };
200
+
201
+ class Zone {
202
+ get type() {
203
+ throw new ZoneIsAbstractError;
204
+ }
205
+ get name() {
206
+ throw new ZoneIsAbstractError;
207
+ }
208
+ get ianaName() {
209
+ return this.name;
210
+ }
211
+ get isUniversal() {
212
+ throw new ZoneIsAbstractError;
213
+ }
214
+ offsetName(ts, opts) {
215
+ throw new ZoneIsAbstractError;
216
+ }
217
+ formatOffset(ts, format) {
218
+ throw new ZoneIsAbstractError;
219
+ }
220
+ offset(ts) {
221
+ throw new ZoneIsAbstractError;
222
+ }
223
+ equals(otherZone) {
224
+ throw new ZoneIsAbstractError;
225
+ }
226
+ get isValid() {
227
+ throw new ZoneIsAbstractError;
228
+ }
229
+ }
230
+ var singleton$1 = null;
231
+
232
+ class SystemZone extends Zone {
233
+ static get instance() {
234
+ if (singleton$1 === null) {
235
+ singleton$1 = new SystemZone;
236
+ }
237
+ return singleton$1;
238
+ }
239
+ get type() {
240
+ return "system";
241
+ }
242
+ get name() {
243
+ return new Intl.DateTimeFormat().resolvedOptions().timeZone;
244
+ }
245
+ get isUniversal() {
246
+ return false;
247
+ }
248
+ offsetName(ts, { format, locale }) {
249
+ return parseZoneInfo(ts, format, locale);
250
+ }
251
+ formatOffset(ts, format) {
252
+ return formatOffset(this.offset(ts), format);
253
+ }
254
+ offset(ts) {
255
+ return -new Date(ts).getTimezoneOffset();
256
+ }
257
+ equals(otherZone) {
258
+ return otherZone.type === "system";
259
+ }
260
+ get isValid() {
261
+ return true;
262
+ }
263
+ }
264
+ var dtfCache = new Map;
265
+ function makeDTF(zoneName) {
266
+ let dtf = dtfCache.get(zoneName);
267
+ if (dtf === undefined) {
268
+ dtf = new Intl.DateTimeFormat("en-US", {
269
+ hour12: false,
270
+ timeZone: zoneName,
271
+ year: "numeric",
272
+ month: "2-digit",
273
+ day: "2-digit",
274
+ hour: "2-digit",
275
+ minute: "2-digit",
276
+ second: "2-digit",
277
+ era: "short"
278
+ });
279
+ dtfCache.set(zoneName, dtf);
280
+ }
281
+ return dtf;
282
+ }
283
+ var typeToPos = {
284
+ year: 0,
285
+ month: 1,
286
+ day: 2,
287
+ era: 3,
288
+ hour: 4,
289
+ minute: 5,
290
+ second: 6
291
+ };
292
+ function hackyOffset(dtf, date) {
293
+ 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;
294
+ return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
295
+ }
296
+ function partsOffset(dtf, date) {
297
+ const formatted = dtf.formatToParts(date);
298
+ const filled = [];
299
+ for (let i = 0;i < formatted.length; i++) {
300
+ const { type, value } = formatted[i];
301
+ const pos = typeToPos[type];
302
+ if (type === "era") {
303
+ filled[pos] = value;
304
+ } else if (!isUndefined(pos)) {
305
+ filled[pos] = parseInt(value, 10);
306
+ }
307
+ }
308
+ return filled;
309
+ }
310
+ var ianaZoneCache = new Map;
311
+
312
+ class IANAZone extends Zone {
313
+ static create(name) {
314
+ let zone = ianaZoneCache.get(name);
315
+ if (zone === undefined) {
316
+ ianaZoneCache.set(name, zone = new IANAZone(name));
317
+ }
318
+ return zone;
319
+ }
320
+ static resetCache() {
321
+ ianaZoneCache.clear();
322
+ dtfCache.clear();
323
+ }
324
+ static isValidSpecifier(s2) {
325
+ return this.isValidZone(s2);
326
+ }
327
+ static isValidZone(zone) {
328
+ if (!zone) {
329
+ return false;
330
+ }
331
+ try {
332
+ new Intl.DateTimeFormat("en-US", { timeZone: zone }).format();
333
+ return true;
334
+ } catch (e) {
335
+ return false;
336
+ }
337
+ }
338
+ constructor(name) {
339
+ super();
340
+ this.zoneName = name;
341
+ this.valid = IANAZone.isValidZone(name);
342
+ }
343
+ get type() {
344
+ return "iana";
345
+ }
346
+ get name() {
347
+ return this.zoneName;
348
+ }
349
+ get isUniversal() {
350
+ return false;
351
+ }
352
+ offsetName(ts, { format, locale }) {
353
+ return parseZoneInfo(ts, format, locale, this.name);
354
+ }
355
+ formatOffset(ts, format) {
356
+ return formatOffset(this.offset(ts), format);
357
+ }
358
+ offset(ts) {
359
+ if (!this.valid)
360
+ return NaN;
361
+ const date = new Date(ts);
362
+ if (isNaN(date))
363
+ return NaN;
364
+ const dtf = makeDTF(this.name);
365
+ let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date);
366
+ if (adOrBc === "BC") {
367
+ year = -Math.abs(year) + 1;
368
+ }
369
+ const adjustedHour = hour === 24 ? 0 : hour;
370
+ const asUTC = objToLocalTS({
371
+ year,
372
+ month,
373
+ day,
374
+ hour: adjustedHour,
375
+ minute,
376
+ second,
377
+ millisecond: 0
378
+ });
379
+ let asTS = +date;
380
+ const over = asTS % 1000;
381
+ asTS -= over >= 0 ? over : 1000 + over;
382
+ return (asUTC - asTS) / (60 * 1000);
383
+ }
384
+ equals(otherZone) {
385
+ return otherZone.type === "iana" && otherZone.name === this.name;
386
+ }
387
+ get isValid() {
388
+ return this.valid;
389
+ }
390
+ }
391
+ var intlLFCache = {};
392
+ function getCachedLF(locString, opts = {}) {
393
+ const key = JSON.stringify([locString, opts]);
394
+ let dtf = intlLFCache[key];
395
+ if (!dtf) {
396
+ dtf = new Intl.ListFormat(locString, opts);
397
+ intlLFCache[key] = dtf;
398
+ }
399
+ return dtf;
400
+ }
401
+ var intlDTCache = new Map;
402
+ function getCachedDTF(locString, opts = {}) {
403
+ const key = JSON.stringify([locString, opts]);
404
+ let dtf = intlDTCache.get(key);
405
+ if (dtf === undefined) {
406
+ dtf = new Intl.DateTimeFormat(locString, opts);
407
+ intlDTCache.set(key, dtf);
408
+ }
409
+ return dtf;
410
+ }
411
+ var intlNumCache = new Map;
412
+ function getCachedINF(locString, opts = {}) {
413
+ const key = JSON.stringify([locString, opts]);
414
+ let inf = intlNumCache.get(key);
415
+ if (inf === undefined) {
416
+ inf = new Intl.NumberFormat(locString, opts);
417
+ intlNumCache.set(key, inf);
418
+ }
419
+ return inf;
420
+ }
421
+ var intlRelCache = new Map;
422
+ function getCachedRTF(locString, opts = {}) {
423
+ const { base, ...cacheKeyOpts } = opts;
424
+ const key = JSON.stringify([locString, cacheKeyOpts]);
425
+ let inf = intlRelCache.get(key);
426
+ if (inf === undefined) {
427
+ inf = new Intl.RelativeTimeFormat(locString, opts);
428
+ intlRelCache.set(key, inf);
429
+ }
430
+ return inf;
431
+ }
432
+ var sysLocaleCache = null;
433
+ function systemLocale() {
434
+ if (sysLocaleCache) {
435
+ return sysLocaleCache;
436
+ } else {
437
+ sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
438
+ return sysLocaleCache;
439
+ }
440
+ }
441
+ var intlResolvedOptionsCache = new Map;
442
+ function getCachedIntResolvedOptions(locString) {
443
+ let opts = intlResolvedOptionsCache.get(locString);
444
+ if (opts === undefined) {
445
+ opts = new Intl.DateTimeFormat(locString).resolvedOptions();
446
+ intlResolvedOptionsCache.set(locString, opts);
447
+ }
448
+ return opts;
449
+ }
450
+ var weekInfoCache = new Map;
451
+ function getCachedWeekInfo(locString) {
452
+ let data = weekInfoCache.get(locString);
453
+ if (!data) {
454
+ const locale = new Intl.Locale(locString);
455
+ data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
456
+ if (!("minimalDays" in data)) {
457
+ data = { ...fallbackWeekSettings, ...data };
458
+ }
459
+ weekInfoCache.set(locString, data);
460
+ }
461
+ return data;
462
+ }
463
+ function parseLocaleString(localeStr) {
464
+ const xIndex = localeStr.indexOf("-x-");
465
+ if (xIndex !== -1) {
466
+ localeStr = localeStr.substring(0, xIndex);
467
+ }
468
+ const uIndex = localeStr.indexOf("-u-");
469
+ if (uIndex === -1) {
470
+ return [localeStr];
471
+ } else {
472
+ let options;
473
+ let selectedStr;
474
+ try {
475
+ options = getCachedDTF(localeStr).resolvedOptions();
476
+ selectedStr = localeStr;
477
+ } catch (e) {
478
+ const smaller = localeStr.substring(0, uIndex);
479
+ options = getCachedDTF(smaller).resolvedOptions();
480
+ selectedStr = smaller;
481
+ }
482
+ const { numberingSystem, calendar } = options;
483
+ return [selectedStr, numberingSystem, calendar];
484
+ }
485
+ }
486
+ function intlConfigString(localeStr, numberingSystem, outputCalendar) {
487
+ if (outputCalendar || numberingSystem) {
488
+ if (!localeStr.includes("-u-")) {
489
+ localeStr += "-u";
490
+ }
491
+ if (outputCalendar) {
492
+ localeStr += `-ca-${outputCalendar}`;
493
+ }
494
+ if (numberingSystem) {
495
+ localeStr += `-nu-${numberingSystem}`;
496
+ }
497
+ return localeStr;
498
+ } else {
499
+ return localeStr;
500
+ }
501
+ }
502
+ function mapMonths(f) {
503
+ const ms = [];
504
+ for (let i = 1;i <= 12; i++) {
505
+ const dt = DateTime.utc(2009, i, 1);
506
+ ms.push(f(dt));
507
+ }
508
+ return ms;
509
+ }
510
+ function mapWeekdays(f) {
511
+ const ms = [];
512
+ for (let i = 1;i <= 7; i++) {
513
+ const dt = DateTime.utc(2016, 11, 13 + i);
514
+ ms.push(f(dt));
515
+ }
516
+ return ms;
517
+ }
518
+ function listStuff(loc, length, englishFn, intlFn) {
519
+ const mode = loc.listingMode();
520
+ if (mode === "error") {
521
+ return null;
522
+ } else if (mode === "en") {
523
+ return englishFn(length);
524
+ } else {
525
+ return intlFn(length);
526
+ }
527
+ }
528
+ function supportsFastNumbers(loc) {
529
+ if (loc.numberingSystem && loc.numberingSystem !== "latn") {
530
+ return false;
531
+ } else {
532
+ return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || getCachedIntResolvedOptions(loc.locale).numberingSystem === "latn";
533
+ }
534
+ }
535
+
536
+ class PolyNumberFormatter {
537
+ constructor(intl, forceSimple, opts) {
538
+ this.padTo = opts.padTo || 0;
539
+ this.floor = opts.floor || false;
540
+ const { padTo, floor, ...otherOpts } = opts;
541
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
542
+ const intlOpts = { useGrouping: false, ...opts };
543
+ if (opts.padTo > 0)
544
+ intlOpts.minimumIntegerDigits = opts.padTo;
545
+ this.inf = getCachedINF(intl, intlOpts);
546
+ }
547
+ }
548
+ format(i) {
549
+ if (this.inf) {
550
+ const fixed = this.floor ? Math.floor(i) : i;
551
+ return this.inf.format(fixed);
552
+ } else {
553
+ const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);
554
+ return padStart(fixed, this.padTo);
555
+ }
556
+ }
557
+ }
558
+
559
+ class PolyDateFormatter {
560
+ constructor(dt, intl, opts) {
561
+ this.opts = opts;
562
+ this.originalZone = undefined;
563
+ let z = undefined;
564
+ if (this.opts.timeZone) {
565
+ this.dt = dt;
566
+ } else if (dt.zone.type === "fixed") {
567
+ const gmtOffset = -1 * (dt.offset / 60);
568
+ const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
569
+ if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
570
+ z = offsetZ;
571
+ this.dt = dt;
572
+ } else {
573
+ z = "UTC";
574
+ this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ minutes: dt.offset });
575
+ this.originalZone = dt.zone;
576
+ }
577
+ } else if (dt.zone.type === "system") {
578
+ this.dt = dt;
579
+ } else if (dt.zone.type === "iana") {
580
+ this.dt = dt;
581
+ z = dt.zone.name;
582
+ } else {
583
+ z = "UTC";
584
+ this.dt = dt.setZone("UTC").plus({ minutes: dt.offset });
585
+ this.originalZone = dt.zone;
586
+ }
587
+ const intlOpts = { ...this.opts };
588
+ intlOpts.timeZone = intlOpts.timeZone || z;
589
+ this.dtf = getCachedDTF(intl, intlOpts);
590
+ }
591
+ format() {
592
+ if (this.originalZone) {
593
+ return this.formatToParts().map(({ value }) => value).join("");
594
+ }
595
+ return this.dtf.format(this.dt.toJSDate());
596
+ }
597
+ formatToParts() {
598
+ const parts = this.dtf.formatToParts(this.dt.toJSDate());
599
+ if (this.originalZone) {
600
+ return parts.map((part) => {
601
+ if (part.type === "timeZoneName") {
602
+ const offsetName = this.originalZone.offsetName(this.dt.ts, {
603
+ locale: this.dt.locale,
604
+ format: this.opts.timeZoneName
605
+ });
606
+ return {
607
+ ...part,
608
+ value: offsetName
609
+ };
610
+ } else {
611
+ return part;
612
+ }
613
+ });
614
+ }
615
+ return parts;
616
+ }
617
+ resolvedOptions() {
618
+ return this.dtf.resolvedOptions();
619
+ }
620
+ }
621
+
622
+ class PolyRelFormatter {
623
+ constructor(intl, isEnglish, opts) {
624
+ this.opts = { style: "long", ...opts };
625
+ if (!isEnglish && hasRelative()) {
626
+ this.rtf = getCachedRTF(intl, opts);
627
+ }
628
+ }
629
+ format(count, unit) {
630
+ if (this.rtf) {
631
+ return this.rtf.format(count, unit);
632
+ } else {
633
+ return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long");
634
+ }
635
+ }
636
+ formatToParts(count, unit) {
637
+ if (this.rtf) {
638
+ return this.rtf.formatToParts(count, unit);
639
+ } else {
640
+ return [];
641
+ }
642
+ }
643
+ }
644
+ var fallbackWeekSettings = {
645
+ firstDay: 1,
646
+ minimalDays: 4,
647
+ weekend: [6, 7]
648
+ };
649
+
650
+ class Locale {
651
+ static fromOpts(opts) {
652
+ return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
653
+ }
654
+ static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
655
+ const specifiedLocale = locale || Settings.defaultLocale;
656
+ const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
657
+ const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
658
+ const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
659
+ const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
660
+ return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
661
+ }
662
+ static resetCache() {
663
+ sysLocaleCache = null;
664
+ intlDTCache.clear();
665
+ intlNumCache.clear();
666
+ intlRelCache.clear();
667
+ intlResolvedOptionsCache.clear();
668
+ weekInfoCache.clear();
669
+ }
670
+ static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {
671
+ return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
672
+ }
673
+ constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
674
+ const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
675
+ this.locale = parsedLocale;
676
+ this.numberingSystem = numbering || parsedNumberingSystem || null;
677
+ this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
678
+ this.weekSettings = weekSettings;
679
+ this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
680
+ this.weekdaysCache = { format: {}, standalone: {} };
681
+ this.monthsCache = { format: {}, standalone: {} };
682
+ this.meridiemCache = null;
683
+ this.eraCache = {};
684
+ this.specifiedLocale = specifiedLocale;
685
+ this.fastNumbersCached = null;
686
+ }
687
+ get fastNumbers() {
688
+ if (this.fastNumbersCached == null) {
689
+ this.fastNumbersCached = supportsFastNumbers(this);
690
+ }
691
+ return this.fastNumbersCached;
692
+ }
693
+ listingMode() {
694
+ const isActuallyEn = this.isEnglish();
695
+ const hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
696
+ return isActuallyEn && hasNoWeirdness ? "en" : "intl";
697
+ }
698
+ clone(alts) {
699
+ if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
700
+ return this;
701
+ } else {
702
+ return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
703
+ }
704
+ }
705
+ redefaultToEN(alts = {}) {
706
+ return this.clone({ ...alts, defaultToEN: true });
707
+ }
708
+ redefaultToSystem(alts = {}) {
709
+ return this.clone({ ...alts, defaultToEN: false });
710
+ }
711
+ months(length, format = false) {
712
+ return listStuff(this, length, months, () => {
713
+ const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-");
714
+ format &= !monthSpecialCase;
715
+ const intl = format ? { month: length, day: "numeric" } : { month: length }, formatStr = format ? "format" : "standalone";
716
+ if (!this.monthsCache[formatStr][length]) {
717
+ const mapper = !monthSpecialCase ? (dt) => this.extract(dt, intl, "month") : (dt) => this.dtFormatter(dt, intl).format();
718
+ this.monthsCache[formatStr][length] = mapMonths(mapper);
719
+ }
720
+ return this.monthsCache[formatStr][length];
721
+ });
722
+ }
723
+ weekdays(length, format = false) {
724
+ return listStuff(this, length, weekdays, () => {
725
+ const intl = format ? { weekday: length, year: "numeric", month: "long", day: "numeric" } : { weekday: length }, formatStr = format ? "format" : "standalone";
726
+ if (!this.weekdaysCache[formatStr][length]) {
727
+ this.weekdaysCache[formatStr][length] = mapWeekdays((dt) => this.extract(dt, intl, "weekday"));
728
+ }
729
+ return this.weekdaysCache[formatStr][length];
730
+ });
731
+ }
732
+ meridiems() {
733
+ return listStuff(this, undefined, () => meridiems, () => {
734
+ if (!this.meridiemCache) {
735
+ const intl = { hour: "numeric", hourCycle: "h12" };
736
+ this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map((dt) => this.extract(dt, intl, "dayperiod"));
737
+ }
738
+ return this.meridiemCache;
739
+ });
740
+ }
741
+ eras(length) {
742
+ return listStuff(this, length, eras, () => {
743
+ const intl = { era: length };
744
+ if (!this.eraCache[length]) {
745
+ this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) => this.extract(dt, intl, "era"));
746
+ }
747
+ return this.eraCache[length];
748
+ });
749
+ }
750
+ extract(dt, intlOpts, field) {
751
+ const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m) => m.type.toLowerCase() === field);
752
+ return matching ? matching.value : null;
753
+ }
754
+ numberFormatter(opts = {}) {
755
+ return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);
756
+ }
757
+ dtFormatter(dt, intlOpts = {}) {
758
+ return new PolyDateFormatter(dt, this.intl, intlOpts);
759
+ }
760
+ relFormatter(opts = {}) {
761
+ return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
762
+ }
763
+ listFormatter(opts = {}) {
764
+ return getCachedLF(this.intl, opts);
765
+ }
766
+ isEnglish() {
767
+ return this.locale === "en" || this.locale.toLowerCase() === "en-us" || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us");
768
+ }
769
+ getWeekSettings() {
770
+ if (this.weekSettings) {
771
+ return this.weekSettings;
772
+ } else if (!hasLocaleWeekInfo()) {
773
+ return fallbackWeekSettings;
774
+ } else {
775
+ return getCachedWeekInfo(this.locale);
776
+ }
777
+ }
778
+ getStartOfWeek() {
779
+ return this.getWeekSettings().firstDay;
780
+ }
781
+ getMinDaysInFirstWeek() {
782
+ return this.getWeekSettings().minimalDays;
783
+ }
784
+ getWeekendDays() {
785
+ return this.getWeekSettings().weekend;
786
+ }
787
+ equals(other) {
788
+ return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
789
+ }
790
+ toString() {
791
+ return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
792
+ }
793
+ }
794
+ var singleton = null;
795
+
796
+ class FixedOffsetZone extends Zone {
797
+ static get utcInstance() {
798
+ if (singleton === null) {
799
+ singleton = new FixedOffsetZone(0);
800
+ }
801
+ return singleton;
802
+ }
803
+ static instance(offset) {
804
+ return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
805
+ }
806
+ static parseSpecifier(s2) {
807
+ if (s2) {
808
+ const r = s2.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
809
+ if (r) {
810
+ return new FixedOffsetZone(signedOffset(r[1], r[2]));
811
+ }
812
+ }
813
+ return null;
814
+ }
815
+ constructor(offset) {
816
+ super();
817
+ this.fixed = offset;
818
+ }
819
+ get type() {
820
+ return "fixed";
821
+ }
822
+ get name() {
823
+ return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`;
824
+ }
825
+ get ianaName() {
826
+ if (this.fixed === 0) {
827
+ return "Etc/UTC";
828
+ } else {
829
+ return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`;
830
+ }
831
+ }
832
+ offsetName() {
833
+ return this.name;
834
+ }
835
+ formatOffset(ts, format) {
836
+ return formatOffset(this.fixed, format);
837
+ }
838
+ get isUniversal() {
839
+ return true;
840
+ }
841
+ offset() {
842
+ return this.fixed;
843
+ }
844
+ equals(otherZone) {
845
+ return otherZone.type === "fixed" && otherZone.fixed === this.fixed;
846
+ }
847
+ get isValid() {
848
+ return true;
849
+ }
850
+ }
851
+
852
+ class InvalidZone extends Zone {
853
+ constructor(zoneName) {
854
+ super();
855
+ this.zoneName = zoneName;
856
+ }
857
+ get type() {
858
+ return "invalid";
859
+ }
860
+ get name() {
861
+ return this.zoneName;
862
+ }
863
+ get isUniversal() {
864
+ return false;
865
+ }
866
+ offsetName() {
867
+ return null;
868
+ }
869
+ formatOffset() {
870
+ return "";
871
+ }
872
+ offset() {
873
+ return NaN;
874
+ }
875
+ equals() {
876
+ return false;
877
+ }
878
+ get isValid() {
879
+ return false;
880
+ }
881
+ }
882
+ function normalizeZone(input, defaultZone) {
883
+ if (isUndefined(input) || input === null) {
884
+ return defaultZone;
885
+ } else if (input instanceof Zone) {
886
+ return input;
887
+ } else if (isString(input)) {
888
+ const lowered = input.toLowerCase();
889
+ if (lowered === "default")
890
+ return defaultZone;
891
+ else if (lowered === "local" || lowered === "system")
892
+ return SystemZone.instance;
893
+ else if (lowered === "utc" || lowered === "gmt")
894
+ return FixedOffsetZone.utcInstance;
895
+ else
896
+ return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
897
+ } else if (isNumber(input)) {
898
+ return FixedOffsetZone.instance(input);
899
+ } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") {
900
+ return input;
901
+ } else {
902
+ return new InvalidZone(input);
903
+ }
904
+ }
905
+ var numberingSystems = {
906
+ arab: "[٠-٩]",
907
+ arabext: "[۰-۹]",
908
+ bali: "[᭐-᭙]",
909
+ beng: "[০-৯]",
910
+ deva: "[०-९]",
911
+ fullwide: "[0-9]",
912
+ gujr: "[૦-૯]",
913
+ hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
914
+ khmr: "[០-៩]",
915
+ knda: "[೦-೯]",
916
+ laoo: "[໐-໙]",
917
+ limb: "[᥆-᥏]",
918
+ mlym: "[൦-൯]",
919
+ mong: "[᠐-᠙]",
920
+ mymr: "[၀-၉]",
921
+ orya: "[୦-୯]",
922
+ tamldec: "[௦-௯]",
923
+ telu: "[౦-౯]",
924
+ thai: "[๐-๙]",
925
+ tibt: "[༠-༩]",
926
+ latn: "\\d"
927
+ };
928
+ var numberingSystemsUTF16 = {
929
+ arab: [1632, 1641],
930
+ arabext: [1776, 1785],
931
+ bali: [6992, 7001],
932
+ beng: [2534, 2543],
933
+ deva: [2406, 2415],
934
+ fullwide: [65296, 65303],
935
+ gujr: [2790, 2799],
936
+ khmr: [6112, 6121],
937
+ knda: [3302, 3311],
938
+ laoo: [3792, 3801],
939
+ limb: [6470, 6479],
940
+ mlym: [3430, 3439],
941
+ mong: [6160, 6169],
942
+ mymr: [4160, 4169],
943
+ orya: [2918, 2927],
944
+ tamldec: [3046, 3055],
945
+ telu: [3174, 3183],
946
+ thai: [3664, 3673],
947
+ tibt: [3872, 3881]
948
+ };
949
+ var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
950
+ function parseDigits(str) {
951
+ let value = parseInt(str, 10);
952
+ if (isNaN(value)) {
953
+ value = "";
954
+ for (let i = 0;i < str.length; i++) {
955
+ const code = str.charCodeAt(i);
956
+ if (str[i].search(numberingSystems.hanidec) !== -1) {
957
+ value += hanidecChars.indexOf(str[i]);
958
+ } else {
959
+ for (const key in numberingSystemsUTF16) {
960
+ const [min, max] = numberingSystemsUTF16[key];
961
+ if (code >= min && code <= max) {
962
+ value += code - min;
963
+ }
964
+ }
965
+ }
966
+ }
967
+ return parseInt(value, 10);
968
+ } else {
969
+ return value;
970
+ }
971
+ }
972
+ var digitRegexCache = new Map;
973
+ function resetDigitRegexCache() {
974
+ digitRegexCache.clear();
975
+ }
976
+ function digitRegex({ numberingSystem }, append = "") {
977
+ const ns = numberingSystem || "latn";
978
+ let appendCache = digitRegexCache.get(ns);
979
+ if (appendCache === undefined) {
980
+ appendCache = new Map;
981
+ digitRegexCache.set(ns, appendCache);
982
+ }
983
+ let regex = appendCache.get(append);
984
+ if (regex === undefined) {
985
+ regex = new RegExp(`${numberingSystems[ns]}${append}`);
986
+ appendCache.set(append, regex);
987
+ }
988
+ return regex;
989
+ }
990
+ var now = () => Date.now();
991
+ var defaultZone = "system";
992
+ var defaultLocale = null;
993
+ var defaultNumberingSystem = null;
994
+ var defaultOutputCalendar = null;
995
+ var twoDigitCutoffYear = 60;
996
+ var throwOnInvalid;
997
+ var defaultWeekSettings = null;
998
+
999
+ class Settings {
1000
+ static get now() {
1001
+ return now;
1002
+ }
1003
+ static set now(n2) {
1004
+ now = n2;
1005
+ }
1006
+ static set defaultZone(zone) {
1007
+ defaultZone = zone;
1008
+ }
1009
+ static get defaultZone() {
1010
+ return normalizeZone(defaultZone, SystemZone.instance);
1011
+ }
1012
+ static get defaultLocale() {
1013
+ return defaultLocale;
1014
+ }
1015
+ static set defaultLocale(locale) {
1016
+ defaultLocale = locale;
1017
+ }
1018
+ static get defaultNumberingSystem() {
1019
+ return defaultNumberingSystem;
1020
+ }
1021
+ static set defaultNumberingSystem(numberingSystem) {
1022
+ defaultNumberingSystem = numberingSystem;
1023
+ }
1024
+ static get defaultOutputCalendar() {
1025
+ return defaultOutputCalendar;
1026
+ }
1027
+ static set defaultOutputCalendar(outputCalendar) {
1028
+ defaultOutputCalendar = outputCalendar;
1029
+ }
1030
+ static get defaultWeekSettings() {
1031
+ return defaultWeekSettings;
1032
+ }
1033
+ static set defaultWeekSettings(weekSettings) {
1034
+ defaultWeekSettings = validateWeekSettings(weekSettings);
1035
+ }
1036
+ static get twoDigitCutoffYear() {
1037
+ return twoDigitCutoffYear;
1038
+ }
1039
+ static set twoDigitCutoffYear(cutoffYear) {
1040
+ twoDigitCutoffYear = cutoffYear % 100;
1041
+ }
1042
+ static get throwOnInvalid() {
1043
+ return throwOnInvalid;
1044
+ }
1045
+ static set throwOnInvalid(t) {
1046
+ throwOnInvalid = t;
1047
+ }
1048
+ static resetCaches() {
1049
+ Locale.resetCache();
1050
+ IANAZone.resetCache();
1051
+ DateTime.resetCache();
1052
+ resetDigitRegexCache();
1053
+ }
1054
+ }
1055
+
1056
+ class Invalid {
1057
+ constructor(reason, explanation) {
1058
+ this.reason = reason;
1059
+ this.explanation = explanation;
1060
+ }
1061
+ toMessage() {
1062
+ if (this.explanation) {
1063
+ return `${this.reason}: ${this.explanation}`;
1064
+ } else {
1065
+ return this.reason;
1066
+ }
1067
+ }
1068
+ }
1069
+ var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
1070
+ var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
1071
+ function unitOutOfRange(unit, value) {
1072
+ return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
1073
+ }
1074
+ function dayOfWeek(year, month, day) {
1075
+ const d = new Date(Date.UTC(year, month - 1, day));
1076
+ if (year < 100 && year >= 0) {
1077
+ d.setUTCFullYear(d.getUTCFullYear() - 1900);
1078
+ }
1079
+ const js = d.getUTCDay();
1080
+ return js === 0 ? 7 : js;
1081
+ }
1082
+ function computeOrdinal(year, month, day) {
1083
+ return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
1084
+ }
1085
+ function uncomputeOrdinal(year, ordinal) {
1086
+ const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i) => i < ordinal), day = ordinal - table[month0];
1087
+ return { month: month0 + 1, day };
1088
+ }
1089
+ function isoWeekdayToLocal(isoWeekday, startOfWeek) {
1090
+ return (isoWeekday - startOfWeek + 7) % 7 + 1;
1091
+ }
1092
+ function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
1093
+ const { year, month, day } = gregObj, ordinal = computeOrdinal(year, month, day), weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
1094
+ let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), weekYear;
1095
+ if (weekNumber < 1) {
1096
+ weekYear = year - 1;
1097
+ weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
1098
+ } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
1099
+ weekYear = year + 1;
1100
+ weekNumber = 1;
1101
+ } else {
1102
+ weekYear = year;
1103
+ }
1104
+ return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };
1105
+ }
1106
+ function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
1107
+ const { weekYear, weekNumber, weekday } = weekData, weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), yearInDays = daysInYear(weekYear);
1108
+ let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, year;
1109
+ if (ordinal < 1) {
1110
+ year = weekYear - 1;
1111
+ ordinal += daysInYear(year);
1112
+ } else if (ordinal > yearInDays) {
1113
+ year = weekYear + 1;
1114
+ ordinal -= daysInYear(weekYear);
1115
+ } else {
1116
+ year = weekYear;
1117
+ }
1118
+ const { month, day } = uncomputeOrdinal(year, ordinal);
1119
+ return { year, month, day, ...timeObject(weekData) };
1120
+ }
1121
+ function gregorianToOrdinal(gregData) {
1122
+ const { year, month, day } = gregData;
1123
+ const ordinal = computeOrdinal(year, month, day);
1124
+ return { year, ordinal, ...timeObject(gregData) };
1125
+ }
1126
+ function ordinalToGregorian(ordinalData) {
1127
+ const { year, ordinal } = ordinalData;
1128
+ const { month, day } = uncomputeOrdinal(year, ordinal);
1129
+ return { year, month, day, ...timeObject(ordinalData) };
1130
+ }
1131
+ function usesLocalWeekValues(obj, loc) {
1132
+ const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
1133
+ if (hasLocaleWeekData) {
1134
+ const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
1135
+ if (hasIsoWeekData) {
1136
+ throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
1137
+ }
1138
+ if (!isUndefined(obj.localWeekday))
1139
+ obj.weekday = obj.localWeekday;
1140
+ if (!isUndefined(obj.localWeekNumber))
1141
+ obj.weekNumber = obj.localWeekNumber;
1142
+ if (!isUndefined(obj.localWeekYear))
1143
+ obj.weekYear = obj.localWeekYear;
1144
+ delete obj.localWeekday;
1145
+ delete obj.localWeekNumber;
1146
+ delete obj.localWeekYear;
1147
+ return {
1148
+ minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
1149
+ startOfWeek: loc.getStartOfWeek()
1150
+ };
1151
+ } else {
1152
+ return { minDaysInFirstWeek: 4, startOfWeek: 1 };
1153
+ }
1154
+ }
1155
+ function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
1156
+ const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), validWeekday = integerBetween(obj.weekday, 1, 7);
1157
+ if (!validYear) {
1158
+ return unitOutOfRange("weekYear", obj.weekYear);
1159
+ } else if (!validWeek) {
1160
+ return unitOutOfRange("week", obj.weekNumber);
1161
+ } else if (!validWeekday) {
1162
+ return unitOutOfRange("weekday", obj.weekday);
1163
+ } else
1164
+ return false;
1165
+ }
1166
+ function hasInvalidOrdinalData(obj) {
1167
+ const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
1168
+ if (!validYear) {
1169
+ return unitOutOfRange("year", obj.year);
1170
+ } else if (!validOrdinal) {
1171
+ return unitOutOfRange("ordinal", obj.ordinal);
1172
+ } else
1173
+ return false;
1174
+ }
1175
+ function hasInvalidGregorianData(obj) {
1176
+ const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
1177
+ if (!validYear) {
1178
+ return unitOutOfRange("year", obj.year);
1179
+ } else if (!validMonth) {
1180
+ return unitOutOfRange("month", obj.month);
1181
+ } else if (!validDay) {
1182
+ return unitOutOfRange("day", obj.day);
1183
+ } else
1184
+ return false;
1185
+ }
1186
+ function hasInvalidTimeData(obj) {
1187
+ const { hour, minute, second, millisecond } = obj;
1188
+ const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999);
1189
+ if (!validHour) {
1190
+ return unitOutOfRange("hour", hour);
1191
+ } else if (!validMinute) {
1192
+ return unitOutOfRange("minute", minute);
1193
+ } else if (!validSecond) {
1194
+ return unitOutOfRange("second", second);
1195
+ } else if (!validMillisecond) {
1196
+ return unitOutOfRange("millisecond", millisecond);
1197
+ } else
1198
+ return false;
1199
+ }
1200
+ function isUndefined(o) {
1201
+ return typeof o === "undefined";
1202
+ }
1203
+ function isNumber(o) {
1204
+ return typeof o === "number";
1205
+ }
1206
+ function isInteger(o) {
1207
+ return typeof o === "number" && o % 1 === 0;
1208
+ }
1209
+ function isString(o) {
1210
+ return typeof o === "string";
1211
+ }
1212
+ function isDate(o) {
1213
+ return Object.prototype.toString.call(o) === "[object Date]";
1214
+ }
1215
+ function hasRelative() {
1216
+ try {
1217
+ return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat;
1218
+ } catch (e) {
1219
+ return false;
1220
+ }
1221
+ }
1222
+ function hasLocaleWeekInfo() {
1223
+ try {
1224
+ return typeof Intl !== "undefined" && !!Intl.Locale && (("weekInfo" in Intl.Locale.prototype) || ("getWeekInfo" in Intl.Locale.prototype));
1225
+ } catch (e) {
1226
+ return false;
1227
+ }
1228
+ }
1229
+ function maybeArray(thing) {
1230
+ return Array.isArray(thing) ? thing : [thing];
1231
+ }
1232
+ function bestBy(arr, by, compare) {
1233
+ if (arr.length === 0) {
1234
+ return;
1235
+ }
1236
+ return arr.reduce((best, next) => {
1237
+ const pair = [by(next), next];
1238
+ if (!best) {
1239
+ return pair;
1240
+ } else if (compare(best[0], pair[0]) === best[0]) {
1241
+ return best;
1242
+ } else {
1243
+ return pair;
1244
+ }
1245
+ }, null)[1];
1246
+ }
1247
+ function pick(obj, keys) {
1248
+ return keys.reduce((a, k) => {
1249
+ a[k] = obj[k];
1250
+ return a;
1251
+ }, {});
1252
+ }
1253
+ function hasOwnProperty(obj, prop) {
1254
+ return Object.prototype.hasOwnProperty.call(obj, prop);
1255
+ }
1256
+ function validateWeekSettings(settings) {
1257
+ if (settings == null) {
1258
+ return null;
1259
+ } else if (typeof settings !== "object") {
1260
+ throw new InvalidArgumentError("Week settings must be an object");
1261
+ } else {
1262
+ if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some((v) => !integerBetween(v, 1, 7))) {
1263
+ throw new InvalidArgumentError("Invalid week settings");
1264
+ }
1265
+ return {
1266
+ firstDay: settings.firstDay,
1267
+ minimalDays: settings.minimalDays,
1268
+ weekend: Array.from(settings.weekend)
1269
+ };
1270
+ }
1271
+ }
1272
+ function integerBetween(thing, bottom, top) {
1273
+ return isInteger(thing) && thing >= bottom && thing <= top;
1274
+ }
1275
+ function floorMod(x, n2) {
1276
+ return x - n2 * Math.floor(x / n2);
1277
+ }
1278
+ function padStart(input, n2 = 2) {
1279
+ const isNeg = input < 0;
1280
+ let padded;
1281
+ if (isNeg) {
1282
+ padded = "-" + ("" + -input).padStart(n2, "0");
1283
+ } else {
1284
+ padded = ("" + input).padStart(n2, "0");
1285
+ }
1286
+ return padded;
1287
+ }
1288
+ function parseInteger(string) {
1289
+ if (isUndefined(string) || string === null || string === "") {
1290
+ return;
1291
+ } else {
1292
+ return parseInt(string, 10);
1293
+ }
1294
+ }
1295
+ function parseFloating(string) {
1296
+ if (isUndefined(string) || string === null || string === "") {
1297
+ return;
1298
+ } else {
1299
+ return parseFloat(string);
1300
+ }
1301
+ }
1302
+ function parseMillis(fraction) {
1303
+ if (isUndefined(fraction) || fraction === null || fraction === "") {
1304
+ return;
1305
+ } else {
1306
+ const f = parseFloat("0." + fraction) * 1000;
1307
+ return Math.floor(f);
1308
+ }
1309
+ }
1310
+ function roundTo(number, digits, rounding = "round") {
1311
+ const factor = 10 ** digits;
1312
+ switch (rounding) {
1313
+ case "expand":
1314
+ return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor;
1315
+ case "trunc":
1316
+ return Math.trunc(number * factor) / factor;
1317
+ case "round":
1318
+ return Math.round(number * factor) / factor;
1319
+ case "floor":
1320
+ return Math.floor(number * factor) / factor;
1321
+ case "ceil":
1322
+ return Math.ceil(number * factor) / factor;
1323
+ default:
1324
+ throw new RangeError(`Value rounding ${rounding} is out of range`);
1325
+ }
1326
+ }
1327
+ function isLeapYear(year) {
1328
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
1329
+ }
1330
+ function daysInYear(year) {
1331
+ return isLeapYear(year) ? 366 : 365;
1332
+ }
1333
+ function daysInMonth(year, month) {
1334
+ const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12;
1335
+ if (modMonth === 2) {
1336
+ return isLeapYear(modYear) ? 29 : 28;
1337
+ } else {
1338
+ return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];
1339
+ }
1340
+ }
1341
+ function objToLocalTS(obj) {
1342
+ let d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
1343
+ if (obj.year < 100 && obj.year >= 0) {
1344
+ d = new Date(d);
1345
+ d.setUTCFullYear(obj.year, obj.month - 1, obj.day);
1346
+ }
1347
+ return +d;
1348
+ }
1349
+ function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
1350
+ const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
1351
+ return -fwdlw + minDaysInFirstWeek - 1;
1352
+ }
1353
+ function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {
1354
+ const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
1355
+ const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
1356
+ return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
1357
+ }
1358
+ function untruncateYear(year) {
1359
+ if (year > 99) {
1360
+ return year;
1361
+ } else
1362
+ return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;
1363
+ }
1364
+ function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {
1365
+ const date = new Date(ts), intlOpts = {
1366
+ hourCycle: "h23",
1367
+ year: "numeric",
1368
+ month: "2-digit",
1369
+ day: "2-digit",
1370
+ hour: "2-digit",
1371
+ minute: "2-digit"
1372
+ };
1373
+ if (timeZone) {
1374
+ intlOpts.timeZone = timeZone;
1375
+ }
1376
+ const modified = { timeZoneName: offsetFormat, ...intlOpts };
1377
+ const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find((m) => m.type.toLowerCase() === "timezonename");
1378
+ return parsed ? parsed.value : null;
1379
+ }
1380
+ function signedOffset(offHourStr, offMinuteStr) {
1381
+ let offHour = parseInt(offHourStr, 10);
1382
+ if (Number.isNaN(offHour)) {
1383
+ offHour = 0;
1384
+ }
1385
+ const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;
1386
+ return offHour * 60 + offMinSigned;
1387
+ }
1388
+ function asNumber(value) {
1389
+ const numericValue = Number(value);
1390
+ if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue))
1391
+ throw new InvalidArgumentError(`Invalid unit value ${value}`);
1392
+ return numericValue;
1393
+ }
1394
+ function normalizeObject(obj, normalizer) {
1395
+ const normalized = {};
1396
+ for (const u in obj) {
1397
+ if (hasOwnProperty(obj, u)) {
1398
+ const v = obj[u];
1399
+ if (v === undefined || v === null)
1400
+ continue;
1401
+ normalized[normalizer(u)] = asNumber(v);
1402
+ }
1403
+ }
1404
+ return normalized;
1405
+ }
1406
+ function formatOffset(offset, format) {
1407
+ const hours = Math.trunc(Math.abs(offset / 60)), minutes = Math.trunc(Math.abs(offset % 60)), sign = offset >= 0 ? "+" : "-";
1408
+ switch (format) {
1409
+ case "short":
1410
+ return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;
1411
+ case "narrow":
1412
+ return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`;
1413
+ case "techie":
1414
+ return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;
1415
+ default:
1416
+ throw new RangeError(`Value format ${format} is out of range for property format`);
1417
+ }
1418
+ }
1419
+ function timeObject(obj) {
1420
+ return pick(obj, ["hour", "minute", "second", "millisecond"]);
1421
+ }
1422
+ var monthsLong = [
1423
+ "January",
1424
+ "February",
1425
+ "March",
1426
+ "April",
1427
+ "May",
1428
+ "June",
1429
+ "July",
1430
+ "August",
1431
+ "September",
1432
+ "October",
1433
+ "November",
1434
+ "December"
1435
+ ];
1436
+ var monthsShort = [
1437
+ "Jan",
1438
+ "Feb",
1439
+ "Mar",
1440
+ "Apr",
1441
+ "May",
1442
+ "Jun",
1443
+ "Jul",
1444
+ "Aug",
1445
+ "Sep",
1446
+ "Oct",
1447
+ "Nov",
1448
+ "Dec"
1449
+ ];
1450
+ var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
1451
+ function months(length) {
1452
+ switch (length) {
1453
+ case "narrow":
1454
+ return [...monthsNarrow];
1455
+ case "short":
1456
+ return [...monthsShort];
1457
+ case "long":
1458
+ return [...monthsLong];
1459
+ case "numeric":
1460
+ return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
1461
+ case "2-digit":
1462
+ return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
1463
+ default:
1464
+ return null;
1465
+ }
1466
+ }
1467
+ var weekdaysLong = [
1468
+ "Monday",
1469
+ "Tuesday",
1470
+ "Wednesday",
1471
+ "Thursday",
1472
+ "Friday",
1473
+ "Saturday",
1474
+ "Sunday"
1475
+ ];
1476
+ var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
1477
+ var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"];
1478
+ function weekdays(length) {
1479
+ switch (length) {
1480
+ case "narrow":
1481
+ return [...weekdaysNarrow];
1482
+ case "short":
1483
+ return [...weekdaysShort];
1484
+ case "long":
1485
+ return [...weekdaysLong];
1486
+ case "numeric":
1487
+ return ["1", "2", "3", "4", "5", "6", "7"];
1488
+ default:
1489
+ return null;
1490
+ }
1491
+ }
1492
+ var meridiems = ["AM", "PM"];
1493
+ var erasLong = ["Before Christ", "Anno Domini"];
1494
+ var erasShort = ["BC", "AD"];
1495
+ var erasNarrow = ["B", "A"];
1496
+ function eras(length) {
1497
+ switch (length) {
1498
+ case "narrow":
1499
+ return [...erasNarrow];
1500
+ case "short":
1501
+ return [...erasShort];
1502
+ case "long":
1503
+ return [...erasLong];
1504
+ default:
1505
+ return null;
1506
+ }
1507
+ }
1508
+ function meridiemForDateTime(dt) {
1509
+ return meridiems[dt.hour < 12 ? 0 : 1];
1510
+ }
1511
+ function weekdayForDateTime(dt, length) {
1512
+ return weekdays(length)[dt.weekday - 1];
1513
+ }
1514
+ function monthForDateTime(dt, length) {
1515
+ return months(length)[dt.month - 1];
1516
+ }
1517
+ function eraForDateTime(dt, length) {
1518
+ return eras(length)[dt.year < 0 ? 0 : 1];
1519
+ }
1520
+ function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
1521
+ const units = {
1522
+ years: ["year", "yr."],
1523
+ quarters: ["quarter", "qtr."],
1524
+ months: ["month", "mo."],
1525
+ weeks: ["week", "wk."],
1526
+ days: ["day", "day", "days"],
1527
+ hours: ["hour", "hr."],
1528
+ minutes: ["minute", "min."],
1529
+ seconds: ["second", "sec."]
1530
+ };
1531
+ const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1;
1532
+ if (numeric === "auto" && lastable) {
1533
+ const isDay = unit === "days";
1534
+ switch (count) {
1535
+ case 1:
1536
+ return isDay ? "tomorrow" : `next ${units[unit][0]}`;
1537
+ case -1:
1538
+ return isDay ? "yesterday" : `last ${units[unit][0]}`;
1539
+ case 0:
1540
+ return isDay ? "today" : `this ${units[unit][0]}`;
1541
+ }
1542
+ }
1543
+ const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = fmtValue === 1, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit;
1544
+ return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
1545
+ }
1546
+ function stringifyTokens(splits, tokenToString) {
1547
+ let s2 = "";
1548
+ for (const token of splits) {
1549
+ if (token.literal) {
1550
+ s2 += token.val;
1551
+ } else {
1552
+ s2 += tokenToString(token.val);
1553
+ }
1554
+ }
1555
+ return s2;
1556
+ }
1557
+ var macroTokenToFormatOpts = {
1558
+ D: DATE_SHORT,
1559
+ DD: DATE_MED,
1560
+ DDD: DATE_FULL,
1561
+ DDDD: DATE_HUGE,
1562
+ t: TIME_SIMPLE,
1563
+ tt: TIME_WITH_SECONDS,
1564
+ ttt: TIME_WITH_SHORT_OFFSET,
1565
+ tttt: TIME_WITH_LONG_OFFSET,
1566
+ T: TIME_24_SIMPLE,
1567
+ TT: TIME_24_WITH_SECONDS,
1568
+ TTT: TIME_24_WITH_SHORT_OFFSET,
1569
+ TTTT: TIME_24_WITH_LONG_OFFSET,
1570
+ f: DATETIME_SHORT,
1571
+ ff: DATETIME_MED,
1572
+ fff: DATETIME_FULL,
1573
+ ffff: DATETIME_HUGE,
1574
+ F: DATETIME_SHORT_WITH_SECONDS,
1575
+ FF: DATETIME_MED_WITH_SECONDS,
1576
+ FFF: DATETIME_FULL_WITH_SECONDS,
1577
+ FFFF: DATETIME_HUGE_WITH_SECONDS
1578
+ };
1579
+
1580
+ class Formatter {
1581
+ static create(locale, opts = {}) {
1582
+ return new Formatter(locale, opts);
1583
+ }
1584
+ static parseFormat(fmt) {
1585
+ let current = null, currentFull = "", bracketed = false;
1586
+ const splits = [];
1587
+ for (let i = 0;i < fmt.length; i++) {
1588
+ const c2 = fmt.charAt(i);
1589
+ if (c2 === "'") {
1590
+ if (currentFull.length > 0 || bracketed) {
1591
+ splits.push({
1592
+ literal: bracketed || /^\s+$/.test(currentFull),
1593
+ val: currentFull === "" ? "'" : currentFull
1594
+ });
1595
+ }
1596
+ current = null;
1597
+ currentFull = "";
1598
+ bracketed = !bracketed;
1599
+ } else if (bracketed) {
1600
+ currentFull += c2;
1601
+ } else if (c2 === current) {
1602
+ currentFull += c2;
1603
+ } else {
1604
+ if (currentFull.length > 0) {
1605
+ splits.push({ literal: /^\s+$/.test(currentFull), val: currentFull });
1606
+ }
1607
+ currentFull = c2;
1608
+ current = c2;
1609
+ }
1610
+ }
1611
+ if (currentFull.length > 0) {
1612
+ splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull });
1613
+ }
1614
+ return splits;
1615
+ }
1616
+ static macroTokenToFormatOpts(token) {
1617
+ return macroTokenToFormatOpts[token];
1618
+ }
1619
+ constructor(locale, formatOpts) {
1620
+ this.opts = formatOpts;
1621
+ this.loc = locale;
1622
+ this.systemLoc = null;
1623
+ }
1624
+ formatWithSystemDefault(dt, opts) {
1625
+ if (this.systemLoc === null) {
1626
+ this.systemLoc = this.loc.redefaultToSystem();
1627
+ }
1628
+ const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });
1629
+ return df.format();
1630
+ }
1631
+ dtFormatter(dt, opts = {}) {
1632
+ return this.loc.dtFormatter(dt, { ...this.opts, ...opts });
1633
+ }
1634
+ formatDateTime(dt, opts) {
1635
+ return this.dtFormatter(dt, opts).format();
1636
+ }
1637
+ formatDateTimeParts(dt, opts) {
1638
+ return this.dtFormatter(dt, opts).formatToParts();
1639
+ }
1640
+ formatInterval(interval, opts) {
1641
+ const df = this.dtFormatter(interval.start, opts);
1642
+ return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
1643
+ }
1644
+ resolvedOptions(dt, opts) {
1645
+ return this.dtFormatter(dt, opts).resolvedOptions();
1646
+ }
1647
+ num(n2, p = 0, signDisplay = undefined) {
1648
+ if (this.opts.forceSimple) {
1649
+ return padStart(n2, p);
1650
+ }
1651
+ const opts = { ...this.opts };
1652
+ if (p > 0) {
1653
+ opts.padTo = p;
1654
+ }
1655
+ if (signDisplay) {
1656
+ opts.signDisplay = signDisplay;
1657
+ }
1658
+ return this.loc.numberFormatter(opts).format(n2);
1659
+ }
1660
+ formatDateTimeFromString(dt, fmt) {
1661
+ const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string = (opts, extract) => this.loc.extract(dt, opts, extract), formatOffset2 = (opts) => {
1662
+ if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
1663
+ return "Z";
1664
+ }
1665
+ return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : "";
1666
+ }, meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { month: length } : { month: length, day: "numeric" }, "month"), weekday = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" }, "weekday"), maybeMacro = (token) => {
1667
+ const formatOpts = Formatter.macroTokenToFormatOpts(token);
1668
+ if (formatOpts) {
1669
+ return this.formatWithSystemDefault(dt, formatOpts);
1670
+ } else {
1671
+ return token;
1672
+ }
1673
+ }, era = (length) => knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, "era"), tokenToString = (token) => {
1674
+ switch (token) {
1675
+ case "S":
1676
+ return this.num(dt.millisecond);
1677
+ case "u":
1678
+ case "SSS":
1679
+ return this.num(dt.millisecond, 3);
1680
+ case "s":
1681
+ return this.num(dt.second);
1682
+ case "ss":
1683
+ return this.num(dt.second, 2);
1684
+ case "uu":
1685
+ return this.num(Math.floor(dt.millisecond / 10), 2);
1686
+ case "uuu":
1687
+ return this.num(Math.floor(dt.millisecond / 100));
1688
+ case "m":
1689
+ return this.num(dt.minute);
1690
+ case "mm":
1691
+ return this.num(dt.minute, 2);
1692
+ case "h":
1693
+ return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
1694
+ case "hh":
1695
+ return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
1696
+ case "H":
1697
+ return this.num(dt.hour);
1698
+ case "HH":
1699
+ return this.num(dt.hour, 2);
1700
+ case "Z":
1701
+ return formatOffset2({ format: "narrow", allowZ: this.opts.allowZ });
1702
+ case "ZZ":
1703
+ return formatOffset2({ format: "short", allowZ: this.opts.allowZ });
1704
+ case "ZZZ":
1705
+ return formatOffset2({ format: "techie", allowZ: this.opts.allowZ });
1706
+ case "ZZZZ":
1707
+ return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale });
1708
+ case "ZZZZZ":
1709
+ return dt.zone.offsetName(dt.ts, { format: "long", locale: this.loc.locale });
1710
+ case "z":
1711
+ return dt.zoneName;
1712
+ case "a":
1713
+ return meridiem();
1714
+ case "d":
1715
+ return useDateTimeFormatter ? string({ day: "numeric" }, "day") : this.num(dt.day);
1716
+ case "dd":
1717
+ return useDateTimeFormatter ? string({ day: "2-digit" }, "day") : this.num(dt.day, 2);
1718
+ case "c":
1719
+ return this.num(dt.weekday);
1720
+ case "ccc":
1721
+ return weekday("short", true);
1722
+ case "cccc":
1723
+ return weekday("long", true);
1724
+ case "ccccc":
1725
+ return weekday("narrow", true);
1726
+ case "E":
1727
+ return this.num(dt.weekday);
1728
+ case "EEE":
1729
+ return weekday("short", false);
1730
+ case "EEEE":
1731
+ return weekday("long", false);
1732
+ case "EEEEE":
1733
+ return weekday("narrow", false);
1734
+ case "L":
1735
+ return useDateTimeFormatter ? string({ month: "numeric", day: "numeric" }, "month") : this.num(dt.month);
1736
+ case "LL":
1737
+ return useDateTimeFormatter ? string({ month: "2-digit", day: "numeric" }, "month") : this.num(dt.month, 2);
1738
+ case "LLL":
1739
+ return month("short", true);
1740
+ case "LLLL":
1741
+ return month("long", true);
1742
+ case "LLLLL":
1743
+ return month("narrow", true);
1744
+ case "M":
1745
+ return useDateTimeFormatter ? string({ month: "numeric" }, "month") : this.num(dt.month);
1746
+ case "MM":
1747
+ return useDateTimeFormatter ? string({ month: "2-digit" }, "month") : this.num(dt.month, 2);
1748
+ case "MMM":
1749
+ return month("short", false);
1750
+ case "MMMM":
1751
+ return month("long", false);
1752
+ case "MMMMM":
1753
+ return month("narrow", false);
1754
+ case "y":
1755
+ return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year);
1756
+ case "yy":
1757
+ return useDateTimeFormatter ? string({ year: "2-digit" }, "year") : this.num(dt.year.toString().slice(-2), 2);
1758
+ case "yyyy":
1759
+ return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year, 4);
1760
+ case "yyyyyy":
1761
+ return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year, 6);
1762
+ case "G":
1763
+ return era("short");
1764
+ case "GG":
1765
+ return era("long");
1766
+ case "GGGGG":
1767
+ return era("narrow");
1768
+ case "kk":
1769
+ return this.num(dt.weekYear.toString().slice(-2), 2);
1770
+ case "kkkk":
1771
+ return this.num(dt.weekYear, 4);
1772
+ case "W":
1773
+ return this.num(dt.weekNumber);
1774
+ case "WW":
1775
+ return this.num(dt.weekNumber, 2);
1776
+ case "n":
1777
+ return this.num(dt.localWeekNumber);
1778
+ case "nn":
1779
+ return this.num(dt.localWeekNumber, 2);
1780
+ case "ii":
1781
+ return this.num(dt.localWeekYear.toString().slice(-2), 2);
1782
+ case "iiii":
1783
+ return this.num(dt.localWeekYear, 4);
1784
+ case "o":
1785
+ return this.num(dt.ordinal);
1786
+ case "ooo":
1787
+ return this.num(dt.ordinal, 3);
1788
+ case "q":
1789
+ return this.num(dt.quarter);
1790
+ case "qq":
1791
+ return this.num(dt.quarter, 2);
1792
+ case "X":
1793
+ return this.num(Math.floor(dt.ts / 1000));
1794
+ case "x":
1795
+ return this.num(dt.ts);
1796
+ default:
1797
+ return maybeMacro(token);
1798
+ }
1799
+ };
1800
+ return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
1801
+ }
1802
+ formatDurationFromString(dur, fmt) {
1803
+ const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1;
1804
+ const tokenToField = (token) => {
1805
+ switch (token[0]) {
1806
+ case "S":
1807
+ return "milliseconds";
1808
+ case "s":
1809
+ return "seconds";
1810
+ case "m":
1811
+ return "minutes";
1812
+ case "h":
1813
+ return "hours";
1814
+ case "d":
1815
+ return "days";
1816
+ case "w":
1817
+ return "weeks";
1818
+ case "M":
1819
+ return "months";
1820
+ case "y":
1821
+ return "years";
1822
+ default:
1823
+ return null;
1824
+ }
1825
+ }, tokenToString = (lildur, info) => (token) => {
1826
+ const mapped = tokenToField(token);
1827
+ if (mapped) {
1828
+ const inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
1829
+ let signDisplay;
1830
+ if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) {
1831
+ signDisplay = "never";
1832
+ } else if (this.opts.signMode === "all") {
1833
+ signDisplay = "always";
1834
+ } else {
1835
+ signDisplay = "auto";
1836
+ }
1837
+ return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
1838
+ } else {
1839
+ return token;
1840
+ }
1841
+ }, 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 = {
1842
+ isNegativeDuration: collapsed < 0,
1843
+ largestUnit: Object.keys(collapsed.values)[0]
1844
+ };
1845
+ return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
1846
+ }
1847
+ }
1848
+ var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
1849
+ function combineRegexes(...regexes) {
1850
+ const full = regexes.reduce((f, r) => f + r.source, "");
1851
+ return RegExp(`^${full}$`);
1852
+ }
1853
+ function combineExtractors(...extractors) {
1854
+ return (m) => extractors.reduce(([mergedVals, mergedZone, cursor], ex) => {
1855
+ const [val, zone, next] = ex(m, cursor);
1856
+ return [{ ...mergedVals, ...val }, zone || mergedZone, next];
1857
+ }, [{}, null, 1]).slice(0, 2);
1858
+ }
1859
+ function parse(s2, ...patterns) {
1860
+ if (s2 == null) {
1861
+ return [null, null];
1862
+ }
1863
+ for (const [regex, extractor] of patterns) {
1864
+ const m = regex.exec(s2);
1865
+ if (m) {
1866
+ return extractor(m);
1867
+ }
1868
+ }
1869
+ return [null, null];
1870
+ }
1871
+ function simpleParse(...keys) {
1872
+ return (match, cursor) => {
1873
+ const ret = {};
1874
+ let i;
1875
+ for (i = 0;i < keys.length; i++) {
1876
+ ret[keys[i]] = parseInteger(match[cursor + i]);
1877
+ }
1878
+ return [ret, null, cursor + i];
1879
+ };
1880
+ }
1881
+ var offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
1882
+ var isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
1883
+ var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
1884
+ var isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
1885
+ var isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
1886
+ var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
1887
+ var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
1888
+ var isoOrdinalRegex = /(\d{4})-?(\d{3})/;
1889
+ var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
1890
+ var extractISOOrdinalData = simpleParse("year", "ordinal");
1891
+ var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
1892
+ var sqlTimeRegex = RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`);
1893
+ var sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
1894
+ function int(match, pos, fallback) {
1895
+ const m = match[pos];
1896
+ return isUndefined(m) ? fallback : parseInteger(m);
1897
+ }
1898
+ function extractISOYmd(match, cursor) {
1899
+ const item = {
1900
+ year: int(match, cursor),
1901
+ month: int(match, cursor + 1, 1),
1902
+ day: int(match, cursor + 2, 1)
1903
+ };
1904
+ return [item, null, cursor + 3];
1905
+ }
1906
+ function extractISOTime(match, cursor) {
1907
+ const item = {
1908
+ hours: int(match, cursor, 0),
1909
+ minutes: int(match, cursor + 1, 0),
1910
+ seconds: int(match, cursor + 2, 0),
1911
+ milliseconds: parseMillis(match[cursor + 3])
1912
+ };
1913
+ return [item, null, cursor + 4];
1914
+ }
1915
+ function extractISOOffset(match, cursor) {
1916
+ const local = !match[cursor] && !match[cursor + 1], fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset);
1917
+ return [{}, zone, cursor + 3];
1918
+ }
1919
+ function extractIANAZone(match, cursor) {
1920
+ const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;
1921
+ return [{}, zone, cursor + 1];
1922
+ }
1923
+ var isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
1924
+ var 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)?)?)$/;
1925
+ function extractISODuration(match) {
1926
+ const [s2, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match;
1927
+ const hasNegativePrefix = s2[0] === "-";
1928
+ const negativeSeconds = secondStr && secondStr[0] === "-";
1929
+ const maybeNegate = (num, force = false) => num !== undefined && (force || num && hasNegativePrefix) ? -num : num;
1930
+ return [
1931
+ {
1932
+ years: maybeNegate(parseFloating(yearStr)),
1933
+ months: maybeNegate(parseFloating(monthStr)),
1934
+ weeks: maybeNegate(parseFloating(weekStr)),
1935
+ days: maybeNegate(parseFloating(dayStr)),
1936
+ hours: maybeNegate(parseFloating(hourStr)),
1937
+ minutes: maybeNegate(parseFloating(minuteStr)),
1938
+ seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"),
1939
+ milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
1940
+ }
1941
+ ];
1942
+ }
1943
+ var obsOffsets = {
1944
+ GMT: 0,
1945
+ EDT: -4 * 60,
1946
+ EST: -5 * 60,
1947
+ CDT: -5 * 60,
1948
+ CST: -6 * 60,
1949
+ MDT: -6 * 60,
1950
+ MST: -7 * 60,
1951
+ PDT: -7 * 60,
1952
+ PST: -8 * 60
1953
+ };
1954
+ function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
1955
+ const result = {
1956
+ year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
1957
+ month: monthsShort.indexOf(monthStr) + 1,
1958
+ day: parseInteger(dayStr),
1959
+ hour: parseInteger(hourStr),
1960
+ minute: parseInteger(minuteStr)
1961
+ };
1962
+ if (secondStr)
1963
+ result.second = parseInteger(secondStr);
1964
+ if (weekdayStr) {
1965
+ result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
1966
+ }
1967
+ return result;
1968
+ }
1969
+ var 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)))$/;
1970
+ function extractRFC2822(match) {
1971
+ const [
1972
+ ,
1973
+ weekdayStr,
1974
+ dayStr,
1975
+ monthStr,
1976
+ yearStr,
1977
+ hourStr,
1978
+ minuteStr,
1979
+ secondStr,
1980
+ obsOffset,
1981
+ milOffset,
1982
+ offHourStr,
1983
+ offMinuteStr
1984
+ ] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
1985
+ let offset;
1986
+ if (obsOffset) {
1987
+ offset = obsOffsets[obsOffset];
1988
+ } else if (milOffset) {
1989
+ offset = 0;
1990
+ } else {
1991
+ offset = signedOffset(offHourStr, offMinuteStr);
1992
+ }
1993
+ return [result, new FixedOffsetZone(offset)];
1994
+ }
1995
+ function preprocessRFC2822(s2) {
1996
+ return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
1997
+ }
1998
+ var 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$/;
1999
+ var 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$/;
2000
+ var 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})$/;
2001
+ function extractRFC1123Or850(match) {
2002
+ const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
2003
+ return [result, FixedOffsetZone.utcInstance];
2004
+ }
2005
+ function extractASCII(match) {
2006
+ const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
2007
+ return [result, FixedOffsetZone.utcInstance];
2008
+ }
2009
+ var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
2010
+ var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
2011
+ var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
2012
+ var isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
2013
+ var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
2014
+ var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone);
2015
+ var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone);
2016
+ var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
2017
+ function parseISODate(s2) {
2018
+ return parse(s2, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]);
2019
+ }
2020
+ function parseRFC2822Date(s2) {
2021
+ return parse(preprocessRFC2822(s2), [rfc2822, extractRFC2822]);
2022
+ }
2023
+ function parseHTTPDate(s2) {
2024
+ return parse(s2, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
2025
+ }
2026
+ function parseISODuration(s2) {
2027
+ return parse(s2, [isoDuration, extractISODuration]);
2028
+ }
2029
+ var extractISOTimeOnly = combineExtractors(extractISOTime);
2030
+ function parseISOTimeOnly(s2) {
2031
+ return parse(s2, [isoTimeOnly, extractISOTimeOnly]);
2032
+ }
2033
+ var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
2034
+ var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
2035
+ var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
2036
+ function parseSQL(s2) {
2037
+ return parse(s2, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
2038
+ }
2039
+ var INVALID$2 = "Invalid Duration";
2040
+ var lowOrderMatrix = {
2041
+ weeks: {
2042
+ days: 7,
2043
+ hours: 7 * 24,
2044
+ minutes: 7 * 24 * 60,
2045
+ seconds: 7 * 24 * 60 * 60,
2046
+ milliseconds: 7 * 24 * 60 * 60 * 1000
2047
+ },
2048
+ days: {
2049
+ hours: 24,
2050
+ minutes: 24 * 60,
2051
+ seconds: 24 * 60 * 60,
2052
+ milliseconds: 24 * 60 * 60 * 1000
2053
+ },
2054
+ hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },
2055
+ minutes: { seconds: 60, milliseconds: 60 * 1000 },
2056
+ seconds: { milliseconds: 1000 }
2057
+ };
2058
+ var casualMatrix = {
2059
+ years: {
2060
+ quarters: 4,
2061
+ months: 12,
2062
+ weeks: 52,
2063
+ days: 365,
2064
+ hours: 365 * 24,
2065
+ minutes: 365 * 24 * 60,
2066
+ seconds: 365 * 24 * 60 * 60,
2067
+ milliseconds: 365 * 24 * 60 * 60 * 1000
2068
+ },
2069
+ quarters: {
2070
+ months: 3,
2071
+ weeks: 13,
2072
+ days: 91,
2073
+ hours: 91 * 24,
2074
+ minutes: 91 * 24 * 60,
2075
+ seconds: 91 * 24 * 60 * 60,
2076
+ milliseconds: 91 * 24 * 60 * 60 * 1000
2077
+ },
2078
+ months: {
2079
+ weeks: 4,
2080
+ days: 30,
2081
+ hours: 30 * 24,
2082
+ minutes: 30 * 24 * 60,
2083
+ seconds: 30 * 24 * 60 * 60,
2084
+ milliseconds: 30 * 24 * 60 * 60 * 1000
2085
+ },
2086
+ ...lowOrderMatrix
2087
+ };
2088
+ var daysInYearAccurate = 146097 / 400;
2089
+ var daysInMonthAccurate = 146097 / 4800;
2090
+ var accurateMatrix = {
2091
+ years: {
2092
+ quarters: 4,
2093
+ months: 12,
2094
+ weeks: daysInYearAccurate / 7,
2095
+ days: daysInYearAccurate,
2096
+ hours: daysInYearAccurate * 24,
2097
+ minutes: daysInYearAccurate * 24 * 60,
2098
+ seconds: daysInYearAccurate * 24 * 60 * 60,
2099
+ milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000
2100
+ },
2101
+ quarters: {
2102
+ months: 3,
2103
+ weeks: daysInYearAccurate / 28,
2104
+ days: daysInYearAccurate / 4,
2105
+ hours: daysInYearAccurate * 24 / 4,
2106
+ minutes: daysInYearAccurate * 24 * 60 / 4,
2107
+ seconds: daysInYearAccurate * 24 * 60 * 60 / 4,
2108
+ milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4
2109
+ },
2110
+ months: {
2111
+ weeks: daysInMonthAccurate / 7,
2112
+ days: daysInMonthAccurate,
2113
+ hours: daysInMonthAccurate * 24,
2114
+ minutes: daysInMonthAccurate * 24 * 60,
2115
+ seconds: daysInMonthAccurate * 24 * 60 * 60,
2116
+ milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000
2117
+ },
2118
+ ...lowOrderMatrix
2119
+ };
2120
+ var orderedUnits$1 = [
2121
+ "years",
2122
+ "quarters",
2123
+ "months",
2124
+ "weeks",
2125
+ "days",
2126
+ "hours",
2127
+ "minutes",
2128
+ "seconds",
2129
+ "milliseconds"
2130
+ ];
2131
+ var reverseUnits = orderedUnits$1.slice(0).reverse();
2132
+ function clone$1(dur, alts, clear = false) {
2133
+ const conf = {
2134
+ values: clear ? alts.values : { ...dur.values, ...alts.values || {} },
2135
+ loc: dur.loc.clone(alts.loc),
2136
+ conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
2137
+ matrix: alts.matrix || dur.matrix
2138
+ };
2139
+ return new Duration(conf);
2140
+ }
2141
+ function durationToMillis(matrix, vals) {
2142
+ let sum = vals.milliseconds ?? 0;
2143
+ for (const unit of reverseUnits.slice(1)) {
2144
+ if (vals[unit]) {
2145
+ sum += vals[unit] * matrix[unit]["milliseconds"];
2146
+ }
2147
+ }
2148
+ return sum;
2149
+ }
2150
+ function normalizeValues(matrix, vals) {
2151
+ const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
2152
+ orderedUnits$1.reduceRight((previous, current) => {
2153
+ if (!isUndefined(vals[current])) {
2154
+ if (previous) {
2155
+ const previousVal = vals[previous] * factor;
2156
+ const conv = matrix[current][previous];
2157
+ const rollUp = Math.floor(previousVal / conv);
2158
+ vals[current] += rollUp * factor;
2159
+ vals[previous] -= rollUp * conv * factor;
2160
+ }
2161
+ return current;
2162
+ } else {
2163
+ return previous;
2164
+ }
2165
+ }, null);
2166
+ orderedUnits$1.reduce((previous, current) => {
2167
+ if (!isUndefined(vals[current])) {
2168
+ if (previous) {
2169
+ const fraction = vals[previous] % 1;
2170
+ vals[previous] -= fraction;
2171
+ vals[current] += fraction * matrix[previous][current];
2172
+ }
2173
+ return current;
2174
+ } else {
2175
+ return previous;
2176
+ }
2177
+ }, null);
2178
+ }
2179
+ function removeZeroes(vals) {
2180
+ const newVals = {};
2181
+ for (const [key, value] of Object.entries(vals)) {
2182
+ if (value !== 0) {
2183
+ newVals[key] = value;
2184
+ }
2185
+ }
2186
+ return newVals;
2187
+ }
2188
+
2189
+ class Duration {
2190
+ constructor(config) {
2191
+ const accurate = config.conversionAccuracy === "longterm" || false;
2192
+ let matrix = accurate ? accurateMatrix : casualMatrix;
2193
+ if (config.matrix) {
2194
+ matrix = config.matrix;
2195
+ }
2196
+ this.values = config.values;
2197
+ this.loc = config.loc || Locale.create();
2198
+ this.conversionAccuracy = accurate ? "longterm" : "casual";
2199
+ this.invalid = config.invalid || null;
2200
+ this.matrix = matrix;
2201
+ this.isLuxonDuration = true;
2202
+ }
2203
+ static fromMillis(count, opts) {
2204
+ return Duration.fromObject({ milliseconds: count }, opts);
2205
+ }
2206
+ static fromObject(obj, opts = {}) {
2207
+ if (obj == null || typeof obj !== "object") {
2208
+ throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}`);
2209
+ }
2210
+ return new Duration({
2211
+ values: normalizeObject(obj, Duration.normalizeUnit),
2212
+ loc: Locale.fromObject(opts),
2213
+ conversionAccuracy: opts.conversionAccuracy,
2214
+ matrix: opts.matrix
2215
+ });
2216
+ }
2217
+ static fromDurationLike(durationLike) {
2218
+ if (isNumber(durationLike)) {
2219
+ return Duration.fromMillis(durationLike);
2220
+ } else if (Duration.isDuration(durationLike)) {
2221
+ return durationLike;
2222
+ } else if (typeof durationLike === "object") {
2223
+ return Duration.fromObject(durationLike);
2224
+ } else {
2225
+ throw new InvalidArgumentError(`Unknown duration argument ${durationLike} of type ${typeof durationLike}`);
2226
+ }
2227
+ }
2228
+ static fromISO(text, opts) {
2229
+ const [parsed] = parseISODuration(text);
2230
+ if (parsed) {
2231
+ return Duration.fromObject(parsed, opts);
2232
+ } else {
2233
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
2234
+ }
2235
+ }
2236
+ static fromISOTime(text, opts) {
2237
+ const [parsed] = parseISOTimeOnly(text);
2238
+ if (parsed) {
2239
+ return Duration.fromObject(parsed, opts);
2240
+ } else {
2241
+ return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
2242
+ }
2243
+ }
2244
+ static invalid(reason, explanation = null) {
2245
+ if (!reason) {
2246
+ throw new InvalidArgumentError("need to specify a reason the Duration is invalid");
2247
+ }
2248
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
2249
+ if (Settings.throwOnInvalid) {
2250
+ throw new InvalidDurationError(invalid);
2251
+ } else {
2252
+ return new Duration({ invalid });
2253
+ }
2254
+ }
2255
+ static normalizeUnit(unit) {
2256
+ const normalized = {
2257
+ year: "years",
2258
+ years: "years",
2259
+ quarter: "quarters",
2260
+ quarters: "quarters",
2261
+ month: "months",
2262
+ months: "months",
2263
+ week: "weeks",
2264
+ weeks: "weeks",
2265
+ day: "days",
2266
+ days: "days",
2267
+ hour: "hours",
2268
+ hours: "hours",
2269
+ minute: "minutes",
2270
+ minutes: "minutes",
2271
+ second: "seconds",
2272
+ seconds: "seconds",
2273
+ millisecond: "milliseconds",
2274
+ milliseconds: "milliseconds"
2275
+ }[unit ? unit.toLowerCase() : unit];
2276
+ if (!normalized)
2277
+ throw new InvalidUnitError(unit);
2278
+ return normalized;
2279
+ }
2280
+ static isDuration(o) {
2281
+ return o && o.isLuxonDuration || false;
2282
+ }
2283
+ get locale() {
2284
+ return this.isValid ? this.loc.locale : null;
2285
+ }
2286
+ get numberingSystem() {
2287
+ return this.isValid ? this.loc.numberingSystem : null;
2288
+ }
2289
+ toFormat(fmt, opts = {}) {
2290
+ const fmtOpts = {
2291
+ ...opts,
2292
+ floor: opts.round !== false && opts.floor !== false
2293
+ };
2294
+ return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
2295
+ }
2296
+ toHuman(opts = {}) {
2297
+ if (!this.isValid)
2298
+ return INVALID$2;
2299
+ const showZeros = opts.showZeros !== false;
2300
+ const l2 = orderedUnits$1.map((unit) => {
2301
+ const val = this.values[unit];
2302
+ if (isUndefined(val) || val === 0 && !showZeros) {
2303
+ return null;
2304
+ }
2305
+ return this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...opts, unit: unit.slice(0, -1) }).format(val);
2306
+ }).filter((n2) => n2);
2307
+ return this.loc.listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }).format(l2);
2308
+ }
2309
+ toObject() {
2310
+ if (!this.isValid)
2311
+ return {};
2312
+ return { ...this.values };
2313
+ }
2314
+ toISO() {
2315
+ if (!this.isValid)
2316
+ return null;
2317
+ let s2 = "P";
2318
+ if (this.years !== 0)
2319
+ s2 += this.years + "Y";
2320
+ if (this.months !== 0 || this.quarters !== 0)
2321
+ s2 += this.months + this.quarters * 3 + "M";
2322
+ if (this.weeks !== 0)
2323
+ s2 += this.weeks + "W";
2324
+ if (this.days !== 0)
2325
+ s2 += this.days + "D";
2326
+ if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)
2327
+ s2 += "T";
2328
+ if (this.hours !== 0)
2329
+ s2 += this.hours + "H";
2330
+ if (this.minutes !== 0)
2331
+ s2 += this.minutes + "M";
2332
+ if (this.seconds !== 0 || this.milliseconds !== 0)
2333
+ s2 += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S";
2334
+ if (s2 === "P")
2335
+ s2 += "T0S";
2336
+ return s2;
2337
+ }
2338
+ toISOTime(opts = {}) {
2339
+ if (!this.isValid)
2340
+ return null;
2341
+ const millis = this.toMillis();
2342
+ if (millis < 0 || millis >= 86400000)
2343
+ return null;
2344
+ opts = {
2345
+ suppressMilliseconds: false,
2346
+ suppressSeconds: false,
2347
+ includePrefix: false,
2348
+ format: "extended",
2349
+ ...opts,
2350
+ includeOffset: false
2351
+ };
2352
+ const dateTime = DateTime.fromMillis(millis, { zone: "UTC" });
2353
+ return dateTime.toISOTime(opts);
2354
+ }
2355
+ toJSON() {
2356
+ return this.toISO();
2357
+ }
2358
+ toString() {
2359
+ return this.toISO();
2360
+ }
2361
+ [Symbol.for("nodejs.util.inspect.custom")]() {
2362
+ if (this.isValid) {
2363
+ return `Duration { values: ${JSON.stringify(this.values)} }`;
2364
+ } else {
2365
+ return `Duration { Invalid, reason: ${this.invalidReason} }`;
2366
+ }
2367
+ }
2368
+ toMillis() {
2369
+ if (!this.isValid)
2370
+ return NaN;
2371
+ return durationToMillis(this.matrix, this.values);
2372
+ }
2373
+ valueOf() {
2374
+ return this.toMillis();
2375
+ }
2376
+ plus(duration) {
2377
+ if (!this.isValid)
2378
+ return this;
2379
+ const dur = Duration.fromDurationLike(duration), result = {};
2380
+ for (const k of orderedUnits$1) {
2381
+ if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {
2382
+ result[k] = dur.get(k) + this.get(k);
2383
+ }
2384
+ }
2385
+ return clone$1(this, { values: result }, true);
2386
+ }
2387
+ minus(duration) {
2388
+ if (!this.isValid)
2389
+ return this;
2390
+ const dur = Duration.fromDurationLike(duration);
2391
+ return this.plus(dur.negate());
2392
+ }
2393
+ mapUnits(fn) {
2394
+ if (!this.isValid)
2395
+ return this;
2396
+ const result = {};
2397
+ for (const k of Object.keys(this.values)) {
2398
+ result[k] = asNumber(fn(this.values[k], k));
2399
+ }
2400
+ return clone$1(this, { values: result }, true);
2401
+ }
2402
+ get(unit) {
2403
+ return this[Duration.normalizeUnit(unit)];
2404
+ }
2405
+ set(values) {
2406
+ if (!this.isValid)
2407
+ return this;
2408
+ const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };
2409
+ return clone$1(this, { values: mixed });
2410
+ }
2411
+ reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {
2412
+ const loc = this.loc.clone({ locale, numberingSystem });
2413
+ const opts = { loc, matrix, conversionAccuracy };
2414
+ return clone$1(this, opts);
2415
+ }
2416
+ as(unit) {
2417
+ return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
2418
+ }
2419
+ normalize() {
2420
+ if (!this.isValid)
2421
+ return this;
2422
+ const vals = this.toObject();
2423
+ normalizeValues(this.matrix, vals);
2424
+ return clone$1(this, { values: vals }, true);
2425
+ }
2426
+ rescale() {
2427
+ if (!this.isValid)
2428
+ return this;
2429
+ const vals = removeZeroes(this.normalize().shiftToAll().toObject());
2430
+ return clone$1(this, { values: vals }, true);
2431
+ }
2432
+ shiftTo(...units) {
2433
+ if (!this.isValid)
2434
+ return this;
2435
+ if (units.length === 0) {
2436
+ return this;
2437
+ }
2438
+ units = units.map((u) => Duration.normalizeUnit(u));
2439
+ const built = {}, accumulated = {}, vals = this.toObject();
2440
+ let lastUnit;
2441
+ for (const k of orderedUnits$1) {
2442
+ if (units.indexOf(k) >= 0) {
2443
+ lastUnit = k;
2444
+ let own = 0;
2445
+ for (const ak in accumulated) {
2446
+ own += this.matrix[ak][k] * accumulated[ak];
2447
+ accumulated[ak] = 0;
2448
+ }
2449
+ if (isNumber(vals[k])) {
2450
+ own += vals[k];
2451
+ }
2452
+ const i = Math.trunc(own);
2453
+ built[k] = i;
2454
+ accumulated[k] = (own * 1000 - i * 1000) / 1000;
2455
+ } else if (isNumber(vals[k])) {
2456
+ accumulated[k] = vals[k];
2457
+ }
2458
+ }
2459
+ for (const key in accumulated) {
2460
+ if (accumulated[key] !== 0) {
2461
+ built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
2462
+ }
2463
+ }
2464
+ normalizeValues(this.matrix, built);
2465
+ return clone$1(this, { values: built }, true);
2466
+ }
2467
+ shiftToAll() {
2468
+ if (!this.isValid)
2469
+ return this;
2470
+ return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds");
2471
+ }
2472
+ negate() {
2473
+ if (!this.isValid)
2474
+ return this;
2475
+ const negated = {};
2476
+ for (const k of Object.keys(this.values)) {
2477
+ negated[k] = this.values[k] === 0 ? 0 : -this.values[k];
2478
+ }
2479
+ return clone$1(this, { values: negated }, true);
2480
+ }
2481
+ removeZeros() {
2482
+ if (!this.isValid)
2483
+ return this;
2484
+ const vals = removeZeroes(this.values);
2485
+ return clone$1(this, { values: vals }, true);
2486
+ }
2487
+ get years() {
2488
+ return this.isValid ? this.values.years || 0 : NaN;
2489
+ }
2490
+ get quarters() {
2491
+ return this.isValid ? this.values.quarters || 0 : NaN;
2492
+ }
2493
+ get months() {
2494
+ return this.isValid ? this.values.months || 0 : NaN;
2495
+ }
2496
+ get weeks() {
2497
+ return this.isValid ? this.values.weeks || 0 : NaN;
2498
+ }
2499
+ get days() {
2500
+ return this.isValid ? this.values.days || 0 : NaN;
2501
+ }
2502
+ get hours() {
2503
+ return this.isValid ? this.values.hours || 0 : NaN;
2504
+ }
2505
+ get minutes() {
2506
+ return this.isValid ? this.values.minutes || 0 : NaN;
2507
+ }
2508
+ get seconds() {
2509
+ return this.isValid ? this.values.seconds || 0 : NaN;
2510
+ }
2511
+ get milliseconds() {
2512
+ return this.isValid ? this.values.milliseconds || 0 : NaN;
2513
+ }
2514
+ get isValid() {
2515
+ return this.invalid === null;
2516
+ }
2517
+ get invalidReason() {
2518
+ return this.invalid ? this.invalid.reason : null;
2519
+ }
2520
+ get invalidExplanation() {
2521
+ return this.invalid ? this.invalid.explanation : null;
2522
+ }
2523
+ equals(other) {
2524
+ if (!this.isValid || !other.isValid) {
2525
+ return false;
2526
+ }
2527
+ if (!this.loc.equals(other.loc)) {
2528
+ return false;
2529
+ }
2530
+ function eq(v1, v2) {
2531
+ if (v1 === undefined || v1 === 0)
2532
+ return v2 === undefined || v2 === 0;
2533
+ return v1 === v2;
2534
+ }
2535
+ for (const u of orderedUnits$1) {
2536
+ if (!eq(this.values[u], other.values[u])) {
2537
+ return false;
2538
+ }
2539
+ }
2540
+ return true;
2541
+ }
2542
+ }
2543
+ var INVALID$1 = "Invalid Interval";
2544
+ function validateStartEnd(start, end) {
2545
+ if (!start || !start.isValid) {
2546
+ return Interval.invalid("missing or invalid start");
2547
+ } else if (!end || !end.isValid) {
2548
+ return Interval.invalid("missing or invalid end");
2549
+ } else if (end < start) {
2550
+ 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()}`);
2551
+ } else {
2552
+ return null;
2553
+ }
2554
+ }
2555
+
2556
+ class Interval {
2557
+ constructor(config) {
2558
+ this.s = config.start;
2559
+ this.e = config.end;
2560
+ this.invalid = config.invalid || null;
2561
+ this.isLuxonInterval = true;
2562
+ }
2563
+ static invalid(reason, explanation = null) {
2564
+ if (!reason) {
2565
+ throw new InvalidArgumentError("need to specify a reason the Interval is invalid");
2566
+ }
2567
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
2568
+ if (Settings.throwOnInvalid) {
2569
+ throw new InvalidIntervalError(invalid);
2570
+ } else {
2571
+ return new Interval({ invalid });
2572
+ }
2573
+ }
2574
+ static fromDateTimes(start, end) {
2575
+ const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end);
2576
+ const validateError = validateStartEnd(builtStart, builtEnd);
2577
+ if (validateError == null) {
2578
+ return new Interval({
2579
+ start: builtStart,
2580
+ end: builtEnd
2581
+ });
2582
+ } else {
2583
+ return validateError;
2584
+ }
2585
+ }
2586
+ static after(start, duration) {
2587
+ const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(start);
2588
+ return Interval.fromDateTimes(dt, dt.plus(dur));
2589
+ }
2590
+ static before(end, duration) {
2591
+ const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(end);
2592
+ return Interval.fromDateTimes(dt.minus(dur), dt);
2593
+ }
2594
+ static fromISO(text, opts) {
2595
+ const [s2, e] = (text || "").split("/", 2);
2596
+ if (s2 && e) {
2597
+ let start, startIsValid;
2598
+ try {
2599
+ start = DateTime.fromISO(s2, opts);
2600
+ startIsValid = start.isValid;
2601
+ } catch (e2) {
2602
+ startIsValid = false;
2603
+ }
2604
+ let end, endIsValid;
2605
+ try {
2606
+ end = DateTime.fromISO(e, opts);
2607
+ endIsValid = end.isValid;
2608
+ } catch (e2) {
2609
+ endIsValid = false;
2610
+ }
2611
+ if (startIsValid && endIsValid) {
2612
+ return Interval.fromDateTimes(start, end);
2613
+ }
2614
+ if (startIsValid) {
2615
+ const dur = Duration.fromISO(e, opts);
2616
+ if (dur.isValid) {
2617
+ return Interval.after(start, dur);
2618
+ }
2619
+ } else if (endIsValid) {
2620
+ const dur = Duration.fromISO(s2, opts);
2621
+ if (dur.isValid) {
2622
+ return Interval.before(end, dur);
2623
+ }
2624
+ }
2625
+ }
2626
+ return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
2627
+ }
2628
+ static isInterval(o) {
2629
+ return o && o.isLuxonInterval || false;
2630
+ }
2631
+ get start() {
2632
+ return this.isValid ? this.s : null;
2633
+ }
2634
+ get end() {
2635
+ return this.isValid ? this.e : null;
2636
+ }
2637
+ get lastDateTime() {
2638
+ return this.isValid ? this.e ? this.e.minus(1) : null : null;
2639
+ }
2640
+ get isValid() {
2641
+ return this.invalidReason === null;
2642
+ }
2643
+ get invalidReason() {
2644
+ return this.invalid ? this.invalid.reason : null;
2645
+ }
2646
+ get invalidExplanation() {
2647
+ return this.invalid ? this.invalid.explanation : null;
2648
+ }
2649
+ length(unit = "milliseconds") {
2650
+ return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;
2651
+ }
2652
+ count(unit = "milliseconds", opts) {
2653
+ if (!this.isValid)
2654
+ return NaN;
2655
+ const start = this.start.startOf(unit, opts);
2656
+ let end;
2657
+ if (opts?.useLocaleWeeks) {
2658
+ end = this.end.reconfigure({ locale: start.locale });
2659
+ } else {
2660
+ end = this.end;
2661
+ }
2662
+ end = end.startOf(unit, opts);
2663
+ return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
2664
+ }
2665
+ hasSame(unit) {
2666
+ return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
2667
+ }
2668
+ isEmpty() {
2669
+ return this.s.valueOf() === this.e.valueOf();
2670
+ }
2671
+ isAfter(dateTime) {
2672
+ if (!this.isValid)
2673
+ return false;
2674
+ return this.s > dateTime;
2675
+ }
2676
+ isBefore(dateTime) {
2677
+ if (!this.isValid)
2678
+ return false;
2679
+ return this.e <= dateTime;
2680
+ }
2681
+ contains(dateTime) {
2682
+ if (!this.isValid)
2683
+ return false;
2684
+ return this.s <= dateTime && this.e > dateTime;
2685
+ }
2686
+ set({ start, end } = {}) {
2687
+ if (!this.isValid)
2688
+ return this;
2689
+ return Interval.fromDateTimes(start || this.s, end || this.e);
2690
+ }
2691
+ splitAt(...dateTimes) {
2692
+ if (!this.isValid)
2693
+ return [];
2694
+ const sorted = dateTimes.map(friendlyDateTime).filter((d) => this.contains(d)).sort((a, b) => a.toMillis() - b.toMillis()), results = [];
2695
+ let { s: s2 } = this, i = 0;
2696
+ while (s2 < this.e) {
2697
+ const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added;
2698
+ results.push(Interval.fromDateTimes(s2, next));
2699
+ s2 = next;
2700
+ i += 1;
2701
+ }
2702
+ return results;
2703
+ }
2704
+ splitBy(duration) {
2705
+ const dur = Duration.fromDurationLike(duration);
2706
+ if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) {
2707
+ return [];
2708
+ }
2709
+ let { s: s2 } = this, idx = 1, next;
2710
+ const results = [];
2711
+ while (s2 < this.e) {
2712
+ const added = this.start.plus(dur.mapUnits((x) => x * idx));
2713
+ next = +added > +this.e ? this.e : added;
2714
+ results.push(Interval.fromDateTimes(s2, next));
2715
+ s2 = next;
2716
+ idx += 1;
2717
+ }
2718
+ return results;
2719
+ }
2720
+ divideEqually(numberOfParts) {
2721
+ if (!this.isValid)
2722
+ return [];
2723
+ return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
2724
+ }
2725
+ overlaps(other) {
2726
+ return this.e > other.s && this.s < other.e;
2727
+ }
2728
+ abutsStart(other) {
2729
+ if (!this.isValid)
2730
+ return false;
2731
+ return +this.e === +other.s;
2732
+ }
2733
+ abutsEnd(other) {
2734
+ if (!this.isValid)
2735
+ return false;
2736
+ return +other.e === +this.s;
2737
+ }
2738
+ engulfs(other) {
2739
+ if (!this.isValid)
2740
+ return false;
2741
+ return this.s <= other.s && this.e >= other.e;
2742
+ }
2743
+ equals(other) {
2744
+ if (!this.isValid || !other.isValid) {
2745
+ return false;
2746
+ }
2747
+ return this.s.equals(other.s) && this.e.equals(other.e);
2748
+ }
2749
+ intersection(other) {
2750
+ if (!this.isValid)
2751
+ return this;
2752
+ const s2 = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e;
2753
+ if (s2 >= e) {
2754
+ return null;
2755
+ } else {
2756
+ return Interval.fromDateTimes(s2, e);
2757
+ }
2758
+ }
2759
+ union(other) {
2760
+ if (!this.isValid)
2761
+ return this;
2762
+ const s2 = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e;
2763
+ return Interval.fromDateTimes(s2, e);
2764
+ }
2765
+ static merge(intervals) {
2766
+ const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(([sofar, current], item) => {
2767
+ if (!current) {
2768
+ return [sofar, item];
2769
+ } else if (current.overlaps(item) || current.abutsStart(item)) {
2770
+ return [sofar, current.union(item)];
2771
+ } else {
2772
+ return [sofar.concat([current]), item];
2773
+ }
2774
+ }, [[], null]);
2775
+ if (final) {
2776
+ found.push(final);
2777
+ }
2778
+ return found;
2779
+ }
2780
+ static xor(intervals) {
2781
+ let start = null, currentCount = 0;
2782
+ const results = [], ends = intervals.map((i) => [
2783
+ { time: i.s, type: "s" },
2784
+ { time: i.e, type: "e" }
2785
+ ]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a, b) => a.time - b.time);
2786
+ for (const i of arr) {
2787
+ currentCount += i.type === "s" ? 1 : -1;
2788
+ if (currentCount === 1) {
2789
+ start = i.time;
2790
+ } else {
2791
+ if (start && +start !== +i.time) {
2792
+ results.push(Interval.fromDateTimes(start, i.time));
2793
+ }
2794
+ start = null;
2795
+ }
2796
+ }
2797
+ return Interval.merge(results);
2798
+ }
2799
+ difference(...intervals) {
2800
+ return Interval.xor([this].concat(intervals)).map((i) => this.intersection(i)).filter((i) => i && !i.isEmpty());
2801
+ }
2802
+ toString() {
2803
+ if (!this.isValid)
2804
+ return INVALID$1;
2805
+ return `[${this.s.toISO()} – ${this.e.toISO()})`;
2806
+ }
2807
+ [Symbol.for("nodejs.util.inspect.custom")]() {
2808
+ if (this.isValid) {
2809
+ return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
2810
+ } else {
2811
+ return `Interval { Invalid, reason: ${this.invalidReason} }`;
2812
+ }
2813
+ }
2814
+ toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
2815
+ return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1;
2816
+ }
2817
+ toISO(opts) {
2818
+ if (!this.isValid)
2819
+ return INVALID$1;
2820
+ return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;
2821
+ }
2822
+ toISODate() {
2823
+ if (!this.isValid)
2824
+ return INVALID$1;
2825
+ return `${this.s.toISODate()}/${this.e.toISODate()}`;
2826
+ }
2827
+ toISOTime(opts) {
2828
+ if (!this.isValid)
2829
+ return INVALID$1;
2830
+ return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;
2831
+ }
2832
+ toFormat(dateFormat, { separator = " – " } = {}) {
2833
+ if (!this.isValid)
2834
+ return INVALID$1;
2835
+ return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;
2836
+ }
2837
+ toDuration(unit, opts) {
2838
+ if (!this.isValid) {
2839
+ return Duration.invalid(this.invalidReason);
2840
+ }
2841
+ return this.e.diff(this.s, unit, opts);
2842
+ }
2843
+ mapEndpoints(mapFn) {
2844
+ return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
2845
+ }
2846
+ }
2847
+
2848
+ class Info {
2849
+ static hasDST(zone = Settings.defaultZone) {
2850
+ const proto = DateTime.now().setZone(zone).set({ month: 12 });
2851
+ return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;
2852
+ }
2853
+ static isValidIANAZone(zone) {
2854
+ return IANAZone.isValidZone(zone);
2855
+ }
2856
+ static normalizeZone(input) {
2857
+ return normalizeZone(input, Settings.defaultZone);
2858
+ }
2859
+ static getStartOfWeek({ locale = null, locObj = null } = {}) {
2860
+ return (locObj || Locale.create(locale)).getStartOfWeek();
2861
+ }
2862
+ static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {
2863
+ return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
2864
+ }
2865
+ static getWeekendWeekdays({ locale = null, locObj = null } = {}) {
2866
+ return (locObj || Locale.create(locale)).getWeekendDays().slice();
2867
+ }
2868
+ static months(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
2869
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
2870
+ }
2871
+ static monthsFormat(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
2872
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
2873
+ }
2874
+ static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
2875
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
2876
+ }
2877
+ static weekdaysFormat(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
2878
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
2879
+ }
2880
+ static meridiems({ locale = null } = {}) {
2881
+ return Locale.create(locale).meridiems();
2882
+ }
2883
+ static eras(length = "short", { locale = null } = {}) {
2884
+ return Locale.create(locale, null, "gregory").eras(length);
2885
+ }
2886
+ static features() {
2887
+ return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() };
2888
+ }
2889
+ }
2890
+ function dayDiff(earlier, later) {
2891
+ const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
2892
+ return Math.floor(Duration.fromMillis(ms).as("days"));
2893
+ }
2894
+ function highOrderDiffs(cursor, later, units) {
2895
+ const differs = [
2896
+ ["years", (a, b) => b.year - a.year],
2897
+ ["quarters", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],
2898
+ ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12],
2899
+ [
2900
+ "weeks",
2901
+ (a, b) => {
2902
+ const days = dayDiff(a, b);
2903
+ return (days - days % 7) / 7;
2904
+ }
2905
+ ],
2906
+ ["days", dayDiff]
2907
+ ];
2908
+ const results = {};
2909
+ const earlier = cursor;
2910
+ let lowestOrder, highWater;
2911
+ for (const [unit, differ] of differs) {
2912
+ if (units.indexOf(unit) >= 0) {
2913
+ lowestOrder = unit;
2914
+ results[unit] = differ(cursor, later);
2915
+ highWater = earlier.plus(results);
2916
+ if (highWater > later) {
2917
+ results[unit]--;
2918
+ cursor = earlier.plus(results);
2919
+ if (cursor > later) {
2920
+ highWater = cursor;
2921
+ results[unit]--;
2922
+ cursor = earlier.plus(results);
2923
+ }
2924
+ } else {
2925
+ cursor = highWater;
2926
+ }
2927
+ }
2928
+ }
2929
+ return [cursor, results, highWater, lowestOrder];
2930
+ }
2931
+ function diff(earlier, later, units, opts) {
2932
+ let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);
2933
+ const remainingMillis = later - cursor;
2934
+ const lowerOrderUnits = units.filter((u) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0);
2935
+ if (lowerOrderUnits.length === 0) {
2936
+ if (highWater < later) {
2937
+ highWater = cursor.plus({ [lowestOrder]: 1 });
2938
+ }
2939
+ if (highWater !== cursor) {
2940
+ results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
2941
+ }
2942
+ }
2943
+ const duration = Duration.fromObject(results, opts);
2944
+ if (lowerOrderUnits.length > 0) {
2945
+ return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration);
2946
+ } else {
2947
+ return duration;
2948
+ }
2949
+ }
2950
+ var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
2951
+ function intUnit(regex, post = (i) => i) {
2952
+ return { regex, deser: ([s2]) => post(parseDigits(s2)) };
2953
+ }
2954
+ var NBSP = String.fromCharCode(160);
2955
+ var spaceOrNBSP = `[ ${NBSP}]`;
2956
+ var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
2957
+ function fixListRegex(s2) {
2958
+ return s2.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
2959
+ }
2960
+ function stripInsensitivities(s2) {
2961
+ return s2.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
2962
+ }
2963
+ function oneOf(strings, startIndex) {
2964
+ if (strings === null) {
2965
+ return null;
2966
+ } else {
2967
+ return {
2968
+ regex: RegExp(strings.map(fixListRegex).join("|")),
2969
+ deser: ([s2]) => strings.findIndex((i) => stripInsensitivities(s2) === stripInsensitivities(i)) + startIndex
2970
+ };
2971
+ }
2972
+ }
2973
+ function offset(regex, groups) {
2974
+ return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };
2975
+ }
2976
+ function simple(regex) {
2977
+ return { regex, deser: ([s2]) => s2 };
2978
+ }
2979
+ function escapeToken(value) {
2980
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
2981
+ }
2982
+ function unitForToken(token, loc) {
2983
+ 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) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s2]) => s2, literal: true }), unitate = (t) => {
2984
+ if (token.literal) {
2985
+ return literal(t);
2986
+ }
2987
+ switch (t.val) {
2988
+ case "G":
2989
+ return oneOf(loc.eras("short"), 0);
2990
+ case "GG":
2991
+ return oneOf(loc.eras("long"), 0);
2992
+ case "y":
2993
+ return intUnit(oneToSix);
2994
+ case "yy":
2995
+ return intUnit(twoToFour, untruncateYear);
2996
+ case "yyyy":
2997
+ return intUnit(four);
2998
+ case "yyyyy":
2999
+ return intUnit(fourToSix);
3000
+ case "yyyyyy":
3001
+ return intUnit(six);
3002
+ case "M":
3003
+ return intUnit(oneOrTwo);
3004
+ case "MM":
3005
+ return intUnit(two);
3006
+ case "MMM":
3007
+ return oneOf(loc.months("short", true), 1);
3008
+ case "MMMM":
3009
+ return oneOf(loc.months("long", true), 1);
3010
+ case "L":
3011
+ return intUnit(oneOrTwo);
3012
+ case "LL":
3013
+ return intUnit(two);
3014
+ case "LLL":
3015
+ return oneOf(loc.months("short", false), 1);
3016
+ case "LLLL":
3017
+ return oneOf(loc.months("long", false), 1);
3018
+ case "d":
3019
+ return intUnit(oneOrTwo);
3020
+ case "dd":
3021
+ return intUnit(two);
3022
+ case "o":
3023
+ return intUnit(oneToThree);
3024
+ case "ooo":
3025
+ return intUnit(three);
3026
+ case "HH":
3027
+ return intUnit(two);
3028
+ case "H":
3029
+ return intUnit(oneOrTwo);
3030
+ case "hh":
3031
+ return intUnit(two);
3032
+ case "h":
3033
+ return intUnit(oneOrTwo);
3034
+ case "mm":
3035
+ return intUnit(two);
3036
+ case "m":
3037
+ return intUnit(oneOrTwo);
3038
+ case "q":
3039
+ return intUnit(oneOrTwo);
3040
+ case "qq":
3041
+ return intUnit(two);
3042
+ case "s":
3043
+ return intUnit(oneOrTwo);
3044
+ case "ss":
3045
+ return intUnit(two);
3046
+ case "S":
3047
+ return intUnit(oneToThree);
3048
+ case "SSS":
3049
+ return intUnit(three);
3050
+ case "u":
3051
+ return simple(oneToNine);
3052
+ case "uu":
3053
+ return simple(oneOrTwo);
3054
+ case "uuu":
3055
+ return intUnit(one);
3056
+ case "a":
3057
+ return oneOf(loc.meridiems(), 0);
3058
+ case "kkkk":
3059
+ return intUnit(four);
3060
+ case "kk":
3061
+ return intUnit(twoToFour, untruncateYear);
3062
+ case "W":
3063
+ return intUnit(oneOrTwo);
3064
+ case "WW":
3065
+ return intUnit(two);
3066
+ case "E":
3067
+ case "c":
3068
+ return intUnit(one);
3069
+ case "EEE":
3070
+ return oneOf(loc.weekdays("short", false), 1);
3071
+ case "EEEE":
3072
+ return oneOf(loc.weekdays("long", false), 1);
3073
+ case "ccc":
3074
+ return oneOf(loc.weekdays("short", true), 1);
3075
+ case "cccc":
3076
+ return oneOf(loc.weekdays("long", true), 1);
3077
+ case "Z":
3078
+ case "ZZ":
3079
+ return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);
3080
+ case "ZZZ":
3081
+ return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);
3082
+ case "z":
3083
+ return simple(/[a-z_+-/]{1,256}?/i);
3084
+ case " ":
3085
+ return simple(/[^\S\n\r]/);
3086
+ default:
3087
+ return literal(t);
3088
+ }
3089
+ };
3090
+ const unit = unitate(token) || {
3091
+ invalidReason: MISSING_FTP
3092
+ };
3093
+ unit.token = token;
3094
+ return unit;
3095
+ }
3096
+ var partTypeStyleToTokenVal = {
3097
+ year: {
3098
+ "2-digit": "yy",
3099
+ numeric: "yyyyy"
3100
+ },
3101
+ month: {
3102
+ numeric: "M",
3103
+ "2-digit": "MM",
3104
+ short: "MMM",
3105
+ long: "MMMM"
3106
+ },
3107
+ day: {
3108
+ numeric: "d",
3109
+ "2-digit": "dd"
3110
+ },
3111
+ weekday: {
3112
+ short: "EEE",
3113
+ long: "EEEE"
3114
+ },
3115
+ dayperiod: "a",
3116
+ dayPeriod: "a",
3117
+ hour12: {
3118
+ numeric: "h",
3119
+ "2-digit": "hh"
3120
+ },
3121
+ hour24: {
3122
+ numeric: "H",
3123
+ "2-digit": "HH"
3124
+ },
3125
+ minute: {
3126
+ numeric: "m",
3127
+ "2-digit": "mm"
3128
+ },
3129
+ second: {
3130
+ numeric: "s",
3131
+ "2-digit": "ss"
3132
+ },
3133
+ timeZoneName: {
3134
+ long: "ZZZZZ",
3135
+ short: "ZZZ"
3136
+ }
3137
+ };
3138
+ function tokenForPart(part, formatOpts, resolvedOpts) {
3139
+ const { type, value } = part;
3140
+ if (type === "literal") {
3141
+ const isSpace = /^\s+$/.test(value);
3142
+ return {
3143
+ literal: !isSpace,
3144
+ val: isSpace ? " " : value
3145
+ };
3146
+ }
3147
+ const style = formatOpts[type];
3148
+ let actualType = type;
3149
+ if (type === "hour") {
3150
+ if (formatOpts.hour12 != null) {
3151
+ actualType = formatOpts.hour12 ? "hour12" : "hour24";
3152
+ } else if (formatOpts.hourCycle != null) {
3153
+ if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") {
3154
+ actualType = "hour12";
3155
+ } else {
3156
+ actualType = "hour24";
3157
+ }
3158
+ } else {
3159
+ actualType = resolvedOpts.hour12 ? "hour12" : "hour24";
3160
+ }
3161
+ }
3162
+ let val = partTypeStyleToTokenVal[actualType];
3163
+ if (typeof val === "object") {
3164
+ val = val[style];
3165
+ }
3166
+ if (val) {
3167
+ return {
3168
+ literal: false,
3169
+ val
3170
+ };
3171
+ }
3172
+ return;
3173
+ }
3174
+ function buildRegex(units) {
3175
+ const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, "");
3176
+ return [`^${re}$`, units];
3177
+ }
3178
+ function match(input, regex, handlers) {
3179
+ const matches = input.match(regex);
3180
+ if (matches) {
3181
+ const all = {};
3182
+ let matchIndex = 1;
3183
+ for (const i in handlers) {
3184
+ if (hasOwnProperty(handlers, i)) {
3185
+ const h = handlers[i], groups = h.groups ? h.groups + 1 : 1;
3186
+ if (!h.literal && h.token) {
3187
+ all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));
3188
+ }
3189
+ matchIndex += groups;
3190
+ }
3191
+ }
3192
+ return [matches, all];
3193
+ } else {
3194
+ return [matches, {}];
3195
+ }
3196
+ }
3197
+ function dateTimeFromMatches(matches) {
3198
+ const toField = (token) => {
3199
+ switch (token) {
3200
+ case "S":
3201
+ return "millisecond";
3202
+ case "s":
3203
+ return "second";
3204
+ case "m":
3205
+ return "minute";
3206
+ case "h":
3207
+ case "H":
3208
+ return "hour";
3209
+ case "d":
3210
+ return "day";
3211
+ case "o":
3212
+ return "ordinal";
3213
+ case "L":
3214
+ case "M":
3215
+ return "month";
3216
+ case "y":
3217
+ return "year";
3218
+ case "E":
3219
+ case "c":
3220
+ return "weekday";
3221
+ case "W":
3222
+ return "weekNumber";
3223
+ case "k":
3224
+ return "weekYear";
3225
+ case "q":
3226
+ return "quarter";
3227
+ default:
3228
+ return null;
3229
+ }
3230
+ };
3231
+ let zone = null;
3232
+ let specificOffset;
3233
+ if (!isUndefined(matches.z)) {
3234
+ zone = IANAZone.create(matches.z);
3235
+ }
3236
+ if (!isUndefined(matches.Z)) {
3237
+ if (!zone) {
3238
+ zone = new FixedOffsetZone(matches.Z);
3239
+ }
3240
+ specificOffset = matches.Z;
3241
+ }
3242
+ if (!isUndefined(matches.q)) {
3243
+ matches.M = (matches.q - 1) * 3 + 1;
3244
+ }
3245
+ if (!isUndefined(matches.h)) {
3246
+ if (matches.h < 12 && matches.a === 1) {
3247
+ matches.h += 12;
3248
+ } else if (matches.h === 12 && matches.a === 0) {
3249
+ matches.h = 0;
3250
+ }
3251
+ }
3252
+ if (matches.G === 0 && matches.y) {
3253
+ matches.y = -matches.y;
3254
+ }
3255
+ if (!isUndefined(matches.u)) {
3256
+ matches.S = parseMillis(matches.u);
3257
+ }
3258
+ const vals = Object.keys(matches).reduce((r, k) => {
3259
+ const f = toField(k);
3260
+ if (f) {
3261
+ r[f] = matches[k];
3262
+ }
3263
+ return r;
3264
+ }, {});
3265
+ return [vals, zone, specificOffset];
3266
+ }
3267
+ var dummyDateTimeCache = null;
3268
+ function getDummyDateTime() {
3269
+ if (!dummyDateTimeCache) {
3270
+ dummyDateTimeCache = DateTime.fromMillis(1555555555555);
3271
+ }
3272
+ return dummyDateTimeCache;
3273
+ }
3274
+ function maybeExpandMacroToken(token, locale) {
3275
+ if (token.literal) {
3276
+ return token;
3277
+ }
3278
+ const formatOpts = Formatter.macroTokenToFormatOpts(token.val);
3279
+ const tokens = formatOptsToTokens(formatOpts, locale);
3280
+ if (tokens == null || tokens.includes(undefined)) {
3281
+ return token;
3282
+ }
3283
+ return tokens;
3284
+ }
3285
+ function expandMacroTokens(tokens, locale) {
3286
+ return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));
3287
+ }
3288
+
3289
+ class TokenParser {
3290
+ constructor(locale, format) {
3291
+ this.locale = locale;
3292
+ this.format = format;
3293
+ this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);
3294
+ this.units = this.tokens.map((t) => unitForToken(t, locale));
3295
+ this.disqualifyingUnit = this.units.find((t) => t.invalidReason);
3296
+ if (!this.disqualifyingUnit) {
3297
+ const [regexString, handlers] = buildRegex(this.units);
3298
+ this.regex = RegExp(regexString, "i");
3299
+ this.handlers = handlers;
3300
+ }
3301
+ }
3302
+ explainFromTokens(input) {
3303
+ if (!this.isValid) {
3304
+ return { input, tokens: this.tokens, invalidReason: this.invalidReason };
3305
+ } else {
3306
+ const [rawMatches, matches] = match(input, this.regex, this.handlers), [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [null, null, undefined];
3307
+ if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) {
3308
+ throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");
3309
+ }
3310
+ return {
3311
+ input,
3312
+ tokens: this.tokens,
3313
+ regex: this.regex,
3314
+ rawMatches,
3315
+ matches,
3316
+ result,
3317
+ zone,
3318
+ specificOffset
3319
+ };
3320
+ }
3321
+ }
3322
+ get isValid() {
3323
+ return !this.disqualifyingUnit;
3324
+ }
3325
+ get invalidReason() {
3326
+ return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;
3327
+ }
3328
+ }
3329
+ function explainFromTokens(locale, input, format) {
3330
+ const parser = new TokenParser(locale, format);
3331
+ return parser.explainFromTokens(input);
3332
+ }
3333
+ function parseFromTokens(locale, input, format) {
3334
+ const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);
3335
+ return [result, zone, specificOffset, invalidReason];
3336
+ }
3337
+ function formatOptsToTokens(formatOpts, locale) {
3338
+ if (!formatOpts) {
3339
+ return null;
3340
+ }
3341
+ const formatter = Formatter.create(locale, formatOpts);
3342
+ const df = formatter.dtFormatter(getDummyDateTime());
3343
+ const parts = df.formatToParts();
3344
+ const resolvedOpts = df.resolvedOptions();
3345
+ return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));
3346
+ }
3347
+ var INVALID = "Invalid DateTime";
3348
+ var MAX_DATE = 8640000000000000;
3349
+ function unsupportedZone(zone) {
3350
+ return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
3351
+ }
3352
+ function possiblyCachedWeekData(dt) {
3353
+ if (dt.weekData === null) {
3354
+ dt.weekData = gregorianToWeek(dt.c);
3355
+ }
3356
+ return dt.weekData;
3357
+ }
3358
+ function possiblyCachedLocalWeekData(dt) {
3359
+ if (dt.localWeekData === null) {
3360
+ dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
3361
+ }
3362
+ return dt.localWeekData;
3363
+ }
3364
+ function clone(inst, alts) {
3365
+ const current = {
3366
+ ts: inst.ts,
3367
+ zone: inst.zone,
3368
+ c: inst.c,
3369
+ o: inst.o,
3370
+ loc: inst.loc,
3371
+ invalid: inst.invalid
3372
+ };
3373
+ return new DateTime({ ...current, ...alts, old: current });
3374
+ }
3375
+ function fixOffset(localTS, o, tz) {
3376
+ let utcGuess = localTS - o * 60 * 1000;
3377
+ const o2 = tz.offset(utcGuess);
3378
+ if (o === o2) {
3379
+ return [utcGuess, o];
3380
+ }
3381
+ utcGuess -= (o2 - o) * 60 * 1000;
3382
+ const o3 = tz.offset(utcGuess);
3383
+ if (o2 === o3) {
3384
+ return [utcGuess, o2];
3385
+ }
3386
+ return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];
3387
+ }
3388
+ function tsToObj(ts, offset2) {
3389
+ ts += offset2 * 60 * 1000;
3390
+ const d = new Date(ts);
3391
+ return {
3392
+ year: d.getUTCFullYear(),
3393
+ month: d.getUTCMonth() + 1,
3394
+ day: d.getUTCDate(),
3395
+ hour: d.getUTCHours(),
3396
+ minute: d.getUTCMinutes(),
3397
+ second: d.getUTCSeconds(),
3398
+ millisecond: d.getUTCMilliseconds()
3399
+ };
3400
+ }
3401
+ function objToTS(obj, offset2, zone) {
3402
+ return fixOffset(objToLocalTS(obj), offset2, zone);
3403
+ }
3404
+ function adjustTime(inst, dur) {
3405
+ const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c2 = {
3406
+ ...inst.c,
3407
+ year,
3408
+ month,
3409
+ day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7
3410
+ }, millisToAdd = Duration.fromObject({
3411
+ years: dur.years - Math.trunc(dur.years),
3412
+ quarters: dur.quarters - Math.trunc(dur.quarters),
3413
+ months: dur.months - Math.trunc(dur.months),
3414
+ weeks: dur.weeks - Math.trunc(dur.weeks),
3415
+ days: dur.days - Math.trunc(dur.days),
3416
+ hours: dur.hours,
3417
+ minutes: dur.minutes,
3418
+ seconds: dur.seconds,
3419
+ milliseconds: dur.milliseconds
3420
+ }).as("milliseconds"), localTS = objToLocalTS(c2);
3421
+ let [ts, o] = fixOffset(localTS, oPre, inst.zone);
3422
+ if (millisToAdd !== 0) {
3423
+ ts += millisToAdd;
3424
+ o = inst.zone.offset(ts);
3425
+ }
3426
+ return { ts, o };
3427
+ }
3428
+ function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {
3429
+ const { setZone, zone } = opts;
3430
+ if (parsed && Object.keys(parsed).length !== 0 || parsedZone) {
3431
+ const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, {
3432
+ ...opts,
3433
+ zone: interpretationZone,
3434
+ specificOffset
3435
+ });
3436
+ return setZone ? inst : inst.setZone(zone);
3437
+ } else {
3438
+ return DateTime.invalid(new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`));
3439
+ }
3440
+ }
3441
+ function toTechFormat(dt, format, allowZ = true) {
3442
+ return dt.isValid ? Formatter.create(Locale.create("en-US"), {
3443
+ allowZ,
3444
+ forceSimple: true
3445
+ }).formatDateTimeFromString(dt, format) : null;
3446
+ }
3447
+ function toISODate(o, extended, precision) {
3448
+ const longFormat = o.c.year > 9999 || o.c.year < 0;
3449
+ let c2 = "";
3450
+ if (longFormat && o.c.year >= 0)
3451
+ c2 += "+";
3452
+ c2 += padStart(o.c.year, longFormat ? 6 : 4);
3453
+ if (precision === "year")
3454
+ return c2;
3455
+ if (extended) {
3456
+ c2 += "-";
3457
+ c2 += padStart(o.c.month);
3458
+ if (precision === "month")
3459
+ return c2;
3460
+ c2 += "-";
3461
+ } else {
3462
+ c2 += padStart(o.c.month);
3463
+ if (precision === "month")
3464
+ return c2;
3465
+ }
3466
+ c2 += padStart(o.c.day);
3467
+ return c2;
3468
+ }
3469
+ function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) {
3470
+ let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, c2 = "";
3471
+ switch (precision) {
3472
+ case "day":
3473
+ case "month":
3474
+ case "year":
3475
+ break;
3476
+ default:
3477
+ c2 += padStart(o.c.hour);
3478
+ if (precision === "hour")
3479
+ break;
3480
+ if (extended) {
3481
+ c2 += ":";
3482
+ c2 += padStart(o.c.minute);
3483
+ if (precision === "minute")
3484
+ break;
3485
+ if (showSeconds) {
3486
+ c2 += ":";
3487
+ c2 += padStart(o.c.second);
3488
+ }
3489
+ } else {
3490
+ c2 += padStart(o.c.minute);
3491
+ if (precision === "minute")
3492
+ break;
3493
+ if (showSeconds) {
3494
+ c2 += padStart(o.c.second);
3495
+ }
3496
+ }
3497
+ if (precision === "second")
3498
+ break;
3499
+ if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {
3500
+ c2 += ".";
3501
+ c2 += padStart(o.c.millisecond, 3);
3502
+ }
3503
+ }
3504
+ if (includeOffset) {
3505
+ if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {
3506
+ c2 += "Z";
3507
+ } else if (o.o < 0) {
3508
+ c2 += "-";
3509
+ c2 += padStart(Math.trunc(-o.o / 60));
3510
+ c2 += ":";
3511
+ c2 += padStart(Math.trunc(-o.o % 60));
3512
+ } else {
3513
+ c2 += "+";
3514
+ c2 += padStart(Math.trunc(o.o / 60));
3515
+ c2 += ":";
3516
+ c2 += padStart(Math.trunc(o.o % 60));
3517
+ }
3518
+ }
3519
+ if (extendedZone) {
3520
+ c2 += "[" + o.zone.ianaName + "]";
3521
+ }
3522
+ return c2;
3523
+ }
3524
+ var defaultUnitValues = {
3525
+ month: 1,
3526
+ day: 1,
3527
+ hour: 0,
3528
+ minute: 0,
3529
+ second: 0,
3530
+ millisecond: 0
3531
+ };
3532
+ var defaultWeekUnitValues = {
3533
+ weekNumber: 1,
3534
+ weekday: 1,
3535
+ hour: 0,
3536
+ minute: 0,
3537
+ second: 0,
3538
+ millisecond: 0
3539
+ };
3540
+ var defaultOrdinalUnitValues = {
3541
+ ordinal: 1,
3542
+ hour: 0,
3543
+ minute: 0,
3544
+ second: 0,
3545
+ millisecond: 0
3546
+ };
3547
+ var orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"];
3548
+ var orderedWeekUnits = [
3549
+ "weekYear",
3550
+ "weekNumber",
3551
+ "weekday",
3552
+ "hour",
3553
+ "minute",
3554
+ "second",
3555
+ "millisecond"
3556
+ ];
3557
+ var orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
3558
+ function normalizeUnit(unit) {
3559
+ const normalized = {
3560
+ year: "year",
3561
+ years: "year",
3562
+ month: "month",
3563
+ months: "month",
3564
+ day: "day",
3565
+ days: "day",
3566
+ hour: "hour",
3567
+ hours: "hour",
3568
+ minute: "minute",
3569
+ minutes: "minute",
3570
+ quarter: "quarter",
3571
+ quarters: "quarter",
3572
+ second: "second",
3573
+ seconds: "second",
3574
+ millisecond: "millisecond",
3575
+ milliseconds: "millisecond",
3576
+ weekday: "weekday",
3577
+ weekdays: "weekday",
3578
+ weeknumber: "weekNumber",
3579
+ weeksnumber: "weekNumber",
3580
+ weeknumbers: "weekNumber",
3581
+ weekyear: "weekYear",
3582
+ weekyears: "weekYear",
3583
+ ordinal: "ordinal"
3584
+ }[unit.toLowerCase()];
3585
+ if (!normalized)
3586
+ throw new InvalidUnitError(unit);
3587
+ return normalized;
3588
+ }
3589
+ function normalizeUnitWithLocalWeeks(unit) {
3590
+ switch (unit.toLowerCase()) {
3591
+ case "localweekday":
3592
+ case "localweekdays":
3593
+ return "localWeekday";
3594
+ case "localweeknumber":
3595
+ case "localweeknumbers":
3596
+ return "localWeekNumber";
3597
+ case "localweekyear":
3598
+ case "localweekyears":
3599
+ return "localWeekYear";
3600
+ default:
3601
+ return normalizeUnit(unit);
3602
+ }
3603
+ }
3604
+ function guessOffsetForZone(zone) {
3605
+ if (zoneOffsetTs === undefined) {
3606
+ zoneOffsetTs = Settings.now();
3607
+ }
3608
+ if (zone.type !== "iana") {
3609
+ return zone.offset(zoneOffsetTs);
3610
+ }
3611
+ const zoneName = zone.name;
3612
+ let offsetGuess = zoneOffsetGuessCache.get(zoneName);
3613
+ if (offsetGuess === undefined) {
3614
+ offsetGuess = zone.offset(zoneOffsetTs);
3615
+ zoneOffsetGuessCache.set(zoneName, offsetGuess);
3616
+ }
3617
+ return offsetGuess;
3618
+ }
3619
+ function quickDT(obj, opts) {
3620
+ const zone = normalizeZone(opts.zone, Settings.defaultZone);
3621
+ if (!zone.isValid) {
3622
+ return DateTime.invalid(unsupportedZone(zone));
3623
+ }
3624
+ const loc = Locale.fromObject(opts);
3625
+ let ts, o;
3626
+ if (!isUndefined(obj.year)) {
3627
+ for (const u of orderedUnits) {
3628
+ if (isUndefined(obj[u])) {
3629
+ obj[u] = defaultUnitValues[u];
3630
+ }
3631
+ }
3632
+ const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
3633
+ if (invalid) {
3634
+ return DateTime.invalid(invalid);
3635
+ }
3636
+ const offsetProvis = guessOffsetForZone(zone);
3637
+ [ts, o] = objToTS(obj, offsetProvis, zone);
3638
+ } else {
3639
+ ts = Settings.now();
3640
+ }
3641
+ return new DateTime({ ts, zone, loc, o });
3642
+ }
3643
+ function diffRelative(start, end, opts) {
3644
+ const round = isUndefined(opts.round) ? true : opts.round, rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, format = (c2, unit) => {
3645
+ c2 = roundTo(c2, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
3646
+ const formatter = end.loc.clone(opts).relFormatter(opts);
3647
+ return formatter.format(c2, unit);
3648
+ }, differ = (unit) => {
3649
+ if (opts.calendary) {
3650
+ if (!end.hasSame(start, unit)) {
3651
+ return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);
3652
+ } else
3653
+ return 0;
3654
+ } else {
3655
+ return end.diff(start, unit).get(unit);
3656
+ }
3657
+ };
3658
+ if (opts.unit) {
3659
+ return format(differ(opts.unit), opts.unit);
3660
+ }
3661
+ for (const unit of opts.units) {
3662
+ const count = differ(unit);
3663
+ if (Math.abs(count) >= 1) {
3664
+ return format(count, unit);
3665
+ }
3666
+ }
3667
+ return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
3668
+ }
3669
+ function lastOpts(argList) {
3670
+ let opts = {}, args;
3671
+ if (argList.length > 0 && typeof argList[argList.length - 1] === "object") {
3672
+ opts = argList[argList.length - 1];
3673
+ args = Array.from(argList).slice(0, argList.length - 1);
3674
+ } else {
3675
+ args = Array.from(argList);
3676
+ }
3677
+ return [opts, args];
3678
+ }
3679
+ var zoneOffsetTs;
3680
+ var zoneOffsetGuessCache = new Map;
3681
+
3682
+ class DateTime {
3683
+ constructor(config) {
3684
+ const zone = config.zone || Settings.defaultZone;
3685
+ let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
3686
+ this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
3687
+ let c2 = null, o = null;
3688
+ if (!invalid) {
3689
+ const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
3690
+ if (unchanged) {
3691
+ [c2, o] = [config.old.c, config.old.o];
3692
+ } else {
3693
+ const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);
3694
+ c2 = tsToObj(this.ts, ot);
3695
+ invalid = Number.isNaN(c2.year) ? new Invalid("invalid input") : null;
3696
+ c2 = invalid ? null : c2;
3697
+ o = invalid ? null : ot;
3698
+ }
3699
+ }
3700
+ this._zone = zone;
3701
+ this.loc = config.loc || Locale.create();
3702
+ this.invalid = invalid;
3703
+ this.weekData = null;
3704
+ this.localWeekData = null;
3705
+ this.c = c2;
3706
+ this.o = o;
3707
+ this.isLuxonDateTime = true;
3708
+ }
3709
+ static now() {
3710
+ return new DateTime({});
3711
+ }
3712
+ static local() {
3713
+ const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
3714
+ return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);
3715
+ }
3716
+ static utc() {
3717
+ const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
3718
+ opts.zone = FixedOffsetZone.utcInstance;
3719
+ return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);
3720
+ }
3721
+ static fromJSDate(date, options = {}) {
3722
+ const ts = isDate(date) ? date.valueOf() : NaN;
3723
+ if (Number.isNaN(ts)) {
3724
+ return DateTime.invalid("invalid input");
3725
+ }
3726
+ const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
3727
+ if (!zoneToUse.isValid) {
3728
+ return DateTime.invalid(unsupportedZone(zoneToUse));
3729
+ }
3730
+ return new DateTime({
3731
+ ts,
3732
+ zone: zoneToUse,
3733
+ loc: Locale.fromObject(options)
3734
+ });
3735
+ }
3736
+ static fromMillis(milliseconds, options = {}) {
3737
+ if (!isNumber(milliseconds)) {
3738
+ throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`);
3739
+ } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {
3740
+ return DateTime.invalid("Timestamp out of range");
3741
+ } else {
3742
+ return new DateTime({
3743
+ ts: milliseconds,
3744
+ zone: normalizeZone(options.zone, Settings.defaultZone),
3745
+ loc: Locale.fromObject(options)
3746
+ });
3747
+ }
3748
+ }
3749
+ static fromSeconds(seconds, options = {}) {
3750
+ if (!isNumber(seconds)) {
3751
+ throw new InvalidArgumentError("fromSeconds requires a numerical input");
3752
+ } else {
3753
+ return new DateTime({
3754
+ ts: seconds * 1000,
3755
+ zone: normalizeZone(options.zone, Settings.defaultZone),
3756
+ loc: Locale.fromObject(options)
3757
+ });
3758
+ }
3759
+ }
3760
+ static fromObject(obj, opts = {}) {
3761
+ obj = obj || {};
3762
+ const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);
3763
+ if (!zoneToUse.isValid) {
3764
+ return DateTime.invalid(unsupportedZone(zoneToUse));
3765
+ }
3766
+ const loc = Locale.fromObject(opts);
3767
+ const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
3768
+ const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);
3769
+ const tsNow = Settings.now(), offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
3770
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) {
3771
+ throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
3772
+ }
3773
+ if (containsGregorMD && containsOrdinal) {
3774
+ throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
3775
+ }
3776
+ const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
3777
+ let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis);
3778
+ if (useWeekData) {
3779
+ units = orderedWeekUnits;
3780
+ defaultValues = defaultWeekUnitValues;
3781
+ objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
3782
+ } else if (containsOrdinal) {
3783
+ units = orderedOrdinalUnits;
3784
+ defaultValues = defaultOrdinalUnitValues;
3785
+ objNow = gregorianToOrdinal(objNow);
3786
+ } else {
3787
+ units = orderedUnits;
3788
+ defaultValues = defaultUnitValues;
3789
+ }
3790
+ let foundFirst = false;
3791
+ for (const u of units) {
3792
+ const v = normalized[u];
3793
+ if (!isUndefined(v)) {
3794
+ foundFirst = true;
3795
+ } else if (foundFirst) {
3796
+ normalized[u] = defaultValues[u];
3797
+ } else {
3798
+ normalized[u] = objNow[u];
3799
+ }
3800
+ }
3801
+ const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
3802
+ if (invalid) {
3803
+ return DateTime.invalid(invalid);
3804
+ }
3805
+ const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({
3806
+ ts: tsFinal,
3807
+ zone: zoneToUse,
3808
+ o: offsetFinal,
3809
+ loc
3810
+ });
3811
+ if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {
3812
+ return DateTime.invalid("mismatched weekday", `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`);
3813
+ }
3814
+ if (!inst.isValid) {
3815
+ return DateTime.invalid(inst.invalid);
3816
+ }
3817
+ return inst;
3818
+ }
3819
+ static fromISO(text, opts = {}) {
3820
+ const [vals, parsedZone] = parseISODate(text);
3821
+ return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text);
3822
+ }
3823
+ static fromRFC2822(text, opts = {}) {
3824
+ const [vals, parsedZone] = parseRFC2822Date(text);
3825
+ return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text);
3826
+ }
3827
+ static fromHTTP(text, opts = {}) {
3828
+ const [vals, parsedZone] = parseHTTPDate(text);
3829
+ return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
3830
+ }
3831
+ static fromFormat(text, fmt, opts = {}) {
3832
+ if (isUndefined(text) || isUndefined(fmt)) {
3833
+ throw new InvalidArgumentError("fromFormat requires an input string and a format");
3834
+ }
3835
+ const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
3836
+ locale,
3837
+ numberingSystem,
3838
+ defaultToEN: true
3839
+ }), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);
3840
+ if (invalid) {
3841
+ return DateTime.invalid(invalid);
3842
+ } else {
3843
+ return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);
3844
+ }
3845
+ }
3846
+ static fromString(text, fmt, opts = {}) {
3847
+ return DateTime.fromFormat(text, fmt, opts);
3848
+ }
3849
+ static fromSQL(text, opts = {}) {
3850
+ const [vals, parsedZone] = parseSQL(text);
3851
+ return parseDataToDateTime(vals, parsedZone, opts, "SQL", text);
3852
+ }
3853
+ static invalid(reason, explanation = null) {
3854
+ if (!reason) {
3855
+ throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");
3856
+ }
3857
+ const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
3858
+ if (Settings.throwOnInvalid) {
3859
+ throw new InvalidDateTimeError(invalid);
3860
+ } else {
3861
+ return new DateTime({ invalid });
3862
+ }
3863
+ }
3864
+ static isDateTime(o) {
3865
+ return o && o.isLuxonDateTime || false;
3866
+ }
3867
+ static parseFormatForOpts(formatOpts, localeOpts = {}) {
3868
+ const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
3869
+ return !tokenList ? null : tokenList.map((t) => t ? t.val : null).join("");
3870
+ }
3871
+ static expandFormat(fmt, localeOpts = {}) {
3872
+ const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
3873
+ return expanded.map((t) => t.val).join("");
3874
+ }
3875
+ static resetCache() {
3876
+ zoneOffsetTs = undefined;
3877
+ zoneOffsetGuessCache.clear();
3878
+ }
3879
+ get(unit) {
3880
+ return this[unit];
3881
+ }
3882
+ get isValid() {
3883
+ return this.invalid === null;
3884
+ }
3885
+ get invalidReason() {
3886
+ return this.invalid ? this.invalid.reason : null;
3887
+ }
3888
+ get invalidExplanation() {
3889
+ return this.invalid ? this.invalid.explanation : null;
3890
+ }
3891
+ get locale() {
3892
+ return this.isValid ? this.loc.locale : null;
3893
+ }
3894
+ get numberingSystem() {
3895
+ return this.isValid ? this.loc.numberingSystem : null;
3896
+ }
3897
+ get outputCalendar() {
3898
+ return this.isValid ? this.loc.outputCalendar : null;
3899
+ }
3900
+ get zone() {
3901
+ return this._zone;
3902
+ }
3903
+ get zoneName() {
3904
+ return this.isValid ? this.zone.name : null;
3905
+ }
3906
+ get year() {
3907
+ return this.isValid ? this.c.year : NaN;
3908
+ }
3909
+ get quarter() {
3910
+ return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
3911
+ }
3912
+ get month() {
3913
+ return this.isValid ? this.c.month : NaN;
3914
+ }
3915
+ get day() {
3916
+ return this.isValid ? this.c.day : NaN;
3917
+ }
3918
+ get hour() {
3919
+ return this.isValid ? this.c.hour : NaN;
3920
+ }
3921
+ get minute() {
3922
+ return this.isValid ? this.c.minute : NaN;
3923
+ }
3924
+ get second() {
3925
+ return this.isValid ? this.c.second : NaN;
3926
+ }
3927
+ get millisecond() {
3928
+ return this.isValid ? this.c.millisecond : NaN;
3929
+ }
3930
+ get weekYear() {
3931
+ return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
3932
+ }
3933
+ get weekNumber() {
3934
+ return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
3935
+ }
3936
+ get weekday() {
3937
+ return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
3938
+ }
3939
+ get isWeekend() {
3940
+ return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
3941
+ }
3942
+ get localWeekday() {
3943
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
3944
+ }
3945
+ get localWeekNumber() {
3946
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
3947
+ }
3948
+ get localWeekYear() {
3949
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
3950
+ }
3951
+ get ordinal() {
3952
+ return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
3953
+ }
3954
+ get monthShort() {
3955
+ return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null;
3956
+ }
3957
+ get monthLong() {
3958
+ return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null;
3959
+ }
3960
+ get weekdayShort() {
3961
+ return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null;
3962
+ }
3963
+ get weekdayLong() {
3964
+ return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null;
3965
+ }
3966
+ get offset() {
3967
+ return this.isValid ? +this.o : NaN;
3968
+ }
3969
+ get offsetNameShort() {
3970
+ if (this.isValid) {
3971
+ return this.zone.offsetName(this.ts, {
3972
+ format: "short",
3973
+ locale: this.locale
3974
+ });
3975
+ } else {
3976
+ return null;
3977
+ }
3978
+ }
3979
+ get offsetNameLong() {
3980
+ if (this.isValid) {
3981
+ return this.zone.offsetName(this.ts, {
3982
+ format: "long",
3983
+ locale: this.locale
3984
+ });
3985
+ } else {
3986
+ return null;
3987
+ }
3988
+ }
3989
+ get isOffsetFixed() {
3990
+ return this.isValid ? this.zone.isUniversal : null;
3991
+ }
3992
+ get isInDST() {
3993
+ if (this.isOffsetFixed) {
3994
+ return false;
3995
+ } else {
3996
+ return this.offset > this.set({ month: 1, day: 1 }).offset || this.offset > this.set({ month: 5 }).offset;
3997
+ }
3998
+ }
3999
+ getPossibleOffsets() {
4000
+ if (!this.isValid || this.isOffsetFixed) {
4001
+ return [this];
4002
+ }
4003
+ const dayMs = 86400000;
4004
+ const minuteMs = 60000;
4005
+ const localTS = objToLocalTS(this.c);
4006
+ const oEarlier = this.zone.offset(localTS - dayMs);
4007
+ const oLater = this.zone.offset(localTS + dayMs);
4008
+ const o1 = this.zone.offset(localTS - oEarlier * minuteMs);
4009
+ const o2 = this.zone.offset(localTS - oLater * minuteMs);
4010
+ if (o1 === o2) {
4011
+ return [this];
4012
+ }
4013
+ const ts1 = localTS - o1 * minuteMs;
4014
+ const ts2 = localTS - o2 * minuteMs;
4015
+ const c1 = tsToObj(ts1, o1);
4016
+ const c2 = tsToObj(ts2, o2);
4017
+ if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) {
4018
+ return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })];
4019
+ }
4020
+ return [this];
4021
+ }
4022
+ get isInLeapYear() {
4023
+ return isLeapYear(this.year);
4024
+ }
4025
+ get daysInMonth() {
4026
+ return daysInMonth(this.year, this.month);
4027
+ }
4028
+ get daysInYear() {
4029
+ return this.isValid ? daysInYear(this.year) : NaN;
4030
+ }
4031
+ get weeksInWeekYear() {
4032
+ return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
4033
+ }
4034
+ get weeksInLocalWeekYear() {
4035
+ return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
4036
+ }
4037
+ resolvedLocaleOptions(opts = {}) {
4038
+ const { locale, numberingSystem, calendar } = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this);
4039
+ return { locale, numberingSystem, outputCalendar: calendar };
4040
+ }
4041
+ toUTC(offset2 = 0, opts = {}) {
4042
+ return this.setZone(FixedOffsetZone.instance(offset2), opts);
4043
+ }
4044
+ toLocal() {
4045
+ return this.setZone(Settings.defaultZone);
4046
+ }
4047
+ setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {
4048
+ zone = normalizeZone(zone, Settings.defaultZone);
4049
+ if (zone.equals(this.zone)) {
4050
+ return this;
4051
+ } else if (!zone.isValid) {
4052
+ return DateTime.invalid(unsupportedZone(zone));
4053
+ } else {
4054
+ let newTS = this.ts;
4055
+ if (keepLocalTime || keepCalendarTime) {
4056
+ const offsetGuess = zone.offset(this.ts);
4057
+ const asObj = this.toObject();
4058
+ [newTS] = objToTS(asObj, offsetGuess, zone);
4059
+ }
4060
+ return clone(this, { ts: newTS, zone });
4061
+ }
4062
+ }
4063
+ reconfigure({ locale, numberingSystem, outputCalendar } = {}) {
4064
+ const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });
4065
+ return clone(this, { loc });
4066
+ }
4067
+ setLocale(locale) {
4068
+ return this.reconfigure({ locale });
4069
+ }
4070
+ set(values) {
4071
+ if (!this.isValid)
4072
+ return this;
4073
+ const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
4074
+ const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);
4075
+ 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;
4076
+ if ((containsGregor || containsOrdinal) && definiteWeekDef) {
4077
+ throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
4078
+ }
4079
+ if (containsGregorMD && containsOrdinal) {
4080
+ throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
4081
+ }
4082
+ let mixed;
4083
+ if (settingWeekStuff) {
4084
+ mixed = weekToGregorian({ ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized }, minDaysInFirstWeek, startOfWeek);
4085
+ } else if (!isUndefined(normalized.ordinal)) {
4086
+ mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });
4087
+ } else {
4088
+ mixed = { ...this.toObject(), ...normalized };
4089
+ if (isUndefined(normalized.day)) {
4090
+ mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
4091
+ }
4092
+ }
4093
+ const [ts, o] = objToTS(mixed, this.o, this.zone);
4094
+ return clone(this, { ts, o });
4095
+ }
4096
+ plus(duration) {
4097
+ if (!this.isValid)
4098
+ return this;
4099
+ const dur = Duration.fromDurationLike(duration);
4100
+ return clone(this, adjustTime(this, dur));
4101
+ }
4102
+ minus(duration) {
4103
+ if (!this.isValid)
4104
+ return this;
4105
+ const dur = Duration.fromDurationLike(duration).negate();
4106
+ return clone(this, adjustTime(this, dur));
4107
+ }
4108
+ startOf(unit, { useLocaleWeeks = false } = {}) {
4109
+ if (!this.isValid)
4110
+ return this;
4111
+ const o = {}, normalizedUnit = Duration.normalizeUnit(unit);
4112
+ switch (normalizedUnit) {
4113
+ case "years":
4114
+ o.month = 1;
4115
+ case "quarters":
4116
+ case "months":
4117
+ o.day = 1;
4118
+ case "weeks":
4119
+ case "days":
4120
+ o.hour = 0;
4121
+ case "hours":
4122
+ o.minute = 0;
4123
+ case "minutes":
4124
+ o.second = 0;
4125
+ case "seconds":
4126
+ o.millisecond = 0;
4127
+ break;
4128
+ }
4129
+ if (normalizedUnit === "weeks") {
4130
+ if (useLocaleWeeks) {
4131
+ const startOfWeek = this.loc.getStartOfWeek();
4132
+ const { weekday } = this;
4133
+ if (weekday < startOfWeek) {
4134
+ o.weekNumber = this.weekNumber - 1;
4135
+ }
4136
+ o.weekday = startOfWeek;
4137
+ } else {
4138
+ o.weekday = 1;
4139
+ }
4140
+ }
4141
+ if (normalizedUnit === "quarters") {
4142
+ const q = Math.ceil(this.month / 3);
4143
+ o.month = (q - 1) * 3 + 1;
4144
+ }
4145
+ return this.set(o);
4146
+ }
4147
+ endOf(unit, opts) {
4148
+ return this.isValid ? this.plus({ [unit]: 1 }).startOf(unit, opts).minus(1) : this;
4149
+ }
4150
+ toFormat(fmt, opts = {}) {
4151
+ return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID;
4152
+ }
4153
+ toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
4154
+ return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID;
4155
+ }
4156
+ toLocaleParts(opts = {}) {
4157
+ return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
4158
+ }
4159
+ toISO({
4160
+ format = "extended",
4161
+ suppressSeconds = false,
4162
+ suppressMilliseconds = false,
4163
+ includeOffset = true,
4164
+ extendedZone = false,
4165
+ precision = "milliseconds"
4166
+ } = {}) {
4167
+ if (!this.isValid) {
4168
+ return null;
4169
+ }
4170
+ precision = normalizeUnit(precision);
4171
+ const ext = format === "extended";
4172
+ let c2 = toISODate(this, ext, precision);
4173
+ if (orderedUnits.indexOf(precision) >= 3)
4174
+ c2 += "T";
4175
+ c2 += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
4176
+ return c2;
4177
+ }
4178
+ toISODate({ format = "extended", precision = "day" } = {}) {
4179
+ if (!this.isValid) {
4180
+ return null;
4181
+ }
4182
+ return toISODate(this, format === "extended", normalizeUnit(precision));
4183
+ }
4184
+ toISOWeekDate() {
4185
+ return toTechFormat(this, "kkkk-'W'WW-c");
4186
+ }
4187
+ toISOTime({
4188
+ suppressMilliseconds = false,
4189
+ suppressSeconds = false,
4190
+ includeOffset = true,
4191
+ includePrefix = false,
4192
+ extendedZone = false,
4193
+ format = "extended",
4194
+ precision = "milliseconds"
4195
+ } = {}) {
4196
+ if (!this.isValid) {
4197
+ return null;
4198
+ }
4199
+ precision = normalizeUnit(precision);
4200
+ let c2 = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
4201
+ return c2 + toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
4202
+ }
4203
+ toRFC2822() {
4204
+ return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
4205
+ }
4206
+ toHTTP() {
4207
+ return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
4208
+ }
4209
+ toSQLDate() {
4210
+ if (!this.isValid) {
4211
+ return null;
4212
+ }
4213
+ return toISODate(this, true);
4214
+ }
4215
+ toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {
4216
+ let fmt = "HH:mm:ss.SSS";
4217
+ if (includeZone || includeOffset) {
4218
+ if (includeOffsetSpace) {
4219
+ fmt += " ";
4220
+ }
4221
+ if (includeZone) {
4222
+ fmt += "z";
4223
+ } else if (includeOffset) {
4224
+ fmt += "ZZ";
4225
+ }
4226
+ }
4227
+ return toTechFormat(this, fmt, true);
4228
+ }
4229
+ toSQL(opts = {}) {
4230
+ if (!this.isValid) {
4231
+ return null;
4232
+ }
4233
+ return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;
4234
+ }
4235
+ toString() {
4236
+ return this.isValid ? this.toISO() : INVALID;
4237
+ }
4238
+ [Symbol.for("nodejs.util.inspect.custom")]() {
4239
+ if (this.isValid) {
4240
+ return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
4241
+ } else {
4242
+ return `DateTime { Invalid, reason: ${this.invalidReason} }`;
4243
+ }
4244
+ }
4245
+ valueOf() {
4246
+ return this.toMillis();
4247
+ }
4248
+ toMillis() {
4249
+ return this.isValid ? this.ts : NaN;
4250
+ }
4251
+ toSeconds() {
4252
+ return this.isValid ? this.ts / 1000 : NaN;
4253
+ }
4254
+ toUnixInteger() {
4255
+ return this.isValid ? Math.floor(this.ts / 1000) : NaN;
4256
+ }
4257
+ toJSON() {
4258
+ return this.toISO();
4259
+ }
4260
+ toBSON() {
4261
+ return this.toJSDate();
4262
+ }
4263
+ toObject(opts = {}) {
4264
+ if (!this.isValid)
4265
+ return {};
4266
+ const base = { ...this.c };
4267
+ if (opts.includeConfig) {
4268
+ base.outputCalendar = this.outputCalendar;
4269
+ base.numberingSystem = this.loc.numberingSystem;
4270
+ base.locale = this.loc.locale;
4271
+ }
4272
+ return base;
4273
+ }
4274
+ toJSDate() {
4275
+ return new Date(this.isValid ? this.ts : NaN);
4276
+ }
4277
+ diff(otherDateTime, unit = "milliseconds", opts = {}) {
4278
+ if (!this.isValid || !otherDateTime.isValid) {
4279
+ return Duration.invalid("created by diffing an invalid DateTime");
4280
+ }
4281
+ const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };
4282
+ 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);
4283
+ return otherIsLater ? diffed.negate() : diffed;
4284
+ }
4285
+ diffNow(unit = "milliseconds", opts = {}) {
4286
+ return this.diff(DateTime.now(), unit, opts);
4287
+ }
4288
+ until(otherDateTime) {
4289
+ return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
4290
+ }
4291
+ hasSame(otherDateTime, unit, opts) {
4292
+ if (!this.isValid)
4293
+ return false;
4294
+ const inputMs = otherDateTime.valueOf();
4295
+ const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });
4296
+ return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
4297
+ }
4298
+ equals(other) {
4299
+ return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
4300
+ }
4301
+ toRelative(options = {}) {
4302
+ if (!this.isValid)
4303
+ return null;
4304
+ const base = options.base || DateTime.fromObject({}, { zone: this.zone }), padding = options.padding ? this < base ? -options.padding : options.padding : 0;
4305
+ let units = ["years", "months", "days", "hours", "minutes", "seconds"];
4306
+ let unit = options.unit;
4307
+ if (Array.isArray(options.unit)) {
4308
+ units = options.unit;
4309
+ unit = undefined;
4310
+ }
4311
+ return diffRelative(base, this.plus(padding), {
4312
+ ...options,
4313
+ numeric: "always",
4314
+ units,
4315
+ unit
4316
+ });
4317
+ }
4318
+ toRelativeCalendar(options = {}) {
4319
+ if (!this.isValid)
4320
+ return null;
4321
+ return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {
4322
+ ...options,
4323
+ numeric: "auto",
4324
+ units: ["years", "months", "days"],
4325
+ calendary: true
4326
+ });
4327
+ }
4328
+ static min(...dateTimes) {
4329
+ if (!dateTimes.every(DateTime.isDateTime)) {
4330
+ throw new InvalidArgumentError("min requires all arguments be DateTimes");
4331
+ }
4332
+ return bestBy(dateTimes, (i) => i.valueOf(), Math.min);
4333
+ }
4334
+ static max(...dateTimes) {
4335
+ if (!dateTimes.every(DateTime.isDateTime)) {
4336
+ throw new InvalidArgumentError("max requires all arguments be DateTimes");
4337
+ }
4338
+ return bestBy(dateTimes, (i) => i.valueOf(), Math.max);
4339
+ }
4340
+ static fromFormatExplain(text, fmt, options = {}) {
4341
+ const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
4342
+ locale,
4343
+ numberingSystem,
4344
+ defaultToEN: true
4345
+ });
4346
+ return explainFromTokens(localeToUse, text, fmt);
4347
+ }
4348
+ static fromStringExplain(text, fmt, options = {}) {
4349
+ return DateTime.fromFormatExplain(text, fmt, options);
4350
+ }
4351
+ static buildFormatParser(fmt, options = {}) {
4352
+ const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
4353
+ locale,
4354
+ numberingSystem,
4355
+ defaultToEN: true
4356
+ });
4357
+ return new TokenParser(localeToUse, fmt);
4358
+ }
4359
+ static fromFormatParser(text, formatParser, opts = {}) {
4360
+ if (isUndefined(text) || isUndefined(formatParser)) {
4361
+ throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");
4362
+ }
4363
+ const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
4364
+ locale,
4365
+ numberingSystem,
4366
+ defaultToEN: true
4367
+ });
4368
+ if (!localeToUse.equals(formatParser.locale)) {
4369
+ throw new InvalidArgumentError(`fromFormatParser called with a locale of ${localeToUse}, ` + `but the format parser was created for ${formatParser.locale}`);
4370
+ }
4371
+ const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);
4372
+ if (invalidReason) {
4373
+ return DateTime.invalid(invalidReason);
4374
+ } else {
4375
+ return parseDataToDateTime(result, zone, opts, `format ${formatParser.format}`, text, specificOffset);
4376
+ }
4377
+ }
4378
+ static get DATE_SHORT() {
4379
+ return DATE_SHORT;
4380
+ }
4381
+ static get DATE_MED() {
4382
+ return DATE_MED;
4383
+ }
4384
+ static get DATE_MED_WITH_WEEKDAY() {
4385
+ return DATE_MED_WITH_WEEKDAY;
4386
+ }
4387
+ static get DATE_FULL() {
4388
+ return DATE_FULL;
4389
+ }
4390
+ static get DATE_HUGE() {
4391
+ return DATE_HUGE;
4392
+ }
4393
+ static get TIME_SIMPLE() {
4394
+ return TIME_SIMPLE;
4395
+ }
4396
+ static get TIME_WITH_SECONDS() {
4397
+ return TIME_WITH_SECONDS;
4398
+ }
4399
+ static get TIME_WITH_SHORT_OFFSET() {
4400
+ return TIME_WITH_SHORT_OFFSET;
4401
+ }
4402
+ static get TIME_WITH_LONG_OFFSET() {
4403
+ return TIME_WITH_LONG_OFFSET;
4404
+ }
4405
+ static get TIME_24_SIMPLE() {
4406
+ return TIME_24_SIMPLE;
4407
+ }
4408
+ static get TIME_24_WITH_SECONDS() {
4409
+ return TIME_24_WITH_SECONDS;
4410
+ }
4411
+ static get TIME_24_WITH_SHORT_OFFSET() {
4412
+ return TIME_24_WITH_SHORT_OFFSET;
4413
+ }
4414
+ static get TIME_24_WITH_LONG_OFFSET() {
4415
+ return TIME_24_WITH_LONG_OFFSET;
4416
+ }
4417
+ static get DATETIME_SHORT() {
4418
+ return DATETIME_SHORT;
4419
+ }
4420
+ static get DATETIME_SHORT_WITH_SECONDS() {
4421
+ return DATETIME_SHORT_WITH_SECONDS;
4422
+ }
4423
+ static get DATETIME_MED() {
4424
+ return DATETIME_MED;
4425
+ }
4426
+ static get DATETIME_MED_WITH_SECONDS() {
4427
+ return DATETIME_MED_WITH_SECONDS;
4428
+ }
4429
+ static get DATETIME_MED_WITH_WEEKDAY() {
4430
+ return DATETIME_MED_WITH_WEEKDAY;
4431
+ }
4432
+ static get DATETIME_FULL() {
4433
+ return DATETIME_FULL;
4434
+ }
4435
+ static get DATETIME_FULL_WITH_SECONDS() {
4436
+ return DATETIME_FULL_WITH_SECONDS;
4437
+ }
4438
+ static get DATETIME_HUGE() {
4439
+ return DATETIME_HUGE;
4440
+ }
4441
+ static get DATETIME_HUGE_WITH_SECONDS() {
4442
+ return DATETIME_HUGE_WITH_SECONDS;
4443
+ }
4444
+ }
4445
+ function friendlyDateTime(dateTimeish) {
4446
+ if (DateTime.isDateTime(dateTimeish)) {
4447
+ return dateTimeish;
4448
+ } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {
4449
+ return DateTime.fromJSDate(dateTimeish);
4450
+ } else if (dateTimeish && typeof dateTimeish === "object") {
4451
+ return DateTime.fromObject(dateTimeish);
4452
+ } else {
4453
+ throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`);
4454
+ }
4455
+ }
4456
+
4457
+ // ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-TZVIZNQA.js
4458
+ var ne2 = (e, t) => {
4459
+ let n2 = t.trim();
4460
+ return n2 ? e.find((r) => ne(r) === n2) : undefined;
4461
+ };
4462
+ var y = String.raw`-?\d{4,}-\d{2}-\d{2}`;
4463
+ var x = String.raw`\d{2}:\d{2}(:\d{2}(\.\d+)?)?([Zz]|[+-]\d{2}:\d{2})?`;
4464
+ var R2 = String.raw`-?P(?!$)(\d+Y)?(\d+M)?(\d+D)?(T(?!$)(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?`;
4465
+ var w = String.raw`-?(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?`;
4466
+ var E = new RegExp(`^${y}$`);
4467
+ var D = new RegExp(`^${x}$`);
4468
+ var h = new RegExp(`^${y}T${x}$`);
4469
+ var b = new RegExp(`^${R2}$`);
4470
+ var A = new RegExp(`^${w}$`);
4471
+ var N = /^(?!.*\.\.)[^[\]()<>=!,]*$/;
4472
+ var O = (e) => {
4473
+ let t = e.indexOf("@");
4474
+ return t === -1 ? { text: e } : { text: e.slice(0, t), zone: e.slice(t + 1) };
4475
+ };
4476
+ var $ = (e) => E.test(e) && DateTime.fromISO(e).isValid;
4477
+ var P = (e) => {
4478
+ let { text: t, zone: n2 } = O(e);
4479
+ return D.test(t) ? DateTime.fromISO(`2000-01-01T${t}`, n2 ? { zone: n2 } : { setZone: true }).isValid : false;
4480
+ };
4481
+ var k = (e) => {
4482
+ let { text: t, zone: n2 } = O(e);
4483
+ return h.test(t) && DateTime.fromISO(t, n2 ? { zone: n2 } : { setZone: true }).isValid;
4484
+ };
4485
+ var F = (e) => {
4486
+ if (!b.test(e))
4487
+ return;
4488
+ let t = Duration.fromISO(e);
4489
+ if (!t.isValid)
4490
+ return;
4491
+ let n2 = t.toObject(), r = (...i) => i.some((s2) => n2[s2] !== undefined);
4492
+ return { years: r("years", "months"), days: r("weeks", "days", "hours", "minutes", "seconds", "milliseconds") };
4493
+ };
4494
+ var M = (e, t) => {
4495
+ let n2 = F(e);
4496
+ return n2 ? t === "yearMonth" ? n2.years && !n2.days : n2.days && !n2.years : false;
4497
+ };
4498
+ var C = (e) => A.test(e);
4499
+ var de = (e, t) => {
4500
+ let n2 = e.trim();
4501
+ if (!n2)
4502
+ return false;
4503
+ switch (R(t ?? "string")) {
4504
+ case "date":
4505
+ return $(n2);
4506
+ case "time":
4507
+ return P(n2);
4508
+ case "date and time":
4509
+ return k(n2);
4510
+ case "dayTimeDuration":
4511
+ return M(n2, "dayTime");
4512
+ case "yearMonthDuration":
4513
+ return M(n2, "yearMonth");
4514
+ case "boolean":
4515
+ return n2 === "true" || n2 === "false";
4516
+ case "number":
4517
+ return C(n2);
4518
+ default:
4519
+ return true;
4520
+ }
4521
+ };
4522
+ var W = (e) => ["date", "time", "date and time", "dayTimeDuration", "yearMonthDuration", "boolean", "number"].includes(R(e ?? "string"));
4523
+ var _ = (e) => W(e) || R(e ?? "string") === "string";
4524
+ var J = String.raw`\"`;
4525
+ var c2 = "matches(?, ";
4526
+ var S = "^(";
4527
+ var I = ")$";
4528
+ var v = ["date", "time", "date and time", "duration"];
4529
+ var Y = (e) => {
4530
+ let t = e.trim();
4531
+ for (let n2 of v) {
4532
+ let r = `${n2}(`;
4533
+ if (t.startsWith(r) && t.endsWith(")"))
4534
+ try {
4535
+ let i = JSON.parse(t.slice(r.length, -1).trim());
4536
+ return typeof i == "string" ? i : undefined;
4537
+ } catch {
4538
+ return;
4539
+ }
4540
+ }
4541
+ };
4542
+ var z = (e) => {
4543
+ let t = e.trim(), n2 = Y(t);
4544
+ return n2 !== undefined ? n2 : U(t) ? X(t)[0] : N.test(t) ? t : undefined;
4545
+ };
4546
+ var U = (e) => e.length >= 2 && e.startsWith('"') && e.endsWith('"');
4547
+ var B = (e) => {
4548
+ if (!U(e))
4549
+ return e;
4550
+ try {
4551
+ let t = JSON.parse(e);
4552
+ return typeof t == "string" ? t : e;
4553
+ } catch {
4554
+ return e.slice(1, -1).replaceAll(J, '"');
4555
+ }
4556
+ };
4557
+ var L = (e) => {
4558
+ let t = [], n2 = 0, r = false, i = 0, s2 = (o) => {
4559
+ let a = e.slice(i, o), u = a.trim();
4560
+ if (u) {
4561
+ let f = i + a.indexOf(u);
4562
+ t.push({ token: u, from: f, to: f + u.length });
4563
+ }
4564
+ };
4565
+ for (let o = 0;o < e.length; o += 1) {
4566
+ let a = e[o];
4567
+ r && a === "\\" ? o += 1 : a === '"' ? r = !r : !r && "([{".includes(a) ? n2 += 1 : !r && ")]}".includes(a) ? n2 = Math.max(0, n2 - 1) : a === "," && !r && n2 === 0 && (s2(o), i = o + 1);
4568
+ }
4569
+ return s2(e.length), t;
4570
+ };
4571
+ var H = (e) => L(e).map(({ token: t }) => t);
4572
+ var X = (e) => H(e).map(B);
4573
+ var Z = (e) => {
4574
+ let t = e?.text;
4575
+ if (!t?.startsWith(c2) || !t.endsWith(")"))
4576
+ return null;
4577
+ let n2 = t.slice(c2.length, -1);
4578
+ try {
4579
+ let r = JSON.parse(n2);
4580
+ return typeof r != "string" || `${c2}${JSON.stringify(r)})` !== t || !r.startsWith(S) || !r.endsWith(I) ? null : r.slice(S.length, -I.length);
4581
+ } catch {
4582
+ return null;
4583
+ }
4584
+ };
4585
+ var pe = (e, t) => {
4586
+ let n2 = e?.text.trim();
4587
+ return !e || !n2 ? "none" : Z(e) !== null ? "regex" : ae(n2, "unaryTests") ? "expression" : G(e, t) ? "list" : "expression";
4588
+ };
4589
+ var G = (e, t) => {
4590
+ let n2 = Q(e.text);
4591
+ if (n2.length === 0)
4592
+ return false;
4593
+ if (!_(t))
4594
+ return n2.every(({ token: i }) => oe(i));
4595
+ let r = ee(t);
4596
+ return n2.every(({ token: i, value: s2 }) => s2 !== undefined || r && K(i) !== undefined);
4597
+ };
4598
+ var Q = (e) => L(e).map((t) => ({ ...t, value: z(t.token) }));
4599
+ var K = (e) => {
4600
+ let t = e.trim(), n2 = e.indexOf(t), r;
4601
+ if (c(t, "unaryTests").iterate({ enter(s2) {
4602
+ s2.name === "Interval" && s2.from === 0 && s2.to === t.length && (r = s2.node);
4603
+ } }), !r)
4604
+ return;
4605
+ let i = [];
4606
+ for (let s2 = r.firstChild;s2; s2 = s2.nextSibling)
4607
+ j.has(s2.name) && i.push({ text: t.slice(s2.from, s2.to), from: n2 + s2.from, to: n2 + s2.to });
4608
+ return i.length === 2 ? i : undefined;
4609
+ };
4610
+ var j = new Set(["StringLiteral", "NumericLiteral", "DateTimeLiteral"]);
4611
+ var q = new Set(["number"]);
4612
+ var ee = (e) => q.has(R(e ?? "string"));
4613
+
4614
+ export { ne2 as ne, de, W, Y, U, X, pe, Q, K, ee };
4615
+
4616
+ //# debugId=715F063C6E54761664756E2164756E21