yummies 5.11.1 → 5.12.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 (118) hide show
  1. package/async.cjs +1 -1
  2. package/async.cjs.map +1 -1
  3. package/async.js +38 -21
  4. package/async.js.map +1 -1
  5. package/common.cjs +1 -1
  6. package/common.cjs.map +1 -1
  7. package/common.js +9 -3
  8. package/common.js.map +1 -1
  9. package/complex.cjs +1 -1
  10. package/complex.cjs.map +1 -1
  11. package/complex.js +56 -33
  12. package/complex.js.map +1 -1
  13. package/cookie.cjs +1 -1
  14. package/cookie.cjs.map +1 -1
  15. package/cookie.js +7 -2
  16. package/cookie.js.map +1 -1
  17. package/css.cjs +1 -1
  18. package/css.cjs.map +1 -1
  19. package/css.js +41 -20
  20. package/css.js.map +1 -1
  21. package/data.cjs +1 -1
  22. package/data.cjs.map +1 -1
  23. package/data.js +35 -25
  24. package/data.js.map +1 -1
  25. package/date-time.cjs +1 -1
  26. package/date-time.cjs.map +1 -1
  27. package/date-time.js +332 -250
  28. package/date-time.js.map +1 -1
  29. package/device.cjs +1 -1
  30. package/device.cjs.map +1 -1
  31. package/device.js +27 -18
  32. package/device.js.map +1 -1
  33. package/encodings.cjs +1 -1
  34. package/encodings.cjs.map +1 -1
  35. package/encodings.js +10 -10
  36. package/encodings.js.map +1 -1
  37. package/errors.cjs +1 -1
  38. package/errors.cjs.map +1 -1
  39. package/errors.js +21 -6
  40. package/errors.js.map +1 -1
  41. package/file.cjs +1 -1
  42. package/file.cjs.map +1 -1
  43. package/file.js +26 -17
  44. package/file.js.map +1 -1
  45. package/format.cjs +1 -1
  46. package/format.cjs.map +1 -1
  47. package/format.js +66 -39
  48. package/format.js.map +1 -1
  49. package/html.cjs +1 -1
  50. package/html.cjs.map +1 -1
  51. package/html.d.ts +1 -1
  52. package/html.d.ts.map +1 -1
  53. package/html.js +111 -68
  54. package/html.js.map +1 -1
  55. package/id.cjs +1 -2
  56. package/id.cjs.map +1 -1
  57. package/id.js +23 -13
  58. package/id.js.map +1 -1
  59. package/imports.cjs +1 -1
  60. package/imports.cjs.map +1 -1
  61. package/imports.js +27 -18
  62. package/imports.js.map +1 -1
  63. package/math.cjs +1 -1
  64. package/math.cjs.map +1 -1
  65. package/math.js +10 -8
  66. package/math.js.map +1 -1
  67. package/media.cjs +1 -1
  68. package/media.cjs.map +1 -1
  69. package/media.js +94 -49
  70. package/media.js.map +1 -1
  71. package/mobx.cjs +1 -1
  72. package/mobx.cjs.map +1 -1
  73. package/mobx.js +123 -68
  74. package/mobx.js.map +1 -1
  75. package/ms.cjs +1 -1
  76. package/ms.cjs.map +1 -1
  77. package/ms.js +9 -8
  78. package/ms.js.map +1 -1
  79. package/number.cjs +1 -1
  80. package/number.cjs.map +1 -1
  81. package/number.js +7 -6
  82. package/number.js.map +1 -1
  83. package/package.json +28 -27
  84. package/parser.cjs +1 -1
  85. package/parser.cjs.map +1 -1
  86. package/parser.js +63 -28
  87. package/parser.js.map +1 -1
  88. package/price.cjs +1 -1
  89. package/price.cjs.map +1 -1
  90. package/price.js +14 -7
  91. package/price.js.map +1 -1
  92. package/random.cjs +1 -1
  93. package/random.cjs.map +1 -1
  94. package/random.js +22 -9
  95. package/random.js.map +1 -1
  96. package/react.cjs +1 -1
  97. package/react.cjs.map +1 -1
  98. package/react.js +195 -130
  99. package/react.js.map +1 -1
  100. package/sound.cjs +1 -1
  101. package/sound.cjs.map +1 -1
  102. package/sound.js +8 -4
  103. package/sound.js.map +1 -1
  104. package/text.cjs +1 -1
  105. package/text.cjs.map +1 -1
  106. package/text.js +30 -14
  107. package/text.js.map +1 -1
  108. package/type-guard.cjs +1 -1
  109. package/type-guard.cjs.map +1 -1
  110. package/type-guard.js +58 -38
  111. package/type-guard.js.map +1 -1
  112. package/utility-types.d.ts +15 -0
  113. package/utils/types.d.ts +15 -0
  114. package/utils/types.d.ts.map +1 -1
  115. package/vibrate.cjs +1 -1
  116. package/vibrate.cjs.map +1 -1
  117. package/vibrate.js +5 -3
  118. package/vibrate.js.map +1 -1
package/date-time.js CHANGED
@@ -1,314 +1,396 @@
1
- import S from "dayjs";
2
- import { format as J } from "yummies/format";
3
- import { unitsToMs as k } from "yummies/ms";
4
- import { declension as O } from "yummies/text";
5
- import { typeGuard as U } from "yummies/type-guard";
6
- function V(r) {
7
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
1
+ import dayjs from "dayjs";
2
+ import { format } from "yummies/format";
3
+ import { unitsToMs } from "yummies/ms";
4
+ import { declension } from "yummies/text";
5
+ import { typeGuard } from "yummies/type-guard";
6
+ function getDefaultExportFromCjs(x) {
7
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
8
8
  }
9
- var F = { exports: {} }, Z = F.exports, A;
10
- function K() {
11
- return A || (A = 1, function(r, n) {
12
- (function(u, e) {
13
- r.exports = e();
14
- })(Z, function() {
15
- var u, e, c = 1e3, a = 6e4, _ = 36e5, f = 864e5, T = /\[([^\]]+)]|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 = 31536e6, h = 2628e6, v = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, Y = { years: m, months: h, days: f, hours: _, minutes: a, seconds: c, milliseconds: 1, weeks: 6048e5 }, w = function(i) {
16
- return i instanceof j;
17
- }, o = function(i, s, t) {
18
- return new j(i, t, s.$l);
19
- }, M = function(i) {
20
- return e.p(i) + "s";
21
- }, b = function(i) {
22
- return i < 0;
23
- }, l = function(i) {
24
- return b(i) ? Math.ceil(i) : Math.floor(i);
25
- }, x = function(i) {
26
- return Math.abs(i);
27
- }, L = function(i, s) {
28
- return i ? b(i) ? { negative: !0, format: "" + x(i) + s } : { negative: !1, format: "" + i + s } : { negative: !1, format: "" };
29
- }, j = function() {
30
- function i(t, d, $) {
31
- var p = this;
32
- if (this.$d = {}, this.$l = $, t === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), d) return o(t * Y[M(d)], this);
33
- if (typeof t == "number") return this.$ms = t, this.parseFromMilliseconds(), this;
34
- if (typeof t == "object") return Object.keys(t).forEach(function(H) {
35
- p.$d[M(H)] = t[H];
9
+ var duration$2 = { exports: {} };
10
+ var duration$1 = duration$2.exports;
11
+ var hasRequiredDuration;
12
+ function requireDuration() {
13
+ if (hasRequiredDuration) return duration$2.exports;
14
+ hasRequiredDuration = 1;
15
+ (function(module, exports) {
16
+ !function(t, s) {
17
+ module.exports = s();
18
+ }(duration$1, function() {
19
+ var t, s, n = 1e3, i = 6e4, e = 36e5, r = 864e5, o = /\[([^\]]+)]|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, u = 31536e6, d = 2628e6, a = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h = { years: u, months: d, days: r, hours: e, minutes: i, seconds: n, milliseconds: 1, weeks: 6048e5 }, c = function(t2) {
20
+ return t2 instanceof g;
21
+ }, f = function(t2, s2, n2) {
22
+ return new g(t2, n2, s2.$l);
23
+ }, m = function(t2) {
24
+ return s.p(t2) + "s";
25
+ }, l = function(t2) {
26
+ return t2 < 0;
27
+ }, $ = function(t2) {
28
+ return l(t2) ? Math.ceil(t2) : Math.floor(t2);
29
+ }, y = function(t2) {
30
+ return Math.abs(t2);
31
+ }, v = function(t2, s2) {
32
+ return t2 ? l(t2) ? { negative: true, format: "" + y(t2) + s2 } : { negative: false, format: "" + t2 + s2 } : { negative: false, format: "" };
33
+ }, g = function() {
34
+ function l2(t2, s2, n2) {
35
+ var i2 = this;
36
+ if (this.$d = {}, this.$l = n2, void 0 === t2 && (this.$ms = 0, this.parseFromMilliseconds()), s2) return f(t2 * h[m(s2)], this);
37
+ if ("number" == typeof t2) return this.$ms = t2, this.parseFromMilliseconds(), this;
38
+ if ("object" == typeof t2) return Object.keys(t2).forEach(function(s3) {
39
+ i2.$d[m(s3)] = t2[s3];
36
40
  }), this.calMilliseconds(), this;
37
- if (typeof t == "string") {
38
- var y = t.match(v);
39
- if (y) {
40
- var D = y.slice(2).map(function(H) {
41
- return H != null ? Number(H) : 0;
41
+ if ("string" == typeof t2) {
42
+ var e2 = t2.match(a);
43
+ if (e2) {
44
+ var r2 = e2.slice(2).map(function(t3) {
45
+ return null != t3 ? Number(t3) : 0;
42
46
  });
43
- return this.$d.years = D[0], this.$d.months = D[1], this.$d.weeks = D[2], this.$d.days = D[3], this.$d.hours = D[4], this.$d.minutes = D[5], this.$d.seconds = D[6], this.calMilliseconds(), this;
47
+ return this.$d.years = r2[0], this.$d.months = r2[1], this.$d.weeks = r2[2], this.$d.days = r2[3], this.$d.hours = r2[4], this.$d.minutes = r2[5], this.$d.seconds = r2[6], this.calMilliseconds(), this;
44
48
  }
45
49
  }
46
50
  return this;
47
51
  }
48
- var s = i.prototype;
49
- return s.calMilliseconds = function() {
50
- var t = this;
51
- this.$ms = Object.keys(this.$d).reduce(function(d, $) {
52
- return d + (t.$d[$] || 0) * Y[$];
52
+ var y2 = l2.prototype;
53
+ return y2.calMilliseconds = function() {
54
+ var t2 = this;
55
+ this.$ms = Object.keys(this.$d).reduce(function(s2, n2) {
56
+ return s2 + (t2.$d[n2] || 0) * h[n2];
53
57
  }, 0);
54
- }, s.parseFromMilliseconds = function() {
55
- var t = this.$ms;
56
- this.$d.years = l(t / m), t %= m, this.$d.months = l(t / h), t %= h, this.$d.days = l(t / f), t %= f, this.$d.hours = l(t / _), t %= _, this.$d.minutes = l(t / a), t %= a, this.$d.seconds = l(t / c), t %= c, this.$d.milliseconds = t;
57
- }, s.toISOString = function() {
58
- var t = L(this.$d.years, "Y"), d = L(this.$d.months, "M"), $ = +this.$d.days || 0;
59
- this.$d.weeks && ($ += 7 * this.$d.weeks);
60
- var p = L($, "D"), y = L(this.$d.hours, "H"), D = L(this.$d.minutes, "M"), H = this.$d.seconds || 0;
61
- this.$d.milliseconds && (H += this.$d.milliseconds / 1e3, H = Math.round(1e3 * H) / 1e3);
62
- var q = L(H, "S"), C = t.negative || d.negative || p.negative || y.negative || D.negative || q.negative, G = y.format || D.format || q.format ? "T" : "", E = (C ? "-" : "") + "P" + t.format + d.format + p.format + G + y.format + D.format + q.format;
63
- return E === "P" || E === "-P" ? "P0D" : E;
64
- }, s.toJSON = function() {
58
+ }, y2.parseFromMilliseconds = function() {
59
+ var t2 = this.$ms;
60
+ this.$d.years = $(t2 / u), t2 %= u, this.$d.months = $(t2 / d), t2 %= d, this.$d.days = $(t2 / r), t2 %= r, this.$d.hours = $(t2 / e), t2 %= e, this.$d.minutes = $(t2 / i), t2 %= i, this.$d.seconds = $(t2 / n), t2 %= n, this.$d.milliseconds = t2;
61
+ }, y2.toISOString = function() {
62
+ var t2 = v(this.$d.years, "Y"), s2 = v(this.$d.months, "M"), n2 = +this.$d.days || 0;
63
+ this.$d.weeks && (n2 += 7 * this.$d.weeks);
64
+ var i2 = v(n2, "D"), e2 = v(this.$d.hours, "H"), r2 = v(this.$d.minutes, "M"), o2 = this.$d.seconds || 0;
65
+ this.$d.milliseconds && (o2 += this.$d.milliseconds / 1e3, o2 = Math.round(1e3 * o2) / 1e3);
66
+ var u2 = v(o2, "S"), d2 = t2.negative || s2.negative || i2.negative || e2.negative || r2.negative || u2.negative, a2 = e2.format || r2.format || u2.format ? "T" : "", h2 = (d2 ? "-" : "") + "P" + t2.format + s2.format + i2.format + a2 + e2.format + r2.format + u2.format;
67
+ return "P" === h2 || "-P" === h2 ? "P0D" : h2;
68
+ }, y2.toJSON = function() {
65
69
  return this.toISOString();
66
- }, s.format = function(t) {
67
- var d = t || "YYYY-MM-DDTHH:mm:ss", $ = { Y: this.$d.years, YY: e.s(this.$d.years, 2, "0"), YYYY: e.s(this.$d.years, 4, "0"), M: this.$d.months, MM: e.s(this.$d.months, 2, "0"), D: this.$d.days, DD: e.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: e.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: e.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: e.s(this.$d.seconds, 2, "0"), SSS: e.s(this.$d.milliseconds, 3, "0") };
68
- return d.replace(T, function(p, y) {
69
- return y || String($[p]);
70
+ }, y2.format = function(t2) {
71
+ var n2 = t2 || "YYYY-MM-DDTHH:mm:ss", i2 = { Y: this.$d.years, YY: s.s(this.$d.years, 2, "0"), YYYY: s.s(this.$d.years, 4, "0"), M: this.$d.months, MM: s.s(this.$d.months, 2, "0"), D: this.$d.days, DD: s.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: s.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: s.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: s.s(this.$d.seconds, 2, "0"), SSS: s.s(this.$d.milliseconds, 3, "0") };
72
+ return n2.replace(o, function(t3, s2) {
73
+ return s2 || String(i2[t3]);
70
74
  });
71
- }, s.as = function(t) {
72
- return this.$ms / Y[M(t)];
73
- }, s.get = function(t) {
74
- var d = this.$ms, $ = M(t);
75
- return $ === "milliseconds" ? d %= 1e3 : d = $ === "weeks" ? l(d / Y[$]) : this.$d[$], d || 0;
76
- }, s.add = function(t, d, $) {
77
- var p;
78
- return p = d ? t * Y[M(d)] : w(t) ? t.$ms : o(t, this).$ms, o(this.$ms + p * ($ ? -1 : 1), this);
79
- }, s.subtract = function(t, d) {
80
- return this.add(t, d, !0);
81
- }, s.locale = function(t) {
82
- var d = this.clone();
83
- return d.$l = t, d;
84
- }, s.clone = function() {
85
- return o(this.$ms, this);
86
- }, s.humanize = function(t) {
87
- return u().add(this.$ms, "ms").locale(this.$l).fromNow(!t);
88
- }, s.valueOf = function() {
75
+ }, y2.as = function(t2) {
76
+ return this.$ms / h[m(t2)];
77
+ }, y2.get = function(t2) {
78
+ var s2 = this.$ms, n2 = m(t2);
79
+ return "milliseconds" === n2 ? s2 %= 1e3 : s2 = "weeks" === n2 ? $(s2 / h[n2]) : this.$d[n2], s2 || 0;
80
+ }, y2.add = function(t2, s2, n2) {
81
+ var i2;
82
+ return i2 = s2 ? t2 * h[m(s2)] : c(t2) ? t2.$ms : f(t2, this).$ms, f(this.$ms + i2 * (n2 ? -1 : 1), this);
83
+ }, y2.subtract = function(t2, s2) {
84
+ return this.add(t2, s2, true);
85
+ }, y2.locale = function(t2) {
86
+ var s2 = this.clone();
87
+ return s2.$l = t2, s2;
88
+ }, y2.clone = function() {
89
+ return f(this.$ms, this);
90
+ }, y2.humanize = function(s2) {
91
+ return t().add(this.$ms, "ms").locale(this.$l).fromNow(!s2);
92
+ }, y2.valueOf = function() {
89
93
  return this.asMilliseconds();
90
- }, s.milliseconds = function() {
94
+ }, y2.milliseconds = function() {
91
95
  return this.get("milliseconds");
92
- }, s.asMilliseconds = function() {
96
+ }, y2.asMilliseconds = function() {
93
97
  return this.as("milliseconds");
94
- }, s.seconds = function() {
98
+ }, y2.seconds = function() {
95
99
  return this.get("seconds");
96
- }, s.asSeconds = function() {
100
+ }, y2.asSeconds = function() {
97
101
  return this.as("seconds");
98
- }, s.minutes = function() {
102
+ }, y2.minutes = function() {
99
103
  return this.get("minutes");
100
- }, s.asMinutes = function() {
104
+ }, y2.asMinutes = function() {
101
105
  return this.as("minutes");
102
- }, s.hours = function() {
106
+ }, y2.hours = function() {
103
107
  return this.get("hours");
104
- }, s.asHours = function() {
108
+ }, y2.asHours = function() {
105
109
  return this.as("hours");
106
- }, s.days = function() {
110
+ }, y2.days = function() {
107
111
  return this.get("days");
108
- }, s.asDays = function() {
112
+ }, y2.asDays = function() {
109
113
  return this.as("days");
110
- }, s.weeks = function() {
114
+ }, y2.weeks = function() {
111
115
  return this.get("weeks");
112
- }, s.asWeeks = function() {
116
+ }, y2.asWeeks = function() {
113
117
  return this.as("weeks");
114
- }, s.months = function() {
118
+ }, y2.months = function() {
115
119
  return this.get("months");
116
- }, s.asMonths = function() {
120
+ }, y2.asMonths = function() {
117
121
  return this.as("months");
118
- }, s.years = function() {
122
+ }, y2.years = function() {
119
123
  return this.get("years");
120
- }, s.asYears = function() {
124
+ }, y2.asYears = function() {
121
125
  return this.as("years");
122
- }, i;
123
- }(), g = function(i, s, t) {
124
- return i.add(s.years() * t, "y").add(s.months() * t, "M").add(s.days() * t, "d").add(s.hours() * t, "h").add(s.minutes() * t, "m").add(s.seconds() * t, "s").add(s.milliseconds() * t, "ms");
126
+ }, l2;
127
+ }(), p = function(t2, s2, n2) {
128
+ return t2.add(s2.years() * n2, "y").add(s2.months() * n2, "M").add(s2.days() * n2, "d").add(s2.hours() * n2, "h").add(s2.minutes() * n2, "m").add(s2.seconds() * n2, "s").add(s2.milliseconds() * n2, "ms");
125
129
  };
126
- return function(i, s, t) {
127
- u = t, e = t().$utils(), t.duration = function(p, y) {
128
- var D = t.locale();
129
- return o(p, { $l: D }, y);
130
- }, t.isDuration = w;
131
- var d = s.prototype.add, $ = s.prototype.subtract;
132
- s.prototype.add = function(p, y) {
133
- return w(p) ? g(this, p, 1) : d.bind(this)(p, y);
134
- }, s.prototype.subtract = function(p, y) {
135
- return w(p) ? g(this, p, -1) : $.bind(this)(p, y);
130
+ return function(n2, i2, e2) {
131
+ t = e2, s = e2().$utils(), e2.duration = function(t2, s2) {
132
+ var n3 = e2.locale();
133
+ return f(t2, { $l: n3 }, s2);
134
+ }, e2.isDuration = c;
135
+ var r2 = i2.prototype.add, o2 = i2.prototype.subtract;
136
+ i2.prototype.add = function(t2, s2) {
137
+ return c(t2) ? p(this, t2, 1) : r2.bind(this)(t2, s2);
138
+ }, i2.prototype.subtract = function(t2, s2) {
139
+ return c(t2) ? p(this, t2, -1) : o2.bind(this)(t2, s2);
136
140
  };
137
141
  };
138
142
  });
139
- }(F)), F.exports;
143
+ })(duration$2);
144
+ return duration$2.exports;
140
145
  }
141
- var Q = K();
142
- const X = /* @__PURE__ */ V(Q);
143
- var P = { exports: {} }, tt = P.exports, B;
144
- function st() {
145
- return B || (B = 1, function(r, n) {
146
- (function(u, e) {
147
- r.exports = e();
148
- })(tt, function() {
149
- return function(u, e, c) {
150
- u = u || {};
151
- var a = e.prototype, _ = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
152
- function f(m, h, v, Y) {
153
- return a.fromToBase(m, h, v, Y);
146
+ var durationExports = requireDuration();
147
+ const duration = /* @__PURE__ */ getDefaultExportFromCjs(durationExports);
148
+ var relativeTime$2 = { exports: {} };
149
+ var relativeTime$1 = relativeTime$2.exports;
150
+ var hasRequiredRelativeTime;
151
+ function requireRelativeTime() {
152
+ if (hasRequiredRelativeTime) return relativeTime$2.exports;
153
+ hasRequiredRelativeTime = 1;
154
+ (function(module, exports) {
155
+ !function(r, e) {
156
+ module.exports = e();
157
+ }(relativeTime$1, function() {
158
+ return function(r, e, t) {
159
+ r = r || {};
160
+ var n = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
161
+ function i(r2, e2, t2, o2) {
162
+ return n.fromToBase(r2, e2, t2, o2);
154
163
  }
155
- c.en.relativeTime = _, a.fromToBase = function(m, h, v, Y, w) {
156
- for (var o, M, b, l = v.$locale().relativeTime || _, x = u.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], L = x.length, j = 0; j < L; j += 1) {
157
- var g = x[j];
158
- g.d && (o = Y ? c(m).diff(v, g.d, !0) : v.diff(m, g.d, !0));
159
- var i = (u.rounding || Math.round)(Math.abs(o));
160
- if (b = o > 0, i <= g.r || !g.r) {
161
- i <= 1 && j > 0 && (g = x[j - 1]);
162
- var s = l[g.l];
163
- w && (i = w("" + i)), M = typeof s == "string" ? s.replace("%d", i) : s(i, h, g.l, b);
164
+ t.en.relativeTime = o, n.fromToBase = function(e2, n2, i2, d2, u) {
165
+ for (var f, a, s, l = i2.$locale().relativeTime || o, h = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h.length, c = 0; c < m; c += 1) {
166
+ var y = h[c];
167
+ y.d && (f = d2 ? t(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
168
+ var p = (r.rounding || Math.round)(Math.abs(f));
169
+ if (s = f > 0, p <= y.r || !y.r) {
170
+ p <= 1 && c > 0 && (y = h[c - 1]);
171
+ var v = l[y.l];
172
+ u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n2, y.l, s);
164
173
  break;
165
174
  }
166
175
  }
167
- if (h) return M;
168
- var t = b ? l.future : l.past;
169
- return typeof t == "function" ? t(M) : t.replace("%s", M);
170
- }, a.to = function(m, h) {
171
- return f(m, h, this, !0);
172
- }, a.from = function(m, h) {
173
- return f(m, h, this);
176
+ if (n2) return a;
177
+ var M = s ? l.future : l.past;
178
+ return "function" == typeof M ? M(a) : M.replace("%s", a);
179
+ }, n.to = function(r2, e2) {
180
+ return i(r2, e2, this, true);
181
+ }, n.from = function(r2, e2) {
182
+ return i(r2, e2, this);
174
183
  };
175
- var T = function(m) {
176
- return m.$u ? c.utc() : c();
184
+ var d = function(r2) {
185
+ return r2.$u ? t.utc() : t();
177
186
  };
178
- a.toNow = function(m) {
179
- return this.to(T(this), m);
180
- }, a.fromNow = function(m) {
181
- return this.from(T(this), m);
187
+ n.toNow = function(r2) {
188
+ return this.to(d(this), r2);
189
+ }, n.fromNow = function(r2) {
190
+ return this.from(d(this), r2);
182
191
  };
183
192
  };
184
193
  });
185
- }(P)), P.exports;
194
+ })(relativeTime$2);
195
+ return relativeTime$2.exports;
186
196
  }
187
- var rt = st();
188
- const et = /* @__PURE__ */ V(rt);
189
- var R = { exports: {} }, nt = R.exports, I;
190
- function it() {
191
- return I || (I = 1, function(r, n) {
192
- (function(u, e) {
193
- r.exports = e(S);
194
- })(nt, function(u) {
195
- function e(o) {
196
- return o && typeof o == "object" && "default" in o ? o : { default: o };
197
+ var relativeTimeExports = requireRelativeTime();
198
+ const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
199
+ var ru$1 = { exports: {} };
200
+ var ru = ru$1.exports;
201
+ var hasRequiredRu;
202
+ function requireRu() {
203
+ if (hasRequiredRu) return ru$1.exports;
204
+ hasRequiredRu = 1;
205
+ (function(module, exports) {
206
+ !function(_, t) {
207
+ module.exports = t(dayjs);
208
+ }(ru, function(_) {
209
+ function t(_2) {
210
+ return _2 && "object" == typeof _2 && "default" in _2 ? _2 : { default: _2 };
197
211
  }
198
- var c = e(u), a = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"), _ = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"), f = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"), T = "янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_"), m = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
199
- function h(o, M, b) {
200
- var l, x;
201
- return b === "m" ? M ? "минута" : "минуту" : o + " " + (l = +o, x = { mm: M ? "минута_минуты_минут" : "минуту_минуты_минут", hh: "час_часа_часов", dd: "день_дня_дней", MM: "месяц_месяца_месяцев", yy: "год_года_лет" }[b].split("_"), l % 10 == 1 && l % 100 != 11 ? x[0] : l % 10 >= 2 && l % 10 <= 4 && (l % 100 < 10 || l % 100 >= 20) ? x[1] : x[2]);
212
+ var e = t(_), n = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"), s = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"), r = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"), o = "янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_"), i = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
213
+ function d(_2, t2, e2) {
214
+ var n2, s2;
215
+ return "m" === e2 ? t2 ? "минута" : "минуту" : _2 + " " + (n2 = +_2, s2 = { mm: t2 ? "минута_минуты_минут" : "минуту_минуты_минут", hh: "час_часа_часов", dd: "день_дня_дней", MM: "месяц_месяца_месяцев", yy: "год_года_лет" }[e2].split("_"), n2 % 10 == 1 && n2 % 100 != 11 ? s2[0] : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? s2[1] : s2[2]);
202
216
  }
203
- var v = function(o, M) {
204
- return m.test(M) ? a[o.month()] : _[o.month()];
217
+ var u = function(_2, t2) {
218
+ return i.test(t2) ? n[_2.month()] : s[_2.month()];
205
219
  };
206
- v.s = _, v.f = a;
207
- var Y = function(o, M) {
208
- return m.test(M) ? f[o.month()] : T[o.month()];
220
+ u.s = s, u.f = n;
221
+ var a = function(_2, t2) {
222
+ return i.test(t2) ? r[_2.month()] : o[_2.month()];
209
223
  };
210
- Y.s = T, Y.f = f;
211
- var w = { name: "ru", weekdays: "воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"), weekdaysShort: "вск_пнд_втр_срд_чтв_птн_сбт".split("_"), weekdaysMin: "вс_пн_вт_ср_чт_пт_сб".split("_"), months: v, monthsShort: Y, weekStart: 1, yearStart: 4, formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD.MM.YYYY", LL: "D MMMM YYYY г.", LLL: "D MMMM YYYY г., H:mm", LLLL: "dddd, D MMMM YYYY г., H:mm" }, relativeTime: { future: "через %s", past: "%s назад", s: "несколько секунд", m: h, mm: h, h: "час", hh: h, d: "день", dd: h, M: "месяц", MM: h, y: "год", yy: h }, ordinal: function(o) {
212
- return o;
213
- }, meridiem: function(o) {
214
- return o < 4 ? "ночи" : o < 12 ? "утра" : o < 17 ? "дня" : "вечера";
224
+ a.s = o, a.f = r;
225
+ var m = { name: "ru", weekdays: "воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"), weekdaysShort: "вск_пнд_втр_срд_чтв_птн_сбт".split("_"), weekdaysMin: "вс_пн_вт_ср_чт_пт_сб".split("_"), months: u, monthsShort: a, weekStart: 1, yearStart: 4, formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD.MM.YYYY", LL: "D MMMM YYYY г.", LLL: "D MMMM YYYY г., H:mm", LLLL: "dddd, D MMMM YYYY г., H:mm" }, relativeTime: { future: "через %s", past: "%s назад", s: "несколько секунд", m: d, mm: d, h: "час", hh: d, d: "день", dd: d, M: "месяц", MM: d, y: "год", yy: d }, ordinal: function(_2) {
226
+ return _2;
227
+ }, meridiem: function(_2) {
228
+ return _2 < 4 ? "ночи" : _2 < 12 ? "утра" : _2 < 17 ? "дня" : "вечера";
215
229
  } };
216
- return c.default.locale(w, null, !0), w;
230
+ return e.default.locale(m, null, true), m;
217
231
  });
218
- }(R)), R.exports;
232
+ })(ru$1);
233
+ return ru$1.exports;
219
234
  }
220
- it();
221
- S.extend(et);
222
- S.extend(X);
223
- S.locale("ru");
224
- const W = (r, n) => U.isNumber(r) ? n ? S.duration(r) : S(r) : S.isDayjs(r) ? r : S(r), mt = (r, n) => {
225
- const u = n?.format, e = n?.pattern, c = n?.asTime;
226
- if (r = W(r, c), U.isUndefined(r) || !r.isValid())
227
- return J.NO_VALUE;
228
- if (e)
229
- return r.format(e);
230
- switch (u) {
231
- case "human":
232
- return r.fromNow();
233
- case "spent-time":
234
- return r.fromNow(!0);
235
- case "full":
236
- return r.format("DD MMM YYYY HH:mm:ss");
237
- case "short":
238
- return r.format("DD MMM HH:mm");
239
- case "time":
240
- return r.format("HH:mm:ss");
241
- case "time-short":
242
- return r.format("HH:mm");
243
- case "day":
244
- return r.format("DD MMM YYYY");
245
- case "month":
246
- return r.format("MMMM YYYY");
247
- default:
248
- return r.format("DD.MM.YYYY");
235
+ requireRu();
236
+ dayjs.extend(relativeTime);
237
+ dayjs.extend(duration);
238
+ dayjs.locale("ru");
239
+ const toLibFormat = (value, asTime) => {
240
+ if (typeGuard.isNumber(value)) {
241
+ if (asTime) {
242
+ return dayjs.duration(value);
243
+ }
244
+ return dayjs(value);
245
+ } else if (dayjs.isDayjs(value)) {
246
+ return value;
247
+ } else {
248
+ return dayjs(value);
249
249
  }
250
- }, z = (r) => {
251
- let n = Math.max(r, 0);
252
- const u = Math.floor(n / k.day);
253
- n = n % k.day;
254
- const e = Math.floor(n / k.hour);
255
- n = n % k.hour;
256
- const c = Math.floor(n / k.min);
257
- n = n % k.min;
258
- const a = Math.floor(n / k.sec);
259
- n = n % k.sec;
260
- const _ = Math.floor(n);
250
+ };
251
+ const formatDate = (value, settings) => {
252
+ const dateFormat = settings?.format;
253
+ const datePattern = settings?.pattern;
254
+ const asTime = settings?.asTime;
255
+ value = toLibFormat(value, asTime);
256
+ if (typeGuard.isUndefined(value) || !value.isValid()) {
257
+ return format.NO_VALUE;
258
+ }
259
+ if (datePattern) {
260
+ return value.format(datePattern);
261
+ }
262
+ switch (dateFormat) {
263
+ case "human": {
264
+ return value.fromNow();
265
+ }
266
+ case "spent-time": {
267
+ return value.fromNow(true);
268
+ }
269
+ case "full": {
270
+ return value.format("DD MMM YYYY HH:mm:ss");
271
+ }
272
+ case "short": {
273
+ return value.format("DD MMM HH:mm");
274
+ }
275
+ case "time": {
276
+ return value.format("HH:mm:ss");
277
+ }
278
+ case "time-short": {
279
+ return value.format("HH:mm");
280
+ }
281
+ case "day": {
282
+ return value.format("DD MMM YYYY");
283
+ }
284
+ case "month": {
285
+ return value.format("MMMM YYYY");
286
+ }
287
+ default: {
288
+ return value.format("DD.MM.YYYY");
289
+ }
290
+ }
291
+ };
292
+ const dayTimeDuration = (timeInMs) => {
293
+ let left = Math.max(timeInMs, 0);
294
+ const days = Math.floor(left / unitsToMs.day);
295
+ left = left % unitsToMs.day;
296
+ const hours = Math.floor(left / unitsToMs.hour);
297
+ left = left % unitsToMs.hour;
298
+ const minutes = Math.floor(left / unitsToMs.min);
299
+ left = left % unitsToMs.min;
300
+ const seconds = Math.floor(left / unitsToMs.sec);
301
+ left = left % unitsToMs.sec;
302
+ const milliseconds = Math.floor(left);
261
303
  return {
262
- days: u,
263
- hours: e,
264
- minutes: c,
265
- seconds: a,
266
- milliseconds: _
304
+ days,
305
+ hours,
306
+ minutes,
307
+ seconds,
308
+ milliseconds
267
309
  };
268
- }, ft = (r, ...n) => {
269
- let u = W(r);
270
- for (let e = 0; e < n.length; e += 2) {
271
- const c = n[e], a = n[e + 1];
272
- a != null && (u = u.add(c, a));
310
+ };
311
+ const changeDate = (date, ...args) => {
312
+ let wrappedDate = toLibFormat(date);
313
+ for (let i = 0; i < args.length; i += 2) {
314
+ const amount = args[i];
315
+ const unit = args[i + 1];
316
+ if (unit != null) {
317
+ wrappedDate = wrappedDate.add(amount, unit);
318
+ }
273
319
  }
274
- return u.toDate();
275
- }, ht = (r) => {
276
- const { days: n, hours: u, milliseconds: e, minutes: c, seconds: a } = z(r);
320
+ return wrappedDate.toDate();
321
+ };
322
+ const timeDuration = (timeInMs) => {
323
+ const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
277
324
  return {
278
- hours: u + k.day * n,
279
- milliseconds: e,
280
- minutes: c,
281
- seconds: a
325
+ hours: hours + unitsToMs.day * days,
326
+ milliseconds,
327
+ minutes,
328
+ seconds
282
329
  };
283
- }, N = {
330
+ };
331
+ const durationFormatLabels = {
284
332
  days: { compact: "д", full: ["день", "дня", "дней"] },
285
333
  hours: { compact: "ч", full: ["час", "часа", "часов"] },
286
334
  minutes: { compact: "мин", full: ["минута", "минуты", "минут"] },
287
335
  seconds: { compact: "сек", full: ["секунда", "секунды", "секунд"] }
288
336
  };
289
- function lt(...r) {
290
- let n = !1, u = 0;
291
- if (r[0] instanceof Date) {
292
- const T = S(r[0]);
293
- u = S(r[1]).diff(T, "ms"), n = r[2] === !0;
294
- } else
295
- u = r[0], n = r[1] === !0;
296
- const { days: e, hours: c, minutes: a, seconds: _ } = z(u), f = [];
297
- return e && (n ? f.push(`${e} ${N.days.compact}`) : f.push(
298
- `${e} ${O(e, N.days.full)}`
299
- )), c && (n ? f.push(`${c} ${N.hours.compact}`) : f.push(
300
- `${c} ${O(c, N.hours.full)}`
301
- )), a && (n ? f.push(`${a} ${N.minutes.compact}`) : f.push(
302
- `${a} ${O(a, N.minutes.full)}`
303
- )), _ && (n ? f.push(`${_} ${N.seconds.compact}`) : f.push(
304
- `${_} ${O(_, N.seconds.full)}`
305
- )), f.join(" ");
337
+ function getFormatDuration(...args) {
338
+ let compact = false;
339
+ let diff = 0;
340
+ if (args[0] instanceof Date) {
341
+ const startedDate = dayjs(args[0]);
342
+ const endedDate = dayjs(args[1]);
343
+ diff = endedDate.diff(startedDate, "ms");
344
+ compact = args[2] === true;
345
+ } else {
346
+ diff = args[0];
347
+ compact = args[1] === true;
348
+ }
349
+ const { days, hours, minutes, seconds } = dayTimeDuration(diff);
350
+ const formattedParts = [];
351
+ if (days) {
352
+ if (compact) {
353
+ formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
354
+ } else {
355
+ formattedParts.push(
356
+ `${days} ${declension(days, durationFormatLabels.days.full)}`
357
+ );
358
+ }
359
+ }
360
+ if (hours) {
361
+ if (compact) {
362
+ formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
363
+ } else {
364
+ formattedParts.push(
365
+ `${hours} ${declension(hours, durationFormatLabels.hours.full)}`
366
+ );
367
+ }
368
+ }
369
+ if (minutes) {
370
+ if (compact) {
371
+ formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
372
+ } else {
373
+ formattedParts.push(
374
+ `${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`
375
+ );
376
+ }
377
+ }
378
+ if (seconds) {
379
+ if (compact) {
380
+ formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
381
+ } else {
382
+ formattedParts.push(
383
+ `${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`
384
+ );
385
+ }
386
+ }
387
+ return formattedParts.join(" ");
306
388
  }
307
389
  export {
308
- ft as changeDate,
309
- z as dayTimeDuration,
310
- mt as formatDate,
311
- lt as getFormatDuration,
312
- ht as timeDuration
390
+ changeDate,
391
+ dayTimeDuration,
392
+ formatDate,
393
+ getFormatDuration,
394
+ timeDuration
313
395
  };
314
396
  //# sourceMappingURL=date-time.js.map