yummies 7.11.0 → 7.13.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 (159) hide show
  1. package/README.md +5 -87
  2. package/async.cjs +179 -48
  3. package/async.cjs.map +1 -1
  4. package/async.d.ts +125 -7
  5. package/async.js +180 -54
  6. package/async.js.map +1 -1
  7. package/chunk-CVq3Gv4J.cjs +50 -0
  8. package/chunk-YKewjYmz.js +37 -0
  9. package/common.cjs +48 -8
  10. package/common.cjs.map +1 -1
  11. package/common.d.ts +53 -2
  12. package/common.js +49 -11
  13. package/common.js.map +1 -1
  14. package/complex.cjs +275 -128
  15. package/complex.cjs.map +1 -1
  16. package/complex.d.ts +66 -0
  17. package/complex.js +275 -133
  18. package/complex.js.map +1 -1
  19. package/cookie.cjs +17 -7
  20. package/cookie.cjs.map +1 -1
  21. package/cookie.d.ts +26 -0
  22. package/cookie.js +18 -9
  23. package/cookie.js.map +1 -1
  24. package/css.cjs +163 -39
  25. package/css.cjs.map +1 -1
  26. package/css.d.ts +115 -6
  27. package/css.js +159 -41
  28. package/css.js.map +1 -1
  29. package/data.cjs +90 -55
  30. package/data.cjs.map +1 -1
  31. package/data.d.ts +50 -0
  32. package/data.js +91 -61
  33. package/data.js.map +1 -1
  34. package/date-time.cjs +594 -412
  35. package/date-time.cjs.map +1 -1
  36. package/date-time.d.ts +105 -0
  37. package/date-time.js +591 -421
  38. package/date-time.js.map +1 -1
  39. package/device.cjs +65 -23
  40. package/device.cjs.map +1 -1
  41. package/device.d.ts +49 -0
  42. package/device.js +66 -31
  43. package/device.js.map +1 -1
  44. package/encodings.cjs +275 -266
  45. package/encodings.cjs.map +1 -1
  46. package/encodings.d.ts +25 -0
  47. package/encodings.js +276 -268
  48. package/encodings.js.map +1 -1
  49. package/errors.cjs +36 -18
  50. package/errors.cjs.map +1 -1
  51. package/errors.d.ts +17 -0
  52. package/errors.js +35 -19
  53. package/errors.js.map +1 -1
  54. package/file.cjs +58 -24
  55. package/file.cjs.map +1 -1
  56. package/file.d.ts +32 -0
  57. package/file.js +59 -27
  58. package/file.js.map +1 -1
  59. package/format.cjs +125 -83
  60. package/format.cjs.map +1 -1
  61. package/format.d.ts +18 -0
  62. package/format.js +118 -82
  63. package/format.js.map +1 -1
  64. package/html.cjs +242 -137
  65. package/html.cjs.map +1 -1
  66. package/html.d.ts +81 -0
  67. package/html.js +239 -150
  68. package/html.js.map +1 -1
  69. package/id.cjs +90 -17
  70. package/id.cjs.map +1 -1
  71. package/id.d.ts +16 -0
  72. package/id.js +89 -24
  73. package/id.js.map +1 -1
  74. package/imports.cjs +57 -29
  75. package/imports.cjs.map +1 -1
  76. package/imports.d.ts +24 -0
  77. package/imports.js +56 -31
  78. package/imports.js.map +1 -1
  79. package/math.cjs +32 -6
  80. package/math.cjs.map +1 -1
  81. package/math.d.ts +33 -0
  82. package/math.js +33 -10
  83. package/math.js.map +1 -1
  84. package/media.cjs +291 -84
  85. package/media.cjs.map +1 -1
  86. package/media.d.ts +204 -2
  87. package/media.js +290 -93
  88. package/media.js.map +1 -1
  89. package/mobx.cjs +449 -193
  90. package/mobx.cjs.map +1 -1
  91. package/mobx.d.ts +108 -0
  92. package/mobx.js +447 -200
  93. package/mobx.js.map +1 -1
  94. package/ms.cjs +37 -10
  95. package/ms.cjs.map +1 -1
  96. package/ms.d.ts +16 -0
  97. package/ms.js +38 -13
  98. package/ms.js.map +1 -1
  99. package/number.cjs +29 -7
  100. package/number.cjs.map +1 -1
  101. package/number.d.ts +16 -0
  102. package/number.js +30 -9
  103. package/number.js.map +1 -1
  104. package/package.json +11 -3
  105. package/parser.cjs +117 -64
  106. package/parser.cjs.map +1 -1
  107. package/parser.d.ts +17 -0
  108. package/parser.js +111 -64
  109. package/parser.js.map +1 -1
  110. package/price.cjs +24 -18
  111. package/price.cjs.map +1 -1
  112. package/price.d.ts +24 -0
  113. package/price.js +25 -20
  114. package/price.js.map +1 -1
  115. package/random.cjs +95 -13
  116. package/random.cjs.map +1 -1
  117. package/random.d.ts +80 -0
  118. package/random.js +96 -22
  119. package/random.js.map +1 -1
  120. package/react.cjs +673 -214
  121. package/react.cjs.map +1 -1
  122. package/react.d.ts +21 -0
  123. package/react.js +674 -239
  124. package/react.js.map +1 -1
  125. package/sound.cjs +30 -9
  126. package/sound.cjs.map +1 -1
  127. package/sound.d.ts +16 -0
  128. package/sound.js +31 -11
  129. package/sound.js.map +1 -1
  130. package/storage.cjs +49 -50
  131. package/storage.cjs.map +1 -1
  132. package/storage.d.ts +24 -0
  133. package/storage.js +50 -53
  134. package/storage.js.map +1 -1
  135. package/text.cjs +67 -34
  136. package/text.cjs.map +1 -1
  137. package/text.d.ts +16 -0
  138. package/text.js +68 -37
  139. package/text.js.map +1 -1
  140. package/type-guard.cjs +292 -72
  141. package/type-guard.cjs.map +1 -1
  142. package/type-guard.d.ts +18 -0
  143. package/type-guard.js +288 -73
  144. package/type-guard.js.map +1 -1
  145. package/types.cjs +0 -2
  146. package/types.d.ts +41 -0
  147. package/types.global.cjs +0 -2
  148. package/types.global.d.ts +41 -0
  149. package/types.global.js +0 -2
  150. package/types.js +0 -2
  151. package/vibrate.cjs +47 -6
  152. package/vibrate.cjs.map +1 -1
  153. package/vibrate.d.ts +39 -1
  154. package/vibrate.js +48 -8
  155. package/vibrate.js.map +1 -1
  156. package/types.cjs.map +0 -1
  157. package/types.global.cjs.map +0 -1
  158. package/types.global.js.map +0 -1
  159. package/types.js.map +0 -1
package/date-time.js CHANGED
@@ -1,433 +1,603 @@
1
- import dayjs from "dayjs";
1
+ import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-YKewjYmz.js";
2
+ import { typeGuard } from "yummies/type-guard";
2
3
  import { format } from "yummies/format";
3
- import { unitsToMs, ms } from "yummies/ms";
4
+ import dayjs from "dayjs";
5
+ import { ms, unitsToMs } from "yummies/ms";
4
6
  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
- }
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];
40
- })), this.calMilliseconds(), this;
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;
46
- }));
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;
48
- }
49
- }
50
- return this;
51
- }
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];
57
- }), 0);
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() {
69
- return this.toISOString();
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]);
74
- }));
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() {
93
- return this.asMilliseconds();
94
- }, y2.milliseconds = function() {
95
- return this.get("milliseconds");
96
- }, y2.asMilliseconds = function() {
97
- return this.as("milliseconds");
98
- }, y2.seconds = function() {
99
- return this.get("seconds");
100
- }, y2.asSeconds = function() {
101
- return this.as("seconds");
102
- }, y2.minutes = function() {
103
- return this.get("minutes");
104
- }, y2.asMinutes = function() {
105
- return this.as("minutes");
106
- }, y2.hours = function() {
107
- return this.get("hours");
108
- }, y2.asHours = function() {
109
- return this.as("hours");
110
- }, y2.days = function() {
111
- return this.get("days");
112
- }, y2.asDays = function() {
113
- return this.as("days");
114
- }, y2.weeks = function() {
115
- return this.get("weeks");
116
- }, y2.asWeeks = function() {
117
- return this.as("weeks");
118
- }, y2.months = function() {
119
- return this.get("months");
120
- }, y2.asMonths = function() {
121
- return this.as("months");
122
- }, y2.years = function() {
123
- return this.get("years");
124
- }, y2.asYears = function() {
125
- return this.as("years");
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");
129
- };
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);
140
- };
141
- };
142
- }));
143
- })(duration$2);
144
- return duration$2.exports;
145
- }
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);
163
- }
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);
173
- break;
174
- }
175
- }
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);
183
- };
184
- var d = function(r2) {
185
- return r2.$u ? t.utc() : t();
186
- };
187
- n.toNow = function(r2) {
188
- return this.to(d(this), r2);
189
- }, n.fromNow = function(r2) {
190
- return this.from(d(this), r2);
191
- };
192
- };
193
- }));
194
- })(relativeTime$2);
195
- return relativeTime$2.exports;
196
- }
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 };
211
- }
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]);
216
- }
217
- var u = function(_2, t2) {
218
- return i.test(t2) ? n[_2.month()] : s[_2.month()];
219
- };
220
- u.s = s, u.f = n;
221
- var a = function(_2, t2) {
222
- return i.test(t2) ? r[_2.month()] : o[_2.month()];
223
- };
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 ? "дня" : "вечера";
229
- } };
230
- return e.default.locale(m, null, true), m;
231
- }));
232
- })(ru$1);
233
- return ru$1.exports;
234
- }
235
- requireRu();
236
- dayjs.extend(relativeTime);
237
- dayjs.extend(duration);
7
+ //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/duration.js
8
+ var require_duration = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9
+ (function(t, s) {
10
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = s() : "function" == typeof define && define.amd ? define(s) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_duration = s();
11
+ })(exports, (function() {
12
+ "use strict";
13
+ 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 = {
14
+ years: u,
15
+ months: d,
16
+ days: r,
17
+ hours: e,
18
+ minutes: i,
19
+ seconds: n,
20
+ milliseconds: 1,
21
+ weeks: 6048e5
22
+ }, c = function(t) {
23
+ return t instanceof g;
24
+ }, f = function(t, s, n) {
25
+ return new g(t, n, s.$l);
26
+ }, m = function(t) {
27
+ return s.p(t) + "s";
28
+ }, l = function(t) {
29
+ return t < 0;
30
+ }, $ = function(t) {
31
+ return l(t) ? Math.ceil(t) : Math.floor(t);
32
+ }, y = function(t) {
33
+ return Math.abs(t);
34
+ }, v = function(t, s) {
35
+ return t ? l(t) ? {
36
+ negative: !0,
37
+ format: "" + y(t) + s
38
+ } : {
39
+ negative: !1,
40
+ format: "" + t + s
41
+ } : {
42
+ negative: !1,
43
+ format: ""
44
+ };
45
+ }, g = function() {
46
+ function l(t, s, n) {
47
+ var i = this;
48
+ if (this.$d = {}, this.$l = n, void 0 === t && (this.$ms = 0, this.parseFromMilliseconds()), s) return f(t * h[m(s)], this);
49
+ if ("number" == typeof t) return this.$ms = t, this.parseFromMilliseconds(), this;
50
+ if ("object" == typeof t) return Object.keys(t).forEach((function(s) {
51
+ i.$d[m(s)] = t[s];
52
+ })), this.calMilliseconds(), this;
53
+ if ("string" == typeof t) {
54
+ var e = t.match(a);
55
+ if (e) {
56
+ var r = e.slice(2).map((function(t) {
57
+ return null != t ? Number(t) : 0;
58
+ }));
59
+ return this.$d.years = r[0], this.$d.months = r[1], this.$d.weeks = r[2], this.$d.days = r[3], this.$d.hours = r[4], this.$d.minutes = r[5], this.$d.seconds = r[6], this.calMilliseconds(), this;
60
+ }
61
+ }
62
+ return this;
63
+ }
64
+ var y = l.prototype;
65
+ return y.calMilliseconds = function() {
66
+ var t = this;
67
+ this.$ms = Object.keys(this.$d).reduce((function(s, n) {
68
+ return s + (t.$d[n] || 0) * h[n];
69
+ }), 0);
70
+ }, y.parseFromMilliseconds = function() {
71
+ var t = this.$ms;
72
+ this.$d.years = $(t / u), t %= u, this.$d.months = $(t / d), t %= d, this.$d.days = $(t / r), t %= r, this.$d.hours = $(t / e), t %= e, this.$d.minutes = $(t / i), t %= i, this.$d.seconds = $(t / n), t %= n, this.$d.milliseconds = t;
73
+ }, y.toISOString = function() {
74
+ var t = v(this.$d.years, "Y"), s = v(this.$d.months, "M"), n = +this.$d.days || 0;
75
+ this.$d.weeks && (n += 7 * this.$d.weeks);
76
+ var i = v(n, "D"), e = v(this.$d.hours, "H"), r = v(this.$d.minutes, "M"), o = this.$d.seconds || 0;
77
+ this.$d.milliseconds && (o += this.$d.milliseconds / 1e3, o = Math.round(1e3 * o) / 1e3);
78
+ var u = v(o, "S"), d = t.negative || s.negative || i.negative || e.negative || r.negative || u.negative, a = e.format || r.format || u.format ? "T" : "", h = (d ? "-" : "") + "P" + t.format + s.format + i.format + a + e.format + r.format + u.format;
79
+ return "P" === h || "-P" === h ? "P0D" : h;
80
+ }, y.toJSON = function() {
81
+ return this.toISOString();
82
+ }, y.format = function(t) {
83
+ var n = t || "YYYY-MM-DDTHH:mm:ss", i = {
84
+ Y: this.$d.years,
85
+ YY: s.s(this.$d.years, 2, "0"),
86
+ YYYY: s.s(this.$d.years, 4, "0"),
87
+ M: this.$d.months,
88
+ MM: s.s(this.$d.months, 2, "0"),
89
+ D: this.$d.days,
90
+ DD: s.s(this.$d.days, 2, "0"),
91
+ H: this.$d.hours,
92
+ HH: s.s(this.$d.hours, 2, "0"),
93
+ m: this.$d.minutes,
94
+ mm: s.s(this.$d.minutes, 2, "0"),
95
+ s: this.$d.seconds,
96
+ ss: s.s(this.$d.seconds, 2, "0"),
97
+ SSS: s.s(this.$d.milliseconds, 3, "0")
98
+ };
99
+ return n.replace(o, (function(t, s) {
100
+ return s || String(i[t]);
101
+ }));
102
+ }, y.as = function(t) {
103
+ return this.$ms / h[m(t)];
104
+ }, y.get = function(t) {
105
+ var s = this.$ms, n = m(t);
106
+ return "milliseconds" === n ? s %= 1e3 : s = "weeks" === n ? $(s / h[n]) : this.$d[n], s || 0;
107
+ }, y.add = function(t, s, n) {
108
+ var i;
109
+ return i = s ? t * h[m(s)] : c(t) ? t.$ms : f(t, this).$ms, f(this.$ms + i * (n ? -1 : 1), this);
110
+ }, y.subtract = function(t, s) {
111
+ return this.add(t, s, !0);
112
+ }, y.locale = function(t) {
113
+ var s = this.clone();
114
+ return s.$l = t, s;
115
+ }, y.clone = function() {
116
+ return f(this.$ms, this);
117
+ }, y.humanize = function(s) {
118
+ return t().add(this.$ms, "ms").locale(this.$l).fromNow(!s);
119
+ }, y.valueOf = function() {
120
+ return this.asMilliseconds();
121
+ }, y.milliseconds = function() {
122
+ return this.get("milliseconds");
123
+ }, y.asMilliseconds = function() {
124
+ return this.as("milliseconds");
125
+ }, y.seconds = function() {
126
+ return this.get("seconds");
127
+ }, y.asSeconds = function() {
128
+ return this.as("seconds");
129
+ }, y.minutes = function() {
130
+ return this.get("minutes");
131
+ }, y.asMinutes = function() {
132
+ return this.as("minutes");
133
+ }, y.hours = function() {
134
+ return this.get("hours");
135
+ }, y.asHours = function() {
136
+ return this.as("hours");
137
+ }, y.days = function() {
138
+ return this.get("days");
139
+ }, y.asDays = function() {
140
+ return this.as("days");
141
+ }, y.weeks = function() {
142
+ return this.get("weeks");
143
+ }, y.asWeeks = function() {
144
+ return this.as("weeks");
145
+ }, y.months = function() {
146
+ return this.get("months");
147
+ }, y.asMonths = function() {
148
+ return this.as("months");
149
+ }, y.years = function() {
150
+ return this.get("years");
151
+ }, y.asYears = function() {
152
+ return this.as("years");
153
+ }, l;
154
+ }(), p = function(t, s, n) {
155
+ return t.add(s.years() * n, "y").add(s.months() * n, "M").add(s.days() * n, "d").add(s.hours() * n, "h").add(s.minutes() * n, "m").add(s.seconds() * n, "s").add(s.milliseconds() * n, "ms");
156
+ };
157
+ return function(n, i, e) {
158
+ t = e, s = e().$utils(), e.duration = function(t, s) {
159
+ return f(t, { $l: e.locale() }, s);
160
+ }, e.isDuration = c;
161
+ var r = i.prototype.add, o = i.prototype.subtract;
162
+ i.prototype.add = function(t, s) {
163
+ return c(t) ? p(this, t, 1) : r.bind(this)(t, s);
164
+ }, i.prototype.subtract = function(t, s) {
165
+ return c(t) ? p(this, t, -1) : o.bind(this)(t, s);
166
+ };
167
+ };
168
+ }));
169
+ }));
170
+ //#endregion
171
+ //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/relativeTime.js
172
+ var require_relativeTime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
173
+ (function(r, e) {
174
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (r = "undefined" != typeof globalThis ? globalThis : r || self).dayjs_plugin_relativeTime = e();
175
+ })(exports, (function() {
176
+ "use strict";
177
+ return function(r, e, t) {
178
+ r = r || {};
179
+ var n = e.prototype, o = {
180
+ future: "in %s",
181
+ past: "%s ago",
182
+ s: "a few seconds",
183
+ m: "a minute",
184
+ mm: "%d minutes",
185
+ h: "an hour",
186
+ hh: "%d hours",
187
+ d: "a day",
188
+ dd: "%d days",
189
+ M: "a month",
190
+ MM: "%d months",
191
+ y: "a year",
192
+ yy: "%d years"
193
+ };
194
+ function i(r, e, t, o) {
195
+ return n.fromToBase(r, e, t, o);
196
+ }
197
+ t.en.relativeTime = o, n.fromToBase = function(e, n, i, d, u) {
198
+ for (var f, a, s, l = i.$locale().relativeTime || o, h = r.thresholds || [
199
+ {
200
+ l: "s",
201
+ r: 44,
202
+ d: "second"
203
+ },
204
+ {
205
+ l: "m",
206
+ r: 89
207
+ },
208
+ {
209
+ l: "mm",
210
+ r: 44,
211
+ d: "minute"
212
+ },
213
+ {
214
+ l: "h",
215
+ r: 89
216
+ },
217
+ {
218
+ l: "hh",
219
+ r: 21,
220
+ d: "hour"
221
+ },
222
+ {
223
+ l: "d",
224
+ r: 35
225
+ },
226
+ {
227
+ l: "dd",
228
+ r: 25,
229
+ d: "day"
230
+ },
231
+ {
232
+ l: "M",
233
+ r: 45
234
+ },
235
+ {
236
+ l: "MM",
237
+ r: 10,
238
+ d: "month"
239
+ },
240
+ {
241
+ l: "y",
242
+ r: 17
243
+ },
244
+ {
245
+ l: "yy",
246
+ d: "year"
247
+ }
248
+ ], m = h.length, c = 0; c < m; c += 1) {
249
+ var y = h[c];
250
+ y.d && (f = d ? t(e).diff(i, y.d, !0) : i.diff(e, y.d, !0));
251
+ var p = (r.rounding || Math.round)(Math.abs(f));
252
+ if (s = f > 0, p <= y.r || !y.r) {
253
+ p <= 1 && c > 0 && (y = h[c - 1]);
254
+ var v = l[y.l];
255
+ u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n, y.l, s);
256
+ break;
257
+ }
258
+ }
259
+ if (n) return a;
260
+ var M = s ? l.future : l.past;
261
+ return "function" == typeof M ? M(a) : M.replace("%s", a);
262
+ }, n.to = function(r, e) {
263
+ return i(r, e, this, !0);
264
+ }, n.from = function(r, e) {
265
+ return i(r, e, this);
266
+ };
267
+ var d = function(r) {
268
+ return r.$u ? t.utc() : t();
269
+ };
270
+ n.toNow = function(r) {
271
+ return this.to(d(this), r);
272
+ }, n.fromNow = function(r) {
273
+ return this.from(d(this), r);
274
+ };
275
+ };
276
+ }));
277
+ }));
278
+ //#endregion
279
+ //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/locale/ru.js
280
+ var require_ru = /* @__PURE__ */ __commonJSMin(((exports, module) => {
281
+ (function(_, t) {
282
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t(__require("dayjs")) : "function" == typeof define && define.amd ? define(["dayjs"], t) : (_ = "undefined" != typeof globalThis ? globalThis : _ || self).dayjs_locale_ru = t(_.dayjs);
283
+ })(exports, (function(_) {
284
+ "use strict";
285
+ function t(_) {
286
+ return _ && "object" == typeof _ && "default" in _ ? _ : { default: _ };
287
+ }
288
+ var e = t(_), n = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"), s = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"), r = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"), o = "янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_"), i = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
289
+ function d(_, t, e) {
290
+ var n, s;
291
+ return "m" === e ? t ? "минута" : "минуту" : _ + " " + (n = +_, s = {
292
+ mm: t ? "минута_минуты_минут" : "минуту_минуты_минут",
293
+ hh: "час_часа_часов",
294
+ dd: "день_дня_дней",
295
+ MM: "месяц_месяца_месяцев",
296
+ yy: "год_года_лет"
297
+ }[e].split("_"), n % 10 == 1 && n % 100 != 11 ? s[0] : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? s[1] : s[2]);
298
+ }
299
+ var u = function(_, t) {
300
+ return i.test(t) ? n[_.month()] : s[_.month()];
301
+ };
302
+ u.s = s, u.f = n;
303
+ var a = function(_, t) {
304
+ return i.test(t) ? r[_.month()] : o[_.month()];
305
+ };
306
+ a.s = o, a.f = r;
307
+ var m = {
308
+ name: "ru",
309
+ weekdays: "воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),
310
+ weekdaysShort: "вск_пнд_втр_срд_чтв_птн_сбт".split("_"),
311
+ weekdaysMin: "вс_пн_вт_ср_чт_пт_сб".split("_"),
312
+ months: u,
313
+ monthsShort: a,
314
+ weekStart: 1,
315
+ yearStart: 4,
316
+ formats: {
317
+ LT: "H:mm",
318
+ LTS: "H:mm:ss",
319
+ L: "DD.MM.YYYY",
320
+ LL: "D MMMM YYYY г.",
321
+ LLL: "D MMMM YYYY г., H:mm",
322
+ LLLL: "dddd, D MMMM YYYY г., H:mm"
323
+ },
324
+ relativeTime: {
325
+ future: "через %s",
326
+ past: "%s назад",
327
+ s: "несколько секунд",
328
+ m: d,
329
+ mm: d,
330
+ h: "час",
331
+ hh: d,
332
+ d: "день",
333
+ dd: d,
334
+ M: "месяц",
335
+ MM: d,
336
+ y: "год",
337
+ yy: d
338
+ },
339
+ ordinal: function(_) {
340
+ return _;
341
+ },
342
+ meridiem: function(_) {
343
+ return _ < 4 ? "ночи" : _ < 12 ? "утра" : _ < 17 ? "дня" : "вечера";
344
+ }
345
+ };
346
+ return e.default.locale(m, null, !0), m;
347
+ }));
348
+ }));
349
+ //#endregion
350
+ //#region src/date-time.ts
351
+ /**
352
+ * ---header-docs-section---
353
+ * # yummies/date-time
354
+ *
355
+ * ## Description
356
+ *
357
+ * Date and time formatting built on **dayjs** with locale plugins, human-readable presets, relative
358
+ * phrases, and duration helpers tailored to UI copy. It composes with `yummies/format`, `yummies/ms`,
359
+ * and `yummies/text` for declensions so timestamps read naturally in Russian-facing apps.
360
+ *
361
+ * ## Usage
362
+ *
363
+ * ```ts
364
+ * import { formatDate } from "yummies/date-time";
365
+ * ```
366
+ */
367
+ var import_duration = /* @__PURE__ */ __toESM(require_duration(), 1);
368
+ var import_relativeTime = /* @__PURE__ */ __toESM(require_relativeTime(), 1);
369
+ require_ru();
370
+ dayjs.extend(import_relativeTime.default);
371
+ dayjs.extend(import_duration.default);
238
372
  dayjs.locale("ru");
239
- const toLibFormat = (value) => {
240
- let result = null;
241
- if (dayjs.isDayjs(value)) {
242
- result = value;
243
- } else if (value != null) {
244
- result = dayjs(value);
245
- }
246
- if (!result?.isValid()) {
247
- return null;
248
- }
249
- return result;
373
+ var toLibFormat = (value) => {
374
+ let result = null;
375
+ if (dayjs.isDayjs(value)) result = value;
376
+ else if (value != null) result = dayjs(value);
377
+ if (!result?.isValid()) return null;
378
+ return result;
250
379
  };
251
- const formatDate = (value, settings) => {
252
- const dateFormat = settings?.format;
253
- const datePattern = settings?.pattern;
254
- const asTime = settings?.asTime;
255
- let libDate = null;
256
- if (asTime && typeGuard.isNumber(value)) {
257
- libDate = dayjs.duration(value);
258
- } else {
259
- libDate = toLibFormat(value);
260
- }
261
- if (!libDate) {
262
- return format.NO_VALUE;
263
- }
264
- if (datePattern) {
265
- return libDate.format(datePattern);
266
- }
267
- if (dateFormat === "human" || dateFormat === "spent-time") {
268
- if ("fromNow" in libDate) {
269
- return libDate.fromNow(dateFormat === "spent-time");
270
- } else {
271
- return format.NO_VALUE;
272
- }
273
- }
274
- switch (dateFormat) {
275
- case "full": {
276
- return libDate.format("DD MMM YYYY HH:mm:ss");
277
- }
278
- case "short": {
279
- return libDate.format("DD MMM HH:mm");
280
- }
281
- case "time": {
282
- return libDate.format("HH:mm:ss");
283
- }
284
- case "time-short": {
285
- return libDate.format("HH:mm");
286
- }
287
- case "day": {
288
- return libDate.format("DD MMM YYYY");
289
- }
290
- case "month": {
291
- return libDate.format("MMMM YYYY");
292
- }
293
- default: {
294
- return libDate.format("DD.MM.YYYY");
295
- }
296
- }
380
+ /**
381
+ * Formats a date-like value using predefined presets or a custom pattern.
382
+ *
383
+ * @example
384
+ * ```ts
385
+ * formatDate('2024-03-15', { format: 'time-short' });
386
+ * ```
387
+ */
388
+ var formatDate = (value, settings) => {
389
+ const dateFormat = settings?.format;
390
+ const datePattern = settings?.pattern;
391
+ const asTime = settings?.asTime;
392
+ let libDate = null;
393
+ if (asTime && typeGuard.isNumber(value)) libDate = dayjs.duration(value);
394
+ else libDate = toLibFormat(value);
395
+ if (!libDate) return format.NO_VALUE;
396
+ if (datePattern) return libDate.format(datePattern);
397
+ if (dateFormat === "human" || dateFormat === "spent-time") if ("fromNow" in libDate) return libDate.fromNow(dateFormat === "spent-time");
398
+ else return format.NO_VALUE;
399
+ switch (dateFormat) {
400
+ case "full": return libDate.format("DD MMM YYYY HH:mm:ss");
401
+ case "short": return libDate.format("DD MMM HH:mm");
402
+ case "time": return libDate.format("HH:mm:ss");
403
+ case "time-short": return libDate.format("HH:mm");
404
+ case "day": return libDate.format("DD MMM YYYY");
405
+ case "month": return libDate.format("MMMM YYYY");
406
+ default: return libDate.format("DD.MM.YYYY");
407
+ }
297
408
  };
298
- const dayTimeDuration = (timeInMs) => {
299
- let left = Math.max(timeInMs, 0);
300
- const days = Math.floor(left / unitsToMs.day);
301
- left = left % unitsToMs.day;
302
- const hours = Math.floor(left / unitsToMs.hour);
303
- left = left % unitsToMs.hour;
304
- const minutes = Math.floor(left / unitsToMs.min);
305
- left = left % unitsToMs.min;
306
- const seconds = Math.floor(left / unitsToMs.sec);
307
- left = left % unitsToMs.sec;
308
- const milliseconds = Math.floor(left);
309
- return {
310
- days,
311
- hours,
312
- minutes,
313
- seconds,
314
- milliseconds
315
- };
409
+ /**
410
+ * Splits a duration in milliseconds into day-based time parts.
411
+ *
412
+ * @example
413
+ * ```ts
414
+ * dayTimeDuration(ms(1, 'day') + ms(2, 'hour'));
415
+ * ```
416
+ */
417
+ var dayTimeDuration = (timeInMs) => {
418
+ let left = Math.max(timeInMs, 0);
419
+ const days = Math.floor(left / unitsToMs.day);
420
+ left = left % unitsToMs.day;
421
+ const hours = Math.floor(left / unitsToMs.hour);
422
+ left = left % unitsToMs.hour;
423
+ const minutes = Math.floor(left / unitsToMs.min);
424
+ left = left % unitsToMs.min;
425
+ const seconds = Math.floor(left / unitsToMs.sec);
426
+ left = left % unitsToMs.sec;
427
+ return {
428
+ days,
429
+ hours,
430
+ minutes,
431
+ seconds,
432
+ milliseconds: Math.floor(left)
433
+ };
316
434
  };
317
- const changeDate = (date, ...args) => {
318
- let wrappedDate = toLibFormat(date);
319
- for (let i = 0; i < args.length; i += 2) {
320
- const amount = args[i];
321
- const unit = args[i + 1];
322
- if (unit != null) {
323
- wrappedDate = wrappedDate.add(amount, unit);
324
- }
325
- }
326
- return wrappedDate.toDate();
435
+ /**
436
+ * Applies one or more date adjustments and returns a new `Date` instance.
437
+ *
438
+ * @example
439
+ * ```ts
440
+ * changeDate(new Date(), 1, 'day', 30, 'minute');
441
+ * ```
442
+ */
443
+ var changeDate = (date, ...args) => {
444
+ let wrappedDate = toLibFormat(date);
445
+ for (let i = 0; i < args.length; i += 2) {
446
+ const amount = args[i];
447
+ const unit = args[i + 1];
448
+ if (unit != null) wrappedDate = wrappedDate.add(amount, unit);
449
+ }
450
+ return wrappedDate.toDate();
327
451
  };
328
- const timeDuration = (timeInMs) => {
329
- const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
330
- return {
331
- hours: hours + unitsToMs.day * days,
332
- milliseconds,
333
- minutes,
334
- seconds
335
- };
452
+ /**
453
+ * Converts milliseconds into hour-based time parts without keeping full days separately.
454
+ *
455
+ * @example
456
+ * ```ts
457
+ * timeDuration(ms(1, 'hour') + ms(30, 'min'));
458
+ * ```
459
+ */
460
+ var timeDuration = (timeInMs) => {
461
+ const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
462
+ return {
463
+ hours: hours + unitsToMs.day * days,
464
+ milliseconds,
465
+ minutes,
466
+ seconds
467
+ };
336
468
  };
337
- const durationFormatLabels = {
338
- days: { compact: "д", full: ["день", "дня", "дней"] },
339
- hours: { compact: "ч", full: ["час", "часа", "часов"] },
340
- minutes: { compact: "мин", full: ["минута", "минуты", "минут"] },
341
- seconds: { compact: "сек", full: ["секунда", "секунды", "секунд"] }
469
+ var durationFormatLabels = {
470
+ days: {
471
+ compact: "д",
472
+ full: [
473
+ "день",
474
+ "дня",
475
+ "дней"
476
+ ]
477
+ },
478
+ hours: {
479
+ compact: "ч",
480
+ full: [
481
+ "час",
482
+ "часа",
483
+ "часов"
484
+ ]
485
+ },
486
+ minutes: {
487
+ compact: "мин",
488
+ full: [
489
+ "минута",
490
+ "минуты",
491
+ "минут"
492
+ ]
493
+ },
494
+ seconds: {
495
+ compact: "сек",
496
+ full: [
497
+ "секунда",
498
+ "секунды",
499
+ "секунд"
500
+ ]
501
+ }
342
502
  };
343
503
  function getFormatDuration(...args) {
344
- let compact = false;
345
- let diff = 0;
346
- if (args[0] instanceof Date) {
347
- const startedDate = dayjs(args[0]);
348
- const endedDate = dayjs(args[1]);
349
- diff = endedDate.diff(startedDate, "ms");
350
- compact = args[2] === true;
351
- } else {
352
- diff = args[0];
353
- compact = args[1] === true;
354
- }
355
- const { days, hours, minutes, seconds } = dayTimeDuration(diff);
356
- const formattedParts = [];
357
- if (days) {
358
- if (compact) {
359
- formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
360
- } else {
361
- formattedParts.push(
362
- `${days} ${declension(days, durationFormatLabels.days.full)}`
363
- );
364
- }
365
- }
366
- if (hours) {
367
- if (compact) {
368
- formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
369
- } else {
370
- formattedParts.push(
371
- `${hours} ${declension(hours, durationFormatLabels.hours.full)}`
372
- );
373
- }
374
- }
375
- if (minutes) {
376
- if (compact) {
377
- formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
378
- } else {
379
- formattedParts.push(
380
- `${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`
381
- );
382
- }
383
- }
384
- if (seconds) {
385
- if (compact) {
386
- formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
387
- } else {
388
- formattedParts.push(
389
- `${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`
390
- );
391
- }
392
- }
393
- return formattedParts.join(" ");
504
+ let compact = false;
505
+ let diff = 0;
506
+ if (args[0] instanceof Date) {
507
+ const startedDate = dayjs(args[0]);
508
+ diff = dayjs(args[1]).diff(startedDate, "ms");
509
+ compact = args[2] === true;
510
+ } else {
511
+ diff = args[0];
512
+ compact = args[1] === true;
513
+ }
514
+ const { days, hours, minutes, seconds } = dayTimeDuration(diff);
515
+ const formattedParts = [];
516
+ if (days) if (compact) formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
517
+ else formattedParts.push(`${days} ${declension(days, durationFormatLabels.days.full)}`);
518
+ if (hours) if (compact) formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
519
+ else formattedParts.push(`${hours} ${declension(hours, durationFormatLabels.hours.full)}`);
520
+ if (minutes) if (compact) formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
521
+ else formattedParts.push(`${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`);
522
+ if (seconds) if (compact) formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
523
+ else formattedParts.push(`${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`);
524
+ return formattedParts.join(" ");
394
525
  }
395
- const getTimeDiff = (dateA, dateB) => {
396
- const leftDate = toLibFormat(dateA)?.toDate();
397
- const rightDate = toLibFormat(dateB)?.toDate();
398
- if (!leftDate || !rightDate) {
399
- return {
400
- minutes: 0,
401
- seconds: 0,
402
- total: { ms: 0, hours: 0 }
403
- };
404
- }
405
- const msDiff = leftDate.getTime() - rightDate.getTime();
406
- return {
407
- minutes: Math.max(Math.floor(msDiff / ms(1, "min")), 0),
408
- seconds: Math.max(Math.floor(msDiff % ms(1, "min") / 1e3), 0),
409
- total: {
410
- hours: Math.round(msDiff / ms(1, "hour")),
411
- ms: msDiff
412
- }
413
- };
414
- };
415
- const addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
416
- const subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
417
- const addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
418
- const setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
419
- const setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
420
- export {
421
- addDays,
422
- addMinutes,
423
- changeDate,
424
- dayTimeDuration,
425
- formatDate,
426
- getFormatDuration,
427
- getTimeDiff,
428
- setHours,
429
- setMinutes,
430
- subtractDays,
431
- timeDuration
526
+ /**
527
+ * Calculates the difference between two dates in minutes, seconds and total units.
528
+ *
529
+ * @example
530
+ * ```ts
531
+ * getTimeDiff(new Date('2024-03-15T12:30:00'), new Date('2024-03-15T12:00:00'));
532
+ * ```
533
+ */
534
+ var getTimeDiff = (dateA, dateB) => {
535
+ const leftDate = toLibFormat(dateA)?.toDate();
536
+ const rightDate = toLibFormat(dateB)?.toDate();
537
+ if (!leftDate || !rightDate) return {
538
+ minutes: 0,
539
+ seconds: 0,
540
+ total: {
541
+ ms: 0,
542
+ hours: 0
543
+ }
544
+ };
545
+ const msDiff = leftDate.getTime() - rightDate.getTime();
546
+ return {
547
+ minutes: Math.max(Math.floor(msDiff / ms(1, "min")), 0),
548
+ seconds: Math.max(Math.floor(msDiff % ms(1, "min") / 1e3), 0),
549
+ total: {
550
+ hours: Math.round(msDiff / ms(1, "hour")),
551
+ ms: msDiff
552
+ }
553
+ };
432
554
  };
433
- //# sourceMappingURL=date-time.js.map
555
+ /**
556
+ * Returns a new date shifted forward by the provided number of days.
557
+ *
558
+ * @example
559
+ * ```ts
560
+ * addDays(new Date('2024-03-15'), 7);
561
+ * ```
562
+ */
563
+ var addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
564
+ /**
565
+ * Returns a new date shifted backward by the provided number of days.
566
+ *
567
+ * @example
568
+ * ```ts
569
+ * subtractDays(new Date('2024-03-15'), 7);
570
+ * ```
571
+ */
572
+ var subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
573
+ /**
574
+ * Returns a new date shifted forward by the provided number of minutes.
575
+ *
576
+ * @example
577
+ * ```ts
578
+ * addMinutes(new Date('2024-03-15T12:00:00'), 15);
579
+ * ```
580
+ */
581
+ var addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
582
+ /**
583
+ * Returns a new date with the minutes field replaced.
584
+ *
585
+ * @example
586
+ * ```ts
587
+ * setMinutes(new Date('2024-03-15T12:00:00'), 45);
588
+ * ```
589
+ */
590
+ var setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
591
+ /**
592
+ * Returns a new date with the hours field replaced.
593
+ *
594
+ * @example
595
+ * ```ts
596
+ * setHours(new Date('2024-03-15T12:00:00'), 9);
597
+ * ```
598
+ */
599
+ var setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
600
+ //#endregion
601
+ export { addDays, addMinutes, changeDate, dayTimeDuration, formatDate, getFormatDuration, getTimeDiff, setHours, setMinutes, subtractDays, timeDuration };
602
+
603
+ //# sourceMappingURL=date-time.js.map