@bereasoftware/time-guard 2.7.2 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.en.md +5 -1
  2. package/README.md +5 -1
  3. package/dist/angular/index.cjs +1 -148
  4. package/dist/angular/index.es.js +60 -112
  5. package/dist/calendars/index.cjs +1 -357
  6. package/dist/calendars/index.es.js +66 -99
  7. package/dist/chunk-C6qsp3rV.cjs +1 -0
  8. package/dist/core-Dxn1aRFk.js +1186 -0
  9. package/dist/core-TqmHKXY1.cjs +1 -0
  10. package/dist/core.d.ts +27 -1
  11. package/dist/index.d.ts +4 -2
  12. package/dist/locales/index.cjs +1 -7
  13. package/dist/locales/index.d.ts +11 -0
  14. package/dist/locales/index.es.js +3 -3
  15. package/dist/{locales-CGdn0DJN.cjs → locales-3Mw99lQ-.js} +201 -82
  16. package/dist/locales-bc-5kDuZ.cjs +1 -0
  17. package/dist/native/index.cjs +1 -48
  18. package/dist/native/index.es.js +8 -18
  19. package/dist/plugins/advanced-format.cjs +1 -105
  20. package/dist/plugins/advanced-format.es.js +43 -63
  21. package/dist/plugins/duration.cjs +1 -258
  22. package/dist/plugins/duration.es.js +59 -165
  23. package/dist/plugins/relative-time.cjs +1 -166
  24. package/dist/plugins/relative-time.es.js +36 -74
  25. package/dist/qwik/index.cjs +1 -104
  26. package/dist/qwik/index.es.js +33 -94
  27. package/dist/react/index.cjs +1 -112
  28. package/dist/react/index.es.js +57 -91
  29. package/dist/solid/index.cjs +1 -127
  30. package/dist/solid/index.es.js +34 -116
  31. package/dist/svelte/index.cjs +1 -398
  32. package/dist/svelte/index.es.js +85 -344
  33. package/dist/time-guard.cjs +3 -7359
  34. package/dist/time-guard.es.js +3412 -3625
  35. package/dist/time-guard.iife.js +3 -13549
  36. package/dist/time-guard.umd.js +3 -13550
  37. package/dist/vue/index.cjs +1 -143
  38. package/dist/vue/index.es.js +62 -116
  39. package/package.json +2 -3
  40. package/dist/chunk-S8Y6Ng9i.cjs +0 -36
  41. package/dist/core-BIDjudpO.cjs +0 -1892
  42. package/dist/core-DWPXk3rz.js +0 -1809
  43. package/dist/locales-BUE_aq8K.js +0 -3514
@@ -0,0 +1,1186 @@
1
+ /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { c as e } from "./locales-3Mw99lQ-.js";
3
+ //#region src/adapters/temporal.adapter.ts
4
+ var t = null;
5
+ function n() {
6
+ if (t) return t;
7
+ let e = globalThis.Temporal;
8
+ if (!e) throw Error("Temporal API not loaded. Make sure @js-temporal/polyfill is imported in your app.");
9
+ return t = e, e;
10
+ }
11
+ var r = class {
12
+ static parseToPlainDateTime(e) {
13
+ let t = n();
14
+ return this.isPlainDateTime(e) ? e : this.isZonedDateTime(e) ? e.toPlainDateTime() : this.isPlainDate(e) ? e.toPlainDateTime({
15
+ hour: 0,
16
+ minute: 0,
17
+ second: 0,
18
+ millisecond: 0
19
+ }) : this.isPlainTime(e) ? t.Now.plainDateTimeISO().withPlainTime(e) : typeof e == "object" && e && "getTime" in e && typeof e.getTime == "function" ? this.fromDate(e) : typeof e == "number" ? this.fromUnix(e) : typeof e == "string" ? this.parseISOString(e) : typeof e == "object" && e ? this.fromObject(e) : t.Now.plainDateTimeISO();
20
+ }
21
+ static fromDate(e) {
22
+ let t = n(), [r, i] = e.toISOString().split("T");
23
+ return t.PlainDateTime.from(r + "T" + i.slice(0, -1));
24
+ }
25
+ static fromUnix(e) {
26
+ return this.fromDate(new Date(e));
27
+ }
28
+ static parseISOString(e) {
29
+ let t = n();
30
+ try {
31
+ if (e.includes("T") || / \d{2}:\d{2}/.test(e)) {
32
+ let n = e.replace(" ", "T").replace(/(?:Z|[+-]\d{2}:\d{2})$/i, "");
33
+ return t.PlainDateTime.from(n);
34
+ }
35
+ return t.PlainDate.from(e).toPlainDateTime({ hour: 0 });
36
+ } catch {
37
+ return t.Now.plainDateTimeISO();
38
+ }
39
+ }
40
+ static fromObject(e) {
41
+ let t = n(), r = e.year || t.Now.plainDateISO().year, i = e.month || 1, a = e.day || 1, o = e.hour || 0, s = e.minute || 0, c = e.second || 0, l = e.millisecond || 0;
42
+ return t.PlainDateTime.from({
43
+ year: this.toFiniteInteger(r),
44
+ month: this.toFiniteInteger(i),
45
+ day: this.toFiniteInteger(a),
46
+ hour: this.toFiniteInteger(o),
47
+ minute: this.toFiniteInteger(s),
48
+ second: this.toFiniteInteger(c),
49
+ millisecond: this.toFiniteInteger(l)
50
+ });
51
+ }
52
+ static toDate(e) {
53
+ let t = this.toPlainDateTime(e);
54
+ return new Date(t.toString());
55
+ }
56
+ static toUnix(e) {
57
+ let t = this.toPlainDateTime(e);
58
+ return Date.UTC(t.year, t.month - 1, t.day, t.hour, t.minute, t.second, t.millisecond);
59
+ }
60
+ static toISOString(e) {
61
+ return this.toPlainDateTime(e).toString({ smallestUnit: "millisecond" }) + "Z";
62
+ }
63
+ static toPlainDateTime(e) {
64
+ return this.isPlainDateTime(e) ? e : e.toPlainDateTime();
65
+ }
66
+ static isPlainDateTime(e) {
67
+ return typeof e == "object" && !!e && "year" in e && "month" in e && "day" in e && "hour" in e;
68
+ }
69
+ static isZonedDateTime(e) {
70
+ return typeof e == "object" && !!e && "timeZone" in e;
71
+ }
72
+ static isPlainDate(e) {
73
+ return typeof e == "object" && !!e && "year" in e && "month" in e && "day" in e && !("hour" in e) && "toPlainDateTime" in e;
74
+ }
75
+ static isPlainTime(e) {
76
+ return typeof e == "object" && !!e && "hour" in e && !("year" in e);
77
+ }
78
+ static toFiniteInteger(e) {
79
+ let t = Number(e);
80
+ if (!Number.isFinite(t)) throw Error(`Temporal error: Expected finite integer, got ${e}`);
81
+ return Math.trunc(t);
82
+ }
83
+ static validatePlainDateTime(e) {
84
+ for (let t of [
85
+ "year",
86
+ "month",
87
+ "day",
88
+ "hour",
89
+ "minute",
90
+ "second",
91
+ "millisecond"
92
+ ]) {
93
+ let n = e[t];
94
+ if (typeof n != "number" || !Number.isFinite(n) || !Number.isInteger(n)) throw typeof console < "u" && typeof console.error == "function" && console.error("TemporalAdapter.validatePlainDateTime: campo inválido", t, n, e), Error(`Temporal error: Expected finite integer for ${t}, got ${n}`);
95
+ }
96
+ }
97
+ static now() {
98
+ return n().Now.plainDateTimeISO();
99
+ }
100
+ static nowInTimezone(e) {
101
+ return n().Now.zonedDateTimeISO(e);
102
+ }
103
+ static compare(e, t) {
104
+ let r = n();
105
+ if (this.validatePlainDateTime(e), this.validatePlainDateTime(t), r.PlainDateTime && typeof r.PlainDateTime.compare == "function") return r.PlainDateTime.compare(e, t);
106
+ let i = e.toString(), a = t.toString();
107
+ return i < a ? -1 : +(i > a);
108
+ }
109
+ }, i = class {
110
+ localeManager;
111
+ constructor() {
112
+ this.localeManager = e.getInstance();
113
+ }
114
+ format(e, t, n) {
115
+ let r = this.localeManager.getLocale(n), i = [], a = t.replace(/\[([^\]]+)\]/g, (e, t) => (i.push(t), `~${i.length - 1}~`));
116
+ a = a.replace(/"([^"]*)"/g, (e, t) => (i.push(t), `~${i.length - 1}~`));
117
+ let o = a.replace(/Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|SSS/g, (t) => {
118
+ switch (t) {
119
+ case "YYYY": return String(e.year).padStart(4, "0");
120
+ case "YY": return String(e.year).slice(-2);
121
+ case "Y": return String(e.year);
122
+ case "MMMM": return r.months[e.month - 1];
123
+ case "MMM": return r.monthsShort[e.month - 1];
124
+ case "MM": return String(e.month).padStart(2, "0");
125
+ case "M": return String(e.month);
126
+ case "DD": return String(e.day).padStart(2, "0");
127
+ case "D": return String(e.day);
128
+ case "dddd": return r.weekdays[e.dayOfWeek % 7];
129
+ case "ddd": return r.weekdaysShort[e.dayOfWeek % 7];
130
+ case "dd": return r.weekdaysMin[e.dayOfWeek % 7];
131
+ case "d": return String(e.dayOfWeek);
132
+ case "HH": return String(e.hour).padStart(2, "0");
133
+ case "H": return String(e.hour);
134
+ case "hh": return String(e.hour % 12 || 12).padStart(2, "0");
135
+ case "h": return String(e.hour % 12 || 12);
136
+ case "mm": return String(e.minute).padStart(2, "0");
137
+ case "m": return String(e.minute);
138
+ case "ss": return String(e.second).padStart(2, "0");
139
+ case "s": return String(e.second);
140
+ case "SSS": return String(e.millisecond).padStart(3, "0");
141
+ case "a":
142
+ case "A":
143
+ let n = r.meridiem || {
144
+ am: "am",
145
+ pm: "pm"
146
+ }, i = e.hour >= 12 ? n.pm : n.am;
147
+ return t === "a" ? i.toLowerCase() : i.toUpperCase();
148
+ default: return t;
149
+ }
150
+ });
151
+ return i.forEach((e, t) => {
152
+ o = o.replace(`~${t}~`, e);
153
+ }), o;
154
+ }
155
+ getPreset(e) {
156
+ let t = {
157
+ iso: "YYYY-MM-DDTHH:mm:ss.SSSZ",
158
+ date: "YYYY-MM-DD",
159
+ time: "HH:mm:ss",
160
+ datetime: "YYYY-MM-DD HH:mm:ss",
161
+ rfc2822: "ddd, DD MMM YYYY HH:mm:ss Z",
162
+ rfc3339: "YYYY-MM-DDTHH:mm:ssZ",
163
+ utc: "YYYY-MM-DDTHH:mm:ss[Z]"
164
+ };
165
+ return t[e] || t.iso;
166
+ }
167
+ formatPreset(e, t, n) {
168
+ let r = this.getPreset(t);
169
+ return this.format(e, r, n);
170
+ }
171
+ }, a = {
172
+ en: {
173
+ year: ["year", "years"],
174
+ month: ["month", "months"],
175
+ week: ["week", "weeks"],
176
+ day: ["day", "days"],
177
+ hour: ["hour", "hours"],
178
+ minute: ["minute", "minutes"],
179
+ second: ["second", "seconds"],
180
+ millisecond: ["millisecond", "milliseconds"]
181
+ },
182
+ es: {
183
+ year: ["año", "años"],
184
+ month: ["mes", "meses"],
185
+ week: ["semana", "semanas"],
186
+ day: ["día", "días"],
187
+ hour: ["hora", "horas"],
188
+ minute: ["minuto", "minutos"],
189
+ second: ["segundo", "segundos"],
190
+ millisecond: ["milisegundo", "milisegundos"]
191
+ },
192
+ fr: {
193
+ year: ["année", "années"],
194
+ month: ["mois", "mois"],
195
+ week: ["semaine", "semaines"],
196
+ day: ["jour", "jours"],
197
+ hour: ["heure", "heures"],
198
+ minute: ["minute", "minutes"],
199
+ second: ["seconde", "secondes"],
200
+ millisecond: ["milliseconde", "millisecondes"]
201
+ }
202
+ }, o = {
203
+ en: "and",
204
+ es: "y",
205
+ fr: "et",
206
+ de: "und",
207
+ it: "e",
208
+ pt: "e"
209
+ };
210
+ function s(e, t, n) {
211
+ return ((a[t] || a.en)[e] || [e, e + "s"])[n === 1 ? 0 : 1];
212
+ }
213
+ function c(e) {
214
+ return o[e] || "and";
215
+ }
216
+ function l(e, t) {
217
+ if (e.length === 0) return "";
218
+ if (e.length === 1) return e[0];
219
+ let n = c(t);
220
+ return e.length === 2 ? `${e[0]} ${n} ${e[1]}` : e.slice(0, -1).join(", ") + ` ${n} ${e[e.length - 1]}`;
221
+ }
222
+ function u(e) {
223
+ return {
224
+ en: "0 seconds",
225
+ es: "0 segundos",
226
+ fr: "0 secondes"
227
+ }[e] || "0 seconds";
228
+ }
229
+ //#endregion
230
+ //#region src/calendars/calendar.manager.ts
231
+ var d = class {
232
+ id = "gregory";
233
+ name = "Gregorian Calendar";
234
+ locale = "en";
235
+ monthNames = [
236
+ "January",
237
+ "February",
238
+ "March",
239
+ "April",
240
+ "May",
241
+ "June",
242
+ "July",
243
+ "August",
244
+ "September",
245
+ "October",
246
+ "November",
247
+ "December"
248
+ ];
249
+ monthNamesShort = [
250
+ "Jan",
251
+ "Feb",
252
+ "Mar",
253
+ "Apr",
254
+ "May",
255
+ "Jun",
256
+ "Jul",
257
+ "Aug",
258
+ "Sep",
259
+ "Oct",
260
+ "Nov",
261
+ "Dec"
262
+ ];
263
+ weekdayNames = [
264
+ "Sunday",
265
+ "Monday",
266
+ "Tuesday",
267
+ "Wednesday",
268
+ "Thursday",
269
+ "Friday",
270
+ "Saturday"
271
+ ];
272
+ weekdayNamesShort = [
273
+ "Sun",
274
+ "Mon",
275
+ "Tue",
276
+ "Wed",
277
+ "Thu",
278
+ "Fri",
279
+ "Sat"
280
+ ];
281
+ getMonthName(e, t = !1) {
282
+ return (t ? this.monthNamesShort : this.monthNames)[Math.max(0, Math.min(11, e - 1))];
283
+ }
284
+ getWeekdayName(e, t = !1) {
285
+ return (t ? this.weekdayNamesShort : this.weekdayNames)[Math.max(0, Math.min(6, e - 1))];
286
+ }
287
+ isLeapYear(e) {
288
+ return e % 4 == 0 && e % 100 != 0 || e % 400 == 0;
289
+ }
290
+ daysInMonth(e, t) {
291
+ return t === 2 && this.isLeapYear(e) ? 29 : [
292
+ 31,
293
+ 28,
294
+ 31,
295
+ 30,
296
+ 31,
297
+ 30,
298
+ 31,
299
+ 31,
300
+ 30,
301
+ 31,
302
+ 30,
303
+ 31
304
+ ][Math.max(0, Math.min(11, t - 1))];
305
+ }
306
+ daysInYear(e) {
307
+ return this.isLeapYear(e) ? 366 : 365;
308
+ }
309
+ }, f = class e {
310
+ static instance;
311
+ calendars = /* @__PURE__ */ new Map();
312
+ defaultCalendar = "gregory";
313
+ constructor() {
314
+ this.register(new d());
315
+ }
316
+ static getInstance() {
317
+ return e.instance ||= new e(), e.instance;
318
+ }
319
+ register(e) {
320
+ this.calendars.has(e.id) && console.warn(`Calendar "${e.id}" is already registered. Overwriting...`), this.calendars.set(e.id, e);
321
+ }
322
+ get(e) {
323
+ return this.calendars.get(e);
324
+ }
325
+ list() {
326
+ return Array.from(this.calendars.keys());
327
+ }
328
+ setDefault(e) {
329
+ if (!this.calendars.has(e)) {
330
+ console.warn(`Calendar "${e}" is not registered. Keeping "${this.defaultCalendar}" as default.`);
331
+ return;
332
+ }
333
+ this.defaultCalendar = e;
334
+ }
335
+ getDefault() {
336
+ let e = this.calendars.get(this.defaultCalendar);
337
+ if (!e) throw Error(`Default calendar '${this.defaultCalendar}' not found`);
338
+ return e;
339
+ }
340
+ }, p = f.getInstance(), m = class e {
341
+ static instance;
342
+ plugins = /* @__PURE__ */ new Map();
343
+ static getInstance() {
344
+ return e.instance ||= new e(), e.instance;
345
+ }
346
+ static use(t, n, r) {
347
+ e.getInstance().register(t, n, r);
348
+ }
349
+ static useMultiple(t, n, r) {
350
+ let i = e.getInstance();
351
+ t.forEach((e) => i.register(e, n, r));
352
+ }
353
+ static getPlugin(t) {
354
+ return e.getInstance().plugins.get(t);
355
+ }
356
+ static hasPlugin(t) {
357
+ return e.getInstance().plugins.has(t);
358
+ }
359
+ static listPlugins() {
360
+ let t = e.getInstance();
361
+ return Array.from(t.plugins.keys());
362
+ }
363
+ static unuse(t) {
364
+ return e.getInstance().plugins.delete(t);
365
+ }
366
+ static clear() {
367
+ e.getInstance().plugins.clear();
368
+ }
369
+ register(e, t, n) {
370
+ if (this.plugins.has(e.name)) {
371
+ console.warn(`Plugin "${e.name}" is already registered. Skipping...`);
372
+ return;
373
+ }
374
+ try {
375
+ e.install(t, n), this.plugins.set(e.name, e), process.env.NODE_ENV !== "production" && console.warn(`Plugin "${e.name}" v${e.version} registered successfully`);
376
+ } catch (t) {
377
+ throw console.error(`Failed to register plugin "${e.name}":`, t), Error(`Failed to register plugin "${e.name}": ${t instanceof Error ? t.message : String(t)}`);
378
+ }
379
+ }
380
+ }, h = 1e3, g = h * 60, _ = g * 60, v = _ * 24, y = v * 7, b = 365.25, x = b / 12 * v, S = b * v, C = " days";
381
+ function w(e) {
382
+ return (e.years || 0) * S + (e.months || 0) * x + (e.weeks || 0) * y + (e.days || 0) * v + (e.hours || 0) * _ + (e.minutes || 0) * g + (e.seconds || 0) * h + (e.milliseconds || 0);
383
+ }
384
+ var T = class {
385
+ _value;
386
+ _tg1;
387
+ _tg2;
388
+ _mode;
389
+ _breakdownData;
390
+ _locale;
391
+ constructor(e, t, n, r = "exact", i, a) {
392
+ this._value = e, this._tg1 = t, this._tg2 = n, this._mode = r, this._breakdownData = i || null, this._locale = a || "en";
393
+ }
394
+ as(e) {
395
+ return this._tg1.diff(this._tg2, e);
396
+ }
397
+ breakdown() {
398
+ return this._breakdownData;
399
+ }
400
+ format(e) {
401
+ let t = e || this._locale;
402
+ if (!this._breakdownData) return `${Math.abs(this._tg1.diff(this._tg2, "day"))}${C}`;
403
+ let n = [], r = this._breakdownData;
404
+ return r.years !== 0 && n.push(`${r.years} ${s("year", t, r.years)}`), r.months !== 0 && n.push(`${r.months} ${s("month", t, r.months)}`), r.weeks !== 0 && n.push(`${r.weeks} ${s("week", t, r.weeks)}`), r.days !== 0 && n.push(`${r.days} ${s("day", t, r.days)}`), r.hours !== 0 && n.push(`${r.hours} ${s("hour", t, r.hours)}`), r.minutes !== 0 && n.push(`${r.minutes} ${s("minute", t, r.minutes)}`), r.seconds !== 0 && n.push(`${r.seconds} ${s("second", t, r.seconds)}`), n.length === 0 ? u(t) : l(n, t);
405
+ }
406
+ getMode() {
407
+ return this._mode;
408
+ }
409
+ valueOf() {
410
+ return this._value;
411
+ }
412
+ toString() {
413
+ return this._mode === "calendar" && this._breakdownData ? this.format() : this._value.toString();
414
+ }
415
+ toJSON() {
416
+ return this._value;
417
+ }
418
+ }, E = class {
419
+ years;
420
+ months;
421
+ weeks;
422
+ days;
423
+ hours;
424
+ minutes;
425
+ seconds;
426
+ milliseconds;
427
+ _locale;
428
+ _startDate;
429
+ _endDate;
430
+ _steps = [];
431
+ _mode = "exact";
432
+ _leapYearFlags = [];
433
+ _calculationTimeMs = 0;
434
+ constructor(e, t = "en", n) {
435
+ this.years = e.years, this.months = e.months, this.weeks = e.weeks, this.days = e.days, this.hours = e.hours, this.minutes = e.minutes, this.seconds = e.seconds, this.milliseconds = e.milliseconds, this._locale = t, n && (this._startDate = n.startDate, this._endDate = n.endDate, this._steps = n.steps || [], this._mode = n.mode || "exact", this._leapYearFlags = n.leapYearFlags || [], this._calculationTimeMs = n.calculationTimeMs || 0);
436
+ }
437
+ humanize(e) {
438
+ let t = e?.locale || this._locale, n = e?.fullBreakdown ?? !1, r = e?.numeric ?? "always", i = [
439
+ {
440
+ unit: "year",
441
+ value: this.years
442
+ },
443
+ {
444
+ unit: "month",
445
+ value: this.months
446
+ },
447
+ {
448
+ unit: "week",
449
+ value: this.weeks
450
+ },
451
+ {
452
+ unit: "day",
453
+ value: this.days
454
+ },
455
+ {
456
+ unit: "hour",
457
+ value: this.hours
458
+ },
459
+ {
460
+ unit: "minute",
461
+ value: this.minutes
462
+ },
463
+ {
464
+ unit: "second",
465
+ value: this.seconds
466
+ },
467
+ {
468
+ unit: "millisecond",
469
+ value: this.milliseconds
470
+ }
471
+ ].filter((e) => e.value !== 0);
472
+ if (i.length === 0) return "0 seconds";
473
+ if (!n || i.length === 1) {
474
+ let e = i[0];
475
+ try {
476
+ return new Intl.RelativeTimeFormat(t, {
477
+ numeric: r,
478
+ style: "long"
479
+ }).format(e.value, e.unit);
480
+ } catch {
481
+ let n = Math.abs(e.value);
482
+ return `${n} ${this.pluralizeUnit(e.unit, n, t)}`;
483
+ }
484
+ }
485
+ return l(i.map((e) => {
486
+ let n = Math.abs(e.value);
487
+ return `${n} ${s(e.unit, t, n)}`;
488
+ }), t);
489
+ }
490
+ total(e) {
491
+ let t = 0;
492
+ switch (t += this.years * S, t += this.months * x, t += this.weeks * y, t += this.days * v, t += this.hours * _, t += this.minutes * g, t += this.seconds * h, t += this.milliseconds, e) {
493
+ case "millisecond": return t;
494
+ case "second": return t / h;
495
+ case "minute": return t / g;
496
+ case "hour": return t / _;
497
+ case "day": return t / v;
498
+ case "week": return t / y;
499
+ case "month": return t / x;
500
+ case "year": return t / S;
501
+ case "microsecond": return t * 1e3;
502
+ case "nanosecond": return t * 1e6;
503
+ default: throw Error(`Unsupported unit: ${e}`);
504
+ }
505
+ }
506
+ toString() {
507
+ return this.humanize({ fullBreakdown: !0 });
508
+ }
509
+ toJSON() {
510
+ return {
511
+ years: this.years,
512
+ months: this.months,
513
+ weeks: this.weeks,
514
+ days: this.days,
515
+ hours: this.hours,
516
+ minutes: this.minutes,
517
+ seconds: this.seconds,
518
+ milliseconds: this.milliseconds
519
+ };
520
+ }
521
+ explain() {
522
+ let e = [...this._steps];
523
+ e.length === 0 && (e = this.generateExplanationSteps());
524
+ let t = [];
525
+ if (this._startDate && this._endDate && t.push(`Calculated duration from ${this._startDate} to ${this._endDate}`), this._leapYearFlags && this._leapYearFlags.length > 0) {
526
+ let e = this._leapYearFlags.filter((e) => e.isLeap).map((e) => e.year);
527
+ e.length > 0 && t.push(`Leap year(s) detected: ${e.join(", ")}`);
528
+ }
529
+ return t.push(`Breakdown: ${this.years} year(s), ${this.months} month(s), ${this.days} day(s)`), t.push(`Mode: ${this._mode} calculation`), {
530
+ input: this._startDate && this._endDate ? [this._startDate, this._endDate] : [],
531
+ steps: e,
532
+ breakdown: {
533
+ years: this.years,
534
+ months: this.months,
535
+ weeks: this.weeks,
536
+ days: this.days,
537
+ hours: this.hours,
538
+ minutes: this.minutes,
539
+ seconds: this.seconds,
540
+ milliseconds: this.milliseconds
541
+ },
542
+ mode: this._mode,
543
+ explanation: t.join(". "),
544
+ locale: this._locale,
545
+ leapYearFlags: this._leapYearFlags.length > 0 ? this._leapYearFlags : void 0,
546
+ metadata: {
547
+ calculationTimeMs: this._calculationTimeMs,
548
+ precision: "day"
549
+ }
550
+ };
551
+ }
552
+ generateExplanationSteps() {
553
+ let e = [];
554
+ if (this._startDate && this._endDate ? e.push(`Input: ${this._startDate} to ${this._endDate}`) : e.push("Duration calculation started"), this.years > 0 && e.push(`Years: ${this.years}`), this.months > 0 && e.push(`Months: ${this.months}`), this.weeks > 0 && e.push(`Weeks: ${this.weeks}`), this.days > 0 && e.push(`Days: ${this.days}`), this.hours > 0 && e.push(`Hours: ${this.hours}`), this.minutes > 0 && e.push(`Minutes: ${this.minutes}`), this.seconds > 0 && e.push(`Seconds: ${this.seconds}`), this.milliseconds > 0 && e.push(`Milliseconds: ${this.milliseconds}`), this._leapYearFlags && this._leapYearFlags.length > 0) for (let t of this._leapYearFlags) t.isLeap && e.push(`${t.year} is a leap year (February has ${t.daysInFebruary} days)`);
555
+ let t = [
556
+ this.years > 0 ? `${this.years}y` : "",
557
+ this.months > 0 ? `${this.months}m` : "",
558
+ this.days > 0 ? `${this.days}d` : "",
559
+ this.hours > 0 ? `${this.hours}h` : "",
560
+ this.minutes > 0 ? `${this.minutes}min` : "",
561
+ this.seconds > 0 ? `${this.seconds}s` : ""
562
+ ].filter((e) => e.length > 0).join(" ");
563
+ return e.push(`Total: ${t || "0"}`), e;
564
+ }
565
+ pluralizeUnit(e, t, n) {
566
+ return s(e, n, t);
567
+ }
568
+ }, D = class e {
569
+ _start;
570
+ _end;
571
+ _ordered;
572
+ constructor(e, t) {
573
+ this._start = e, this._end = t;
574
+ }
575
+ get start() {
576
+ return this._start;
577
+ }
578
+ get end() {
579
+ return this._end;
580
+ }
581
+ getOrdered() {
582
+ if (!this._ordered) {
583
+ let e = r.toPlainDateTime(this._start.toTemporal()), t = r.toPlainDateTime(this._end.toTemporal());
584
+ this._ordered = r.compare(e, t) <= 0 ? [e, t] : [t, e];
585
+ }
586
+ return this._ordered;
587
+ }
588
+ toDuration() {
589
+ return O.between(this._start, this._end);
590
+ }
591
+ inMonths() {
592
+ return this.toDuration().total("month");
593
+ }
594
+ humanize(e) {
595
+ return this.toDuration().humanize(e);
596
+ }
597
+ in(e) {
598
+ return this.toDuration().total(e);
599
+ }
600
+ contains(e) {
601
+ let t = e instanceof O ? e : new O(e), n = r.toPlainDateTime(t.toTemporal()), [i, a] = this.getOrdered();
602
+ return r.compare(n, i) >= 0 && r.compare(n, a) <= 0;
603
+ }
604
+ overlaps(e) {
605
+ let [t, n] = this.getOrdered(), [i, a] = e.getOrdered();
606
+ return r.compare(t, a) <= 0 && r.compare(i, n) <= 0;
607
+ }
608
+ intersect(t) {
609
+ if (!this.overlaps(t)) return null;
610
+ let [n, i] = this.getOrdered(), [a, o] = t.getOrdered(), s = r.compare(n, a) >= 0 ? n : a, c = r.compare(i, o) <= 0 ? i : o;
611
+ return new e(O.fromTemporal(s, { locale: this._start.locale() }), O.fromTemporal(c, { locale: this._end.locale() }));
612
+ }
613
+ union(t) {
614
+ let [n, i] = this.getOrdered(), [a, o] = t.getOrdered(), s = r.compare(n, a) <= 0 ? n : a, c = r.compare(i, o) >= 0 ? i : o;
615
+ return new e(O.fromTemporal(s, { locale: this._start.locale() }), O.fromTemporal(c, { locale: this._end.locale() }));
616
+ }
617
+ }, O = class e {
618
+ temporal;
619
+ config;
620
+ formatterInstance;
621
+ static holidays = /* @__PURE__ */ new Set();
622
+ static registerHolidays(t) {
623
+ t.forEach((t) => {
624
+ try {
625
+ let n = new e(t);
626
+ this.holidays.add(n.format("YYYY-MM-DD"));
627
+ } catch {}
628
+ });
629
+ }
630
+ static clearHolidays() {
631
+ this.holidays.clear();
632
+ }
633
+ static getRegisteredHolidays() {
634
+ return Array.from(this.holidays).sort();
635
+ }
636
+ static ZERO_DURATION = {
637
+ years: 0,
638
+ months: 0,
639
+ weeks: 0,
640
+ days: 0,
641
+ hours: 0,
642
+ minutes: 0,
643
+ seconds: 0,
644
+ milliseconds: 0
645
+ };
646
+ static isLeapYearValue(e) {
647
+ return e % 4 == 0 && e % 100 != 0 || e % 400 == 0;
648
+ }
649
+ static toDurationParts(e) {
650
+ return {
651
+ years: Math.floor(e.years || 0),
652
+ months: Math.floor(e.months || 0),
653
+ weeks: Math.floor(e.weeks || 0),
654
+ days: Math.floor(e.days || 0),
655
+ hours: Math.floor(e.hours || 0),
656
+ minutes: Math.floor(e.minutes || 0),
657
+ seconds: Math.floor(e.seconds || 0),
658
+ milliseconds: Math.floor(e.milliseconds || 0)
659
+ };
660
+ }
661
+ constructor(t, n) {
662
+ this.formatterInstance = new i(), this.config = {
663
+ locale: n?.locale || "en",
664
+ timezone: n?.timezone || "UTC",
665
+ strict: n?.strict ?? !1
666
+ };
667
+ let a = t instanceof e ? t.toTemporal() : t;
668
+ if (this.temporal = r.parseToPlainDateTime(a), this.config.timezone && this.config.timezone !== "UTC") try {
669
+ let e = this.temporal.toZonedDateTime(this.config.timezone);
670
+ this.temporal = e;
671
+ } catch {}
672
+ }
673
+ static now(t) {
674
+ return new e(void 0, t);
675
+ }
676
+ static from(t, n) {
677
+ return new e(t, n);
678
+ }
679
+ static fromTemporal(t, n) {
680
+ let r = new e(void 0, n);
681
+ return r.temporal = t, r;
682
+ }
683
+ static between(e, t) {
684
+ let n = r.toPlainDateTime(e.temporal), i = r.toPlainDateTime(t.temporal), [a, o] = r.compare(n, i) <= 0 ? [e, t] : [t, e];
685
+ return a.until(o);
686
+ }
687
+ static range(t, n) {
688
+ return new D(t instanceof e ? t : new e(t), n instanceof e ? n : new e(n));
689
+ }
690
+ toTemporal() {
691
+ return this.temporal;
692
+ }
693
+ toDate() {
694
+ return r.toDate(this.temporal);
695
+ }
696
+ toISOString() {
697
+ return r.toISOString(this.temporal);
698
+ }
699
+ valueOf() {
700
+ return r.toUnix(this.temporal);
701
+ }
702
+ unix() {
703
+ return Math.floor(this.valueOf() / 1e3);
704
+ }
705
+ toJSON() {
706
+ return this.toISOString();
707
+ }
708
+ [Symbol.toPrimitive](e) {
709
+ return e === "number" ? this.valueOf() : this.toISOString();
710
+ }
711
+ toString() {
712
+ return this.format("YYYY-MM-DD HH:mm:ss");
713
+ }
714
+ locale(e) {
715
+ if (e === void 0) return this.config.locale;
716
+ let t = this.clone();
717
+ return t.config.locale = e, t;
718
+ }
719
+ timezone(e) {
720
+ if (e === void 0) return this.config.timezone;
721
+ let t = this.clone();
722
+ t.config.timezone = e;
723
+ try {
724
+ t.temporal = r.toPlainDateTime(t.temporal).toZonedDateTime(e);
725
+ } catch {}
726
+ return t;
727
+ }
728
+ format(e) {
729
+ let t = r.toPlainDateTime(this.temporal), n = [
730
+ "iso",
731
+ "date",
732
+ "time",
733
+ "datetime",
734
+ "rfc2822",
735
+ "rfc3339",
736
+ "utc"
737
+ ].includes(e) ? this.formatterInstance.getPreset(e) : e;
738
+ return this.formatterInstance.format(t, n, this.config.locale);
739
+ }
740
+ get(e) {
741
+ let t = r.toPlainDateTime(this.temporal);
742
+ return e === "week" ? t.weekOfYear : t[{
743
+ year: "year",
744
+ month: "month",
745
+ day: "day",
746
+ hour: "hour",
747
+ minute: "minute",
748
+ second: "second",
749
+ millisecond: "millisecond",
750
+ microsecond: "microsecond",
751
+ nanosecond: "nanosecond"
752
+ }[e]];
753
+ }
754
+ static UNIT_TO_PLURAL = {
755
+ year: "years",
756
+ month: "months",
757
+ week: "weeks",
758
+ day: "days",
759
+ hour: "hours",
760
+ minute: "minutes",
761
+ second: "seconds",
762
+ millisecond: "milliseconds",
763
+ microsecond: "microseconds",
764
+ nanosecond: "nanoseconds",
765
+ years: "years",
766
+ months: "months",
767
+ weeks: "weeks",
768
+ days: "days",
769
+ hours: "hours",
770
+ minutes: "minutes",
771
+ seconds: "seconds",
772
+ milliseconds: "milliseconds",
773
+ microseconds: "microseconds",
774
+ nanoseconds: "nanoseconds"
775
+ };
776
+ add(t) {
777
+ let n = r.toPlainDateTime(this.temporal), i = {
778
+ years: 0,
779
+ months: 0,
780
+ weeks: 0,
781
+ days: 0,
782
+ hours: 0,
783
+ minutes: 0,
784
+ seconds: 0,
785
+ milliseconds: 0,
786
+ microseconds: 0,
787
+ nanoseconds: 0
788
+ }, a = !1;
789
+ return Object.entries(t).forEach(([t, n]) => {
790
+ if (n !== void 0 && n !== 0) {
791
+ let r = Number(n);
792
+ if (Number.isFinite(r)) {
793
+ let n = e.UNIT_TO_PLURAL[t] || t;
794
+ i[n] = Math.trunc(r), a = !0;
795
+ }
796
+ }
797
+ }), a ? (n = n.add(i), e.fromTemporal(n, this.config)) : this;
798
+ }
799
+ subtract(e) {
800
+ let t = {};
801
+ return Object.entries(e).forEach(([e, n]) => {
802
+ t[e] = n ? -n : 0;
803
+ }), this.add(t);
804
+ }
805
+ diff(e, t) {
806
+ let n = r.toPlainDateTime(this.temporal), i = r.toPlainDateTime(e.temporal), a = {
807
+ year: "years",
808
+ month: "months",
809
+ week: "weeks",
810
+ day: "days",
811
+ hour: "hours",
812
+ minute: "minutes",
813
+ second: "seconds",
814
+ millisecond: "milliseconds",
815
+ microsecond: "microseconds",
816
+ nanosecond: "nanoseconds"
817
+ };
818
+ if (typeof t == "string") {
819
+ let e = t, r = a[e], o = n.since(i, {
820
+ largestUnit: e,
821
+ smallestUnit: e
822
+ });
823
+ return Math.round(o[r] || 0);
824
+ }
825
+ let o = t || {}, s = o.mode || "exact", c = o.unit || "millisecond", l = o.locale || this.config.locale;
826
+ if (s === "exact") {
827
+ let r = a[c], o = n.since(i, { smallestUnit: c }), u = Math.round(o[r] || 0);
828
+ if (t === void 0 || typeof t == "object") {
829
+ let t = w(o);
830
+ return new T(Math.round(t), this, e, s, void 0, l);
831
+ }
832
+ return u;
833
+ }
834
+ if (s === "calendar") {
835
+ let t = r.compare(n, i) < 0, a = t ? i : n, o = t ? n : i, c = a.since(o, {
836
+ largestUnit: "month",
837
+ smallestUnit: "millisecond"
838
+ }), u = {
839
+ years: Math.floor(c.years || 0),
840
+ months: Math.floor(c.months || 0),
841
+ weeks: Math.floor(c.weeks || 0),
842
+ days: Math.floor(c.days || 0),
843
+ hours: Math.floor(c.hours || 0),
844
+ minutes: Math.floor(c.minutes || 0),
845
+ seconds: Math.floor(c.seconds || 0),
846
+ milliseconds: Math.floor(c.milliseconds || 0)
847
+ }, d = w(c);
848
+ return new T(Math.round(d), this, e, s, u, l);
849
+ }
850
+ let u = w(n.since(i, { smallestUnit: "millisecond" }));
851
+ return new T(Math.round(u), this, e, s, void 0, l);
852
+ }
853
+ isBefore(e) {
854
+ let t = r.toPlainDateTime(this.temporal), n = r.toPlainDateTime(e.temporal);
855
+ return r.compare(t, n) < 0;
856
+ }
857
+ isAfter(e) {
858
+ let t = r.toPlainDateTime(this.temporal), n = r.toPlainDateTime(e.temporal);
859
+ return r.compare(t, n) > 0;
860
+ }
861
+ isSame(e, t) {
862
+ if (!t) return r.compare(r.toPlainDateTime(this.temporal), r.toPlainDateTime(e.temporal)) === 0;
863
+ let n = r.toPlainDateTime(this.temporal), i = r.toPlainDateTime(e.temporal);
864
+ switch (t) {
865
+ case "year": return n.year === i.year;
866
+ case "month": return n.year === i.year && n.month === i.month;
867
+ case "day": return n.year === i.year && n.month === i.month && n.day === i.day;
868
+ case "hour": return n.year === i.year && n.month === i.month && n.day === i.day && n.hour === i.hour;
869
+ case "minute": return n.year === i.year && n.month === i.month && n.day === i.day && n.hour === i.hour && n.minute === i.minute;
870
+ case "second": return n.year === i.year && n.month === i.month && n.day === i.day && n.hour === i.hour && n.minute === i.minute && n.second === i.second;
871
+ default: return !1;
872
+ }
873
+ }
874
+ isBetween(e, t, n, i = "[]") {
875
+ let a = r.toPlainDateTime(this.temporal), o = r.toPlainDateTime(e.temporal), s = r.toPlainDateTime(t.temporal), c = !0, l = !0;
876
+ if (n) {
877
+ let e = this.clone().startOf(n), t = this.clone().endOf(n), i = r.toPlainDateTime(e.temporal), a = r.toPlainDateTime(t.temporal);
878
+ c = r.compare(i, o) >= 0, l = r.compare(a, s) <= 0;
879
+ } else c = r.compare(a, o) >= 0, l = r.compare(a, s) <= 0;
880
+ let u = i[0] === "[", d = i[1] === "]";
881
+ return (u ? c : r.compare(a, o) > 0) && (d ? l : r.compare(a, s) < 0);
882
+ }
883
+ clone() {
884
+ return e.fromTemporal(this.temporal, this.config);
885
+ }
886
+ startOf(t) {
887
+ let n = r.toPlainDateTime(this.temporal), i = {};
888
+ switch (t) {
889
+ case "year":
890
+ i.month = 1, i.day = 1, i.hour = 0, i.minute = 0, i.second = 0, i.millisecond = 0;
891
+ break;
892
+ case "month":
893
+ i.day = 1, i.hour = 0, i.minute = 0, i.second = 0, i.millisecond = 0;
894
+ break;
895
+ case "week":
896
+ case "day":
897
+ i.hour = 0, i.minute = 0, i.second = 0, i.millisecond = 0;
898
+ break;
899
+ case "hour":
900
+ i.minute = 0, i.second = 0, i.millisecond = 0;
901
+ break;
902
+ case "minute":
903
+ i.second = 0, i.millisecond = 0;
904
+ break;
905
+ case "second":
906
+ i.millisecond = 0;
907
+ break;
908
+ }
909
+ let a = n.with(i);
910
+ return e.fromTemporal(a, this.config);
911
+ }
912
+ endOf(e) {
913
+ return this.startOf(e).add({ [e]: 1 }).subtract({ millisecond: 1 });
914
+ }
915
+ set(t) {
916
+ let n = r.toPlainDateTime(this.temporal).with(t);
917
+ return e.fromTemporal(n, this.config);
918
+ }
919
+ year() {
920
+ return r.toPlainDateTime(this.temporal).year;
921
+ }
922
+ month() {
923
+ return r.toPlainDateTime(this.temporal).month;
924
+ }
925
+ day() {
926
+ return r.toPlainDateTime(this.temporal).day;
927
+ }
928
+ hour() {
929
+ return r.toPlainDateTime(this.temporal).hour;
930
+ }
931
+ minute() {
932
+ return r.toPlainDateTime(this.temporal).minute;
933
+ }
934
+ second() {
935
+ return r.toPlainDateTime(this.temporal).second;
936
+ }
937
+ millisecond() {
938
+ return r.toPlainDateTime(this.temporal).millisecond;
939
+ }
940
+ dayOfWeek() {
941
+ return r.toPlainDateTime(this.temporal).dayOfWeek;
942
+ }
943
+ dayOfYear() {
944
+ return r.toPlainDateTime(this.temporal).dayOfYear;
945
+ }
946
+ weekOfYear() {
947
+ return r.toPlainDateTime(this.temporal).weekOfYear;
948
+ }
949
+ daysInMonth() {
950
+ return r.toPlainDateTime(this.temporal).add({ months: 1 }).with({ day: 1 }).subtract({ days: 1 }).day;
951
+ }
952
+ daysInYear() {
953
+ let t = this.year();
954
+ return e.isLeapYearValue(t) ? 366 : 365;
955
+ }
956
+ inLeapYear() {
957
+ let t = r.toPlainDateTime(this.temporal);
958
+ return e.isLeapYearValue(t.year);
959
+ }
960
+ until(t, n) {
961
+ let i = r.toPlainDateTime(this.temporal), a = r.toPlainDateTime(t.temporal), o = performance.now();
962
+ try {
963
+ let t = { largestUnit: n?.largestUnit || "year" };
964
+ n?.smallestUnit && (t.smallestUnit = n.smallestUnit);
965
+ let r = a.since(i, t), s = e.toDurationParts(r), c = i.year, l = a.year, u = [];
966
+ for (let t = c; t <= l; t++) {
967
+ let n = e.isLeapYearValue(t);
968
+ u.push({
969
+ year: t,
970
+ isLeap: n,
971
+ daysInFebruary: n ? 29 : 28
972
+ });
973
+ }
974
+ let d = this.generateUntilSteps(i, a, s, u), f = performance.now() - o;
975
+ return new E(s, this.config.locale, {
976
+ startDate: i.toString(),
977
+ endDate: a.toString(),
978
+ steps: d,
979
+ mode: "exact",
980
+ leapYearFlags: u.filter((e) => e.isLeap),
981
+ calculationTimeMs: f
982
+ });
983
+ } catch {
984
+ return new E(e.ZERO_DURATION, this.config.locale, {
985
+ startDate: i.toString(),
986
+ endDate: a.toString(),
987
+ steps: ["Calculation failed, returning zero duration"],
988
+ mode: "estimated"
989
+ });
990
+ }
991
+ }
992
+ generateUntilSteps(t, n, r, i) {
993
+ let a = [];
994
+ a.push(`Parsed dates: ${t.year}-${String(t.month).padStart(2, "0")}-${String(t.day).padStart(2, "0")} (day ${t.dayOfYear} of ${e.isLeapYearValue(t.year) ? 366 : 365})`), a.push(`to ${n.year}-${String(n.month).padStart(2, "0")}-${String(n.day).padStart(2, "0")} (day ${n.dayOfYear} of ${e.isLeapYearValue(n.year) ? 366 : 365})`);
995
+ let o = i.filter((e) => e.isLeap);
996
+ if (o.length > 0) for (let e of o) a.push(`${e.year} is a leap year (February has ${e.daysInFebruary} days)`);
997
+ if (r.years > 0 && a.push(`Years: ${r.years}`), r.months > 0 && a.push(`Months: ${r.months}`), r.days > 0 && a.push(`Days: ${r.days}`), r.hours > 0 || r.minutes > 0 || r.seconds > 0) {
998
+ let e = [];
999
+ r.hours > 0 && e.push(`${r.hours}h`), r.minutes > 0 && e.push(`${r.minutes}m`), r.seconds > 0 && e.push(`${r.seconds}s`), a.push(`Time: ${e.join(" ")}`);
1000
+ }
1001
+ let s = r.years * 365.25 + r.months * 30.4375 + r.days + r.hours / 24;
1002
+ return a.push(`Total: approximately ${s.toFixed(2)} days`), a;
1003
+ }
1004
+ round(e = {}) {
1005
+ let { smallestUnit: t = "millisecond", roundingMode: n = "halfExpand" } = e, i = r.toPlainDateTime(this.temporal), a = {
1006
+ year: i.year,
1007
+ month: i.month,
1008
+ day: i.day,
1009
+ hour: i.hour,
1010
+ minute: i.minute,
1011
+ second: i.second,
1012
+ millisecond: i.millisecond,
1013
+ microsecond: i.microsecond || 0,
1014
+ nanosecond: i.nanosecond || 0,
1015
+ week: 0
1016
+ }, o = [
1017
+ "year",
1018
+ "month",
1019
+ "day",
1020
+ "hour",
1021
+ "minute",
1022
+ "second",
1023
+ "millisecond",
1024
+ "microsecond",
1025
+ "nanosecond"
1026
+ ], s = o.indexOf(t);
1027
+ if (s === -1) return this.clone();
1028
+ let c = {};
1029
+ for (let e = 0; e < s; e++) {
1030
+ let t = o[e];
1031
+ c[t] = a[t];
1032
+ }
1033
+ let l = o[s], u = a[l];
1034
+ s + 1 < o.length && ((e, t) => {
1035
+ switch (e) {
1036
+ case "ceil": return t > 0;
1037
+ case "floor":
1038
+ case "trunc": return !1;
1039
+ case "halfExpand":
1040
+ case "halfFloor":
1041
+ case "halfCeil": return t >= 5;
1042
+ case "expand": return t > 0;
1043
+ default: return t >= 5;
1044
+ }
1045
+ })(n, a[o[s + 1]]) && (u += 1), c[l] = u;
1046
+ for (let e = s + 1; e < o.length; e++) c[o[e]] = 0;
1047
+ return this.set(c);
1048
+ }
1049
+ toPlainDate() {
1050
+ let e = r.toPlainDateTime(this.temporal);
1051
+ return {
1052
+ year: e.year,
1053
+ month: e.month,
1054
+ day: e.day,
1055
+ dayOfWeek: e.dayOfWeek
1056
+ };
1057
+ }
1058
+ toPlainTime() {
1059
+ let e = r.toPlainDateTime(this.temporal);
1060
+ return {
1061
+ hour: e.hour,
1062
+ minute: e.minute,
1063
+ second: e.second,
1064
+ millisecond: e.millisecond
1065
+ };
1066
+ }
1067
+ withDate(e, t, n) {
1068
+ return this.set({
1069
+ year: e,
1070
+ month: t,
1071
+ day: n
1072
+ });
1073
+ }
1074
+ withTime(e, t = 0, n = 0, r = 0) {
1075
+ return this.set({
1076
+ hour: e,
1077
+ minute: t,
1078
+ second: n,
1079
+ millisecond: r
1080
+ });
1081
+ }
1082
+ getOffset() {
1083
+ return this.temporal?.offset || "Z";
1084
+ }
1085
+ getOffsetNanoseconds() {
1086
+ return this.temporal?.offsetNanoseconds || 0;
1087
+ }
1088
+ getTimeZoneId() {
1089
+ return this.temporal?.timeZoneId || null;
1090
+ }
1091
+ startOfDay() {
1092
+ return this.startOf("day");
1093
+ }
1094
+ endOfDay() {
1095
+ return this.endOf("day");
1096
+ }
1097
+ since(t, n) {
1098
+ let i = r.toPlainDateTime(this.temporal), a = r.toPlainDateTime(t.temporal), o = performance.now();
1099
+ try {
1100
+ let t = { largestUnit: n?.largestUnit || "year" };
1101
+ n?.smallestUnit && (t.smallestUnit = n.smallestUnit);
1102
+ let r = i.since(a, t), s = e.toDurationParts(r), c = a.year, l = i.year, u = [];
1103
+ for (let t = c; t <= l; t++) {
1104
+ let n = e.isLeapYearValue(t);
1105
+ u.push({
1106
+ year: t,
1107
+ isLeap: n,
1108
+ daysInFebruary: n ? 29 : 28
1109
+ });
1110
+ }
1111
+ let d = this.generateUntilSteps(a, i, s, u), f = performance.now() - o;
1112
+ return new E(s, this.config.locale, {
1113
+ startDate: a.toString(),
1114
+ endDate: i.toString(),
1115
+ steps: d,
1116
+ mode: "exact",
1117
+ leapYearFlags: u.filter((e) => e.isLeap),
1118
+ calculationTimeMs: f
1119
+ });
1120
+ } catch {
1121
+ return new E(e.ZERO_DURATION, this.config.locale, {
1122
+ startDate: a.toString(),
1123
+ endDate: i.toString(),
1124
+ steps: ["Calculation failed, returning zero duration"],
1125
+ mode: "estimated"
1126
+ });
1127
+ }
1128
+ }
1129
+ toDurationString(t) {
1130
+ let n = t ? this.until(t) : this.until(e.now()), r = [];
1131
+ n.years && r.push(`${n.years}Y`), n.months && r.push(`${n.months}M`), n.days && r.push(`${n.days}D`);
1132
+ let i = [];
1133
+ n.hours && i.push(`${n.hours}H`), n.minutes && i.push(`${n.minutes}M`), n.seconds && i.push(`${n.seconds}S`);
1134
+ let a = `P${r.join("")}${i.length > 0 ? "T" + i.join("") : ""}`;
1135
+ return a === "P" ? "PT0S" : a;
1136
+ }
1137
+ isPast() {
1138
+ return this.isBefore(e.now());
1139
+ }
1140
+ isFuture() {
1141
+ return this.isAfter(e.now());
1142
+ }
1143
+ isToday() {
1144
+ return this.isSame(e.now(), "day");
1145
+ }
1146
+ isTomorrow() {
1147
+ return this.isSame(e.now().add({ day: 1 }), "day");
1148
+ }
1149
+ isYesterday() {
1150
+ return this.isSame(e.now().subtract({ day: 1 }), "day");
1151
+ }
1152
+ isWeekend() {
1153
+ let e = r.toPlainDateTime(this.temporal);
1154
+ return e.dayOfWeek === 6 || e.dayOfWeek === 7;
1155
+ }
1156
+ isHoliday() {
1157
+ let t = String(this.get("year")).padStart(4, "0"), n = String(this.get("month")).padStart(2, "0"), r = String(this.get("day")).padStart(2, "0");
1158
+ return e.holidays.has(`${t}-${n}-${r}`);
1159
+ }
1160
+ isBusinessDay() {
1161
+ return !this.isWeekend() && !this.isHoliday();
1162
+ }
1163
+ addBusinessDays(e) {
1164
+ let t = Math.trunc(e);
1165
+ if (!Number.isFinite(t) || t === 0) return this;
1166
+ let n = this.clone(), r = Math.abs(t), i = t > 0 ? 1 : -1;
1167
+ for (; r > 0;) n = n.add({ day: i }), n.isBusinessDay() && r--;
1168
+ return n;
1169
+ }
1170
+ subtractBusinessDays(e) {
1171
+ return this.addBusinessDays(-e);
1172
+ }
1173
+ }, k = 1e3, A = 6e4;
1174
+ function j(e, t) {
1175
+ let n = O.from(e), r = O.now();
1176
+ return n.since(r).humanize(t);
1177
+ }
1178
+ function M(e, t, n) {
1179
+ return new D(O.from(e, n), O.from(t, n));
1180
+ }
1181
+ function N(e, t) {
1182
+ return new O(e, t);
1183
+ }
1184
+ var P = "2.8.0";
1185
+ //#endregion
1186
+ export { D as a, N as c, f as d, d as f, r as h, O as i, P as l, i as m, k as n, j as o, p, E as r, M as s, A as t, m as u };