temporal-fmt 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +166 -1
  2. package/dist/chunk-4JDAJSEM.js +35 -0
  3. package/dist/chunk-4JDAJSEM.js.map +1 -0
  4. package/dist/{chunk-F4RGUDA3.js → chunk-4XRE37WT.js} +2 -2
  5. package/dist/chunk-GMGZZG6I.js +2 -0
  6. package/dist/chunk-GMGZZG6I.js.map +1 -0
  7. package/dist/{chunk-R52YOKI3.js → chunk-NPKJ7QFK.js} +2 -2
  8. package/dist/{chunk-NBXF7V5B.js → chunk-R4YEFOVE.js} +2 -2
  9. package/dist/{chunk-4JWGUR4O.js → chunk-SSPABEUR.js} +2 -2
  10. package/dist/format.cjs +5 -5
  11. package/dist/format.cjs.map +1 -1
  12. package/dist/format.js +1 -1
  13. package/dist/index.cjs +24 -24
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/interval.cjs +2 -2
  18. package/dist/interval.cjs.map +1 -1
  19. package/dist/interval.js +1 -1
  20. package/dist/parse.cjs +9 -9
  21. package/dist/parse.cjs.map +1 -1
  22. package/dist/parse.js +1 -1
  23. package/dist/pattern.d.cts +1 -0
  24. package/dist/pattern.d.ts +1 -0
  25. package/dist/relativeTime.cjs +1 -1
  26. package/dist/relativeTime.cjs.map +1 -1
  27. package/dist/relativeTime.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunk-C5YESWFT.js +0 -2
  30. package/dist/chunk-C5YESWFT.js.map +0 -1
  31. package/dist/chunk-YB6YAG7E.js +0 -35
  32. package/dist/chunk-YB6YAG7E.js.map +0 -1
  33. /package/dist/{chunk-F4RGUDA3.js.map → chunk-4XRE37WT.js.map} +0 -0
  34. /package/dist/{chunk-R52YOKI3.js.map → chunk-NPKJ7QFK.js.map} +0 -0
  35. /package/dist/{chunk-NBXF7V5B.js.map → chunk-R4YEFOVE.js.map} +0 -0
  36. /package/dist/{chunk-4JWGUR4O.js.map → chunk-SSPABEUR.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ln=Object.defineProperty;var Ts=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var Ds=Object.prototype.hasOwnProperty;var vs=(e,n)=>{for(var t in n)Ln(e,t,{get:n[t],enumerable:!0})},Ms=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Ss(n))!Ds.call(e,o)&&o!==t&&Ln(e,o,{get:()=>n[o],enumerable:!(r=Ts(n,o))||r.enumerable});return e};var xs=e=>Ms(Ln({},"__esModule",{value:!0}),e);var ji={};vs(ji,{ALL_TOKEN_NAMES:()=>tn,AmbiguousInputError:()=>me,DATE_FNS_TO_TEMPORAL_FMT:()=>Cn,DAYJS_TO_TEMPORAL_FMT:()=>Nn,DEFAULT_CONFIG:()=>Pt,FORMAT_ONLY_TOKENS:()=>Xn,FormatSyntaxError:()=>y,InvalidCalendarError:()=>dn,InvalidDateError:()=>z,InvalidDurationError:()=>W,InvalidLocaleError:()=>D,InvalidOffsetError:()=>B,InvalidTimeError:()=>cn,InvalidTimeZoneError:()=>ke,ParseMismatchError:()=>C,SUPPORTED_NUMBERING_SYSTEMS:()=>Xe,TOKEN_METADATA:()=>ee,TemporalFmtError:()=>I,UnknownTokenError:()=>O,add:()=>S,addBusinessDays:()=>zt,addDays:()=>to,addDuration:()=>$t,addHours:()=>ro,addMilliseconds:()=>so,addMinutes:()=>oo,addMonths:()=>eo,addSeconds:()=>ao,addWeeks:()=>no,addYears:()=>Jr,analyzeFormat:()=>Le,applyNumbering:()=>Te,applyParseNumbering:()=>Ge,asDateFieldView:()=>A,assertDuration:()=>Rr,assertInstant:()=>vr,assertPlainDate:()=>Mr,assertPlainDateTime:()=>Er,assertPlainMonthDay:()=>$r,assertPlainTime:()=>xr,assertPlainYearMonth:()=>_r,assertTemporal:()=>Dr,assertZonedDateTime:()=>Fr,balanceDuration:()=>ca,between:()=>Za,ceil:()=>Zo,clamp:()=>$o,compare:()=>T,compareDuration:()=>fa,compileFormat:()=>Jt,compileParser:()=>rr,convertDigits:()=>Zn,convertDigitsToAscii:()=>Yn,createBusinessCalendar:()=>ja,createConfig:()=>Ta,createFormatter:()=>cs,createHolidayCalendar:()=>Ka,dayOfYear:()=>Zr,daysInMonth:()=>xe,daysInYear:()=>Lr,difference:()=>te,differenceInBusinessDays:()=>Ba,differenceInDays:()=>_n,differenceInHours:()=>bo,differenceInMilliseconds:()=>So,differenceInMinutes:()=>ko,differenceInMonths:()=>yo,differenceInSeconds:()=>To,differenceInWeeks:()=>wo,differenceInYears:()=>go,endOf:()=>Kr,explainFormat:()=>Pr,fieldForToken:()=>Ar,floor:()=>Ho,format:()=>Q,formatDistance:()=>at,formatDistanceToNow:()=>ur,formatDuration:()=>ar,formatDurationToParts:()=>ia,formatHTTPDate:()=>Bo,formatISO:()=>Ft,formatISODuration:()=>la,formatRFC2822:()=>Xo,formatRFC3339:()=>Wo,formatRRule:()=>Va,formatRange:()=>Aa,formatRangeToParts:()=>La,formatRelative:()=>Rt,formatRelativeToNow:()=>ha,formatSQL:()=>aa,formatToParts:()=>Ke,fromUnixMicroseconds:()=>Jo,fromUnixMilliseconds:()=>Qo,fromUnixNanoseconds:()=>ea,fromUnixSeconds:()=>Ko,getAutocompleteData:()=>ds,getDocUrl:()=>gs,getHoverDocs:()=>fs,getInlineDiagnostics:()=>ps,getLocale:()=>ba,getMonth:()=>jr,getNextTransition:()=>ss,getOffset:()=>rs,getOffsetNanoseconds:()=>os,getPreviousTransition:()=>is,getQuarter:()=>Wr,getTimeZone:()=>ts,getTransitions:()=>ls,getWeekday:()=>Xr,hasLocale:()=>ka,holidaysBetween:()=>es,intersection:()=>Ia,intersects:()=>Ee,interval:()=>Ea,intervalContains:()=>Fa,intervalDifference:()=>Nt,intervalIsAfter:()=>Ra,intervalIsBefore:()=>$a,intervalSubtract:()=>Pa,isAfter:()=>Eo,isBefore:()=>xo,isBetween:()=>Ro,isBusinessDay:()=>sn,isDST:()=>as,isDuration:()=>bt,isEqual:()=>Mo,isInstant:()=>gt,isLeapMonth:()=>Hr,isLeapYear:()=>Ur,isPlainDate:()=>dt,isPlainDateTime:()=>pt,isPlainMonthDay:()=>wt,isPlainTime:()=>ft,isPlainYearMonth:()=>yt,isSameDay:()=>Io,isSameMonth:()=>Ao,isSameQuarter:()=>Lo,isSameWeek:()=>Co,isSameYear:()=>zo,isTemporal:()=>kt,isToday:()=>Oo,isTomorrow:()=>Po,isValidFormat:()=>Nr,isWeekday:()=>Uo,isWeekend:()=>xt,isYesterday:()=>No,isZonedDateTime:()=>ht,listRegisteredGrammars:()=>dr,listTokens:()=>Tt,max:()=>_o,mergeIntervals:()=>Na,mergeWithConfig:()=>Sa,min:()=>Fo,monthsInYear:()=>zr,nextBusinessDay:()=>At,nextHoliday:()=>Qa,overlaps:()=>_a,parse:()=>ge,parseDuration:()=>ma,parseHTTPDate:()=>Go,parseISO:()=>In,parseISODuration:()=>ua,parseRFC2822:()=>jo,parseRFC3339:()=>Vo,parseRRule:()=>Ya,parseRelative:()=>Sr,parseSQL:()=>oa,parseToParts:()=>nt,possibleInstantsFor:()=>ms,previewFormat:()=>hs,previousBusinessDay:()=>Lt,previousHoliday:()=>Ja,recurrence:()=>Ct,registerLocale:()=>wa,registerLocaleVocab:()=>fn,registerRelativeGrammar:()=>mr,resolveZoned:()=>ns,round:()=>rn,roundDuration:()=>Rn,roundDurationAlias:()=>Rn,safeParse:()=>Jn,setTemporal:()=>Yt,skip:()=>Ha,splitInterval:()=>Ca,startOf:()=>qr,subtract:()=>ne,subtractBusinessDays:()=>Ga,subtractDays:()=>mo,subtractDuration:()=>pa,subtractHours:()=>co,subtractMilliseconds:()=>ho,subtractMinutes:()=>fo,subtractMonths:()=>uo,subtractSeconds:()=>po,subtractWeeks:()=>lo,subtractYears:()=>io,take:()=>Ua,toUnixMicroseconds:()=>ta,toUnixMilliseconds:()=>na,toUnixNanoseconds:()=>ra,toUnixSeconds:()=>qo,tokenInfo:()=>Or,tokenizeFormat:()=>Ir,totalDuration:()=>da,translateDateFnsFormatString:()=>bs,translateDayjsFormatString:()=>ws,truncate:()=>Yo,tryParse:()=>et,union:()=>Oa,validateFormat:()=>Cr,weekOfYear:()=>Yr,weekYear:()=>Vr});module.exports=xs(ji);var Ut,Ht=[];function Zt(e){Ht.push(e)}function Yt(e){Ut=e;for(let n of Ht)n()}function Es(){return Ut??globalThis.Temporal}function R(){let e=Es();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 I=class extends Error{code;input;format;token;position;expected;actual;reason;constructor(n,t){super(n),this.name="TemporalFmtError",this.code=t.code,this.input=t.input,this.format=t.format,this.token=t.token,this.position=t.position,this.expected=t.expected,this.actual=t.actual,this.reason=t.reason;let r=Error.captureStackTrace;typeof r=="function"&&r(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,code:this.code,input:this.input,format:this.format,token:this.token,position:this.position,expected:this.expected,actual:this.actual,reason:this.reason}}},y=class extends I{constructor(n){let{message:t,...r}=n;super(t??`format string "${n.format??""}" has a syntax error${n.reason?`: ${n.reason}`:""}.`,{code:"FORMAT_SYNTAX_ERROR",...r}),this.name="FormatSyntaxError"}},O=class extends I{constructor(n){let{message:t,...r}=n;super(t??`token "${n.token??""}" is not a recognized temporal-fmt token${n.format?` in format string "${n.format}"`:""}.`,{code:"UNKNOWN_TOKEN",...r}),this.name="UnknownTokenError"}},C=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" does not match format "${n.format??""}"${n.reason?`: ${n.reason}`:""}.`,{code:"PARSE_MISMATCH",...r}),this.name="ParseMismatchError"}},z=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" does not describe a valid date${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_DATE",...r}),this.name="InvalidDateError"}};/* c8 ignore start @preserve -- InvalidTimeError is part of the public
1
+ "use strict";var zn=Object.defineProperty;var Ss=Object.getOwnPropertyDescriptor;var Ds=Object.getOwnPropertyNames;var vs=Object.prototype.hasOwnProperty;var Ms=(e,n)=>{for(var t in n)zn(e,t,{get:n[t],enumerable:!0})},xs=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Ds(n))!vs.call(e,o)&&o!==t&&zn(e,o,{get:()=>n[o],enumerable:!(r=Ss(n,o))||r.enumerable});return e};var Es=e=>xs(zn({},"__esModule",{value:!0}),e);var Gi={};Ms(Gi,{ALL_TOKEN_NAMES:()=>nn,AmbiguousInputError:()=>le,DATE_FNS_TO_TEMPORAL_FMT:()=>Nn,DAYJS_TO_TEMPORAL_FMT:()=>Pn,DEFAULT_CONFIG:()=>Pt,FORMAT_ONLY_TOKENS:()=>Gn,FormatSyntaxError:()=>y,InvalidCalendarError:()=>mn,InvalidDateError:()=>z,InvalidDurationError:()=>W,InvalidLocaleError:()=>D,InvalidOffsetError:()=>B,InvalidTimeError:()=>ln,InvalidTimeZoneError:()=>we,ParseMismatchError:()=>C,SUPPORTED_NUMBERING_SYSTEMS:()=>Xe,TOKEN_METADATA:()=>ee,TemporalFmtError:()=>I,UnknownTokenError:()=>O,add:()=>S,addBusinessDays:()=>zt,addDays:()=>ro,addDuration:()=>$t,addHours:()=>oo,addMilliseconds:()=>io,addMinutes:()=>ao,addMonths:()=>no,addSeconds:()=>so,addWeeks:()=>to,addYears:()=>eo,analyzeFormat:()=>Le,applyNumbering:()=>ke,applyParseNumbering:()=>je,asDateFieldView:()=>A,assertDuration:()=>Ir,assertInstant:()=>Mr,assertPlainDate:()=>xr,assertPlainDateTime:()=>Fr,assertPlainMonthDay:()=>Rr,assertPlainTime:()=>Er,assertPlainYearMonth:()=>$r,assertTemporal:()=>vr,assertZonedDateTime:()=>_r,balanceDuration:()=>da,between:()=>Ya,ceil:()=>Yo,clamp:()=>Ro,compare:()=>T,compareDuration:()=>pa,compileFormat:()=>Jt,compileParser:()=>or,convertDigits:()=>Yn,convertDigitsToAscii:()=>Vn,createBusinessCalendar:()=>ja,createConfig:()=>Sa,createFormatter:()=>ds,createHolidayCalendar:()=>Qa,dayOfYear:()=>Yr,daysInMonth:()=>Me,daysInYear:()=>zr,difference:()=>te,differenceInBusinessDays:()=>qa,differenceInDays:()=>Fn,differenceInHours:()=>ko,differenceInMilliseconds:()=>Do,differenceInMinutes:()=>To,differenceInMonths:()=>wo,differenceInSeconds:()=>So,differenceInWeeks:()=>bo,differenceInYears:()=>yo,endOf:()=>Qr,explainFormat:()=>Nr,fieldForToken:()=>Lr,floor:()=>Zo,format:()=>Q,formatDistance:()=>at,formatDistanceToNow:()=>lr,formatDuration:()=>sr,formatDurationToParts:()=>ua,formatHTTPDate:()=>qo,formatISO:()=>Ft,formatISODuration:()=>ma,formatRFC2822:()=>Go,formatRFC3339:()=>Xo,formatRRule:()=>Wa,formatRange:()=>La,formatRangeToParts:()=>za,formatRelative:()=>Rt,formatRelativeToNow:()=>ga,formatSQL:()=>sa,formatToParts:()=>qe,fromUnixMicroseconds:()=>ea,fromUnixMilliseconds:()=>Jo,fromUnixNanoseconds:()=>na,fromUnixSeconds:()=>Qo,getAutocompleteData:()=>fs,getDocUrl:()=>ys,getHoverDocs:()=>ps,getInlineDiagnostics:()=>hs,getLocale:()=>ka,getMonth:()=>jr,getNextTransition:()=>is,getOffset:()=>os,getOffsetNanoseconds:()=>as,getPreviousTransition:()=>us,getQuarter:()=>Xr,getTimeZone:()=>rs,getTransitions:()=>ms,getWeekday:()=>Gr,hasLocale:()=>Ta,holidaysBetween:()=>ns,intersection:()=>Oa,intersects:()=>xe,interval:()=>Fa,intervalContains:()=>_a,intervalDifference:()=>Nt,intervalIsAfter:()=>Ia,intervalIsBefore:()=>Ra,intervalSubtract:()=>Na,isAfter:()=>Fo,isBefore:()=>Eo,isBetween:()=>Io,isBusinessDay:()=>an,isDST:()=>ss,isDuration:()=>bt,isEqual:()=>xo,isInstant:()=>gt,isLeapMonth:()=>Zr,isLeapYear:()=>Hr,isPlainDate:()=>dt,isPlainDateTime:()=>pt,isPlainMonthDay:()=>wt,isPlainTime:()=>ft,isPlainYearMonth:()=>yt,isSameDay:()=>Oo,isSameMonth:()=>Lo,isSameQuarter:()=>zo,isSameWeek:()=>Ao,isSameYear:()=>Uo,isTemporal:()=>kt,isToday:()=>Po,isTomorrow:()=>No,isValidFormat:()=>Cr,isWeekday:()=>Ho,isWeekend:()=>xt,isYesterday:()=>Co,isZonedDateTime:()=>ht,listRegisteredGrammars:()=>fr,listTokens:()=>Tt,max:()=>$o,mergeIntervals:()=>Ca,mergeWithConfig:()=>Da,min:()=>_o,monthsInYear:()=>Ur,nextBusinessDay:()=>At,nextHoliday:()=>Ja,overlaps:()=>$a,parse:()=>pe,parseDuration:()=>ca,parseHTTPDate:()=>Bo,parseISO:()=>Rn,parseISODuration:()=>la,parseRFC2822:()=>jo,parseRFC3339:()=>Wo,parseRRule:()=>Va,parseRelative:()=>Dr,parseSQL:()=>aa,parseToParts:()=>nt,possibleInstantsFor:()=>cs,previewFormat:()=>gs,previousBusinessDay:()=>Lt,previousHoliday:()=>es,recurrence:()=>Ct,registerLocale:()=>ba,registerLocaleVocab:()=>cn,registerRelativeGrammar:()=>cr,resolveZoned:()=>ts,round:()=>tn,roundDuration:()=>$n,roundDurationAlias:()=>$n,safeParse:()=>Jn,setTemporal:()=>Yt,skip:()=>Za,splitInterval:()=>Aa,startOf:()=>Kr,subtract:()=>ne,subtractBusinessDays:()=>Ba,subtractDays:()=>co,subtractDuration:()=>ha,subtractHours:()=>fo,subtractMilliseconds:()=>go,subtractMinutes:()=>po,subtractMonths:()=>lo,subtractSeconds:()=>ho,subtractWeeks:()=>mo,subtractYears:()=>uo,take:()=>Ha,toUnixMicroseconds:()=>ra,toUnixMilliseconds:()=>ta,toUnixNanoseconds:()=>oa,toUnixSeconds:()=>Ko,tokenInfo:()=>Pr,tokenizeFormat:()=>Or,totalDuration:()=>fa,translateDateFnsFormatString:()=>ks,translateDayjsFormatString:()=>bs,truncate:()=>Vo,tryParse:()=>et,union:()=>Pa,validateFormat:()=>Ar,weekOfYear:()=>Vr,weekYear:()=>Wr});module.exports=Es(Gi);var Ut,Ht=[];function Zt(e){Ht.push(e)}function Yt(e){Ut=e;for(let n of Ht)n()}function Fs(){return Ut??globalThis.Temporal}function R(){let e=Fs();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 I=class extends Error{code;input;format;token;position;expected;actual;reason;constructor(n,t){super(n),this.name="TemporalFmtError",this.code=t.code,this.input=t.input,this.format=t.format,this.token=t.token,this.position=t.position,this.expected=t.expected,this.actual=t.actual,this.reason=t.reason;let r=Error.captureStackTrace;typeof r=="function"&&r(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,code:this.code,input:this.input,format:this.format,token:this.token,position:this.position,expected:this.expected,actual:this.actual,reason:this.reason}}},y=class extends I{constructor(n){let{message:t,...r}=n;super(t??`format string "${n.format??""}" has a syntax error${n.reason?`: ${n.reason}`:""}.`,{code:"FORMAT_SYNTAX_ERROR",...r}),this.name="FormatSyntaxError"}},O=class extends I{constructor(n){let{message:t,...r}=n;super(t??`token "${n.token??""}" is not a recognized temporal-fmt token${n.format?` in format string "${n.format}"`:""}.`,{code:"UNKNOWN_TOKEN",...r}),this.name="UnknownTokenError"}},C=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" does not match format "${n.format??""}"${n.reason?`: ${n.reason}`:""}.`,{code:"PARSE_MISMATCH",...r}),this.name="ParseMismatchError"}},z=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" does not describe a valid date${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_DATE",...r}),this.name="InvalidDateError"}};/* c8 ignore start @preserve -- InvalidTimeError is part of the public
2
2
  error-class surface (exported from index.ts, code 'INVALID_TIME')
3
3
  but nothing in this package constructs one. Investigated wiring it
4
4
  in the same way InvalidTimeZoneError was just wired (see parse.ts's
@@ -10,7 +10,7 @@
10
10
  is rejected as a plain shape mismatch before any semantic check
11
11
  could run. There's no live gap to hook this into without inventing a
12
12
  redundant check purely to give this class a body. Left unconstructed
13
- until the library actually has a real invalid-time case to report. */var cn=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" does not describe a valid time${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_TIME",...r}),this.name="InvalidTimeError"}};/* c8 ignore stop @preserve */var B=class extends I{constructor(n){let{message:t,...r}=n;super(t??`offset "${n.actual??""}" is invalid${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_OFFSET",...r}),this.name="InvalidOffsetError"}},ke=class extends I{constructor(n){let{message:t,...r}=n;super(t??`time zone "${n.actual??""}" is not a recognized IANA time zone or fixed offset${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_TIME_ZONE",...r}),this.name="InvalidTimeZoneError"}};/* c8 ignore start @preserve -- InvalidCalendarError is part of the
13
+ until the library actually has a real invalid-time case to report. */var ln=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" does not describe a valid time${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_TIME",...r}),this.name="InvalidTimeError"}};/* c8 ignore stop @preserve */var B=class extends I{constructor(n){let{message:t,...r}=n;super(t??`offset "${n.actual??""}" is invalid${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_OFFSET",...r}),this.name="InvalidOffsetError"}},we=class extends I{constructor(n){let{message:t,...r}=n;super(t??`time zone "${n.actual??""}" is not a recognized IANA time zone or fixed offset${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_TIME_ZONE",...r}),this.name="InvalidTimeZoneError"}};/* c8 ignore start @preserve -- InvalidCalendarError is part of the
14
14
  public error-class surface (exported from index.ts, code
15
15
  'INVALID_CALENDAR') but nothing in this package constructs one.
16
16
  Checked for a wiring opportunity the same way InvalidTimeZoneError
@@ -20,8 +20,8 @@
20
20
  of the locale string — it's never handed an arbitrary "calendar"
21
21
  value a caller could get wrong. There's no live input to reject.
22
22
  Left unconstructed until the library actually accepts a calendar
23
- parameter that could be invalid. */var dn=class extends I{constructor(n){let{message:t,...r}=n;super(t??`calendar "${n.actual??""}" is not supported${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_CALENDAR",...r}),this.name="InvalidCalendarError"}};/* c8 ignore stop @preserve */var me=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" is ambiguous${n.reason?`: ${n.reason}`:""}.`,{code:"AMBIGUOUS_INPUT",...r}),this.name="AmbiguousInputError"}},D=class extends I{constructor(n){let{message:t,...r}=n;super(t??`locale "${n.actual??""}" is not a valid BCP-47 tag${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_LOCALE",...r}),this.name="InvalidLocaleError"}},W=class extends I{constructor(n){let{message:t,...r}=n;super(t??`duration is invalid${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_DURATION",...r}),this.name="InvalidDurationError"}};/* c8 ignore start @preserve -- unreachable from the current test suite,
24
- see rationale above */function Vt(e,n){let t=e.message;if(/unknown token|isn't a recognized token/.test(t))return new O({input:n.input,format:n.format,reason:t});if(/ambiguous/i.test(t))return new me({input:n.input,format:n.format,reason:t});if(/offset/.test(t)&&/out of range|exceeds|doesn't match the shape/i.test(t))return new B({input:n.input,format:n.format,reason:t});if(/no valid pattern matches/i.test(t))return new C({input:n.input,format:n.format,reason:t});if(/doesn't describe a valid date\/time|incomplete date|weekday token|quarter token/.test(t))return new z({input:n.input,format:n.format,reason:t});let r=t.toLowerCase();return r.includes("locale")&&(r.includes("produced no")||r.includes("not a valid"))||r.includes("cutoffs must be")?new D({input:n.input,format:n.format,reason:t}):/format string exceeds maximum length|input exceeds maximum length|unterminated quote|isn't a recognized token/i.test(t)?new y({input:n.input,format:n.format,reason:t}):new C({input:n.input,format:n.format,reason:t})}/* c8 ignore stop @preserve */var Ze=new Map,Wt=500,jt=256,Xt=256;function Fs(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 s=e[r];if(s===void 0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}" is missing required field "${r}" (${a}).`);if(!Array.isArray(s))throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}" must be an array, got ${typeof s}.`);if(s.length!==o)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}" must have exactly ${o} entries (got ${s.length}) \u2014 ${a}.`);s.forEach((u,i)=>{if(typeof u!="string"||u.length===0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}[${i}]" must be a non-empty string, got ${String(u)}.`);if(u.length>Xt)throw new RangeError(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}[${i}]" is too long (maximum ${Xt} characters).`)})}if(ce(e.monthLong,"MMMM month",n),ce(e.monthShort,"MMM month",n),ce(e.weekdayLong,"EEEE weekday",n),ce(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.`)}var Gt=[];function Bt(e){Gt.push(e)}function fn(e,n){if(typeof e!="string"||e.length===0)throw new Error(`temporal-fmt: registerLocaleVocab requires a non-empty locale string, got ${String(e)}.`);if(e.length>jt)throw new RangeError(`temporal-fmt: registerLocaleVocab locale is too long (maximum ${jt} characters).`);Fs(n,e);let t=q(e);if(!Ze.has(t)&&Ze.size>=Wt)throw new RangeError(`temporal-fmt: registerLocaleVocab reached the ${Wt}-locale limit.`);Ze.set(t,{monthLong:[...n.monthLong],monthShort:[...n.monthShort],weekdayLong:[...n.weekdayLong],weekdayShort:[...n.weekdayShort],dayPeriod:[...n.dayPeriod]}),Re.delete(t);for(let r of Gt)r()}function U(e){return e.replace(/_/g,"-")}var He=new Map,_s=500;function q(e){let n=He.get(e);if(n!==void 0)return n;let t;try{t=new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{t=e}if(He.size>=_s){let r=He.keys().next().value;r!==void 0&&He.delete(r)}return He.set(e,t),t}function zn(e){try{new Intl.Locale(U(e))}catch{throw new D({actual:e,reason:"not a valid BCP-47 locale tag"})}}var Re=new Map,$s=500;function $e(e,n,t){let r=e.formatToParts(n),o=r.findIndex(i=>i.type===t);/* c8 ignore start @preserve -- defensive guard against a real but
23
+ parameter that could be invalid. */var mn=class extends I{constructor(n){let{message:t,...r}=n;super(t??`calendar "${n.actual??""}" is not supported${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_CALENDAR",...r}),this.name="InvalidCalendarError"}};/* c8 ignore stop @preserve */var le=class extends I{constructor(n){let{message:t,...r}=n;super(t??`input "${n.input??""}" is ambiguous${n.reason?`: ${n.reason}`:""}.`,{code:"AMBIGUOUS_INPUT",...r}),this.name="AmbiguousInputError"}},D=class extends I{constructor(n){let{message:t,...r}=n;super(t??`locale "${n.actual??""}" is not a valid BCP-47 tag${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_LOCALE",...r}),this.name="InvalidLocaleError"}},W=class extends I{constructor(n){let{message:t,...r}=n;super(t??`duration is invalid${n.reason?`: ${n.reason}`:""}.`,{code:"INVALID_DURATION",...r}),this.name="InvalidDurationError"}};/* c8 ignore start @preserve -- unreachable from the current test suite,
24
+ see rationale above */function Vt(e,n){let t=e.message;if(/unknown token|isn't a recognized token/.test(t))return new O({input:n.input,format:n.format,reason:t});if(/ambiguous/i.test(t))return new le({input:n.input,format:n.format,reason:t});if(/offset/.test(t)&&/out of range|exceeds|doesn't match the shape/i.test(t))return new B({input:n.input,format:n.format,reason:t});if(/no valid pattern matches/i.test(t))return new C({input:n.input,format:n.format,reason:t});if(/doesn't describe a valid date\/time|incomplete date|weekday token|quarter token/.test(t))return new z({input:n.input,format:n.format,reason:t});let r=t.toLowerCase();return r.includes("locale")&&(r.includes("produced no")||r.includes("not a valid"))||r.includes("cutoffs must be")?new D({input:n.input,format:n.format,reason:t}):/format string exceeds maximum length|input exceeds maximum length|unterminated quote|isn't a recognized token/i.test(t)?new y({input:n.input,format:n.format,reason:t}):new C({input:n.input,format:n.format,reason:t})}/* c8 ignore stop @preserve */var He=new Map,Wt=500,Xt=256,jt=256;function _s(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 s=e[r];if(s===void 0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}" is missing required field "${r}" (${a}).`);if(!Array.isArray(s))throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}" must be an array, got ${typeof s}.`);if(s.length!==o)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}" must have exactly ${o} entries (got ${s.length}) \u2014 ${a}.`);s.forEach((u,i)=>{if(typeof u!="string"||u.length===0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}[${i}]" must be a non-empty string, got ${String(u)}.`);if(u.length>jt)throw new RangeError(`temporal-fmt: registerLocaleVocab for locale "${n}": "${r}[${i}]" is too long (maximum ${jt} characters).`)})}if(me(e.monthLong,"MMMM month",n),me(e.monthShort,"MMM month",n),me(e.weekdayLong,"EEEE weekday",n),me(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.`)}var Gt=[];function Bt(e){Gt.push(e)}function cn(e,n){if(typeof e!="string"||e.length===0)throw new Error(`temporal-fmt: registerLocaleVocab requires a non-empty locale string, got ${String(e)}.`);if(e.length>Xt)throw new RangeError(`temporal-fmt: registerLocaleVocab locale is too long (maximum ${Xt} characters).`);_s(n,e);let t=q(e);if(!He.has(t)&&He.size>=Wt)throw new RangeError(`temporal-fmt: registerLocaleVocab reached the ${Wt}-locale limit.`);He.set(t,{monthLong:[...n.monthLong],monthShort:[...n.monthShort],weekdayLong:[...n.weekdayLong],weekdayShort:[...n.weekdayShort],dayPeriod:[...n.dayPeriod]}),Re.delete(t);for(let r of Gt)r()}function U(e){return e.replace(/_/g,"-")}var Ue=new Map,$s=500;function q(e){let n=Ue.get(e);if(n!==void 0)return n;let t;try{t=new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{t=e}if(Ue.size>=$s){let r=Ue.keys().next().value;r!==void 0&&Ue.delete(r)}return Ue.set(e,t),t}function Un(e){try{new Intl.Locale(U(e))}catch{throw new D({actual:e,reason:"not a valid BCP-47 locale tag"})}}var Re=new Map,Rs=500;function $e(e,n,t){let r=e.formatToParts(n),o=r.findIndex(i=>i.type===t);/* c8 ignore start @preserve -- defensive guard against a real but
25
25
  unreproducible failure mode: an Intl implementation that omits the
26
26
  requested part type entirely for some locale. Checked every locale
27
27
  with unusual dayPeriod/weekday/month rendering available in this
@@ -32,28 +32,28 @@
32
32
  produced a false "gap" during investigation). None omit their part
33
33
  on this runtime. A different ICU version or a non-Node Intl
34
34
  implementation could plausibly behave differently, so this stays a
35
- real check rather than an assertion. *//* c8 ignore start @preserve */if(o===-1)throw new D({message:`temporal-fmt: locale produced no "${t}" part while building match vocabulary.`});/* c8 ignore stop @preserve */let a=r[o].value,s=r[o-1],u=r[o+1];return s?.type==="literal"&&!/\s/.test(s.value)&&(a=s.value+a),u?.type==="literal"&&!/\s/.test(u.value)&&(a=a+u.value),a}function ce(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 K(e){let n=q(e);return Ze.get(n)}function de(e){zn(e);let n=q(e),t=Ze.get(n);if(t)return t;let r=Re.get(n);if(r)return r;let o=U(e),a=new Intl.DateTimeFormat(o,{month:"long",timeZone:"UTC"}),s=new Intl.DateTimeFormat(o,{month:"short",timeZone:"UTC"}),u=[],i=[];for(let b=0;b<12;b++){let x=new Date(Date.UTC(2020,b,1));u.push($e(a,x,"month")),i.push($e(s,x,"month"))}ce(u,"MMMM month",e),ce(i,"MMM month",e);let m=new Intl.DateTimeFormat(o,{weekday:"long",timeZone:"UTC"}),l=new Intl.DateTimeFormat(o,{weekday:"short",timeZone:"UTC"}),c=[],p=[];for(let b=0;b<7;b++){let x=new Date(Date.UTC(2024,0,1+b));c.push($e(m,x,"weekday")),p.push($e(l,x,"weekday"))}ce(c,"EEEE weekday",e),ce(p,"EEE weekday",e);let d=new Intl.DateTimeFormat(o,{hour:"numeric",hour12:!0,timeZone:"UTC"}),f=$e(d,new Date(Date.UTC(2020,0,1,1)),"dayPeriod"),h=$e(d,new Date(Date.UTC(2020,0,1,13)),"dayPeriod"),w=[...new Set([f,h])],M={monthLong:u,monthShort:i,weekdayLong:c,weekdayShort:p,dayPeriod:w};if(Re.size>=$s){let b=Re.keys().next().value;b!==void 0&&Re.delete(b)}return Re.set(n,M),M}var Rs=[0,31,59,90,120,151,181,212,243,273,304,334];function oe(e){return e%4===0&&e%100!==0||e%400===0}function Ye(e){return oe(e)?366:365}function ae(e,n,t){let r=Rs[n-1]+t;return n>2&&oe(e)&&(r+=1),r}var Un=2e3;function Is(e){let n=0;if(e>=Un)for(let r=Un;r<e;r++)n+=Ye(r);else for(let r=e;r<Un;r++)n-=Ye(r);return((5+n)%7+7)%7+1}function Ie(e,n,t,r){let a=ae(e,n,t)+(4-r),s,u;a<1?(s=e-1,u=a+Ye(s)):a>Ye(e)?(s=e+1,u=a-Ye(e)):(s=e,u=a);let m=1+(4-Is(s)+7)%7,l=1+Math.floor((u-m)/7);return{isoYear:s,week:l}}function E(e,n){let t=e<0,r=String(Math.abs(e)).padStart(n,"0");return t?"-"+r:r}E.fraction=function(n,t){let r=n.millisecond*1e6+(n.microsecond??0)*1e3+(n.nanosecond??0);return E(r,9).slice(0,t)};var P="en-US",Ve=new Map,Os=500;function qt(e,n){let t=JSON.stringify([q(e),n]),r=Ve.get(t);if(r)return r;if(Ve.size>=Os){let o=Ve.keys().next().value;o!==void 0&&Ve.delete(o)}try{r=new Intl.DateTimeFormat(U(e),n)}catch(o){throw new D({actual:e,reason:o.message})}return Ve.set(t,r),r}var We;Zt(()=>{We=void 0});function Ps(){if(We===void 0){We=!1;try{let e=R();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),We=!0}catch{}}return We}function je(e,n,t,r){let o=e?.calendarId,a={...t,calendar:o&&o!=="iso8601"?o:"gregory"},s=e.toLocaleString;if(typeof s!="function"||s===Object.prototype.toLocaleString)throw new Error(`temporal-fmt: locale-aware part "${r}" needs a value that implements toLocaleString (a real Temporal object). A plain field bag cannot render locale-aware names \u2014 pass a Temporal.PlainDate/PlainDateTime/ZonedDateTime.`);if(!Ps())try{return s.call(e,U(n),a)}catch(b){throw b instanceof RangeError?new D({actual:n,reason:b.message}):b}let{toInstant:u,timeZoneId:i}=e,m=typeof u=="function"&&typeof i=="string",l=m?e.toInstant():e,c={...a,...m?{timeZone:i}:{}},d=qt(n,c).formatToParts(l),f=d.findIndex(b=>b.type===r);if(f===-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 h=d[f].value,w=d[f-1],M=d[f+1];return w?.type==="literal"&&!/\s/.test(w.value)&&(h=w.value+h),M?.type==="literal"&&!/\s/.test(M.value)&&(h=h+M.value),h}function Ns(e,n){let t=K(n);if(t)return e<12?t.dayPeriod[0]:t.dayPeriod[1];let r=new Date(Date.UTC(1970,0,1,e)),a=qt(n,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(s=>s.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${n}" produced no "dayPeriod" part for token "a".`);return a.value}function fe(e,n,t,r,o,a){return o&&a!==void 0&&a>=0&&a<o.length?o[a]:je(e,n,t,r)}function Oe(e,n){if(e==="+00:00"&&(n==="X"||n==="XX"||n==="XXX"))return"Z";let t=e[0],r=e.slice(1,3),o=e.slice(4,6);switch(n){case"X":case"x":return o==="00"?`${t}${r}`:`${t}${r}${o}`;case"XX":case"xx":return`${t}${r}${o}`;case"XXX":case"xxx":return`${t}${r}:${o}`}}var pe=[["yyyy",e=>E(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 E(e.year%100,2)},"year"],["MMMM",(e,n)=>{let t=K(n);return fe(e,n,{month:"long"},"month",t?.monthLong,e.month-1)},"month"],["MMM",(e,n)=>{let t=K(n);return fe(e,n,{month:"short"},"month",t?.monthShort,e.month-1)},"month"],["MM",e=>E(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>E(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,n)=>{let t=K(n);return fe(e,n,{weekday:"long"},"weekday",t?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,n)=>{let t=K(n);return fe(e,n,{weekday:"short"},"weekday",t?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>E(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>E(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>E(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>E(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSSSSSSSS",e=>E.fraction(e,9),"millisecond"],["SSSSSSSS",e=>E.fraction(e,8),"millisecond"],["SSSSSSS",e=>E.fraction(e,7),"millisecond"],["SSSSSS",e=>E.fraction(e,6),"millisecond"],["SSSSS",e=>E.fraction(e,5),"millisecond"],["SSSS",e=>E.fraction(e,4),"millisecond"],["SSS",e=>E.fraction(e,3),"millisecond"],["SS",e=>E.fraction(e,2),"millisecond"],["S",e=>E.fraction(e,1),"millisecond"],["a",(e,n)=>Ns(e.hour,n),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["xxx",e=>Oe(e.offset,"xxx"),"offset"],["xx",e=>Oe(e.offset,"xx"),"offset"],["X",e=>Oe(e.offset,"X"),"offset"],["XX",e=>Oe(e.offset,"XX"),"offset"],["XXX",e=>Oe(e.offset,"XXX"),"offset"],["x",e=>Oe(e.offset,"x"),"offset"],["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}=Ie(e.year,e.month,e.day,e.dayOfWeek);return E(n,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:n}=Ie(e.year,e.month,e.day,e.dayOfWeek);return E(n,4)},"dayOfWeek"],["D",e=>String(ae(e.year,e.month,e.day)),"day"],["DD",e=>E(ae(e.year,e.month,e.day),2),"day"],["DDD",e=>E(ae(e.year,e.month,e.day),3),"day"],["LLLL",(e,n)=>{let t=K(n);return fe(e,n,{month:"long"},"month",t?.monthLong,e.month-1)},"month"],["LLL",(e,n)=>{let t=K(n);return fe(e,n,{month:"short"},"month",t?.monthShort,e.month-1)},"month"],["cccc",(e,n)=>{let t=K(n);return fe(e,n,{weekday:"long"},"weekday",t?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["ccc",(e,n)=>{let t=K(n);return fe(e,n,{weekday:"short"},"weekday",t?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["GGGG",(e,n)=>je(e,n,{era:"long"},"era"),"year"],["G",(e,n)=>je(e,n,{era:"short"},"era"),"year"],["zzzz",(e,n)=>je(e,n,{timeZoneName:"longGeneric"},"timeZoneName"),"timeZoneId"],["z",(e,n)=>je(e,n,{timeZoneName:"short"},"timeZoneName"),"timeZoneId"]];var Cs=pe.map(([e])=>e).sort((e,n)=>n.length-e.length);function he(e){let n=[],t=0;for(;t<e.length;){let r=e[t];if(r==="'"){if(e[t+1]==="'"){Hn(n,"'"),t+=2;continue}let a=t+1,s="",u=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){s+="'",a+=2;continue}u=!0,a+=1;break}s+=e[a],a+=1}if(!u)throw new y({format:e,message:`temporal-fmt: unterminated quote in format string "${e}"`});Hn(n,s),t=a;continue}let o=Cs.find(a=>e.startsWith(a,t));if(o){let a=o[o.length-1];if(e[t+o.length]===a){let s=t+o.length;for(;e[s]===a;)s+=1;throw new O({format:e,token:e.slice(t,s),message:`temporal-fmt: "${e.slice(t,s)}" in format string "${e}" isn't a recognized token \u2014 did you mean "${o}"?`})}n.push({kind:"token",value:o}),t+=o.length;continue}Hn(n,r),t+=1}return n}function Hn(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}var Xe=new Set(["latn","arab","deva","beng","guru","gujr","orya","tamldec","telu","knda","mlym","fullwide","hanidec"]),Kt=new Map;function Qt(e){let n=Kt.get(e);if(n)return n;/* c8 ignore start @preserve -- dead by construction, not just
35
+ real check rather than an assertion. *//* c8 ignore start @preserve */if(o===-1)throw new D({message:`temporal-fmt: locale produced no "${t}" part while building match vocabulary.`});/* c8 ignore stop @preserve */let a=r[o].value,s=r[o-1],u=r[o+1];return s?.type==="literal"&&!/\s/.test(s.value)&&(a=s.value+a),u?.type==="literal"&&!/\s/.test(u.value)&&(a=a+u.value),a}function me(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 K(e){let n=q(e);return He.get(n)}function be(e){Un(e);let n=q(e),t=He.get(n);if(t)return t;let r=Re.get(n);if(r)return r;let o=U(e),a=new Intl.DateTimeFormat(o,{month:"long",timeZone:"UTC"}),s=new Intl.DateTimeFormat(o,{month:"short",timeZone:"UTC"}),u=[],i=[];for(let b=0;b<12;b++){let E=new Date(Date.UTC(2020,b,1));u.push($e(a,E,"month")),i.push($e(s,E,"month"))}me(u,"MMMM month",e),me(i,"MMM month",e);let m=new Intl.DateTimeFormat(o,{weekday:"long",timeZone:"UTC"}),l=new Intl.DateTimeFormat(o,{weekday:"short",timeZone:"UTC"}),c=[],p=[];for(let b=0;b<7;b++){let E=new Date(Date.UTC(2024,0,1+b));c.push($e(m,E,"weekday")),p.push($e(l,E,"weekday"))}me(c,"EEEE weekday",e),me(p,"EEE weekday",e);let d=new Intl.DateTimeFormat(o,{hour:"numeric",hour12:!0,timeZone:"UTC"}),f=$e(d,new Date(Date.UTC(2020,0,1,1)),"dayPeriod"),h=$e(d,new Date(Date.UTC(2020,0,1,13)),"dayPeriod"),w=[...new Set([f,h])],M={monthLong:u,monthShort:i,weekdayLong:c,weekdayShort:p,dayPeriod:w};if(Re.size>=Rs){let b=Re.keys().next().value;b!==void 0&&Re.delete(b)}return Re.set(n,M),M}var Is=[0,31,59,90,120,151,181,212,243,273,304,334];function oe(e){return e%4===0&&e%100!==0||e%400===0}function Ze(e){return oe(e)?366:365}function ae(e,n,t){let r=Is[n-1]+t;return n>2&&oe(e)&&(r+=1),r}var Hn=2e3;function Os(e){let n=0;if(e>=Hn)for(let r=Hn;r<e;r++)n+=Ze(r);else for(let r=e;r<Hn;r++)n-=Ze(r);return((5+n)%7+7)%7+1}function Ie(e,n,t,r){let a=ae(e,n,t)+(4-r),s,u;a<1?(s=e-1,u=a+Ze(s)):a>Ze(e)?(s=e+1,u=a-Ze(e)):(s=e,u=a);let m=1+(4-Os(s)+7)%7,l=1+Math.floor((u-m)/7);return{isoYear:s,week:l}}function x(e,n){let t=e<0,r=String(Math.abs(e)).padStart(n,"0");return t?"-"+r:r}x.fraction=function(n,t){let r=n.millisecond*1e6+(n.microsecond??0)*1e3+(n.nanosecond??0);return x(r,9).slice(0,t)};var P="en-US",Ye=new Map,Ps=500;function qt(e,n){let t=JSON.stringify([q(e),n]),r=Ye.get(t);if(r)return r;if(Ye.size>=Ps){let o=Ye.keys().next().value;o!==void 0&&Ye.delete(o)}try{r=new Intl.DateTimeFormat(U(e),n)}catch(o){throw new D({actual:e,reason:o.message})}return Ye.set(t,r),r}var Ve;Zt(()=>{Ve=void 0});function Ns(){if(Ve===void 0){Ve=!1;try{let e=R();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),Ve=!0}catch{}}return Ve}function We(e,n,t,r){let o=e?.calendarId,a={...t,calendar:o&&o!=="iso8601"?o:"gregory"},s=e.toLocaleString;if(typeof s!="function"||s===Object.prototype.toLocaleString)throw new Error(`temporal-fmt: locale-aware part "${r}" needs a value that implements toLocaleString (a real Temporal object). A plain field bag cannot render locale-aware names \u2014 pass a Temporal.PlainDate/PlainDateTime/ZonedDateTime.`);if(!Ns())try{return s.call(e,U(n),a)}catch(b){throw b instanceof RangeError?new D({actual:n,reason:b.message}):b}let{toInstant:u,timeZoneId:i}=e,m=typeof u=="function"&&typeof i=="string",l=m?e.toInstant():e,c={...a,...m?{timeZone:i}:{}},d=qt(n,c).formatToParts(l),f=d.findIndex(b=>b.type===r);if(f===-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 h=d[f].value,w=d[f-1],M=d[f+1];return w?.type==="literal"&&!/\s/.test(w.value)&&(h=w.value+h),M?.type==="literal"&&!/\s/.test(M.value)&&(h=h+M.value),h}function Cs(e,n){let t=K(n);if(t)return e<12?t.dayPeriod[0]:t.dayPeriod[1];let r=new Date(Date.UTC(1970,0,1,e)),a=qt(n,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(s=>s.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${n}" produced no "dayPeriod" part for token "a".`);return a.value}function ce(e,n,t,r,o,a){return o&&a!==void 0&&a>=0&&a<o.length?o[a]:We(e,n,t,r)}function Oe(e,n){if(e==="+00:00"&&(n==="X"||n==="XX"||n==="XXX"))return"Z";if(e.length>6){if(n==="xxx")return e;throw new Error(`temporal-fmt: token "${n}" cannot represent the offset "${e}", which has a seconds component. None of the X/XX/XXX/x/xx tokens support offset seconds; use "xxx" instead, which formats the full offset unchanged.`)}let t=e[0],r=e.slice(1,3),o=e.slice(4,6);switch(n){case"X":case"x":return o==="00"?`${t}${r}`:`${t}${r}${o}`;case"XX":case"xx":return`${t}${r}${o}`;case"XXX":case"xxx":return`${t}${r}:${o}`}}var de=[["yyyy",e=>x(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 x(e.year%100,2)},"year"],["y",e=>x(e.year,0),"year"],["MMMM",(e,n)=>{let t=K(n);return ce(e,n,{month:"long"},"month",t?.monthLong,e.month-1)},"month"],["MMM",(e,n)=>{let t=K(n);return ce(e,n,{month:"short"},"month",t?.monthShort,e.month-1)},"month"],["MM",e=>x(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>x(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,n)=>{let t=K(n);return ce(e,n,{weekday:"long"},"weekday",t?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,n)=>{let t=K(n);return ce(e,n,{weekday:"short"},"weekday",t?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>x(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>x(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>x(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>x(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSSSSSSSS",e=>x.fraction(e,9),"millisecond"],["SSSSSSSS",e=>x.fraction(e,8),"millisecond"],["SSSSSSS",e=>x.fraction(e,7),"millisecond"],["SSSSSS",e=>x.fraction(e,6),"millisecond"],["SSSSS",e=>x.fraction(e,5),"millisecond"],["SSSS",e=>x.fraction(e,4),"millisecond"],["SSS",e=>x.fraction(e,3),"millisecond"],["SS",e=>x.fraction(e,2),"millisecond"],["S",e=>x.fraction(e,1),"millisecond"],["a",(e,n)=>Cs(e.hour,n),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["xxx",e=>Oe(e.offset,"xxx"),"offset"],["xx",e=>Oe(e.offset,"xx"),"offset"],["X",e=>Oe(e.offset,"X"),"offset"],["XX",e=>Oe(e.offset,"XX"),"offset"],["XXX",e=>Oe(e.offset,"XXX"),"offset"],["x",e=>Oe(e.offset,"x"),"offset"],["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}=Ie(e.year,e.month,e.day,e.dayOfWeek);return x(n,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:n}=Ie(e.year,e.month,e.day,e.dayOfWeek);return x(n,4)},"dayOfWeek"],["D",e=>String(ae(e.year,e.month,e.day)),"day"],["DD",e=>x(ae(e.year,e.month,e.day),2),"day"],["DDD",e=>x(ae(e.year,e.month,e.day),3),"day"],["LLLL",(e,n)=>{let t=K(n);return ce(e,n,{month:"long"},"month",t?.monthLong,e.month-1)},"month"],["LLL",(e,n)=>{let t=K(n);return ce(e,n,{month:"short"},"month",t?.monthShort,e.month-1)},"month"],["cccc",(e,n)=>{let t=K(n);return ce(e,n,{weekday:"long"},"weekday",t?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["ccc",(e,n)=>{let t=K(n);return ce(e,n,{weekday:"short"},"weekday",t?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["GGGG",(e,n)=>We(e,n,{era:"long"},"era"),"year"],["G",(e,n)=>We(e,n,{era:"short"},"era"),"year"],["zzzz",(e,n)=>We(e,n,{timeZoneName:"longGeneric"},"timeZoneName"),"timeZoneId"],["z",(e,n)=>We(e,n,{timeZoneName:"short"},"timeZoneName"),"timeZoneId"]];var As=de.map(([e])=>e).sort((e,n)=>n.length-e.length);function fe(e){let n=[],t=0;for(;t<e.length;){let r=e[t];if(r==="'"){if(e[t+1]==="'"){Zn(n,"'"),t+=2;continue}let a=t+1,s="",u=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){s+="'",a+=2;continue}u=!0,a+=1;break}s+=e[a],a+=1}if(!u)throw new y({format:e,message:`temporal-fmt: unterminated quote in format string "${e}"`});Zn(n,s),t=a;continue}let o=As.find(a=>e.startsWith(a,t));if(o){let a=o[o.length-1];if(e[t+o.length]===a){let s=t+o.length;for(;e[s]===a;)s+=1;throw new O({format:e,token:e.slice(t,s),message:`temporal-fmt: "${e.slice(t,s)}" in format string "${e}" isn't a recognized token \u2014 did you mean "${o}"?`})}n.push({kind:"token",value:o}),t+=o.length;continue}Zn(n,r),t+=1}return n}function Zn(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}var Xe=new Set(["latn","arab","deva","beng","guru","gujr","orya","tamldec","telu","knda","mlym","fullwide","hanidec"]),Kt=new Map;function Qt(e){let n=Kt.get(e);if(n)return n;/* c8 ignore start @preserve -- dead by construction, not just
36
36
  untested: both callers (convertDigits, convertDigitsToAscii) already
37
37
  return early on system === 'latn' before calling getDigitMap at all,
38
38
  so this function is never invoked with 'latn'. Kept as a defensive
39
39
  fallback rather than trusting that stays true for any future
40
- caller. */if(e==="latn"){n={};for(let t=0;t<10;t++)n[String(t)]=String(t)}else{/* c8 ignore stop @preserve */let t=new Intl.NumberFormat("en-US-u-nu-"+e,{useGrouping:!1});n={};for(let r=0;r<10;r++)n[String(r)]=t.format(r)}return Kt.set(e,n),n}function Zn(e,n){if(n==="latn")return e;if(!Xe.has(n))throw new D({actual:n,reason:`numbering system "${n}" is not supported. Supported: ${[...Xe].join(", ")}.`});let t=Qt(n),r="";for(let o of e)o>="0"&&o<="9"?r+=t[o]??o:r+=o;return r}function Yn(e,n){if(n==="latn")return e;if(!Xe.has(n))throw new D({actual:n,reason:`numbering system "${n}" is not supported.`});let t=Qt(n),r={};for(let a of Object.keys(t))r[t[a]]=a;let o="";for(let a of e)o+=r[a]??a;return o}function Te(e,n){let t=n.numberingSystem??"latn";return t==="latn"?e:Zn(e,t)}function Ge(e,n){let t=n.parseNumberingSystem??"latn";return t==="latn"?e:Yn(e,t)}var qe=new Map(pe.map(([e,n,t])=>[e,{fn:n,field:t}])),Be=new Map,As=500;function Vn(e){let n=Be.get(e);if(n)return n;if(Be.size>=As){let t=Be.keys().next().value;t!==void 0&&Be.delete(t)}return n=he(e),Be.set(e,n),n}function Q(e,n,t={}){if(n.length>1e3)throw new y({format:n,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${n.length}).`});let r=t.locale??P,o=Vn(n),a="";for(let s of o){if(s.kind==="literal"){a+=s.value;continue}let u=qe.get(s.value);/* c8 ignore start @preserve -- unreachable: tokenize() only ever emits
40
+ caller. */if(e==="latn"){n={};for(let t=0;t<10;t++)n[String(t)]=String(t)}else{/* c8 ignore stop @preserve */let t=new Intl.NumberFormat("en-US-u-nu-"+e,{useGrouping:!1});n={};for(let r=0;r<10;r++)n[String(r)]=t.format(r)}return Kt.set(e,n),n}function Yn(e,n){if(n==="latn")return e;if(!Xe.has(n))throw new D({actual:n,reason:`numbering system "${n}" is not supported. Supported: ${[...Xe].join(", ")}.`});let t=Qt(n),r="";for(let o of e)o>="0"&&o<="9"?r+=t[o]??o:r+=o;return r}function Vn(e,n){if(n==="latn")return e;if(!Xe.has(n))throw new D({actual:n,reason:`numbering system "${n}" is not supported.`});let t=Qt(n),r={};for(let a of Object.keys(t))r[t[a]]=a;let o="";for(let a of e)o+=r[a]??a;return o}function ke(e,n){let t=n.numberingSystem??"latn";return t==="latn"?e:Yn(e,t)}function je(e,n){let t=n.parseNumberingSystem??"latn";return t==="latn"?e:Vn(e,t)}var Be=new Map(de.map(([e,n,t])=>[e,{fn:n,field:t}])),Ge=new Map,Ls=500;function Wn(e){let n=Ge.get(e);if(n)return n;if(Ge.size>=Ls){let t=Ge.keys().next().value;t!==void 0&&Ge.delete(t)}return n=fe(e),Ge.set(e,n),n}function Q(e,n,t={}){if(n.length>1e3)throw new y({format:n,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${n.length}).`});let r=t.locale??P,o=Wn(n),a="";for(let s of o){if(s.kind==="literal"){a+=s.value;continue}let u=Be.get(s.value);/* c8 ignore start @preserve -- unreachable: tokenize() only ever emits
41
41
  tokens present in TOKENS, and HANDLER_BY_TOKEN is built from that
42
42
  same list, so every token piece.value can hold already has an entry
43
43
  here. Same defensive-guard category as the twin checks in
44
- analyze.ts/formatDuration.ts. */if(!u)throw new O({token:s.value,format:n,message:`temporal-fmt: unknown token "${s.value}"`});/* c8 ignore stop @preserve */if(e[u.field]===void 0)throw new y({format:n,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a+=u.fn(e,r)}return Te(a,t)}function Ke(e,n,t={}){if(n.length>1e3)throw new y({format:n,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${n.length}).`});let r=t.locale??P,o=Vn(n),a=[];for(let s of o){if(s.kind==="literal"){let i=a[a.length-1];/* c8 ignore start @preserve -- unreachable through tokenize()'s own
44
+ analyze.ts/formatDuration.ts. */if(!u)throw new O({token:s.value,format:n,message:`temporal-fmt: unknown token "${s.value}"`});/* c8 ignore stop @preserve */if(e[u.field]===void 0)throw new y({format:n,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a+=u.fn(e,r)}return ke(a,t)}function qe(e,n,t={}){if(n.length>1e3)throw new y({format:n,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${n.length}).`});let r=t.locale??P,o=Wn(n),a=[];for(let s of o){if(s.kind==="literal"){let i=a[a.length-1];/* c8 ignore start @preserve -- unreachable through tokenize()'s own
45
45
  output: appendLiteral() in tokenize.ts already merges every
46
46
  adjacent literal character before pieces ever reaches here, so
47
47
  two 'literal' pieces never sit back-to-back in the array this
48
48
  loop walks. Kept as defense-in-depth in case that invariant ever
49
- changes upstream. */if(i&&i.type==="literal")i.value+=s.value;else{/* c8 ignore stop @preserve */a.push({type:"literal",value:s.value})}continue}let u=qe.get(s.value);/* c8 ignore start @preserve -- unreachable, see the note in format() above */if(!u)throw new O({token:s.value,format:n,message:`temporal-fmt: unknown token "${s.value}"`});/* c8 ignore stop @preserve */if(e[u.field]===void 0)throw new y({format:n,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a.push({type:"token",value:Te(u.fn(e,r),t),token:s.value})}return a}function Jt(e){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});let n=Vn(e);return{formatStr:e,pieces:n,format(t,r={}){let o=r.locale??P,a="";for(let s of n){if(s.kind==="literal"){a+=s.value;continue}let u=qe.get(s.value);if(!u)throw new O({token:s.value,format:e,message:`temporal-fmt: unknown token "${s.value}"`});if(t[u.field]===void 0)throw new y({format:e,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a+=u.fn(t,o)}return Te(a,r)},formatToParts(t,r={}){let o=r.locale??P,a=[];for(let s of n){if(s.kind==="literal"){let i=a[a.length-1];i&&i.type==="literal"?i.value+=s.value:a.push({type:"literal",value:s.value});continue}let u=qe.get(s.value);if(!u)throw new O({token:s.value,format:e,message:`temporal-fmt: unknown token "${s.value}"`});if(t[u.field]===void 0)throw new y({format:e,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a.push({type:"token",value:Te(u.fn(t,o),r),token:s.value})}return a}}}function Wn(e){return qe.get(e)}function Ls(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(e,n=!1){let t=e.map(Ls);return n?`(?:${t.map(zs).join("|")})`:`(?:${t.join("|")})`}function zs(e){return e.replace(/[a-zA-Z]/g,n=>`[${n.toLowerCase()}${n.toUpperCase()}]`)}var Us="(?:UTC|[+-]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?|[A-Za-z_]+(?:[+-]\\d{1,2})?(?:\\/[A-Za-z0-9_+-]+)*)",Hs={X:"(?:Z|[+-]\\d{2}(?:\\d{2})?)",XX:"(?:Z|[+-]\\d{4})",XXX:"(?:Z|[+-]\\d{2}:\\d{2})",x:"[+-]\\d{2}(?:\\d{2})?",xx:"[+-]\\d{4}",xxx:"[+-]\\d{2}:\\d{2}"};function Zs(){return Us}var pn;function Ys(){return pn||(pn=new Set(Intl.supportedValuesOf("timeZone")),pn.add("UTC")),pn}var Vs=/^[+-]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/;function jn(e){return Vs.test(e)||Ys().has(e)}var Ws={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]"},js="Q[1-4]",Xn=new Set(["do","ww","RRRR","D","DD","DDD","LLLL","LLL","cccc","ccc","GGGG","G","zzzz","z"]),Xs="-?\\d{4}",Gs="-?\\d{4,}",Gn=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 hn(e,n,t){if(e==="yyyy")return t!==void 0&&Gn.has(t)?Xs:Gs;let r=Ws[e];if(r)return r;if(e==="QQQ")return js;if(Xn.has(e))throw new O({token:e,message:`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=de(n);switch(e){case"MMMM":return Qe(o.monthLong);case"MMM":return Qe(o.monthShort);case"EEEE":return Qe(o.weekdayLong);case"EEE":return Qe(o.weekdayShort);case"a":return Qe(o.dayPeriod,!0);case"zzz":return Zs();case"X":case"XX":case"XXX":case"x":case"xx":case"xxx":return Hs[e];default:throw new O({token:e,message:`temporal-fmt: unknown token "${e}"`})}}var gn=new Set(["M","d","H","h","m","s"]),Bs={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 Bn(e,n){let t=new Map;function r(o,a){let s=`${o}:${a}`,u=t.get(s);if(u)return u;if(o===n.length){let c=a===e.length?[[]]:[];return t.set(s,c),c}let i=n[o],m=Bs[i];/* c8 ignore start @preserve -- defensive guard, not reachable through
49
+ changes upstream. */if(i&&i.type==="literal")i.value+=s.value;else{/* c8 ignore stop @preserve */a.push({type:"literal",value:s.value})}continue}let u=Be.get(s.value);/* c8 ignore start @preserve -- unreachable, see the note in format() above */if(!u)throw new O({token:s.value,format:n,message:`temporal-fmt: unknown token "${s.value}"`});/* c8 ignore stop @preserve */if(e[u.field]===void 0)throw new y({format:n,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a.push({type:"token",value:ke(u.fn(e,r),t),token:s.value})}return a}function Jt(e){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});let n=Wn(e);return{formatStr:e,pieces:n,format(t,r={}){let o=r.locale??P,a="";for(let s of n){if(s.kind==="literal"){a+=s.value;continue}let u=Be.get(s.value);if(!u)throw new O({token:s.value,format:e,message:`temporal-fmt: unknown token "${s.value}"`});if(t[u.field]===void 0)throw new y({format:e,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a+=u.fn(t,o)}return ke(a,r)},formatToParts(t,r={}){let o=r.locale??P,a=[];for(let s of n){if(s.kind==="literal"){let i=a[a.length-1];i&&i.type==="literal"?i.value+=s.value:a.push({type:"literal",value:s.value});continue}let u=Be.get(s.value);if(!u)throw new O({token:s.value,format:e,message:`temporal-fmt: unknown token "${s.value}"`});if(t[u.field]===void 0)throw new y({format:e,token:s.value,message:`temporal-fmt: token "${s.value}" requires "${u.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`});a.push({type:"token",value:ke(u.fn(t,o),r),token:s.value})}return a}}}function Xn(e){return Be.get(e)}function zs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(e,n=!1){let t=e.map(zs);return n?`(?:${t.map(Us).join("|")})`:`(?:${t.join("|")})`}function Us(e){return e.replace(/[a-zA-Z]/g,n=>`[${n.toLowerCase()}${n.toUpperCase()}]`)}var Hs="(?:UTC|[+-]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?|[A-Za-z_]+(?:[+-]\\d{1,2})?(?:\\/[A-Za-z0-9_+-]+)*)",Zs={X:"(?:Z|[+-]\\d{2}(?:\\d{2})?)",XX:"(?:Z|[+-]\\d{4})",XXX:"(?:Z|[+-]\\d{2}:\\d{2})",x:"[+-]\\d{2}(?:\\d{2})?",xx:"[+-]\\d{4}",xxx:"[+-]\\d{2}:\\d{2}"};function Ys(){return Hs}var dn;function Vs(){return dn||(dn=new Set(Intl.supportedValuesOf("timeZone")),dn.add("UTC")),dn}var Ws=/^[+-]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/;function jn(e){if(Ws.test(e)||Vs().has(e))return!0;try{return R().ZonedDateTime.from({year:2026,month:1,day:1,hour:0,minute:0,second:0,timeZone:e}),!0}catch{return!1}}var Xs={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]"},js="Q[1-4]",Gn=new Set(["do","ww","RRRR","D","DD","DDD","LLLL","LLL","cccc","ccc","GGGG","G","zzzz","z"]),Gs="-?\\d{4}",Bs="-?\\d{4,}",qs="-?\\d+",Bn=new Set(["yyyy","yy","y","MM","M","dd","d","HH","H","hh","h","mm","m","ss","s","SSSSSSSSS","SSSSSSSS","SSSSSSS","SSSSSS","SSSSS","SSSS","SSS","SS","S"]),er=new Set(["y"]);function fn(e,n,t){if(e==="yyyy")return t!==void 0&&Bn.has(t)?Gs:Bs;if(e==="y")return qs;let r=Xs[e];if(r)return r;if(e==="QQQ")return js;if(Gn.has(e))throw new O({token:e,message:`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=be(n);switch(e){case"MMMM":return Ke(o.monthLong);case"MMM":return Ke(o.monthShort);case"EEEE":return Ke(o.weekdayLong);case"EEE":return Ke(o.weekdayShort);case"a":return Ke(o.dayPeriod,!0);case"zzz":return Ys();case"X":case"XX":case"XXX":case"x":case"xx":case"xxx":return Zs[e];default:throw new O({token:e,message:`temporal-fmt: unknown token "${e}"`})}}var pn=new Set(["M","d","H","h","m","s"]),Ks={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 qn(e,n){let t=new Map;function r(o,a){let s=`${o}:${a}`,u=t.get(s);if(u)return u;if(o===n.length){let c=a===e.length?[[]]:[];return t.set(s,c),c}let i=n[o],m=Ks[i];/* c8 ignore start @preserve -- defensive guard, not reachable through
50
50
  the public API. enumerateValidSplits's only caller (parse.ts, both
51
51
  call sites) passes run.tokens straight from
52
52
  pattern.ambiguousRuns, which parsePattern.ts only ever populates
53
53
  with tokens already checked against UNPADDED_NUMERIC_TOKENS — the
54
54
  exact same key set as UNPADDED_NUMERIC_RANGES. There's no path
55
55
  where a token reaches here without having already passed that
56
- check. */if(!m)throw new Error(`temporal-fmt: internal error \u2014 "${i}" is not an unpadded numeric token`);/* c8 ignore stop @preserve */let l=[];for(let{digits:c,min:p,max:d}of m){if(a+c>e.length)continue;let f=e.slice(a,a+c);if(c===2&&f[0]==="0")continue;let h=Number(f);if(!(h<p||h>d)){for(let w of r(o+1,a+c))if(l.push([h,...w]),l.length===2)break;if(l.length===2)break}}return t.set(s,l),l}return r(0,0)}function qs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var er=12;function Ks(e){return Math.ceil(Math.log2(Math.max(e,1)))}function qn(e){return e===void 0?!1:e.kind==="literal"?/^[0-9]/.test(e.value):Gn.has(e.value)}function nr(e,n){let t=[],r=[],o="",a=0,s=0,u={names:[],tokens:[]},i=m=>{if(u.tokens.length===1){let l=u.names[0],c=u.tokens[0];o+=`(?<${l}>${hn(c,n)})`,qn(m)&&(s+=1)}else if(u.tokens.length>=2){let l=`r${a++}`,c=u.tokens.length;o+=`(?<${l}>\\d{${c},${c*2}})`,r.push({groupName:l,groupNames:u.names,tokens:u.tokens}),qn(m)&&(s+=Ks(c+1))}u={names:[],tokens:[]}};for(let[m,l]of e.entries()){if(l.kind==="literal"){i(l),o+=qs(l.value);continue}if(gn.has(l.value)){let f=`g${a++}`;t.push({name:f,token:l.value}),u.names.push(f),u.tokens.push(l.value);continue}i(l);let c=`g${a++}`;t.push({name:c,token:l.value});let p=e[m+1],d=p?.kind==="token"?p.value:void 0;l.value==="yyyy"&&d===void 0&&qn(p)?o+=`(?<${c}>${hn(l.value,n,"M")})`:o+=`(?<${c}>${hn(l.value,n,d)})`}if(i(void 0),s>er)throw new y({reason:`format string has too many variable-width numeric tokens glued to digit-consuming neighbors (ambiguity score ${s} > ${er}). This shape makes the regex engine backtrack exponentially on near-miss input. Add a non-digit separator between these tokens (e.g. "-" or " ") or use their padded forms (MM/dd/HH/mm/ss).`});return{regex:new RegExp(`^(?:${o})$`,"ud"),groups:t,ambiguousRuns:r}}var Ne=new Map,Qs=500;Bt(()=>{Ne.clear()});function Qn(e,n){let t=JSON.stringify([q(n),e]),r=Ne.get(t);if(r)return r;if(Ne.size>=Qs){let o=Ne.keys().next().value;o!==void 0&&Ne.delete(o)}return r=nr(he(e),n),Ne.set(t,r),r}var Pe=new Map,Js=500;function ei(e){zn(e);let n=q(e);if(Pe.has(n))return Pe.get(n);if(Pe.size>=Js){let s=Pe.keys().next().value;s!==void 0&&Pe.delete(s)}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 s=new Intl.DateTimeFormat(n).resolvedOptions().calendar;t=s==="gregory"?void 0:s}return Pe.set(n,t),t}function ni(e,n){if(e==="Z"){/* c8 ignore start @preserve -- unreachable: lowercase tokens' regex
56
+ check. */if(!m)throw new Error(`temporal-fmt: internal error \u2014 "${i}" is not an unpadded numeric token`);/* c8 ignore stop @preserve */let l=[];for(let{digits:c,min:p,max:d}of m){if(a+c>e.length)continue;let f=e.slice(a,a+c);if(c===2&&f[0]==="0")continue;let h=Number(f);if(!(h<p||h>d)){for(let w of r(o+1,a+c))if(l.push([h,...w]),l.length===2)break;if(l.length===2)break}}return t.set(s,l),l}return r(0,0)}function Qs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var nr=12;function Js(e){return Math.ceil(Math.log2(Math.max(e,1)))}function hn(e){return e===void 0?!1:e.kind==="literal"?/^[0-9]/.test(e.value):Bn.has(e.value)}function tr(e,n){let t=[],r=[],o="",a=0,s=0,u={names:[],tokens:[]},i=m=>{if(u.tokens.length===1){let l=u.names[0],c=u.tokens[0];o+=`(?<${l}>${fn(c,n)})`,hn(m)&&(s+=1)}else if(u.tokens.length>=2){let l=`r${a++}`,c=u.tokens.length;o+=`(?<${l}>\\d{${c},${c*2}})`,r.push({groupName:l,groupNames:u.names,tokens:u.tokens}),hn(m)&&(s+=Js(c+1))}u={names:[],tokens:[]}};for(let[m,l]of e.entries()){if(l.kind==="literal"){i(l),o+=Qs(l.value);continue}if(pn.has(l.value)){let f=`g${a++}`;t.push({name:f,token:l.value}),u.names.push(f),u.tokens.push(l.value);continue}i(l);let c=`g${a++}`;t.push({name:c,token:l.value});let p=e[m+1],d=p?.kind==="token"?p.value:void 0;if(er.has(l.value)&&hn(p))throw new y({reason:`token "${l.value}" has no fixed width \u2014 it can't be placed directly next to another digit-reading token or a literal that starts with a digit, since there's no way to tell where "${l.value}" ends and the next field begins. Add a non-digit separator (e.g. "-" or " ") after it.`});l.value==="yyyy"&&d===void 0&&hn(p)?o+=`(?<${c}>${fn(l.value,n,"M")})`:o+=`(?<${c}>${fn(l.value,n,d)})`}if(i(void 0),s>nr)throw new y({reason:`format string has too many variable-width numeric tokens glued to digit-consuming neighbors (ambiguity score ${s} > ${nr}). This shape makes the regex engine backtrack exponentially on near-miss input. Add a non-digit separator between these tokens (e.g. "-" or " ") or use their padded forms (MM/dd/HH/mm/ss).`});return{regex:new RegExp(`^(?:${o})$`,"ud"),groups:t,ambiguousRuns:r}}var Ne=new Map,ei=500;Bt(()=>{Ne.clear()});function Qn(e,n){let t=JSON.stringify([q(n),e]),r=Ne.get(t);if(r)return r;if(Ne.size>=ei){let o=Ne.keys().next().value;o!==void 0&&Ne.delete(o)}return r=tr(fe(e),n),Ne.set(t,r),r}var Pe=new Map,ni=500;function ti(e){Un(e);let n=q(e);if(Pe.has(n))return Pe.get(n);if(Pe.size>=ni){let s=Pe.keys().next().value;s!==void 0&&Pe.delete(s)}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 s=new Intl.DateTimeFormat(n).resolvedOptions().calendar;t=s==="gregory"?void 0:s}return Pe.set(n,t),t}function ri(e,n){if(e==="Z"){/* c8 ignore start @preserve -- unreachable: lowercase tokens' regex
57
57
  (OFFSET_SHAPES in pattern.ts) has no "Z" alternative at all, so
58
58
  raw === 'Z' can only ever be reached when token is one of the
59
59
  uppercase variants (X/XX/XXX). A lowercase token can't even
@@ -74,19 +74,19 @@
74
74
  with a colon at index 2 (see OFFSET_SHAPES in pattern.ts) — no
75
75
  shape falls outside those three cases, so this else arm can't be
76
76
  taken through parse(). Kept as an exhaustiveness fallback so
77
- hoursStr/minutesStr are assigned on every path TypeScript can see. */}else throw new Error(`temporal-fmt: offset "${e}" doesn't match the shape token "${n}" accepts.`);/* c8 ignore stop @preserve */let s=Number(o),u=Number(a);if(s>14)throw new B({actual:e,message:`temporal-fmt: offset hours ${s} in "${e}" out of range (max 14 \u2014 Kiritimati, Line Islands is +14:00).`});if(u>59)throw new B({actual:e,message:`temporal-fmt: offset minutes ${u} in "${e}" out of range (max 59).`});if(t==="+"&&s===14&&u!==0)throw new B({actual:e,message:`temporal-fmt: offset "${e}" exceeds the maximum supported UTC offset of +14:00.`});if(t==="-"&&s===12&&u!==0)throw new B({actual:e,message:`temporal-fmt: offset "${e}" exceeds the maximum supported negative UTC offset of -12:00.`});return`${t}${o}:${a}`}function F(e,n,t){e[n]=t}function ti(e,n,t,r,o){let a=de(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 s=Number(t.padEnd(9,"0"));F(e,"millisecond",Math.floor(s/1e6)),F(e,"microsecond",Math.floor(s/1e3)%1e3),F(e,"nanosecond",s%1e3);break}case"a":{let s=a.dayPeriod.findIndex(u=>u.toLowerCase()===t.toLowerCase());/* c8 ignore start @preserve -- unreachable: the 'a' token's regex
77
+ hoursStr/minutesStr are assigned on every path TypeScript can see. */}else throw new Error(`temporal-fmt: offset "${e}" doesn't match the shape token "${n}" accepts.`);/* c8 ignore stop @preserve */let s=Number(o),u=Number(a);if(s>14)throw new B({actual:e,message:`temporal-fmt: offset hours ${s} in "${e}" out of range (max 14 \u2014 Kiritimati, Line Islands is +14:00).`});if(u>59)throw new B({actual:e,message:`temporal-fmt: offset minutes ${u} in "${e}" out of range (max 59).`});if(t==="+"&&s===14&&u!==0)throw new B({actual:e,message:`temporal-fmt: offset "${e}" exceeds the maximum supported UTC offset of +14:00.`});if(t==="-"&&s===12&&u!==0)throw new B({actual:e,message:`temporal-fmt: offset "${e}" exceeds the maximum supported negative UTC offset of -12:00.`});return`${t}${o}:${a}`}function F(e,n,t){e[n]=t}function oi(e,n,t,r,o){let a=be(r);switch(n){case"yyyy":case"y":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 s=Number(t.padEnd(9,"0"));F(e,"millisecond",Math.floor(s/1e6)),F(e,"microsecond",Math.floor(s/1e3)%1e3),F(e,"nanosecond",s%1e3);break}case"a":{let s=a.dayPeriod.findIndex(u=>u.toLowerCase()===t.toLowerCase());/* c8 ignore start @preserve -- unreachable: the 'a' token's regex
78
78
  fragment (pattern.ts's alternation() over vocab.dayPeriod) can
79
79
  only ever capture a case-insensitive match of one of
80
80
  vocab.dayPeriod's own entries. Both the regex and this lookup
81
81
  derive their vocab from the same `locale` via getLocaleVocab(),
82
- so periodIndex can't come back negative through parse(). */if(s<0)throw new Error(`temporal-fmt: unknown day period "${t}" for locale "${r}".`);/* c8 ignore stop @preserve */F(e,"dayPeriodRaw",t),F(e,"isPM",s===1);break}case"zzz":F(e,"timeZoneId",t);break;case"X":case"XX":case"XXX":case"x":case"xx":case"xxx":F(e,"offsetString",ni(t,n));break;case"Q":F(e,"quarter",Number(t));break;case"QQQ":F(e,"quarter",Number(t.slice(1)));break}}function tr(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 ri(e){if(e.year!==void 0&&e.twoDigitYear!==void 0)throw new y({message:'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 oi(e,n,t){if(e.hour!==void 0&&e.hour12!==void 0)throw new y({format:n,message:`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=de(t),o=e.hour<12?r.dayPeriod[0]:r.dayPeriod[1];if(e.dayPeriodRaw.toLowerCase()!==o?.toLowerCase())throw new y({format:n,message:`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 y({format:n,message:`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 ge(e,n,t={}){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});if(n.length>1e5)throw new y({input:n,message:`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${n.length}).`});t.parseNumberingSystem&&(n=Ge(n,t));let r=t.locale??P,o=ei(r),a=Qn(e,r),s=a.regex.exec(n);if(!s)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(a.groups.length===0)throw new C({format:e,reason:`format string "${e}" has no tokens \u2014 nothing to parse into a value.`,message:`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`});for(let{name:_,token:L}of a.groups)if(L==="zzz"&&!jn(s.groups[_]))throw new ke({input:n,format:e,actual:s.groups[_],reason:"not a recognized IANA time zone identifier"});let u=new Map;for(let _ of a.ambiguousRuns){let L=s.groups[_.groupName],G=Bn(L,_.tokens);if(G.length===0)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(G.length>1){if(!t.lenient)throw new me({input:n,format:e,message:`temporal-fmt: "${L}" in format string "${e}" is ambiguous \u2014 ${G.length} different ways to read tokens "${_.tokens.join("")}" (with no separator between them) are all individually valid (e.g. ${JSON.stringify(G[0])} vs ${JSON.stringify(G[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.`});let _e=tr(G,_.tokens);_.groupNames.forEach((An,ks)=>u.set(An,String(_e[ks])))}else _.groupNames.forEach((_e,An)=>u.set(_e,String(G[0][An])))}let i={};for(let{name:_,token:L}of a.groups){let G=u.get(_)??s.groups[_];ti(i,L,G,r,e)}let m=ri(i),l=oi(i,e,r),{month:c,day:p,minute:d,second:f,millisecond:h,microsecond:w,nanosecond:M,timeZoneId:b,offsetString:x,weekdayExpected:k,weekdayRaw:N,quarter:re}=i,Fe=m!==void 0||c!==void 0||p!==void 0,Z=m!==void 0&&c!==void 0&&p!==void 0;if(Fe&&!Z)throw new z({format:e,message:`temporal-fmt: format string "${e}" has an incomplete date \u2014 year, month, and day tokens must all be present together.`});let un=l!==void 0||d!==void 0||f!==void 0||h!==void 0;if(b!==void 0&&!(Z&&un))throw new y({format:e,message:`temporal-fmt: format string "${e}" has a "zzz" token but needs a full date and time to build a ZonedDateTime.`});if(x!==void 0&&!(Z&&un))throw new y({format:e,message:`temporal-fmt: format string "${e}" has an offset token (X/XX/XXX/x/xx/xxx) but needs a full date and time to build a ZonedDateTime.`});if(k!==void 0&&!Z)throw new y({format:e,message:`temporal-fmt: format string "${e}" has a weekday token ("EEEE"/"EEE") but needs a full date to validate it against.`});if(!Z&&!un)throw new y({format:e,message:`temporal-fmt: format string "${e}" has no date or time tokens to parse.`});let Ue=R(),be={hour:l??0,minute:d??0,second:f??0,millisecond:h??0,microsecond:w??0,nanosecond:M??0},ln=o?{calendar:o}:{},mn={overflow:"reject"},le;try{if(b!==void 0){let _={overflow:"reject",offset:"prefer"};if(le=Ue.ZonedDateTime.from({year:m,month:c,day:p,...be,...ln,timeZone:b,...x!==void 0?{offset:x}:{}},_),x!==void 0){let L=le;if(L.hour!==be.hour||L.minute!==be.minute||L.second!==be.second)throw new z({input:n,format:e,message:`"${b}" has no such wall-clock time on this date \u2014 it falls in a DST gap, not an ambiguous or valid instant.`});let _e=L.offset;if(_e!==x)throw new C({input:n,format:e,message:`has both a "zzz" zone (${b}) and an offset token (${x}), but the zone's actual offset at this date/time is ${_e}, not ${x}.`})}}else x!==void 0?le=Ue.ZonedDateTime.from({year:m,month:c,day:p,...be,...ln,timeZone:x},mn):Z&&un?le=Ue.PlainDateTime.from({year:m,month:c,day:p,...be,...ln},mn):Z?le=Ue.PlainDate.from({year:m,month:c,day:p,...ln},mn):le=Ue.PlainTime.from(be,mn)}catch(_){throw new z({input:n,format:e,message:`temporal-fmt: "${n}" doesn't describe a valid date/time for format "${e}": ${_.message}`})}if(k!==void 0){let _=le.dayOfWeek;if(_!==k){let L=de(r);throw new z({input:n,format:e,message:`temporal-fmt: "${N}" doesn't match the actual weekday (${L.weekdayLong[_-1]}) for the parsed date.`})}}if(re!==void 0&&c!==void 0){let _=Math.ceil(c/3);if(re!==_)throw new z({format:e,message:`temporal-fmt: format string "${e}" contains a quarter token (Q/QQQ) whose value (Q${re}) disagrees with the parsed month's actual quarter \u2014 month ${c} is in Q${_}.`})}return le}function Jn(e,n,t={}){try{return{ok:!0,value:ge(e,n,t)}}catch(r){/* c8 ignore start @preserve */return r instanceof I?{ok:!1,error:r}:{ok:!1,error:Vt(r,{input:n,format:e})}}/* c8 ignore stop @preserve */}function et(e,n,t={}){try{return ge(e,n,t)}catch{return}}function nt(e,n,t={}){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});if(n.length>1e5)throw new y({input:n,message:`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${n.length}).`});t.parseNumberingSystem&&(n=Ge(n,t));let r=t.locale??P,o=Qn(e,r),a=o.regex.exec(n);if(!a)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(o.groups.length===0)throw new C({format:e,reason:`format string "${e}" has no tokens \u2014 nothing to parse into a value.`,message:`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`});for(let{name:c,token:p}of o.groups)if(p==="zzz"&&!jn(a.groups[c]))throw new ke({input:n,format:e,actual:a.groups[c],reason:"not a recognized IANA time zone identifier"});let s=new Map;for(let c of o.ambiguousRuns){let p=a.groups[c.groupName],d=Bn(p,c.tokens);if(d.length===0)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(d.length>1){if(!t.lenient)throw new me({input:n,format:e,message:`temporal-fmt: "${p}" in format string "${e}" is ambiguous \u2014 ${d.length} different ways to read tokens "${c.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.`});let f=tr(d,c.tokens);c.groupNames.forEach((h,w)=>s.set(h,String(f[w])))}else c.groupNames.forEach((f,h)=>s.set(f,String(d[0][h])))}let u=[],m=a.indices?.groups,l=0;for(let{name:c,token:p}of o.groups){let d=s.get(c)??a.groups[c],f=!s.has(c)&&m?.[c],h=f?f[0]:(a.index??0)+l;u.push({token:p,raw:d,position:h}),l+=d.length}return u}function rr(e,n={}){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});let t=n.locale??P,r=Qn(e,t);return{formatStr:e,pattern:r,parse(o,a={}){return ge(e,o,{locale:t,...a})},safeParse(o,a={}){return Jn(e,o,{locale:t,...a})},tryParse(o,a={}){return et(e,o,{locale:t,...a})},parseToParts(o,a={}){return nt(e,o,{locale:t,...a})}}}var or={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"}},ai=Object.keys(or).flatMap(e=>[e+e+e,e+e,e]).sort((e,n)=>n.length-e.length);function si(e){let n=[],t=0;for(;t<e.length;){let r=e[t];if(r==="'"){if(e[t+1]==="'"){tt(n,"'"),t+=2;continue}let a=t+1,s="",u=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){s+="'",a+=2;continue}u=!0,a+=1;break}s+=e[a],a+=1}if(!u)throw new Error(`temporal-fmt: unterminated quote in duration format string "${e}"`);tt(n,s),t=a;continue}let o=ai.find(a=>e.startsWith(a,t));if(o){let a=o[0],s=o.length===1?"numeric":o.length===2?"short":"long";n.push({kind:"token",value:o,unit:a,form:s}),t+=o.length;continue}tt(n,r),t+=1}return n}function tt(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}function ii(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 Je=new Map,ui=200;function li(e,n,t){let r=`${q(e)}|${n}|${t}`,o=Je.get(r);if(o)return o;if(Je.size>=ui){let s=Je.keys().next().value;s!==void 0&&Je.delete(s)}let a;try{a=new Intl.NumberFormat(U(e),{style:"unit",unit:n,unitDisplay:t})}catch(s){throw new D({actual:e,reason:s.message})}return Je.set(r,a),a}function ar(e,n,t={}){return rt(e,n,t).map(r=>r.value).join("")}function rt(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,s=si(n),u=[];for(let i of s){if(i.kind==="literal"){u.push({kind:"literal",value:i.value});continue}let m=or[i.unit];if(!m)throw new Error(`temporal-fmt: unknown duration token "${i.value}"`);let l=ii(e,m.field);if(l===0&&!r){u.push({kind:"token",value:"",token:i.value});continue}if(i.form==="numeric"){u.push({kind:"token",value:String(l),token:i.value});continue}if(a){let c=i.form==="short"?"short":"long",p=li(o,m.intlUnit,c);u.push({kind:"token",value:p.format(l),token:i.value});continue}i.form==="short"?u.push({kind:"token",value:l+(l===1||l===-1?m.shortSingular:m.shortPlural),token:i.value}):u.push({kind:"token",value:l+" "+(l===1||l===-1?m.longSingular:m.longPlural),token:i.value})}return u}function sr(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 ot=2e3,yn=1e3,wn=60*yn,bn=60*wn,ye=24*bn;function mi(e,n,t){let r=0;if(e>=ot)for(let o=ot;o<e;o++)r+=oe(o)?366:365;else for(let o=e;o<ot;o++)r-=oe(o)?366:365;return r+=ae(e,n,t)-1,r}function ir(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=mi(e.year,e.month,e.day),t=e.hour??0,r=e.minute??0,o=e.second??0,a=e.millisecond??0;return n*ye+t*bn+r*wn+o*yn+a}var ci={seconds:60,minutes:60,hours:24,days:30,months:365};function di(e){let n={...ci,...e};for(let u of Object.keys(n)){let i=n[u];if(typeof i!="number"||!Number.isFinite(i)||i<=0)throw new Error(`temporal-fmt: formatDistance cutoff "${u}" must be a positive finite number (got ${String(i)}).`)}let t=n.seconds*yn,r=n.minutes*wn,o=n.hours*bn,a=n.days*ye,s=n.months*ye;if(!(t<=r&&r<=o&&o<=a&&a<=s))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:s,unit:"month"}]}var en=new Map,fi=100;function pi(e,n){let t=`${hi(e)}|${n}`,r=en.get(t);if(r)return r;if(en.size>=fi){let o=en.keys().next().value;o!==void 0&&en.delete(o)}try{r=new Intl.RelativeTimeFormat(U(e),{numeric:n})}catch(o){throw new D({actual:e,reason:o.message})}return en.set(t,r),r}function hi(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function at(e,n,t={}){let r=sr(e,"date1"),o=sr(n,"date2"),a=ir(r)-ir(o),s=Math.abs(a),u=di(t.cutoffs),i="year";for(let{maxMs:f,unit:h}of u)if(s<f){i=h;break}let m=gi(i),l=Math.round(a/m),c=t.numeric??"auto",p=t.locale??P;return pi(p,c).format(l,i)}function ur(e,n={}){let t=new Date,r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()};return at(e,r,n)}function gi(e){switch(e){case"second":return yn;case"minute":return wn;case"hour":return bn;case"day":return ye;case"week":return 7*ye;case"month":return 30*ye;case"quarter":return 91*ye;case"year":return 365*ye;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var lr=100,Ce=[];function mr(e){if(typeof e.language!="string"||e.language.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires a non-empty language string.");if(!Array.isArray(e.matchers)||e.matchers.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires at least one matcher.");let n=Ce.findIndex(t=>t.language===e.language);if(n>=0)Ce[n]=e;else{if(Ce.length>=lr)throw new RangeError(`temporal-fmt: registerRelativeGrammar reached the ${lr}-grammar limit.`);Ce.push(e)}}function cr(e,n,t){for(let r of Ce)if(r.language===e)for(let o of r.matchers){let a=o(n);if(a===null)continue;let s=R();if(a.resolve){let u=a.resolve(t);return s.PlainDate.from(u,{overflow:"reject"})}return s.PlainDate.from({year:a.year??t.year,month:a.month??t.month,day:a.day??t.day},{overflow:"reject"})}return null}function dr(){return Ce.map(e=>e.language)}function X(e){return e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function yi(e,n){/* c8 ignore start @preserve -- unreachable through the only call
82
+ so periodIndex can't come back negative through parse(). */if(s<0)throw new Error(`temporal-fmt: unknown day period "${t}" for locale "${r}".`);/* c8 ignore stop @preserve */F(e,"dayPeriodRaw",t),F(e,"isPM",s===1);break}case"zzz":F(e,"timeZoneId",t);break;case"X":case"XX":case"XXX":case"x":case"xx":case"xxx":F(e,"offsetString",ri(t,n));break;case"Q":F(e,"quarter",Number(t));break;case"QQQ":F(e,"quarter",Number(t.slice(1)));break}}function rr(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 ai(e){if(e.year!==void 0&&e.twoDigitYear!==void 0)throw new y({message:'temporal-fmt: format string mixes a full-year token ("yyyy"/"y") with the two-digit "yy" token.'});if(e.year!==void 0)return e.year;if(e.twoDigitYear!==void 0)return e.twoDigitYear<=68?2e3+e.twoDigitYear:1900+e.twoDigitYear}function si(e,n,t){if(e.hour!==void 0&&e.hour12!==void 0)throw new y({format:n,message:`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)throw new y({format:n,message:`temporal-fmt: format string "${n}" mixes a 24-hour token ("HH"/"H") with a day-period token ("a"). Both describe the same field; use one or the other, not both.`});return e.hour}if(e.hour12!==void 0){if(e.isPM===void 0)throw new y({format:n,message:`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 pe(e,n,t={}){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});if(n.length>1e5)throw new y({input:n,message:`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${n.length}).`});t.parseNumberingSystem&&(n=je(n,t));let r=t.locale??P,o=ti(r),a=Qn(e,r),s=a.regex.exec(n);if(!s)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(a.groups.length===0)throw new C({format:e,reason:`format string "${e}" has no tokens \u2014 nothing to parse into a value.`,message:`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`});for(let{name:_,token:L}of a.groups)if(L==="zzz"&&!jn(s.groups[_]))throw new we({input:n,format:e,actual:s.groups[_],reason:"not a recognized IANA time zone identifier"});let u=new Map;for(let _ of a.ambiguousRuns){let L=s.groups[_.groupName],G=qn(L,_.tokens);if(G.length===0)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(G.length>1){if(!t.lenient)throw new le({input:n,format:e,message:`temporal-fmt: "${L}" in format string "${e}" is ambiguous \u2014 ${G.length} different ways to read tokens "${_.tokens.join("")}" (with no separator between them) are all individually valid (e.g. ${JSON.stringify(G[0])} vs ${JSON.stringify(G[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.`});let _e=rr(G,_.tokens);_.groupNames.forEach((Ln,Ts)=>u.set(Ln,String(_e[Ts])))}else _.groupNames.forEach((_e,Ln)=>u.set(_e,String(G[0][Ln])))}let i={};for(let{name:_,token:L}of a.groups){let G=u.get(_)??s.groups[_];oi(i,L,G,r,e)}let m=ai(i),l=si(i,e,r),{month:c,day:p,minute:d,second:f,millisecond:h,microsecond:w,nanosecond:M,timeZoneId:b,offsetString:E,weekdayExpected:k,weekdayRaw:N,quarter:re}=i,Ee=m!==void 0||c!==void 0||p!==void 0,Z=m!==void 0&&c!==void 0&&p!==void 0;if(Ee&&!Z)throw new z({format:e,message:`temporal-fmt: format string "${e}" has an incomplete date \u2014 year, month, and day tokens must all be present together.`});let sn=l!==void 0||d!==void 0||f!==void 0||h!==void 0;if(b!==void 0&&!(Z&&sn))throw new y({format:e,message:`temporal-fmt: format string "${e}" has a "zzz" token but needs a full date and time to build a ZonedDateTime.`});if(E!==void 0&&!(Z&&sn))throw new y({format:e,message:`temporal-fmt: format string "${e}" has an offset token (X/XX/XXX/x/xx/xxx) but needs a full date and time to build a ZonedDateTime.`});if(k!==void 0&&!Z)throw new y({format:e,message:`temporal-fmt: format string "${e}" has a weekday token ("EEEE"/"EEE") but needs a full date to validate it against.`});if(!Z&&!sn)throw new y({format:e,message:`temporal-fmt: format string "${e}" has no date or time tokens to parse.`});let un=R(),Fe={hour:l??0,minute:d??0,second:f??0,millisecond:h??0,microsecond:w??0,nanosecond:M??0},Cn=o?{calendar:o}:{},An={overflow:"reject"},ye;try{if(b!==void 0){let _={overflow:"reject",offset:"prefer"};if(ye=un.ZonedDateTime.from({year:m,month:c,day:p,...Fe,...Cn,timeZone:b,...E!==void 0?{offset:E}:{}},_),E!==void 0){let L=ye;if(L.hour!==Fe.hour||L.minute!==Fe.minute||L.second!==Fe.second)throw new z({input:n,format:e,message:`"${b}" has no such wall-clock time on this date \u2014 it falls in a DST gap, not an ambiguous or valid instant.`});let _e=L.offset;if(_e!==E)throw new C({input:n,format:e,message:`has both a "zzz" zone (${b}) and an offset token (${E}), but the zone's actual offset at this date/time is ${_e}, not ${E}.`})}}else{if(E!==void 0)throw new C({input:n,format:e,message:`format string "${e}" has an offset token but no "zzz" zone token. An offset does not identify a time zone by itself \u2014 add "zzz" to the pattern, or parse into a PlainDateTime/PlainDate/PlainTime if a zone isn't needed.`});Z&&sn?ye=un.PlainDateTime.from({year:m,month:c,day:p,...Fe,...Cn},An):Z?ye=un.PlainDate.from({year:m,month:c,day:p,...Cn},An):ye=un.PlainTime.from(Fe,An)}}catch(_){throw new z({input:n,format:e,message:`temporal-fmt: "${n}" doesn't describe a valid date/time for format "${e}": ${_.message}`})}if(k!==void 0){let _=ye.dayOfWeek;if(_!==k){let L=be(r);throw new z({input:n,format:e,message:`temporal-fmt: "${N}" doesn't match the actual weekday (${L.weekdayLong[_-1]}) for the parsed date.`})}}if(re!==void 0&&c!==void 0){let _=Math.ceil(c/3);if(re!==_)throw new z({format:e,message:`temporal-fmt: format string "${e}" contains a quarter token (Q/QQQ) whose value (Q${re}) disagrees with the parsed month's actual quarter \u2014 month ${c} is in Q${_}.`})}return ye}function Jn(e,n,t={}){try{return{ok:!0,value:pe(e,n,t)}}catch(r){/* c8 ignore start @preserve */return r instanceof I?{ok:!1,error:r}:{ok:!1,error:Vt(r,{input:n,format:e})}}/* c8 ignore stop @preserve */}function et(e,n,t={}){try{return pe(e,n,t)}catch{return}}function nt(e,n,t={}){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});if(n.length>1e5)throw new y({input:n,message:`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${n.length}).`});t.parseNumberingSystem&&(n=je(n,t));let r=t.locale??P,o=Qn(e,r),a=o.regex.exec(n);if(!a)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(o.groups.length===0)throw new C({format:e,reason:`format string "${e}" has no tokens \u2014 nothing to parse into a value.`,message:`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`});for(let{name:c,token:p}of o.groups)if(p==="zzz"&&!jn(a.groups[c]))throw new we({input:n,format:e,actual:a.groups[c],reason:"not a recognized IANA time zone identifier"});let s=new Map;for(let c of o.ambiguousRuns){let p=a.groups[c.groupName],d=qn(p,c.tokens);if(d.length===0)throw new C({input:n,format:e,reason:"no valid pattern matches the format string and input shape",message:"temporal-fmt: no valid pattern matches the format string and input shape"});if(d.length>1){if(!t.lenient)throw new le({input:n,format:e,message:`temporal-fmt: "${p}" in format string "${e}" is ambiguous \u2014 ${d.length} different ways to read tokens "${c.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.`});let f=rr(d,c.tokens);c.groupNames.forEach((h,w)=>s.set(h,String(f[w])))}else c.groupNames.forEach((f,h)=>s.set(f,String(d[0][h])))}let u=[],m=a.indices?.groups,l=0;for(let{name:c,token:p}of o.groups){let d=s.get(c)??a.groups[c],f=!s.has(c)&&m?.[c],h=f?f[0]:(a.index??0)+l;u.push({token:p,raw:d,position:h}),l+=d.length}return u}function or(e,n={}){if(e.length>1e3)throw new y({format:e,message:`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`});let t=n.locale??P,r=Qn(e,t);return{formatStr:e,pattern:r,parse(o,a={}){return pe(e,o,{locale:t,...a})},safeParse(o,a={}){return Jn(e,o,{locale:t,...a})},tryParse(o,a={}){return et(e,o,{locale:t,...a})},parseToParts(o,a={}){return nt(e,o,{locale:t,...a})}}}var ar={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"}},ii=Object.keys(ar).flatMap(e=>[e+e+e,e+e,e]).sort((e,n)=>n.length-e.length);function ui(e){let n=[],t=0;for(;t<e.length;){let r=e[t];if(r==="'"){if(e[t+1]==="'"){tt(n,"'"),t+=2;continue}let a=t+1,s="",u=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){s+="'",a+=2;continue}u=!0,a+=1;break}s+=e[a],a+=1}if(!u)throw new Error(`temporal-fmt: unterminated quote in duration format string "${e}"`);tt(n,s),t=a;continue}let o=ii.find(a=>e.startsWith(a,t));if(o){let a=o[0],s=o.length===1?"numeric":o.length===2?"short":"long";n.push({kind:"token",value:o,unit:a,form:s}),t+=o.length;continue}tt(n,r),t+=1}return n}function tt(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}function li(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 Qe=new Map,mi=200;function ci(e,n,t){let r=`${q(e)}|${n}|${t}`,o=Qe.get(r);if(o)return o;if(Qe.size>=mi){let s=Qe.keys().next().value;s!==void 0&&Qe.delete(s)}let a;try{a=new Intl.NumberFormat(U(e),{style:"unit",unit:n,unitDisplay:t})}catch(s){throw new D({actual:e,reason:s.message})}return Qe.set(r,a),a}function sr(e,n,t={}){return rt(e,n,t).map(r=>r.value).join("")}function rt(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,s=ui(n),u=[];for(let i of s){if(i.kind==="literal"){u.push({kind:"literal",value:i.value});continue}let m=ar[i.unit];if(!m)throw new Error(`temporal-fmt: unknown duration token "${i.value}"`);let l=li(e,m.field);if(l===0&&!r){u.push({kind:"token",value:"",token:i.value});continue}if(i.form==="numeric"){u.push({kind:"token",value:String(l),token:i.value});continue}if(a){let c=i.form==="short"?"short":"long",p=ci(o,m.intlUnit,c);u.push({kind:"token",value:p.format(l),token:i.value});continue}i.form==="short"?u.push({kind:"token",value:l+(l===1||l===-1?m.shortSingular:m.shortPlural),token:i.value}):u.push({kind:"token",value:l+" "+(l===1||l===-1?m.longSingular:m.longPlural),token:i.value})}return u}function ir(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 ot=2e3,gn=1e3,yn=60*gn,wn=60*yn,he=24*wn;function di(e,n,t){let r=0;if(e>=ot)for(let o=ot;o<e;o++)r+=oe(o)?366:365;else for(let o=e;o<ot;o++)r-=oe(o)?366:365;return r+=ae(e,n,t)-1,r}function ur(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=di(e.year,e.month,e.day),t=e.hour??0,r=e.minute??0,o=e.second??0,a=e.millisecond??0;return n*he+t*wn+r*yn+o*gn+a}var fi={seconds:60,minutes:60,hours:24,days:30,months:365};function pi(e){let n={...fi,...e};for(let u of Object.keys(n)){let i=n[u];if(typeof i!="number"||!Number.isFinite(i)||i<=0)throw new Error(`temporal-fmt: formatDistance cutoff "${u}" must be a positive finite number (got ${String(i)}).`)}let t=n.seconds*gn,r=n.minutes*yn,o=n.hours*wn,a=n.days*he,s=n.months*he;if(!(t<=r&&r<=o&&o<=a&&a<=s))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:s,unit:"month"}]}var Je=new Map,hi=100;function gi(e,n){let t=`${yi(e)}|${n}`,r=Je.get(t);if(r)return r;if(Je.size>=hi){let o=Je.keys().next().value;o!==void 0&&Je.delete(o)}try{r=new Intl.RelativeTimeFormat(U(e),{numeric:n})}catch(o){throw new D({actual:e,reason:o.message})}return Je.set(t,r),r}function yi(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function at(e,n,t={}){let r=ir(e,"date1"),o=ir(n,"date2"),a=ur(r)-ur(o),s=Math.abs(a),u=pi(t.cutoffs),i="year";for(let{maxMs:f,unit:h}of u)if(s<f){i=h;break}let m=wi(i),l=Math.round(a/m),c=t.numeric??"auto",p=t.locale??P;return gi(p,c).format(l,i)}function lr(e,n={}){let t=new Date,r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()};return at(e,r,n)}function wi(e){switch(e){case"second":return gn;case"minute":return yn;case"hour":return wn;case"day":return he;case"week":return 7*he;case"month":return 30*he;case"quarter":return 91*he;case"year":return 365*he;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var mr=100,Ce=[];function cr(e){if(typeof e.language!="string"||e.language.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires a non-empty language string.");if(!Array.isArray(e.matchers)||e.matchers.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires at least one matcher.");let n=Ce.findIndex(t=>t.language===e.language);if(n>=0)Ce[n]=e;else{if(Ce.length>=mr)throw new RangeError(`temporal-fmt: registerRelativeGrammar reached the ${mr}-grammar limit.`);Ce.push(e)}}function dr(e,n,t){for(let r of Ce)if(r.language===e)for(let o of r.matchers){let a=o(n);if(a===null)continue;let s=R();if(a.resolve){let u=a.resolve(t);return s.PlainDate.from(u,{overflow:"reject"})}return s.PlainDate.from({year:a.year??t.year,month:a.month??t.month,day:a.day??t.day},{overflow:"reject"})}return null}function fr(){return Ce.map(e=>e.language)}function j(e){return e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function bi(e,n){/* c8 ignore start @preserve -- unreachable through the only call
83
83
  * site (fuzzyCorrectEnglish): `a` is always a word that already
84
84
  * failed the `vocabulary.includes(word)` exact-match check, so
85
85
  * a === b never holds against any `b` drawn from that same
86
86
  * vocabulary; and neither `a` (split from a non-empty normalized
87
87
  * string) nor `b` (a vocabulary entry) is ever empty. Kept as
88
88
  * general-purpose guards in case levenshtein() gets a second caller
89
- * later. */if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;/* c8 ignore stop @preserve */let t=new Array(n.length+1),r=new Array(n.length+1);for(let o=0;o<=n.length;o++)t[o]=o;for(let o=1;o<=e.length;o++){r[0]=o;for(let a=1;a<=n.length;a++){let s=e[o-1]===n[a-1]?0:1;r[a]=Math.min(t[a]+1,r[a-1]+1,t[a-1]+s)}[t,r]=[r,t]}return t[n.length]}var fr=2,Tn=4096,pr=32;function wi(){return[...lt,...mt,...ct,"today","tomorrow","yesterday","next","last","this","in","ago","day","days","week","weeks","month","months","year","years"].map(X)}var st;function bi(){return st||(st=Object.freeze(wi())),st}function ki(e){let n=bi(),t=e.split(" ");if(e.length>Tn||t.length>pr)throw new RangeError(`temporal-fmt: parseRelative fuzzy input is too large (maximum ${Tn} characters and ${pr} words).`);let r=!1,o=t.map(a=>{if(/^\d+(?:st|nd|rd|th)?$/.test(a)||n.includes(a))return a;let s,u=fr+1;for(let i of n){let m=yi(a,i);m<u&&(u=m,s=i)}return s!==void 0&&u<=fr?(r=!0,s):a});return r?o.join(" "):void 0}function De(e){if(typeof e.year!="number")throw new Error("temporal-fmt: parseRelative reference date is missing year.");return e.year}function ve(e){if(typeof e.month!="number")throw new Error("temporal-fmt: parseRelative reference date is missing month.");return e.month}function Me(e){if(typeof e.day!="number")throw new Error("temporal-fmt: parseRelative reference date is missing day.");return e.day}function Sn(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 j(e){return[...e.map(X)].sort((r,o)=>o.length-r.length).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}function Dn(e,n,t,r){return e.PlainDate.from({year:n,month:t,day:r},{overflow:"reject"})}function Y(e,n,t){return e.PlainDate.from({year:De(n),month:ve(n),day:Me(n)}).add({days:t})}function Se(e,n,t,r){let o=e.PlainDate.from({year:De(n),month:ve(n),day:Me(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 vn(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 Mn(e,n,t,r){let o=De(n),a=e.PlainDate.from({year:o,month:ve(n),day:Me(n)});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.");try{let s=e.PlainDate.from({year:o,month:t,day:r},{overflow:"reject"});return e.PlainDate.compare(s,a)>=0?s:e.PlainDate.from({year:o+1,month:t,day:r},{overflow:"reject"})}catch(s){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: ${s.message}`)}}}function xn(e,n){let t=X(e),r=n.findIndex(o=>X(o)===t);/* c8 ignore start @preserve -- unreachable: every caller passes a
89
+ * later. */if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;/* c8 ignore stop @preserve */let t=new Array(n.length+1),r=new Array(n.length+1);for(let o=0;o<=n.length;o++)t[o]=o;for(let o=1;o<=e.length;o++){r[0]=o;for(let a=1;a<=n.length;a++){let s=e[o-1]===n[a-1]?0:1;r[a]=Math.min(t[a]+1,r[a-1]+1,t[a-1]+s)}[t,r]=[r,t]}return t[n.length]}var pr=2,kn=4096,hr=32;function ki(){return[...lt,...mt,...ct,"today","tomorrow","yesterday","next","last","this","in","ago","day","days","week","weeks","month","months","year","years"].map(j)}var st;function Ti(){return st||(st=Object.freeze(ki())),st}function Si(e){let n=Ti(),t=e.split(" ");if(e.length>kn||t.length>hr)throw new RangeError(`temporal-fmt: parseRelative fuzzy input is too large (maximum ${kn} characters and ${hr} words).`);let r=!1,o=t.map(a=>{if(/^\d+(?:st|nd|rd|th)?$/.test(a)||n.includes(a))return a;let s,u=pr+1;for(let i of n){let m=bi(a,i);m<u&&(u=m,s=i)}return s!==void 0&&u<=pr?(r=!0,s):a});return r?o.join(" "):void 0}function Se(e){if(typeof e.year!="number")throw new Error("temporal-fmt: parseRelative reference date is missing year.");return e.year}function De(e){if(typeof e.month!="number")throw new Error("temporal-fmt: parseRelative reference date is missing month.");return e.month}function ve(e){if(typeof e.day!="number")throw new Error("temporal-fmt: parseRelative reference date is missing day.");return e.day}function Tn(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 X(e){return[...e.map(j)].sort((r,o)=>o.length-r.length).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}function Sn(e,n,t,r){return e.PlainDate.from({year:n,month:t,day:r},{overflow:"reject"})}function Y(e,n,t){return e.PlainDate.from({year:Se(n),month:De(n),day:ve(n)}).add({days:t})}function Te(e,n,t,r){let o=e.PlainDate.from({year:Se(n),month:De(n),day:ve(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 Dn(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 vn(e,n,t,r){let o=Se(n),a=e.PlainDate.from({year:o,month:De(n),day:ve(n)});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.");try{let s=e.PlainDate.from({year:o,month:t,day:r},{overflow:"reject"});return e.PlainDate.compare(s,a)>=0?s:e.PlainDate.from({year:o+1,month:t,day:r},{overflow:"reject"})}catch(s){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: ${s.message}`)}}}function Mn(e,n){let t=j(e),r=n.findIndex(o=>j(o)===t);/* c8 ignore start @preserve -- unreachable: every caller passes a
90
90
  * name captured by nameAlternation(names), which builds its regex
91
91
  * alternation from this same list under the same normalizeForMatch
92
92
  * transform. The regex can't match anything findIndex() wouldn't
@@ -95,20 +95,20 @@
95
95
  * the `if` itself, not just the throw inside it — c8 tracks the
96
96
  * branch outcome (was the true side ever taken) separately from the
97
97
  * statements inside, so excluding only the inner throw still leaves
98
- * the branch itself flagged as uncovered. */if(r<0)throw new Error(`temporal-fmt: parseRelative internal error \u2014 weekday "${e}" not in names list.`);/* c8 ignore stop @preserve */return r+1}function En(e,n,t=[]){let r=X(e),o=n.findIndex(s=>X(s)===r);if(o>=0)return o+1;let a=t.findIndex(s=>X(s)===r);if(a>=0)return a+1;/* c8 ignore start @preserve -- unreachable: every caller passes a name
98
+ * the branch itself flagged as uncovered. */if(r<0)throw new Error(`temporal-fmt: parseRelative internal error \u2014 weekday "${e}" not in names list.`);/* c8 ignore stop @preserve */return r+1}function xn(e,n,t=[]){let r=j(e),o=n.findIndex(s=>j(s)===r);if(o>=0)return o+1;let a=t.findIndex(s=>j(s)===r);if(a>=0)return a+1;/* c8 ignore start @preserve -- unreachable: every caller passes a name
99
99
  * captured by nameAlternation([...longNames, ...shortNames]), so the
100
100
  * regex alternation and these two findIndex() scans are built from
101
101
  * the same lists under the same normalizeForMatch transform. Kept as
102
- * a tripwire for the type checker in case that invariant ever breaks. */throw new Error(`temporal-fmt: parseRelative internal error \u2014 month "${e}" not in names list.`);/* c8 ignore stop @preserve */}var lt=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],mt=["January","February","March","April","May","June","July","August","September","October","November","December"],ct=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],nn={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)=>Dn(n.temporal,De(n.reference),ve(n.reference),Me(n.reference))},{pattern:/^tomorrow$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^yesterday$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(next|last|this)\\s+(${j(lt)})$`,"i"),resolve:(e,n)=>{let t=e[1].toLowerCase(),r=xn(e[2],lt),o=Sn(n.reference);return Y(n.temporal,n.reference,vn(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,s=/\bago\b/i.test(e[0]);if(!a&&!s)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 u=a?1:-1;return Se(n.temporal,n.reference,u*Number(r),o)}},{pattern:new RegExp(`^(${j([...mt,...ct])})\\s+(\\d{1,2})(?:st|nd|rd|th)?(?:,?\\s*(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=En(e[1],mt,ct),r=Number(e[2]);return Mn(n.temporal,n.reference,t,r)}}]},kn=["lunes","martes","mi\xE9rcoles","jueves","viernes","s\xE1bado","domingo"],hr=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],gr=["ene","feb","mar","abr","may","jun","jul","ago","sept","oct","nov","dic"],Ti={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)=>Dn(n.temporal,De(n.reference),ve(n.reference),Me(n.reference))},{pattern:/^ma[ñn]ana$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^ayer$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(?:el\\s+)?(?:(pr[o\xF3]ximo|pasado)\\s+(${j(kn)})|(${j(kn)})\\s+(pr[o\xF3]ximo|pasado)|este\\s+(${j(kn)}))$`,"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=X(t)==="proximo"?"next":t.toLowerCase()==="este"?"this":"last",a=xn(r,kn),s=Sn(n.reference);return Y(n.temporal,n.reference,vn(o,s,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[4],r=e[5],o=-1);let a=Ae(r);return Se(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=Ae(e[2]);return Se(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+(${j([...hr,...gr])})(?:\\s+de\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=En(e[2],hr,gr);return Mn(n.temporal,n.reference,r,t)}}]},it=["lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche"],yr=["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],wr=["janv.","f\xE9vr.","mars","avr.","mai","juin","juil.","ao\xFBt","sept.","oct.","nov.","d\xE9c."],Si={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)=>Dn(n.temporal,De(n.reference),ve(n.reference),Me(n.reference))},{pattern:/^demain$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^hier$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(?:(${j(it)})\\s+(prochain|dernier)|ce\\s+(${j(it)}))$`,"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=xn(r,it),a=Sn(n.reference);return Y(n.temporal,n.reference,vn(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=Ae(e[2]);return Se(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=Ae(e[2]);return Se(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+(${j([...yr,...wr])})(?:\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=En(e[2],yr,wr);return Mn(n.temporal,n.reference,r,t)}}]},br=["Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"],kr=["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],Tr=["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],Di={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)=>Dn(n.temporal,De(n.reference),ve(n.reference),Me(n.reference))},{pattern:/^morgen$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^gestern$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(n(?:ae|a|\xE4)chsten|letzten|diesen)\\s+(${j(br)})$`,"i"),resolve:(e,n)=>{let t=X(e[1]),r=t==="nachsten"||t==="naechsten"?"next":t==="diesen"?"this":"last",o=xn(e[2],br),a=Sn(n.reference);return Y(n.temporal,n.reference,vn(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=Ae(e[2]);return Se(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=Ae(e[2]);return Se(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+(${j([...kr,...Tr,"Maerz","Maer"])})(?:\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=En(e[2],kr,Tr);return Mn(n.temporal,n.reference,r,t)}}]},vi={en:nn,es:Ti,fr:Si,de:Di};function Mi(e){if(!e)return nn;try{let t=new Intl.Locale(e.replace(/_/g,"-")).language.toLowerCase();return vi[t]??nn}catch{return nn}}function xi(e){if(!e)return"en";try{return new Intl.Locale(e.replace(/_/g,"-")).language.toLowerCase()}catch{return"en"}}function Ae(e){let n=X(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";/* c8 ignore start @preserve -- unreachable: every caller passes a word
102
+ * a tripwire for the type checker in case that invariant ever breaks. */throw new Error(`temporal-fmt: parseRelative internal error \u2014 month "${e}" not in names list.`);/* c8 ignore stop @preserve */}var lt=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],mt=["January","February","March","April","May","June","July","August","September","October","November","December"],ct=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],en={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)=>Sn(n.temporal,Se(n.reference),De(n.reference),ve(n.reference))},{pattern:/^tomorrow$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^yesterday$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(next|last|this)\\s+(${X(lt)})$`,"i"),resolve:(e,n)=>{let t=e[1].toLowerCase(),r=Mn(e[2],lt),o=Tn(n.reference);return Y(n.temporal,n.reference,Dn(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,s=/\bago\b/i.test(e[0]);if(!a&&!s)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 u=a?1:-1;return Te(n.temporal,n.reference,u*Number(r),o)}},{pattern:new RegExp(`^(${X([...mt,...ct])})\\s+(\\d{1,2})(?:st|nd|rd|th)?(?:,?\\s*(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=xn(e[1],mt,ct),r=Number(e[2]);return vn(n.temporal,n.reference,t,r)}}]},bn=["lunes","martes","mi\xE9rcoles","jueves","viernes","s\xE1bado","domingo"],gr=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],yr=["ene","feb","mar","abr","may","jun","jul","ago","sept","oct","nov","dic"],Di={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)=>Sn(n.temporal,Se(n.reference),De(n.reference),ve(n.reference))},{pattern:/^ma[ñn]ana$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^ayer$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(?:el\\s+)?(?:(pr[o\xF3]ximo|pasado)\\s+(${X(bn)})|(${X(bn)})\\s+(pr[o\xF3]ximo|pasado)|este\\s+(${X(bn)}))$`,"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=j(t)==="proximo"?"next":t.toLowerCase()==="este"?"this":"last",a=Mn(r,bn),s=Tn(n.reference);return Y(n.temporal,n.reference,Dn(o,s,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[4],r=e[5],o=-1);let a=Ae(r);return Te(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=Ae(e[2]);return Te(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+(${X([...gr,...yr])})(?:\\s+de\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=xn(e[2],gr,yr);return vn(n.temporal,n.reference,r,t)}}]},it=["lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche"],wr=["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],br=["janv.","f\xE9vr.","mars","avr.","mai","juin","juil.","ao\xFBt","sept.","oct.","nov.","d\xE9c."],vi={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)=>Sn(n.temporal,Se(n.reference),De(n.reference),ve(n.reference))},{pattern:/^demain$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^hier$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(?:(${X(it)})\\s+(prochain|dernier)|ce\\s+(${X(it)}))$`,"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=Mn(r,it),a=Tn(n.reference);return Y(n.temporal,n.reference,Dn(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=Ae(e[2]);return Te(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=Ae(e[2]);return Te(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+(${X([...wr,...br])})(?:\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=xn(e[2],wr,br);return vn(n.temporal,n.reference,r,t)}}]},kr=["Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"],Tr=["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],Sr=["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],Mi={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)=>Sn(n.temporal,Se(n.reference),De(n.reference),ve(n.reference))},{pattern:/^morgen$/i,resolve:(e,n)=>Y(n.temporal,n.reference,1)},{pattern:/^gestern$/i,resolve:(e,n)=>Y(n.temporal,n.reference,-1)},{pattern:new RegExp(`^(n(?:ae|a|\xE4)chsten|letzten|diesen)\\s+(${X(kr)})$`,"i"),resolve:(e,n)=>{let t=j(e[1]),r=t==="nachsten"||t==="naechsten"?"next":t==="diesen"?"this":"last",o=Mn(e[2],kr),a=Tn(n.reference);return Y(n.temporal,n.reference,Dn(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=Ae(e[2]);return Te(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=Ae(e[2]);return Te(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+(${X([...Tr,...Sr,"Maerz","Maer"])})(?:\\s+(\\d{4}))?$`,"i"),resolve:(e,n)=>{let t=Number(e[1]),r=xn(e[2],Tr,Sr);return vn(n.temporal,n.reference,r,t)}}]},xi={en,es:Di,fr:vi,de:Mi};function Ei(e){if(!e)return en;try{let t=new Intl.Locale(e.replace(/_/g,"-")).language.toLowerCase();return xi[t]??en}catch{return en}}function Fi(e){if(!e)return"en";try{return new Intl.Locale(e.replace(/_/g,"-")).language.toLowerCase()}catch{return"en"}}function Ae(e){let n=j(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";/* c8 ignore start @preserve -- unreachable: every caller passes a word
103
103
  * captured by a regex alternation built from exactly these unit-word
104
104
  * forms (day/week/month/year across en/es/fr/de), so the branches
105
105
  * above already cover every string that can reach this function.
106
106
  * Kept as a tripwire for the type checker in case a grammar adds a
107
- * unit word here without a matching regex update. */throw new Error(`temporal-fmt: parseRelative internal error \u2014 unrecognized unit word "${e}".`);/* c8 ignore stop @preserve */}function Sr(e,n,t={}){let r=n,o=R(),a=(e??"").trim().replace(/\s+/g," ");if(a.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");if(a.length>Tn)throw new RangeError(`temporal-fmt: parseRelative input is too large (maximum ${Tn} characters).`);let s=X(a),u=Mi(t.locale),i={temporal:o,reference:r},m=cr(xi(t.locale),a,{year:r.year,month:r.month,day:r.day,dayOfWeek:r.dayOfWeek});if(m!==null)return m;let l=p=>{for(let d of u.matchers){let f=p.match(d.pattern);if(f)return d.resolve(f,i)}return ut},c=l(s);if(c!==ut)return c;if(t.fuzzy){if(u!==nn)throw new Error("temporal-fmt: parseRelative's { fuzzy: true } option currently only supports English. Pass no locale (or locale: 'en'), or omit { fuzzy: true } for this locale.");let p=ki(s);if(p!==void 0){let d=l(p);if(d!==ut)return d}}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${a}". `+u.supportedHint)}var ut=Symbol("temporal-fmt: parseRelative no match");function J(e){return typeof e=="object"&&e!==null}function se(e){return n=>{try{return e(n)}catch{return!1}}}function v(e,n){return typeof e[n]=="function"}function we(e,n){return J(e)?e[Symbol.toStringTag]===`Temporal.${n}`:!1}var dt=se(function(n){if(we(n,"PlainDate"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour>"u"&&v(t,"toPlainDateTime")&&v(t,"withCalendar")}),ft=se(function(n){if(we(n,"PlainTime"))return!0;if(!J(n))return!1;let t=n;return typeof t.hour=="number"&&typeof t.year>"u"&&!v(t,"withCalendar")&&!v(t,"toPlainDate")&&!v(t,"toPlainDateTime")}),pt=se(function(n){if(we(n,"PlainDateTime"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&v(t,"withPlainTime")&&!v(t,"toInstant")}),ht=se(function(n){if(we(n,"ZonedDateTime"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&v(t,"withTimeZone")&&v(t,"toInstant")}),gt=se(function(n){if(we(n,"Instant"))return!0;if(!J(n))return!1;let t=n;return v(t,"toZonedDateTimeISO")&&!v(t,"toInstant")&&typeof t.year>"u"}),yt=se(function(n){if(we(n,"PlainYearMonth"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day>"u"&&v(t,"toPlainDate")}),wt=se(function(n){if(we(n,"PlainMonthDay"))return!0;if(!J(n))return!1;let t=n;return typeof t.year>"u"&&typeof t.month>"u"&&typeof t.day=="number"&&typeof t.monthCode=="string"&&v(t,"toPlainDate")}),bt=se(function(n){return we(n,"Duration")?!0:J(n)?v(n,"total"):!1}),kt=se(function(n){if(!J(n))return!1;let t=n[Symbol.toStringTag];if(typeof t=="string"&&t.startsWith("Temporal."))return!0;let r=n;return v(r,"toInstant")||v(r,"toPlainDate")||v(r,"toPlainDateTime")||v(r,"toPlainTime")||v(r,"toPlainYearMonth")||v(r,"toPlainMonthDay")||v(r,"toZonedDateTime")||v(r,"toZonedDateTimeISO")||v(r,"withCalendar")||v(r,"withPlainTime")||v(r,"withTimeZone")||v(r,"total")});function Ei(e){if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object"){let n=e.constructor;return n&&typeof n.name=="string"&&n.name!=="Object"?`instance of ${n.name}`:"plain object"}return typeof e}function ie(e,n,t){if(!n(e))throw new Error(`temporal-fmt: expected a Temporal.${t}, got ${Ei(e)}.`)}function Dr(e){ie(e,kt,"object (Instant, PlainDate, PlainTime, PlainDateTime, ZonedDateTime, Duration, PlainYearMonth, or PlainMonthDay)")}function vr(e){ie(e,gt,"Instant")}function Mr(e){ie(e,dt,"PlainDate")}function xr(e){ie(e,ft,"PlainTime")}function Er(e){ie(e,pt,"PlainDateTime")}function Fr(e){ie(e,ht,"ZonedDateTime")}function _r(e){ie(e,yt,"PlainYearMonth")}function $r(e){ie(e,wt,"PlainMonthDay")}function Rr(e){ie(e,bt,"Duration")}var g={year:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth"],month:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth","PlainMonthDay"],day:["PlainDate","PlainDateTime","ZonedDateTime","PlainMonthDay"],hour:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],minute:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],second:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],millisecond:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],dayOfWeek:["PlainDate","PlainDateTime","ZonedDateTime"],timeZoneId:["ZonedDateTime"],offset:["ZonedDateTime"]},ee={yyyy:{meaning:"Four-digit year (preserves sign for BCE; no truncation).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!0},yy:{meaning:"Two-digit year (year % 100). Throws on negative years.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!1},MMMM:{meaning:'Long month name (locale-aware, e.g. "January", "janvier").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},MMM:{meaning:'Short month name (locale-aware, e.g. "Jan", "janv.").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},MM:{meaning:"Two-digit month (01-12, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},M:{meaning:"One- or two-digit month (1-12, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},dd:{meaning:"Two-digit day-of-month (01-31, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!0},d:{meaning:"One- or two-digit day-of-month (1-31, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!0},EEEE:{meaning:'Long weekday name (locale-aware, e.g. "Monday", "lundi"). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},EEE:{meaning:'Short weekday name (locale-aware, e.g. "Mon", "lun."). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},HH:{meaning:"Two-digit hour, 24-hour clock (00-23, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},H:{meaning:"One- or two-digit hour, 24-hour clock (0-23, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},hh:{meaning:"Two-digit hour, 12-hour clock (01-12, zero-padded). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},h:{meaning:"One- or two-digit hour, 12-hour clock (1-12, no padding). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},mm:{meaning:"Two-digit minute (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.minute,roundTripSafe:!0},m:{meaning:"One- or two-digit minute (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.minute,roundTripSafe:!0},ss:{meaning:"Two-digit second (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.second,roundTripSafe:!0},s:{meaning:"One- or two-digit second (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.second,roundTripSafe:!0},S:{meaning:"Fractional second, 1 digit (tenths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SS:{meaning:"Fractional second, 2 digits (hundredths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSS:{meaning:"Fractional second, 3 digits (milliseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSS:{meaning:"Fractional second, 4 digits (tens of microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSS:{meaning:"Fractional second, 5 digits (hundred-thousandths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSS:{meaning:"Fractional second, 6 digits (microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSSS:{meaning:"Fractional second, 7 digits (tens of nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSSSS:{meaning:"Fractional second, 8 digits (hundred-millionths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSSSSS:{meaning:"Fractional second, 9 digits (nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},a:{meaning:'Day period (locale-aware: "AM"/"PM", "\u5348\u524D"/"\u5348\u5F8C", etc.). Required alongside 12-hour tokens on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},zzz:{meaning:'IANA time zone id (e.g. "America/New_York") or fixed offset ("+05:30"). Requires full date+time on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.timeZoneId,roundTripSafe:!0},X:{meaning:"Numeric UTC offset, short (Z for UTC, \xB1HH[MM] otherwise). Minutes omitted when zero.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},XX:{meaning:"Numeric UTC offset, no colon (Z for UTC, \xB1HHMM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},XXX:{meaning:"Numeric UTC offset, with colon (Z for UTC, \xB1HH:MM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},x:{meaning:"Numeric UTC offset, short, never Z (always \xB1HH[MM]). Lowercase variant of X.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},xx:{meaning:"Numeric UTC offset, no colon, never Z (always \xB1HHMM). Lowercase variant of XX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},xxx:{meaning:"Numeric UTC offset, with colon, never Z (always \xB1HH:MM). Lowercase variant of XXX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},do:{meaning:'Ordinal day-of-month with English suffix ("1st", "2nd", "3rd", "4th", ... 21st, 22nd, ...). Format-only \u2014 not parseable.',formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},Q:{meaning:"Quarter as a digit (1-4). Derived from month.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},QQQ:{meaning:'Quarter with "Q" prefix ("Q1".."Q4"). Derived from month.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},ww:{meaning:"ISO 8601 week number (01-53). Format-only \u2014 week alone can't reconstruct a date.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!1},RRRR:{meaning:"ISO 8601 week-numbering year (4-digit, may differ from calendar year at year boundaries). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!1},D:{meaning:"Day of year, unpadded (1-366). Format-only \u2014 parsing requires resolving against a year.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},DD:{meaning:"Day of year, 2-digit minimum (01-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},DDD:{meaning:"Day of year, 3-digit zero-padded (001-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},LLLL:{meaning:"Stand-alone long month name (nominative case in Slavic locales). Identical to MMMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},LLL:{meaning:"Stand-alone short month name. Identical to MMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},cccc:{meaning:"Stand-alone long weekday name. Identical to EEEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},ccc:{meaning:"Stand-alone short weekday name. Identical to EEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},GGGG:{meaning:'Long era name (locale-aware, e.g. "Anno Domini"/"Before Christ"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!1},G:{meaning:'Short era name (locale-aware, e.g. "AD"/"BC"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!1},zzzz:{meaning:'Localized long timezone name (e.g. "Eastern Standard Time"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.timeZoneId,roundTripSafe:!1},z:{meaning:'Localized short timezone name (e.g. "EST"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.timeZoneId,roundTripSafe:!1}},tn=Object.keys(ee);function Ir(e){return he(e)}function Tt(){return pe.map(([e])=>({name:e,metadata:ee[e]}))}function Or(e){return ee[e]}function Le(e){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);let n=he(e),t=[],r=new Set,o=new Set,a=!0,s=!1,u=!1,i=!1,m=!0,l=[],c=0,p=[],d=()=>{p.length>=2&&l.push({code:"AMBIGUOUS_NUMERIC_RUN",message:`Adjacent unpadded numeric tokens "${p.join("")}" with no separator can be ambiguous to parse. Add a separator or use the padded form (e.g. "MM" instead of "M").`}),p.length=0};for(let k of n){if(k.kind==="literal"){c+=k.value.length,d();continue}let N=ee[k.value];if(!N){l.push({code:"UNKNOWN_TOKEN_NO_METADATA",message:`Token "${k.value}" is recognized by the tokenizer but has no metadata entry in tokenMetadata.ts \u2014 this is a bug in temporal-fmt.`}),c+=k.value.length;continue}t.push({name:k.value,position:c,metadata:N});let re=Wn(k.value);if(re&&r.add(re.field),t.length===1)for(let Fe of N.supportedTypes)o.add(Fe);else{let Fe=new Set;for(let Z of o)N.supportedTypes.includes(Z)&&Fe.add(Z);o.clear();for(let Z of Fe)o.add(Z)}N.parseCapable||(a=!1,l.push({code:"FORMAT_ONLY_TOKEN",message:`Token "${k.value}" is format-only \u2014 it can't be parsed back into a value. Use a parse-capable variant (e.g. "d" instead of "do") if you need round-trip.`})),N.localeSensitive&&(s=!0),N.calendarSensitive&&(u=!0),N.timezoneSensitive&&(i=!0),N.roundTripSafe||(m=!1),gn.has(k.value)?p.push(k.value):d(),c+=k.value.length}d();let f=t.map(k=>k.name),h=f.some(k=>k==="hh"||k==="h"),w=f.some(k=>k==="HH"||k==="H"),M=f.some(k=>k==="a");h&&!M&&l.push({code:"TWELVE_HOUR_WITHOUT_A",message:`12-hour token ("hh"/"h") used without an "a" (AM/PM) token \u2014 parse() can't tell AM from PM and throws at runtime.`}),h&&w&&l.push({code:"MIXED_12_AND_24_HOUR",message:"Mixing 24-hour and 12-hour tokens \u2014 parse() refuses to guess which is authoritative and throws at runtime."});let b=f.some(k=>k==="X"||k==="XX"||k==="XXX"||k==="x"||k==="xx"||k==="xxx"),x=f.some(k=>k==="zzz");return b&&x&&l.push({code:"ZZZ_WITH_OFFSET_TOKEN",message:`Format string has both "zzz" and an offset token \u2014 parse() cross-checks them and throws if the parsed offset disagrees with the zone's actual offset.`}),b&&!r.has("year")&&l.push({code:"OFFSET_WITHOUT_FULL_DATE",message:"Offset token used without a full date \u2014 parse() needs a complete date and time to build a ZonedDateTime and throws at runtime otherwise."}),{tokens:t,requiredFields:[...r].sort(),compatibleTypes:[...o].sort(),parseable:a,localeSensitive:s,calendarSensitive:u,timezoneSensitive:i,ambiguous:l.some(k=>k.code==="AMBIGUOUS_NUMERIC_RUN"),roundTripSafe:m&&a,warnings:l}}function Pr(e){let n=Le(e),t=[];t.push(`Format string: "${e}"`),t.push(`Tokens (${n.tokens.length}):`);for(let r of n.tokens)t.push(` ${r.name} @${r.position} \u2014 ${r.metadata.meaning}`);if(n.requiredFields.length>0&&t.push(`Required fields: ${n.requiredFields.join(", ")}`),n.compatibleTypes.length>0&&t.push(`Compatible Temporal types: ${n.compatibleTypes.join(", ")}`),t.push(`Parseable: ${n.parseable?"yes":"no"}`),t.push(`Locale-sensitive: ${n.localeSensitive?"yes":"no"}`),t.push(`Calendar-sensitive: ${n.calendarSensitive?"yes":"no"}`),t.push(`Timezone-sensitive: ${n.timezoneSensitive?"yes":"no"}`),t.push(`Ambiguous: ${n.ambiguous?"yes":"no"}`),t.push(`Round-trip safe: ${n.roundTripSafe?"yes":"no"}`),n.warnings.length>0){t.push("Warnings:");for(let r of n.warnings)t.push(` [${r.code}] ${r.message}`)}return t.join(`
108
- `)}function Nr(e){if(e.length>1e3)return!1;try{return he(e),!0}catch{return!1}}function Cr(e){return Le(e)}function Ar(e){return Wn(e)?.field}function ue(e,n){for(let t of n)if(typeof e[t]!="number")throw new Error(`temporal-fmt: calendar helper requires "${String(t)}", which this value doesn't have. Pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.`)}function xe(e){ue(e,["year","month"]);let{year:n,month:t}=e,r=[31,28,31,30,31,30,31,31,30,31,30,31];return t===2&&oe(n)?29:r[t-1]}function Lr(e){return ue(e,["year"]),oe(e.year)?366:365}function zr(e){return 12}function Ur(e){return ue(e,["year"]),oe(e.year)}function Hr(e){return!1}function Zr(e){return ue(e,["year","month","day"]),ae(e.year,e.month,e.day)}function Yr(e){return ue(e,["year","month","day","dayOfWeek"]),Ie(e.year,e.month,e.day,e.dayOfWeek).week}function Vr(e){return ue(e,["year","month","day","dayOfWeek"]),Ie(e.year,e.month,e.day,e.dayOfWeek).isoYear}function Fi(e){if(!Number.isInteger(e)||e<1||e>12)throw new Error(`temporal-fmt: getQuarter's startMonth must be an integer from 1 to 12 (got ${e}).`)}function Wr(e,n={}){ue(e,["month"]);let t=n.startMonth??1;if(Fi(t),t===1)return Math.ceil(e.month/3);let r=(e.month-t+12)%12+1;return Math.ceil(r/3)}function jr(e){return ue(e,["month"]),e.month}function Xr(e){return ue(e,["dayOfWeek"]),e.dayOfWeek}function Gr(e){return e==="day"||e==="month"||e==="year"}function Br(e){if(typeof e.dayOfWeek!="number")return;/* c8 ignore start @preserve -- unreachable: startOf()/endOf() both call
107
+ * unit word here without a matching regex update. */throw new Error(`temporal-fmt: parseRelative internal error \u2014 unrecognized unit word "${e}".`);/* c8 ignore stop @preserve */}function Dr(e,n,t={}){let r=n,o=R(),a=(e??"").trim().replace(/\s+/g," ");if(a.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");if(a.length>kn)throw new RangeError(`temporal-fmt: parseRelative input is too large (maximum ${kn} characters).`);let s=j(a),u=Ei(t.locale),i={temporal:o,reference:r},m=dr(Fi(t.locale),a,{year:r.year,month:r.month,day:r.day,dayOfWeek:r.dayOfWeek});if(m!==null)return m;let l=p=>{for(let d of u.matchers){let f=p.match(d.pattern);if(f)return d.resolve(f,i)}return ut},c=l(s);if(c!==ut)return c;if(t.fuzzy){if(u!==en)throw new Error("temporal-fmt: parseRelative's { fuzzy: true } option currently only supports English. Pass no locale (or locale: 'en'), or omit { fuzzy: true } for this locale.");let p=Si(s);if(p!==void 0){let d=l(p);if(d!==ut)return d}}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${a}". `+u.supportedHint)}var ut=Symbol("temporal-fmt: parseRelative no match");function J(e){return typeof e=="object"&&e!==null}function se(e){return n=>{try{return e(n)}catch{return!1}}}function v(e,n){return typeof e[n]=="function"}function ge(e,n){return J(e)?e[Symbol.toStringTag]===`Temporal.${n}`:!1}var dt=se(function(n){if(ge(n,"PlainDate"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour>"u"&&v(t,"toPlainDateTime")&&v(t,"withCalendar")}),ft=se(function(n){if(ge(n,"PlainTime"))return!0;if(!J(n))return!1;let t=n;return typeof t.hour=="number"&&typeof t.year>"u"&&!v(t,"withCalendar")&&!v(t,"toPlainDate")&&!v(t,"toPlainDateTime")}),pt=se(function(n){if(ge(n,"PlainDateTime"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&v(t,"withPlainTime")&&!v(t,"toInstant")}),ht=se(function(n){if(ge(n,"ZonedDateTime"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&v(t,"withTimeZone")&&v(t,"toInstant")}),gt=se(function(n){if(ge(n,"Instant"))return!0;if(!J(n))return!1;let t=n;return v(t,"toZonedDateTimeISO")&&!v(t,"toInstant")&&typeof t.year>"u"}),yt=se(function(n){if(ge(n,"PlainYearMonth"))return!0;if(!J(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day>"u"&&v(t,"toPlainDate")}),wt=se(function(n){if(ge(n,"PlainMonthDay"))return!0;if(!J(n))return!1;let t=n;return typeof t.year>"u"&&typeof t.month>"u"&&typeof t.day=="number"&&typeof t.monthCode=="string"&&v(t,"toPlainDate")}),bt=se(function(n){return ge(n,"Duration")?!0:J(n)?v(n,"total"):!1}),kt=se(function(n){if(!J(n))return!1;let t=n[Symbol.toStringTag];if(typeof t=="string"&&t.startsWith("Temporal."))return!0;let r=n;return v(r,"toInstant")||v(r,"toPlainDate")||v(r,"toPlainDateTime")||v(r,"toPlainTime")||v(r,"toPlainYearMonth")||v(r,"toPlainMonthDay")||v(r,"toZonedDateTime")||v(r,"toZonedDateTimeISO")||v(r,"withCalendar")||v(r,"withPlainTime")||v(r,"withTimeZone")||v(r,"total")});function _i(e){if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object"){let n=e.constructor;return n&&typeof n.name=="string"&&n.name!=="Object"?`instance of ${n.name}`:"plain object"}return typeof e}function ie(e,n,t){if(!n(e))throw new Error(`temporal-fmt: expected a Temporal.${t}, got ${_i(e)}.`)}function vr(e){ie(e,kt,"object (Instant, PlainDate, PlainTime, PlainDateTime, ZonedDateTime, Duration, PlainYearMonth, or PlainMonthDay)")}function Mr(e){ie(e,gt,"Instant")}function xr(e){ie(e,dt,"PlainDate")}function Er(e){ie(e,ft,"PlainTime")}function Fr(e){ie(e,pt,"PlainDateTime")}function _r(e){ie(e,ht,"ZonedDateTime")}function $r(e){ie(e,yt,"PlainYearMonth")}function Rr(e){ie(e,wt,"PlainMonthDay")}function Ir(e){ie(e,bt,"Duration")}var g={year:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth"],month:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth","PlainMonthDay"],day:["PlainDate","PlainDateTime","ZonedDateTime","PlainMonthDay"],hour:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],minute:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],second:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],millisecond:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],dayOfWeek:["PlainDate","PlainDateTime","ZonedDateTime"],timeZoneId:["ZonedDateTime"],offset:["ZonedDateTime"]},ee={yyyy:{meaning:"Four-digit year (preserves sign for BCE; no truncation).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!0},yy:{meaning:"Two-digit year (year % 100). Throws on negative years.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!1},y:{meaning:"Unpadded year, any width (preserves sign for BCE; no truncation, no minimum digits). Cannot sit directly next to another digit-reading token or a literal starting with a digit \u2014 there would be no way to tell where it ends.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!0},MMMM:{meaning:'Long month name (locale-aware, e.g. "January", "janvier").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},MMM:{meaning:'Short month name (locale-aware, e.g. "Jan", "janv.").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},MM:{meaning:"Two-digit month (01-12, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},M:{meaning:"One- or two-digit month (1-12, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},dd:{meaning:"Two-digit day-of-month (01-31, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!0},d:{meaning:"One- or two-digit day-of-month (1-31, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!0},EEEE:{meaning:'Long weekday name (locale-aware, e.g. "Monday", "lundi"). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},EEE:{meaning:'Short weekday name (locale-aware, e.g. "Mon", "lun."). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},HH:{meaning:"Two-digit hour, 24-hour clock (00-23, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},H:{meaning:"One- or two-digit hour, 24-hour clock (0-23, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},hh:{meaning:"Two-digit hour, 12-hour clock (01-12, zero-padded). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},h:{meaning:"One- or two-digit hour, 12-hour clock (1-12, no padding). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},mm:{meaning:"Two-digit minute (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.minute,roundTripSafe:!0},m:{meaning:"One- or two-digit minute (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.minute,roundTripSafe:!0},ss:{meaning:"Two-digit second (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.second,roundTripSafe:!0},s:{meaning:"One- or two-digit second (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.second,roundTripSafe:!0},S:{meaning:"Fractional second, 1 digit (tenths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SS:{meaning:"Fractional second, 2 digits (hundredths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSS:{meaning:"Fractional second, 3 digits (milliseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSS:{meaning:"Fractional second, 4 digits (tens of microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSS:{meaning:"Fractional second, 5 digits (hundred-thousandths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSS:{meaning:"Fractional second, 6 digits (microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSSS:{meaning:"Fractional second, 7 digits (tens of nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSSSS:{meaning:"Fractional second, 8 digits (hundred-millionths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},SSSSSSSSS:{meaning:"Fractional second, 9 digits (nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.millisecond,roundTripSafe:!0},a:{meaning:'Day period (locale-aware: "AM"/"PM", "\u5348\u524D"/"\u5348\u5F8C", etc.). Required alongside 12-hour tokens on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:g.hour,roundTripSafe:!0},zzz:{meaning:'IANA time zone id (e.g. "America/New_York") or fixed offset ("+05:30"). Requires full date+time on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.timeZoneId,roundTripSafe:!0},X:{meaning:"Numeric UTC offset, short (Z for UTC, \xB1HH[MM] otherwise). Minutes omitted when zero.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},XX:{meaning:"Numeric UTC offset, no colon (Z for UTC, \xB1HHMM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},XXX:{meaning:"Numeric UTC offset, with colon (Z for UTC, \xB1HH:MM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},x:{meaning:"Numeric UTC offset, short, never Z (always \xB1HH[MM]). Lowercase variant of X.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},xx:{meaning:"Numeric UTC offset, no colon, never Z (always \xB1HHMM). Lowercase variant of XX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},xxx:{meaning:"Numeric UTC offset, with colon, never Z (always \xB1HH:MM). Lowercase variant of XXX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.offset,roundTripSafe:!0},do:{meaning:'Ordinal day-of-month with English suffix ("1st", "2nd", "3rd", "4th", ... 21st, 22nd, ...). Format-only \u2014 not parseable.',formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},Q:{meaning:"Quarter as a digit (1-4). Derived from month.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},QQQ:{meaning:'Quarter with "Q" prefix ("Q1".."Q4"). Derived from month.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},ww:{meaning:"ISO 8601 week number (01-53). Format-only \u2014 week alone can't reconstruct a date.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!1},RRRR:{meaning:"ISO 8601 week-numbering year (4-digit, may differ from calendar year at year boundaries). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!1},D:{meaning:"Day of year, unpadded (1-366). Format-only \u2014 parsing requires resolving against a year.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},DD:{meaning:"Day of year, 2-digit minimum (01-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},DDD:{meaning:"Day of year, 3-digit zero-padded (001-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.day,roundTripSafe:!1},LLLL:{meaning:"Stand-alone long month name (nominative case in Slavic locales). Identical to MMMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},LLL:{meaning:"Stand-alone short month name. Identical to MMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.month,roundTripSafe:!0},cccc:{meaning:"Stand-alone long weekday name. Identical to EEEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},ccc:{meaning:"Stand-alone short weekday name. Identical to EEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.dayOfWeek,roundTripSafe:!0},GGGG:{meaning:'Long era name (locale-aware, e.g. "Anno Domini"/"Before Christ"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!1},G:{meaning:'Short era name (locale-aware, e.g. "AD"/"BC"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:g.year,roundTripSafe:!1},zzzz:{meaning:'Localized long timezone name (e.g. "Eastern Standard Time"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.timeZoneId,roundTripSafe:!1},z:{meaning:'Localized short timezone name (e.g. "EST"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:g.timeZoneId,roundTripSafe:!1}},nn=Object.keys(ee);function Or(e){return fe(e)}function Tt(){return de.map(([e])=>({name:e,metadata:ee[e]}))}function Pr(e){return ee[e]}function Le(e){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);let n=fe(e),t=[],r=new Set,o=new Set,a=!0,s=!1,u=!1,i=!1,m=!0,l=[],c=0,p=[],d=()=>{p.length>=2&&l.push({code:"AMBIGUOUS_NUMERIC_RUN",message:`Adjacent unpadded numeric tokens "${p.join("")}" with no separator can be ambiguous to parse. Add a separator or use the padded form (e.g. "MM" instead of "M").`}),p.length=0};for(let k of n){if(k.kind==="literal"){c+=k.value.length,d();continue}let N=ee[k.value];if(!N){l.push({code:"UNKNOWN_TOKEN_NO_METADATA",message:`Token "${k.value}" is recognized by the tokenizer but has no metadata entry in tokenMetadata.ts \u2014 this is a bug in temporal-fmt.`}),c+=k.value.length;continue}t.push({name:k.value,position:c,metadata:N});let re=Xn(k.value);if(re&&r.add(re.field),t.length===1)for(let Ee of N.supportedTypes)o.add(Ee);else{let Ee=new Set;for(let Z of o)N.supportedTypes.includes(Z)&&Ee.add(Z);o.clear();for(let Z of Ee)o.add(Z)}N.parseCapable||(a=!1,l.push({code:"FORMAT_ONLY_TOKEN",message:`Token "${k.value}" is format-only \u2014 it can't be parsed back into a value. Use a parse-capable variant (e.g. "d" instead of "do") if you need round-trip.`})),N.localeSensitive&&(s=!0),N.calendarSensitive&&(u=!0),N.timezoneSensitive&&(i=!0),N.roundTripSafe||(m=!1),pn.has(k.value)?p.push(k.value):d(),c+=k.value.length}d();let f=t.map(k=>k.name),h=f.some(k=>k==="hh"||k==="h"),w=f.some(k=>k==="HH"||k==="H"),M=f.some(k=>k==="a");h&&!M&&l.push({code:"TWELVE_HOUR_WITHOUT_A",message:`12-hour token ("hh"/"h") used without an "a" (AM/PM) token \u2014 parse() can't tell AM from PM and throws at runtime.`}),h&&w&&l.push({code:"MIXED_12_AND_24_HOUR",message:"Mixing 24-hour and 12-hour tokens \u2014 parse() refuses to guess which is authoritative and throws at runtime."});let b=f.some(k=>k==="X"||k==="XX"||k==="XXX"||k==="x"||k==="xx"||k==="xxx"),E=f.some(k=>k==="zzz");return b&&E&&l.push({code:"ZZZ_WITH_OFFSET_TOKEN",message:`Format string has both "zzz" and an offset token \u2014 parse() cross-checks them and throws if the parsed offset disagrees with the zone's actual offset.`}),b&&!r.has("year")&&l.push({code:"OFFSET_WITHOUT_FULL_DATE",message:"Offset token used without a full date \u2014 parse() needs a complete date and time to build a ZonedDateTime and throws at runtime otherwise."}),{tokens:t,requiredFields:[...r].sort(),compatibleTypes:[...o].sort(),parseable:a,localeSensitive:s,calendarSensitive:u,timezoneSensitive:i,ambiguous:l.some(k=>k.code==="AMBIGUOUS_NUMERIC_RUN"),roundTripSafe:m&&a,warnings:l}}function Nr(e){let n=Le(e),t=[];t.push(`Format string: "${e}"`),t.push(`Tokens (${n.tokens.length}):`);for(let r of n.tokens)t.push(` ${r.name} @${r.position} \u2014 ${r.metadata.meaning}`);if(n.requiredFields.length>0&&t.push(`Required fields: ${n.requiredFields.join(", ")}`),n.compatibleTypes.length>0&&t.push(`Compatible Temporal types: ${n.compatibleTypes.join(", ")}`),t.push(`Parseable: ${n.parseable?"yes":"no"}`),t.push(`Locale-sensitive: ${n.localeSensitive?"yes":"no"}`),t.push(`Calendar-sensitive: ${n.calendarSensitive?"yes":"no"}`),t.push(`Timezone-sensitive: ${n.timezoneSensitive?"yes":"no"}`),t.push(`Ambiguous: ${n.ambiguous?"yes":"no"}`),t.push(`Round-trip safe: ${n.roundTripSafe?"yes":"no"}`),n.warnings.length>0){t.push("Warnings:");for(let r of n.warnings)t.push(` [${r.code}] ${r.message}`)}return t.join(`
108
+ `)}function Cr(e){if(e.length>1e3)return!1;try{return fe(e),!0}catch{return!1}}function Ar(e){return Le(e)}function Lr(e){return Xn(e)?.field}function ue(e,n){for(let t of n)if(typeof e[t]!="number")throw new Error(`temporal-fmt: calendar helper requires "${String(t)}", which this value doesn't have. Pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.`)}function Me(e){ue(e,["year","month"]);let{year:n,month:t}=e,r=[31,28,31,30,31,30,31,31,30,31,30,31];return t===2&&oe(n)?29:r[t-1]}function zr(e){return ue(e,["year"]),oe(e.year)?366:365}function Ur(e){return 12}function Hr(e){return ue(e,["year"]),oe(e.year)}function Zr(e){return!1}function Yr(e){return ue(e,["year","month","day"]),ae(e.year,e.month,e.day)}function Vr(e){return ue(e,["year","month","day","dayOfWeek"]),Ie(e.year,e.month,e.day,e.dayOfWeek).week}function Wr(e){return ue(e,["year","month","day","dayOfWeek"]),Ie(e.year,e.month,e.day,e.dayOfWeek).isoYear}function $i(e){if(!Number.isInteger(e)||e<1||e>12)throw new Error(`temporal-fmt: getQuarter's startMonth must be an integer from 1 to 12 (got ${e}).`)}function Xr(e,n={}){ue(e,["month"]);let t=n.startMonth??1;if($i(t),t===1)return Math.ceil(e.month/3);let r=(e.month-t+12)%12+1;return Math.ceil(r/3)}function jr(e){return ue(e,["month"]),e.month}function Gr(e){return ue(e,["dayOfWeek"]),e.dayOfWeek}function Br(e){return e==="day"||e==="month"||e==="year"}function qr(e){if(typeof e.dayOfWeek!="number")return;/* c8 ignore start @preserve -- unreachable: startOf()/endOf() both call
109
109
  * asDateFieldView() before this, which already throws if year/month/day
110
110
  * aren't all numbers — so by the time a value with a numeric dayOfWeek
111
- * reaches here, year/month/day are guaranteed present too. */if(typeof e.year!="number"||typeof e.month!="number"||typeof e.day!="number")return;/* c8 ignore stop @preserve */let n=new Date(Date.UTC(e.year,e.month-1,e.day)).getUTCDay();e.dayOfWeek=n===0?7:n}function qr(e,n){let r={...A(e)};return n==="year"?(r.month=1,r.day=1):n==="month"&&(r.day=1),Br(r),Gr(n)?(r.hour=0,r.minute=0,r.second=0,r.millisecond=0):n==="hour"?(r.minute=0,r.second=0,r.millisecond=0):n==="minute"?(r.second=0,r.millisecond=0):n==="second"&&(r.millisecond=0),r}function Kr(e,n){let r={...A(e)};return n==="year"?(r.month=12,r.day=xe({year:r.year,month:12})):n==="month"&&(r.day=xe({year:r.year,month:r.month})),Br(r),Gr(n)?(r.hour=23,r.minute=59,r.second=59,r.millisecond=999):n==="hour"?(r.minute=59,r.second=59,r.millisecond=999):n==="minute"?(r.second=59,r.millisecond=999):n==="second"&&(r.millisecond=999),r}function A(e){if(typeof e!="object"||e===null)throw new Error(`temporal-fmt: expected a date-carrying Temporal value, got ${String(e)}.`);let n=e,t={};if(typeof n.year=="number"&&(t.year=n.year),typeof n.month=="number"&&(t.month=n.month),typeof n.day=="number"&&(t.day=n.day),typeof n.hour=="number"&&(t.hour=n.hour),typeof n.minute=="number"&&(t.minute=n.minute),typeof n.second=="number"&&(t.second=n.second),typeof n.millisecond=="number"&&(t.millisecond=n.millisecond),typeof n.dayOfWeek=="number"&&(t.dayOfWeek=n.dayOfWeek),typeof n.calendarId=="string"&&(t.calendarId=n.calendarId),t.year===void 0||t.month===void 0||t.day===void 0)throw new Error("temporal-fmt: value is missing year/month/day fields \u2014 pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.");return t}function St(e){return A(e)}function Dt(e){if(typeof e.dayOfWeek!="number")return;/* c8 ignore start @preserve -- unreachable: every call site (add()'s
111
+ * reaches here, year/month/day are guaranteed present too. */if(typeof e.year!="number"||typeof e.month!="number"||typeof e.day!="number")return;/* c8 ignore stop @preserve */let n=new Date(Date.UTC(e.year,e.month-1,e.day)).getUTCDay();e.dayOfWeek=n===0?7:n}function Kr(e,n){let r={...A(e)};return n==="year"?(r.month=1,r.day=1):n==="month"&&(r.day=1),qr(r),Br(n)?(r.hour=0,r.minute=0,r.second=0,r.millisecond=0):n==="hour"?(r.minute=0,r.second=0,r.millisecond=0):n==="minute"?(r.second=0,r.millisecond=0):n==="second"&&(r.millisecond=0),r}function Qr(e,n){let r={...A(e)};return n==="year"?(r.month=12,r.day=Me({year:r.year,month:12})):n==="month"&&(r.day=Me({year:r.year,month:r.month})),qr(r),Br(n)?(r.hour=23,r.minute=59,r.second=59,r.millisecond=999):n==="hour"?(r.minute=59,r.second=59,r.millisecond=999):n==="minute"?(r.second=59,r.millisecond=999):n==="second"&&(r.millisecond=999),r}function A(e){if(typeof e!="object"||e===null)throw new Error(`temporal-fmt: expected a date-carrying Temporal value, got ${String(e)}.`);let n=e,t={};if(typeof n.year=="number"&&(t.year=n.year),typeof n.month=="number"&&(t.month=n.month),typeof n.day=="number"&&(t.day=n.day),typeof n.hour=="number"&&(t.hour=n.hour),typeof n.minute=="number"&&(t.minute=n.minute),typeof n.second=="number"&&(t.second=n.second),typeof n.millisecond=="number"&&(t.millisecond=n.millisecond),typeof n.dayOfWeek=="number"&&(t.dayOfWeek=n.dayOfWeek),typeof n.calendarId=="string"&&(t.calendarId=n.calendarId),t.year===void 0||t.month===void 0||t.day===void 0)throw new Error("temporal-fmt: value is missing year/month/day fields \u2014 pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.");return t}function St(e){return A(e)}function Dt(e){if(typeof e.dayOfWeek!="number")return;/* c8 ignore start @preserve -- unreachable: every call site (add()'s
112
112
  'years'/'months' cases, shiftDays()) passes a `result` whose
113
113
  year/month/day were just explicitly set, and the value originally
114
114
  came from asDateTime()/asDateFieldView(), which throws unless
@@ -118,7 +118,7 @@
118
118
  asDateTime()/asDateFieldView() (called at the top of add()) throws
119
119
  unless year is present as a number, so result.year is never
120
120
  undefined here. Kept as a guard against a future change that
121
- relaxes that validation. */o.year=(o.year??0)+n;/* c8 ignore stop @preserve */let a=xe({year:o.year,month:o.month});o.day>a&&(o.day=a),Dt(o);break}case"months":{/* c8 ignore start @preserve -- both `??` fallbacks are unreachable
121
+ relaxes that validation. */o.year=(o.year??0)+n;/* c8 ignore stop @preserve */let a=Me({year:o.year,month:o.month});o.day>a&&(o.day=a),Dt(o);break}case"months":{/* c8 ignore start @preserve -- both `??` fallbacks are unreachable
122
122
  for the same reason as the 'years' case above: asDateFieldView()
123
123
  guarantees year and month are present numbers before add() ever
124
124
  reaches here. */let a=(o.year??0)*12+(o.month??1)-1+n;/* c8 ignore stop @preserve */o.year=Math.floor(a/12),o.month=a%12+1,o.month<1&&(o.month+=12,o.year-=1);/* c8 ignore start @preserve -- unreachable: (total % 12) + 1 can never
@@ -127,7 +127,7 @@
127
127
  magnitude >= 12, so adding 1 tops out at 12). Only the < 1 branch
128
128
  above is reachable; this was written symmetrically with it but the
129
129
  overflow direction it guards against can't occur. Kept rather than
130
- removed since it costs nothing and documents the intent. */o.month>12&&(o.month-=12,o.year+=1);/* c8 ignore stop @preserve */let s=xe({year:o.year,month:o.month});o.day>s&&(o.day=s),Dt(o);break}case"weeks":o=vt(o,n*7);break;case"days":o=vt(o,n);break;case"hours":o=Fn(o,n*36e5);break;case"minutes":o=Fn(o,n*6e4);break;case"seconds":o=Fn(o,n*1e3);break;case"milliseconds":o=Fn(o,n);break}return o}function vt(e,n){let t=e.year,r=e.month,o=e.day,a=r<=2?t-1:t,s=Math.floor((a>=0?a:a-399)/400),u=a-s*400,i=r>2?r-3:r+9,m=Math.floor((153*i+2)/5)+o-1,l=u*365+Math.floor(u/4)-Math.floor(u/100)+m,p=s*146097+l-719468+n+719468,d=Math.floor((p>=0?p:p-146096)/146097),f=p-d*146097,h=Math.floor((f-Math.floor(f/1460)+Math.floor(f/36524)-Math.floor(f/146096))/365),w=h+d*400,M=f-(365*h+Math.floor(h/4)-Math.floor(h/100)),b=Math.floor((5*M+2)/153),x=M-Math.floor((153*b+2)/5)+1,k=b<10?b+3:b-9,N=k<=2?w+1:w,re={...e,year:N,month:k,day:x};return Dt(re),re}function Fn(e,n){let s=(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)+n,u=Math.floor(s/864e5),i=s%864e5;i<0&&(i+=864e5);let m=Math.floor(i/36e5),l=Math.floor(i%36e5/6e4),c=Math.floor(i%6e4/1e3),p=i%1e3,d={...e,hour:m,minute:l,second:c,millisecond:p};return u!==0?vt(d,u):d}function ne(e,n,t){return S(e,-n,t)}var Jr=(e,n)=>S(e,n,"years"),eo=(e,n)=>S(e,n,"months"),no=(e,n)=>S(e,n,"weeks"),to=(e,n)=>S(e,n,"days"),ro=(e,n)=>S(e,n,"hours"),oo=(e,n)=>S(e,n,"minutes"),ao=(e,n)=>S(e,n,"seconds"),so=(e,n)=>S(e,n,"milliseconds"),io=(e,n)=>ne(e,n,"years"),uo=(e,n)=>ne(e,n,"months"),lo=(e,n)=>ne(e,n,"weeks"),mo=(e,n)=>ne(e,n,"days"),co=(e,n)=>ne(e,n,"hours"),fo=(e,n)=>ne(e,n,"minutes"),po=(e,n)=>ne(e,n,"seconds"),ho=(e,n)=>ne(e,n,"milliseconds");function te(e,n,t){let r=St(e),o=St(n);if(t==="years")return o.year-r.year;if(t==="months")return o.year*12+o.month-1-(r.year*12+r.month-1);if(t==="weeks"||t==="days"){let c=Mt(r),d=Mt(o)-c;return t==="weeks"?Math.trunc(d/7):d}let a=36e5,s=6e4,u=1e3,i=Qr(r),l=Qr(o)-i;switch(t){case"hours":return Math.trunc(l/a);case"minutes":return Math.trunc(l/s);case"seconds":return Math.trunc(l/u);case"milliseconds":return l}}function Mt(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return a*146097+m-719468}function Qr(e){return Mt(e)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}var go=(e,n)=>te(e,n,"years"),yo=(e,n)=>te(e,n,"months"),wo=(e,n)=>te(e,n,"weeks"),_n=(e,n)=>te(e,n,"days"),bo=(e,n)=>te(e,n,"hours"),ko=(e,n)=>te(e,n,"minutes"),To=(e,n)=>te(e,n,"seconds"),So=(e,n)=>te(e,n,"milliseconds");function Do(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return(a*146097+m-719468)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}function vo(e){return A(e)}function T(e,n){let t=vo(e),r=vo(n),o=Do(t),a=Do(r);return o<a?-1:o>a?1:0}function Mo(e,n){return T(e,n)===0}function xo(e,n){return T(e,n)<0}function Eo(e,n){return T(e,n)>0}function Fo(e){if(!Array.isArray(e)||e.length===0)throw new Error("temporal-fmt: min() requires a non-empty array of values.");let n=e[0];for(let t=1;t<e.length;t++)T(e[t],n)<0&&(n=e[t]);return n}function _o(e){if(!Array.isArray(e)||e.length===0)throw new Error("temporal-fmt: max() requires a non-empty array of values.");let n=e[0];for(let t=1;t<e.length;t++)T(e[t],n)>0&&(n=e[t]);return n}function $o(e,n,t){return T(e,n)<0?n:T(e,t)>0?t:e}function Ro(e,n,t){return T(e,n)>=0&&T(e,t)<=0}function H(e){let n=A(e);return{year:n.year,month:n.month,day:n.day}}function _i(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function $n(e,n){return e.year===n.year&&e.month===n.month&&e.day===n.day}function Io(e,n){return $n(H(e),H(n))}function Oo(e){return $n(H(e),_i())}function $i(){let e=new Date;return e.setDate(e.getDate()+1),{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function Ri(){let e=new Date;return e.setDate(e.getDate()-1),{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function Po(e){return $n(H(e),$i())}function No(e){return $n(H(e),Ri())}function Ii(e,n,t,r,o,a){let u=(d,f,h)=>{let w=f<=2?d-1:d,M=(w>=0?w:w-399)/400|0,b=w-M*400,x=f>2?f-3:f+9,k=Math.floor(Math.floor(153*x+2)/5+h-1),N=b*365+Math.floor(b/4)-Math.floor(b/100)+k;return M*146097+N-719468},i=u(e,n,t),m=u(r,o,a);if(Math.abs(i-m)>=7)return!1;let l=(d,f,h)=>{let w=u(d,f,h),b=new Date(Date.UTC(d,f-1,h)).getUTCDay();return b===0?7:b},c=i-(l(e,n,t)-1),p=m-(l(r,o,a)-1);return c===p}function Co(e,n){let t=H(e),r=H(n);return Ii(t.year,t.month,t.day,r.year,r.month,r.day)}function Ao(e,n){let t=H(e),r=H(n);return t.year===r.year&&t.month===r.month}function Lo(e,n){let t=H(e),r=H(n);return t.year===r.year&&Math.ceil(t.month/3)===Math.ceil(r.month/3)}function zo(e,n){return H(e).year===H(n).year}function xt(e){if(typeof e!="object"||e===null)throw new Error(`temporal-fmt: isWeekend() expected a Temporal value, got ${String(e)}.`);let n=e;if(typeof n.dayOfWeek!="number")throw new Error("temporal-fmt: isWeekend() needs a value with a dayOfWeek field (PlainDate / PlainDateTime / ZonedDateTime).");return n.dayOfWeek===6||n.dayOfWeek===7}function Uo(e){return!xt(e)}var V={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1};function Oi(e,n,t){let r=e<0?-1:1,a=Math.abs(e)/t,s;switch(n){case"nearest":s=Math.round(a);break;case"floor":s=Math.floor(a);break;case"ceil":s=Math.ceil(a);break;case"trunc":s=Math.trunc(a);break}return r*s*t}function Pi(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return(a*146097+m-719468)*V.day+(e.hour??0)*V.hour+(e.minute??0)*V.minute+(e.second??0)*V.second+(e.millisecond??0)}function Ni(e,n){let t=V.day,r=Math.floor(e/t),o=e-r*t;o<0&&(o+=t);let a=Math.floor(o/V.hour),s=Math.floor(o%V.hour/V.minute),u=Math.floor(o%V.minute/V.second),i=o%V.second,m=r+719468,l=Math.floor((m>=0?m:m-146096)/146097),c=m-l*146097,p=Math.floor((c-Math.floor(c/1460)+Math.floor(c/36524)-Math.floor(c/146096))/365),d=p+l*400,f=c-(365*p+Math.floor(p/4)-Math.floor(p/100)),h=Math.floor((5*f+2)/153),w=f-Math.floor((153*h+2)/5)+1,M=h<10?h+3:h-9,b=M<=2?d+1:d;return{...n,year:b,month:M,day:w,hour:a,minute:s,second:u,millisecond:i}}function rn(e,n){let t=A(e),r=n.mode??"nearest",o=(n.roundingIncrement??1)*V[n.unit];if(o<=0)throw new Error(`temporal-fmt: round() requires a positive roundingIncrement (got ${n.roundingIncrement}).`);let a=Pi(t),s=Oi(a,r,o);return Ni(s,t)}function Ho(e,n,t=1){return rn(e,{unit:n,mode:"floor",roundingIncrement:t})}function Zo(e,n,t=1){return rn(e,{unit:n,mode:"ceil",roundingIncrement:t})}function Yo(e,n,t=1){return rn(e,{unit:n,mode:"trunc",roundingIncrement:t})}function on(e,n,t){if(Number.isInteger(e))return BigInt(e)*n;let r=e*Number(n);if(Number.isSafeInteger(r))return BigInt(r);throw new W({reason:`field "${t}" (${e}) cannot be converted to nanoseconds exactly \u2014 the value is too large for a fractional unit; use smaller units`})}var Et={years:0n,months:0n,weeks:0n,days:86400n*1000000000n,hours:3600n*1000000000n,minutes:60n*1000000000n,seconds:1000000000n,milliseconds:1000000n,microseconds:1000n,nanoseconds:1n};function Ci(e){return e==="years"||e==="months"||e==="weeks"}function Rn(e,n){let t=n.mode??"nearest",r=BigInt(n.roundingIncrement??1);if(r<=0n)throw new Error(`temporal-fmt: roundDuration() requires a positive roundingIncrement (got ${n.roundingIncrement}).`);if(Ci(n.unit))throw new Error(`temporal-fmt: roundDuration() to "${n.unit}" requires a Temporal.Duration with a relativeTo \u2014 this helper operates on plain field bags without calendar context. Use Temporal.Duration.prototype.round() directly.`);let o=0n;for(let w of["days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"]){let M=e[w]??0;o+=on(M,Et[w],w)}let a=r*Et[n.unit],s=o<0n?-1n:1n,u=o<0n?-o:o,i=u/a,m=u%a,l;switch(t){case"nearest":l=m*2n>=a?i+1n:i;break;case"floor":l=i;break;case"ceil":l=m>0n?i+1n:i;break;case"trunc":l=i;break}let c=s*l*a,p={...e},d=c,f=["days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"],h=f.indexOf(n.unit);for(let w=h+1;w<f.length;w++)p[f[w]]=0;for(let w=0;w<=h;w++){let M=f[w],b=Et[M];if(b===0n)continue;let x=d/b;d-=x*b,p[M]=Number(x)}return p}function In(e){let n=R();try{if(/^\d{4}-\d{2}-\d{2}T/.test(e)||/T\d{2}:\d{2}/.test(e)){if(/[zZ]$/.test(e)||/[+-]\d{2}:?\d{2}$/.test(e)){let t=e;if(/[zZ]$/.test(t))t=t.slice(0,-1)+"+00:00[UTC]";else{let r=/([+-]\d{2}:?\d{2})$/.exec(t);r&&(t=`${t}[${r[1]}]`)}return n.ZonedDateTime.from(t,{overflow:"reject"})}return n.PlainDateTime.from(e,{overflow:"reject"})}if(/^\d{4}-\d{2}-\d{2}/.test(e))return n.PlainDate.from(e,{overflow:"reject"});if(/^\d{2}:\d{2}/.test(e))return n.PlainTime.from(e);throw new Error(`temporal-fmt: parseISO("${e}") doesn't look like an ISO 8601 string.`)}catch(t){throw new z({input:e,reason:t.message})}}function Ft(e){let n=e;if(typeof n?.toString!="function")throw new y({reason:`formatISO() expects a Temporal value with toString(), got ${typeof e}.`});return n.toString()}function Vo(e){if(!/^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/.exec(e))throw new y({input:e,reason:"does not match RFC 3339 date-time grammar"});let r=e.replace(/[tT]/,"T").replace(/[zZ]$/,"+00:00[UTC]");return In(r)}function Wo(e){let n=Ft(e);if(!/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$/.test(n))throw new y({input:n,reason:"value did not produce RFC 3339-compliant output"});return n}function jo(e){if(!/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s+)?\d{1,2}\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{2,4}\s+\d{2}:\d{2}(?::\d{2})?\s+(?:[+-]\d{4}|[A-Za-z]{1,5})$/.test(e.trim()))throw new y({input:e,reason:"not a valid RFC 2822 date"});let t=Date.parse(e);if(Number.isNaN(t))throw new y({input:e,reason:"not a valid RFC 2822 date"});return ze().fromEpochMilliseconds(t)}function Xo(e){let n=e,t;if(typeof n?.toEpochMilliseconds=="function")t=n.toEpochMilliseconds();else if(typeof n?.epochMilliseconds=="number")t=n.epochMilliseconds;else if(typeof n?.toInstant=="function"){let r=n.toInstant();typeof r.epochMilliseconds=="number"&&(t=r.epochMilliseconds)}if(t===void 0)throw new y({reason:`formatRFC2822() expects a value with epochMilliseconds, toEpochMilliseconds(), or toInstant(), got ${typeof e}.`});return Ai(t)}function Ai(e){try{let t=new Intl.DateTimeFormat("en-US",{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:"UTC",timeZoneName:"shortOffset",hour12:!1}).formatToParts(new Date(e)),r=i=>t.find(m=>m.type===i)?.value??"",a=r("timeZoneName")?.match(/GMT([+-])(\d+)(?::(\d+))?/),s;if(a){let i=a[1],m=a[2].padStart(2,"0"),l=(a[3]??"0").padStart(2,"0");s=`${i}${m}${l}`;/* c8 ignore start @preserve -- timeZone is hardcoded to 'UTC' above,
130
+ removed since it costs nothing and documents the intent. */o.month>12&&(o.month-=12,o.year+=1);/* c8 ignore stop @preserve */let s=Me({year:o.year,month:o.month});o.day>s&&(o.day=s),Dt(o);break}case"weeks":o=vt(o,n*7);break;case"days":o=vt(o,n);break;case"hours":o=En(o,n*36e5);break;case"minutes":o=En(o,n*6e4);break;case"seconds":o=En(o,n*1e3);break;case"milliseconds":o=En(o,n);break}return o}function vt(e,n){let t=e.year,r=e.month,o=e.day,a=r<=2?t-1:t,s=Math.floor((a>=0?a:a-399)/400),u=a-s*400,i=r>2?r-3:r+9,m=Math.floor((153*i+2)/5)+o-1,l=u*365+Math.floor(u/4)-Math.floor(u/100)+m,p=s*146097+l-719468+n+719468,d=Math.floor((p>=0?p:p-146096)/146097),f=p-d*146097,h=Math.floor((f-Math.floor(f/1460)+Math.floor(f/36524)-Math.floor(f/146096))/365),w=h+d*400,M=f-(365*h+Math.floor(h/4)-Math.floor(h/100)),b=Math.floor((5*M+2)/153),E=M-Math.floor((153*b+2)/5)+1,k=b<10?b+3:b-9,N=k<=2?w+1:w,re={...e,year:N,month:k,day:E};return Dt(re),re}function En(e,n){let s=(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)+n,u=Math.floor(s/864e5),i=s%864e5;i<0&&(i+=864e5);let m=Math.floor(i/36e5),l=Math.floor(i%36e5/6e4),c=Math.floor(i%6e4/1e3),p=i%1e3,d={...e,hour:m,minute:l,second:c,millisecond:p};return u!==0?vt(d,u):d}function ne(e,n,t){return S(e,-n,t)}var eo=(e,n)=>S(e,n,"years"),no=(e,n)=>S(e,n,"months"),to=(e,n)=>S(e,n,"weeks"),ro=(e,n)=>S(e,n,"days"),oo=(e,n)=>S(e,n,"hours"),ao=(e,n)=>S(e,n,"minutes"),so=(e,n)=>S(e,n,"seconds"),io=(e,n)=>S(e,n,"milliseconds"),uo=(e,n)=>ne(e,n,"years"),lo=(e,n)=>ne(e,n,"months"),mo=(e,n)=>ne(e,n,"weeks"),co=(e,n)=>ne(e,n,"days"),fo=(e,n)=>ne(e,n,"hours"),po=(e,n)=>ne(e,n,"minutes"),ho=(e,n)=>ne(e,n,"seconds"),go=(e,n)=>ne(e,n,"milliseconds");function te(e,n,t){let r=St(e),o=St(n);if(t==="years")return o.year-r.year;if(t==="months")return o.year*12+o.month-1-(r.year*12+r.month-1);if(t==="weeks"||t==="days"){let c=Mt(r),d=Mt(o)-c;return t==="weeks"?Math.trunc(d/7):d}let a=36e5,s=6e4,u=1e3,i=Jr(r),l=Jr(o)-i;switch(t){case"hours":return Math.trunc(l/a);case"minutes":return Math.trunc(l/s);case"seconds":return Math.trunc(l/u);case"milliseconds":return l}}function Mt(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return a*146097+m-719468}function Jr(e){return Mt(e)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}var yo=(e,n)=>te(e,n,"years"),wo=(e,n)=>te(e,n,"months"),bo=(e,n)=>te(e,n,"weeks"),Fn=(e,n)=>te(e,n,"days"),ko=(e,n)=>te(e,n,"hours"),To=(e,n)=>te(e,n,"minutes"),So=(e,n)=>te(e,n,"seconds"),Do=(e,n)=>te(e,n,"milliseconds");function vo(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return(a*146097+m-719468)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}function Mo(e){return A(e)}function T(e,n){let t=Mo(e),r=Mo(n),o=vo(t),a=vo(r);return o<a?-1:o>a?1:0}function xo(e,n){return T(e,n)===0}function Eo(e,n){return T(e,n)<0}function Fo(e,n){return T(e,n)>0}function _o(e){if(!Array.isArray(e)||e.length===0)throw new Error("temporal-fmt: min() requires a non-empty array of values.");let n=e[0];for(let t=1;t<e.length;t++)T(e[t],n)<0&&(n=e[t]);return n}function $o(e){if(!Array.isArray(e)||e.length===0)throw new Error("temporal-fmt: max() requires a non-empty array of values.");let n=e[0];for(let t=1;t<e.length;t++)T(e[t],n)>0&&(n=e[t]);return n}function Ro(e,n,t){return T(e,n)<0?n:T(e,t)>0?t:e}function Io(e,n,t){return T(e,n)>=0&&T(e,t)<=0}function H(e){let n=A(e);return{year:n.year,month:n.month,day:n.day}}function Ri(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function _n(e,n){return e.year===n.year&&e.month===n.month&&e.day===n.day}function Oo(e,n){return _n(H(e),H(n))}function Po(e){return _n(H(e),Ri())}function Ii(){let e=new Date;return e.setDate(e.getDate()+1),{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function Oi(){let e=new Date;return e.setDate(e.getDate()-1),{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function No(e){return _n(H(e),Ii())}function Co(e){return _n(H(e),Oi())}function Pi(e,n,t,r,o,a){let u=(d,f,h)=>{let w=f<=2?d-1:d,M=(w>=0?w:w-399)/400|0,b=w-M*400,E=f>2?f-3:f+9,k=Math.floor(Math.floor(153*E+2)/5+h-1),N=b*365+Math.floor(b/4)-Math.floor(b/100)+k;return M*146097+N-719468},i=u(e,n,t),m=u(r,o,a);if(Math.abs(i-m)>=7)return!1;let l=(d,f,h)=>{let w=u(d,f,h),b=new Date(Date.UTC(d,f-1,h)).getUTCDay();return b===0?7:b},c=i-(l(e,n,t)-1),p=m-(l(r,o,a)-1);return c===p}function Ao(e,n){let t=H(e),r=H(n);return Pi(t.year,t.month,t.day,r.year,r.month,r.day)}function Lo(e,n){let t=H(e),r=H(n);return t.year===r.year&&t.month===r.month}function zo(e,n){let t=H(e),r=H(n);return t.year===r.year&&Math.ceil(t.month/3)===Math.ceil(r.month/3)}function Uo(e,n){return H(e).year===H(n).year}function xt(e){if(typeof e!="object"||e===null)throw new Error(`temporal-fmt: isWeekend() expected a Temporal value, got ${String(e)}.`);let n=e;if(typeof n.dayOfWeek!="number")throw new Error("temporal-fmt: isWeekend() needs a value with a dayOfWeek field (PlainDate / PlainDateTime / ZonedDateTime).");return n.dayOfWeek===6||n.dayOfWeek===7}function Ho(e){return!xt(e)}var V={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1};function Ni(e,n,t){let r=e<0?-1:1,a=Math.abs(e)/t,s;switch(n){case"nearest":s=Math.round(a);break;case"floor":s=Math.floor(a);break;case"ceil":s=Math.ceil(a);break;case"trunc":s=Math.trunc(a);break}return r*s*t}function Ci(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return(a*146097+m-719468)*V.day+(e.hour??0)*V.hour+(e.minute??0)*V.minute+(e.second??0)*V.second+(e.millisecond??0)}function Ai(e,n){let t=V.day,r=Math.floor(e/t),o=e-r*t;o<0&&(o+=t);let a=Math.floor(o/V.hour),s=Math.floor(o%V.hour/V.minute),u=Math.floor(o%V.minute/V.second),i=o%V.second,m=r+719468,l=Math.floor((m>=0?m:m-146096)/146097),c=m-l*146097,p=Math.floor((c-Math.floor(c/1460)+Math.floor(c/36524)-Math.floor(c/146096))/365),d=p+l*400,f=c-(365*p+Math.floor(p/4)-Math.floor(p/100)),h=Math.floor((5*f+2)/153),w=f-Math.floor((153*h+2)/5)+1,M=h<10?h+3:h-9,b=M<=2?d+1:d;return{...n,year:b,month:M,day:w,hour:a,minute:s,second:u,millisecond:i}}function tn(e,n){let t=A(e),r=n.mode??"nearest",o=(n.roundingIncrement??1)*V[n.unit];if(o<=0)throw new Error(`temporal-fmt: round() requires a positive roundingIncrement (got ${n.roundingIncrement}).`);let a=Ci(t),s=Ni(a,r,o);return Ai(s,t)}function Zo(e,n,t=1){return tn(e,{unit:n,mode:"floor",roundingIncrement:t})}function Yo(e,n,t=1){return tn(e,{unit:n,mode:"ceil",roundingIncrement:t})}function Vo(e,n,t=1){return tn(e,{unit:n,mode:"trunc",roundingIncrement:t})}function rn(e,n,t){if(Number.isInteger(e))return BigInt(e)*n;let r=e*Number(n);if(Number.isSafeInteger(r))return BigInt(r);throw new W({reason:`field "${t}" (${e}) cannot be converted to nanoseconds exactly \u2014 the value is too large for a fractional unit; use smaller units`})}var Et={years:0n,months:0n,weeks:0n,days:86400n*1000000000n,hours:3600n*1000000000n,minutes:60n*1000000000n,seconds:1000000000n,milliseconds:1000000n,microseconds:1000n,nanoseconds:1n};function Li(e){return e==="years"||e==="months"||e==="weeks"}function $n(e,n){let t=n.mode??"nearest",r=BigInt(n.roundingIncrement??1);if(r<=0n)throw new Error(`temporal-fmt: roundDuration() requires a positive roundingIncrement (got ${n.roundingIncrement}).`);if(Li(n.unit))throw new Error(`temporal-fmt: roundDuration() to "${n.unit}" requires a Temporal.Duration with a relativeTo \u2014 this helper operates on plain field bags without calendar context. Use Temporal.Duration.prototype.round() directly.`);let o=0n;for(let w of["days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"]){let M=e[w]??0;o+=rn(M,Et[w],w)}let a=r*Et[n.unit],s=o<0n?-1n:1n,u=o<0n?-o:o,i=u/a,m=u%a,l;switch(t){case"nearest":l=m*2n>=a?i+1n:i;break;case"floor":l=i;break;case"ceil":l=m>0n?i+1n:i;break;case"trunc":l=i;break}let c=s*l*a,p={...e},d=c,f=["days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"],h=f.indexOf(n.unit);for(let w=h+1;w<f.length;w++)p[f[w]]=0;for(let w=0;w<=h;w++){let M=f[w],b=Et[M];if(b===0n)continue;let E=d/b;d-=E*b,p[M]=Number(E)}return p}function Rn(e){let n=R();try{if(/^\d{4}-\d{2}-\d{2}T/.test(e)||/T\d{2}:\d{2}/.test(e)){if(/[zZ]$/.test(e)||/[+-]\d{2}:?\d{2}$/.test(e)){let t=e;if(/[zZ]$/.test(t))t=t.slice(0,-1)+"+00:00[UTC]";else{let r=/([+-]\d{2}:?\d{2})$/.exec(t);r&&(t=`${t}[${r[1]}]`)}return n.ZonedDateTime.from(t,{overflow:"reject"})}return n.PlainDateTime.from(e,{overflow:"reject"})}if(/^\d{4}-\d{2}-\d{2}/.test(e))return n.PlainDate.from(e,{overflow:"reject"});if(/^\d{2}:\d{2}/.test(e))return n.PlainTime.from(e);throw new Error(`temporal-fmt: parseISO("${e}") doesn't look like an ISO 8601 string.`)}catch(t){throw new z({input:e,reason:t.message})}}function Ft(e){let n=e;if(typeof n?.toString!="function")throw new y({reason:`formatISO() expects a Temporal value with toString(), got ${typeof e}.`});return n.toString()}function Wo(e){if(!/^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/.exec(e))throw new y({input:e,reason:"does not match RFC 3339 date-time grammar"});let r=e.replace(/[tT]/,"T").replace(/[zZ]$/,"+00:00[UTC]");return Rn(r)}function Xo(e){let n=Ft(e);if(!/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$/.test(n))throw new y({input:n,reason:"value did not produce RFC 3339-compliant output"});return n}function jo(e){if(!/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s+)?\d{1,2}\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{2,4}\s+\d{2}:\d{2}(?::\d{2})?\s+(?:[+-]\d{4}|[A-Za-z]{1,5})$/.test(e.trim()))throw new y({input:e,reason:"not a valid RFC 2822 date"});let t=Date.parse(e);if(Number.isNaN(t))throw new y({input:e,reason:"not a valid RFC 2822 date"});return ze().fromEpochMilliseconds(t)}function Go(e){let n=e,t;if(typeof n?.toEpochMilliseconds=="function")t=n.toEpochMilliseconds();else if(typeof n?.epochMilliseconds=="number")t=n.epochMilliseconds;else if(typeof n?.toInstant=="function"){let r=n.toInstant();typeof r.epochMilliseconds=="number"&&(t=r.epochMilliseconds)}if(t===void 0)throw new y({reason:`formatRFC2822() expects a value with epochMilliseconds, toEpochMilliseconds(), or toInstant(), got ${typeof e}.`});return zi(t)}function zi(e){try{let t=new Intl.DateTimeFormat("en-US",{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:"UTC",timeZoneName:"shortOffset",hour12:!1}).formatToParts(new Date(e)),r=i=>t.find(m=>m.type===i)?.value??"",a=r("timeZoneName")?.match(/GMT([+-])(\d+)(?::(\d+))?/),s;if(a){let i=a[1],m=a[2].padStart(2,"0"),l=(a[3]??"0").padStart(2,"0");s=`${i}${m}${l}`;/* c8 ignore start @preserve -- timeZone is hardcoded to 'UTC' above,
131
131
  which always resolves cleanly, so shortOffset always returns a
132
132
  parseable "GMT+0"-shaped string in this environment's ICU. This
133
133
  branch only guards against an ICU build whose shortOffset output
@@ -142,12 +142,12 @@
142
142
  user input reaches the constructor or formatToParts call, so this
143
143
  catch can't be triggered through the public API in a normal Intl
144
144
  environment (e.g. Node with full-icu). Kept as a genuine fallback
145
- for runtimes with a broken or absent Intl implementation. */}catch{let n=new Date(e),t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=t[n.getUTCDay()],a=String(n.getUTCDate()).padStart(2,"0"),s=r[n.getUTCMonth()],u=n.getUTCFullYear(),i=String(n.getUTCHours()).padStart(2,"0"),m=String(n.getUTCMinutes()).padStart(2,"0"),l=String(n.getUTCSeconds()).padStart(2,"0");return`${o}, ${a} ${s} ${u} ${i}:${m}:${l} +0000`}/* c8 ignore stop @preserve */}function Go(e){let n=e.trim(),t=Date.parse(n);if(Number.isNaN(t))throw new y({input:e,reason:"not a valid HTTP-date"});return ze().fromEpochMilliseconds(t)}function Bo(e){let n=e?.toInstant?.()??e,t=typeof n=="object"&&n!==null&&"epochMilliseconds"in n?n.epochMilliseconds:(()=>{throw new y({reason:`formatHTTPDate() expects an Instant or ZonedDateTime, got ${typeof e}.`})})(),r=new Date(t),o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=o[r.getUTCDay()],u=String(r.getUTCDate()).padStart(2,"0"),i=a[r.getUTCMonth()],m=r.getUTCFullYear(),l=String(r.getUTCHours()).padStart(2,"0"),c=String(r.getUTCMinutes()).padStart(2,"0"),p=String(r.getUTCSeconds()).padStart(2,"0");return`${s}, ${u} ${i} ${m} ${l}:${c}:${p} GMT`}function On(e){let n=e;if(typeof n?.toInstant=="function"){let t=n.toInstant();return typeof t.epochNanoseconds=="bigint"?{epochMilliseconds:t.epochMilliseconds,epochNanoseconds:t.epochNanoseconds}:{epochMilliseconds:t.epochMilliseconds,epochNanoseconds:BigInt(t.epochMilliseconds)*1000000n}}if(typeof n?.epochNanoseconds=="bigint")return{epochMilliseconds:Number(n.epochNanoseconds/1000000n),epochNanoseconds:n.epochNanoseconds};if(typeof n?.epochMilliseconds=="number")return{epochMilliseconds:n.epochMilliseconds,epochNanoseconds:BigInt(n.epochMilliseconds)*1000000n};throw new y({reason:`expected an Instant or ZonedDateTime, got ${typeof e}.`})}function ze(){let e=R().Instant;if(!e)throw new Error("temporal-fmt: Temporal.Instant is not available in this implementation.");return e}function qo(e){return On(e).epochMilliseconds/1e3}function Ko(e){return ze().fromEpochMilliseconds(e*1e3)}function Qo(e){return ze().fromEpochMilliseconds(e)}function Jo(e){return ze().fromEpochNanoseconds(BigInt(e)*1000n)}function ea(e){return ze().fromEpochNanoseconds(e)}function na(e){return On(e).epochMilliseconds}function ta(e){let{epochNanoseconds:n}=On(e);return Number(n/1000n)}function ra(e){return On(e).epochNanoseconds}function oa(e){let n=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n))return ge("yyyy-MM-dd",n);if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(n))return ge("yyyy-MM-dd HH:mm:ss",n);if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(n))return In(n);throw new y({input:e,reason:"not a recognized SQL date/time format"})}function aa(e){return typeof e?.hour=="number"?Q(e,"yyyy-MM-dd HH:mm:ss"):Q(e,"yyyy-MM-dd")}function ia(e,n,t={}){return rt(e,n,t).map(r=>r.kind==="token"?{type:"token",value:r.value,token:r.token}:{type:"literal",value:r.value})}function ua(e){let t=/^P(?:(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/.exec(e);if(!t)throw new W({input:e,reason:"does not match ISO 8601 duration grammar (P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S)"});if(t.slice(1).every(o=>o===void 0))throw new W({input:e,reason:'duration has no fields (use "P0D" for zero duration)'});let r=o=>o===void 0?0:Number(o);return{years:r(t[1]),months:r(t[2]),weeks:r(t[3]),days:r(t[4]),hours:r(t[5]),minutes:r(t[6]),seconds:r(t[7])}}function la(e){let n=["P"],t=e.years??0,r=e.months??0,o=e.weeks??0,a=e.days??0,s=e.hours??0,u=e.minutes??0,i=e.seconds??0;return t&&n.push(`${t}Y`),r&&n.push(`${r}M`),o&&n.push(`${o}W`),a&&n.push(`${a}D`),(s||u||i)&&(n.push("T"),s&&n.push(`${s}H`),u&&n.push(`${u}M`),i&&n.push(`${i}S`)),n.length===1&&n.push("0D"),n.join("")}function Li(e){let n=["y","o","w","d","h","m","s","S"].flatMap(o=>[o+o+o,o+o,o]).sort((o,a)=>a.length-o.length),t=[],r=0;for(;r<e.length;){let o=e[r];if(o==="'"){if(e[r+1]==="'"){_t(t,"'"),r+=2;continue}let s=r+1,u="",i=!1;for(;s<e.length;){if(e[s]==="'"){if(e[s+1]==="'"){u+="'",s+=2;continue}i=!0,s+=1;break}u+=e[s],s+=1}if(!i)throw new y({format:e,reason:"unterminated quote"});_t(t,u),r=s;continue}let a=n.find(s=>e.startsWith(s,r));if(a){t.push({kind:"token",value:a,unit:a[0]}),r+=a.length;continue}_t(t,o),r+=1}return t}function _t(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}function ma(e,n,t={}){let r=Li(n),o={},a=[],s="";for(let m of r)if(m.kind==="literal")s+=m.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else{let l=m.unit,c=m.value.length===1?"numeric":m.value.length===2?"short":"long";/* c8 ignore start @preserve -- the final `: null` branch, and the
145
+ for runtimes with a broken or absent Intl implementation. */}catch{let n=new Date(e),t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=t[n.getUTCDay()],a=String(n.getUTCDate()).padStart(2,"0"),s=r[n.getUTCMonth()],u=n.getUTCFullYear(),i=String(n.getUTCHours()).padStart(2,"0"),m=String(n.getUTCMinutes()).padStart(2,"0"),l=String(n.getUTCSeconds()).padStart(2,"0");return`${o}, ${a} ${s} ${u} ${i}:${m}:${l} +0000`}/* c8 ignore stop @preserve */}function Bo(e){let n=e.trim(),t=Date.parse(n);if(Number.isNaN(t))throw new y({input:e,reason:"not a valid HTTP-date"});return ze().fromEpochMilliseconds(t)}function qo(e){let n=e?.toInstant?.()??e,t=typeof n=="object"&&n!==null&&"epochMilliseconds"in n?n.epochMilliseconds:(()=>{throw new y({reason:`formatHTTPDate() expects an Instant or ZonedDateTime, got ${typeof e}.`})})(),r=new Date(t),o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=o[r.getUTCDay()],u=String(r.getUTCDate()).padStart(2,"0"),i=a[r.getUTCMonth()],m=r.getUTCFullYear(),l=String(r.getUTCHours()).padStart(2,"0"),c=String(r.getUTCMinutes()).padStart(2,"0"),p=String(r.getUTCSeconds()).padStart(2,"0");return`${s}, ${u} ${i} ${m} ${l}:${c}:${p} GMT`}function In(e){let n=e;if(typeof n?.toInstant=="function"){let t=n.toInstant();return typeof t.epochNanoseconds=="bigint"?{epochMilliseconds:t.epochMilliseconds,epochNanoseconds:t.epochNanoseconds}:{epochMilliseconds:t.epochMilliseconds,epochNanoseconds:BigInt(t.epochMilliseconds)*1000000n}}if(typeof n?.epochNanoseconds=="bigint")return{epochMilliseconds:Number(n.epochNanoseconds/1000000n),epochNanoseconds:n.epochNanoseconds};if(typeof n?.epochMilliseconds=="number")return{epochMilliseconds:n.epochMilliseconds,epochNanoseconds:BigInt(n.epochMilliseconds)*1000000n};throw new y({reason:`expected an Instant or ZonedDateTime, got ${typeof e}.`})}function ze(){let e=R().Instant;if(!e)throw new Error("temporal-fmt: Temporal.Instant is not available in this implementation.");return e}function Ko(e){return In(e).epochMilliseconds/1e3}function Qo(e){return ze().fromEpochMilliseconds(e*1e3)}function Jo(e){return ze().fromEpochMilliseconds(e)}function ea(e){return ze().fromEpochNanoseconds(BigInt(e)*1000n)}function na(e){return ze().fromEpochNanoseconds(e)}function ta(e){return In(e).epochMilliseconds}function ra(e){let{epochNanoseconds:n}=In(e);return Number(n/1000n)}function oa(e){return In(e).epochNanoseconds}function aa(e){let n=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n))return pe("yyyy-MM-dd",n);if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(n))return pe("yyyy-MM-dd HH:mm:ss",n);if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(n))return Rn(n);throw new y({input:e,reason:"not a recognized SQL date/time format"})}function sa(e){return typeof e?.hour=="number"?Q(e,"yyyy-MM-dd HH:mm:ss"):Q(e,"yyyy-MM-dd")}function ua(e,n,t={}){return rt(e,n,t).map(r=>r.kind==="token"?{type:"token",value:r.value,token:r.token}:{type:"literal",value:r.value})}function la(e){let t=/^P(?:(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/.exec(e);if(!t)throw new W({input:e,reason:"does not match ISO 8601 duration grammar (P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S)"});if(t.slice(1).every(o=>o===void 0))throw new W({input:e,reason:'duration has no fields (use "P0D" for zero duration)'});let r=o=>o===void 0?0:Number(o);return{years:r(t[1]),months:r(t[2]),weeks:r(t[3]),days:r(t[4]),hours:r(t[5]),minutes:r(t[6]),seconds:r(t[7])}}function ma(e){let n=["P"],t=e.years??0,r=e.months??0,o=e.weeks??0,a=e.days??0,s=e.hours??0,u=e.minutes??0,i=e.seconds??0;return t&&n.push(`${t}Y`),r&&n.push(`${r}M`),o&&n.push(`${o}W`),a&&n.push(`${a}D`),(s||u||i)&&(n.push("T"),s&&n.push(`${s}H`),u&&n.push(`${u}M`),i&&n.push(`${i}S`)),n.length===1&&n.push("0D"),n.join("")}function Ui(e){let n=["y","o","w","d","h","m","s","S"].flatMap(o=>[o+o+o,o+o,o]).sort((o,a)=>a.length-o.length),t=[],r=0;for(;r<e.length;){let o=e[r];if(o==="'"){if(e[r+1]==="'"){_t(t,"'"),r+=2;continue}let s=r+1,u="",i=!1;for(;s<e.length;){if(e[s]==="'"){if(e[s+1]==="'"){u+="'",s+=2;continue}i=!0,s+=1;break}u+=e[s],s+=1}if(!i)throw new y({format:e,reason:"unterminated quote"});_t(t,u),r=s;continue}let a=n.find(s=>e.startsWith(s,r));if(a){t.push({kind:"token",value:a,unit:a[0]}),r+=a.length;continue}_t(t,o),r+=1}return t}function _t(e,n){let t=e[e.length-1];t&&t.kind==="literal"?t.value+=n:e.push({kind:"literal",value:n})}function ca(e,n,t={}){let r=Ui(n),o={},a=[],s="";for(let m of r)if(m.kind==="literal")s+=m.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else{let l=m.unit,c=m.value.length===1?"numeric":m.value.length===2?"short":"long";/* c8 ignore start @preserve -- the final `: null` branch, and the
146
146
  `if (key === null)` throw it feeds, are both unreachable: tok.unit
147
147
  is always one of the 8 letters in DURATION_TOKEN_STRINGS (the same
148
148
  source set this ternary checks against), so `null` can't be
149
149
  produced by any token the tokenizer emits. Kept as a guard against
150
- a future letter being added to one set without the other. */let p=l==="y"?"years":l==="o"?"months":l==="w"?"weeks":l==="d"?"days":l==="h"?"hours":l==="m"?"minutes":l==="s"?"seconds":l==="S"?"milliseconds":null;if(p===null)throw new y({format:n,token:m.value,reason:"unknown duration token"});/* c8 ignore stop @preserve */c==="numeric"?s+="(-?\\d+)":s+="(\\d+)\\s*\\w*",a.push({unit:p,form:c})}let i=new RegExp(`^${s}$`,"u").exec(e);if(!i)throw new y({input:e,format:n,reason:"does not match duration format"});return a.forEach((m,l)=>{let c=i[l+1],p=Number(c);if(!Number.isFinite(p))throw new W({input:e,reason:`token for ${m.unit} matched "${c}" but isn't a finite number`});o[m.unit]=p}),o}function ca(e){let n=[["days",86400n*1000000000n],["hours",3600n*1000000000n],["minutes",60n*1000000000n],["seconds",1000000000n],["milliseconds",1000000n],["microseconds",1000n],["nanoseconds",1n]],t=0n;for(let[a,s]of n){let u=e[a];typeof u=="number"&&(t+=on(u,s,a))}let r={...e},o=t;for(let[a,s]of n){let u=o/s;o-=u*s,r[a]=Number(u)}return r}function da(e,n){let t={days:86400n*1000000000n,hours:3600n*1000000000n,minutes:60n*1000000000n,seconds:1000000000n,milliseconds:1000000n,microseconds:1000n,nanoseconds:1n},r=0n;for(let a of Object.keys(t)){let s=e[a];typeof s=="number"&&(r+=on(s,t[a],a))}let o=t[n];if(!o)throw new W({reason:`totalDuration() does not support unit "${n}" (calendar-bound units need a relativeTo)`});return Number(r)/Number(o)}function fa(e,n){let t=sa(e),r=sa(n);return t<r?-1:t>r?1:0}function sa(e){let n={days:86400n*1000000000n,hours:3600n*1000000000n,minutes:60n*1000000000n,seconds:1000000000n,milliseconds:1000000n,microseconds:1000n,nanoseconds:1n},t=0n;for(let r of Object.keys(n)){let o=e[r];typeof o=="number"&&(t+=on(o,n[r],r))}return t}function $t(e,n){let t=["years","months","weeks","days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"],r={};for(let o of t)r[o]=(e[o]??0)+(n[o]??0);return r}function pa(e,n){return $t(e,zi(n))}function zi(e){let n={};for(let t of Object.keys(e))n[t]=-(e[t]??0);return n}var an=new Map,Ui=100;function Hi(e,n){let t=`${e}|${n}`,r=an.get(t);if(r)return r;if(an.size>=Ui){let o=an.keys().next().value;o!==void 0&&an.delete(o)}try{r=new Intl.RelativeTimeFormat(U(e),{numeric:n})}catch(o){throw new D({actual:e,reason:o.message})}return an.set(t,r),r}function Rt(e,n,t={}){let r=t.locale??P,o=t.numeric??"auto",a=Hi(r,o),s=-_n(e,n),u=Math.abs(s);return u===0?a.format(0,"day"):u<7?a.format(s,"day"):u<30?a.format(-Math.trunc(-s/7),"week"):u<365?a.format(-Math.trunc(-s/30),"month"):a.format(-Math.trunc(-s/365),"year")}function ha(e,n={}){let t=new Date,r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return Rt(e,r,n)}var It=new Map,ga=256,ya=256;function Ot(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function wa(e,n){if(typeof e!="string"||e.length===0)throw new D({actual:String(e),reason:"locale string must be non-empty"});if(e.length>ga)throw new D({actual:String(e.length),reason:`locale tag must be at most ${ga} characters`});fn(e,n),Zi(n,e);let t=Ot(e);It.set(t,{...n})}function Zi(e,n){let t=(r,o,a)=>{if(r!==void 0){if(!Array.isArray(r))throw new D({actual:String(r),reason:`locale "${n}": "${o}" must be an array`});if(r.length!==a)throw new D({actual:String(r.length),reason:`locale "${n}": "${o}" must have ${a} entries (got ${r.length})`});for(let s=0;s<r.length;s++){if(typeof r[s]!="string"||r[s].length===0)throw new D({actual:String(r[s]),reason:`locale "${n}": "${o}[${s}]" must be a non-empty string`});if(r[s].length>ya)throw new D({actual:String(r[s].length),reason:`locale "${n}": "${o}[${s}]" must be at most ${ya} characters`})}}};t(e.quartersLong,"quartersLong",4),t(e.quartersShort,"quartersShort",4),t(e.erasLong,"erasLong",2),t(e.erasShort,"erasShort",2),t(e.ordinals,"ordinals",4)}function ba(e){let n=Ot(e),t=It.get(n);if(t)return t;try{return{...de(e)}}catch{return}}function ka(e){let n=Ot(e);return It.has(n)}var Pt={locale:P,numberingSystem:"latn",firstDayOfWeek:1,roundingMode:"nearest",disambiguation:"compatible",overflow:"reject",parseLenient:!1,durationShowZeroValues:!1};function Ta(e={}){let n={...Pt,...e};if(typeof n.locale!="string"||n.locale.length===0)throw new Error(`temporal-fmt: config.locale must be a non-empty string (got ${String(n.locale)}).`);if(n.firstDayOfWeek!==1&&n.firstDayOfWeek!==7)throw new Error(`temporal-fmt: config.firstDayOfWeek must be 1 (Monday) or 7 (Sunday) (got ${n.firstDayOfWeek}).`);if(!["nearest","floor","ceil","trunc"].includes(n.roundingMode))throw new Error(`temporal-fmt: config.roundingMode "${n.roundingMode}" is not recognized.`);if(!["compatible","earlier","later","reject"].includes(n.disambiguation))throw new Error(`temporal-fmt: config.disambiguation "${n.disambiguation}" is not recognized.`);if(!["constrain","reject"].includes(n.overflow))throw new Error(`temporal-fmt: config.overflow "${n.overflow}" is not recognized.`);return Object.freeze(n)}function Sa(e,n){if(!e)return n;let t={...n};return t.locale===void 0&&(t.locale=e.locale),t.calendar===void 0&&e.calendar!==void 0&&(t.calendar=e.calendar),t.timezone===void 0&&e.timezone!==void 0&&(t.timezone=e.timezone),t.numberingSystem===void 0&&(t.numberingSystem=e.numberingSystem),t.lenient===void 0&&e.parseLenient&&(t.lenient=!0),t}function Ea(e,n,t="closed"){if(T(e,n)>0)throw new Error("temporal-fmt: interval start must be \u2264 end (got start > end). Pass them in chronological order.");return{start:e,end:n,bounds:t}}function Fa(e,n){let t=T(n,e.start),r=T(n,e.end),o=e.bounds==="open"||e.bounds==="half-open-end"?t>0:t>=0,a=e.bounds==="open"||e.bounds==="half-open-start"?r<0:r<=0;return o&&a}function _a(e,n){return Ee(e,n)}function Ee(e,n){return!(T(e.end,n.start)<0||T(e.start,n.end)>0)}function $a(e,n){return T(e.end,n.start)<0}function Ra(e,n){return T(e.start,n.end)>0}function Ia(e,n){if(!Ee(e,n))return null;let t=T(e.start,n.start)>=0?e.start:n.start,r=T(e.end,n.end)<=0?e.end:n.end,o=e.bounds==="open"||e.bounds==="half-open-end"||n.bounds==="open"||n.bounds==="half-open-end",a=e.bounds==="open"||e.bounds==="half-open-start"||n.bounds==="open"||n.bounds==="half-open-start";return{start:t,end:r,bounds:o&&a?"open":o?"half-open-end":a?"half-open-start":"closed"}}function Oa(e,n){if(!Ee(e,n))return null;let t=T(e.start,n.start)<=0?e.start:n.start,r=T(e.end,n.end)>=0?e.end:n.end,o=(e.bounds==="open"||e.bounds==="half-open-end")&&(n.bounds==="open"||n.bounds==="half-open-end"),a=(e.bounds==="open"||e.bounds==="half-open-start")&&(n.bounds==="open"||n.bounds==="half-open-start");return{start:t,end:r,bounds:o&&a?"open":o?"half-open-end":a?"half-open-start":"closed"}}function Nt(e,n){if(!Ee(e,n))return[e];let t=[],r=e.bounds==="closed"||e.bounds==="half-open-end",o=e.bounds==="closed"||e.bounds==="half-open-start";return T(e.start,n.start)<0&&t.push({start:e.start,end:n.start,bounds:r?"half-open-end":"open"}),T(e.end,n.end)>0&&t.push({start:n.end,end:e.end,bounds:o?"half-open-start":"open"}),t}var Pa=Nt;function Na(e){if(e.length===0)return[];let n=[...e].sort((r,o)=>T(r.start,o.start)),t=[{...n[0]}];for(let r=1;r<n.length;r++){let o=n[r],a=t[t.length-1];Ee(a,o)||T(a.end,o.start)===0?T(o.end,a.end)>0&&(a.end=o.end):t.push(o)}return t}var Da=864e13;function Ca(e,n){if(n<=0)throw new Error(`temporal-fmt: splitInterval requires n > 0 (got ${n}).`);if(n===1)return[e];let t=A(e.start),r=A(e.end),o=va(t),a=va(r);if(Math.abs(o)>Da||Math.abs(a)>Da)throw new RangeError("temporal-fmt: splitInterval() endpoints are outside the representable Date range (approximately \xB1275,760 years). Split the interval into smaller ranges first.");let s=(a-o)/n,u=[];for(let i=0;i<n;i++){let m=o+i*s,l=i===n-1?a:m+s;u.push({start:Ma(m,t),end:Ma(l,r),bounds:i===0?e.bounds:"half-open-start"})}return u}function va(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return(a*146097+m-719468)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}function Ma(e,n){let r=Math.floor(e/864e5),o=e%864e5;o<0&&(o+=864e5);let a=Math.floor(o/36e5),s=Math.floor(o%36e5/6e4),u=Math.floor(o%6e4/1e3),i=o%1e3,m=r*864e5,l=new Date(m);return{...n,year:l.getUTCFullYear(),month:l.getUTCMonth()+1,day:l.getUTCDate(),hour:a,minute:s,second:u,millisecond:i}}function Aa(e,n,t={}){try{let r=Q(e.start,n,t),o=Q(e.end,n,t);return`${r} \u2013 ${o}`}catch(r){try{let o=new Intl.DateTimeFormat(U(t.locale??"en-US"),{}),a=xa(e.start),s=xa(e.end);return o.formatRange(a,s)}catch{throw r}}}function La(e,n,t={}){let r=Ke(e.start,n,t),o=Ke(e.end,n,t),a=[...r];return a.push({type:"literal",value:" \u2013 "}),a.push(...o),a}function xa(e){let n=e;if(typeof n?.toInstant=="function")return new Date(n.toInstant().epochMilliseconds);if(typeof n?.year=="number"&&typeof n?.month=="number"&&typeof n?.day=="number")return new Date(Date.UTC(n.year,n.month-1,n.day,n.hour??0,n.minute??0,n.second??0,n.millisecond??0));throw new Error(`temporal-fmt: formatRange() expected Temporal values with year/month/day, got ${typeof e}.`)}function Ct(e,n){let t=e,r=0,o=[],a=1e4,s=!1,u=!0;function i(p){let d=p;return!(n.byWeekday&&n.byWeekday.length>0&&!n.byWeekday.includes(d.dayOfWeek??0)||n.byMonthDay&&n.byMonthDay.length>0&&!n.byMonthDay.includes(d.day??0)||n.byMonth&&n.byMonth.length>0&&!n.byMonth.includes(d.month??0)||n.exDates&&n.exDates.some(f=>T(f,p)===0))}function m(p,d){let f=n.frequency==="secondly"?"seconds":n.frequency==="minutely"?"minutes":n.frequency==="hourly"?"hours":n.frequency==="daily"?"days":n.frequency==="weekly"?"weeks":n.frequency==="monthly"?"months":"years";return S(p,d*n.interval,f)}function l(p){o.push(p),o.length>a&&o.shift()}function c(p){let d=p,f=0;do{if(d=m(d,1),f++,f>1e3)return s=!0,{value:d,found:!1};if(n.until&&T(d,n.until)>0)return s=!0,{value:d,found:!1}}while(!i(d));return{value:d,found:!0}}return{next(){if(s)return{value:void 0,done:!0};if(u){if(u=!1,i(t))return r++,n.count!==void 0&&r>=n.count&&(s=!0),n.until&&T(t,n.until)>0?(s=!0,{value:void 0,done:!0}):(l(t),{value:t,done:!1});let d=c(t);return d.found?(t=d.value,r++,n.count!==void 0&&r>=n.count&&(s=!0),l(t),{value:t,done:!1}):{value:void 0,done:!0}}let p=c(t);return p.found?(t=p.value,r++,n.count!==void 0&&r>=n.count&&(s=!0),l(t),{value:t,done:!1}):{value:void 0,done:!0}},previous(){return o.length===0?{value:void 0,done:!0}:{value:o.pop(),done:!1}}}}function Ua(e,n){let t=[];for(let r=0;r<n;r++){let o=e.next();if(o.done)break;t.push(o.value)}return t}var za=1e5;function Ha(e,n){for(let r=0;r<n&&!e.next().done;r++);let t=[];for(;t.length<za;){let r=e.next();if(r.done)return t;t.push(r.value)}throw new RangeError(`temporal-fmt: skip() collected ${za} occurrences and the rule is still producing \u2014 add a count or until to the rule, or use take(iter, n) for a bounded read.`)}function Za(e,n,t,r){let o=Ct(e,n),a=[];for(;;){let s=o.next();if(s.done||T(s.value,r)>=0)break;T(s.value,t)>=0&&a.push(s.value)}return a}function Ya(e){let n=e.trim().toUpperCase().replace(/^RRULE:/,"").split(";"),t={frequency:"daily",interval:1},r=new Set(["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"]);for(let o of n){if(!o)continue;let a=o.indexOf("=");if(a<0)continue;let s=o.slice(0,a),u=o.slice(a+1);switch(s){case"FREQ":if(!r.has(u))throw new RangeError(`temporal-fmt: unsupported RRULE frequency "${u}".`);t.frequency=u.toLowerCase();break;case"INTERVAL":{let i=Number(u);if(!Number.isSafeInteger(i)||i<1)throw new RangeError(`temporal-fmt: RRULE INTERVAL must be a positive safe integer (got "${u}").`);t.interval=i;break}case"COUNT":{let i=Number(u);if(!Number.isSafeInteger(i)||i<1)throw new RangeError(`temporal-fmt: RRULE COUNT must be a positive safe integer (got "${u}").`);t.count=i;break}case"UNTIL":t.until=u;break;case"BYDAY":t.byWeekday=u.split(",").map(i=>{let m=i.match(/^([+-]?\d)?([A-Z]{2})$/);if(!m)return 0;let l=m[2];return{MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:7}[l]??0});break;case"BYMONTHDAY":{let i=u.split(",").map(Number);if(i.some(m=>!Number.isInteger(m)||m===0||m<-31||m>31))throw new RangeError("temporal-fmt: RRULE BYMONTHDAY contains an out-of-range value.");t.byMonthDay=i;break}case"BYMONTH":{let i=u.split(",").map(Number);if(i.some(m=>!Number.isInteger(m)||m<1||m>12))throw new RangeError("temporal-fmt: RRULE BYMONTH contains an out-of-range value.");t.byMonth=i;break}}}return t}function Va(e){let n=[`FREQ=${e.frequency.toUpperCase()}`];if(e.interval!==1&&n.push(`INTERVAL=${e.interval}`),e.count!==void 0&&n.push(`COUNT=${e.count}`),e.until!==void 0&&n.push(`UNTIL=${String(e.until)}`),e.byWeekday&&e.byWeekday.length>0){let t={1:"MO",2:"TU",3:"WE",4:"TH",5:"FR",6:"SA",7:"SU"};n.push(`BYDAY=${e.byWeekday.map(r=>t[r]).join(",")}`)}return e.byMonthDay&&e.byMonthDay.length>0&&n.push(`BYMONTHDAY=${e.byMonthDay.join(",")}`),e.byMonth&&e.byMonth.length>0&&n.push(`BYMONTH=${e.byMonth.join(",")}`),n.join(";")}function ja(e={}){let n=new Set(e.weekend??[6,7]),t={...e.workingHours??{}};for(let r=1;r<=7;r++)t[r]===void 0&&(t[r]=n.has(r)?0:8);return{weekend:n,holidays:e.holidays,workingHours:t,halfDays:new Set(e.halfDays??[])}}function sn(e,n){let t=n,r=t.dayOfWeek;if(typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"){let a=new Date(Date.UTC(t.year,t.month-1,t.day)).getUTCDay();r=a===0?7:a}if(typeof r!="number")throw new Error("temporal-fmt: isBusinessDay() needs a value with dayOfWeek (or year/month/day to compute it).");return!(e.weekend.has(r)||e.holidays&&e.holidays.isHoliday(n))}function At(e,n){let t=S(n,1,"days");for(let r=0;r<14;r++){if(sn(e,t))return t;t=S(t,1,"days")}throw new Error("temporal-fmt: nextBusinessDay() gave up after 14 days \u2014 likely a misconfigured calendar (e.g. all days are weekends or holidays).")}function Lt(e,n){let t=S(n,-1,"days");for(let r=0;r<14;r++){if(sn(e,t))return t;t=S(t,-1,"days")}throw new Error("temporal-fmt: previousBusinessDay() gave up after 14 days \u2014 likely a misconfigured calendar.")}var Pn=1e5;function Xa(e){if(!Number.isSafeInteger(e))throw new RangeError(`temporal-fmt: business-day count must be a finite safe integer (got ${e}).`)}function Wa(e,n){let t=e,r=n,o=t.year*1e4+t.month*100+t.day,a=r.year*1e4+r.month*100+r.day;return o-a}function zt(e,n,t){if(Xa(t),t===0)return n;let r=t>0?1:-1,o=Math.abs(t);if(o>Pn)throw new RangeError(`temporal-fmt: addBusinessDays() exceeded the ${Pn}-day limit.`);let a=n;for(let s=0;s<o;s++)a=r>0?At(e,a):Lt(e,a);return a}function Ga(e,n,t){return Xa(t),zt(e,n,-t)}function Ba(e,n,t){let r=Wa(t,n);if(r===0)return 0;let o=r>0?1:-1,a=n,s=0,u=0;for(;Wa(a,t)!==0;){if(a=S(a,o,"days"),u++,u>Pn)throw new RangeError(`temporal-fmt: differenceInBusinessDays() exceeded the ${Pn}-day traversal limit.`);sn(e,a)&&(s+=o)}return s}var qa=5e3;function Ka(e){let n=new Map;function t(r){let o=n.get(r);return o||(o=e.map(a=>{let s;return a.compute?s=a.compute(r):s={month:a.month,day:a.day},{...s,name:a.name}}),n.set(r,o),o)}return{isHoliday(r){let o=r;if(typeof o.year!="number"||typeof o.month!="number"||typeof o.day!="number")throw new Error("temporal-fmt: isHoliday() needs a value with year/month/day.");return t(o.year).some(s=>s.month===o.month&&s.day===o.day)},holidaysBetween(r,o){let a=r,s=o;if(typeof a?.year!="number"||typeof s?.year!="number")throw new Error("temporal-fmt: holidaysBetween() needs start/end values with year/month/day.");if(s.year-a.year>qa)throw new RangeError(`temporal-fmt: holidaysBetween() year range (${a.year}\u2013${s.year}) exceeds the ${qa}-year limit. Split the query into smaller ranges.`);let u=[];for(let i=a.year;i<=s.year;i++){let m=t(i);for(let l of m){let c={year:i,month:l.month,day:l.day};T(c,a)>=0&&T(c,s)<=0&&u.push({year:i,month:l.month,day:l.day})}}return u}}}function Qa(e,n){let t=S(n,1,"days");for(let r=0;r<365*5;r++){if(e.isHoliday(t))return t;t=S(t,1,"days")}}function Ja(e,n){let t=S(n,-1,"days");for(let r=0;r<365*5;r++){if(e.isHoliday(t))return t;t=S(t,-1,"days")}}function es(e,n,t){return e.holidaysBetween(n,t)}function ns(e,n,t={}){let r=R(),o=t.disambiguation??"compatible",s={overflow:t.overflow??"constrain",disambiguation:o,offset:t.offset??"prefer"};try{return r.ZonedDateTime.from({year:e.year,month:e.month,day:e.day,hour:e.hour??0,minute:e.minute??0,second:e.second??0,millisecond:e.millisecond??0,microsecond:e.microsecond??0,nanosecond:e.nanosecond??0,timeZone:n},s)}catch(u){let i=u.message;throw/no such (wall-clock )?time/i.test(i)&&o==="reject"?new Error(`temporal-fmt: "${n}" has no such wall-clock time on ${e.year}-${e.month}-${e.day}T${e.hour??0}:${e.minute??0} \u2014 it falls in a DST gap. Pass { disambiguation: 'compatible' | 'earlier' | 'later' } to pick an instant.`):u}}function ts(e){let n=e;if(typeof n?.timeZoneId!="string")throw new Error(`temporal-fmt: getTimeZone() expected a ZonedDateTime, got ${typeof e}.`);return n.timeZoneId}function rs(e){let n=e;if(typeof n?.offset!="string")throw new Error(`temporal-fmt: getOffset() expected a ZonedDateTime, got ${typeof e}.`);return n.offset}function os(e){let n=e;if(typeof n?.offsetNanoseconds=="number")return n.offsetNanoseconds;if(typeof n?.offset=="string"){let t=n.offset.match(/^([+-])(\d{2}):(\d{2})$/);if(!t)throw new Error(`temporal-fmt: getOffsetNanoseconds() couldn't parse offset "${n.offset}".`);return(t[1]==="-"?-1:1)*(Number(t[2])*3600+Number(t[3])*60)*1e9}throw new Error(`temporal-fmt: getOffsetNanoseconds() expected a ZonedDateTime, got ${typeof e}.`)}function as(e){let n=e;if(typeof n?.timeZoneId!="string"||typeof n?.offset!="string"||typeof n?.year!="number")throw new Error(`temporal-fmt: isDST() expected a ZonedDateTime, got ${typeof e}.`);let t=R();try{return t.ZonedDateTime.from({year:n.year,month:1,day:1,hour:12,timeZone:n.timeZoneId},{disambiguation:"compatible"}).offset!==n.offset}catch{return!1}}function ss(e){return us(e,1)}function is(e){return us(e,-1)}function us(e,n){let t=e;if(typeof t?.timeZoneId!="string")throw new Error(`temporal-fmt: ${n>0?"getNextTransition":"getPreviousTransition"}() expected a ZonedDateTime, got ${typeof e}.`);let r=R(),o=t.timeZoneId,a=S(e,n,"days"),s=t.offset;for(let u=0;u<365*2;u++){let i=a,m=r.ZonedDateTime.from({...i,timeZone:o},{disambiguation:"compatible"});if(m.offset!==s)return m;a=S(a,n,"days")}}function ls(e,n){let t=[],r=e;if(typeof r?.timeZoneId!="string")throw new Error(`temporal-fmt: getTransitions() expected a ZonedDateTime for start, got ${typeof e}.`);let o=n,a=R(),s=r.timeZoneId,u=S(e,1,"days"),i=r.offset;for(let m=0;m<365*5;m++){let l=u,c=a.ZonedDateTime.from({...l,timeZone:s},{disambiguation:"compatible"});if(c.offset!==i){if(c.year>o.year||c.year===o.year&&(c.month>o.month||c.month===o.month&&c.day>o.day))break;t.push(c),i=c.offset}u=S(u,1,"days")}return t}function ms(e,n){let t=R(),r=t.ZonedDateTime.from({...e,timeZone:n},{disambiguation:"earlier",offset:"ignore"}),o=t.ZonedDateTime.from({...e,timeZone:n},{disambiguation:"later",offset:"ignore"}),a=s=>s.year===e.year&&s.month===e.month&&s.day===e.day&&s.hour===e.hour&&s.minute===e.minute&&s.second===e.second&&s.millisecond===e.millisecond;return!a(r)||!a(o)?[]:r.toInstant().epochNanoseconds===o.toInstant().epochNanoseconds?[r]:[r,o]}function cs(e={}){let n=[...pe],t=new Set;for(let i of e.tokens??[])t.add(i.name);for(let i of e.tokens??[]){let m=n.findIndex(([l])=>l===i.name);m>=0?n[m]=[i.name,i.handler,i.field]:n.push([i.name,i.handler,i.field])}n.sort((i,m)=>m[0].length-i[0].length);let r=new Map(n.map(([i,m,l])=>[i,{handler:m,field:l}])),o=n.map(([i])=>i);function a(i){let m=[],l=0;for(;l<i.length;){let c=i[l];if(c==="'"){if(i[l+1]==="'"){s(m,"'"),l+=2;continue}let d=l+1,f="",h=!1;for(;d<i.length;){if(i[d]==="'"){if(i[d+1]==="'"){f+="'",d+=2;continue}h=!0,d+=1;break}f+=i[d],d+=1}if(!h)throw new Error(`temporal-fmt: unterminated quote in format string "${i}"`);s(m,f),l=d;continue}let p=o.find(d=>i.startsWith(d,l));if(p){let d=p[p.length-1];if(i[l+p.length]===d){let f=l+p.length;for(;i[f]===d;)f+=1;throw new O({token:i.slice(l,f),format:i,message:`temporal-fmt: "${i.slice(l,f)}" in format string "${i}" isn't a recognized token \u2014 did you mean "${p}"?`})}m.push({kind:"token",value:p}),l+=p.length;continue}s(m,c),l+=1}return m}function s(i,m){let l=i[i.length-1];l&&l.kind==="literal"?l.value+=m:i.push({kind:"literal",value:m})}let u=e.defaultLocale??P;return{format(i,m,l={}){if(m.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${m.length}).`);let c=l.locale??u,p=a(m),d="";for(let f of p){if(f.kind==="literal"){d+=f.value;continue}let h=r.get(f.value);/* c8 ignore start @preserve -- unreachable: customTokenize only ever produces a
150
+ a future letter being added to one set without the other. */let p=l==="y"?"years":l==="o"?"months":l==="w"?"weeks":l==="d"?"days":l==="h"?"hours":l==="m"?"minutes":l==="s"?"seconds":l==="S"?"milliseconds":null;if(p===null)throw new y({format:n,token:m.value,reason:"unknown duration token"});/* c8 ignore stop @preserve */c==="numeric"?s+="(-?\\d+)":s+="(\\d+)\\s*\\w*",a.push({unit:p,form:c})}let i=new RegExp(`^${s}$`,"u").exec(e);if(!i)throw new y({input:e,format:n,reason:"does not match duration format"});return a.forEach((m,l)=>{let c=i[l+1],p=Number(c);if(!Number.isFinite(p))throw new W({input:e,reason:`token for ${m.unit} matched "${c}" but isn't a finite number`});o[m.unit]=p}),o}function da(e){let n=[["days",86400n*1000000000n],["hours",3600n*1000000000n],["minutes",60n*1000000000n],["seconds",1000000000n],["milliseconds",1000000n],["microseconds",1000n],["nanoseconds",1n]],t=0n;for(let[a,s]of n){let u=e[a];typeof u=="number"&&(t+=rn(u,s,a))}let r={...e},o=t;for(let[a,s]of n){let u=o/s;o-=u*s,r[a]=Number(u)}return r}function fa(e,n){let t={days:86400n*1000000000n,hours:3600n*1000000000n,minutes:60n*1000000000n,seconds:1000000000n,milliseconds:1000000n,microseconds:1000n,nanoseconds:1n},r=0n;for(let a of Object.keys(t)){let s=e[a];typeof s=="number"&&(r+=rn(s,t[a],a))}let o=t[n];if(!o)throw new W({reason:`totalDuration() does not support unit "${n}" (calendar-bound units need a relativeTo)`});return Number(r)/Number(o)}function pa(e,n){let t=ia(e),r=ia(n);return t<r?-1:t>r?1:0}function ia(e){let n={days:86400n*1000000000n,hours:3600n*1000000000n,minutes:60n*1000000000n,seconds:1000000000n,milliseconds:1000000n,microseconds:1000n,nanoseconds:1n},t=0n;for(let r of Object.keys(n)){let o=e[r];typeof o=="number"&&(t+=rn(o,n[r],r))}return t}function $t(e,n){let t=["years","months","weeks","days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"],r={};for(let o of t)r[o]=(e[o]??0)+(n[o]??0);return r}function ha(e,n){return $t(e,Hi(n))}function Hi(e){let n={};for(let t of Object.keys(e))n[t]=-(e[t]??0);return n}var on=new Map,Zi=100;function Yi(e,n){let t=`${e}|${n}`,r=on.get(t);if(r)return r;if(on.size>=Zi){let o=on.keys().next().value;o!==void 0&&on.delete(o)}try{r=new Intl.RelativeTimeFormat(U(e),{numeric:n})}catch(o){throw new D({actual:e,reason:o.message})}return on.set(t,r),r}function Rt(e,n,t={}){let r=t.locale??P,o=t.numeric??"auto",a=Yi(r,o),s=-Fn(e,n),u=Math.abs(s);return u===0?a.format(0,"day"):u<7?a.format(s,"day"):u<30?a.format(-Math.trunc(-s/7),"week"):u<365?a.format(-Math.trunc(-s/30),"month"):a.format(-Math.trunc(-s/365),"year")}function ga(e,n={}){let t=new Date,r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return Rt(e,r,n)}var It=new Map,ya=256,wa=256;function Ot(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function ba(e,n){if(typeof e!="string"||e.length===0)throw new D({actual:String(e),reason:"locale string must be non-empty"});if(e.length>ya)throw new D({actual:String(e.length),reason:`locale tag must be at most ${ya} characters`});cn(e,n),Vi(n,e);let t=Ot(e);It.set(t,{...n})}function Vi(e,n){let t=(r,o,a)=>{if(r!==void 0){if(!Array.isArray(r))throw new D({actual:String(r),reason:`locale "${n}": "${o}" must be an array`});if(r.length!==a)throw new D({actual:String(r.length),reason:`locale "${n}": "${o}" must have ${a} entries (got ${r.length})`});for(let s=0;s<r.length;s++){if(typeof r[s]!="string"||r[s].length===0)throw new D({actual:String(r[s]),reason:`locale "${n}": "${o}[${s}]" must be a non-empty string`});if(r[s].length>wa)throw new D({actual:String(r[s].length),reason:`locale "${n}": "${o}[${s}]" must be at most ${wa} characters`})}}};t(e.quartersLong,"quartersLong",4),t(e.quartersShort,"quartersShort",4),t(e.erasLong,"erasLong",2),t(e.erasShort,"erasShort",2),t(e.ordinals,"ordinals",4)}function ka(e){let n=Ot(e),t=It.get(n);if(t)return t;try{return{...be(e)}}catch{return}}function Ta(e){let n=Ot(e);return It.has(n)}var Pt={locale:P,numberingSystem:"latn",firstDayOfWeek:1,roundingMode:"nearest",disambiguation:"compatible",overflow:"reject",parseLenient:!1,durationShowZeroValues:!1};function Sa(e={}){let n={...Pt,...e};if(typeof n.locale!="string"||n.locale.length===0)throw new Error(`temporal-fmt: config.locale must be a non-empty string (got ${String(n.locale)}).`);if(n.firstDayOfWeek!==1&&n.firstDayOfWeek!==7)throw new Error(`temporal-fmt: config.firstDayOfWeek must be 1 (Monday) or 7 (Sunday) (got ${n.firstDayOfWeek}).`);if(!["nearest","floor","ceil","trunc"].includes(n.roundingMode))throw new Error(`temporal-fmt: config.roundingMode "${n.roundingMode}" is not recognized.`);if(!["compatible","earlier","later","reject"].includes(n.disambiguation))throw new Error(`temporal-fmt: config.disambiguation "${n.disambiguation}" is not recognized.`);if(!["constrain","reject"].includes(n.overflow))throw new Error(`temporal-fmt: config.overflow "${n.overflow}" is not recognized.`);return Object.freeze(n)}function Da(e,n){if(!e)return n;let t={...n};return t.locale===void 0&&(t.locale=e.locale),t.calendar===void 0&&e.calendar!==void 0&&(t.calendar=e.calendar),t.timezone===void 0&&e.timezone!==void 0&&(t.timezone=e.timezone),t.numberingSystem===void 0&&(t.numberingSystem=e.numberingSystem),t.lenient===void 0&&e.parseLenient&&(t.lenient=!0),t}function Fa(e,n,t="closed"){if(T(e,n)>0)throw new Error("temporal-fmt: interval start must be \u2264 end (got start > end). Pass them in chronological order.");return{start:e,end:n,bounds:t}}function _a(e,n){let t=T(n,e.start),r=T(n,e.end),o=e.bounds==="open"||e.bounds==="half-open-end"?t>0:t>=0,a=e.bounds==="open"||e.bounds==="half-open-start"?r<0:r<=0;return o&&a}function $a(e,n){return xe(e,n)}function xe(e,n){return!(T(e.end,n.start)<0||T(e.start,n.end)>0)}function Ra(e,n){return T(e.end,n.start)<0}function Ia(e,n){return T(e.start,n.end)>0}function Oa(e,n){if(!xe(e,n))return null;let t=T(e.start,n.start)>=0?e.start:n.start,r=T(e.end,n.end)<=0?e.end:n.end,o=e.bounds==="open"||e.bounds==="half-open-end"||n.bounds==="open"||n.bounds==="half-open-end",a=e.bounds==="open"||e.bounds==="half-open-start"||n.bounds==="open"||n.bounds==="half-open-start";return{start:t,end:r,bounds:o&&a?"open":o?"half-open-end":a?"half-open-start":"closed"}}function Pa(e,n){if(!xe(e,n))return null;let t=T(e.start,n.start)<=0?e.start:n.start,r=T(e.end,n.end)>=0?e.end:n.end,o=(e.bounds==="open"||e.bounds==="half-open-end")&&(n.bounds==="open"||n.bounds==="half-open-end"),a=(e.bounds==="open"||e.bounds==="half-open-start")&&(n.bounds==="open"||n.bounds==="half-open-start");return{start:t,end:r,bounds:o&&a?"open":o?"half-open-end":a?"half-open-start":"closed"}}function Nt(e,n){if(!xe(e,n))return[e];let t=[],r=e.bounds==="closed"||e.bounds==="half-open-end",o=e.bounds==="closed"||e.bounds==="half-open-start";return T(e.start,n.start)<0&&t.push({start:e.start,end:n.start,bounds:r?"half-open-end":"open"}),T(e.end,n.end)>0&&t.push({start:n.end,end:e.end,bounds:o?"half-open-start":"open"}),t}var Na=Nt;function Ca(e){if(e.length===0)return[];let n=[...e].sort((r,o)=>T(r.start,o.start)),t=[{...n[0]}];for(let r=1;r<n.length;r++){let o=n[r],a=t[t.length-1];xe(a,o)||T(a.end,o.start)===0?T(o.end,a.end)>0&&(a.end=o.end):t.push(o)}return t}var va=864e13;function Aa(e,n){if(n<=0)throw new Error(`temporal-fmt: splitInterval requires n > 0 (got ${n}).`);if(n===1)return[e];let t=A(e.start),r=A(e.end),o=Ma(t),a=Ma(r);if(Math.abs(o)>va||Math.abs(a)>va)throw new RangeError("temporal-fmt: splitInterval() endpoints are outside the representable Date range (approximately \xB1275,760 years). Split the interval into smaller ranges first.");let s=(a-o)/n,u=[];for(let i=0;i<n;i++){let m=o+i*s,l=i===n-1?a:m+s;u.push({start:xa(m,t),end:xa(l,r),bounds:i===0?e.bounds:"half-open-start"})}return u}function Ma(e){let n=e.year,t=e.month,r=e.day,o=t<=2?n-1:n,a=Math.floor((o>=0?o:o-399)/400),s=o-a*400,u=t>2?t-3:t+9,i=Math.floor((153*u+2)/5)+r-1,m=s*365+Math.floor(s/4)-Math.floor(s/100)+i;return(a*146097+m-719468)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}function xa(e,n){let r=Math.floor(e/864e5),o=e%864e5;o<0&&(o+=864e5);let a=Math.floor(o/36e5),s=Math.floor(o%36e5/6e4),u=Math.floor(o%6e4/1e3),i=o%1e3,m=r*864e5,l=new Date(m);return{...n,year:l.getUTCFullYear(),month:l.getUTCMonth()+1,day:l.getUTCDate(),hour:a,minute:s,second:u,millisecond:i}}function La(e,n,t={}){try{let r=Q(e.start,n,t),o=Q(e.end,n,t);return`${r} \u2013 ${o}`}catch(r){try{let o=new Intl.DateTimeFormat(U(t.locale??"en-US"),{}),a=Ea(e.start),s=Ea(e.end);return o.formatRange(a,s)}catch{throw r}}}function za(e,n,t={}){let r=qe(e.start,n,t),o=qe(e.end,n,t),a=[...r];return a.push({type:"literal",value:" \u2013 "}),a.push(...o),a}function Ea(e){let n=e;if(typeof n?.toInstant=="function")return new Date(n.toInstant().epochMilliseconds);if(typeof n?.year=="number"&&typeof n?.month=="number"&&typeof n?.day=="number")return new Date(Date.UTC(n.year,n.month-1,n.day,n.hour??0,n.minute??0,n.second??0,n.millisecond??0));throw new Error(`temporal-fmt: formatRange() expected Temporal values with year/month/day, got ${typeof e}.`)}function Ct(e,n){let t=e,r=0,o=[],a=1e4,s=!1,u=!0;function i(p){let d=p;return!(n.byWeekday&&n.byWeekday.length>0&&!n.byWeekday.includes(d.dayOfWeek??0)||n.byMonthDay&&n.byMonthDay.length>0&&!n.byMonthDay.includes(d.day??0)||n.byMonth&&n.byMonth.length>0&&!n.byMonth.includes(d.month??0)||n.exDates&&n.exDates.some(f=>T(f,p)===0))}function m(p,d){let f=n.frequency==="secondly"?"seconds":n.frequency==="minutely"?"minutes":n.frequency==="hourly"?"hours":n.frequency==="daily"?"days":n.frequency==="weekly"?"weeks":n.frequency==="monthly"?"months":"years";return S(p,d*n.interval,f)}function l(p){o.push(p),o.length>a&&o.shift()}function c(p){let d=p,f=0;do{if(d=m(d,1),f++,f>1e3)return s=!0,{value:d,found:!1};if(n.until&&T(d,n.until)>0)return s=!0,{value:d,found:!1}}while(!i(d));return{value:d,found:!0}}return{next(){if(s)return{value:void 0,done:!0};if(u){if(u=!1,i(t))return r++,n.count!==void 0&&r>=n.count&&(s=!0),n.until&&T(t,n.until)>0?(s=!0,{value:void 0,done:!0}):(l(t),{value:t,done:!1});let d=c(t);return d.found?(t=d.value,r++,n.count!==void 0&&r>=n.count&&(s=!0),l(t),{value:t,done:!1}):{value:void 0,done:!0}}let p=c(t);return p.found?(t=p.value,r++,n.count!==void 0&&r>=n.count&&(s=!0),l(t),{value:t,done:!1}):{value:void 0,done:!0}},previous(){return o.length===0?{value:void 0,done:!0}:{value:o.pop(),done:!1}}}}function Ha(e,n){let t=[];for(let r=0;r<n;r++){let o=e.next();if(o.done)break;t.push(o.value)}return t}var Ua=1e5;function Za(e,n){for(let r=0;r<n&&!e.next().done;r++);let t=[];for(;t.length<Ua;){let r=e.next();if(r.done)return t;t.push(r.value)}throw new RangeError(`temporal-fmt: skip() collected ${Ua} occurrences and the rule is still producing \u2014 add a count or until to the rule, or use take(iter, n) for a bounded read.`)}function Ya(e,n,t,r){let o=Ct(e,n),a=[];for(;;){let s=o.next();if(s.done||T(s.value,r)>=0)break;T(s.value,t)>=0&&a.push(s.value)}return a}function Va(e){let n=e.trim().toUpperCase().replace(/^RRULE:/,"").split(";"),t={frequency:"daily",interval:1},r=new Set(["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"]);for(let o of n){if(!o)continue;let a=o.indexOf("=");if(a<0)continue;let s=o.slice(0,a),u=o.slice(a+1);switch(s){case"FREQ":if(!r.has(u))throw new RangeError(`temporal-fmt: unsupported RRULE frequency "${u}".`);t.frequency=u.toLowerCase();break;case"INTERVAL":{let i=Number(u);if(!Number.isSafeInteger(i)||i<1)throw new RangeError(`temporal-fmt: RRULE INTERVAL must be a positive safe integer (got "${u}").`);t.interval=i;break}case"COUNT":{let i=Number(u);if(!Number.isSafeInteger(i)||i<1)throw new RangeError(`temporal-fmt: RRULE COUNT must be a positive safe integer (got "${u}").`);t.count=i;break}case"UNTIL":t.until=u;break;case"BYDAY":t.byWeekday=u.split(",").map(i=>{let m=i.match(/^([+-]?\d)?([A-Z]{2})$/);if(!m)return 0;let l=m[2];return{MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:7}[l]??0});break;case"BYMONTHDAY":{let i=u.split(",").map(Number);if(i.some(m=>!Number.isInteger(m)||m===0||m<-31||m>31))throw new RangeError("temporal-fmt: RRULE BYMONTHDAY contains an out-of-range value.");t.byMonthDay=i;break}case"BYMONTH":{let i=u.split(",").map(Number);if(i.some(m=>!Number.isInteger(m)||m<1||m>12))throw new RangeError("temporal-fmt: RRULE BYMONTH contains an out-of-range value.");t.byMonth=i;break}}}return t}function Wa(e){let n=[`FREQ=${e.frequency.toUpperCase()}`];if(e.interval!==1&&n.push(`INTERVAL=${e.interval}`),e.count!==void 0&&n.push(`COUNT=${e.count}`),e.until!==void 0&&n.push(`UNTIL=${String(e.until)}`),e.byWeekday&&e.byWeekday.length>0){let t={1:"MO",2:"TU",3:"WE",4:"TH",5:"FR",6:"SA",7:"SU"};n.push(`BYDAY=${e.byWeekday.map(r=>t[r]).join(",")}`)}return e.byMonthDay&&e.byMonthDay.length>0&&n.push(`BYMONTHDAY=${e.byMonthDay.join(",")}`),e.byMonth&&e.byMonth.length>0&&n.push(`BYMONTH=${e.byMonth.join(",")}`),n.join(";")}function ja(e={}){let n=new Set(e.weekend??[6,7]),t={...e.workingHours??{}};for(let r=1;r<=7;r++)t[r]===void 0&&(t[r]=n.has(r)?0:8);return{weekend:n,holidays:e.holidays,workingHours:t,halfDays:new Set(e.halfDays??[])}}function an(e,n){let t=n,r=t.dayOfWeek;if(typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"){let a=new Date(Date.UTC(t.year,t.month-1,t.day)).getUTCDay();r=a===0?7:a}if(typeof r!="number")throw new Error("temporal-fmt: isBusinessDay() needs a value with dayOfWeek (or year/month/day to compute it).");return!(e.weekend.has(r)||e.holidays&&e.holidays.isHoliday(n))}function At(e,n){let t=S(n,1,"days");for(let r=0;r<14;r++){if(an(e,t))return t;t=S(t,1,"days")}throw new Error("temporal-fmt: nextBusinessDay() gave up after 14 days \u2014 likely a misconfigured calendar (e.g. all days are weekends or holidays).")}function Lt(e,n){let t=S(n,-1,"days");for(let r=0;r<14;r++){if(an(e,t))return t;t=S(t,-1,"days")}throw new Error("temporal-fmt: previousBusinessDay() gave up after 14 days \u2014 likely a misconfigured calendar.")}var On=1e5;function Ga(e){if(!Number.isSafeInteger(e))throw new RangeError(`temporal-fmt: business-day count must be a finite safe integer (got ${e}).`)}function Xa(e,n){let t=e,r=n,o=t.year*1e4+t.month*100+t.day,a=r.year*1e4+r.month*100+r.day;return o-a}function zt(e,n,t){if(Ga(t),t===0)return n;let r=t>0?1:-1,o=Math.abs(t);if(o>On)throw new RangeError(`temporal-fmt: addBusinessDays() exceeded the ${On}-day limit.`);let a=n;for(let s=0;s<o;s++)a=r>0?At(e,a):Lt(e,a);return a}function Ba(e,n,t){return Ga(t),zt(e,n,-t)}function qa(e,n,t){let r=Xa(t,n);if(r===0)return 0;let o=r>0?1:-1,a=n,s=0,u=0;for(;Xa(a,t)!==0;){if(a=S(a,o,"days"),u++,u>On)throw new RangeError(`temporal-fmt: differenceInBusinessDays() exceeded the ${On}-day traversal limit.`);an(e,a)&&(s+=o)}return s}var Ka=5e3;function Qa(e){let n=new Map;function t(r){let o=n.get(r);return o||(o=e.map(a=>{let s;return a.compute?s=a.compute(r):s={month:a.month,day:a.day},{...s,name:a.name}}),n.set(r,o),o)}return{isHoliday(r){let o=r;if(typeof o.year!="number"||typeof o.month!="number"||typeof o.day!="number")throw new Error("temporal-fmt: isHoliday() needs a value with year/month/day.");return t(o.year).some(s=>s.month===o.month&&s.day===o.day)},holidaysBetween(r,o){let a=r,s=o;if(typeof a?.year!="number"||typeof s?.year!="number")throw new Error("temporal-fmt: holidaysBetween() needs start/end values with year/month/day.");if(s.year-a.year>Ka)throw new RangeError(`temporal-fmt: holidaysBetween() year range (${a.year}\u2013${s.year}) exceeds the ${Ka}-year limit. Split the query into smaller ranges.`);let u=[];for(let i=a.year;i<=s.year;i++){let m=t(i);for(let l of m){let c={year:i,month:l.month,day:l.day};T(c,a)>=0&&T(c,s)<=0&&u.push({year:i,month:l.month,day:l.day})}}return u}}}function Ja(e,n){let t=S(n,1,"days");for(let r=0;r<365*5;r++){if(e.isHoliday(t))return t;t=S(t,1,"days")}}function es(e,n){let t=S(n,-1,"days");for(let r=0;r<365*5;r++){if(e.isHoliday(t))return t;t=S(t,-1,"days")}}function ns(e,n,t){return e.holidaysBetween(n,t)}function ts(e,n,t={}){let r=R(),o=t.disambiguation??"compatible",s={overflow:t.overflow??"constrain",disambiguation:o,offset:t.offset??"prefer"};try{return r.ZonedDateTime.from({year:e.year,month:e.month,day:e.day,hour:e.hour??0,minute:e.minute??0,second:e.second??0,millisecond:e.millisecond??0,microsecond:e.microsecond??0,nanosecond:e.nanosecond??0,timeZone:n},s)}catch(u){let i=u.message;throw/no such (wall-clock )?time/i.test(i)&&o==="reject"?new Error(`temporal-fmt: "${n}" has no such wall-clock time on ${e.year}-${e.month}-${e.day}T${e.hour??0}:${e.minute??0} \u2014 it falls in a DST gap. Pass { disambiguation: 'compatible' | 'earlier' | 'later' } to pick an instant.`):u}}function rs(e){let n=e;if(typeof n?.timeZoneId!="string")throw new Error(`temporal-fmt: getTimeZone() expected a ZonedDateTime, got ${typeof e}.`);return n.timeZoneId}function os(e){let n=e;if(typeof n?.offset!="string")throw new Error(`temporal-fmt: getOffset() expected a ZonedDateTime, got ${typeof e}.`);return n.offset}function as(e){let n=e;if(typeof n?.offsetNanoseconds=="number")return n.offsetNanoseconds;if(typeof n?.offset=="string"){let t=n.offset.match(/^([+-])(\d{2}):(\d{2})$/);if(!t)throw new Error(`temporal-fmt: getOffsetNanoseconds() couldn't parse offset "${n.offset}".`);return(t[1]==="-"?-1:1)*(Number(t[2])*3600+Number(t[3])*60)*1e9}throw new Error(`temporal-fmt: getOffsetNanoseconds() expected a ZonedDateTime, got ${typeof e}.`)}function ss(e){let n=e;if(typeof n?.timeZoneId!="string"||typeof n?.offset!="string"||typeof n?.year!="number")throw new Error(`temporal-fmt: isDST() expected a ZonedDateTime, got ${typeof e}.`);let t=R();try{return t.ZonedDateTime.from({year:n.year,month:1,day:1,hour:12,timeZone:n.timeZoneId},{disambiguation:"compatible"}).offset!==n.offset}catch{return!1}}function is(e){return ls(e,1)}function us(e){return ls(e,-1)}function ls(e,n){let t=e;if(typeof t?.timeZoneId!="string")throw new Error(`temporal-fmt: ${n>0?"getNextTransition":"getPreviousTransition"}() expected a ZonedDateTime, got ${typeof e}.`);let r=R(),o=t.timeZoneId,a=S(e,n,"days"),s=t.offset;for(let u=0;u<365*2;u++){let i=a,m=r.ZonedDateTime.from({...i,timeZone:o},{disambiguation:"compatible"});if(m.offset!==s)return m;a=S(a,n,"days")}}function ms(e,n){let t=[],r=e;if(typeof r?.timeZoneId!="string")throw new Error(`temporal-fmt: getTransitions() expected a ZonedDateTime for start, got ${typeof e}.`);let o=n,a=R(),s=r.timeZoneId,u=S(e,1,"days"),i=r.offset;for(let m=0;m<365*5;m++){let l=u,c=a.ZonedDateTime.from({...l,timeZone:s},{disambiguation:"compatible"});if(c.offset!==i){if(c.year>o.year||c.year===o.year&&(c.month>o.month||c.month===o.month&&c.day>o.day))break;t.push(c),i=c.offset}u=S(u,1,"days")}return t}function cs(e,n){let t=R(),r=t.ZonedDateTime.from({...e,timeZone:n},{disambiguation:"earlier",offset:"ignore"}),o=t.ZonedDateTime.from({...e,timeZone:n},{disambiguation:"later",offset:"ignore"}),a=s=>s.year===e.year&&s.month===e.month&&s.day===e.day&&s.hour===e.hour&&s.minute===e.minute&&s.second===e.second&&s.millisecond===e.millisecond;return!a(r)||!a(o)?[]:r.toInstant().epochNanoseconds===o.toInstant().epochNanoseconds?[r]:[r,o]}function ds(e={}){let n=[...de],t=new Set;for(let i of e.tokens??[])t.add(i.name);for(let i of e.tokens??[]){let m=n.findIndex(([l])=>l===i.name);m>=0?n[m]=[i.name,i.handler,i.field]:n.push([i.name,i.handler,i.field])}n.sort((i,m)=>m[0].length-i[0].length);let r=new Map(n.map(([i,m,l])=>[i,{handler:m,field:l}])),o=n.map(([i])=>i);function a(i){let m=[],l=0;for(;l<i.length;){let c=i[l];if(c==="'"){if(i[l+1]==="'"){s(m,"'"),l+=2;continue}let d=l+1,f="",h=!1;for(;d<i.length;){if(i[d]==="'"){if(i[d+1]==="'"){f+="'",d+=2;continue}h=!0,d+=1;break}f+=i[d],d+=1}if(!h)throw new Error(`temporal-fmt: unterminated quote in format string "${i}"`);s(m,f),l=d;continue}let p=o.find(d=>i.startsWith(d,l));if(p){let d=p[p.length-1];if(i[l+p.length]===d){let f=l+p.length;for(;i[f]===d;)f+=1;throw new O({token:i.slice(l,f),format:i,message:`temporal-fmt: "${i.slice(l,f)}" in format string "${i}" isn't a recognized token \u2014 did you mean "${p}"?`})}m.push({kind:"token",value:p}),l+=p.length;continue}s(m,c),l+=1}return m}function s(i,m){let l=i[i.length-1];l&&l.kind==="literal"?l.value+=m:i.push({kind:"literal",value:m})}let u=e.defaultLocale??P;return{format(i,m,l={}){if(m.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${m.length}).`);let c=l.locale??u,p=a(m),d="";for(let f of p){if(f.kind==="literal"){d+=f.value;continue}let h=r.get(f.value);/* c8 ignore start @preserve -- unreachable: customTokenize only ever produces a
151
151
  `kind: 'token'` piece via sortedTokenStrings.find(...), and
152
152
  handlerByToken is built from that same mergedTokens array, so
153
153
  every token piece is guaranteed a handler entry. Guards against a
@@ -161,7 +161,7 @@
161
161
  a handler entry. Guards against future decoupling of the two. */if(!h)throw new Error(`temporal-fmt: unknown token "${f.value}"`);/* c8 ignore stop @preserve */if(i[h.field]===void 0)throw new Error(`temporal-fmt: token "${f.value}" requires "${String(h.field)}".`);d.push({type:"token",value:h.handler(i,c),token:f.value})}return d},compileFormat(i){if(i.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${i.length}).`);let m=a(i);return{formatStr:i,pieces:m.map(l=>l),format(l,c={}){let p=c.locale??u,d="";for(let f of m){if(f.kind==="literal"){d+=f.value;continue}let h=r.get(f.value);/* c8 ignore start @preserve -- unreachable, see the same guard's comment
162
162
  above in the un-compiled format(). */if(!h)throw new Error(`temporal-fmt: unknown token "${f.value}"`);/* c8 ignore stop @preserve */if(l[h.field]===void 0)throw new Error(`temporal-fmt: token "${f.value}" requires "${String(h.field)}".`);d+=h.handler(l,p)}return d},formatToParts(l,c={}){let p=c.locale??u,d=[];for(let f of m){if(f.kind==="literal"){let w=d[d.length-1];/* c8 ignore start @preserve -- unreachable, see the same guard's
163
163
  comment above in the un-compiled formatToParts. */w&&w.type==="literal"?w.value+=f.value:d.push({type:"literal",value:f.value});continue}let h=r.get(f.value);/* c8 ignore start @preserve -- unreachable, see the same guard's
164
- comment above in the un-compiled formatToParts. */if(!h)throw new Error(`temporal-fmt: unknown token "${f.value}"`);/* c8 ignore stop @preserve */if(l[h.field]===void 0)throw new Error(`temporal-fmt: token "${f.value}" requires "${String(h.field)}".`);d.push({type:"token",value:h.handler(l,p),token:f.value})}return d}}}}}function Yi(e){return/^y+$/.test(e)?"Year":/^[ML]+$/.test(e)?"Month":/^[decD]+$/.test(e)?"Day":/^[Ec]+$/.test(e)?"Weekday":/^[Qq]+$/.test(e)?"Quarter":/^[Gg]+$/.test(e)?"Era":/^[Hh]+$/.test(e)?"Hour":/^m+$/.test(e)?"Minute":/^s+$/.test(e)?"Second":/^S+$/.test(e)?"Fractional Second":e==="a"?"Day Period":e==="zzz"?"Time Zone":/^[Xx]+$/.test(e)?"UTC Offset":e==="do"?"Ordinal Day":e==="ww"||e==="RRRR"?"ISO Week":"Other"}function ds(){return tn.map(e=>{let n=ee[e];return{label:e,detail:n.meaning,documentation:[n.meaning,"",`Format-capable: ${n.formatCapable}`,`Parse-capable: ${n.parseCapable}`,`Locale-sensitive: ${n.localeSensitive}`,`Calendar-sensitive: ${n.calendarSensitive}`,`Timezone-sensitive: ${n.timezoneSensitive}`,`Round-trip safe: ${n.roundTripSafe}`,`Supported types: ${n.supportedTypes.join(", ")}`].join(`
165
- `),family:Yi(e)}})}function fs(){let e={};for(let n of tn){let t=ee[n];e[n]={signature:n,summary:t.meaning,details:[`Format-capable: ${t.formatCapable?"yes":"no"}`,`Parse-capable: ${t.parseCapable?"yes":"no"}`,`Locale-sensitive: ${t.localeSensitive?"yes":"no"}`,`Calendar-sensitive: ${t.calendarSensitive?"yes":"no"}`,`Timezone-sensitive: ${t.timezoneSensitive?"yes":"no"}`,`Round-trip safe: ${t.roundTripSafe?"yes":"no"}`,`Supported types: ${t.supportedTypes.join(", ")}`].join(`
166
- `)}}return e}function ps(e){let n=Le(e),t=[];for(let r of n.warnings){let o=r.message,a;r.code==="TWELVE_HOUR_WITHOUT_A"?a='Add an "a" token (e.g. "h:mm a") or use "H:mm" for 24-hour.':r.code==="MIXED_12_AND_24_HOUR"?a='Pick one form: "HH:mm" for 24-hour or "h:mm a" for 12-hour.':r.code==="AMBIGUOUS_NUMERIC_RUN"?a='Add a separator or use padded forms (e.g. "MM" instead of "M").':r.code==="FORMAT_ONLY_TOKEN"&&(a='Use a parse-capable variant (e.g. "d" instead of "do").'),t.push({startColumn:0,endColumn:e.length,severity:"warning",message:o,code:r.code,suggestion:a})}return t}var Nn=[{from:"YYYY",to:"yyyy"},{from:"YY",to:"yy"},{from:"MMMM",to:"MMMM"},{from:"MMM",to:"MMM"},{from:"MM",to:"MM"},{from:"M",to:"M"},{from:"DD",to:"dd"},{from:"D",to:"d"},{from:"Do",to:null,notes:`Ordinal day (AdvancedFormat) \u2014 use temporal-fmt's own "do" token instead.`},{from:"dddd",to:"EEEE"},{from:"ddd",to:"EEE"},{from:"dd",to:null,notes:'Min-name weekday (e.g. "Tu") \u2014 temporal-fmt has no equivalent width.'},{from:"d",to:null,notes:'Numeric weekday (0-6) \u2014 no temporal-fmt equivalent; not the same as "d" here, which is day-of-month.'},{from:"HH",to:"HH"},{from:"H",to:"H"},{from:"hh",to:"hh"},{from:"h",to:"h"},{from:"kk",to:null,notes:"Hour 1-24 (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"k",to:null,notes:"Hour 1-24 (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"mm",to:"mm"},{from:"m",to:"m"},{from:"ss",to:"ss"},{from:"s",to:"s"},{from:"SSS",to:"SSS"},{from:"A",to:"a",notes:"Uppercase AM/PM in Day.js \u2014 temporal-fmt is always lowercase."},{from:"a",to:"a"},{from:"ZZ",to:"XX",notes:"Numeric UTC offset, no colon."},{from:"Z",to:"XXX",notes:"Numeric UTC offset with colon."},{from:"X",to:null,notes:"Unix timestamp (seconds) \u2014 use fromUnixSeconds() instead."},{from:"x",to:null,notes:"Unix timestamp (ms) \u2014 use fromUnixMilliseconds() instead."},{from:"Qo",to:null,notes:"Ordinal quarter (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"Q",to:"Q"},{from:"Mo",to:null,notes:"Ordinal month (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"ww",to:"ww"},{from:"wo",to:null,notes:"Ordinal ISO week (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"w",to:null,notes:`Unpadded ISO week \u2014 temporal-fmt's "ww" is always 2-digit.`},{from:"gggg",to:"RRRR",notes:"Week-numbering year, not the calendar year \u2014 same caveat as temporal-fmt's RRRR."},{from:"L",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LL",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LLL",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LLLL",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LT",to:null,notes:"Localized time format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LTS",to:null,notes:"Localized time format (AdvancedFormat) \u2014 write the format string out explicitly."}],Cn=[{from:"yyyy",to:"yyyy"},{from:"yy",to:"yy"},{from:"y",to:null,notes:'Unpadded calendar year, opt-in via useAdditionalWeekYearTokens \u2014 temporal-fmt has no unpadded-year token; use "yyyy".'},{from:"MMMM",to:"MMMM"},{from:"MMM",to:"MMM"},{from:"MM",to:"MM"},{from:"M",to:"M"},{from:"LLLL",to:"LLLL"},{from:"LLL",to:"LLL"},{from:"dd",to:"dd"},{from:"d",to:"d"},{from:"do",to:"do"},{from:"DDD",to:"DDD"},{from:"DD",to:"DD"},{from:"D",to:"D",notes:`Day-of-year, opt-in via useAdditionalDayOfYearTokens \u2014 matches temporal-fmt's own "D" already.`},{from:"EEEE",to:"EEEE"},{from:"EEE",to:"EEE"},{from:"eeee",to:null,notes:"Locale-aware numeric weekday \u2014 no temporal-fmt equivalent."},{from:"cccc",to:"cccc"},{from:"ccc",to:"ccc"},{from:"HH",to:"HH"},{from:"H",to:"H"},{from:"hh",to:"hh"},{from:"h",to:"h"},{from:"mm",to:"mm"},{from:"m",to:"m"},{from:"ss",to:"ss"},{from:"s",to:"s"},{from:"SSS",to:"SSS"},{from:"a",to:"a"},{from:"aaa",to:"a"},{from:"XXX",to:"XXX"},{from:"XX",to:"XX"},{from:"X",to:"X",notes:`Opt-in via useAdditionalDayOfYearTokens-adjacent rules in date-fns v3+; matches temporal-fmt's own "X" already.`},{from:"xxx",to:"xxx"},{from:"xx",to:"xx"},{from:"x",to:"x"},{from:"zzzz",to:"zzzz"},{from:"zzz",to:"zzz"},{from:"z",to:"z"},{from:"QQQ",to:"QQQ"},{from:"Q",to:"Q"},{from:"GGGG",to:"GGGG"},{from:"GGG",to:null,notes:'Abbreviated era \u2014 temporal-fmt only has "G" (short) and "GGGG" (long).'},{from:"GG",to:null,notes:'Abbreviated era \u2014 temporal-fmt only has "G" (short) and "GGGG" (long).'},{from:"G",to:"G"},{from:"ww",to:"ww"},{from:"w",to:null,notes:`Unpadded local week number \u2014 temporal-fmt's "ww" is ISO-week and always 2-digit.`},{from:"RRRR",to:"RRRR"},{from:"R",to:null,notes:`Unpadded ISO week-numbering year \u2014 temporal-fmt's "RRRR" is always 4-digit.`},{from:"Y",to:null,notes:'Week-numbering year (locale week rules), opt-in \u2014 no temporal-fmt equivalent; "RRRR" is ISO week-numbering, a different rule set.'},{from:"PPPP",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"PPP",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"PP",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"P",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"pppp",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"ppp",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"pp",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"p",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."}];function hs(e,n){return Q(n??{year:2026,month:8,day:4,hour:15,minute:45,second:30,millisecond:123,dayOfWeek:2,timeZoneId:"UTC",offset:"+00:00",calendarId:"iso8601"},e,{locale:"en-US"})}function gs(e){return"README.md#token-reference"}function Vi(e){let n=[],t=0;for(;t<e.length;)if(e[t]==="["){let r=e.indexOf("]",t+1);if(r===-1){n.push({kind:"token",value:e.slice(t)});break}n.push({kind:"literal",value:e.slice(t+1,r)}),t=r+1}else{let r=t;for(;r<e.length&&e[r]!=="[";)r+=1;n.push({kind:"token",value:e.slice(t,r)}),t=r}return n}function Wi(e,n){let t=[],r=0;for(;r<e.length;){let o=n.find(s=>e.startsWith(s,r));if(o){t.push({kind:"token",value:o}),r+=o.length;continue}let a=t[t.length-1];a&&a.kind==="literal"?a.value+=e[r]:t.push({kind:"literal",value:e[r]}),r+=1}return t}function ys(e,n,t){let r=new Map(n.map(u=>[u.from,u.to])),o=[...r.keys()].sort((u,i)=>i.length-u.length),a=Vi(e),s="";for(let u of a){if(u.kind==="literal"){s+=`'${u.value.replace(/'/g,"''")}'`;continue}for(let i of Wi(u.value,o))if(i.kind==="token"){let m=r.get(i.value);if(m==null)throw new Error(`temporal-fmt: "${i.value}" has no ${t} -> temporal-fmt mapping (in format string "${e}"). Write the equivalent temporal-fmt token in by hand, or wrap it in brackets if it was meant as literal text.`);s+=m}else/[a-zA-Z]/.test(i.value)?s+=`'${i.value.replace(/'/g,"''")}'`:s+=i.value}return s}function ws(e){return ys(e,Nn,"Day.js")}function bs(e){return ys(e,Cn,"date-fns")}0&&(module.exports={ALL_TOKEN_NAMES,AmbiguousInputError,DATE_FNS_TO_TEMPORAL_FMT,DAYJS_TO_TEMPORAL_FMT,DEFAULT_CONFIG,FORMAT_ONLY_TOKENS,FormatSyntaxError,InvalidCalendarError,InvalidDateError,InvalidDurationError,InvalidLocaleError,InvalidOffsetError,InvalidTimeError,InvalidTimeZoneError,ParseMismatchError,SUPPORTED_NUMBERING_SYSTEMS,TOKEN_METADATA,TemporalFmtError,UnknownTokenError,add,addBusinessDays,addDays,addDuration,addHours,addMilliseconds,addMinutes,addMonths,addSeconds,addWeeks,addYears,analyzeFormat,applyNumbering,applyParseNumbering,asDateFieldView,assertDuration,assertInstant,assertPlainDate,assertPlainDateTime,assertPlainMonthDay,assertPlainTime,assertPlainYearMonth,assertTemporal,assertZonedDateTime,balanceDuration,between,ceil,clamp,compare,compareDuration,compileFormat,compileParser,convertDigits,convertDigitsToAscii,createBusinessCalendar,createConfig,createFormatter,createHolidayCalendar,dayOfYear,daysInMonth,daysInYear,difference,differenceInBusinessDays,differenceInDays,differenceInHours,differenceInMilliseconds,differenceInMinutes,differenceInMonths,differenceInSeconds,differenceInWeeks,differenceInYears,endOf,explainFormat,fieldForToken,floor,format,formatDistance,formatDistanceToNow,formatDuration,formatDurationToParts,formatHTTPDate,formatISO,formatISODuration,formatRFC2822,formatRFC3339,formatRRule,formatRange,formatRangeToParts,formatRelative,formatRelativeToNow,formatSQL,formatToParts,fromUnixMicroseconds,fromUnixMilliseconds,fromUnixNanoseconds,fromUnixSeconds,getAutocompleteData,getDocUrl,getHoverDocs,getInlineDiagnostics,getLocale,getMonth,getNextTransition,getOffset,getOffsetNanoseconds,getPreviousTransition,getQuarter,getTimeZone,getTransitions,getWeekday,hasLocale,holidaysBetween,intersection,intersects,interval,intervalContains,intervalDifference,intervalIsAfter,intervalIsBefore,intervalSubtract,isAfter,isBefore,isBetween,isBusinessDay,isDST,isDuration,isEqual,isInstant,isLeapMonth,isLeapYear,isPlainDate,isPlainDateTime,isPlainMonthDay,isPlainTime,isPlainYearMonth,isSameDay,isSameMonth,isSameQuarter,isSameWeek,isSameYear,isTemporal,isToday,isTomorrow,isValidFormat,isWeekday,isWeekend,isYesterday,isZonedDateTime,listRegisteredGrammars,listTokens,max,mergeIntervals,mergeWithConfig,min,monthsInYear,nextBusinessDay,nextHoliday,overlaps,parse,parseDuration,parseHTTPDate,parseISO,parseISODuration,parseRFC2822,parseRFC3339,parseRRule,parseRelative,parseSQL,parseToParts,possibleInstantsFor,previewFormat,previousBusinessDay,previousHoliday,recurrence,registerLocale,registerLocaleVocab,registerRelativeGrammar,resolveZoned,round,roundDuration,roundDurationAlias,safeParse,setTemporal,skip,splitInterval,startOf,subtract,subtractBusinessDays,subtractDays,subtractDuration,subtractHours,subtractMilliseconds,subtractMinutes,subtractMonths,subtractSeconds,subtractWeeks,subtractYears,take,toUnixMicroseconds,toUnixMilliseconds,toUnixNanoseconds,toUnixSeconds,tokenInfo,tokenizeFormat,totalDuration,translateDateFnsFormatString,translateDayjsFormatString,truncate,tryParse,union,validateFormat,weekOfYear,weekYear});
164
+ comment above in the un-compiled formatToParts. */if(!h)throw new Error(`temporal-fmt: unknown token "${f.value}"`);/* c8 ignore stop @preserve */if(l[h.field]===void 0)throw new Error(`temporal-fmt: token "${f.value}" requires "${String(h.field)}".`);d.push({type:"token",value:h.handler(l,p),token:f.value})}return d}}}}}function Wi(e){return/^y+$/.test(e)?"Year":/^[ML]+$/.test(e)?"Month":/^[decD]+$/.test(e)?"Day":/^[Ec]+$/.test(e)?"Weekday":/^[Qq]+$/.test(e)?"Quarter":/^[Gg]+$/.test(e)?"Era":/^[Hh]+$/.test(e)?"Hour":/^m+$/.test(e)?"Minute":/^s+$/.test(e)?"Second":/^S+$/.test(e)?"Fractional Second":e==="a"?"Day Period":e==="zzz"?"Time Zone":/^[Xx]+$/.test(e)?"UTC Offset":e==="do"?"Ordinal Day":e==="ww"||e==="RRRR"?"ISO Week":"Other"}function fs(){return nn.map(e=>{let n=ee[e];return{label:e,detail:n.meaning,documentation:[n.meaning,"",`Format-capable: ${n.formatCapable}`,`Parse-capable: ${n.parseCapable}`,`Locale-sensitive: ${n.localeSensitive}`,`Calendar-sensitive: ${n.calendarSensitive}`,`Timezone-sensitive: ${n.timezoneSensitive}`,`Round-trip safe: ${n.roundTripSafe}`,`Supported types: ${n.supportedTypes.join(", ")}`].join(`
165
+ `),family:Wi(e)}})}function ps(){let e={};for(let n of nn){let t=ee[n];e[n]={signature:n,summary:t.meaning,details:[`Format-capable: ${t.formatCapable?"yes":"no"}`,`Parse-capable: ${t.parseCapable?"yes":"no"}`,`Locale-sensitive: ${t.localeSensitive?"yes":"no"}`,`Calendar-sensitive: ${t.calendarSensitive?"yes":"no"}`,`Timezone-sensitive: ${t.timezoneSensitive?"yes":"no"}`,`Round-trip safe: ${t.roundTripSafe?"yes":"no"}`,`Supported types: ${t.supportedTypes.join(", ")}`].join(`
166
+ `)}}return e}function hs(e){let n=Le(e),t=[];for(let r of n.warnings){let o=r.message,a;r.code==="TWELVE_HOUR_WITHOUT_A"?a='Add an "a" token (e.g. "h:mm a") or use "H:mm" for 24-hour.':r.code==="MIXED_12_AND_24_HOUR"?a='Pick one form: "HH:mm" for 24-hour or "h:mm a" for 12-hour.':r.code==="AMBIGUOUS_NUMERIC_RUN"?a='Add a separator or use padded forms (e.g. "MM" instead of "M").':r.code==="FORMAT_ONLY_TOKEN"&&(a='Use a parse-capable variant (e.g. "d" instead of "do").'),t.push({startColumn:0,endColumn:e.length,severity:"warning",message:o,code:r.code,suggestion:a})}return t}var Pn=[{from:"YYYY",to:"yyyy"},{from:"YY",to:"yy"},{from:"MMMM",to:"MMMM"},{from:"MMM",to:"MMM"},{from:"MM",to:"MM"},{from:"M",to:"M"},{from:"DD",to:"dd"},{from:"D",to:"d"},{from:"Do",to:null,notes:`Ordinal day (AdvancedFormat) \u2014 use temporal-fmt's own "do" token instead.`},{from:"dddd",to:"EEEE"},{from:"ddd",to:"EEE"},{from:"dd",to:null,notes:'Min-name weekday (e.g. "Tu") \u2014 temporal-fmt has no equivalent width.'},{from:"d",to:null,notes:'Numeric weekday (0-6) \u2014 no temporal-fmt equivalent; not the same as "d" here, which is day-of-month.'},{from:"HH",to:"HH"},{from:"H",to:"H"},{from:"hh",to:"hh"},{from:"h",to:"h"},{from:"kk",to:null,notes:"Hour 1-24 (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"k",to:null,notes:"Hour 1-24 (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"mm",to:"mm"},{from:"m",to:"m"},{from:"ss",to:"ss"},{from:"s",to:"s"},{from:"SSS",to:"SSS"},{from:"A",to:"a",notes:"Uppercase AM/PM in Day.js \u2014 temporal-fmt is always lowercase."},{from:"a",to:"a"},{from:"ZZ",to:"XX",notes:"Numeric UTC offset, no colon."},{from:"Z",to:"XXX",notes:"Numeric UTC offset with colon."},{from:"X",to:null,notes:"Unix timestamp (seconds) \u2014 use fromUnixSeconds() instead."},{from:"x",to:null,notes:"Unix timestamp (ms) \u2014 use fromUnixMilliseconds() instead."},{from:"Qo",to:null,notes:"Ordinal quarter (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"Q",to:"Q"},{from:"Mo",to:null,notes:"Ordinal month (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"ww",to:"ww"},{from:"wo",to:null,notes:"Ordinal ISO week (AdvancedFormat) \u2014 no temporal-fmt equivalent."},{from:"w",to:null,notes:`Unpadded ISO week \u2014 temporal-fmt's "ww" is always 2-digit.`},{from:"gggg",to:"RRRR",notes:"Week-numbering year, not the calendar year \u2014 same caveat as temporal-fmt's RRRR."},{from:"L",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LL",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LLL",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LLLL",to:null,notes:"Localized date format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LT",to:null,notes:"Localized time format (AdvancedFormat) \u2014 write the format string out explicitly."},{from:"LTS",to:null,notes:"Localized time format (AdvancedFormat) \u2014 write the format string out explicitly."}],Nn=[{from:"yyyy",to:"yyyy"},{from:"yy",to:"yy"},{from:"y",to:null,notes:'Unpadded calendar year, opt-in via useAdditionalWeekYearTokens \u2014 temporal-fmt has no unpadded-year token; use "yyyy".'},{from:"MMMM",to:"MMMM"},{from:"MMM",to:"MMM"},{from:"MM",to:"MM"},{from:"M",to:"M"},{from:"LLLL",to:"LLLL"},{from:"LLL",to:"LLL"},{from:"dd",to:"dd"},{from:"d",to:"d"},{from:"do",to:"do"},{from:"DDD",to:"DDD"},{from:"DD",to:"DD"},{from:"D",to:"D",notes:`Day-of-year, opt-in via useAdditionalDayOfYearTokens \u2014 matches temporal-fmt's own "D" already.`},{from:"EEEE",to:"EEEE"},{from:"EEE",to:"EEE"},{from:"eeee",to:null,notes:"Locale-aware numeric weekday \u2014 no temporal-fmt equivalent."},{from:"cccc",to:"cccc"},{from:"ccc",to:"ccc"},{from:"HH",to:"HH"},{from:"H",to:"H"},{from:"hh",to:"hh"},{from:"h",to:"h"},{from:"mm",to:"mm"},{from:"m",to:"m"},{from:"ss",to:"ss"},{from:"s",to:"s"},{from:"SSS",to:"SSS"},{from:"a",to:"a"},{from:"aaa",to:"a"},{from:"XXX",to:"XXX"},{from:"XX",to:"XX"},{from:"X",to:"X",notes:`Opt-in via useAdditionalDayOfYearTokens-adjacent rules in date-fns v3+; matches temporal-fmt's own "X" already.`},{from:"xxx",to:"xxx"},{from:"xx",to:"xx"},{from:"x",to:"x"},{from:"zzzz",to:"zzzz"},{from:"zzz",to:"zzz"},{from:"z",to:"z"},{from:"QQQ",to:"QQQ"},{from:"Q",to:"Q"},{from:"GGGG",to:"GGGG"},{from:"GGG",to:null,notes:'Abbreviated era \u2014 temporal-fmt only has "G" (short) and "GGGG" (long).'},{from:"GG",to:null,notes:'Abbreviated era \u2014 temporal-fmt only has "G" (short) and "GGGG" (long).'},{from:"G",to:"G"},{from:"ww",to:"ww"},{from:"w",to:null,notes:`Unpadded local week number \u2014 temporal-fmt's "ww" is ISO-week and always 2-digit.`},{from:"RRRR",to:"RRRR"},{from:"R",to:null,notes:`Unpadded ISO week-numbering year \u2014 temporal-fmt's "RRRR" is always 4-digit.`},{from:"Y",to:null,notes:'Week-numbering year (locale week rules), opt-in \u2014 no temporal-fmt equivalent; "RRRR" is ISO week-numbering, a different rule set.'},{from:"PPPP",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"PPP",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"PP",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"P",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"pppp",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"ppp",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"pp",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."},{from:"p",to:null,notes:"Localized composite format \u2014 write the format string out explicitly."}];function gs(e,n){return Q(n??{year:2026,month:8,day:4,hour:15,minute:45,second:30,millisecond:123,dayOfWeek:2,timeZoneId:"UTC",offset:"+00:00",calendarId:"iso8601"},e,{locale:"en-US"})}function ys(e){return"README.md#token-reference"}function Xi(e){let n=[],t=0;for(;t<e.length;)if(e[t]==="["){let r=e.indexOf("]",t+1);if(r===-1){n.push({kind:"token",value:e.slice(t)});break}n.push({kind:"literal",value:e.slice(t+1,r)}),t=r+1}else{let r=t;for(;r<e.length&&e[r]!=="[";)r+=1;n.push({kind:"token",value:e.slice(t,r)}),t=r}return n}function ji(e,n){let t=[],r=0;for(;r<e.length;){let o=n.find(s=>e.startsWith(s,r));if(o){t.push({kind:"token",value:o}),r+=o.length;continue}let a=t[t.length-1];a&&a.kind==="literal"?a.value+=e[r]:t.push({kind:"literal",value:e[r]}),r+=1}return t}function ws(e,n,t){let r=new Map(n.map(u=>[u.from,u.to])),o=[...r.keys()].sort((u,i)=>i.length-u.length),a=Xi(e),s="";for(let u of a){if(u.kind==="literal"){s+=`'${u.value.replace(/'/g,"''")}'`;continue}for(let i of ji(u.value,o))if(i.kind==="token"){let m=r.get(i.value);if(m==null)throw new Error(`temporal-fmt: "${i.value}" has no ${t} -> temporal-fmt mapping (in format string "${e}"). Write the equivalent temporal-fmt token in by hand, or wrap it in brackets if it was meant as literal text.`);s+=m}else/[a-zA-Z]/.test(i.value)?s+=`'${i.value.replace(/'/g,"''")}'`:s+=i.value}return s}function bs(e){return ws(e,Pn,"Day.js")}function ks(e){return ws(e,Nn,"date-fns")}0&&(module.exports={ALL_TOKEN_NAMES,AmbiguousInputError,DATE_FNS_TO_TEMPORAL_FMT,DAYJS_TO_TEMPORAL_FMT,DEFAULT_CONFIG,FORMAT_ONLY_TOKENS,FormatSyntaxError,InvalidCalendarError,InvalidDateError,InvalidDurationError,InvalidLocaleError,InvalidOffsetError,InvalidTimeError,InvalidTimeZoneError,ParseMismatchError,SUPPORTED_NUMBERING_SYSTEMS,TOKEN_METADATA,TemporalFmtError,UnknownTokenError,add,addBusinessDays,addDays,addDuration,addHours,addMilliseconds,addMinutes,addMonths,addSeconds,addWeeks,addYears,analyzeFormat,applyNumbering,applyParseNumbering,asDateFieldView,assertDuration,assertInstant,assertPlainDate,assertPlainDateTime,assertPlainMonthDay,assertPlainTime,assertPlainYearMonth,assertTemporal,assertZonedDateTime,balanceDuration,between,ceil,clamp,compare,compareDuration,compileFormat,compileParser,convertDigits,convertDigitsToAscii,createBusinessCalendar,createConfig,createFormatter,createHolidayCalendar,dayOfYear,daysInMonth,daysInYear,difference,differenceInBusinessDays,differenceInDays,differenceInHours,differenceInMilliseconds,differenceInMinutes,differenceInMonths,differenceInSeconds,differenceInWeeks,differenceInYears,endOf,explainFormat,fieldForToken,floor,format,formatDistance,formatDistanceToNow,formatDuration,formatDurationToParts,formatHTTPDate,formatISO,formatISODuration,formatRFC2822,formatRFC3339,formatRRule,formatRange,formatRangeToParts,formatRelative,formatRelativeToNow,formatSQL,formatToParts,fromUnixMicroseconds,fromUnixMilliseconds,fromUnixNanoseconds,fromUnixSeconds,getAutocompleteData,getDocUrl,getHoverDocs,getInlineDiagnostics,getLocale,getMonth,getNextTransition,getOffset,getOffsetNanoseconds,getPreviousTransition,getQuarter,getTimeZone,getTransitions,getWeekday,hasLocale,holidaysBetween,intersection,intersects,interval,intervalContains,intervalDifference,intervalIsAfter,intervalIsBefore,intervalSubtract,isAfter,isBefore,isBetween,isBusinessDay,isDST,isDuration,isEqual,isInstant,isLeapMonth,isLeapYear,isPlainDate,isPlainDateTime,isPlainMonthDay,isPlainTime,isPlainYearMonth,isSameDay,isSameMonth,isSameQuarter,isSameWeek,isSameYear,isTemporal,isToday,isTomorrow,isValidFormat,isWeekday,isWeekend,isYesterday,isZonedDateTime,listRegisteredGrammars,listTokens,max,mergeIntervals,mergeWithConfig,min,monthsInYear,nextBusinessDay,nextHoliday,overlaps,parse,parseDuration,parseHTTPDate,parseISO,parseISODuration,parseRFC2822,parseRFC3339,parseRRule,parseRelative,parseSQL,parseToParts,possibleInstantsFor,previewFormat,previousBusinessDay,previousHoliday,recurrence,registerLocale,registerLocaleVocab,registerRelativeGrammar,resolveZoned,round,roundDuration,roundDurationAlias,safeParse,setTemporal,skip,splitInterval,startOf,subtract,subtractBusinessDays,subtractDays,subtractDuration,subtractHours,subtractMilliseconds,subtractMinutes,subtractMonths,subtractSeconds,subtractWeeks,subtractYears,take,toUnixMicroseconds,toUnixMilliseconds,toUnixNanoseconds,toUnixSeconds,tokenInfo,tokenizeFormat,totalDuration,translateDateFnsFormatString,translateDayjsFormatString,truncate,tryParse,union,validateFormat,weekOfYear,weekYear});
167
167
  //# sourceMappingURL=index.cjs.map