ts-time-utils 1.0.0 → 1.1.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/README.md +226 -1
- package/dist/calculate.d.ts.map +1 -1
- package/dist/calculate.js +24 -10
- package/dist/countdown.d.ts +217 -0
- package/dist/countdown.d.ts.map +1 -0
- package/dist/countdown.js +298 -0
- package/dist/dateRange.d.ts +266 -0
- package/dist/dateRange.d.ts.map +1 -0
- package/dist/dateRange.js +433 -0
- package/dist/esm/calculate.d.ts.map +1 -1
- package/dist/esm/calculate.js +24 -10
- package/dist/esm/countdown.d.ts +217 -0
- package/dist/esm/countdown.d.ts.map +1 -0
- package/dist/esm/countdown.js +298 -0
- package/dist/esm/dateRange.d.ts +266 -0
- package/dist/esm/dateRange.d.ts.map +1 -0
- package/dist/esm/dateRange.js +433 -0
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/naturalLanguage.d.ts +107 -0
- package/dist/esm/naturalLanguage.d.ts.map +1 -0
- package/dist/esm/naturalLanguage.js +344 -0
- package/dist/esm/recurrence.d.ts +149 -0
- package/dist/esm/recurrence.d.ts.map +1 -0
- package/dist/esm/recurrence.js +404 -0
- package/dist/esm/types.d.ts +21 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/naturalLanguage.d.ts +107 -0
- package/dist/naturalLanguage.d.ts.map +1 -0
- package/dist/naturalLanguage.js +344 -0
- package/dist/recurrence.d.ts +149 -0
- package/dist/recurrence.d.ts.map +1 -0
- package/dist/recurrence.js +404 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +30 -2
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Recurring events and pattern-based date generation utilities
|
|
3
|
+
* Provides RRULE-inspired recurrence patterns for creating repeating events
|
|
4
|
+
*/
|
|
5
|
+
import { addTime } from './calculate.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a recurrence pattern generator
|
|
8
|
+
* @param rule - The recurrence rule defining the pattern
|
|
9
|
+
* @returns An object with methods to work with the recurrence
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // Daily recurrence
|
|
14
|
+
* const daily = createRecurrence({
|
|
15
|
+
* frequency: 'daily',
|
|
16
|
+
* interval: 1,
|
|
17
|
+
* startDate: new Date('2024-01-01')
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // Weekly on Monday and Wednesday
|
|
21
|
+
* const weekly = createRecurrence({
|
|
22
|
+
* frequency: 'weekly',
|
|
23
|
+
* interval: 1,
|
|
24
|
+
* startDate: new Date('2024-01-01'),
|
|
25
|
+
* byWeekday: [1, 3] // Monday = 1, Wednesday = 3
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Monthly on the 15th
|
|
29
|
+
* const monthly = createRecurrence({
|
|
30
|
+
* frequency: 'monthly',
|
|
31
|
+
* interval: 1,
|
|
32
|
+
* startDate: new Date('2024-01-01'),
|
|
33
|
+
* byMonthDay: [15]
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function createRecurrence(rule) {
|
|
38
|
+
const startDate = new Date(rule.startDate);
|
|
39
|
+
return {
|
|
40
|
+
rule,
|
|
41
|
+
getNextOccurrence: (afterDate) => getNextOccurrence(rule, afterDate),
|
|
42
|
+
getOccurrencesBetween: (start, end, limit) => getOccurrencesBetween(rule, start, end, limit),
|
|
43
|
+
isRecurrenceDate: (date) => isRecurrenceDate(date, rule),
|
|
44
|
+
getAllOccurrences: (limit = 100) => {
|
|
45
|
+
const occurrences = [];
|
|
46
|
+
let current = new Date(startDate);
|
|
47
|
+
let count = 0;
|
|
48
|
+
while (count < limit) {
|
|
49
|
+
if (rule.until && current > new Date(rule.until))
|
|
50
|
+
break;
|
|
51
|
+
if (rule.count && count >= rule.count)
|
|
52
|
+
break;
|
|
53
|
+
const next = getNextOccurrence(rule, current);
|
|
54
|
+
if (!next)
|
|
55
|
+
break;
|
|
56
|
+
occurrences.push(next);
|
|
57
|
+
current = new Date(next.getTime() + 1);
|
|
58
|
+
count++;
|
|
59
|
+
}
|
|
60
|
+
return occurrences;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Gets the next occurrence of a recurring event after a specified date
|
|
66
|
+
* @param rule - The recurrence rule
|
|
67
|
+
* @param afterDate - Date to find next occurrence after (defaults to now)
|
|
68
|
+
* @returns The next occurrence date, or null if no more occurrences
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const rule = {
|
|
73
|
+
* frequency: 'daily',
|
|
74
|
+
* interval: 2,
|
|
75
|
+
* startDate: new Date('2024-01-01')
|
|
76
|
+
* };
|
|
77
|
+
*
|
|
78
|
+
* const next = getNextOccurrence(rule, new Date('2024-01-05'));
|
|
79
|
+
* // Returns Date('2024-01-07') - every other day
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function getNextOccurrence(rule, afterDate) {
|
|
83
|
+
const after = afterDate ? new Date(afterDate) : new Date();
|
|
84
|
+
const start = new Date(rule.startDate);
|
|
85
|
+
// If afterDate is before start, check if start matches
|
|
86
|
+
if (after < start) {
|
|
87
|
+
if (matchesRecurrenceRule(start, rule)) {
|
|
88
|
+
return new Date(start);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Check if we've exceeded count or until date
|
|
92
|
+
if (rule.until && after >= new Date(rule.until)) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
// Start searching from the day after 'after'
|
|
96
|
+
// We want strictly greater than after, so start from the next potential occurrence
|
|
97
|
+
let candidate = addTime(after, 1, 'day');
|
|
98
|
+
// Preserve time from start date
|
|
99
|
+
candidate.setHours(start.getHours(), start.getMinutes(), start.getSeconds(), start.getMilliseconds());
|
|
100
|
+
const maxIterations = 1000; // Prevent infinite loops
|
|
101
|
+
let iterations = 0;
|
|
102
|
+
while (iterations < maxIterations) {
|
|
103
|
+
if (rule.until && candidate > new Date(rule.until)) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
if (matchesRecurrenceRule(candidate, rule)) {
|
|
107
|
+
return new Date(candidate);
|
|
108
|
+
}
|
|
109
|
+
// Move to next potential date based on frequency
|
|
110
|
+
candidate = getNextCandidate(candidate, rule);
|
|
111
|
+
iterations++;
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets all occurrences of a recurring event between two dates
|
|
117
|
+
* @param rule - The recurrence rule
|
|
118
|
+
* @param start - Start date of the range
|
|
119
|
+
* @param end - End date of the range
|
|
120
|
+
* @param limit - Maximum number of occurrences to return (default: 1000)
|
|
121
|
+
* @returns Array of dates that match the recurrence pattern
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* const rule = {
|
|
126
|
+
* frequency: 'weekly',
|
|
127
|
+
* interval: 1,
|
|
128
|
+
* startDate: new Date('2024-01-01'),
|
|
129
|
+
* byWeekday: [1, 5] // Monday and Friday
|
|
130
|
+
* };
|
|
131
|
+
*
|
|
132
|
+
* const occurrences = getOccurrencesBetween(
|
|
133
|
+
* rule,
|
|
134
|
+
* new Date('2024-01-01'),
|
|
135
|
+
* new Date('2024-01-31')
|
|
136
|
+
* );
|
|
137
|
+
* // Returns all Mondays and Fridays in January 2024
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export function getOccurrencesBetween(rule, start, end, limit = 1000) {
|
|
141
|
+
const startDate = new Date(start);
|
|
142
|
+
const endDate = new Date(end);
|
|
143
|
+
const occurrences = [];
|
|
144
|
+
let current = new Date(rule.startDate);
|
|
145
|
+
// Fast forward to start date if recurrence starts before range
|
|
146
|
+
if (current < startDate) {
|
|
147
|
+
current = new Date(startDate);
|
|
148
|
+
}
|
|
149
|
+
let iterations = 0;
|
|
150
|
+
const maxIterations = limit * 10; // Safety limit
|
|
151
|
+
while (current <= endDate && occurrences.length < limit && iterations < maxIterations) {
|
|
152
|
+
if (rule.until && current > new Date(rule.until)) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
if (matchesRecurrenceRule(current, rule) && current >= startDate) {
|
|
156
|
+
occurrences.push(new Date(current));
|
|
157
|
+
}
|
|
158
|
+
current = getNextCandidate(current, rule);
|
|
159
|
+
iterations++;
|
|
160
|
+
}
|
|
161
|
+
return occurrences;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Checks if a specific date matches a recurrence rule
|
|
165
|
+
* @param date - The date to check
|
|
166
|
+
* @param rule - The recurrence rule
|
|
167
|
+
* @returns True if the date matches the recurrence pattern
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const rule = {
|
|
172
|
+
* frequency: 'weekly',
|
|
173
|
+
* interval: 1,
|
|
174
|
+
* startDate: new Date('2024-01-01'),
|
|
175
|
+
* byWeekday: [1] // Mondays only
|
|
176
|
+
* };
|
|
177
|
+
*
|
|
178
|
+
* isRecurrenceDate(new Date('2024-01-08'), rule); // true (Monday)
|
|
179
|
+
* isRecurrenceDate(new Date('2024-01-09'), rule); // false (Tuesday)
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export function isRecurrenceDate(date, rule) {
|
|
183
|
+
const checkDate = new Date(date);
|
|
184
|
+
const start = new Date(rule.startDate);
|
|
185
|
+
// Must be on or after start date
|
|
186
|
+
if (checkDate < start)
|
|
187
|
+
return false;
|
|
188
|
+
// Must be before until date if specified
|
|
189
|
+
if (rule.until && checkDate > new Date(rule.until))
|
|
190
|
+
return false;
|
|
191
|
+
return matchesRecurrenceRule(checkDate, rule);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Validates a recurrence rule
|
|
195
|
+
* @param rule - The recurrence rule to validate
|
|
196
|
+
* @returns True if the rule is valid
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* isValidRecurrenceRule({
|
|
201
|
+
* frequency: 'daily',
|
|
202
|
+
* interval: 1,
|
|
203
|
+
* startDate: new Date()
|
|
204
|
+
* }); // true
|
|
205
|
+
*
|
|
206
|
+
* isValidRecurrenceRule({
|
|
207
|
+
* frequency: 'daily',
|
|
208
|
+
* interval: 0, // Invalid
|
|
209
|
+
* startDate: new Date()
|
|
210
|
+
* }); // false
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
export function isValidRecurrenceRule(rule) {
|
|
214
|
+
if (!rule.frequency || !rule.startDate)
|
|
215
|
+
return false;
|
|
216
|
+
const validFrequencies = ['daily', 'weekly', 'monthly', 'yearly'];
|
|
217
|
+
if (!validFrequencies.includes(rule.frequency))
|
|
218
|
+
return false;
|
|
219
|
+
if (rule.interval !== undefined && rule.interval < 1)
|
|
220
|
+
return false;
|
|
221
|
+
if (rule.count !== undefined && rule.count < 1)
|
|
222
|
+
return false;
|
|
223
|
+
if (rule.until) {
|
|
224
|
+
const until = new Date(rule.until);
|
|
225
|
+
const start = new Date(rule.startDate);
|
|
226
|
+
if (until <= start)
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
if (rule.byWeekday) {
|
|
230
|
+
if (!Array.isArray(rule.byWeekday))
|
|
231
|
+
return false;
|
|
232
|
+
if (!rule.byWeekday.every((d) => d >= 0 && d <= 6))
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
if (rule.byMonthDay) {
|
|
236
|
+
if (!Array.isArray(rule.byMonthDay))
|
|
237
|
+
return false;
|
|
238
|
+
if (!rule.byMonthDay.every((d) => d >= 1 && d <= 31))
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
if (rule.byMonth) {
|
|
242
|
+
if (!Array.isArray(rule.byMonth))
|
|
243
|
+
return false;
|
|
244
|
+
if (!rule.byMonth.every((m) => m >= 1 && m <= 12))
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Converts a recurrence rule to a human-readable string
|
|
251
|
+
* @param rule - The recurrence rule
|
|
252
|
+
* @returns A human-readable description
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* const rule = {
|
|
257
|
+
* frequency: 'weekly',
|
|
258
|
+
* interval: 2,
|
|
259
|
+
* startDate: new Date('2024-01-01'),
|
|
260
|
+
* byWeekday: [1, 3, 5]
|
|
261
|
+
* };
|
|
262
|
+
*
|
|
263
|
+
* recurrenceToString(rule);
|
|
264
|
+
* // "Every 2 weeks on Monday, Wednesday, Friday"
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
export function recurrenceToString(rule) {
|
|
268
|
+
const interval = rule.interval || 1;
|
|
269
|
+
let result = interval === 1 ? 'Every' : `Every ${interval}`;
|
|
270
|
+
switch (rule.frequency) {
|
|
271
|
+
case 'daily':
|
|
272
|
+
result += interval === 1 ? ' day' : ' days';
|
|
273
|
+
break;
|
|
274
|
+
case 'weekly':
|
|
275
|
+
result += interval === 1 ? ' week' : ' weeks';
|
|
276
|
+
if (rule.byWeekday && rule.byWeekday.length > 0) {
|
|
277
|
+
const days = rule.byWeekday.map((d) => ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][d]);
|
|
278
|
+
result += ` on ${days.join(', ')}`;
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
case 'monthly':
|
|
282
|
+
result += interval === 1 ? ' month' : ' months';
|
|
283
|
+
if (rule.byMonthDay && rule.byMonthDay.length > 0) {
|
|
284
|
+
result += ` on day ${rule.byMonthDay.join(', ')}`;
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
case 'yearly':
|
|
288
|
+
result += interval === 1 ? ' year' : ' years';
|
|
289
|
+
if (rule.byMonth && rule.byMonth.length > 0) {
|
|
290
|
+
const months = rule.byMonth.map((m) => ['January', 'February', 'March', 'April', 'May', 'June',
|
|
291
|
+
'July', 'August', 'September', 'October', 'November', 'December'][m - 1]);
|
|
292
|
+
result += ` in ${months.join(', ')}`;
|
|
293
|
+
}
|
|
294
|
+
if (rule.byMonthDay && rule.byMonthDay.length > 0) {
|
|
295
|
+
result += ` on day ${rule.byMonthDay.join(', ')}`;
|
|
296
|
+
}
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
if (rule.count) {
|
|
300
|
+
result += ` (${rule.count} times)`;
|
|
301
|
+
}
|
|
302
|
+
else if (rule.until) {
|
|
303
|
+
result += ` until ${new Date(rule.until).toLocaleDateString()}`;
|
|
304
|
+
}
|
|
305
|
+
return result;
|
|
306
|
+
}
|
|
307
|
+
// Helper functions
|
|
308
|
+
function matchesRecurrenceRule(date, rule) {
|
|
309
|
+
const start = new Date(rule.startDate);
|
|
310
|
+
start.setHours(0, 0, 0, 0);
|
|
311
|
+
const checkDate = new Date(date);
|
|
312
|
+
checkDate.setHours(0, 0, 0, 0);
|
|
313
|
+
const interval = rule.interval || 1;
|
|
314
|
+
// Check if date matches the frequency and interval
|
|
315
|
+
switch (rule.frequency) {
|
|
316
|
+
case 'daily': {
|
|
317
|
+
// Calculate days difference more reliably
|
|
318
|
+
const msPerDay = 1000 * 60 * 60 * 24;
|
|
319
|
+
const daysDiff = Math.round((checkDate.getTime() - start.getTime()) / msPerDay);
|
|
320
|
+
if (daysDiff < 0)
|
|
321
|
+
return false;
|
|
322
|
+
if (daysDiff % interval !== 0)
|
|
323
|
+
return false;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
case 'weekly': {
|
|
327
|
+
// If byWeekday is specified, check if current day matches
|
|
328
|
+
if (rule.byWeekday && rule.byWeekday.length > 0) {
|
|
329
|
+
if (!rule.byWeekday.includes(date.getDay())) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
// No specific weekdays - match same day of week as start
|
|
335
|
+
if (date.getDay() !== start.getDay())
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
// Check interval
|
|
339
|
+
const msPerDay = 1000 * 60 * 60 * 24;
|
|
340
|
+
const daysDiff = Math.round((checkDate.getTime() - start.getTime()) / msPerDay);
|
|
341
|
+
const weeksDiff = Math.floor(daysDiff / 7);
|
|
342
|
+
if (weeksDiff % interval !== 0)
|
|
343
|
+
return false;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
case 'monthly': {
|
|
347
|
+
const monthsDiff = (date.getFullYear() - start.getFullYear()) * 12 +
|
|
348
|
+
(date.getMonth() - start.getMonth());
|
|
349
|
+
if (monthsDiff < 0)
|
|
350
|
+
return false;
|
|
351
|
+
if (monthsDiff % interval !== 0)
|
|
352
|
+
return false;
|
|
353
|
+
if (rule.byMonthDay && !rule.byMonthDay.includes(date.getDate())) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
case 'yearly': {
|
|
359
|
+
const yearsDiff = date.getFullYear() - start.getFullYear();
|
|
360
|
+
if (yearsDiff < 0)
|
|
361
|
+
return false;
|
|
362
|
+
if (yearsDiff % interval !== 0)
|
|
363
|
+
return false;
|
|
364
|
+
if (rule.byMonth && !rule.byMonth.includes(date.getMonth() + 1)) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
if (rule.byMonthDay && !rule.byMonthDay.includes(date.getDate())) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
function getNextCandidate(date, rule) {
|
|
376
|
+
const interval = rule.interval || 1;
|
|
377
|
+
switch (rule.frequency) {
|
|
378
|
+
case 'daily':
|
|
379
|
+
// For daily recurrence, always increment by 1 day to check each day
|
|
380
|
+
// matchesRecurrenceRule will filter based on interval
|
|
381
|
+
return addTime(date, 1, 'day');
|
|
382
|
+
case 'weekly':
|
|
383
|
+
// If we have specific weekdays, try next day, otherwise skip full interval
|
|
384
|
+
if (rule.byWeekday && rule.byWeekday.length > 0) {
|
|
385
|
+
return addTime(date, 1, 'day');
|
|
386
|
+
}
|
|
387
|
+
return addTime(date, interval * 7, 'day');
|
|
388
|
+
case 'monthly':
|
|
389
|
+
// If we have specific days of month, try next day, otherwise skip full interval
|
|
390
|
+
if (rule.byMonthDay && rule.byMonthDay.length > 0) {
|
|
391
|
+
return addTime(date, 1, 'day');
|
|
392
|
+
}
|
|
393
|
+
return addTime(date, interval, 'month');
|
|
394
|
+
case 'yearly':
|
|
395
|
+
// If we have specific months or days, try next day, otherwise skip full interval
|
|
396
|
+
if ((rule.byMonth && rule.byMonth.length > 0) ||
|
|
397
|
+
(rule.byMonthDay && rule.byMonthDay.length > 0)) {
|
|
398
|
+
return addTime(date, 1, 'day');
|
|
399
|
+
}
|
|
400
|
+
return addTime(date, interval, 'year');
|
|
401
|
+
default:
|
|
402
|
+
return addTime(date, 1, 'day');
|
|
403
|
+
}
|
|
404
|
+
}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -104,6 +104,27 @@ export interface RecurrencePattern {
|
|
|
104
104
|
count?: number;
|
|
105
105
|
until?: Date;
|
|
106
106
|
}
|
|
107
|
+
/** Recurrence frequency types */
|
|
108
|
+
export type RecurrenceFrequency = 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
109
|
+
/** Recurrence rule for repeating events (RRULE-inspired) */
|
|
110
|
+
export interface RecurrenceRule {
|
|
111
|
+
/** Frequency of recurrence */
|
|
112
|
+
frequency: RecurrenceFrequency;
|
|
113
|
+
/** Start date for the recurrence */
|
|
114
|
+
startDate: DateInput;
|
|
115
|
+
/** Interval between occurrences (default: 1) */
|
|
116
|
+
interval?: number;
|
|
117
|
+
/** Days of week (0=Sunday, 6=Saturday) */
|
|
118
|
+
byWeekday?: number[];
|
|
119
|
+
/** Days of month (1-31) */
|
|
120
|
+
byMonthDay?: number[];
|
|
121
|
+
/** Months of year (1-12) */
|
|
122
|
+
byMonth?: number[];
|
|
123
|
+
/** Number of occurrences (alternative to until) */
|
|
124
|
+
count?: number;
|
|
125
|
+
/** End date for recurrence (alternative to count) */
|
|
126
|
+
until?: DateInput;
|
|
127
|
+
}
|
|
107
128
|
/** Locale-specific formatting options */
|
|
108
129
|
export interface LocaleFormatOptions extends FormatOptions {
|
|
109
130
|
/** Calendar system to use */
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4CAA4C;AAC5C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/C,4CAA4C;AAC5C,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX;AAED,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,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EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;KACnD,CAAC;IACF,iCAAiC;IACjC,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACzC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,wBAAwB;IACxB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,uDAAuD;IACvD,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,yDAAyD;IACzD,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CACrC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export { today, yesterday, tomorrow, lastNDays, nextNDays, thisWeek, lastWeek, n
|
|
|
16
16
|
export { Duration, createDuration, isValidDuration, parseDurationString, formatDurationString, maxDuration, minDuration, sumDurations, averageDuration } from './duration.js';
|
|
17
17
|
export { serializeDate, deserializeDate, createDateReviver, createDateReplacer, parseISOString, toEpochTimestamp, fromEpochTimestamp, createEpochTimestamp, toDateObject, fromDateObject, isValidISODateString, isValidEpochTimestamp, cloneDate, datesEqual, now, parseJSONWithDates, stringifyWithDates } from './serialize.js';
|
|
18
18
|
export { registerLocale, getLocaleConfig, getSupportedLocales, formatRelativeTime, formatDateLocale, formatTimeLocale, formatDateTimeLocale, getMonthNames, getDayNames, getFirstDayOfWeek, isLocaleSupported, getBestMatchingLocale, detectLocale, convertRelativeTime, detectLocaleFromRelativeTime, convertFormatPattern, convertFormattedDate, convertRelativeTimeArray, compareLocaleFormats } from './locale.js';
|
|
19
|
+
export { createRecurrence, getNextOccurrence, getOccurrencesBetween, isRecurrenceDate, isValidRecurrenceRule, recurrenceToString } from './recurrence.js';
|
|
20
|
+
export { createCountdown, getRemainingTime, formatCountdown, isExpired, getProgressPercentage, getTimeUntil, createDeadline, type Countdown, type RemainingTime, type CountdownOptions } from './countdown.js';
|
|
21
|
+
export { dateRangeOverlap, hasOverlappingRanges, mergeDateRanges, findGaps, splitRange, containsDate, getIntersection, getUnion, subtractRange, getRangeDuration, expandRange, shrinkRange, rangeContains, sortRanges } from './dateRange.js';
|
|
22
|
+
export { parseNaturalDate, parseRelativePhrase, extractDatesFromText, suggestDateFromContext, type NaturalParseOptions, type ExtractedDate } from './naturalLanguage.js';
|
|
19
23
|
export { MILLISECONDS_PER_SECOND, MILLISECONDS_PER_MINUTE, MILLISECONDS_PER_HOUR, MILLISECONDS_PER_DAY, MILLISECONDS_PER_WEEK, MILLISECONDS_PER_MONTH, MILLISECONDS_PER_YEAR, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, type TimeUnit, type FormatOptions } from './constants.js';
|
|
20
|
-
export type { DateInput, DateRange, ParseOptions, WorkingHoursConfig, AgeResult, ZonedTime, Interval, BenchmarkResult, RecurrencePattern, LocaleFormatOptions, BusinessConfig, DateValidator, DateTransformer, TimeUtilsError, ParseError, ValidationError, DurationUnit, DurationInput, DurationComparison, SerializationOptions, DateObject, EpochTimestamp, SupportedLocale, LocaleConfig, RelativeTimeOptions, RelativeTimeUnit } from './types.js';
|
|
24
|
+
export type { DateInput, DateRange, ParseOptions, WorkingHoursConfig, AgeResult, ZonedTime, Interval, BenchmarkResult, RecurrencePattern, RecurrenceRule, RecurrenceFrequency, LocaleFormatOptions, BusinessConfig, DateValidator, DateTransformer, TimeUtilsError, ParseError, ValidationError, DurationUnit, DurationInput, DurationComparison, SerializationOptions, DateObject, EpochTimestamp, SupportedLocale, LocaleConfig, RelativeTimeOptions, RelativeTimeUnit } from './types.js';
|
|
21
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,aAAa,EACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,SAAS,EACT,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,UAAU,EACX,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,cAAc,EACd,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACl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B,EACjB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,GAAG,EACH,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EAEZ,mBAAmB,EACnB,4BAA4B,EAC5B,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,aAAa,EACd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gB,EAChB,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,aAAa,EACb,UAAU,EACX,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -32,5 +32,13 @@ export { serializeDate, deserializeDate, createDateReviver, createDateReplacer,
|
|
|
32
32
|
export { registerLocale, getLocaleConfig, getSupportedLocales, formatRelativeTime, formatDateLocale, formatTimeLocale, formatDateTimeLocale, getMonthNames, getDayNames, getFirstDayOfWeek, isLocaleSupported, getBestMatchingLocale, detectLocale,
|
|
33
33
|
// Conversion utilities
|
|
34
34
|
convertRelativeTime, detectLocaleFromRelativeTime, convertFormatPattern, convertFormattedDate, convertRelativeTimeArray, compareLocaleFormats } from './locale.js';
|
|
35
|
+
// Recurrence utilities
|
|
36
|
+
export { createRecurrence, getNextOccurrence, getOccurrencesBetween, isRecurrenceDate, isValidRecurrenceRule, recurrenceToString } from './recurrence.js';
|
|
37
|
+
// Countdown utilities
|
|
38
|
+
export { createCountdown, getRemainingTime, formatCountdown, isExpired, getProgressPercentage, getTimeUntil, createDeadline } from './countdown.js';
|
|
39
|
+
// Date range utilities
|
|
40
|
+
export { dateRangeOverlap, hasOverlappingRanges, mergeDateRanges, findGaps, splitRange, containsDate, getIntersection, getUnion, subtractRange, getRangeDuration, expandRange, shrinkRange, rangeContains, sortRanges } from './dateRange.js';
|
|
41
|
+
// Natural language parsing utilities
|
|
42
|
+
export { parseNaturalDate, parseRelativePhrase, extractDatesFromText, suggestDateFromContext } from './naturalLanguage.js';
|
|
35
43
|
// Constants and types
|
|
36
44
|
export { MILLISECONDS_PER_SECOND, MILLISECONDS_PER_MINUTE, MILLISECONDS_PER_HOUR, MILLISECONDS_PER_DAY, MILLISECONDS_PER_WEEK, MILLISECONDS_PER_MONTH, MILLISECONDS_PER_YEAR, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK } from './constants.js';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Natural language date parsing utilities
|
|
3
|
+
* Provides intelligent parsing of human-readable date strings
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for natural language parsing
|
|
7
|
+
*/
|
|
8
|
+
export interface NaturalParseOptions {
|
|
9
|
+
/** Reference date for relative parsing (defaults to now) */
|
|
10
|
+
referenceDate?: Date;
|
|
11
|
+
/** Preferred time for dates without time specified */
|
|
12
|
+
defaultTime?: {
|
|
13
|
+
hour: number;
|
|
14
|
+
minute: number;
|
|
15
|
+
second?: number;
|
|
16
|
+
};
|
|
17
|
+
/** Locale for language-specific parsing */
|
|
18
|
+
locale?: string;
|
|
19
|
+
/** Whether to use strict parsing */
|
|
20
|
+
strict?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Extracted date information from text
|
|
24
|
+
*/
|
|
25
|
+
export interface ExtractedDate {
|
|
26
|
+
/** The parsed date */
|
|
27
|
+
date: Date;
|
|
28
|
+
/** The original text that was matched */
|
|
29
|
+
text: string;
|
|
30
|
+
/** Starting position in the original text */
|
|
31
|
+
index: number;
|
|
32
|
+
/** Type of date pattern matched */
|
|
33
|
+
type: 'absolute' | 'relative' | 'range' | 'time';
|
|
34
|
+
/** Confidence score (0-1) */
|
|
35
|
+
confidence: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parses natural language date strings into Date objects
|
|
39
|
+
* @param input - Natural language date string
|
|
40
|
+
* @param options - Parsing options
|
|
41
|
+
* @returns Parsed date or null if unable to parse
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* parseNaturalDate('tomorrow at 3pm');
|
|
46
|
+
* // Date for tomorrow at 15:00
|
|
47
|
+
*
|
|
48
|
+
* parseNaturalDate('next Friday');
|
|
49
|
+
* // Date for next Friday
|
|
50
|
+
*
|
|
51
|
+
* parseNaturalDate('in 2 weeks');
|
|
52
|
+
* // Date 2 weeks from now
|
|
53
|
+
*
|
|
54
|
+
* parseNaturalDate('December 25th');
|
|
55
|
+
* // Date for Dec 25 this year (or next if passed)
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseNaturalDate(input: string, options?: NaturalParseOptions): Date | null;
|
|
59
|
+
/**
|
|
60
|
+
* Parses a relative time phrase into a Date
|
|
61
|
+
* @param input - Relative time phrase
|
|
62
|
+
* @param referenceDate - Reference date (defaults to now)
|
|
63
|
+
* @returns Parsed date or null
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* parseRelativePhrase('in 2 hours'); // 2 hours from now
|
|
68
|
+
* parseRelativePhrase('5 minutes ago'); // 5 minutes ago
|
|
69
|
+
* parseRelativePhrase('next week'); // 7 days from now
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function parseRelativePhrase(input: string, referenceDate?: Date): Date | null;
|
|
73
|
+
/**
|
|
74
|
+
* Extracts all dates from a text string
|
|
75
|
+
* @param text - Text to extract dates from
|
|
76
|
+
* @param options - Extraction options
|
|
77
|
+
* @returns Array of extracted date information
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const text = "Meeting tomorrow at 3pm and dinner next Friday at 7pm";
|
|
82
|
+
* const dates = extractDatesFromText(text);
|
|
83
|
+
* // [
|
|
84
|
+
* // { date: Date(...), text: 'tomorrow at 3pm', index: 8, ... },
|
|
85
|
+
* // { date: Date(...), text: 'next Friday at 7pm', index: 37, ... }
|
|
86
|
+
* // ]
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function extractDatesFromText(text: string, options?: NaturalParseOptions): ExtractedDate[];
|
|
90
|
+
/**
|
|
91
|
+
* Suggests possible dates based on context
|
|
92
|
+
* @param context - Context string to analyze
|
|
93
|
+
* @param options - Parsing options
|
|
94
|
+
* @returns Array of suggested dates with confidence scores
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* suggestDateFromContext('deadline is end of month');
|
|
99
|
+
* // [{ date: Date(last day of current month), confidence: 0.8, ... }]
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function suggestDateFromContext(context: string, options?: NaturalParseOptions): Array<{
|
|
103
|
+
date: Date;
|
|
104
|
+
text: string;
|
|
105
|
+
confidence: number;
|
|
106
|
+
}>;
|
|
107
|
+
//# sourceMappingURL=naturalLanguage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naturalLanguage.d.ts","sourceRoot":"","sources":["../src/naturalLanguage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,sDAAsD;IACtD,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;IACjD,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,IAAI,GAAG,IAAI,CA8C9F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,IAAiB,GAAG,IAAI,GAAG,IAAI,CA6DhG;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,mBAAwB,GAChC,aAAa,EAAE,CAkDjB;A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