qrono 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/qrono.js CHANGED
@@ -1,38 +1,38 @@
1
1
  var rt = Object.defineProperty;
2
- var K = Object.getOwnPropertySymbols;
2
+ var Q = Object.getOwnPropertySymbols;
3
3
  var st = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable;
4
- var V = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, k = (t, e) => {
4
+ var G = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, $ = (t, e) => {
5
5
  for (var n in e || (e = {}))
6
- st.call(e, n) && V(t, n, e[n]);
7
- if (K)
8
- for (var n of K(e))
9
- at.call(e, n) && V(t, n, e[n]);
6
+ st.call(e, n) && G(t, n, e[n]);
7
+ if (Q)
8
+ for (var n of Q(e))
9
+ at.call(e, n) && G(t, n, e[n]);
10
10
  return t;
11
11
  };
12
- const ut = new Date(1915, 0, 1, 12, 0, 0, 0), T = 7, _ = 24, v = 60, N = v * _, J = 60, ct = J * v, ft = ct * _, X = 1e3, ht = J * X, U = ft * X;
13
- function D(t, ...e) {
12
+ const ut = new Date(1915, 0, 1, 12, 0, 0, 0), b = 7, K = 24, v = 60, N = v * K, V = 60, ct = V * v, ft = ct * K, _ = 1e3, ht = V * _, J = ft * _;
13
+ function p(t, ...e) {
14
14
  return e.flat().some(t.hasOwnProperty, t);
15
15
  }
16
- function F(t) {
16
+ function X(t) {
17
17
  return Object.entries(t).filter(([, e]) => !lt(e)).map(([e]) => e);
18
18
  }
19
- function w(t) {
19
+ function Y(t) {
20
20
  return t !== void 0;
21
21
  }
22
22
  function lt(t) {
23
23
  return t instanceof Function;
24
24
  }
25
- function mt(t) {
25
+ function yt(t) {
26
26
  return typeof t == "string" || t instanceof String;
27
27
  }
28
- function S(t) {
28
+ function T(t) {
29
29
  return t !== null && typeof t == "object" && t.constructor === Object;
30
30
  }
31
31
  function tt(t) {
32
32
  return !Number.isNaN(t.getTime());
33
33
  }
34
- function Y(t) {
35
- return D(t, [
34
+ function S(t) {
35
+ return p(t, [
36
36
  "year",
37
37
  "month",
38
38
  "day",
@@ -42,41 +42,31 @@ function Y(t) {
42
42
  "millisecond"
43
43
  ]);
44
44
  }
45
- const C = o;
45
+ const k = o;
46
46
  o.date = a;
47
- const d = {
47
+ const M = {
48
48
  localtime: !1,
49
49
  disambiguation: "compatible"
50
50
  };
51
- for (const t of F(d))
52
- o[t] = function(e) {
53
- return w(e) ? (d[t] = e, this) : d[t];
54
- };
55
51
  o.context = function(t) {
56
- if (w(t)) {
57
- for (const e of F(d))
58
- D(t, e) && (d[e] = t[e]);
52
+ if (Y(t)) {
53
+ for (const e of X(M))
54
+ p(t, e) && (M[e] = t[e]);
59
55
  return this;
60
56
  }
61
- return k({}, d);
62
- };
63
- o.asUtc = function() {
64
- return d.localtime = !1, this;
65
- };
66
- o.asLocaltime = function() {
67
- return d.localtime = !0, this;
57
+ return $({}, M);
68
58
  };
69
- const yt = 1, dt = 2, et = 3, M = 4, pt = 5, Dt = 6, gt = 7;
59
+ const dt = 1, mt = 2, et = 3, w = 4, pt = 5, Dt = 6, gt = 7;
70
60
  Object.assign(o, {
71
- monday: yt,
72
- tuesday: dt,
61
+ monday: dt,
62
+ tuesday: mt,
73
63
  wednesday: et,
74
- thursday: M,
64
+ thursday: w,
75
65
  friday: pt,
76
66
  saturday: Dt,
77
67
  sunday: gt
78
68
  });
79
- const c = /* @__PURE__ */ Symbol();
69
+ const f = /* @__PURE__ */ Symbol();
80
70
  function o(...t) {
81
71
  var s;
82
72
  if (!new.target)
@@ -88,26 +78,25 @@ function o(...t) {
88
78
  disambiguation: "compatible",
89
79
  // methods
90
80
  set: Mt,
91
- parse: vt,
81
+ parse: Tt,
92
82
  valid: Ot,
93
83
  context: wt,
94
84
  getNative: bt
95
85
  };
96
- if (this[c] = e, e.context(d), t[0] instanceof o) {
97
- const r = t.shift();
98
- for (const i of F(e))
99
- e[i] = r[i]();
86
+ if (this[f] = e, e.context(M), t[0] instanceof o) {
87
+ const i = t.shift();
88
+ e.nativeDate = i.nativeDate(), e.context(i.context());
100
89
  }
101
- S(t[0]) && !Y(t[0]) && e.context(t.shift());
90
+ T(t[0]) && !S(t[0]) && e.context(t.shift());
102
91
  const n = t[0], u = t[1];
103
92
  if (n == null)
104
93
  (s = e.nativeDate) != null || (e.nativeDate = /* @__PURE__ */ new Date());
105
94
  else if (n instanceof Date)
106
95
  e.nativeDate = new Date(n.getTime());
107
- else if (mt(n))
96
+ else if (yt(n))
108
97
  e.parse(n);
109
- else if (S(n)) {
110
- if (!Y(n))
98
+ else if (T(n)) {
99
+ if (!S(n))
111
100
  throw RangeError(
112
101
  "Missing time field (year, minute, day, hour, minute, second or millisecond)"
113
102
  );
@@ -115,19 +104,19 @@ function o(...t) {
115
104
  } else if (Number.isFinite(n) && !Number.isFinite(u))
116
105
  e.nativeDate = new Date(n);
117
106
  else if (Number.isFinite(n) || Array.isArray(n)) {
118
- const r = t.flat(), i = r.filter((m) => Number.isSafeInteger(m));
119
- if (i.length !== r.length)
107
+ const i = t.flat(), r = i.filter((l) => Number.isSafeInteger(l));
108
+ if (r.length !== i.length)
120
109
  throw RangeError("Should be safe integers");
121
- if (i.length > 7)
110
+ if (r.length > 7)
122
111
  throw RangeError("Too many numbers");
123
112
  e.set({
124
- year: i[0],
125
- month: i[1],
126
- day: i[2],
127
- hour: i[3],
128
- minute: i[4],
129
- second: i[5],
130
- millisecond: i[6]
113
+ year: r[0],
114
+ month: r[1],
115
+ day: r[2],
116
+ hour: r[3],
117
+ minute: r[4],
118
+ second: r[5],
119
+ millisecond: r[6]
131
120
  });
132
121
  } else
133
122
  throw TypeError(`Invalid argument ${t}`);
@@ -138,8 +127,8 @@ function Ot() {
138
127
  }
139
128
  function wt(t) {
140
129
  if (t) {
141
- for (const e of F(d))
142
- D(t, e) && (this[e] = t[e]);
130
+ for (const e of X(M))
131
+ p(t, e) && (this[e] = t[e]);
143
132
  return this;
144
133
  }
145
134
  }
@@ -147,120 +136,111 @@ function bt(t) {
147
136
  return this.nativeDate[`get${this.localtime ? "" : "UTC"}${t}`]();
148
137
  }
149
138
  function Mt(t) {
150
- var A, H, I, E, R, P, W, j, x, L, B, z, q, Z, Q, G;
151
- const e = k({}, t);
139
+ var C, A, H, I, U, E, R, P, x, W, j, B, L, z, q, Z;
140
+ const e = $({}, t);
152
141
  if (e.month = e.month && e.month - 1, !this.localtime) {
153
- const O = (A = this.nativeDate) != null ? A : /* @__PURE__ */ new Date(0), $ = /* @__PURE__ */ new Date(0);
154
- return $.setUTCFullYear(
155
- (H = e.year) != null ? H : O.getUTCFullYear(),
156
- (I = e.month) != null ? I : O.getUTCMonth(),
157
- (E = e.day) != null ? E : O.getUTCDate()
158
- ), $.setUTCHours(
159
- (R = e.hour) != null ? R : O.getUTCHours(),
160
- (P = e.minute) != null ? P : O.getUTCMinutes(),
161
- (W = e.second) != null ? W : O.getUTCSeconds(),
162
- (j = e.millisecond) != null ? j : O.getUTCMilliseconds()
163
- ), this.nativeDate = $, this;
142
+ const g = (C = this.nativeDate) != null ? C : /* @__PURE__ */ new Date(0), F = /* @__PURE__ */ new Date(0);
143
+ return F.setUTCFullYear(
144
+ (A = e.year) != null ? A : g.getUTCFullYear(),
145
+ (H = e.month) != null ? H : g.getUTCMonth(),
146
+ (I = e.day) != null ? I : g.getUTCDate()
147
+ ), F.setUTCHours(
148
+ (U = e.hour) != null ? U : g.getUTCHours(),
149
+ (E = e.minute) != null ? E : g.getUTCMinutes(),
150
+ (R = e.second) != null ? R : g.getUTCSeconds(),
151
+ (P = e.millisecond) != null ? P : g.getUTCMilliseconds()
152
+ ), this.nativeDate = F, this;
164
153
  }
165
- const n = !D(t, "hour", "minute", "second", "millisecond"), u = n ? "later" : this.disambiguation, s = (x = this.nativeDate) != null ? x : new Date(0, 0), r = new Date(ut.getTime()), i = {
166
- year: (L = e.year) != null ? L : s.getFullYear(),
167
- month: (B = e.month) != null ? B : s.getMonth(),
168
- day: (z = e.day) != null ? z : s.getDate(),
169
- hour: (q = e.hour) != null ? q : n ? 0 : s.getHours(),
170
- minute: (Z = e.minute) != null ? Z : n ? 0 : s.getMinutes(),
171
- second: (Q = e.second) != null ? Q : n ? 0 : s.getSeconds(),
172
- millisecond: (G = e.millisecond) != null ? G : n ? 0 : s.getMilliseconds()
154
+ const n = !p(t, "hour", "minute", "second", "millisecond"), u = n ? "later" : this.disambiguation, s = (x = this.nativeDate) != null ? x : new Date(0, 0), i = new Date(ut.getTime()), r = {
155
+ year: (W = e.year) != null ? W : s.getFullYear(),
156
+ month: (j = e.month) != null ? j : s.getMonth(),
157
+ day: (B = e.day) != null ? B : s.getDate(),
158
+ hour: (L = e.hour) != null ? L : n ? 0 : s.getHours(),
159
+ minute: (z = e.minute) != null ? z : n ? 0 : s.getMinutes(),
160
+ second: (q = e.second) != null ? q : n ? 0 : s.getSeconds(),
161
+ millisecond: (Z = e.millisecond) != null ? Z : n ? 0 : s.getMilliseconds()
173
162
  };
174
- r.setFullYear(i.year, i.month, i.day), r.setHours(
175
- i.hour,
176
- i.minute,
177
- i.second,
178
- i.millisecond
163
+ i.setFullYear(r.year, r.month, r.day), i.setHours(
164
+ r.hour,
165
+ r.minute,
166
+ r.second,
167
+ r.millisecond
179
168
  );
180
- const m = r.getTime(), y = new Date(m);
181
- y.setDate(r.getDate() + 1);
182
- const h = new Date(m);
183
- h.setDate(r.getDate() - 1);
184
- const f = y.getTimezoneOffset() - h.getTimezoneOffset();
185
- if (u === "compatible" || f === 0)
186
- return this.nativeDate = r, this;
187
- const g = i.year * 1e8 + i.month * 1e6 + i.day * 1e4 + i.hour * 100 + i.minute < r.getFullYear() * 1e8 + r.getMonth() * 1e6 + r.getDate() * 1e4 + r.getHours() * 100 + r.getMinutes(), b = new Date(
188
- new Date(m).setUTCMinutes(r.getUTCMinutes() + f)
189
- ), it = b.getHours() === r.getHours() && b.getMinutes() === r.getMinutes();
190
- if (!g && !it)
191
- return this.nativeDate = r, this;
169
+ const l = i.getTime(), d = new Date(l);
170
+ d.setDate(i.getDate() + 1);
171
+ const h = new Date(l);
172
+ h.setDate(i.getDate() - 1);
173
+ const c = d.getTimezoneOffset() - h.getTimezoneOffset();
174
+ if (u === "compatible" || c === 0)
175
+ return this.nativeDate = i, this;
176
+ const D = r.year * 1e8 + r.month * 1e6 + r.day * 1e4 + r.hour * 100 + r.minute < i.getFullYear() * 1e8 + i.getMonth() * 1e6 + i.getDate() * 1e4 + i.getHours() * 100 + i.getMinutes(), O = new Date(
177
+ new Date(l).setUTCMinutes(i.getUTCMinutes() + c)
178
+ ), it = O.getHours() === i.getHours() && O.getMinutes() === i.getMinutes();
179
+ if (!D && !it)
180
+ return this.nativeDate = i, this;
192
181
  if (u === "reject")
193
- throw new RangeError(`Requested local time ${i} is ambiguous.`);
194
- return this.nativeDate = u === "later" ? r : b, this;
182
+ throw new RangeError(`Requested local time ${r} is ambiguous.`);
183
+ return this.nativeDate = u === "later" ? i : O, this;
195
184
  }
196
- const Tt = new RegExp(
185
+ const vt = new RegExp(
197
186
  // yyyy[[-|/]MM[[-|/]DD]]
198
187
  "^(\\d{4})(?:[-/]?([0-2]?\\d)(?:[-/]?([0-3]?\\d))?)?(?:[T\\s]([0-2]?\\d)(?::([0-5]?\\d)?(?::([0-6]?\\d)?(?:[.:](\\d{1,3})?\\d*)?)?)?)?(Z|[-+]\\d{2}:?\\d{2})?$"
199
188
  );
200
- function vt(t) {
189
+ function Tt(t) {
201
190
  var h;
202
- const e = t.trim().toUpperCase(), n = e.match(Tt);
191
+ const e = t.trim().toUpperCase(), n = e.match(vt);
203
192
  if (!n)
204
193
  throw RangeError(
205
194
  `Failed to parse '${t}'. Should be yyyy[[-|/]MM[[-|/]DD]][(T| )HH:mm[:ss[(.|:)SSS]]][Z|(+|-)hh:mm]`
206
195
  );
207
- const u = n[4] !== void 0, [s, r, i, m] = [
196
+ const u = n[4] !== void 0, [s, i, r, l] = [
208
197
  +n[1],
209
198
  +n[2] || 1,
210
199
  +n[3] || 1,
211
200
  n[8]
212
- ], y = new Date(e);
213
- if (!tt(y))
201
+ ], d = new Date(e);
202
+ if (!tt(d))
214
203
  throw RangeError(
215
204
  `Failed to parse '${t}' by Date. Should be yyyy[[-|/]MM[[-|/]DD]][(T| )HH:mm[:ss[(.|:)SSS]]][Z|(+|-)hh:mm]`
216
205
  );
217
- return m ? this.nativeDate = y : u ? this.set({
206
+ return l ? this.nativeDate = d : u ? this.set({
218
207
  year: s,
219
- month: r,
220
- day: i,
208
+ month: i,
209
+ day: r,
221
210
  hour: +n[4] || 0,
222
211
  minute: +n[5] || 0,
223
212
  second: +n[6] || 0,
224
213
  millisecond: +((h = n[7]) == null ? void 0 : h.padStart(3, "0")) || 0
225
- }) : this.set({ year: s, month: r, day: i }), this;
214
+ }) : this.set({ year: s, month: i, day: r }), this;
226
215
  }
227
- const p = (t, e) => String(t).padStart(e, "0");
216
+ const m = (t, e) => String(t).padStart(e, "0");
228
217
  o.prototype.toString = function() {
229
- if (this[c].localtime) {
230
- const t = this[c].nativeDate, e = -t.getTimezoneOffset(), n = Math.abs(e);
231
- return `${p(t.getFullYear(), 4)}-${p(t.getMonth() + 1, 2)}-${p(t.getDate(), 2)}T${p(t.getHours(), 2)}:${p(t.getMinutes(), 2)}:${p(t.getSeconds(), 2)}.${p(t.getMilliseconds(), 3)}${e >= 0 ? "+" : "-"}${p(Math.trunc(n / v), 2)}:${p(n % v, 2)}`;
218
+ if (this[f].localtime) {
219
+ const t = this[f].nativeDate, e = -t.getTimezoneOffset(), n = Math.abs(e);
220
+ return `${m(t.getFullYear(), 4)}-${m(t.getMonth() + 1, 2)}-${m(t.getDate(), 2)}T${m(t.getHours(), 2)}:${m(t.getMinutes(), 2)}:${m(t.getSeconds(), 2)}.${m(t.getMilliseconds(), 3)}${e >= 0 ? "+" : "-"}${m(Math.trunc(n / v), 2)}:${m(n % v, 2)}`;
232
221
  }
233
- return this[c].nativeDate.toISOString();
222
+ return this[f].nativeDate.toISOString();
234
223
  };
235
224
  o.prototype.valueOf = function() {
236
- return this[c].nativeDate.valueOf();
225
+ return this[f].nativeDate.valueOf();
237
226
  };
238
227
  o.prototype.clone = function(...t) {
239
228
  return new o(this, ...t);
240
229
  };
241
230
  o.prototype.context = function(t) {
242
- return w(t) ? this.clone(t) : {
243
- localtime: this[c].localtime,
244
- disambiguation: this[c].disambiguation
231
+ return Y(t) ? this.clone(t) : {
232
+ localtime: this[f].localtime,
233
+ disambiguation: this[f].disambiguation
245
234
  };
246
235
  };
247
236
  o.prototype.nativeDate = function() {
248
- return new Date(this[c].nativeDate.getTime());
237
+ return new Date(this[f].nativeDate.getTime());
249
238
  };
250
239
  o.prototype.offset = function() {
251
- return this[c].localtime ? -this[c].nativeDate.getTimezoneOffset() : 0;
252
- };
253
- o.prototype.localtime = function(t) {
254
- return w(t) ? this.clone({ localtime: t }) : this[c].localtime;
255
- };
256
- o.prototype.disambiguation = function(t) {
257
- return w(t) ? this.clone({ disambiguation: t }) : this[c].disambiguation;
240
+ return this[f].localtime ? -this[f].nativeDate.getTimezoneOffset() : 0;
258
241
  };
259
242
  o.prototype.valid = function() {
260
- return this[c].valid();
261
- };
262
- o.prototype.numeric = function() {
263
- return this[c].nativeDate.getTime();
243
+ return this[f].valid();
264
244
  };
265
245
  o.prototype.toObject = function() {
266
246
  return {
@@ -287,12 +267,6 @@ o.prototype.toArray = function() {
287
267
  o.prototype.toDate = function(...t) {
288
268
  return new a(this.clone(...t));
289
269
  };
290
- o.prototype.asUtc = function() {
291
- return this.clone({ localtime: !1 });
292
- };
293
- o.prototype.asLocaltime = function() {
294
- return this.clone({ localtime: !0 });
295
- };
296
270
  for (const [t, e, n] of [
297
271
  ["year", "FullYear", 0],
298
272
  ["month", "Month", 1],
@@ -303,37 +277,37 @@ for (const [t, e, n] of [
303
277
  ["millisecond", "Milliseconds", 0]
304
278
  ])
305
279
  o.prototype[t] = function(u) {
306
- return w(u) ? this.clone({ [t]: u }) : this[c].getNative(e) + n;
280
+ return Y(u) ? this.clone({ [t]: u }) : this[f].getNative(e) + n;
307
281
  };
308
282
  o.prototype.dayOfWeek = function() {
309
- return 1 + (this[c].getNative("Day") - 1 + T) % T;
283
+ return 1 + (this[f].getNative("Day") - 1 + b) % b;
310
284
  };
311
285
  o.prototype.dayOfYear = function() {
312
286
  const t = this.toDate();
313
287
  return 1 + t - t.startOfYear();
314
288
  };
315
289
  o.prototype.weekOfYear = function() {
316
- const t = this.toDate(), e = t.day(t.day() - t.dayOfWeek() + M), n = e.startOfYear(), u = n.dayOfWeek() === M ? n : n.day(
317
- 1 + (M - n.dayOfWeek() + T) % T
290
+ const t = this.toDate(), e = t.day(t.day() - t.dayOfWeek() + w), n = e.startOfYear(), u = n.dayOfWeek() === w ? n : n.day(
291
+ 1 + (w - n.dayOfWeek() + b) % b
318
292
  );
319
- return 1 + Math.ceil((e - u) / T);
293
+ return 1 + Math.ceil((e - u) / b);
320
294
  };
321
295
  o.prototype.yearOfWeek = function() {
322
296
  const t = this.toDate();
323
- return t.day(t.day() - t.dayOfWeek() + M).year();
297
+ return t.day(t.day() - t.dayOfWeek() + w).year();
324
298
  };
325
299
  o.prototype.isLeapYear = function() {
326
300
  const t = this.year();
327
301
  return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
328
302
  };
329
303
  o.prototype.hasDstInYear = function() {
330
- if (!this[c].localtime)
304
+ if (!this[f].localtime)
331
305
  return !1;
332
306
  const t = this.offset();
333
307
  return [3, 6, 9, 12].map((e) => this.month(e).offset()).some((e) => e !== t);
334
308
  };
335
309
  o.prototype.isInDst = function() {
336
- if (!this[c].localtime)
310
+ if (!this[f].localtime)
337
311
  return !1;
338
312
  const t = Array.from(
339
313
  { length: 12 },
@@ -342,10 +316,10 @@ o.prototype.isInDst = function() {
342
316
  return e !== n && this.offset() === n;
343
317
  };
344
318
  o.prototype.isDstTransitionDay = function() {
345
- return this[c].localtime ? this.minutesInDay() !== N : !1;
319
+ return this[f].localtime ? this.minutesInDay() !== N : !1;
346
320
  };
347
321
  o.prototype.minutesInDay = function() {
348
- if (!this[c].localtime)
322
+ if (!this[f].localtime)
349
323
  return N;
350
324
  const t = this.context({ disambiguation: "later" }).startOfDay(), e = t.plus({ day: 1 }).startOfDay();
351
325
  return t.day() === e.day() ? N : (e - t) / ht;
@@ -359,7 +333,7 @@ o.prototype.daysInYear = function() {
359
333
  };
360
334
  o.prototype.weeksInYear = function() {
361
335
  const t = this.toDate({ month: 12, day: 31 }), e = t.minus({ year: 1 });
362
- return t.dayOfWeek() === M || e.dayOfWeek() === et ? 53 : 52;
336
+ return t.dayOfWeek() === w || e.dayOfWeek() === et ? 53 : 52;
363
337
  };
364
338
  for (const [t, e] of [
365
339
  ["Year", { month: 1, day: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }],
@@ -375,7 +349,7 @@ o.prototype.startOfDay = function() {
375
349
  const t = this.clone(
376
350
  { disambiguation: "later" },
377
351
  { hour: 0, minute: 0, second: 0, millisecond: 0 }
378
- ).numeric();
352
+ ).valueOf();
379
353
  return this.clone(t);
380
354
  };
381
355
  o.prototype.isSame = function(t) {
@@ -403,81 +377,78 @@ o.prototype.minus = function(...t) {
403
377
  return nt.call(this, -1, ...t);
404
378
  };
405
379
  function nt(t, ...e) {
406
- var m, y;
380
+ var l, d;
407
381
  const n = e[0], u = e[1];
408
382
  if (Number.isFinite(n) && !Number.isFinite(u))
409
- return this.clone(this.numeric() + n);
383
+ return this.clone(this.valueOf() + n);
410
384
  let s = null;
411
- if (S(n)) {
412
- if (!Y(n))
385
+ if (T(n)) {
386
+ if (!S(n))
413
387
  throw RangeError(
414
388
  "Missing time field (year, minute, day, hour, minute, second or millisecond)"
415
389
  );
416
390
  s = n;
417
391
  } else if (Number.isFinite(n) || Array.isArray(n)) {
418
- const h = e.flat(), f = h.filter((g) => Number.isSafeInteger(g));
419
- if (f.length !== h.length)
392
+ const h = e.flat(), c = h.filter((D) => Number.isSafeInteger(D));
393
+ if (c.length !== h.length)
420
394
  throw RangeError("Should be safe integers");
421
- if (f.length > 7)
395
+ if (c.length > 7)
422
396
  throw RangeError("Too many numbers");
423
397
  s = {
424
- year: f[0],
425
- month: f[1],
426
- day: f[2],
427
- hour: f[3],
428
- minute: f[4],
429
- second: f[5],
430
- millisecond: f[6]
398
+ year: c[0],
399
+ month: c[1],
400
+ day: c[2],
401
+ hour: c[3],
402
+ minute: c[4],
403
+ second: c[5],
404
+ millisecond: c[6]
431
405
  };
432
406
  } else
433
407
  throw TypeError();
434
- const r = this.nativeDate(), i = this[c].localtime ? "" : "UTC";
435
- if (D(s, "year") || D(s, "month")) {
436
- const h = this.year() + t * ((m = s.year) != null ? m : 0), f = this.month() + t * ((y = s.month) != null ? y : 0), g = new Date(r.getTime());
437
- g[`set${i}FullYear`](h, f, 0);
438
- const b = g[`get${i}Date`]();
439
- b < this.day() ? r[`set${i}FullYear`](h, g[`get${i}Month`](), b) : r[`set${i}FullYear`](h, f - 1);
408
+ const i = this.nativeDate(), r = this[f].localtime ? "" : "UTC";
409
+ if (p(s, "year") || p(s, "month")) {
410
+ const h = this.year() + t * ((l = s.year) != null ? l : 0), c = this.month() + t * ((d = s.month) != null ? d : 0), D = new Date(i.getTime());
411
+ D[`set${r}FullYear`](h, c, 0);
412
+ const O = D[`get${r}Date`]();
413
+ O < this.day() ? i[`set${r}FullYear`](h, D[`get${r}Month`](), O) : i[`set${r}FullYear`](h, c - 1);
440
414
  }
441
- D(s, "day") && r[`set${i}Date`](r[`get${i}Date`]() + t * s.day);
442
- for (const [h, f] of [
415
+ p(s, "day") && i[`set${r}Date`](i[`get${r}Date`]() + t * s.day);
416
+ for (const [h, c] of [
443
417
  ["hour", "Hours"],
444
418
  ["minute", "Minutes"],
445
419
  ["second", "Seconds"],
446
420
  ["millisecond", "Milliseconds"]
447
421
  ])
448
- !D(s, h) || s[h] == null || r[`setUTC${f}`](
449
- r[`getUTC${f}`]() + t * s[h]
422
+ !p(s, h) || s[h] == null || i[`setUTC${c}`](
423
+ i[`getUTC${c}`]() + t * s[h]
450
424
  );
451
- return this.clone(r);
425
+ return this.clone(i);
452
426
  }
453
- const l = /* @__PURE__ */ Symbol();
427
+ const y = /* @__PURE__ */ Symbol();
454
428
  function a(...t) {
455
429
  if (!new.target)
456
430
  return new a(...t);
457
431
  const e = { datetime: null };
458
- this[l] = e;
432
+ this[y] = e;
459
433
  let n = null;
460
434
  t[0] instanceof a ? n = t.shift().toDatetime() : t[0] instanceof o && (n = t.shift());
461
435
  const u = t[0], s = t[1];
462
- return Number.isFinite(u) && !Number.isFinite(s) && (t[0] = Math.floor(u) * U), n ? n = n.clone(...t) : n = C(...t), e.datetime = n.startOfDay(), this;
436
+ return Number.isFinite(u) && !Number.isFinite(s) && (t[0] = Math.floor(u) * J), n ? n = n.clone(...t) : n = k(...t), e.datetime = n.startOfDay(), this;
463
437
  }
464
438
  a.prototype.toString = function() {
465
- return this[l].datetime.toString().substring(0, 10);
439
+ return this[y].datetime.toString().substring(0, 10);
466
440
  };
467
441
  a.prototype.valueOf = function() {
468
- return this[l].datetime / U;
442
+ return this[y].datetime / J;
469
443
  };
470
444
  a.prototype.valid = function() {
471
- return this[l].datetime.valid();
445
+ return this[y].datetime.valid();
472
446
  };
473
447
  a.prototype.clone = function(...t) {
474
448
  return new a(this, ...t);
475
449
  };
476
450
  a.prototype.toDatetime = function() {
477
- return C(this[l].datetime.toArray());
478
- };
479
- a.prototype.numeric = function() {
480
- return this[l].datetime.numeric() / U;
451
+ return k(this[y].datetime.toArray());
481
452
  };
482
453
  a.prototype.toObject = function() {
483
454
  return {
@@ -490,17 +461,14 @@ a.prototype.toArray = function() {
490
461
  return [this.year(), this.month(), this.day()];
491
462
  };
492
463
  a.prototype.startOfYear = function() {
493
- return new a(this[l].datetime.startOfYear());
464
+ return new a(this[y].datetime.startOfYear());
494
465
  };
495
466
  a.prototype.startOfMonth = function() {
496
- return new a(this[l].datetime.startOfMonth());
497
- };
498
- a.prototype.startOfDay = function() {
499
- return this[l].datetime.clone();
467
+ return new a(this[y].datetime.startOfMonth());
500
468
  };
501
469
  for (const t of ["year", "month", "day"])
502
470
  a.prototype[t] = function(e) {
503
- return w(e) ? new a(this[l].datetime[t](e)) : this[l].datetime[t]();
471
+ return Y(e) ? new a(this[y].datetime[t](e)) : this[y].datetime[t]();
504
472
  };
505
473
  for (const t of [
506
474
  "dayOfWeek",
@@ -513,13 +481,13 @@ for (const t of [
513
481
  "weeksInYear"
514
482
  ])
515
483
  a.prototype[t] = function() {
516
- return this[l].datetime[t]();
484
+ return this[y].datetime[t]();
517
485
  };
518
486
  for (const t of ["minutesInDay", "hasDstInYear", "isDstTransitionDay"])
519
487
  a.prototype[t] = function() {
520
- return C(
488
+ return k(
521
489
  { disambiguation: "later" },
522
- this[l].datetime.toArray().slice(0, 3)
490
+ this[y].datetime.toArray().slice(0, 3)
523
491
  )[t]();
524
492
  };
525
493
  a.prototype.endOfYear = function() {
@@ -553,34 +521,34 @@ a.prototype.minus = function(...t) {
553
521
  return ot.call(this, -1, ...t);
554
522
  };
555
523
  function ot(t, ...e) {
556
- var i, m, y;
557
- const n = e[0], u = e[1], s = this[l].datetime;
524
+ var r, l, d;
525
+ const n = e[0], u = e[1], s = this[y].datetime;
558
526
  if (Number.isFinite(n) && !Number.isFinite(u))
559
527
  return s.plus({ day: t * n }).toDate();
560
- let r = null;
561
- if (S(n) && Y(n))
562
- r = {
563
- year: t * ((i = n.year) != null ? i : 0),
564
- month: t * ((m = n.month) != null ? m : 0),
565
- day: t * ((y = n.day) != null ? y : 0)
528
+ let i = null;
529
+ if (T(n) && S(n))
530
+ i = {
531
+ year: t * ((r = n.year) != null ? r : 0),
532
+ month: t * ((l = n.month) != null ? l : 0),
533
+ day: t * ((d = n.day) != null ? d : 0)
566
534
  };
567
535
  else if (Number.isFinite(n)) {
568
536
  if (e.length > 3)
569
537
  throw RangeError("Too many arguments");
570
- r = { year: t * n, month: t * u, day: t * arg2 };
538
+ i = { year: t * n, month: t * u, day: t * arg2 };
571
539
  } else if (Array.isArray(n)) {
572
540
  if (n.length > 3)
573
541
  throw RangeError("Too many elements");
574
- r = {
542
+ i = {
575
543
  year: t * n[0],
576
544
  month: t * n[1],
577
545
  day: t * n[2]
578
546
  };
579
547
  } else
580
548
  throw TypeError();
581
- return s.plus(r).toDate();
549
+ return s.plus(i).toDate();
582
550
  }
583
551
  export {
584
- C as qrono
552
+ k as qrono
585
553
  };
586
554
  //# sourceMappingURL=qrono.js.map