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/interval.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var V=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!fe.call(e,r)&&r!==n&&V(e,r,{get:()=>t[r],enumerable:!(o=ce(t,r))||o.enumerable});return e};var ge=e=>he(V({},"__esModule",{value:!0}),e);var Xe={};pe(Xe,{contains:()=>$e,difference:()=>ue,formatRange:()=>We,formatRangeToParts:()=>Ye,intersection:()=>ve,intersects:()=>b,interval:()=>Le,isAfter:()=>Ae,isBefore:()=>Ne,mergeIntervals:()=>Re,overlaps:()=>Pe,splitInterval:()=>Ue,subtract:()=>Ce,union:()=>Ve});module.exports=ge(Xe);var ye=[0,31,59,90,120,151,181,212,243,273,304,334];function H(e){return e%4===0&&e%100!==0||e%400===0}function E(e){return H(e)?366:365}function x(e,t,n){let o=ye[t-1]+n;return t>2&&H(e)&&(o+=1),o}var C=2e3;function we(e){let t=0;if(e>=C)for(let o=C;o<e;o++)t+=E(o);else for(let o=e;o<C;o++)t-=E(o);return((5+t)%7+7)%7+1}function R(e,t,n,o){let a=x(e,t,n)+(4-o),s,i;a<1?(s=e-1,i=a+E(s)):a>E(e)?(s=e+1,i=a-E(e)):(s=e,i=a);let c=1+(4-we(s)+7)%7,d=1+Math.floor((i-c)/7);return{isoYear:s,week:d}}function F(e){if(typeof e!="object"||e===null)throw new Error(`temporal-fmt: expected a date-carrying Temporal value, got ${String(e)}.`);let t=e,n={};if(typeof t.year=="number"&&(n.year=t.year),typeof t.month=="number"&&(n.month=t.month),typeof t.day=="number"&&(n.day=t.day),typeof t.hour=="number"&&(n.hour=t.hour),typeof t.minute=="number"&&(n.minute=t.minute),typeof t.second=="number"&&(n.second=t.second),typeof t.millisecond=="number"&&(n.millisecond=t.millisecond),typeof t.dayOfWeek=="number"&&(n.dayOfWeek=t.dayOfWeek),typeof t.calendarId=="string"&&(n.calendarId=t.calendarId),n.year===void 0||n.month===void 0||n.day===void 0)throw new Error("temporal-fmt: value is missing year/month/day fields \u2014 pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.");return n}function B(e){let t=e.year,n=e.month,o=e.day,r=n<=2?t-1:t,a=Math.floor((r>=0?r:r-399)/400),s=r-a*400,i=n>2?n-3:n+9,u=Math.floor((153*i+2)/5)+o-1,c=s*365+Math.floor(s/4)-Math.floor(s/100)+u;return(a*146097+c-719468)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}function q(e){return F(e)}function l(e,t){let n=q(e),o=q(t),r=B(n),a=B(o);return r<a?-1:r>a?1:0}var be,ke=[];function G(e){ke.push(e)}function Te(){return be??globalThis.Temporal}function Q(){let e=Te();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 S=class extends Error{code;input;format;token;position;expected;actual;reason;constructor(t,n){super(t),this.name="TemporalFmtError",this.code=n.code,this.input=n.input,this.format=n.format,this.token=n.token,this.position=n.position,this.expected=n.expected,this.actual=n.actual,this.reason=n.reason;let o=Error.captureStackTrace;typeof o=="function"&&o(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}}},p=class extends S{constructor(t){let{message:n,...o}=t;super(n??`format string "${t.format??""}" has a syntax error${t.reason?`: ${t.reason}`:""}.`,{code:"FORMAT_SYNTAX_ERROR",...o}),this.name="FormatSyntaxError"}},g=class extends S{constructor(t){let{message:n,...o}=t;super(n??`token "${t.token??""}" is not a recognized temporal-fmt token${t.format?` in format string "${t.format}"`:""}.`,{code:"UNKNOWN_TOKEN",...o}),this.name="UnknownTokenError"}};/* c8 ignore start @preserve -- InvalidTimeError is part of the public
1
+ "use strict";var V=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!fe.call(e,r)&&r!==n&&V(e,r,{get:()=>t[r],enumerable:!(o=ce(t,r))||o.enumerable});return e};var ge=e=>he(V({},"__esModule",{value:!0}),e);var Xe={};pe(Xe,{contains:()=>$e,difference:()=>ue,formatRange:()=>We,formatRangeToParts:()=>Ye,intersection:()=>ve,intersects:()=>b,interval:()=>Le,isAfter:()=>Ae,isBefore:()=>Ne,mergeIntervals:()=>Re,overlaps:()=>Pe,splitInterval:()=>Ue,subtract:()=>Ce,union:()=>Ve});module.exports=ge(Xe);var ye=[0,31,59,90,120,151,181,212,243,273,304,334];function H(e){return e%4===0&&e%100!==0||e%400===0}function x(e){return H(e)?366:365}function E(e,t,n){let o=ye[t-1]+n;return t>2&&H(e)&&(o+=1),o}var C=2e3;function we(e){let t=0;if(e>=C)for(let o=C;o<e;o++)t+=x(o);else for(let o=e;o<C;o++)t-=x(o);return((5+t)%7+7)%7+1}function R(e,t,n,o){let a=E(e,t,n)+(4-o),s,i;a<1?(s=e-1,i=a+x(s)):a>x(e)?(s=e+1,i=a-x(e)):(s=e,i=a);let c=1+(4-we(s)+7)%7,d=1+Math.floor((i-c)/7);return{isoYear:s,week:d}}function F(e){if(typeof e!="object"||e===null)throw new Error(`temporal-fmt: expected a date-carrying Temporal value, got ${String(e)}.`);let t=e,n={};if(typeof t.year=="number"&&(n.year=t.year),typeof t.month=="number"&&(n.month=t.month),typeof t.day=="number"&&(n.day=t.day),typeof t.hour=="number"&&(n.hour=t.hour),typeof t.minute=="number"&&(n.minute=t.minute),typeof t.second=="number"&&(n.second=t.second),typeof t.millisecond=="number"&&(n.millisecond=t.millisecond),typeof t.dayOfWeek=="number"&&(n.dayOfWeek=t.dayOfWeek),typeof t.calendarId=="string"&&(n.calendarId=t.calendarId),n.year===void 0||n.month===void 0||n.day===void 0)throw new Error("temporal-fmt: value is missing year/month/day fields \u2014 pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.");return n}function B(e){let t=e.year,n=e.month,o=e.day,r=n<=2?t-1:t,a=Math.floor((r>=0?r:r-399)/400),s=r-a*400,i=n>2?n-3:n+9,u=Math.floor((153*i+2)/5)+o-1,c=s*365+Math.floor(s/4)-Math.floor(s/100)+u;return(a*146097+c-719468)*864e5+(e.hour??0)*36e5+(e.minute??0)*6e4+(e.second??0)*1e3+(e.millisecond??0)}function q(e){return F(e)}function l(e,t){let n=q(e),o=q(t),r=B(n),a=B(o);return r<a?-1:r>a?1:0}var be,ke=[];function G(e){ke.push(e)}function Te(){return be??globalThis.Temporal}function Q(){let e=Te();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 S=class extends Error{code;input;format;token;position;expected;actual;reason;constructor(t,n){super(t),this.name="TemporalFmtError",this.code=n.code,this.input=n.input,this.format=n.format,this.token=n.token,this.position=n.position,this.expected=n.expected,this.actual=n.actual,this.reason=n.reason;let o=Error.captureStackTrace;typeof o=="function"&&o(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}}},p=class extends S{constructor(t){let{message:n,...o}=t;super(n??`format string "${t.format??""}" has a syntax error${t.reason?`: ${t.reason}`:""}.`,{code:"FORMAT_SYNTAX_ERROR",...o}),this.name="FormatSyntaxError"}},g=class extends S{constructor(t){let{message:n,...o}=t;super(n??`token "${t.token??""}" is not a recognized temporal-fmt token${t.format?` in format string "${t.format}"`:""}.`,{code:"UNKNOWN_TOKEN",...o}),this.name="UnknownTokenError"}};/* 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
@@ -21,7 +21,7 @@
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
23
  parameter that could be invalid. *//* c8 ignore stop @preserve */var y=class extends S{constructor(t){let{message:n,...o}=t;super(n??`locale "${t.actual??""}" is not a valid BCP-47 tag${t.reason?`: ${t.reason}`:""}.`,{code:"INVALID_LOCALE",...o}),this.name="InvalidLocaleError"}};/* c8 ignore start @preserve -- unreachable from the current test suite,
24
- see rationale above *//* c8 ignore stop @preserve */var De=new Map;function O(e){return e.replace(/_/g,"-")}var I=new Map,Ee=500;function U(e){let t=I.get(e);if(t!==void 0)return t;let n;try{n=new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{n=e}if(I.size>=Ee){let o=I.keys().next().value;o!==void 0&&I.delete(o)}return I.set(e,n),n}function f(e){let t=U(e);return De.get(t)}function m(e,t){let n=e<0,o=String(Math.abs(e)).padStart(t,"0");return n?"-"+o:o}m.fraction=function(t,n){let o=t.millisecond*1e6+(t.microsecond??0)*1e3+(t.nanosecond??0);return m(o,9).slice(0,n)};var W="en-US",M=new Map,xe=500;function J(e,t){let n=JSON.stringify([U(e),t]),o=M.get(n);if(o)return o;if(M.size>=xe){let r=M.keys().next().value;r!==void 0&&M.delete(r)}try{o=new Intl.DateTimeFormat(O(e),t)}catch(r){throw new y({actual:e,reason:r.message})}return M.set(n,o),o}var _;G(()=>{_=void 0});function Fe(){if(_===void 0){_=!1;try{let e=Q();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),_=!0}catch{}}return _}function L(e,t,n,o){let r=e?.calendarId,a={...n,calendar:r&&r!=="iso8601"?r:"gregory"},s=e.toLocaleString;if(typeof s!="function"||s===Object.prototype.toLocaleString)throw new Error(`temporal-fmt: locale-aware part "${o}" 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(!Fe())try{return s.call(e,O(t),a)}catch(D){throw D instanceof RangeError?new y({actual:t,reason:D.message}):D}let{toInstant:i,timeZoneId:u}=e,c=typeof i=="function"&&typeof u=="string",d=c?e.toInstant():e,K={...a,...c?{timeZone:u}:{}},k=J(t,K).formatToParts(d),P=k.findIndex(D=>D.type===o);if(P===-1)throw new Error(`temporal-fmt: locale "${t}" produced no "${o}" part for this token. This usually means the Temporal object is missing the field the token needs.`);let T=k[P].value,A=k[P-1],v=k[P+1];return A?.type==="literal"&&!/\s/.test(A.value)&&(T=A.value+T),v?.type==="literal"&&!/\s/.test(v.value)&&(T=T+v.value),T}function Se(e,t){let n=f(t);if(n)return e<12?n.dayPeriod[0]:n.dayPeriod[1];let o=new Date(Date.UTC(1970,0,1,e)),a=J(t,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(o).find(s=>s.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${t}" produced no "dayPeriod" part for token "a".`);return a.value}function h(e,t,n,o,r,a){return r&&a!==void 0&&a>=0&&a<r.length?r[a]:L(e,t,n,o)}function w(e,t){if(e==="+00:00"&&(t==="X"||t==="XX"||t==="XXX"))return"Z";let n=e[0],o=e.slice(1,3),r=e.slice(4,6);switch(t){case"X":case"x":return r==="00"?`${n}${o}`:`${n}${o}${r}`;case"XX":case"xx":return`${n}${o}${r}`;case"XXX":case"xxx":return`${n}${o}:${r}`}}var N=[["yyyy",e=>m(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 m(e.year%100,2)},"year"],["MMMM",(e,t)=>{let n=f(t);return h(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["MMM",(e,t)=>{let n=f(t);return h(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["MM",e=>m(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>m(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,t)=>{let n=f(t);return h(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,t)=>{let n=f(t);return h(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>m(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>m(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>m(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>m(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSSSSSSSS",e=>m.fraction(e,9),"millisecond"],["SSSSSSSS",e=>m.fraction(e,8),"millisecond"],["SSSSSSS",e=>m.fraction(e,7),"millisecond"],["SSSSSS",e=>m.fraction(e,6),"millisecond"],["SSSSS",e=>m.fraction(e,5),"millisecond"],["SSSS",e=>m.fraction(e,4),"millisecond"],["SSS",e=>m.fraction(e,3),"millisecond"],["SS",e=>m.fraction(e,2),"millisecond"],["S",e=>m.fraction(e,1),"millisecond"],["a",(e,t)=>Se(e.hour,t),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["xxx",e=>w(e.offset,"xxx"),"offset"],["xx",e=>w(e.offset,"xx"),"offset"],["X",e=>w(e.offset,"X"),"offset"],["XX",e=>w(e.offset,"XX"),"offset"],["XXX",e=>w(e.offset,"XXX"),"offset"],["x",e=>w(e.offset,"x"),"offset"],["do",e=>{let t=e.day,n=t%10,o=t%100;return o>=11&&o<=13?t+"th":n===1?t+"st":n===2?t+"nd":n===3?t+"rd":t+"th"},"day"],["Q",e=>String(Math.ceil(e.month/3)),"month"],["QQQ",e=>"Q"+Math.ceil(e.month/3),"month"],["ww",e=>{let{week:t}=R(e.year,e.month,e.day,e.dayOfWeek);return m(t,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:t}=R(e.year,e.month,e.day,e.dayOfWeek);return m(t,4)},"dayOfWeek"],["D",e=>String(x(e.year,e.month,e.day)),"day"],["DD",e=>m(x(e.year,e.month,e.day),2),"day"],["DDD",e=>m(x(e.year,e.month,e.day),3),"day"],["LLLL",(e,t)=>{let n=f(t);return h(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["LLL",(e,t)=>{let n=f(t);return h(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["cccc",(e,t)=>{let n=f(t);return h(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["ccc",(e,t)=>{let n=f(t);return h(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["GGGG",(e,t)=>L(e,t,{era:"long"},"era"),"year"],["G",(e,t)=>L(e,t,{era:"short"},"era"),"year"],["zzzz",(e,t)=>L(e,t,{timeZoneName:"longGeneric"},"timeZoneName"),"timeZoneId"],["z",(e,t)=>L(e,t,{timeZoneName:"short"},"timeZoneName"),"timeZoneId"]];var Ie=N.map(([e])=>e).sort((e,t)=>t.length-e.length);function ee(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="'"){if(e[n+1]==="'"){Y(t,"'"),n+=2;continue}let a=n+1,s="",i=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){s+="'",a+=2;continue}i=!0,a+=1;break}s+=e[a],a+=1}if(!i)throw new p({format:e,message:`temporal-fmt: unterminated quote in format string "${e}"`});Y(t,s),n=a;continue}let r=Ie.find(a=>e.startsWith(a,n));if(r){let a=r[r.length-1];if(e[n+r.length]===a){let s=n+r.length;for(;e[s]===a;)s+=1;throw new g({format:e,token:e.slice(n,s),message:`temporal-fmt: "${e.slice(n,s)}" in format string "${e}" isn't a recognized token \u2014 did you mean "${r}"?`})}t.push({kind:"token",value:r}),n+=r.length;continue}Y(t,o),n+=1}return t}function Y(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}var te=new Set(["latn","arab","deva","beng","guru","gujr","orya","tamldec","telu","knda","mlym","fullwide","hanidec"]),ne=new Map;function Oe(e){let t=ne.get(e);if(t)return t;/* c8 ignore start @preserve -- dead by construction, not just
24
+ see rationale above *//* c8 ignore stop @preserve */var De=new Map;function O(e){return e.replace(/_/g,"-")}var I=new Map,xe=500;function U(e){let t=I.get(e);if(t!==void 0)return t;let n;try{n=new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{n=e}if(I.size>=xe){let o=I.keys().next().value;o!==void 0&&I.delete(o)}return I.set(e,n),n}function f(e){let t=U(e);return De.get(t)}function m(e,t){let n=e<0,o=String(Math.abs(e)).padStart(t,"0");return n?"-"+o:o}m.fraction=function(t,n){let o=t.millisecond*1e6+(t.microsecond??0)*1e3+(t.nanosecond??0);return m(o,9).slice(0,n)};var W="en-US",M=new Map,Ee=500;function J(e,t){let n=JSON.stringify([U(e),t]),o=M.get(n);if(o)return o;if(M.size>=Ee){let r=M.keys().next().value;r!==void 0&&M.delete(r)}try{o=new Intl.DateTimeFormat(O(e),t)}catch(r){throw new y({actual:e,reason:r.message})}return M.set(n,o),o}var _;G(()=>{_=void 0});function Fe(){if(_===void 0){_=!1;try{let e=Q();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),_=!0}catch{}}return _}function L(e,t,n,o){let r=e?.calendarId,a={...n,calendar:r&&r!=="iso8601"?r:"gregory"},s=e.toLocaleString;if(typeof s!="function"||s===Object.prototype.toLocaleString)throw new Error(`temporal-fmt: locale-aware part "${o}" 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(!Fe())try{return s.call(e,O(t),a)}catch(D){throw D instanceof RangeError?new y({actual:t,reason:D.message}):D}let{toInstant:i,timeZoneId:u}=e,c=typeof i=="function"&&typeof u=="string",d=c?e.toInstant():e,K={...a,...c?{timeZone:u}:{}},k=J(t,K).formatToParts(d),P=k.findIndex(D=>D.type===o);if(P===-1)throw new Error(`temporal-fmt: locale "${t}" produced no "${o}" part for this token. This usually means the Temporal object is missing the field the token needs.`);let T=k[P].value,A=k[P-1],v=k[P+1];return A?.type==="literal"&&!/\s/.test(A.value)&&(T=A.value+T),v?.type==="literal"&&!/\s/.test(v.value)&&(T=T+v.value),T}function Se(e,t){let n=f(t);if(n)return e<12?n.dayPeriod[0]:n.dayPeriod[1];let o=new Date(Date.UTC(1970,0,1,e)),a=J(t,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(o).find(s=>s.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${t}" produced no "dayPeriod" part for token "a".`);return a.value}function h(e,t,n,o,r,a){return r&&a!==void 0&&a>=0&&a<r.length?r[a]:L(e,t,n,o)}function w(e,t){if(e==="+00:00"&&(t==="X"||t==="XX"||t==="XXX"))return"Z";if(e.length>6){if(t==="xxx")return e;throw new Error(`temporal-fmt: token "${t}" 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 n=e[0],o=e.slice(1,3),r=e.slice(4,6);switch(t){case"X":case"x":return r==="00"?`${n}${o}`:`${n}${o}${r}`;case"XX":case"xx":return`${n}${o}${r}`;case"XXX":case"xxx":return`${n}${o}:${r}`}}var N=[["yyyy",e=>m(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 m(e.year%100,2)},"year"],["y",e=>m(e.year,0),"year"],["MMMM",(e,t)=>{let n=f(t);return h(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["MMM",(e,t)=>{let n=f(t);return h(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["MM",e=>m(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>m(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,t)=>{let n=f(t);return h(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,t)=>{let n=f(t);return h(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>m(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>m(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>m(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>m(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSSSSSSSS",e=>m.fraction(e,9),"millisecond"],["SSSSSSSS",e=>m.fraction(e,8),"millisecond"],["SSSSSSS",e=>m.fraction(e,7),"millisecond"],["SSSSSS",e=>m.fraction(e,6),"millisecond"],["SSSSS",e=>m.fraction(e,5),"millisecond"],["SSSS",e=>m.fraction(e,4),"millisecond"],["SSS",e=>m.fraction(e,3),"millisecond"],["SS",e=>m.fraction(e,2),"millisecond"],["S",e=>m.fraction(e,1),"millisecond"],["a",(e,t)=>Se(e.hour,t),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["xxx",e=>w(e.offset,"xxx"),"offset"],["xx",e=>w(e.offset,"xx"),"offset"],["X",e=>w(e.offset,"X"),"offset"],["XX",e=>w(e.offset,"XX"),"offset"],["XXX",e=>w(e.offset,"XXX"),"offset"],["x",e=>w(e.offset,"x"),"offset"],["do",e=>{let t=e.day,n=t%10,o=t%100;return o>=11&&o<=13?t+"th":n===1?t+"st":n===2?t+"nd":n===3?t+"rd":t+"th"},"day"],["Q",e=>String(Math.ceil(e.month/3)),"month"],["QQQ",e=>"Q"+Math.ceil(e.month/3),"month"],["ww",e=>{let{week:t}=R(e.year,e.month,e.day,e.dayOfWeek);return m(t,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:t}=R(e.year,e.month,e.day,e.dayOfWeek);return m(t,4)},"dayOfWeek"],["D",e=>String(E(e.year,e.month,e.day)),"day"],["DD",e=>m(E(e.year,e.month,e.day),2),"day"],["DDD",e=>m(E(e.year,e.month,e.day),3),"day"],["LLLL",(e,t)=>{let n=f(t);return h(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["LLL",(e,t)=>{let n=f(t);return h(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["cccc",(e,t)=>{let n=f(t);return h(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["ccc",(e,t)=>{let n=f(t);return h(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["GGGG",(e,t)=>L(e,t,{era:"long"},"era"),"year"],["G",(e,t)=>L(e,t,{era:"short"},"era"),"year"],["zzzz",(e,t)=>L(e,t,{timeZoneName:"longGeneric"},"timeZoneName"),"timeZoneId"],["z",(e,t)=>L(e,t,{timeZoneName:"short"},"timeZoneName"),"timeZoneId"]];var Ie=N.map(([e])=>e).sort((e,t)=>t.length-e.length);function ee(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="'"){if(e[n+1]==="'"){Y(t,"'"),n+=2;continue}let a=n+1,s="",i=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){s+="'",a+=2;continue}i=!0,a+=1;break}s+=e[a],a+=1}if(!i)throw new p({format:e,message:`temporal-fmt: unterminated quote in format string "${e}"`});Y(t,s),n=a;continue}let r=Ie.find(a=>e.startsWith(a,n));if(r){let a=r[r.length-1];if(e[n+r.length]===a){let s=n+r.length;for(;e[s]===a;)s+=1;throw new g({format:e,token:e.slice(n,s),message:`temporal-fmt: "${e.slice(n,s)}" in format string "${e}" isn't a recognized token \u2014 did you mean "${r}"?`})}t.push({kind:"token",value:r}),n+=r.length;continue}Y(t,o),n+=1}return t}function Y(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}var te=new Set(["latn","arab","deva","beng","guru","gujr","orya","tamldec","telu","knda","mlym","fullwide","hanidec"]),ne=new Map;function Oe(e){let t=ne.get(e);if(t)return t;/* c8 ignore start @preserve -- dead by construction, not just
25
25
  untested: both callers (convertDigits, convertDigitsToAscii) already
26
26
  return early on system === 'latn' before calling getDigitMap at all,
27
27
  so this function is never invoked with 'latn'. Kept as a defensive