@samline/date 2.1.0 → 2.1.2

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.
@@ -0,0 +1,846 @@
1
+ "use strict";
2
+ (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+
29
+ // node_modules/dayjs/dayjs.min.js
30
+ var require_dayjs_min = __commonJS({
31
+ "node_modules/dayjs/dayjs.min.js"(exports, module) {
32
+ "use strict";
33
+ !(function(t, e) {
34
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
35
+ })(exports, (function() {
36
+ "use strict";
37
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|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}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
38
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
39
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
40
+ } }, m = function(t2, e2, n2) {
41
+ var r2 = String(t2);
42
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
43
+ }, v = { s: m, z: function(t2) {
44
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
45
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
46
+ }, m: function t2(e2, n2) {
47
+ if (e2.date() < n2.date()) return -t2(n2, e2);
48
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
49
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
50
+ }, a: function(t2) {
51
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
52
+ }, p: function(t2) {
53
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
54
+ }, u: function(t2) {
55
+ return void 0 === t2;
56
+ } }, g = "en", D = {};
57
+ D[g] = M;
58
+ var p = "$isDayjsObject", S = function(t2) {
59
+ return t2 instanceof _ || !(!t2 || !t2[p]);
60
+ }, w = function t2(e2, n2, r2) {
61
+ var i2;
62
+ if (!e2) return g;
63
+ if ("string" == typeof e2) {
64
+ var s2 = e2.toLowerCase();
65
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
66
+ var u2 = e2.split("-");
67
+ if (!i2 && u2.length > 1) return t2(u2[0]);
68
+ } else {
69
+ var a2 = e2.name;
70
+ D[a2] = e2, i2 = a2;
71
+ }
72
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
73
+ }, O = function(t2, e2) {
74
+ if (S(t2)) return t2.clone();
75
+ var n2 = "object" == typeof e2 ? e2 : {};
76
+ return n2.date = t2, n2.args = arguments, new _(n2);
77
+ }, b = v;
78
+ b.l = w, b.i = S, b.w = function(t2, e2) {
79
+ return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
80
+ };
81
+ var _ = (function() {
82
+ function M2(t2) {
83
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
84
+ }
85
+ var m2 = M2.prototype;
86
+ return m2.parse = function(t2) {
87
+ this.$d = (function(t3) {
88
+ var e2 = t3.date, n2 = t3.utc;
89
+ if (null === e2) return /* @__PURE__ */ new Date(NaN);
90
+ if (b.u(e2)) return /* @__PURE__ */ new Date();
91
+ if (e2 instanceof Date) return new Date(e2);
92
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
93
+ var r2 = e2.match($);
94
+ if (r2) {
95
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
96
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
97
+ }
98
+ }
99
+ return new Date(e2);
100
+ })(t2), this.init();
101
+ }, m2.init = function() {
102
+ var t2 = this.$d;
103
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
104
+ }, m2.$utils = function() {
105
+ return b;
106
+ }, m2.isValid = function() {
107
+ return !(this.$d.toString() === l);
108
+ }, m2.isSame = function(t2, e2) {
109
+ var n2 = O(t2);
110
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
111
+ }, m2.isAfter = function(t2, e2) {
112
+ return O(t2) < this.startOf(e2);
113
+ }, m2.isBefore = function(t2, e2) {
114
+ return this.endOf(e2) < O(t2);
115
+ }, m2.$g = function(t2, e2, n2) {
116
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
117
+ }, m2.unix = function() {
118
+ return Math.floor(this.valueOf() / 1e3);
119
+ }, m2.valueOf = function() {
120
+ return this.$d.getTime();
121
+ }, m2.startOf = function(t2, e2) {
122
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
123
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
124
+ return r2 ? i2 : i2.endOf(a);
125
+ }, $2 = function(t3, e3) {
126
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
127
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
128
+ switch (f2) {
129
+ case h:
130
+ return r2 ? l2(1, 0) : l2(31, 11);
131
+ case c:
132
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
133
+ case o:
134
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
135
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
136
+ case a:
137
+ case d:
138
+ return $2(v2 + "Hours", 0);
139
+ case u:
140
+ return $2(v2 + "Minutes", 1);
141
+ case s:
142
+ return $2(v2 + "Seconds", 2);
143
+ case i:
144
+ return $2(v2 + "Milliseconds", 3);
145
+ default:
146
+ return this.clone();
147
+ }
148
+ }, m2.endOf = function(t2) {
149
+ return this.startOf(t2, false);
150
+ }, m2.$set = function(t2, e2) {
151
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
152
+ if (o2 === c || o2 === h) {
153
+ var y2 = this.clone().set(d, 1);
154
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
155
+ } else l2 && this.$d[l2]($2);
156
+ return this.init(), this;
157
+ }, m2.set = function(t2, e2) {
158
+ return this.clone().$set(t2, e2);
159
+ }, m2.get = function(t2) {
160
+ return this[b.p(t2)]();
161
+ }, m2.add = function(r2, f2) {
162
+ var d2, l2 = this;
163
+ r2 = Number(r2);
164
+ var $2 = b.p(f2), y2 = function(t2) {
165
+ var e2 = O(l2);
166
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
167
+ };
168
+ if ($2 === c) return this.set(c, this.$M + r2);
169
+ if ($2 === h) return this.set(h, this.$y + r2);
170
+ if ($2 === a) return y2(1);
171
+ if ($2 === o) return y2(7);
172
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
173
+ return b.w(m3, this);
174
+ }, m2.subtract = function(t2, e2) {
175
+ return this.add(-1 * t2, e2);
176
+ }, m2.format = function(t2) {
177
+ var e2 = this, n2 = this.$locale();
178
+ if (!this.isValid()) return n2.invalidDate || l;
179
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
180
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
181
+ }, d2 = function(t3) {
182
+ return b.s(s2 % 12 || 12, t3, "0");
183
+ }, $2 = f2 || function(t3, e3, n3) {
184
+ var r3 = t3 < 12 ? "AM" : "PM";
185
+ return n3 ? r3.toLowerCase() : r3;
186
+ };
187
+ return r2.replace(y, (function(t3, r3) {
188
+ return r3 || (function(t4) {
189
+ switch (t4) {
190
+ case "YY":
191
+ return String(e2.$y).slice(-2);
192
+ case "YYYY":
193
+ return b.s(e2.$y, 4, "0");
194
+ case "M":
195
+ return a2 + 1;
196
+ case "MM":
197
+ return b.s(a2 + 1, 2, "0");
198
+ case "MMM":
199
+ return h2(n2.monthsShort, a2, c2, 3);
200
+ case "MMMM":
201
+ return h2(c2, a2);
202
+ case "D":
203
+ return e2.$D;
204
+ case "DD":
205
+ return b.s(e2.$D, 2, "0");
206
+ case "d":
207
+ return String(e2.$W);
208
+ case "dd":
209
+ return h2(n2.weekdaysMin, e2.$W, o2, 2);
210
+ case "ddd":
211
+ return h2(n2.weekdaysShort, e2.$W, o2, 3);
212
+ case "dddd":
213
+ return o2[e2.$W];
214
+ case "H":
215
+ return String(s2);
216
+ case "HH":
217
+ return b.s(s2, 2, "0");
218
+ case "h":
219
+ return d2(1);
220
+ case "hh":
221
+ return d2(2);
222
+ case "a":
223
+ return $2(s2, u2, true);
224
+ case "A":
225
+ return $2(s2, u2, false);
226
+ case "m":
227
+ return String(u2);
228
+ case "mm":
229
+ return b.s(u2, 2, "0");
230
+ case "s":
231
+ return String(e2.$s);
232
+ case "ss":
233
+ return b.s(e2.$s, 2, "0");
234
+ case "SSS":
235
+ return b.s(e2.$ms, 3, "0");
236
+ case "Z":
237
+ return i2;
238
+ }
239
+ return null;
240
+ })(t3) || i2.replace(":", "");
241
+ }));
242
+ }, m2.utcOffset = function() {
243
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
244
+ }, m2.diff = function(r2, d2, l2) {
245
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
246
+ return b.m(y2, m3);
247
+ };
248
+ switch (M3) {
249
+ case h:
250
+ $2 = D2() / 12;
251
+ break;
252
+ case c:
253
+ $2 = D2();
254
+ break;
255
+ case f:
256
+ $2 = D2() / 3;
257
+ break;
258
+ case o:
259
+ $2 = (g2 - v2) / 6048e5;
260
+ break;
261
+ case a:
262
+ $2 = (g2 - v2) / 864e5;
263
+ break;
264
+ case u:
265
+ $2 = g2 / n;
266
+ break;
267
+ case s:
268
+ $2 = g2 / e;
269
+ break;
270
+ case i:
271
+ $2 = g2 / t;
272
+ break;
273
+ default:
274
+ $2 = g2;
275
+ }
276
+ return l2 ? $2 : b.a($2);
277
+ }, m2.daysInMonth = function() {
278
+ return this.endOf(c).$D;
279
+ }, m2.$locale = function() {
280
+ return D[this.$L];
281
+ }, m2.locale = function(t2, e2) {
282
+ if (!t2) return this.$L;
283
+ var n2 = this.clone(), r2 = w(t2, e2, true);
284
+ return r2 && (n2.$L = r2), n2;
285
+ }, m2.clone = function() {
286
+ return b.w(this.$d, this);
287
+ }, m2.toDate = function() {
288
+ return new Date(this.valueOf());
289
+ }, m2.toJSON = function() {
290
+ return this.isValid() ? this.toISOString() : null;
291
+ }, m2.toISOString = function() {
292
+ return this.$d.toISOString();
293
+ }, m2.toString = function() {
294
+ return this.$d.toUTCString();
295
+ }, M2;
296
+ })(), k = _.prototype;
297
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t2) {
298
+ k[t2[1]] = function(e2) {
299
+ return this.$g(e2, t2[0], t2[1]);
300
+ };
301
+ })), O.extend = function(t2, e2) {
302
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
303
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
304
+ return O(1e3 * t2);
305
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
306
+ }));
307
+ }
308
+ });
309
+
310
+ // node_modules/dayjs/locale/de.js
311
+ var require_de = __commonJS({
312
+ "node_modules/dayjs/locale/de.js"(exports, module) {
313
+ "use strict";
314
+ !(function(e, n) {
315
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = n(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], n) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_de = n(e.dayjs);
316
+ })(exports, (function(e) {
317
+ "use strict";
318
+ function n(e2) {
319
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
320
+ }
321
+ var t = n(e), a = { s: "ein paar Sekunden", m: ["eine Minute", "einer Minute"], mm: "%d Minuten", h: ["eine Stunde", "einer Stunde"], hh: "%d Stunden", d: ["ein Tag", "einem Tag"], dd: ["%d Tage", "%d Tagen"], M: ["ein Monat", "einem Monat"], MM: ["%d Monate", "%d Monaten"], y: ["ein Jahr", "einem Jahr"], yy: ["%d Jahre", "%d Jahren"] };
322
+ function i(e2, n2, t2) {
323
+ var i2 = a[t2];
324
+ return Array.isArray(i2) && (i2 = i2[n2 ? 0 : 1]), i2.replace("%d", e2);
325
+ }
326
+ var r = { name: "de", weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"), weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"), weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"), months: "Januar_Februar_M\xE4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"), monthsShort: "Jan._Feb._M\xE4rz_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"), ordinal: function(e2) {
327
+ return e2 + ".";
328
+ }, weekStart: 1, yearStart: 4, formats: { LTS: "HH:mm:ss", LT: "HH:mm", L: "DD.MM.YYYY", LL: "D. MMMM YYYY", LLL: "D. MMMM YYYY HH:mm", LLLL: "dddd, D. MMMM YYYY HH:mm" }, relativeTime: { future: "in %s", past: "vor %s", s: i, m: i, mm: i, h: i, hh: i, d: i, dd: i, M: i, MM: i, y: i, yy: i } };
329
+ return t.default.locale(r, null, true), r;
330
+ }));
331
+ }
332
+ });
333
+
334
+ // node_modules/dayjs/locale/es-mx.js
335
+ var require_es_mx = __commonJS({
336
+ "node_modules/dayjs/locale/es-mx.js"(exports, module) {
337
+ "use strict";
338
+ !(function(e, o) {
339
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = o(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], o) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_es_mx = o(e.dayjs);
340
+ })(exports, (function(e) {
341
+ "use strict";
342
+ function o(e2) {
343
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
344
+ }
345
+ var s = o(e), d = { name: "es-mx", weekdays: "domingo_lunes_martes_mi\xE9rcoles_jueves_viernes_s\xE1bado".split("_"), weekdaysShort: "dom._lun._mar._mi\xE9._jue._vie._s\xE1b.".split("_"), weekdaysMin: "do_lu_ma_mi_ju_vi_s\xE1".split("_"), months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"), monthsShort: "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"), relativeTime: { future: "en %s", past: "hace %s", s: "unos segundos", m: "un minuto", mm: "%d minutos", h: "una hora", hh: "%d horas", d: "un d\xEDa", dd: "%d d\xEDas", M: "un mes", MM: "%d meses", y: "un a\xF1o", yy: "%d a\xF1os" }, ordinal: function(e2) {
346
+ return e2 + "\xBA";
347
+ }, formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD/MM/YYYY", LL: "D [de] MMMM [de] YYYY", LLL: "D [de] MMMM [de] YYYY H:mm", LLLL: "dddd, D [de] MMMM [de] YYYY H:mm" } };
348
+ return s.default.locale(d, null, true), d;
349
+ }));
350
+ }
351
+ });
352
+
353
+ // node_modules/dayjs/locale/es.js
354
+ var require_es = __commonJS({
355
+ "node_modules/dayjs/locale/es.js"(exports, module) {
356
+ "use strict";
357
+ !(function(e, o) {
358
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = o(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], o) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_es = o(e.dayjs);
359
+ })(exports, (function(e) {
360
+ "use strict";
361
+ function o(e2) {
362
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
363
+ }
364
+ var s = o(e), d = { name: "es", monthsShort: "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"), weekdays: "domingo_lunes_martes_mi\xE9rcoles_jueves_viernes_s\xE1bado".split("_"), weekdaysShort: "dom._lun._mar._mi\xE9._jue._vie._s\xE1b.".split("_"), weekdaysMin: "do_lu_ma_mi_ju_vi_s\xE1".split("_"), months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"), weekStart: 1, formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD/MM/YYYY", LL: "D [de] MMMM [de] YYYY", LLL: "D [de] MMMM [de] YYYY H:mm", LLLL: "dddd, D [de] MMMM [de] YYYY H:mm" }, relativeTime: { future: "en %s", past: "hace %s", s: "unos segundos", m: "un minuto", mm: "%d minutos", h: "una hora", hh: "%d horas", d: "un d\xEDa", dd: "%d d\xEDas", M: "un mes", MM: "%d meses", y: "un a\xF1o", yy: "%d a\xF1os" }, ordinal: function(e2) {
365
+ return e2 + "\xBA";
366
+ } };
367
+ return s.default.locale(d, null, true), d;
368
+ }));
369
+ }
370
+ });
371
+
372
+ // node_modules/dayjs/locale/fr.js
373
+ var require_fr = __commonJS({
374
+ "node_modules/dayjs/locale/fr.js"(exports, module) {
375
+ "use strict";
376
+ !(function(e, n) {
377
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = n(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], n) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_fr = n(e.dayjs);
378
+ })(exports, (function(e) {
379
+ "use strict";
380
+ function n(e2) {
381
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
382
+ }
383
+ var t = n(e), i = { name: "fr", weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"), weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"), weekdaysMin: "di_lu_ma_me_je_ve_sa".split("_"), months: "janvier_f\xE9vrier_mars_avril_mai_juin_juillet_ao\xFBt_septembre_octobre_novembre_d\xE9cembre".split("_"), monthsShort: "janv._f\xE9vr._mars_avr._mai_juin_juil._ao\xFBt_sept._oct._nov._d\xE9c.".split("_"), weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D MMMM YYYY", LLL: "D MMMM YYYY HH:mm", LLLL: "dddd D MMMM YYYY HH:mm" }, relativeTime: { future: "dans %s", past: "il y a %s", s: "quelques secondes", m: "une minute", mm: "%d minutes", h: "une heure", hh: "%d heures", d: "un jour", dd: "%d jours", M: "un mois", MM: "%d mois", y: "un an", yy: "%d ans" }, ordinal: function(e2) {
384
+ return "" + e2 + (1 === e2 ? "er" : "");
385
+ } };
386
+ return t.default.locale(i, null, true), i;
387
+ }));
388
+ }
389
+ });
390
+
391
+ // node_modules/dayjs/locale/it.js
392
+ var require_it = __commonJS({
393
+ "node_modules/dayjs/locale/it.js"(exports, module) {
394
+ "use strict";
395
+ !(function(e, o) {
396
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = o(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], o) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_it = o(e.dayjs);
397
+ })(exports, (function(e) {
398
+ "use strict";
399
+ function o(e2) {
400
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
401
+ }
402
+ var t = o(e), n = { name: "it", weekdays: "domenica_luned\xEC_marted\xEC_mercoled\xEC_gioved\xEC_venerd\xEC_sabato".split("_"), weekdaysShort: "dom_lun_mar_mer_gio_ven_sab".split("_"), weekdaysMin: "do_lu_ma_me_gi_ve_sa".split("_"), months: "gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"), weekStart: 1, monthsShort: "gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"), formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D MMMM YYYY", LLL: "D MMMM YYYY HH:mm", LLLL: "dddd D MMMM YYYY HH:mm" }, relativeTime: { future: "tra %s", past: "%s fa", s: "qualche secondo", m: "un minuto", mm: "%d minuti", h: "un'ora", hh: "%d ore", d: "un giorno", dd: "%d giorni", M: "un mese", MM: "%d mesi", y: "un anno", yy: "%d anni" }, ordinal: function(e2) {
403
+ return e2 + "\xBA";
404
+ } };
405
+ return t.default.locale(n, null, true), n;
406
+ }));
407
+ }
408
+ });
409
+
410
+ // node_modules/dayjs/locale/ja.js
411
+ var require_ja = __commonJS({
412
+ "node_modules/dayjs/locale/ja.js"(exports, module) {
413
+ "use strict";
414
+ !(function(e, _) {
415
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = _(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], _) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_ja = _(e.dayjs);
416
+ })(exports, (function(e) {
417
+ "use strict";
418
+ function _(e2) {
419
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
420
+ }
421
+ var t = _(e), d = { name: "ja", weekdays: "\u65E5\u66DC\u65E5_\u6708\u66DC\u65E5_\u706B\u66DC\u65E5_\u6C34\u66DC\u65E5_\u6728\u66DC\u65E5_\u91D1\u66DC\u65E5_\u571F\u66DC\u65E5".split("_"), weekdaysShort: "\u65E5_\u6708_\u706B_\u6C34_\u6728_\u91D1_\u571F".split("_"), weekdaysMin: "\u65E5_\u6708_\u706B_\u6C34_\u6728_\u91D1_\u571F".split("_"), months: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"), monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"), ordinal: function(e2) {
422
+ return e2 + "\u65E5";
423
+ }, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY\u5E74M\u6708D\u65E5", LLL: "YYYY\u5E74M\u6708D\u65E5 HH:mm", LLLL: "YYYY\u5E74M\u6708D\u65E5 dddd HH:mm", l: "YYYY/MM/DD", ll: "YYYY\u5E74M\u6708D\u65E5", lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm", llll: "YYYY\u5E74M\u6708D\u65E5(ddd) HH:mm" }, meridiem: function(e2) {
424
+ return e2 < 12 ? "\u5348\u524D" : "\u5348\u5F8C";
425
+ }, relativeTime: { future: "%s\u5F8C", past: "%s\u524D", s: "\u6570\u79D2", m: "1\u5206", mm: "%d\u5206", h: "1\u6642\u9593", hh: "%d\u6642\u9593", d: "1\u65E5", dd: "%d\u65E5", M: "1\u30F6\u6708", MM: "%d\u30F6\u6708", y: "1\u5E74", yy: "%d\u5E74" } };
426
+ return t.default.locale(d, null, true), d;
427
+ }));
428
+ }
429
+ });
430
+
431
+ // node_modules/dayjs/locale/pt-br.js
432
+ var require_pt_br = __commonJS({
433
+ "node_modules/dayjs/locale/pt-br.js"(exports, module) {
434
+ "use strict";
435
+ !(function(e, o) {
436
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = o(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], o) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_pt_br = o(e.dayjs);
437
+ })(exports, (function(e) {
438
+ "use strict";
439
+ function o(e2) {
440
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
441
+ }
442
+ var a = o(e), s = { name: "pt-br", weekdays: "domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"), weekdaysShort: "dom_seg_ter_qua_qui_sex_s\xE1b".split("_"), weekdaysMin: "Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_S\xE1".split("_"), months: "janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"), monthsShort: "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"), ordinal: function(e2) {
443
+ return e2 + "\xBA";
444
+ }, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D [de] MMMM [de] YYYY", LLL: "D [de] MMMM [de] YYYY [\xE0s] HH:mm", LLLL: "dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm" }, relativeTime: { future: "em %s", past: "h\xE1 %s", s: "poucos segundos", m: "um minuto", mm: "%d minutos", h: "uma hora", hh: "%d horas", d: "um dia", dd: "%d dias", M: "um m\xEAs", MM: "%d meses", y: "um ano", yy: "%d anos" } };
445
+ return a.default.locale(s, null, true), s;
446
+ }));
447
+ }
448
+ });
449
+
450
+ // node_modules/dayjs/locale/pt.js
451
+ var require_pt = __commonJS({
452
+ "node_modules/dayjs/locale/pt.js"(exports, module) {
453
+ "use strict";
454
+ !(function(e, a) {
455
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = a(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], a) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_pt = a(e.dayjs);
456
+ })(exports, (function(e) {
457
+ "use strict";
458
+ function a(e2) {
459
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
460
+ }
461
+ var o = a(e), t = { name: "pt", weekdays: "domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"), weekdaysShort: "dom_seg_ter_qua_qui_sex_sab".split("_"), weekdaysMin: "Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_Sa".split("_"), months: "janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"), monthsShort: "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"), ordinal: function(e2) {
462
+ return e2 + "\xBA";
463
+ }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D [de] MMMM [de] YYYY", LLL: "D [de] MMMM [de] YYYY [\xE0s] HH:mm", LLLL: "dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm" }, relativeTime: { future: "em %s", past: "h\xE1 %s", s: "alguns segundos", m: "um minuto", mm: "%d minutos", h: "uma hora", hh: "%d horas", d: "um dia", dd: "%d dias", M: "um m\xEAs", MM: "%d meses", y: "um ano", yy: "%d anos" } };
464
+ return o.default.locale(t, null, true), t;
465
+ }));
466
+ }
467
+ });
468
+
469
+ // node_modules/dayjs/plugin/customParseFormat.js
470
+ var require_customParseFormat = __commonJS({
471
+ "node_modules/dayjs/plugin/customParseFormat.js"(exports, module) {
472
+ "use strict";
473
+ !(function(e, t) {
474
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
475
+ })(exports, (function() {
476
+ "use strict";
477
+ var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
478
+ return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
479
+ };
480
+ var f = function(e2) {
481
+ return function(t2) {
482
+ this[e2] = +t2;
483
+ };
484
+ }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
485
+ (this.zone || (this.zone = {})).offset = (function(e3) {
486
+ if (!e3) return 0;
487
+ if ("Z" === e3) return 0;
488
+ var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
489
+ return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2;
490
+ })(e2);
491
+ }], u = function(e2) {
492
+ var t2 = s[e2];
493
+ return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
494
+ }, d = function(e2, t2) {
495
+ var n2, r2 = s.meridiem;
496
+ if (r2) {
497
+ for (var i2 = 1; i2 <= 24; i2 += 1) if (e2.indexOf(r2(i2, 0, t2)) > -1) {
498
+ n2 = i2 > 12;
499
+ break;
500
+ }
501
+ } else n2 = e2 === (t2 ? "pm" : "PM");
502
+ return n2;
503
+ }, c = { A: [o, function(e2) {
504
+ this.afternoon = d(e2, false);
505
+ }], a: [o, function(e2) {
506
+ this.afternoon = d(e2, true);
507
+ }], Q: [n, function(e2) {
508
+ this.month = 3 * (e2 - 1) + 1;
509
+ }], S: [n, function(e2) {
510
+ this.milliseconds = 100 * +e2;
511
+ }], SS: [r, function(e2) {
512
+ this.milliseconds = 10 * +e2;
513
+ }], SSS: [/\d{3}/, function(e2) {
514
+ this.milliseconds = +e2;
515
+ }], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
516
+ var t2 = s.ordinal, n2 = e2.match(/\d+/);
517
+ if (this.day = n2[0], t2) for (var r2 = 1; r2 <= 31; r2 += 1) t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
518
+ }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
519
+ var t2 = u("months"), n2 = (u("monthsShort") || t2.map((function(e3) {
520
+ return e3.slice(0, 3);
521
+ }))).indexOf(e2) + 1;
522
+ if (n2 < 1) throw new Error();
523
+ this.month = n2 % 12 || n2;
524
+ }], MMMM: [o, function(e2) {
525
+ var t2 = u("months").indexOf(e2) + 1;
526
+ if (t2 < 1) throw new Error();
527
+ this.month = t2 % 12 || t2;
528
+ }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
529
+ this.year = a(e2);
530
+ }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
531
+ function l(n2) {
532
+ var r2, i2;
533
+ r2 = n2, i2 = s && s.formats;
534
+ for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t2, n3, r3) {
535
+ var o3 = r3 && r3.toUpperCase();
536
+ return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e2, t3, n4) {
537
+ return t3 || n4.slice(1);
538
+ }));
539
+ }))).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
540
+ var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
541
+ o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
542
+ }
543
+ return function(e2) {
544
+ for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
545
+ var i3 = o2[n3];
546
+ if ("string" == typeof i3) r3 += i3.length;
547
+ else {
548
+ var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
549
+ f3.call(t2, u3), e2 = e2.replace(u3, "");
550
+ }
551
+ }
552
+ return (function(e3) {
553
+ var t3 = e3.afternoon;
554
+ if (void 0 !== t3) {
555
+ var n4 = e3.hours;
556
+ t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
557
+ }
558
+ })(t2), t2;
559
+ };
560
+ }
561
+ return function(e2, t2, n2) {
562
+ n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
563
+ var r2 = t2.prototype, i2 = r2.parse;
564
+ r2.parse = function(e3) {
565
+ var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
566
+ this.$u = r3;
567
+ var a2 = o2[1];
568
+ if ("string" == typeof a2) {
569
+ var f2 = true === o2[2], h2 = true === o2[3], u2 = f2 || h2, d2 = o2[2];
570
+ h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = (function(e4, t4, n3, r4) {
571
+ try {
572
+ if (["x", "X"].indexOf(t4) > -1) return new Date(("X" === t4 ? 1e3 : 1) * e4);
573
+ var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = /* @__PURE__ */ new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
574
+ o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
575
+ var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
576
+ return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
577
+ } catch (e5) {
578
+ return /* @__PURE__ */ new Date("");
579
+ }
580
+ })(t3, a2, r3, n2), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
581
+ } else if (a2 instanceof Array) for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
582
+ o2[1] = a2[m - 1];
583
+ var M = n2.apply(this, o2);
584
+ if (M.isValid()) {
585
+ this.$d = M.$d, this.$L = M.$L, this.init();
586
+ break;
587
+ }
588
+ m === c2 && (this.$d = /* @__PURE__ */ new Date(""));
589
+ }
590
+ else i2.call(this, e3);
591
+ };
592
+ };
593
+ }));
594
+ }
595
+ });
596
+
597
+ // src/browser/preload-locales.ts
598
+ var import_de = __toESM(require_de(), 1);
599
+ var import_es_mx = __toESM(require_es_mx(), 1);
600
+ var import_es = __toESM(require_es(), 1);
601
+ var import_fr = __toESM(require_fr(), 1);
602
+ var import_it = __toESM(require_it(), 1);
603
+ var import_ja = __toESM(require_ja(), 1);
604
+ var import_pt_br = __toESM(require_pt_br(), 1);
605
+ var import_pt = __toESM(require_pt(), 1);
606
+
607
+ // src/core/locales.ts
608
+ var SUPPORTED_LOCALES = [
609
+ "en",
610
+ "es",
611
+ "es-mx",
612
+ "fr",
613
+ "pt",
614
+ "pt-br",
615
+ "de",
616
+ "it",
617
+ "ja"
618
+ ];
619
+ var loadedLocales = /* @__PURE__ */ new Set(["en"]);
620
+ var localeLoaders = {
621
+ en: null,
622
+ es: () => Promise.resolve().then(() => __toESM(require_es(), 1)),
623
+ "es-mx": () => Promise.resolve().then(() => __toESM(require_es_mx(), 1)),
624
+ fr: () => Promise.resolve().then(() => __toESM(require_fr(), 1)),
625
+ pt: () => Promise.resolve().then(() => __toESM(require_pt(), 1)),
626
+ "pt-br": () => Promise.resolve().then(() => __toESM(require_pt_br(), 1)),
627
+ de: () => Promise.resolve().then(() => __toESM(require_de(), 1)),
628
+ it: () => Promise.resolve().then(() => __toESM(require_it(), 1)),
629
+ ja: () => Promise.resolve().then(() => __toESM(require_ja(), 1))
630
+ };
631
+ var normalizeLocale = (locale) => {
632
+ return locale.trim().toLowerCase().replace(/_/g, "-");
633
+ };
634
+ var asSupportedLocale = (locale) => {
635
+ if (!SUPPORTED_LOCALES.includes(locale)) {
636
+ return null;
637
+ }
638
+ return locale;
639
+ };
640
+ var isSupportedLocale = (locale) => {
641
+ return resolveLocale(locale) !== null;
642
+ };
643
+ var resolveLocale = (locale) => {
644
+ const normalizedLocale = normalizeLocale(locale);
645
+ const exactLocale = asSupportedLocale(normalizedLocale);
646
+ if (exactLocale) {
647
+ return exactLocale;
648
+ }
649
+ const [baseLocale] = normalizedLocale.split("-");
650
+ if (!baseLocale) {
651
+ return null;
652
+ }
653
+ return asSupportedLocale(baseLocale);
654
+ };
655
+ var markLocaleAsLoaded = (locale) => {
656
+ loadedLocales.add(locale);
657
+ };
658
+ var ensureLocaleLoaded = async (locale) => {
659
+ if (loadedLocales.has(locale)) {
660
+ return;
661
+ }
662
+ const load = localeLoaders[locale];
663
+ if (!load) {
664
+ loadedLocales.add(locale);
665
+ return;
666
+ }
667
+ await load();
668
+ loadedLocales.add(locale);
669
+ };
670
+
671
+ // src/browser/preload-locales.ts
672
+ markLocaleAsLoaded("de");
673
+ markLocaleAsLoaded("es");
674
+ markLocaleAsLoaded("es-mx");
675
+ markLocaleAsLoaded("fr");
676
+ markLocaleAsLoaded("it");
677
+ markLocaleAsLoaded("ja");
678
+ markLocaleAsLoaded("pt");
679
+ markLocaleAsLoaded("pt-br");
680
+ var browserLocalesReady = true;
681
+
682
+ // src/core/date.ts
683
+ var import_customParseFormat = __toESM(require_customParseFormat(), 1);
684
+ var import_dayjs = __toESM(require_dayjs_min(), 1);
685
+ import_dayjs.default.extend(import_customParseFormat.default);
686
+ import_dayjs.default.locale("en");
687
+ var DEFAULT_FORMAT = "YYYY-MM-DD";
688
+ var DEFAULT_LOCALE = "en";
689
+ var DEFAULT_INVALID_DATE = "Invalid Date";
690
+ var DEFAULT_STRICT = true;
691
+ var createResolvedConfig = (locale, config) => ({
692
+ locale,
693
+ strict: config?.strict ?? DEFAULT_STRICT,
694
+ invalid: config?.invalid ?? DEFAULT_INVALID_DATE
695
+ });
696
+ var getInvalidDateText = (config, props) => {
697
+ return props?.invalid ?? config?.invalid ?? DEFAULT_INVALID_DATE;
698
+ };
699
+ var getTargetLocale = (currentLocale, props) => {
700
+ if (!props?.locale) {
701
+ return currentLocale;
702
+ }
703
+ return resolveLocaleOrThrow(props.locale);
704
+ };
705
+ var getHelperLocale = (config, props) => {
706
+ if (props?.locale) {
707
+ return resolveLocaleOrThrow(props.locale);
708
+ }
709
+ if (config?.locale) {
710
+ return resolveLocaleOrThrow(config.locale);
711
+ }
712
+ return DEFAULT_LOCALE;
713
+ };
714
+ var parseDateValue = (value, input, locale, strict) => {
715
+ if (!input) {
716
+ return (0, import_dayjs.default)(value).locale(locale);
717
+ }
718
+ if (typeof input === "string") {
719
+ return (0, import_dayjs.default)(value, input, locale, strict).locale(locale);
720
+ }
721
+ return (0, import_dayjs.default)(value, [...input], locale, strict).locale(locale);
722
+ };
723
+ var createFormatterParseDate = (getConfig) => {
724
+ return (props) => {
725
+ const config = getConfig();
726
+ const locale = getTargetLocale(config.locale, props);
727
+ const parsed = parseDateValue(props.date, props.input, locale, props.strict ?? config.strict);
728
+ if (!parsed.isValid()) {
729
+ return {
730
+ isValid: false,
731
+ locale,
732
+ date: null,
733
+ iso: null,
734
+ timestamp: null,
735
+ error: getInvalidDateText(config, props)
736
+ };
737
+ }
738
+ return {
739
+ isValid: true,
740
+ locale,
741
+ date: parsed.toDate(),
742
+ iso: parsed.toISOString(),
743
+ timestamp: parsed.valueOf(),
744
+ format: (output = DEFAULT_FORMAT) => parsed.format(output)
745
+ };
746
+ };
747
+ };
748
+ var createFormatterIsValidDate = (parseDate2) => {
749
+ return (props) => parseDate2(props).isValid;
750
+ };
751
+ var createFormatterGetDate = (getConfig) => {
752
+ const parseDate2 = createFormatterParseDate(getConfig);
753
+ return (props) => {
754
+ const config = getConfig();
755
+ const locale = getTargetLocale(config.locale, props);
756
+ const output = props?.output ?? DEFAULT_FORMAT;
757
+ if (!props) {
758
+ return (0, import_dayjs.default)().locale(locale).format(DEFAULT_FORMAT);
759
+ }
760
+ if (props.date === void 0) {
761
+ return (0, import_dayjs.default)().locale(locale).format(output);
762
+ }
763
+ const parsed = parseDate2({
764
+ date: props.date,
765
+ input: props.input,
766
+ locale: props.locale,
767
+ strict: props.strict
768
+ });
769
+ if (!parsed.isValid) {
770
+ return props.invalid ?? parsed.error;
771
+ }
772
+ return parsed.format(output);
773
+ };
774
+ };
775
+ function resolveLocaleOrThrow(locale) {
776
+ const resolvedLocale = resolveLocale(locale);
777
+ if (!resolvedLocale) {
778
+ throw new Error(
779
+ `Unsupported locale: ${locale}. The package tries an exact locale match first and then falls back to the base locale.`
780
+ );
781
+ }
782
+ return resolvedLocale;
783
+ }
784
+ var getSupportedLocales = () => SUPPORTED_LOCALES;
785
+ var getDate = async (props, config) => {
786
+ const locale = getHelperLocale(config, props);
787
+ const formatter = createDateFormatter({ ...config, locale });
788
+ await formatter.ready;
789
+ return formatter.getDate(props);
790
+ };
791
+ var parseDate = async (props, config) => {
792
+ const locale = getHelperLocale(config, props);
793
+ const formatter = createDateFormatter({ ...config, locale });
794
+ await formatter.ready;
795
+ return formatter.parseDate(props);
796
+ };
797
+ var isValidDate = async (props, config) => {
798
+ const locale = getHelperLocale(config, props);
799
+ const formatter = createDateFormatter({ ...config, locale });
800
+ await formatter.ready;
801
+ return formatter.isValidDate(props);
802
+ };
803
+ var createDateFormatter = (config) => {
804
+ let currentLocale = config?.locale ? resolveLocaleOrThrow(config.locale) : DEFAULT_LOCALE;
805
+ const getConfig = () => createResolvedConfig(currentLocale, config);
806
+ const ready = ensureLocaleLoaded(currentLocale);
807
+ const parseDate2 = createFormatterParseDate(getConfig);
808
+ return {
809
+ getDate: createFormatterGetDate(getConfig),
810
+ parseDate: parseDate2,
811
+ isValidDate: createFormatterIsValidDate(parseDate2),
812
+ getSupportedLocales,
813
+ getCurrentLocale: () => currentLocale,
814
+ setLocale: async (locale) => {
815
+ const resolvedLocale = resolveLocaleOrThrow(locale);
816
+ await ensureLocaleLoaded(resolvedLocale);
817
+ currentLocale = resolvedLocale;
818
+ },
819
+ ready
820
+ };
821
+ };
822
+
823
+ // src/browser/global.ts
824
+ var DateKit = {
825
+ createDateFormatter,
826
+ getDate,
827
+ getSupportedLocales,
828
+ isSupportedLocale,
829
+ parseDate,
830
+ isValidDate,
831
+ resolveLocale
832
+ };
833
+ if (typeof window !== "undefined") {
834
+ window.DateKit = DateKit;
835
+ }
836
+
837
+ // src/browser/cdn.ts
838
+ if (!browserLocalesReady) {
839
+ throw new Error("Browser locales failed to preload");
840
+ }
841
+ if (typeof globalThis !== "undefined") {
842
+ ;
843
+ globalThis.DateKit = DateKit;
844
+ }
845
+ })();
846
+ //# sourceMappingURL=date.global.js.map