temporal-fmt 0.8.4 → 0.8.6

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 CHANGED
@@ -118,6 +118,11 @@ A few things worth knowing:
118
118
  This is different from mixing `HH` with `hh`/`h` above — there's only one hour token here, `a` just confirms it.
119
119
  - **`a` (AM/PM) matches case-insensitively** — `pm`, `Pm`, and `PM` all parse the same way. Month and weekday
120
120
  names (`MMMM`, `EEEE`, etc.) stay case-sensitive; only the day-period marker is case-folded.
121
+ - **`S` through `SSSSSSSSS` reach micro/nanosecond precision, not just milliseconds.** `SSS` is unchanged (3-digit
122
+ ms). Wider tokens expose whatever sub-millisecond precision the `Temporal` value actually carries — useful for
123
+ round-tripping machine-generated timestamps (DB exports, instrumentation logs) without silently truncating to
124
+ ms. Format truncates to the requested width (never rounds); parse right-pads short input, so `SSSSSSSSS` reading
125
+ `.5` means 500ms-worth of nanoseconds (`500000000`), not 5 nanoseconds.
121
126
  - **`MMMM`/`MMM` name matching assumes a 12-month calendar** — the vocabulary
122
127
  it matches against is generated from 12 Gregorian reference dates, so a
123
128
  calendar with a leap month (e.g. Hebrew's 13-month leap years) isn't fully
@@ -183,7 +188,8 @@ yourself.
183
188
  | m | minute | 45 |
184
189
  | ss | 2-digit second | 30 |
185
190
  | s | second | 30 |
186
- | SSS | milliseconds | 000 |
191
+ | SSS | milliseconds (3 digits) | 000 |
192
+ | SSSSSSSSS...S | fractional second, 1-9 digits — `S` through `SSSSSSSSS`. `SSS` is the common 3-digit millisecond case; wider widths reach micro/nanosecond precision. Format slices from the underlying nanosecond value (never rounds); parse right-pads whatever digits it captured (`.5` under `SSSSSSSSS` means 500,000,000ns, not 5ns) | `SSSSSSSSS` → 123456789 |
187
193
  | a | AM/PM (case-insensitive on parse) | PM |
188
194
  | Q | numeric quarter (1-4) | 3 |
189
195
  | QQQ | quarter with "Q" prefix (Q1, Q2, Q3, Q4) | Q3 |
@@ -232,7 +238,18 @@ formatDuration({ hours: 2, minutes: 30 }, 'h:mm') // "2:30"
232
238
 
233
239
  **Zero-value handling**: by default, zero-value units are omitted from the output. `formatDuration({ hours: 2 }, 'hhh mmm')` returns `"2 hours "` (the trailing space is the literal separator from the format string — the codemod doesn't do separator cleanup; the caller is responsible for structuring the format string). Pass `{ showZeroValues: true }` to force zero-value units to render.
234
240
 
235
- Unit names are hardcoded English in this pass. `Intl.DurationFormat` exists in some engines but is still maturing; for now, English-only is explicit. Callers wanting locale-aware duration formatting should use `Intl.DurationFormat` directly.
241
+ **Locale-aware unit names**: pass a `locale` option to localize the short/long forms via `Intl.NumberFormat`'s `style: 'unit'` mode same approach `formatDistance` uses for `Intl.RelativeTimeFormat`. Numeric-only tokens (`y`, `o`, `w`, ...) stay ASCII digits regardless of locale, matching the rest of the library's "numbers stay Western" convention.
242
+
243
+ ```js
244
+ formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm', { locale: 'fr-FR' }) // "2 heures 30 minutes"
245
+ formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm', { locale: 'es-ES' }) // "2 horas 30 minutos"
246
+ formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm', { locale: 'de-DE' }) // "2 Stunden 30 Minuten"
247
+ formatDuration({ milliseconds: 5 }, 'SSS', { locale: 'fr-FR' }) // "5 millisecondes"
248
+ ```
249
+
250
+ Without a `locale`, the original English hardcoded singular/plural table is used — byte-identical to previous versions. This is additive: existing calls with no `locale` produce the same output as before. (Passing `locale: 'en-US'` explicitly is *not* identical to no-locale — Intl's spacing differs from the hand-rolled English table, e.g. `"2 hr"` vs `"2h"`. Pick the path that matches your needs.)
251
+
252
+ Milliseconds *are* supported by `Intl.NumberFormat`'s unit list on every Node version this library targets — confirmed against the current Intl spec, not assumed. The original task brief flagged this as a possible gap; empirically it isn't.
236
253
 
237
254
  ## Relative time: formatDistance
238
255
 
@@ -252,19 +269,30 @@ formatDistance(today, today.add({ days: 2 }), { locale: 'fr-FR' }) // "dans 2 jo
252
269
 
253
270
  **Direction convention**: `diff = date1 - date2`. Positive diff → date1 is in the future relative to date2 → "in X". Negative diff → date1 is in the past → "X ago". Swap the args to flip the direction.
254
271
 
255
- **Unit-selection cutoffs** (documented, not configurable):
272
+ **Unit-selection cutoffs** (defaults documented below; per-call override via the `cutoffs` option):
256
273
 
257
- | abs(diff) | Unit |
258
- |-----------|------|
259
- | < 60 seconds | seconds |
260
- | < 60 minutes | minutes |
261
- | < 24 hours | hours |
262
- | < 30 days | days |
263
- | < 365 days | months |
264
- | otherwise | years |
274
+ | abs(diff) | Unit | Default cutoff |
275
+ |-----------|------|----------------|
276
+ | < 60 seconds | seconds | `seconds: 60` |
277
+ | < 60 minutes | minutes | `minutes: 60` |
278
+ | < 24 hours | hours | `hours: 24` |
279
+ | < 30 days | days | `days: 30` |
280
+ | < 365 days | months | `months: 365` (in days — see note) |
281
+ | otherwise | years | — |
265
282
 
266
283
  30 days is an approximation of a month (calendar months are 28-31 days); 365 days is an approximation of a year. These are the same cutoffs date-fns uses, trimmed to the units `Intl.RelativeTimeFormat` supports across engines.
267
284
 
285
+ The `months` cutoff is in days, not months — "months" itself isn't a fixed number of days, so the months→years boundary is expressed as a day count, matching how the original hardcoded table expressed the same boundary (`30 * MS_PER_DAY` for days, `365 * MS_PER_DAY` for the months cap). This lets a caller say "treat anything under 90 days as months" rather than "anything under 3 months as months" (which would require picking a definition of "month").
286
+
287
+ Override any subset of the boundaries per call. Unspecified boundaries fall back to the defaults above. Throws descriptively on non-monotonic boundaries (e.g. `seconds: 300, minutes: 1` — 300s > 1min, so the seconds branch would always win and the minutes branch would be unreachable) or non-positive values, rather than producing confusing output downstream.
288
+
289
+ ```js
290
+ formatDistance(in5d, today) // "in 5 days" (default cutoffs)
291
+ formatDistance(in14d, today, { cutoffs: { days: 10 } }) // "this month" (14d > 10d)
292
+ formatDistance(in200d, today, { cutoffs: { months: 100 } }) // "this year" (200d > 100d)
293
+ formatDistance(in30d, today) // "next month" (exactly at default 30d boundary → next unit up)
294
+ ```
295
+
268
296
  Accepts `Temporal.PlainDate`, `PlainDateTime`, or `ZonedDateTime`. A `PlainDate` is treated as midnight when diffing against a `PlainDateTime`. Throws on `PlainTime` (no anchor date to diff against) and on partial-date shapes (e.g. `{ year: 2026 }` with no month/day).
269
297
 
270
298
  ## Lenient parse mode
@@ -309,7 +337,7 @@ Registered vocab takes precedence over the `Intl`-derived vocab for that locale
309
337
 
310
338
  ## parseRelative: natural-language date parsing
311
339
 
312
- `parseRelative(input, referenceDate, options?)` resolves common English relative-date phrases against a reference date, returning a `Temporal.PlainDate`. English only this pass the matching patterns are hand-written regular expressions keyed on English month/weekday names.
340
+ `parseRelative(input, referenceDate, options?)` resolves common relative-date phrases against a reference date, returning a `Temporal.PlainDate`. English by default; pass `locale: 'es'` / `'fr'` / `'de'` (or any locale tag with that language subtag) to route to the corresponding grammar.
313
341
 
314
342
  Supported phrases:
315
343
 
@@ -318,6 +346,22 @@ Supported phrases:
318
346
  - **relative unit offsets**: "in 3 days", "2 weeks ago", "in 1 month", "1 year ago"
319
347
  - **month-day without year**: "March 5th", "Aug 4" (resolved to next occurrence)
320
348
 
349
+ Per-language equivalents (each grammar is its own module — phrase patterns and vocabulary are NOT shared across languages, only the matching engine and the resolution helpers are):
350
+
351
+ | Phrase class | es | fr | de |
352
+ |--------------|----|----|-----|
353
+ | today | `hoy` | `aujourd'hui` | `heute` |
354
+ | tomorrow | `mañana` | `demain` | `morgen` |
355
+ | yesterday | `ayer` | `hier` | `gestern` |
356
+ | next Tuesday | `el próximo martes` / `martes próximo` | `mardi prochain` | `nächsten Dienstag` |
357
+ | last Tuesday | `el martes pasado` | `mardi dernier` | `letzten Dienstag` |
358
+ | this Wednesday | `este miércoles` | `ce mercredi` | `diesen Mittwoch` |
359
+ | in 3 days | `en 3 días` | `dans 3 jours` | `in 3 Tagen` |
360
+ | 2 weeks ago | `hace 2 semanas` | `il y a 2 semaines` | `vor 2 Wochen` |
361
+ | March 5 | `5 de marzo` | `5 mars` | `5. März` |
362
+
363
+ Diacritics are stripped before matching (NFD + combining-mark removal), so `"miercoles"` matches the same as `"miércoles"`, `"aout"` as `"août"`, `"naechsten"` as `"nächsten"`. German umlaut transliterations (`ä` → `ae`, `ö` → `oe`, `ü` → `ue`, `ß` → `ss`) are also expanded, so `"5. Maerz"` resolves the same as `"5. März"`.
364
+
321
365
  ```js
322
366
  import { parseRelative } from 'temporal-fmt';
323
367
 
@@ -331,12 +375,30 @@ parseRelative('2 weeks ago', today).toString() // '2026-07-21'
331
375
  parseRelative('March 5th', today).toString() // '2027-03-05' (next occurrence)
332
376
  ```
333
377
 
378
+ Per-language examples:
379
+
380
+ ```js
381
+ parseRelative('mañana', today, { locale: 'es-ES' }).toString() // '2026-08-05'
382
+ parseRelative('el próximo martes', today, { locale: 'es-ES' }).toString() // '2026-08-11'
383
+ parseRelative('5 de marzo', today, { locale: 'es-ES' }).toString() // '2027-03-05'
384
+
385
+ parseRelative('demain', today, { locale: 'fr-FR' }).toString() // '2026-08-05'
386
+ parseRelative('mardi prochain', today, { locale: 'fr-FR' }).toString() // '2026-08-11'
387
+ parseRelative('5 mars', today, { locale: 'fr-FR' }).toString() // '2027-03-05'
388
+
389
+ parseRelative('morgen', today, { locale: 'de-DE' }).toString() // '2026-08-05'
390
+ parseRelative('nächsten Dienstag', today, { locale: 'de-DE' }).toString() // '2026-08-11'
391
+ parseRelative('5. März', today, { locale: 'de-DE' }).toString() // '2027-03-05'
392
+ ```
393
+
334
394
  **Ambiguous-case choices** (documented, not inferred):
335
395
 
336
396
  - **"next Tuesday" said on a Tuesday** = 7 days out, not today. "this Tuesday" handles the same-week case, so "next Tuesday" staying strictly-future gives the two phrases distinct, non-overlapping meanings.
337
397
  - **"last Tuesday" said on a Tuesday** = 7 days ago (strictly-past, symmetric to "next").
338
398
  - **"March 5th" without a year** = next occurrence. Future-leaning: today's date returns today; a past date this year returns next year's occurrence. (The alternative — "nearest in time, past or future" — would mean "March 5th" said on March 6 returns yesterday, which is counterintuitive for the typical "next birthday"/"next deadline" use case.)
339
- - **"5 days" without "in" or "ago"** = throws. Past or future? parseRelative refuses to guess — same contract as `parse()`'s strict mode.
399
+ - **"5 days" without "in" or "ago"** = throws. Past or future? parseRelative refuses to guess — same contract as `parse()`'s strict mode. Per-language equivalent: bare `"3 días"` / `"3 jours"` / `"3 Tage"` all throw with a localized error message pointing at the disambiguation options (`"en 3 días"`/`"hace 3 días"`, etc.).
400
+
401
+ **Cross-language consistency on the same-day-of-week ambiguity**: the "next X on X = 7 days out, not today" convention holds across all four supported languages (en/es/fr/de). The natural phrasing in each language (`"next Tuesday"` / `"el próximo martes"` / `"mardi prochain"` / `"nächsten Dienstag"`) all resolve to strictly-future-next-week when said on the named weekday. This is a deliberate cross-language convention, not an accident of implementation — if a future language grammar's natural phrasing for "next X" resolves differently by convention, document it in that grammar's section and the README here.
340
402
 
341
403
  Throws a descriptive error for any phrase it doesn't recognize, naming the supported categories in the message. Accepts `PlainDate`, `PlainDateTime`, or `ZonedDateTime` as the reference (needs `dayOfWeek` to compute weekday offsets). Throws on `PlainTime`.
342
404
 
@@ -1,4 +1,11 @@
1
1
  import { type FormatOptions } from './tokens.cjs';
2
+ export interface DistanceCutoffs {
3
+ seconds?: number;
4
+ minutes?: number;
5
+ hours?: number;
6
+ days?: number;
7
+ months?: number;
8
+ }
2
9
  export interface FormatDistanceOptions extends FormatOptions {
3
10
  /**
4
11
  * 'auto' (default) lets Intl.RelativeTimeFormat use natural forms like
@@ -6,6 +13,17 @@ export interface FormatDistanceOptions extends FormatOptions {
6
13
  * 'always' forces the strict "1 day ago"/"in 1 day"/"in 0 seconds" form.
7
14
  */
8
15
  numeric?: 'always' | 'auto';
16
+ /**
17
+ * Override the unit-selection boundaries (seconds→minutes,
18
+ * minutes→hours, hours→days, days→months, months→years). Any
19
+ * subset can be supplied; omitted boundaries fall back to the
20
+ * defaults (60s, 60min, 24h, 30d, 365d). Values are in each
21
+ * unit's native scale except `months`, which is in days — see
22
+ * DistanceCutoffs. Throws descriptively on non-monotonic
23
+ * boundaries or non-positive values, rather than producing
24
+ * confusing output downstream.
25
+ */
26
+ cutoffs?: DistanceCutoffs;
9
27
  }
10
28
  /**
11
29
  * Returns a human-readable relative-time string describing `date1`
@@ -1,4 +1,11 @@
1
1
  import { type FormatOptions } from './tokens.js';
2
+ export interface DistanceCutoffs {
3
+ seconds?: number;
4
+ minutes?: number;
5
+ hours?: number;
6
+ days?: number;
7
+ months?: number;
8
+ }
2
9
  export interface FormatDistanceOptions extends FormatOptions {
3
10
  /**
4
11
  * 'auto' (default) lets Intl.RelativeTimeFormat use natural forms like
@@ -6,6 +13,17 @@ export interface FormatDistanceOptions extends FormatOptions {
6
13
  * 'always' forces the strict "1 day ago"/"in 1 day"/"in 0 seconds" form.
7
14
  */
8
15
  numeric?: 'always' | 'auto';
16
+ /**
17
+ * Override the unit-selection boundaries (seconds→minutes,
18
+ * minutes→hours, hours→days, days→months, months→years). Any
19
+ * subset can be supplied; omitted boundaries fall back to the
20
+ * defaults (60s, 60min, 24h, 30d, 365d). Values are in each
21
+ * unit's native scale except `months`, which is in days — see
22
+ * DistanceCutoffs. Throws descriptively on non-monotonic
23
+ * boundaries or non-positive values, rather than producing
24
+ * confusing output downstream.
25
+ */
26
+ cutoffs?: DistanceCutoffs;
9
27
  }
10
28
  /**
11
29
  * Returns a human-readable relative-time string describing `date1`
@@ -18,10 +18,19 @@ export interface DurationFormatOptions extends FormatOptions {
18
18
  * Zero-value units are omitted by default; pass { showZeroValues: true }
19
19
  * to force them to appear.
20
20
  *
21
+ * Unit-name localization: without a `locale`, output is the original
22
+ * English hardcoded singular/plural forms (byte-identical to previous
23
+ * versions). With a `locale`, the short/long forms delegate to
24
+ * `Intl.NumberFormat`'s `style: 'unit'` — same approach `formatDistance`
25
+ * already uses for `Intl.RelativeTimeFormat`. Numeric-only tokens
26
+ * (`y`, `o`, `w`, ...) are not affected by `locale`; they remain ASCII
27
+ * digits, matching the rest of this library's "numbers stay Western"
28
+ * convention.
29
+ *
21
30
  * @example
22
31
  * formatDuration(Temporal.Duration.from({ years: 2, months: 1 }), 'yyy ooo')
23
32
  * // "2 years 1 month"
24
- * formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm')
25
- * // "2 hours 30 minutes"
33
+ * formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm', { locale: 'fr-FR' })
34
+ * // "2 heures 30 minutes"
26
35
  */
27
36
  export declare function formatDuration(duration: Record<string, unknown>, formatStr: string, options?: DurationFormatOptions): string;
@@ -18,10 +18,19 @@ export interface DurationFormatOptions extends FormatOptions {
18
18
  * Zero-value units are omitted by default; pass { showZeroValues: true }
19
19
  * to force them to appear.
20
20
  *
21
+ * Unit-name localization: without a `locale`, output is the original
22
+ * English hardcoded singular/plural forms (byte-identical to previous
23
+ * versions). With a `locale`, the short/long forms delegate to
24
+ * `Intl.NumberFormat`'s `style: 'unit'` — same approach `formatDistance`
25
+ * already uses for `Intl.RelativeTimeFormat`. Numeric-only tokens
26
+ * (`y`, `o`, `w`, ...) are not affected by `locale`; they remain ASCII
27
+ * digits, matching the rest of this library's "numbers stay Western"
28
+ * convention.
29
+ *
21
30
  * @example
22
31
  * formatDuration(Temporal.Duration.from({ years: 2, months: 1 }), 'yyy ooo')
23
32
  * // "2 years 1 month"
24
- * formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm')
25
- * // "2 hours 30 minutes"
33
+ * formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm', { locale: 'fr-FR' })
34
+ * // "2 heures 30 minutes"
26
35
  */
27
36
  export declare function formatDuration(duration: Record<string, unknown>, formatStr: string, options?: DurationFormatOptions): string;
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var ie=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Ze=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},He=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ve(t))!Ye.call(e,o)&&o!==n&&ie(e,o,{get:()=>t[o],enumerable:!(r=Ue(t,o))||r.enumerable});return e};var je=e=>He(ie({},"__esModule",{value:!0}),e);var jt={};Ze(jt,{format:()=>xe,formatDistance:()=>Ae,formatDuration:()=>Oe,parse:()=>Fe,parseRelative:()=>Ce,registerLocaleVocab:()=>Te,setTemporal:()=>Ee});module.exports=je(jt);var we,be=[];function ke(e){be.push(e)}function Ee(e){we=e;for(let t of be)t()}function ze(){return we??globalThis.Temporal}function $(){let e=ze();if(!e)throw new Error("temporal-fmt: parse() needs a Temporal implementation to construct its result. Call setTemporal(Temporal) once at startup, or assign one to globalThis.Temporal (native on Node 26+, or a polyfill like temporal-polyfill).");return e}var se=new Map;function Ke(e,t){let n=[{key:"monthLong",length:12,label:"long month names"},{key:"monthShort",length:12,label:"short month names"},{key:"weekdayLong",length:7,label:"long weekday names"},{key:"weekdayShort",length:7,label:"short weekday names"},{key:"dayPeriod",length:2,label:"day period markers (AM/PM-equivalent)"}];for(let{key:r,length:o,label:a}of n){let i=e[r];if(i===void 0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}" is missing required field "${r}" (${a}).`);if(!Array.isArray(i))throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}" must be an array, got ${typeof i}.`);if(i.length!==o)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}" must have exactly ${o} entries (got ${i.length}) \u2014 ${a}.`);i.forEach((s,m)=>{if(typeof s!="string"||s.length===0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}[${m}]" must be a non-empty string, got ${String(s)}.`)})}if(M(e.monthLong,"MMMM month",t),M(e.monthShort,"MMM month",t),M(e.weekdayLong,"EEEE weekday",t),M(e.weekdayShort,"EEE weekday",t),e.dayPeriod[0]===e.dayPeriod[1])throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": dayPeriod entries must differ (both are "${e.dayPeriod[0]}"); otherwise parse() can't tell AM from PM.`)}function Te(e,t){if(typeof e!="string"||e.length===0)throw new Error(`temporal-fmt: registerLocaleVocab requires a non-empty locale string, got ${String(e)}.`);Ke(t,e);let n=P(e);se.set(n,{monthLong:[...t.monthLong],monthShort:[...t.monthShort],weekdayLong:[...t.weekdayLong],weekdayShort:[...t.weekdayShort],dayPeriod:[...t.dayPeriod]}),L.delete(n)}function P(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}var L=new Map,We=500;function F(e,t,n){let r=e.formatToParts(t),o=r.findIndex(m=>m.type===n);if(o===-1)throw new Error(`temporal-fmt: locale produced no "${n}" part while building match vocabulary.`);let a=r[o].value,i=r[o-1],s=r[o+1];return i?.type==="literal"&&!/\s/.test(i.value)&&(a=i.value+a),s?.type==="literal"&&!/\s/.test(s.value)&&(a=a+s.value),a}function M(e,t,n){let r=new Map;for(let o=0;o<e.length;o++){let a=r.get(e[o]);if(a!==void 0)throw new Error(`temporal-fmt: locale "${n}" renders ${t} index ${a} and ${o} identically ("${e[o]}"). parse() can't reliably tell these apart for this locale/token, so this combination isn't supported.`);r.set(e[o],o)}}function O(e){let t=P(e);return se.get(t)}function N(e){let t=P(e),n=se.get(t);if(n)return n;let r=L.get(t);if(r)return r;let o=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),a=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[],s=[];for(let y=0;y<12;y++){let T=new Date(Date.UTC(2020,y,1));i.push(F(o,T,"month")),s.push(F(a,T,"month"))}M(i,"MMMM month",e),M(s,"MMM month",e);let m=new Intl.DateTimeFormat(e,{weekday:"long",timeZone:"UTC"}),c=new Intl.DateTimeFormat(e,{weekday:"short",timeZone:"UTC"}),u=[],l=[];for(let y=0;y<7;y++){let T=new Date(Date.UTC(2024,0,1+y));u.push(F(m,T,"weekday")),l.push(F(c,T,"weekday"))}M(u,"EEEE weekday",e),M(l,"EEE weekday",e);let d=new Intl.DateTimeFormat(e,{hour:"numeric",hour12:!0,timeZone:"UTC"}),f=F(d,new Date(Date.UTC(2020,0,1,1)),"dayPeriod"),p=F(d,new Date(Date.UTC(2020,0,1,13)),"dayPeriod"),w=[...new Set([f,p])],b={monthLong:i,monthShort:s,weekdayLong:u,weekdayShort:l,dayPeriod:w};if(L.size>=We){let y=L.keys().next().value;y!==void 0&&L.delete(y)}return L.set(t,b),b}var Qe=[0,31,59,90,120,151,181,212,243,273,304,334];function I(e){return e%4===0&&e%100!==0||e%400===0}function C(e){return I(e)?366:365}function ue(e,t,n){let r=Qe[t-1]+n;return t>2&&I(e)&&(r+=1),r}var me=2e3;function qe(e){let t=0;if(e>=me)for(let r=me;r<e;r++)t+=C(r);else for(let r=e;r<me;r++)t-=C(r);return((5+t)%7+7)%7+1}function de(e,t,n,r){let a=ue(e,t,n)+(4-r),i,s;a<1?(i=e-1,s=a+C(i)):a>C(e)?(i=e+1,s=a-C(e)):(i=e,s=a);let c=1+(4-qe(i)+7)%7,u=1+Math.floor((s-c)/7);return{isoYear:i,week:u}}function k(e,t){let n=e<0,r=String(Math.abs(e)).padStart(t,"0");return n?"-"+r:r}var R="en-US",_=new Map,Ge=500;function De(e,t){let n=JSON.stringify([P(e),t]),r=_.get(n);if(r)return r;if(_.size>=Ge){let o=_.keys().next().value;o!==void 0&&_.delete(o)}return r=new Intl.DateTimeFormat(e,t),_.set(n,r),r}var U;ke(()=>{U=void 0});function Xe(){if(U===void 0){U=!1;try{let e=$();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),U=!0}catch{}}return U}function Be(e,t,n,r){let o=e?.calendarId,a={...n,calendar:o&&o!=="iso8601"?o:"gregory"};if(!Xe())return e.toLocaleString(t,a);let{toInstant:i,timeZoneId:s}=e,m=typeof i=="function"&&typeof s=="string",c=m?e.toInstant():e,u={...a,...m?{timeZone:s}:{}},d=De(t,u).formatToParts(c),f=d.findIndex(y=>y.type===r);if(f===-1)throw new Error(`temporal-fmt: locale "${t}" produced no "${r}" part for this token. This usually means the Temporal object is missing the field the token needs.`);let p=d[f].value,w=d[f-1],b=d[f+1];return w?.type==="literal"&&!/\s/.test(w.value)&&(p=w.value+p),b?.type==="literal"&&!/\s/.test(b.value)&&(p=p+b.value),p}function Je(e,t){let n=O(t);if(n)return e<12?n.dayPeriod[0]:n.dayPeriod[1];let r=new Date(Date.UTC(1970,0,1,e)),a=De(t,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(i=>i.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${t}" produced no "dayPeriod" part for token "a".`);return a.value}function K(e,t,n,r,o,a){return o&&a!==void 0&&a>=0&&a<o.length?o[a]:Be(e,t,n,r)}var W=[["yyyy",e=>k(e.year,4),"year"],["yy",e=>{if(e.year<0)throw new Error(`temporal-fmt: token "yy" doesn't support negative years (got ${e.year}), since truncating to 2 digits would make it indistinguishable from a positive year. Use "yyyy" instead.`);return k(e.year%100,2)},"year"],["MMMM",(e,t)=>{let n=O(t);return K(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["MMM",(e,t)=>{let n=O(t);return K(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["MM",e=>k(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>k(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,t)=>{let n=O(t);return K(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,t)=>{let n=O(t);return K(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>k(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>k(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>k(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>k(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSS",e=>k(e.millisecond,3),"millisecond"],["a",(e,t)=>Je(e.hour,t),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["do",e=>{let t=e.day,n=t%10,r=t%100;return r>=11&&r<=13?t+"th":n===1?t+"st":n===2?t+"nd":n===3?t+"rd":t+"th"},"day"],["Q",e=>String(Math.ceil(e.month/3)),"month"],["QQQ",e=>"Q"+Math.ceil(e.month/3),"month"],["ww",e=>{let{week:t}=de(e.year,e.month,e.day,e.dayOfWeek);return k(t,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:t}=de(e.year,e.month,e.day,e.dayOfWeek);return k(t,4)},"dayOfWeek"]];var et=W.map(([e])=>e).sort((e,t)=>t.length-e.length);function Q(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r==="'"){if(e[n+1]==="'"){le(t,"'"),n+=2;continue}let a=n+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in format string "${e}"`);le(t,i),n=a;continue}let o=et.find(a=>e.startsWith(a,n));if(o){t.push({kind:"token",value:o}),n+=o.length;continue}le(t,r),n+=1}return t}function le(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}var tt=new Map(W.map(([e,t,n])=>[e,{fn:t,field:n}]));function xe(e,t,n={}){if(t.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${t.length}).`);let r=n.locale??R,o=Q(t),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=tt.get(i.value);if(!s)throw new Error(`temporal-fmt: unknown token "${i.value}"`);if(e[s.field]===void 0)throw new Error(`temporal-fmt: token "${i.value}" requires "${s.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`);a+=s.fn(e,r)}return a}function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e,t=!1){let n=e.map(nt);return t?`(?:${n.map(rt).join("|")})`:`(?:${n.join("|")})`}function rt(e){return e.replace(/[a-zA-Z]/g,t=>`[${t.toLowerCase()}${t.toUpperCase()}]`)}var ot="(?:UTC|[+-]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?|[A-Za-z_]+(?:[+-]\\d{1,2})?(?:\\/[A-Za-z0-9_+-]+)*)";function at(){return ot}var q;function it(){return q||(q=new Set(Intl.supportedValuesOf("timeZone")),q.add("UTC")),q}var st=/^[+-]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/;function Me(e){return st.test(e)||it().has(e)}var mt={yy:"\\d{2}",MM:"(?:0[1-9]|1[0-2])",M:"(?:1[0-2]|[1-9])",dd:"(?:0[1-9]|[12]\\d|3[01])",d:"(?:[12]\\d|3[01]|[1-9])",HH:"(?:[01]\\d|2[0-3])",H:"(?:1\\d|2[0-3]|[0-9])",hh:"(?:0[1-9]|1[0-2])",h:"(?:1[0-2]|[1-9])",mm:"(?:[0-5]\\d)",m:"(?:[1-5]\\d|[0-9])",ss:"(?:[0-5]\\d)",s:"(?:[1-5]\\d|[0-9])",SSS:"\\d{3}",Q:"[1-4]"},ut="Q[1-4]",dt=new Set(["do","ww","RRRR"]),lt="-?\\d{4}",ct="-?\\d{4,}",ft=new Set(["yyyy","yy","MM","M","dd","d","HH","H","hh","h","mm","m","ss","s","SSS"]);function Pe(e,t,n){if(e==="yyyy")return n!==void 0&&ft.has(n)?lt:ct;let r=mt[e];if(r)return r;if(e==="QQQ")return ut;if(dt.has(e))throw new Error(`temporal-fmt: token "${e}" is format-only \u2014 it can't be parsed back into a value. Use a different token in the parse format string (e.g. "d" for "do", "MM" for "ww").`);let o=N(t);switch(e){case"MMMM":return Y(o.monthLong);case"MMM":return Y(o.monthShort);case"EEEE":return Y(o.weekdayLong);case"EEE":return Y(o.weekdayShort);case"a":return Y(o.dayPeriod,!0);case"zzz":return at();default:throw new Error(`temporal-fmt: unknown token "${e}"`)}}var ve=new Set(["M","d","H","h","m","s"]),ht={M:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],d:[{digits:1,min:1,max:9},{digits:2,min:10,max:31}],H:[{digits:1,min:0,max:9},{digits:2,min:10,max:23}],h:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],m:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}],s:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}]};function Se(e,t){let n=new Map;function r(o,a){let i=`${o}:${a}`,s=n.get(i);if(s)return s;if(o===t.length){let l=a===e.length?[[]]:[];return n.set(i,l),l}let m=t[o],c=ht[m];if(!c)throw new Error(`temporal-fmt: internal error \u2014 "${m}" is not an unpadded numeric token`);let u=[];for(let{digits:l,min:d,max:f}of c){if(a+l>e.length)continue;let p=e.slice(a,a+l);if(l===2&&p[0]==="0")continue;let w=Number(p);if(!(w<d||w>f)){for(let b of r(o+1,a+l))if(u.push([w,...b]),u.length===2)break;if(u.length===2)break}}return n.set(i,u),u}return r(0,0)}function gt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(e,t){let n=[],r=[],o="",a=0,i={groupNames:[],tokens:[]},s=()=>{i.tokens.length>=2&&r.push(i),i={groupNames:[],tokens:[]}};for(let[m,c]of e.entries()){if(c.kind==="literal"){o+=gt(c.value),s();continue}let u=`g${a++}`;n.push({name:u,token:c.value});let l=e[m+1],d=l?.kind==="token"?l.value:void 0;o+=`(?<${u}>${Pe(c.value,t,d)})`,ve.has(c.value)?(i.groupNames.push(u),i.tokens.push(c.value)):s()}return s(),{regex:new RegExp(`^(?:${o})$`,"u"),groups:n,ambiguousRuns:r}}var Z=new Map,yt=500;function wt(e,t){let n=JSON.stringify([P(t),e]),r=Z.get(n);if(r)return r;if(Z.size>=yt){let o=Z.keys().next().value;o!==void 0&&Z.delete(o)}return r=$e(Q(e),t),Z.set(n,r),r}var A=new Map,bt=500;function kt(e){let t=new Intl.Locale(e).toString().toLowerCase();if(A.has(t))return A.get(t);if(A.size>=bt){let i=A.keys().next().value;i!==void 0&&A.delete(i)}let n,r=t.split("-"),o=r.indexOf("u"),a=o===-1?-1:r.indexOf("ca",o+1);if(a!==-1&&a+1<r.length){let i=new Intl.DateTimeFormat(t).resolvedOptions().calendar;n=i==="gregory"?void 0:i}return A.set(t,n),n}function g(e,t,n){e[t]=n}function Et(e,t,n,r,o){let a=N(r);switch(t){case"yyyy":g(e,"year",Number(n));break;case"yy":g(e,"twoDigitYear",Number(n));break;case"MM":case"M":g(e,"month",Number(n));break;case"MMMM":g(e,"month",a.monthLong.indexOf(n)+1);break;case"MMM":g(e,"month",a.monthShort.indexOf(n)+1);break;case"dd":case"d":g(e,"day",Number(n));break;case"EEEE":g(e,"weekdayRaw",n),g(e,"weekdayExpected",a.weekdayLong.indexOf(n)+1);break;case"EEE":g(e,"weekdayRaw",n),g(e,"weekdayExpected",a.weekdayShort.indexOf(n)+1);break;case"HH":case"H":g(e,"hour",Number(n));break;case"hh":case"h":g(e,"hour12",Number(n));break;case"mm":case"m":g(e,"minute",Number(n));break;case"ss":case"s":g(e,"second",Number(n));break;case"SSS":g(e,"millisecond",Number(n));break;case"a":{let i=a.dayPeriod.findIndex(s=>s.toLowerCase()===n.toLowerCase());if(i<0)throw new Error(`temporal-fmt: unknown day period "${n}" for locale "${r}".`);g(e,"dayPeriodRaw",n),g(e,"isPM",i===1);break}case"zzz":g(e,"timeZoneId",n);break;case"Q":g(e,"quarter",Number(n));break;case"QQQ":g(e,"quarter",Number(n.slice(1)));break}}function Tt(e,t){let n=t.indexOf("d");if(n!==-1){let r=e.filter(o=>o[n]<=12);if(r.length>0)return r[0]}return e[0]}function Dt(e){if(e.year!==void 0&&e.twoDigitYear!==void 0)throw new Error('temporal-fmt: format string mixes "yyyy" and "yy" year representations.');if(e.year!==void 0)return e.year;if(e.twoDigitYear!==void 0)return e.twoDigitYear<=68?2e3+e.twoDigitYear:1900+e.twoDigitYear}function xt(e,t,n){if(e.hour!==void 0&&e.hour12!==void 0)throw new Error(`temporal-fmt: format string "${t}" mixes a 24-hour token ("HH"/"H") with a 12-hour token ("hh"/"h").`);if(e.hour!==void 0){if(e.dayPeriodRaw!==void 0){let r=N(n),o=e.hour<12?r.dayPeriod[0]:r.dayPeriod[1];if(e.dayPeriodRaw.toLowerCase()!==o?.toLowerCase())throw new Error(`temporal-fmt: format string "${t}" contains a day period that contradicts the 24-hour value.`)}return e.hour}if(e.hour12!==void 0){if(e.isPM===void 0)throw new Error(`temporal-fmt: format string "${t}" uses a 12-hour token ("hh"/"h") without an "a" token, so parse() can't tell AM from PM.`);return e.hour12%12+(e.isPM?12:0)}}function Fe(e,t,n={}){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);if(t.length>1e5)throw new Error(`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${t.length}).`);let r=n.locale??R,o=kt(r),a=wt(e,r),i=a.regex.exec(t);if(!i)throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");if(a.groups.length===0)throw new Error(`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`);for(let{name:h,token:E}of a.groups)if(E==="zzz"&&!Me(i.groups[h]))throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");let s=[];for(let h of a.ambiguousRuns){let E=h.groupNames.map(ae=>i.groups[ae]).join(""),D=Se(E,h.tokens);if(D.length>1){if(!n.lenient)throw new Error(`temporal-fmt: "${E}" in format string "${e}" is ambiguous \u2014 ${D.length} different ways to read tokens "${h.tokens.join("")}" (with no separator between them) are all individually valid (e.g. ${JSON.stringify(D[0])} vs ${JSON.stringify(D[1])}). parse() won't guess; add a separator between these tokens, or use their padded form (e.g. "MM" instead of "M") so each one has a fixed width. Pass { lenient: true } to opt into a documented heuristic that picks one.`);s.push({groupNames:h.groupNames,values:Tt(D,h.tokens)})}}let m={},c=new Map;for(let{groupNames:h,values:E}of s)h.forEach((D,ae)=>c.set(D,String(E[ae])));for(let{name:h,token:E}of a.groups){let D=c.get(h)??i.groups[h];Et(m,E,D,r,e)}let u=Dt(m),l=xt(m,e,r),{month:d,day:f,minute:p,second:w,millisecond:b,timeZoneId:y,weekdayExpected:T,weekdayRaw:Ie,quarter:te}=m,_e=u!==void 0||d!==void 0||f!==void 0,v=u!==void 0&&d!==void 0&&f!==void 0;if(_e&&!v)throw new Error(`temporal-fmt: format string "${e}" has an incomplete date \u2014 year, month, and day tokens must all be present together.`);let ne=l!==void 0||p!==void 0||w!==void 0||b!==void 0;if(y!==void 0&&!(v&&ne))throw new Error(`temporal-fmt: format string "${e}" has a "zzz" token but needs a full date and time to build a ZonedDateTime.`);if(T!==void 0&&!v)throw new Error(`temporal-fmt: format string "${e}" has a weekday token ("EEEE"/"EEE") but needs a full date to validate it against.`);if(!v&&!ne)throw new Error(`temporal-fmt: format string "${e}" has no date or time tokens to parse.`);let j=$(),re={hour:l??0,minute:p??0,second:w??0,millisecond:b??0},oe=o?{calendar:o}:{},z={overflow:"reject"},S;try{y!==void 0?S=j.ZonedDateTime.from({year:u,month:d,day:f,...re,...oe,timeZone:y},z):v&&ne?S=j.PlainDateTime.from({year:u,month:d,day:f,...re,...oe},z):v?S=j.PlainDate.from({year:u,month:d,day:f,...oe},z):S=j.PlainTime.from(re,z)}catch(h){throw new Error(`temporal-fmt: "${t}" doesn't describe a valid date/time for format "${e}": ${h.message}`)}if(T!==void 0){let h=S.dayOfWeek;if(h!==T){let E=N(r);throw new Error(`temporal-fmt: "${Ie}" doesn't match the actual weekday (${E.weekdayLong[h-1]}) for the parsed date.`)}}if(te!==void 0&&d!==void 0){let h=Math.ceil(d/3);if(te!==h)throw new Error(`temporal-fmt: format string "${e}" contains a quarter token (Q/QQQ) whose value (Q${te}) disagrees with the parsed month's actual quarter \u2014 month ${d} is in Q${h}.`)}return S}var Le={y:{longSingular:"year",longPlural:"years",shortSingular:"yr",shortPlural:"yrs",field:"years"},o:{longSingular:"month",longPlural:"months",shortSingular:"mo",shortPlural:"mos",field:"months"},w:{longSingular:"week",longPlural:"weeks",shortSingular:"wk",shortPlural:"wks",field:"weeks"},d:{longSingular:"day",longPlural:"days",shortSingular:"d",shortPlural:"d",field:"days"},h:{longSingular:"hour",longPlural:"hours",shortSingular:"h",shortPlural:"h",field:"hours"},m:{longSingular:"minute",longPlural:"minutes",shortSingular:"m",shortPlural:"m",field:"minutes"},s:{longSingular:"second",longPlural:"seconds",shortSingular:"s",shortPlural:"s",field:"seconds"},S:{longSingular:"millisecond",longPlural:"milliseconds",shortSingular:"ms",shortPlural:"ms",field:"milliseconds"}},Mt=Object.keys(Le).flatMap(e=>[e+e+e,e+e,e]).sort((e,t)=>t.length-e.length);function Pt(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r==="'"){if(e[n+1]==="'"){ce(t,"'"),n+=2;continue}let a=n+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in duration format string "${e}"`);ce(t,i),n=a;continue}let o=Mt.find(a=>e.startsWith(a,n));if(o){let a=o[0],i=o.length===1?"numeric":o.length===2?"short":"long";t.push({kind:"token",value:o,unit:a,form:i}),n+=o.length;continue}ce(t,r),n+=1}return t}function ce(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}function vt(e,t){let n=e[t];if(n==null)return 0;if(typeof n=="number"&&Number.isFinite(n))return n;let r=Number(n);if(!Number.isFinite(r))throw new Error(`temporal-fmt: duration field "${t}" is not a finite number (got ${String(n)}).`);return r}function Oe(e,t,n={}){if(t.length>1e3)throw new Error(`temporal-fmt: duration format string exceeds maximum length of ${1e3} characters (got ${t.length}).`);n.locale;let r=n.showZeroValues===!0,o=Pt(t),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=Le[i.unit];if(!s)throw new Error(`temporal-fmt: unknown duration token "${i.value}"`);let m=vt(e,s.field);m===0&&!r||(i.form==="numeric"?a+=String(m):i.form==="short"?a+=m+(m===1||m===-1?s.shortSingular:s.shortPlural):a+=m+" "+(m===1||m===-1?s.longSingular:s.longPlural))}return a}function Ne(e,t){if(e===null||typeof e!="object")throw new Error(`temporal-fmt: formatDistance expects Temporal values, got ${t} = ${String(e)}.`);let n=e,r=typeof n.year=="number",o=typeof n.month=="number",a=typeof n.day=="number";if(r!==o||o!==a)throw new Error(`temporal-fmt: formatDistance got a ${t} with a partial date (some of year/month/day missing). Pass a full Temporal.PlainDate / PlainDateTime / ZonedDateTime.`);return{year:r?n.year:void 0,month:o?n.month:void 0,day:a?n.day:void 0,hour:typeof n.hour=="number"?n.hour:void 0,minute:typeof n.minute=="number"?n.minute:void 0,second:typeof n.second=="number"?n.second:void 0,millisecond:typeof n.millisecond=="number"?n.millisecond:void 0}}var fe=2e3,he=1e3,G=60*he,X=60*G,x=24*X;function St(e,t,n){let r=0;if(e>=fe)for(let o=fe;o<e;o++)r+=I(o)?366:365;else for(let o=e;o<fe;o++)r-=I(o)?366:365;return r+=ue(e,t,n)-1,r}function Re(e){if(e.year===void 0||e.month===void 0||e.day===void 0)throw new Error("temporal-fmt: formatDistance needs a Temporal value with year/month/day fields (PlainDate, PlainDateTime, or ZonedDateTime). A PlainTime or other shape has no anchor date to diff against.");let t=St(e.year,e.month,e.day),n=e.hour??0,r=e.minute??0,o=e.second??0,a=e.millisecond??0;return t*x+n*X+r*G+o*he+a}var $t=[{maxMs:G,unit:"second"},{maxMs:X,unit:"minute"},{maxMs:x,unit:"hour"},{maxMs:30*x,unit:"day"},{maxMs:365*x,unit:"month"}],H=new Map,Ft=100;function Lt(e,t){let n=`${Ot(e)}|${t}`,r=H.get(n);if(r)return r;if(H.size>=Ft){let o=H.keys().next().value;o!==void 0&&H.delete(o)}return r=new Intl.RelativeTimeFormat(e,{numeric:t}),H.set(n,r),r}function Ot(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function Ae(e,t,n={}){let r=Ne(e,"date1"),o=Ne(t,"date2"),a=Re(r)-Re(o),i=Math.abs(a),s="year";for(let{maxMs:f,unit:p}of $t)if(i<f){s=p;break}let m=Nt(s),c=Math.round(a/m),u=n.numeric??"auto",l=n.locale??R;return Lt(l,u).format(c,s)}function Nt(e){switch(e){case"second":return he;case"minute":return G;case"hour":return X;case"day":return x;case"week":return 7*x;case"month":return 30*x;case"quarter":return 91*x;case"year":return 365*x;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var pe=["January","February","March","April","May","June","July","August","September","October","November","December"],Rt=pe.flatMap((e,t)=>[[e,t+1],[e.slice(0,3),t+1]]),At=Rt.map(([e])=>e).join("|"),ye=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ct=ye.join("|");function It(e){let t=e.toLowerCase(),n=ye.find(r=>r.toLowerCase()===t);return ye.indexOf(n??e)+1}function _t(e){let t=e.toLowerCase(),n=pe.findIndex(o=>o.toLowerCase()===t);return n>=0?n+1:pe.findIndex(o=>o.slice(0,3).toLowerCase()===t)+1}function Ut(e){let t=e.dayOfWeek;if(typeof t!="number")throw new Error("temporal-fmt: parseRelative needs a reference date exposing dayOfWeek (a Temporal.PlainDate / PlainDateTime / ZonedDateTime).");return t}function B(e){if(typeof e.year!="number")throw new Error("temporal-fmt: parseRelative reference date is missing year.");return e.year}function J(e){if(typeof e.month!="number")throw new Error("temporal-fmt: parseRelative reference date is missing month.");return e.month}function ee(e){if(typeof e.day!="number")throw new Error("temporal-fmt: parseRelative reference date is missing day.");return e.day}function Ce(e,t,n={}){n.locale;let r=t,o=$(),a=(e??"").trim().replace(/\s+/g," ");if(a.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");let i=a.toLowerCase();if(i==="today")return Yt(o,B(r),J(r),ee(r));if(i==="tomorrow")return ge(o,r,1);if(i==="yesterday")return ge(o,r,-1);let s=a.match(new RegExp(`^(next|last|this)\\s+(${Ct})$`,"i"));if(s){let u=s[1].toLowerCase(),l=s[2],d=Ut(r),f=It(l),p=Vt(u,d,f);return ge(o,r,p)}let m=a.match(/^(in\s+)?(\d+)\s+(day|week|month|year)s?(?:\s+ago)?$/i);if(m){let u=m[1],l=m[2],d=m[3].toLowerCase(),f=!!u,p=/\bago\b/i.test(a);if(!f&&!p)throw new Error(`temporal-fmt: parseRelative can't tell whether "${a}" is past or future \u2014 use "in ${l} ${d}s" or "${l} ${d}s ago".`);return Zt(o,r,(f?1:-1)*Number(l),d)}let c=a.match(new RegExp(`^(${At})\\s+(\\d{1,2})(?:st|nd|rd|th)?(?:,?\\s*(\\d{4}))?$`,"i"));if(c){let u=c[1],l=c[2],d=_t(u),f=Number(l);return Ht(o,r,d,f)}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${a}". Supported: weekday refs ("next Tuesday"), day offsets ("today"/"tomorrow"/"yesterday"), unit offsets ("in 3 days", "2 weeks ago"), and month-day ("March 5th").`)}function Vt(e,t,n){if(e==="next"){let r=n-t;return r<=0&&(r+=7),r}if(e==="last"){let r=n-t;return r>=0&&(r-=7),r}return n-t}function Yt(e,t,n,r){return e.PlainDate.from({year:t,month:n,day:r},{overflow:"reject"})}function ge(e,t,n){return e.PlainDate.from({year:B(t),month:J(t),day:ee(t)}).add({days:n})}function Zt(e,t,n,r){let o=e.PlainDate.from({year:B(t),month:J(t),day:ee(t)}),a={};return r==="day"&&(a.days=n),r==="week"&&(a.weeks=n),r==="month"&&(a.months=n),r==="year"&&(a.years=n),o.add(a)}function Ht(e,t,n,r){let o=B(t),a=e.PlainDate.from({year:o,month:J(t),day:ee(t)});try{let i=e.PlainDate.from({year:o,month:n,day:r},{overflow:"reject"});if(!e.PlainDate.compare)throw new Error("temporal-fmt: parseRelative needs Temporal.PlainDate.compare to resolve month-day phrases; the active implementation does not expose it.");return e.PlainDate.compare(i,a)>=0?i:e.PlainDate.from({year:o+1,month:n,day:r},{overflow:"reject"})}catch(i){try{return e.PlainDate.from({year:o+1,month:n,day:r},{overflow:"reject"})}catch{throw new Error(`temporal-fmt: parseRelative can't resolve month ${n} day ${r} \u2014 it isn't a valid date in either ${o} or ${o+1}. Original error: ${i.message}`)}}}0&&(module.exports={format,formatDistance,formatDuration,parse,parseRelative,registerLocaleVocab,setTemporal});
1
+ "use strict";var Te=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var ln=Object.getOwnPropertyNames;var dn=Object.prototype.hasOwnProperty;var fn=(e,n)=>{for(var t in n)Te(e,t,{get:n[t],enumerable:!0})},pn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of ln(n))!dn.call(e,o)&&o!==t&&Te(e,o,{get:()=>n[o],enumerable:!(r=cn(n,o))||r.enumerable});return e};var hn=e=>pn(Te({},"__esModule",{value:!0}),e);var ft={};fn(ft,{format:()=>Ie,formatDistance:()=>Qe,formatDuration:()=>Ze,parse:()=>Ve,parseRelative:()=>sn,registerLocaleVocab:()=>Le,setTemporal:()=>Oe});module.exports=hn(ft);var Pe,_e=[];function Ae(e){_e.push(e)}function Oe(e){Pe=e;for(let n of _e)n()}function gn(){return Pe??globalThis.Temporal}function L(){let e=gn();if(!e)throw new Error("temporal-fmt: parse() needs a Temporal implementation to construct its result. Call setTemporal(Temporal) once at startup, or assign one to globalThis.Temporal (native on Node 26+, or a polyfill like temporal-polyfill).");return e}var ve=new Map;function yn(e,n){let t=[{key:"monthLong",length:12,label:"long month names"},{key:"monthShort",length:12,label:"short month names"},{key:"weekdayLong",length:7,label:"long weekday names"},{key:"weekdayShort",length:7,label:"short weekday names"},{key:"dayPeriod",length:2,label:"day period markers (AM/PM-equivalent)"}];for(let{key:r,length:o,label:a}of t){let i=e[r];if(i===void 0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}" is missing required field "${r}" (${a}).`);if(!Array.isArray(i))throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}" must be an array, got ${typeof i}.`);if(i.length!==o)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}" must have exactly ${o} entries (got ${i.length}) \u2014 ${a}.`);i.forEach((s,m)=>{if(typeof s!="string"||s.length===0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}[${m}]" must be a non-empty string, got ${String(s)}.`)})}if(D(e.monthLong,"MMMM month",n),D(e.monthShort,"MMM month",n),D(e.weekdayLong,"EEEE weekday",n),D(e.weekdayShort,"EEE weekday",n),e.dayPeriod[0]===e.dayPeriod[1])throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": dayPeriod entries must differ (both are "${e.dayPeriod[0]}"); otherwise parse() can't tell AM from PM.`)}function Le(e,n){if(typeof e!="string"||e.length===0)throw new Error(`temporal-fmt: registerLocaleVocab requires a non-empty locale string, got ${String(e)}.`);yn(n,e);let t=$(e);ve.set(t,{monthLong:[...n.monthLong],monthShort:[...n.monthShort],weekdayLong:[...n.weekdayLong],weekdayShort:[...n.weekdayShort],dayPeriod:[...n.dayPeriod]}),I.delete(t)}function $(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}var I=new Map,wn=500;function C(e,n,t){let r=e.formatToParts(n),o=r.findIndex(m=>m.type===t);if(o===-1)throw new Error(`temporal-fmt: locale produced no "${t}" part while building match vocabulary.`);let a=r[o].value,i=r[o-1],s=r[o+1];return i?.type==="literal"&&!/\s/.test(i.value)&&(a=i.value+a),s?.type==="literal"&&!/\s/.test(s.value)&&(a=a+s.value),a}function D(e,n,t){let r=new Map;for(let o=0;o<e.length;o++){let a=r.get(e[o]);if(a!==void 0)throw new Error(`temporal-fmt: locale "${t}" renders ${n} index ${a} and ${o} identically ("${e[o]}"). parse() can't reliably tell these apart for this locale/token, so this combination isn't supported.`);r.set(e[o],o)}}function H(e){let n=$(e);return ve.get(n)}function U(e){let n=$(e),t=ve.get(n);if(t)return t;let r=I.get(n);if(r)return r;let o=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),a=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[],s=[];for(let S=0;S<12;S++){let N=new Date(Date.UTC(2020,S,1));i.push(C(o,N,"month")),s.push(C(a,N,"month"))}D(i,"MMMM month",e),D(s,"MMM month",e);let m=new Intl.DateTimeFormat(e,{weekday:"long",timeZone:"UTC"}),c=new Intl.DateTimeFormat(e,{weekday:"short",timeZone:"UTC"}),u=[],d=[];for(let S=0;S<7;S++){let N=new Date(Date.UTC(2024,0,1+S));u.push(C(m,N,"weekday")),d.push(C(c,N,"weekday"))}D(u,"EEEE weekday",e),D(d,"EEE weekday",e);let l=new Intl.DateTimeFormat(e,{hour:"numeric",hour12:!0,timeZone:"UTC"}),g=C(l,new Date(Date.UTC(2020,0,1,1)),"dayPeriod"),y=C(l,new Date(Date.UTC(2020,0,1,13)),"dayPeriod"),w=[...new Set([g,y])],E={monthLong:i,monthShort:s,weekdayLong:u,weekdayShort:d,dayPeriod:w};if(I.size>=wn){let S=I.keys().next().value;S!==void 0&&I.delete(S)}return I.set(n,E),E}var Sn=[0,31,59,90,120,151,181,212,243,273,304,334];function W(e){return e%4===0&&e%100!==0||e%400===0}function V(e){return W(e)?366:365}function $e(e,n,t){let r=Sn[n-1]+t;return n>2&&W(e)&&(r+=1),r}var Me=2e3;function bn(e){let n=0;if(e>=Me)for(let r=Me;r<e;r++)n+=V(r);else for(let r=e;r<Me;r++)n-=V(r);return((5+n)%7+7)%7+1}function De(e,n,t,r){let a=$e(e,n,t)+(4-r),i,s;a<1?(i=e-1,s=a+V(i)):a>V(e)?(i=e+1,s=a-V(e)):(i=e,s=a);let c=1+(4-bn(i)+7)%7,u=1+Math.floor((s-c)/7);return{isoYear:i,week:u}}function p(e,n){let t=e<0,r=String(Math.abs(e)).padStart(n,"0");return t?"-"+r:r}p.fraction=function(n,t){let r=n.millisecond*1e6+(n.microsecond??0)*1e3+(n.nanosecond??0);return p(r,9).slice(0,t)};var j="en-US",Z=new Map,En=500;function Ce(e,n){let t=JSON.stringify([$(e),n]),r=Z.get(t);if(r)return r;if(Z.size>=En){let o=Z.keys().next().value;o!==void 0&&Z.delete(o)}return r=new Intl.DateTimeFormat(e,n),Z.set(t,r),r}var K;Ae(()=>{K=void 0});function kn(){if(K===void 0){K=!1;try{let e=L();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),K=!0}catch{}}return K}function Tn(e,n,t,r){let o=e?.calendarId,a={...t,calendar:o&&o!=="iso8601"?o:"gregory"};if(!kn())return e.toLocaleString(n,a);let{toInstant:i,timeZoneId:s}=e,m=typeof i=="function"&&typeof s=="string",c=m?e.toInstant():e,u={...a,...m?{timeZone:s}:{}},l=Ce(n,u).formatToParts(c),g=l.findIndex(S=>S.type===r);if(g===-1)throw new Error(`temporal-fmt: locale "${n}" produced no "${r}" part for this token. This usually means the Temporal object is missing the field the token needs.`);let y=l[g].value,w=l[g-1],E=l[g+1];return w?.type==="literal"&&!/\s/.test(w.value)&&(y=w.value+y),E?.type==="literal"&&!/\s/.test(E.value)&&(y=y+E.value),y}function vn(e,n){let t=H(n);if(t)return e<12?t.dayPeriod[0]:t.dayPeriod[1];let r=new Date(Date.UTC(1970,0,1,e)),a=Ce(n,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(i=>i.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${n}" produced no "dayPeriod" part for token "a".`);return a.value}function ne(e,n,t,r,o,a){return o&&a!==void 0&&a>=0&&a<o.length?o[a]:Tn(e,n,t,r)}var te=[["yyyy",e=>p(e.year,4),"year"],["yy",e=>{if(e.year<0)throw new Error(`temporal-fmt: token "yy" doesn't support negative years (got ${e.year}), since truncating to 2 digits would make it indistinguishable from a positive year. Use "yyyy" instead.`);return p(e.year%100,2)},"year"],["MMMM",(e,n)=>{let t=H(n);return ne(e,n,{month:"long"},"month",t?.monthLong,e.month-1)},"month"],["MMM",(e,n)=>{let t=H(n);return ne(e,n,{month:"short"},"month",t?.monthShort,e.month-1)},"month"],["MM",e=>p(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>p(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,n)=>{let t=H(n);return ne(e,n,{weekday:"long"},"weekday",t?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,n)=>{let t=H(n);return ne(e,n,{weekday:"short"},"weekday",t?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>p(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>p(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>p(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>p(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSSSSSSSS",e=>p.fraction(e,9),"millisecond"],["SSSSSSSS",e=>p.fraction(e,8),"millisecond"],["SSSSSSS",e=>p.fraction(e,7),"millisecond"],["SSSSSS",e=>p.fraction(e,6),"millisecond"],["SSSSS",e=>p.fraction(e,5),"millisecond"],["SSSS",e=>p.fraction(e,4),"millisecond"],["SSS",e=>p.fraction(e,3),"millisecond"],["SS",e=>p.fraction(e,2),"millisecond"],["S",e=>p.fraction(e,1),"millisecond"],["a",(e,n)=>vn(e.hour,n),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["do",e=>{let n=e.day,t=n%10,r=n%100;return r>=11&&r<=13?n+"th":t===1?n+"st":t===2?n+"nd":t===3?n+"rd":n+"th"},"day"],["Q",e=>String(Math.ceil(e.month/3)),"month"],["QQQ",e=>"Q"+Math.ceil(e.month/3),"month"],["ww",e=>{let{week:n}=De(e.year,e.month,e.day,e.dayOfWeek);return p(n,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:n}=De(e.year,e.month,e.day,e.dayOfWeek);return p(n,4)},"dayOfWeek"]];var Mn=te.map(([e])=>e).sort((e,n)=>n.length-e.length);function re(e){let n=[],t=0;for(;t<e.length;){let r=e[t];if(r==="'"){if(e[t+1]==="'"){Re(n,"'"),t+=2;continue}let a=t+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in format string "${e}"`);Re(n,i),t=a;continue}let o=Mn.find(a=>e.startsWith(a,t));if(o){n.push({kind:"token",value:o}),t+=o.length;continue}Re(n,r),t+=1}return n}function Re(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}var $n=new Map(te.map(([e,n,t])=>[e,{fn:n,field:t}]));function Ie(e,n,t={}){if(n.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${n.length}).`);let r=t.locale??j,o=re(n),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=$n.get(i.value);if(!s)throw new Error(`temporal-fmt: unknown token "${i.value}"`);if(e[s.field]===void 0)throw new Error(`temporal-fmt: token "${i.value}" requires "${s.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`);a+=s.fn(e,r)}return a}function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Q(e,n=!1){let t=e.map(Dn);return n?`(?:${t.map(Rn).join("|")})`:`(?:${t.join("|")})`}function Rn(e){return e.replace(/[a-zA-Z]/g,n=>`[${n.toLowerCase()}${n.toUpperCase()}]`)}var Nn="(?:UTC|[+-]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?|[A-Za-z_]+(?:[+-]\\d{1,2})?(?:\\/[A-Za-z0-9_+-]+)*)";function xn(){return Nn}var oe;function Fn(){return oe||(oe=new Set(Intl.supportedValuesOf("timeZone")),oe.add("UTC")),oe}var Pn=/^[+-]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/;function He(e){return Pn.test(e)||Fn().has(e)}var _n={yy:"\\d{2}",MM:"(?:0[1-9]|1[0-2])",M:"(?:1[0-2]|[1-9])",dd:"(?:0[1-9]|[12]\\d|3[01])",d:"(?:[12]\\d|3[01]|[1-9])",HH:"(?:[01]\\d|2[0-3])",H:"(?:1\\d|2[0-3]|[0-9])",hh:"(?:0[1-9]|1[0-2])",h:"(?:1[0-2]|[1-9])",mm:"(?:[0-5]\\d)",m:"(?:[1-5]\\d|[0-9])",ss:"(?:[0-5]\\d)",s:"(?:[1-5]\\d|[0-9])",SSSSSSSSS:"\\d{9}",SSSSSSSS:"\\d{8}",SSSSSSS:"\\d{7}",SSSSSS:"\\d{6}",SSSSS:"\\d{5}",SSSS:"\\d{4}",SSS:"\\d{3}",SS:"\\d{2}",S:"\\d",Q:"[1-4]"},An="Q[1-4]",On=new Set(["do","ww","RRRR"]),Ln="-?\\d{4}",Cn="-?\\d{4,}",In=new Set(["yyyy","yy","MM","M","dd","d","HH","H","hh","h","mm","m","ss","s","SSSSSSSSS","SSSSSSSS","SSSSSSS","SSSSSS","SSSSS","SSSS","SSS","SS","S"]);function Ue(e,n,t){if(e==="yyyy")return t!==void 0&&In.has(t)?Ln:Cn;let r=_n[e];if(r)return r;if(e==="QQQ")return An;if(On.has(e))throw new Error(`temporal-fmt: token "${e}" is format-only \u2014 it can't be parsed back into a value. Use a different token in the parse format string (e.g. "d" for "do", "MM" for "ww").`);let o=U(n);switch(e){case"MMMM":return Q(o.monthLong);case"MMM":return Q(o.monthShort);case"EEEE":return Q(o.weekdayLong);case"EEE":return Q(o.weekdayShort);case"a":return Q(o.dayPeriod,!0);case"zzz":return xn();default:throw new Error(`temporal-fmt: unknown token "${e}"`)}}var je=new Set(["M","d","H","h","m","s"]),Hn={M:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],d:[{digits:1,min:1,max:9},{digits:2,min:10,max:31}],H:[{digits:1,min:0,max:9},{digits:2,min:10,max:23}],h:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],m:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}],s:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}]};function ze(e,n){let t=new Map;function r(o,a){let i=`${o}:${a}`,s=t.get(i);if(s)return s;if(o===n.length){let d=a===e.length?[[]]:[];return t.set(i,d),d}let m=n[o],c=Hn[m];if(!c)throw new Error(`temporal-fmt: internal error \u2014 "${m}" is not an unpadded numeric token`);let u=[];for(let{digits:d,min:l,max:g}of c){if(a+d>e.length)continue;let y=e.slice(a,a+d);if(d===2&&y[0]==="0")continue;let w=Number(y);if(!(w<l||w>g)){for(let E of r(o+1,a+d))if(u.push([w,...E]),u.length===2)break;if(u.length===2)break}}return t.set(i,u),u}return r(0,0)}function Un(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ye(e,n){let t=[],r=[],o="",a=0,i={groupNames:[],tokens:[]},s=()=>{i.tokens.length>=2&&r.push(i),i={groupNames:[],tokens:[]}};for(let[m,c]of e.entries()){if(c.kind==="literal"){o+=Un(c.value),s();continue}let u=`g${a++}`;t.push({name:u,token:c.value});let d=e[m+1],l=d?.kind==="token"?d.value:void 0;o+=`(?<${u}>${Ue(c.value,n,l)})`,je.has(c.value)?(i.groupNames.push(u),i.tokens.push(c.value)):s()}return s(),{regex:new RegExp(`^(?:${o})$`,"u"),groups:t,ambiguousRuns:r}}var J=new Map,zn=500;function Yn(e,n){let t=JSON.stringify([$(n),e]),r=J.get(t);if(r)return r;if(J.size>=zn){let o=J.keys().next().value;o!==void 0&&J.delete(o)}return r=Ye(re(e),n),J.set(t,r),r}var z=new Map,Vn=500;function Wn(e){let n=new Intl.Locale(e).toString().toLowerCase();if(z.has(n))return z.get(n);if(z.size>=Vn){let i=z.keys().next().value;i!==void 0&&z.delete(i)}let t,r=n.split("-"),o=r.indexOf("u"),a=o===-1?-1:r.indexOf("ca",o+1);if(a!==-1&&a+1<r.length){let i=new Intl.DateTimeFormat(n).resolvedOptions().calendar;t=i==="gregory"?void 0:i}return z.set(n,t),t}function f(e,n,t){e[n]=t}function Zn(e,n,t,r,o){let a=U(r);switch(n){case"yyyy":f(e,"year",Number(t));break;case"yy":f(e,"twoDigitYear",Number(t));break;case"MM":case"M":f(e,"month",Number(t));break;case"MMMM":f(e,"month",a.monthLong.indexOf(t)+1);break;case"MMM":f(e,"month",a.monthShort.indexOf(t)+1);break;case"dd":case"d":f(e,"day",Number(t));break;case"EEEE":f(e,"weekdayRaw",t),f(e,"weekdayExpected",a.weekdayLong.indexOf(t)+1);break;case"EEE":f(e,"weekdayRaw",t),f(e,"weekdayExpected",a.weekdayShort.indexOf(t)+1);break;case"HH":case"H":f(e,"hour",Number(t));break;case"hh":case"h":f(e,"hour12",Number(t));break;case"mm":case"m":f(e,"minute",Number(t));break;case"ss":case"s":f(e,"second",Number(t));break;case"S":case"SS":case"SSS":case"SSSS":case"SSSSS":case"SSSSSS":case"SSSSSSS":case"SSSSSSSS":case"SSSSSSSSS":{let i=Number(t.padEnd(9,"0"));f(e,"millisecond",Math.floor(i/1e6)),f(e,"microsecond",Math.floor(i/1e3)%1e3),f(e,"nanosecond",i%1e3);break}case"a":{let i=a.dayPeriod.findIndex(s=>s.toLowerCase()===t.toLowerCase());if(i<0)throw new Error(`temporal-fmt: unknown day period "${t}" for locale "${r}".`);f(e,"dayPeriodRaw",t),f(e,"isPM",i===1);break}case"zzz":f(e,"timeZoneId",t);break;case"Q":f(e,"quarter",Number(t));break;case"QQQ":f(e,"quarter",Number(t.slice(1)));break}}function Kn(e,n){let t=n.indexOf("d");if(t!==-1){let r=e.filter(o=>o[t]<=12);if(r.length>0)return r[0]}return e[0]}function Gn(e){if(e.year!==void 0&&e.twoDigitYear!==void 0)throw new Error('temporal-fmt: format string mixes "yyyy" and "yy" year representations.');if(e.year!==void 0)return e.year;if(e.twoDigitYear!==void 0)return e.twoDigitYear<=68?2e3+e.twoDigitYear:1900+e.twoDigitYear}function Qn(e,n,t){if(e.hour!==void 0&&e.hour12!==void 0)throw new Error(`temporal-fmt: format string "${n}" mixes a 24-hour token ("HH"/"H") with a 12-hour token ("hh"/"h").`);if(e.hour!==void 0){if(e.dayPeriodRaw!==void 0){let r=U(t),o=e.hour<12?r.dayPeriod[0]:r.dayPeriod[1];if(e.dayPeriodRaw.toLowerCase()!==o?.toLowerCase())throw new Error(`temporal-fmt: format string "${n}" contains a day period that contradicts the 24-hour value.`)}return e.hour}if(e.hour12!==void 0){if(e.isPM===void 0)throw new Error(`temporal-fmt: format string "${n}" uses a 12-hour token ("hh"/"h") without an "a" token, so parse() can't tell AM from PM.`);return e.hour12%12+(e.isPM?12:0)}}function Ve(e,n,t={}){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);if(n.length>1e5)throw new Error(`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${n.length}).`);let r=t.locale??j,o=Wn(r),a=Yn(e,r),i=a.regex.exec(n);if(!i)throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");if(a.groups.length===0)throw new Error(`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`);for(let{name:h,token:T}of a.groups)if(T==="zzz"&&!He(i.groups[h]))throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");let s=[];for(let h of a.ambiguousRuns){let T=h.groupNames.map(ke=>i.groups[ke]).join(""),M=ze(T,h.tokens);if(M.length>1){if(!t.lenient)throw new Error(`temporal-fmt: "${T}" in format string "${e}" is ambiguous \u2014 ${M.length} different ways to read tokens "${h.tokens.join("")}" (with no separator between them) are all individually valid (e.g. ${JSON.stringify(M[0])} vs ${JSON.stringify(M[1])}). parse() won't guess; add a separator between these tokens, or use their padded form (e.g. "MM" instead of "M") so each one has a fixed width. Pass { lenient: true } to opt into a documented heuristic that picks one.`);s.push({groupNames:h.groupNames,values:Kn(M,h.tokens)})}}let m={},c=new Map;for(let{groupNames:h,values:T}of s)h.forEach((M,ke)=>c.set(M,String(T[ke])));for(let{name:h,token:T}of a.groups){let M=c.get(h)??i.groups[h];Zn(m,T,M,r,e)}let u=Gn(m),d=Qn(m,e,r),{month:l,day:g,minute:y,second:w,millisecond:E,microsecond:S,nanosecond:N,timeZoneId:ge,weekdayExpected:ye,weekdayRaw:mn,quarter:we}=m,un=u!==void 0||l!==void 0||g!==void 0,A=u!==void 0&&l!==void 0&&g!==void 0;if(un&&!A)throw new Error(`temporal-fmt: format string "${e}" has an incomplete date \u2014 year, month, and day tokens must all be present together.`);let Se=d!==void 0||y!==void 0||w!==void 0||E!==void 0;if(ge!==void 0&&!(A&&Se))throw new Error(`temporal-fmt: format string "${e}" has a "zzz" token but needs a full date and time to build a ZonedDateTime.`);if(ye!==void 0&&!A)throw new Error(`temporal-fmt: format string "${e}" has a weekday token ("EEEE"/"EEE") but needs a full date to validate it against.`);if(!A&&!Se)throw new Error(`temporal-fmt: format string "${e}" has no date or time tokens to parse.`);let X=L(),be={hour:d??0,minute:y??0,second:w??0,millisecond:E??0,microsecond:S??0,nanosecond:N??0},Ee=o?{calendar:o}:{},ee={overflow:"reject"},O;try{ge!==void 0?O=X.ZonedDateTime.from({year:u,month:l,day:g,...be,...Ee,timeZone:ge},ee):A&&Se?O=X.PlainDateTime.from({year:u,month:l,day:g,...be,...Ee},ee):A?O=X.PlainDate.from({year:u,month:l,day:g,...Ee},ee):O=X.PlainTime.from(be,ee)}catch(h){throw new Error(`temporal-fmt: "${n}" doesn't describe a valid date/time for format "${e}": ${h.message}`)}if(ye!==void 0){let h=O.dayOfWeek;if(h!==ye){let T=U(r);throw new Error(`temporal-fmt: "${mn}" doesn't match the actual weekday (${T.weekdayLong[h-1]}) for the parsed date.`)}}if(we!==void 0&&l!==void 0){let h=Math.ceil(l/3);if(we!==h)throw new Error(`temporal-fmt: format string "${e}" contains a quarter token (Q/QQQ) whose value (Q${we}) disagrees with the parsed month's actual quarter \u2014 month ${l} is in Q${h}.`)}return O}var We={y:{longSingular:"year",longPlural:"years",shortSingular:"yr",shortPlural:"yrs",field:"years",intlUnit:"year"},o:{longSingular:"month",longPlural:"months",shortSingular:"mo",shortPlural:"mos",field:"months",intlUnit:"month"},w:{longSingular:"week",longPlural:"weeks",shortSingular:"wk",shortPlural:"wks",field:"weeks",intlUnit:"week"},d:{longSingular:"day",longPlural:"days",shortSingular:"d",shortPlural:"d",field:"days",intlUnit:"day"},h:{longSingular:"hour",longPlural:"hours",shortSingular:"h",shortPlural:"h",field:"hours",intlUnit:"hour"},m:{longSingular:"minute",longPlural:"minutes",shortSingular:"m",shortPlural:"m",field:"minutes",intlUnit:"minute"},s:{longSingular:"second",longPlural:"seconds",shortSingular:"s",shortPlural:"s",field:"seconds",intlUnit:"second"},S:{longSingular:"millisecond",longPlural:"milliseconds",shortSingular:"ms",shortPlural:"ms",field:"milliseconds",intlUnit:"millisecond"}},Jn=Object.keys(We).flatMap(e=>[e+e+e,e+e,e]).sort((e,n)=>n.length-e.length);function qn(e){let n=[],t=0;for(;t<e.length;){let r=e[t];if(r==="'"){if(e[t+1]==="'"){Ne(n,"'"),t+=2;continue}let a=t+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in duration format string "${e}"`);Ne(n,i),t=a;continue}let o=Jn.find(a=>e.startsWith(a,t));if(o){let a=o[0],i=o.length===1?"numeric":o.length===2?"short":"long";n.push({kind:"token",value:o,unit:a,form:i}),t+=o.length;continue}Ne(n,r),t+=1}return n}function Ne(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}function Bn(e,n){let t=e[n];if(t==null)return 0;if(typeof t=="number"&&Number.isFinite(t))return t;let r=Number(t);if(!Number.isFinite(r))throw new Error(`temporal-fmt: duration field "${n}" is not a finite number (got ${String(t)}).`);return r}var q=new Map,Xn=200;function et(e,n,t){let r=`${$(e)}|${n}|${t}`,o=q.get(r);if(o)return o;if(q.size>=Xn){let i=q.keys().next().value;i!==void 0&&q.delete(i)}let a=new Intl.NumberFormat(e,{style:"unit",unit:n,unitDisplay:t});return q.set(r,a),a}function Ze(e,n,t={}){if(n.length>1e3)throw new Error(`temporal-fmt: duration format string exceeds maximum length of ${1e3} characters (got ${n.length}).`);let r=t.showZeroValues===!0,o=t.locale,a=o!==void 0,i=qn(n),s="";for(let m of i){if(m.kind==="literal"){s+=m.value;continue}let c=We[m.unit];if(!c)throw new Error(`temporal-fmt: unknown duration token "${m.value}"`);let u=Bn(e,c.field);if(!(u===0&&!r)){if(m.form==="numeric"){s+=String(u);continue}if(a){let d=m.form==="short"?"short":"long",l=et(o,c.intlUnit,d);s+=l.format(u);continue}m.form==="short"?s+=u+(u===1||u===-1?c.shortSingular:c.shortPlural):s+=u+" "+(u===1||u===-1?c.longSingular:c.longPlural)}}return s}function Ke(e,n){if(e===null||typeof e!="object")throw new Error(`temporal-fmt: formatDistance expects Temporal values, got ${n} = ${String(e)}.`);let t=e,r=typeof t.year=="number",o=typeof t.month=="number",a=typeof t.day=="number";if(r!==o||o!==a)throw new Error(`temporal-fmt: formatDistance got a ${n} with a partial date (some of year/month/day missing). Pass a full Temporal.PlainDate / PlainDateTime / ZonedDateTime.`);return{year:r?t.year:void 0,month:o?t.month:void 0,day:a?t.day:void 0,hour:typeof t.hour=="number"?t.hour:void 0,minute:typeof t.minute=="number"?t.minute:void 0,second:typeof t.second=="number"?t.second:void 0,millisecond:typeof t.millisecond=="number"?t.millisecond:void 0}}var xe=2e3,ae=1e3,ie=60*ae,se=60*ie,R=24*se;function nt(e,n,t){let r=0;if(e>=xe)for(let o=xe;o<e;o++)r+=W(o)?366:365;else for(let o=e;o<xe;o++)r-=W(o)?366:365;return r+=$e(e,n,t)-1,r}function Ge(e){if(e.year===void 0||e.month===void 0||e.day===void 0)throw new Error("temporal-fmt: formatDistance needs a Temporal value with year/month/day fields (PlainDate, PlainDateTime, or ZonedDateTime). A PlainTime or other shape has no anchor date to diff against.");let n=nt(e.year,e.month,e.day),t=e.hour??0,r=e.minute??0,o=e.second??0,a=e.millisecond??0;return n*R+t*se+r*ie+o*ae+a}var tt={seconds:60,minutes:60,hours:24,days:30,months:365};function rt(e){let n={...tt,...e};for(let s of Object.keys(n)){let m=n[s];if(typeof m!="number"||!Number.isFinite(m)||m<=0)throw new Error(`temporal-fmt: formatDistance cutoff "${s}" must be a positive finite number (got ${String(m)}).`)}let t=n.seconds*ae,r=n.minutes*ie,o=n.hours*se,a=n.days*R,i=n.months*R;if(!(t<=r&&r<=o&&o<=a&&a<=i))throw new Error(`temporal-fmt: formatDistance cutoffs must be monotonically non-decreasing in equivalent ms (seconds \u2264 minutes \u2264 hours \u2264 days \u2264 months). Got: seconds=${n.seconds}s, minutes=${n.minutes}min, hours=${n.hours}h, days=${n.days}d, months=${n.months}d \u2014 pick a sequence where each boundary is at least as large as the one before it.`);return[{maxMs:t,unit:"second"},{maxMs:r,unit:"minute"},{maxMs:o,unit:"hour"},{maxMs:a,unit:"day"},{maxMs:i,unit:"month"}]}var B=new Map,ot=100;function at(e,n){let t=`${it(e)}|${n}`,r=B.get(t);if(r)return r;if(B.size>=ot){let o=B.keys().next().value;o!==void 0&&B.delete(o)}return r=new Intl.RelativeTimeFormat(e,{numeric:n}),B.set(t,r),r}function it(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function Qe(e,n,t={}){let r=Ke(e,"date1"),o=Ke(n,"date2"),a=Ge(r)-Ge(o),i=Math.abs(a),s=rt(t.cutoffs),m="year";for(let{maxMs:y,unit:w}of s)if(i<y){m=w;break}let c=st(m),u=Math.round(a/c),d=t.numeric??"auto",l=t.locale??j;return at(l,d).format(u,m)}function st(e){switch(e){case"second":return ae;case"minute":return ie;case"hour":return se;case"day":return R;case"week":return 7*R;case"month":return 30*R;case"quarter":return 91*R;case"year":return 365*R;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}function v(e){return e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function F(e){if(typeof e.year!="number")throw new Error("temporal-fmt: parseRelative reference date is missing year.");return e.year}function P(e){if(typeof e.month!="number")throw new Error("temporal-fmt: parseRelative reference date is missing month.");return e.month}function _(e){if(typeof e.day!="number")throw new Error("temporal-fmt: parseRelative reference date is missing day.");return e.day}function ce(e){let n=e.dayOfWeek;if(typeof n!="number")throw new Error("temporal-fmt: parseRelative needs a reference date exposing dayOfWeek (a Temporal.PlainDate / PlainDateTime / ZonedDateTime).");return n}function k(e){return[...e.map(v)].sort((r,o)=>o.length-r.length).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}function le(e,n,t,r){return e.PlainDate.from({year:n,month:t,day:r},{overflow:"reject"})}function b(e,n,t){return e.PlainDate.from({year:F(n),month:P(n),day:_(n)}).add({days:t})}function x(e,n,t,r){let o=e.PlainDate.from({year:F(n),month:P(n),day:_(n)}),a={};return r==="day"&&(a.days=t),r==="week"&&(a.weeks=t),r==="month"&&(a.months=t),r==="year"&&(a.years=t),o.add(a)}function de(e,n,t){if(e==="next"){let r=t-n;return r<=0&&(r+=7),r}if(e==="last"){let r=t-n;return r>=0&&(r-=7),r}return t-n}function fe(e,n,t,r){let o=F(n),a=e.PlainDate.from({year:o,month:P(n),day:_(n)});try{let i=e.PlainDate.from({year:o,month:t,day:r},{overflow:"reject"});if(!e.PlainDate.compare)throw new Error("temporal-fmt: parseRelative needs Temporal.PlainDate.compare to resolve month-day phrases; the active implementation does not expose it.");return e.PlainDate.compare(i,a)>=0?i:e.PlainDate.from({year:o+1,month:t,day:r},{overflow:"reject"})}catch(i){try{return e.PlainDate.from({year:o+1,month:t,day:r},{overflow:"reject"})}catch{throw new Error(`temporal-fmt: parseRelative can't resolve month ${t} day ${r} \u2014 it isn't a valid date in either ${o} or ${o+1}. Original error: ${i.message}`)}}}function pe(e,n){let t=v(e),r=n.findIndex(o=>v(o)===t);if(r<0)throw new Error(`temporal-fmt: parseRelative internal error \u2014 weekday "${e}" not in names list.`);return r+1}function he(e,n,t=[]){let r=v(e),o=n.findIndex(i=>v(i)===r);if(o>=0)return o+1;let a=t.findIndex(i=>v(i)===r);if(a>=0)return a+1;throw new Error(`temporal-fmt: parseRelative internal error \u2014 month "${e}" not in names list.`)}var Je=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],qe=["January","February","March","April","May","June","July","August","September","October","November","December"],Be=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ue={supportedHint:'Supported: weekday refs ("next Tuesday"), day offsets ("today"/"tomorrow"/"yesterday"), unit offsets ("in 3 days", "2 weeks ago"), and month-day ("March 5th").',matchers:[{pattern:/^today$/i,resolve:(e,n)=>le(n.temporal,F(n.reference),P(n.reference),_(n.reference))},{pattern:/^tomorrow$/i,resolve:(e,n)=>b(n.temporal,n.reference,1)},{pattern:/^yesterday$/i,resolve:(e,n)=>b(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(next|last|this)\\s+(${k(Je)})$`,"i"),resolve:(e,n)=>{let t=e[1].toLowerCase(),r=pe(e[2],Je),o=ce(n.reference);return b(n.temporal,n.reference,de(t,o,r))}},{pattern:/^(in\s+)?(\d+)\s+(day|week|month|year)s?(?:\s+ago)?$/i,resolve:(e,n)=>{let t=e[1],r=e[2],o=e[3].toLowerCase(),a=!!t,i=/\bago\b/i.test(e[0]);if(!a&&!i)throw new Error(`temporal-fmt: parseRelative can't tell whether "${e[0]}" is past or future \u2014 use "in ${r} ${o}s" or "${r} ${o}s ago".`);let s=a?1:-1;return x(n.temporal,n.reference,s*Number(r),o)}},{pattern:new RegExp(`^(${k([...qe,...Be])})\\s+(\\d{1,2})(?:st|nd|rd|th)?(?:,?\\s*(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=he(e[1],qe,Be),r=Number(e[2]);return fe(n.temporal,n.reference,t,r)}}]},me=["lunes","martes","mi\xE9rcoles","jueves","viernes","s\xE1bado","domingo"],Xe=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],en=["ene","feb","mar","abr","may","jun","jul","ago","sept","oct","nov","dic"],mt={supportedHint:'Frases soportadas: referencias de d\xEDa de la semana ("el pr\xF3ximo lunes", "el lunes pasado", "este martes"), offsets de d\xEDa ("hoy"/"ma\xF1ana"/"ayer"), offsets de unidad ("en 3 d\xEDas", "hace 2 semanas"), y mes-d\xEDa ("5 de marzo").',matchers:[{pattern:/^hoy$/i,resolve:(e,n)=>le(n.temporal,F(n.reference),P(n.reference),_(n.reference))},{pattern:/^ma[ñn]ana$/i,resolve:(e,n)=>b(n.temporal,n.reference,1)},{pattern:/^ayer$/i,resolve:(e,n)=>b(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(?:el\\s+)?(?:(pr[o\xF3]ximo|pasado)\\s+(${k(me)})|(${k(me)})\\s+(pr[o\xF3]ximo|pasado)|este\\s+(${k(me)}))$`,"i"),resolve:(e,n)=>{let t,r;e[1]&&e[2]?(t=e[1],r=e[2]):e[3]&&e[4]?(r=e[3],t=e[4]):(t="este",r=e[5]);let o=v(t)==="proximo"?"next":t.toLowerCase()==="este"?"this":"last",a=pe(r,me),i=ce(n.reference);return b(n.temporal,n.reference,de(o,i,a))}},{pattern:new RegExp("^(?:(en|dentro\\s+de)\\s+(\\d+)\\s+(d[i\xED]a|semana|mes|a[\xF1n]o)s?|(\\d+)\\s+(d[i\xED]a|semana|mes|a[\xF1n]o)s?\\s+(hace))$","i"),resolve:(e,n)=>{let t,r,o;e[1]&&e[2]&&e[3]?(t=e[2],r=e[3],o=1):(t=e[5],r=e[6],o=-1);let a=Y(r);return x(n.temporal,n.reference,o*Number(t),a)}},{pattern:new RegExp("^hace\\s+(\\d+)\\s+(d[i\xED]a|semana|mes|a[\xF1n]o)s?$","i"),resolve:(e,n)=>{let t=Number(e[1]),r=Y(e[2]);return x(n.temporal,n.reference,-t,r)}},{pattern:new RegExp("^(\\d+)\\s+(d[i\xED]a|semana|mes|a[\xF1n]o)s?$","i"),resolve:(e,n)=>{throw new Error(`temporal-fmt: parseRelative no puede decidir si "${e[0]}" es pasado o futuro \u2014 usa "en ${e[1]} ${e[2]}s" o "hace ${e[1]} ${e[2]}s".`)}},{pattern:new RegExp(`^(\\d{1,2})\\.?\\s+de\\s+(${k([...Xe,...en])})(?:\\s+de\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=he(e[2],Xe,en);return fe(n.temporal,n.reference,r,t)}}]},Fe=["lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche"],nn=["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],tn=["janv.","f\xE9vr.","mars","avr.","mai","juin","juil.","ao\xFBt","sept.","oct.","nov.","d\xE9c."],ut={supportedHint:`Phrases prises en charge : r\xE9f\xE9rences de jour de la semaine ("lundi prochain", "mardi dernier", "ce mercredi"), d\xE9calages de jour ("aujourd'hui"/"demain"/"hier"), d\xE9calages d'unit\xE9 ("dans 3 jours", "il y a 2 semaines"), et mois-jour ("5 mars").`,matchers:[{pattern:/^aujourd'hui$/i,resolve:(e,n)=>le(n.temporal,F(n.reference),P(n.reference),_(n.reference))},{pattern:/^demain$/i,resolve:(e,n)=>b(n.temporal,n.reference,1)},{pattern:/^hier$/i,resolve:(e,n)=>b(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(?:(${k(Fe)})\\s+(prochain|dernier)|ce\\s+(${k(Fe)}))$`,"i"),resolve:(e,n)=>{let t,r;e[1]&&e[2]?(r=e[1],t=e[2].toLowerCase()==="prochain"?"next":"last"):(t="this",r=e[3]);let o=pe(r,Fe),a=ce(n.reference);return b(n.temporal,n.reference,de(t,a,o))}},{pattern:new RegExp("^il\\s+y\\s+a\\s+(\\d+)\\s+(jour|semaine|mois|an|ann[e\xE9e]e)s?$","i"),resolve:(e,n)=>{let t=Number(e[1]),r=Y(e[2]);return x(n.temporal,n.reference,-t,r)}},{pattern:new RegExp("^dans\\s+(\\d+)\\s+(jour|semaine|mois|an|ann[e\xE9e]e)s?$","i"),resolve:(e,n)=>{let t=Number(e[1]),r=Y(e[2]);return x(n.temporal,n.reference,t,r)}},{pattern:new RegExp("^(\\d+)\\s+(jour|semaine|mois|an|ann[e\xE9e]e)s?$","i"),resolve:(e,n)=>{throw new Error(`temporal-fmt: parseRelative ne peut pas d\xE9terminer si "${e[0]}" est pass\xE9 ou futur \u2014 utilisez "dans ${e[1]} ${e[2]}s" ou "il y a ${e[1]} ${e[2]}s".`)}},{pattern:new RegExp(`^(\\d{1,2})\\s+(${k([...nn,...tn])})(?:\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=he(e[2],nn,tn);return fe(n.temporal,n.reference,r,t)}}]},rn=["Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"],on=["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],an=["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],ct={supportedHint:'Unterst\xFCtzte Phrasen: Wochentag-Bez\xFCge ("n\xE4chsten Dienstag", "letzten Freitag", "diesen Montag"), Tages-Offsets ("heute"/"morgen"/"gestern"), Einheiten-Offsets ("in 3 Tagen", "vor 2 Wochen"), und Monat-Tag ("5. M\xE4rz").',matchers:[{pattern:/^heute$/i,resolve:(e,n)=>le(n.temporal,F(n.reference),P(n.reference),_(n.reference))},{pattern:/^morgen$/i,resolve:(e,n)=>b(n.temporal,n.reference,1)},{pattern:/^gestern$/i,resolve:(e,n)=>b(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(n(?:ae|a|\xE4)chsten|letzten|diesen)\\s+(${k(rn)})$`,"i"),resolve:(e,n)=>{let t=v(e[1]),r=t==="nachsten"||t==="naechsten"?"next":t==="diesen"?"this":"last",o=pe(e[2],rn),a=ce(n.reference);return b(n.temporal,n.reference,de(r,a,o))}},{pattern:new RegExp("^vor\\s+(\\d+)\\s+(Tag(?:e|n|en)?|Woche(?:n)?|Monat(?:e|n|en)?|Jahr(?:e|n|en)?)$","i"),resolve:(e,n)=>{let t=Number(e[1]),r=Y(e[2]);return x(n.temporal,n.reference,-t,r)}},{pattern:new RegExp("^in\\s+(\\d+)\\s+(Tag(?:e|n|en)?|Woche(?:n)?|Monat(?:e|n|en)?|Jahr(?:e|n|en)?)$","i"),resolve:(e,n)=>{let t=Number(e[1]),r=Y(e[2]);return x(n.temporal,n.reference,t,r)}},{pattern:new RegExp("^(\\d+)\\s+(Tag(?:e|n|en)?|Woche(?:n)?|Monat(?:e|n|en)?|Jahr(?:e|n|en)?)$","i"),resolve:(e,n)=>{throw new Error(`temporal-fmt: parseRelative kann nicht erkennen, ob "${e[0]}" Vergangenheit oder Zukunft ist \u2014 verwende "in ${e[1]} ${e[2]}" oder "vor ${e[1]} ${e[2]}".`)}},{pattern:new RegExp(`^(\\d{1,2})\\.?\\s+(${k([...on,...an,"Maerz","Maer"])})(?:\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=he(e[2],on,an);return fe(n.temporal,n.reference,r,t)}}]},lt={en:ue,es:mt,fr:ut,de:ct};function dt(e){if(!e)return ue;try{let t=new Intl.Locale(e.replace(/_/g,"-")).language.toLowerCase();return lt[t]??ue}catch{return ue}}function Y(e){let n=v(e);if(n==="day"||n==="week"||n==="month"||n==="year")return n;if(n==="dia")return"day";if(n==="semana")return"week";if(n==="mes")return"month";if(n==="ano"||n==="a\xF1o")return"year";if(n==="jour")return"day";if(n==="semaine")return"week";if(n==="mois")return"month";if(n==="an"||n==="annee")return"year";if(n==="tag"||n==="tagen")return"day";if(n==="woche"||n==="wochen")return"week";if(n==="monat"||n==="monaten")return"month";if(n==="jahr"||n==="jahren")return"year";throw new Error(`temporal-fmt: parseRelative internal error \u2014 unrecognized unit word "${e}".`)}function sn(e,n,t={}){let r=n,o=L(),a=(e??"").trim().replace(/\s+/g," ");if(a.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");let i=v(a),s=dt(t.locale),m={temporal:o,reference:r};for(let c of s.matchers){let u=i.match(c.pattern);if(u)return c.resolve(u,m)}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${a}". `+s.supportedHint)}0&&(module.exports={format,formatDistance,formatDuration,parse,parseRelative,registerLocaleVocab,setTemporal});
2
2
  //# sourceMappingURL=index.cjs.map