@trackunit/date-and-time-utils 0.0.1 → 0.0.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.
package/index.cjs.js CHANGED
@@ -6,6 +6,12 @@ class JSBI extends Array{constructor(i,_){if(super(i),this.sign=_,Object.setProt
6
6
 
7
7
  const t={};function MakeIntrinsicClass(e,t){Object.defineProperty(e.prototype,Symbol.toStringTag,{value:t,writable:!1,enumerable:!1,configurable:!0});for(const t of Object.getOwnPropertyNames(e)){const r=Object.getOwnPropertyDescriptor(e,t);r.configurable&&r.enumerable&&(r.enumerable=!1,Object.defineProperty(e,t,r));}for(const t of Object.getOwnPropertyNames(e.prototype)){const r=Object.getOwnPropertyDescriptor(e.prototype,t);r.configurable&&r.enumerable&&(r.enumerable=!1,Object.defineProperty(e.prototype,t,r));}DefineIntrinsic(t,e),DefineIntrinsic(`${t}.prototype`,e.prototype);}function DefineIntrinsic(e,r){const o=`%${e}%`;if(void 0!==t[o])throw new Error(`intrinsic ${e} already exists`);t[o]=r;}function GetIntrinsic(e){return t[e]}const r="slot-epochNanoSeconds",o="slot-timezone-identifier",n="slot-year",a="slot-month",i="slot-day",s="slot-hour",l="slot-minute",d="slot-second",m="slot-millisecond",c="slot-microsecond",h="slot-nanosecond",u="slot-calendar",T="slot-cached-instant",p="slot-time-zone",f="slot-years",y="slot-months",S="slot-weeks",w="slot-days",g="slot-hours",I="slot-minutes",D="slot-seconds",G="slot-milliseconds",v="slot-microseconds",O="slot-nanoseconds",C="slot-calendar-identifier",E=new WeakMap;function CreateSlots(e){E.set(e,Object.create(null));}function GetSlots(e){return E.get(e)}function HasSlot(e,...t){if(!e||"object"!=typeof e)return !1;const r=GetSlots(e);return !!r&&t.reduce(((e,t)=>e&&t in r),!0)}function GetSlot(e,t){const r=GetSlots(e)[t];if(void 0===r)throw new TypeError(`Missing internal slot ${t}`);return r}function SetSlot(e,t,r){GetSlots(e)[t]=r;}const b=/\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/,M=new RegExp(`(?:(?:${b.source})(?:\\/(?:${b.source}))*|Etc/GMT[-+]\\d{1,2}|${/(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/.source})`),R=/[A-Za-z0-9]{3,8}/,Z=new RegExp(`(?:${R.source}(?:-${R.source})*)`),P=/(?:[+\u2212-]\d{6}|\d{4})/,F=/(?:0[1-9]|1[0-2])/,Y=/(?:0[1-9]|[12]\d|3[01])/,j=new RegExp(`(${P.source})(?:-(${F.source})-(${Y.source})|(${F.source})(${Y.source}))`),$=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,B=/([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/,N=new RegExp(`(?:([zZ])|(?:${B.source})?)(?:\\[(${M.source})\\])?`),k=new RegExp(`\\[u-ca=(${Z.source})\\]`),A=new RegExp(`^${j.source}(?:(?:T|\\s+)${$.source})?${N.source}(?:${k.source})?$`,"i"),U=new RegExp(`^T?${$.source}(?:${N.source})?(?:${k.source})?$`,"i"),L=new RegExp(`^(${P.source})-?(${F.source})$`),x=new RegExp(`^(?:--)?(${F.source})-?(${Y.source})$`),H=/(\d+)(?:[.,](\d{1,9}))?/,q=new RegExp(`(?:${H.source}H)?(?:${H.source}M)?(?:${H.source}S)?`),W=new RegExp(`^([+−-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${q.source})?$`,"i"),z=Array.prototype.includes,_=Array.prototype.push,J=globalThis.Intl.DateTimeFormat,V=Math.min,X=Math.max,K=Math.abs,Q=Math.floor,ee=Math.sign,te=Math.trunc,re=Number.isNaN,oe=Number.isFinite,ne=Number,ae=String,ie=Number.MAX_SAFE_INTEGER,se=Object.assign,le=Object.create,de=Object.getOwnPropertyDescriptor,me=Object.is,ce=Reflect.apply,he=JSBI.BigInt(0),ue=JSBI.BigInt(1),Te=JSBI.BigInt(60),pe=JSBI.BigInt(1e3),fe=JSBI.BigInt(1e6),ye=JSBI.BigInt(1e9),Se=JSBI.BigInt(-1),we=JSBI.multiply(JSBI.BigInt(86400),ye),ge=JSBI.multiply(JSBI.BigInt(-86400),JSBI.BigInt(1e17)),Ie=JSBI.multiply(JSBI.BigInt(86400),JSBI.BigInt(1e17)),De=JSBI.multiply(JSBI.BigInt(-388152),JSBI.BigInt(1e13)),Ge=JSBI.multiply(we,JSBI.BigInt(3660)),ve=JSBI.multiply(we,JSBI.BigInt(366)),Oe=JSBI.multiply(we,JSBI.BigInt(14)),Ce=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"];function IsInteger(e){if("number"!=typeof e||!oe(e))return !1;const t=K(e);return Q(t)===t}function IsObject(e){return "object"==typeof e&&null!==e||"function"==typeof e}function ToNumber(e){if("bigint"==typeof e)throw new TypeError("Cannot convert BigInt to number");return ne(e)}function ToInteger(e){const t=ToNumber(e);if(re(t))return 0;const r=te(t);return 0===t?0:r}function ToString(e){if("symbol"==typeof e)throw new TypeError("Cannot convert a Symbol value to a String");return ae(e)}function ToIntegerThrowOnInfinity(e){const t=ToInteger(e);if(!oe(t))throw new RangeError("infinity is out of range");return t}function ToPositiveInteger(e,t){const r=ToInteger(e);if(!oe(r))throw new RangeError("infinity is out of range");if(r<1){if(void 0!==t)throw new RangeError(`property '${t}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return r}function ToIntegerWithoutRounding(e){const t=ToNumber(e);if(re(t))return 0;if(!oe(t))throw new RangeError("infinity is out of range");if(!IsInteger(t))throw new RangeError(`unsupported fractional value ${t}`);return ToInteger(t)}function divmod(t,r){return {quotient:JSBI.divide(t,r),remainder:JSBI.remainder(t,r)}}function abs(t){return JSBI.lessThan(t,he)?JSBI.multiply(t,Se):t}function ArrayPush(e,...t){return _.apply(e,t),e}const Ee=new Map([["year",ToIntegerThrowOnInfinity],["month",ToPositiveInteger],["monthCode",ToString],["day",ToPositiveInteger],["hour",ToIntegerThrowOnInfinity],["minute",ToIntegerThrowOnInfinity],["second",ToIntegerThrowOnInfinity],["millisecond",ToIntegerThrowOnInfinity],["microsecond",ToIntegerThrowOnInfinity],["nanosecond",ToIntegerThrowOnInfinity],["years",ToIntegerWithoutRounding],["months",ToIntegerWithoutRounding],["weeks",ToIntegerWithoutRounding],["days",ToIntegerWithoutRounding],["hours",ToIntegerWithoutRounding],["minutes",ToIntegerWithoutRounding],["seconds",ToIntegerWithoutRounding],["milliseconds",ToIntegerWithoutRounding],["microseconds",ToIntegerWithoutRounding],["nanoseconds",ToIntegerWithoutRounding],["era",ToString],["eraYear",ToInteger],["offset",ToString]]),be=new Map([["hour",0],["minute",0],["second",0],["millisecond",0],["microsecond",0],["nanosecond",0]]),Me=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],Re=new Map(Me.map((e=>[e[0],e[1]]))),Ze=new Map(Me.map((([e,t])=>[t,e]))),Pe=Me.map((([,e])=>e)),Fe=Array.from(Re.keys()).sort(),Ye=new Map;function getIntlDateTimeFormatEnUsForTimeZone(e){let t=Ye.get(e);return void 0===t&&(t=new J("en-us",{timeZone:ae(e),hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ye.set(e,t)),t}function IsTemporalInstant(e){return HasSlot(e,r)&&!HasSlot(e,p,u)}function IsTemporalTimeZone(e){return HasSlot(e,o)}function IsTemporalCalendar(e){return HasSlot(e,C)}function IsTemporalDuration(e){return HasSlot(e,f,y,w,g,I,D,G,v,O)}function IsTemporalDate(e){return HasSlot(e,"slot-date-brand")}function IsTemporalTime(e){return HasSlot(e,s,l,d,m,c,h)&&!HasSlot(e,n,a,i)}function IsTemporalDateTime(e){return HasSlot(e,n,a,i,s,l,d,m,c,h)}function IsTemporalYearMonth(e){return HasSlot(e,"slot-year-month-brand")}function IsTemporalMonthDay(e){return HasSlot(e,"slot-month-day-brand")}function IsTemporalZonedDateTime(e){return HasSlot(e,r,p,u)}function RejectObjectWithCalendarOrTimeZone(e){if(HasSlot(e,u)||HasSlot(e,p))throw new TypeError("with() does not support a calendar or timeZone property");if(void 0!==e.calendar)throw new TypeError("with() does not support a calendar property");if(void 0!==e.timeZone)throw new TypeError("with() does not support a timeZone property")}function ParseTemporalTimeZone(e){let{ianaName:t,offset:r,z:o}=function ParseTemporalTimeZoneString(e){try{let t=GetCanonicalTimeZoneIdentifier(e);if(t)return {ianaName:t.toString()}}catch{}try{const t=ParseISODateTime(e);if(t.z||t.offset||t.ianaName)return t}catch{}throw new RangeError(`Invalid time zone: ${e}`)}(e);return t||(o?"UTC":r)}function FormatCalendarAnnotation(e,t){return "never"===t||"auto"===t&&"iso8601"===e?"":`[u-ca=${e}]`}function ParseISODateTime(e){const t=A.exec(e);if(!t)throw new RangeError(`invalid ISO 8601 string: ${e}`);let r=t[1];if("−"===r[0]&&(r=`-${r.slice(1)}`),"-000000"===r)throw new RangeError(`invalid ISO 8601 string: ${e}`);const o=ToInteger(r),n=ToInteger(t[2]||t[4]),a=ToInteger(t[3]||t[5]),i=ToInteger(t[6]),s=void 0!==t[6],l=ToInteger(t[7]||t[10]);let d=ToInteger(t[8]||t[11]);60===d&&(d=59);const m=(t[9]||t[12])+"000000000",c=ToInteger(m.slice(0,3)),h=ToInteger(m.slice(3,6)),u=ToInteger(m.slice(6,9));let T,p=!1;if(t[13])T=void 0,p=!0;else if(t[14]&&t[15]){const e="-"===t[14]||"−"===t[14]?"-":"+",r=t[15]||"00",o=t[16]||"00",n=t[17]||"00";let a=t[18]||"0";if(T=`${e}${r}:${o}`,+a){for(;a.endsWith("0");)a=a.slice(0,-1);T+=`:${n}.${a}`;}else +n&&(T+=`:${n}`);"-00:00"===T&&(T="+00:00");}let f=t[19];if(f)try{f=GetCanonicalTimeZoneIdentifier(f).toString();}catch{}const y=t[20];return RejectDateTime(o,n,a,i,l,d,c,h,u),{year:o,month:n,day:a,hasTime:s,hour:i,minute:l,second:d,millisecond:c,microsecond:h,nanosecond:u,ianaName:f,offset:T,z:p,calendar:y}}function ParseTemporalYearMonthString(e){const t=L.exec(e);let r,o,n,a;if(t){let a=t[1];if("−"===a[0]&&(a=`-${a.slice(1)}`),"-000000"===a)throw new RangeError(`invalid ISO 8601 string: ${e}`);r=ToInteger(a),o=ToInteger(t[2]),n=t[3];}else {let t;if(({year:r,month:o,calendar:n,day:a,z:t}=ParseISODateTime(e)),t)throw new RangeError("Z designator not supported for PlainYearMonth")}return {year:r,month:o,calendar:n,referenceISODay:a}}function ParseTemporalMonthDayString(e){const t=x.exec(e);let r,o,n,a;if(t)r=ToInteger(t[1]),o=ToInteger(t[2]);else {let t;if(({month:r,day:o,calendar:n,year:a,z:t}=ParseISODateTime(e)),t)throw new RangeError("Z designator not supported for PlainMonthDay")}return {month:r,day:o,calendar:n,referenceISOYear:a}}function ParseTemporalDurationString(e){const t=W.exec(e);if(!t)throw new RangeError(`invalid duration: ${e}`);if(t.slice(2).every((e=>void 0===e)))throw new RangeError(`invalid duration: ${e}`);const r="-"===t[1]||"−"===t[1]?-1:1,o=ToInteger(t[2])*r,n=ToInteger(t[3])*r,a=ToInteger(t[4])*r,i=ToInteger(t[5])*r,s=ToInteger(t[6])*r;let l=t[7],d=ToInteger(t[8])*r,m=t[9],c=ToInteger(t[10])*r;const h=t[11]+"000000000";let u=ToInteger(h.slice(0,3))*r,T=ToInteger(h.slice(3,6))*r,p=ToInteger(h.slice(6,9))*r;return l=l?r*ToInteger(l)/10**l.length:0,m=m?r*ToInteger(m)/10**m.length:0,({minutes:d,seconds:c,milliseconds:u,microseconds:T,nanoseconds:p}=function DurationHandleFractions(e,t,r,o,n,a,i){let s=e,l=t,d=r,m=o,c=n,h=a,u=i;if(0!==s){[l,d,m,c,h,u].forEach((e=>{if(0!==e)throw new RangeError("only the smallest unit can be fractional")}));const e=60*s;l=te(e),d=e%1;}if(0!==d){[m,c,h,u].forEach((e=>{if(0!==e)throw new RangeError("only the smallest unit can be fractional")}));const e=60*d;m=te(e);const t=e%1;if(0!==t){const e=1e3*t;c=te(e);const r=e%1;if(0!==r){const e=1e3*r;h=te(e);const t=e%1;if(0!==t){u=te(1e3*t);}}}}return {minutes:l,seconds:m,milliseconds:c,microseconds:h,nanoseconds:u}}(l,d,m,c,u,T,p)),RejectDuration(o,n,a,i,s,d,c,u,T,p),{years:o,months:n,weeks:a,days:i,hours:s,minutes:d,seconds:c,milliseconds:u,microseconds:T,nanoseconds:p}}function ParseTemporalInstant(e){let{year:t,month:r,day:o,hour:n,minute:a,second:i,millisecond:s,microsecond:l,nanosecond:d,offset:m,z:c}=function ParseTemporalInstantString(e){const t=ParseISODateTime(e);if(!t.z&&!t.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return t}(e);if(!c&&!m)throw new RangeError("Temporal.Instant requires a time zone offset");const h=c?0:ParseTimeZoneOffsetString(m);({year:t,month:r,day:o,hour:n,minute:a,second:i,millisecond:s,microsecond:l,nanosecond:d}=BalanceISODateTime(t,r,o,n,a,i,s,l,d-h));const u=GetEpochFromISOParts(t,r,o,n,a,i,s,l,d);if(null===u)throw new RangeError("DateTime outside of supported range");return u}function RegulateISODate(e,t,r,o){let n=e,a=t,i=r;switch(o){case"reject":RejectISODate(n,a,i);break;case"constrain":({year:n,month:a,day:i}=ConstrainISODate(n,a,i));}return {year:n,month:a,day:i}}function RegulateTime(e,t,r,o,n,a,i){let s=e,l=t,d=r,m=o,c=n,h=a;switch(i){case"reject":RejectTime(s,l,d,m,c,h);break;case"constrain":({hour:s,minute:l,second:d,millisecond:m,microsecond:c,nanosecond:h}=function ConstrainTime(e,t,r,o,n,a){const i=ConstrainToRange(e,0,23),s=ConstrainToRange(t,0,59),l=ConstrainToRange(r,0,59),d=ConstrainToRange(o,0,999),m=ConstrainToRange(n,0,999),c=ConstrainToRange(a,0,999);return {hour:i,minute:s,second:l,millisecond:d,microsecond:m,nanosecond:c}}(s,l,d,m,c,h));}return {hour:s,minute:l,second:d,millisecond:m,microsecond:c,nanosecond:h}}function ToTemporalDurationRecord(e){if(!IsObject(e))return ParseTemporalDurationString(ToString(e));if(IsTemporalDuration(e))return {years:GetSlot(e,f),months:GetSlot(e,y),weeks:GetSlot(e,S),days:GetSlot(e,w),hours:GetSlot(e,g),minutes:GetSlot(e,I),seconds:GetSlot(e,D),milliseconds:GetSlot(e,G),microseconds:GetSlot(e,v),nanoseconds:GetSlot(e,O)};const t={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};let r=function ToTemporalPartialDurationRecord(e){if(!IsObject(e))throw new TypeError("invalid duration-like");const t={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0};let r=!1;for(const o of Fe){const n=e[o];void 0!==n&&(r=!0,t[o]=ToIntegerWithoutRounding(n));}if(!r)throw new TypeError("invalid duration-like");return t}(e);for(const e of Fe){const o=r[e];void 0!==o&&(t[e]=o);}let{years:o,months:n,weeks:a,days:i,hours:s,minutes:l,seconds:d,milliseconds:m,microseconds:c,nanoseconds:h}=t;return RejectDuration(o,n,a,i,s,l,d,m,c,h),{years:o,months:n,weeks:a,days:i,hours:s,minutes:l,seconds:d,milliseconds:m,microseconds:c,nanoseconds:h}}function ToTemporalOverflow(e){return void 0===e?"constrain":GetOption(e,"overflow",["constrain","reject"],"constrain")}function ToTemporalDisambiguation(e){return void 0===e?"compatible":GetOption(e,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function ToTemporalRoundingMode(e,t){return GetOption(e,"roundingMode",["ceil","floor","trunc","halfExpand"],t)}function NegateTemporalRoundingMode(e){switch(e){case"ceil":return "floor";case"floor":return "ceil";default:return e}}function ToTemporalOffset(e,t){return void 0===e?t:GetOption(e,"offset",["prefer","use","ignore","reject"],t)}function ToShowCalendarOption(e){return GetOption(e,"calendarName",["auto","always","never"],"auto")}function ToTemporalRoundingIncrement(e,t,r){let o=1/0;void 0!==t&&(o=t),r||void 0===t||(o=t>1?t-1:1);const n=function GetNumberOption(e,t,r,o,n){let a=e[t];if(void 0===a)return n;const i=ToNumber(a);if(re(i)||i<r||i>o)throw new RangeError(`${String(t)} must be between ${r} and ${o}, not ${i}`);return Q(i)}(e,"roundingIncrement",1,o,1);if(void 0!==t&&t%n!=0)throw new RangeError(`Rounding increment must divide evenly into ${t}`);return n}function ToTemporalDateTimeRoundingIncrement(e,t){return ToTemporalRoundingIncrement(e,{year:void 0,month:void 0,week:void 0,day:void 0,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[t],!1)}function ToSecondsStringPrecision(e){const t=GetTemporalUnit(e,"smallestUnit","time",void 0);if("hour"===t){const e=Me.reduce(((e,[t,r,o])=>("time"===o&&"hour"!==r&&e.push(r,t),e)),[]);throw new RangeError(`smallestUnit must be one of ${e.join(", ")}, not ${t}`)}switch(t){case"minute":return {precision:"minute",unit:"minute",increment:1};case"second":return {precision:0,unit:"second",increment:1};case"millisecond":return {precision:3,unit:"millisecond",increment:1};case"microsecond":return {precision:6,unit:"microsecond",increment:1};case"nanosecond":return {precision:9,unit:"nanosecond",increment:1}}let r=e.fractionalSecondDigits;if(void 0===r&&(r="auto"),"number"!=typeof r){const e=ToString(r);if("auto"===e)return {precision:"auto",unit:"nanosecond",increment:1};throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`)}if(re(r)||r<0||r>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${r}`);const o=Q(r);switch(o){case 0:return {precision:o,unit:"second",increment:1};case 1:case 2:case 3:return {precision:o,unit:"millisecond",increment:10**(3-o)};case 4:case 5:case 6:return {precision:o,unit:"microsecond",increment:10**(6-o)};case 7:case 8:case 9:return {precision:o,unit:"nanosecond",increment:10**(9-o)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${r}`)}}const je=Symbol("~required~");function GetTemporalUnit(e,t,r,o,n=[]){const a=[];for(const[,e,t]of Me)"datetime"!==r&&r!==t||a.push(e);a.push(...n);let i=o;i===je?i=void 0:void 0!==i&&a.push(i);const s=[...a];for(const e of a){const t=Ze.get(e);void 0!==t&&s.push(t);}let l=GetOption(e,t,s,i);if(void 0===l&&o===je)throw new RangeError(`${t} is required`);return Re.has(l)?Re.get(l):l}function ToRelativeTemporalObject(e){const t=e.relativeTo;if(void 0===t)return t;let r,o,n,a,i,s,l,d,m,c,h,u,T="option",p=!1;if(IsObject(t)){if(IsTemporalZonedDateTime(t)||IsTemporalDate(t))return t;if(IsTemporalDateTime(t))return TemporalDateTimeToDate(t);c=GetTemporalCalendarWithISODefault(t);const e=PrepareTemporalFields(t,CalendarFields(c,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]),p=le(null);p.overflow="constrain",({year:r,month:o,day:n,hour:a,minute:i,second:s,millisecond:l,microsecond:d,nanosecond:m}=InterpretTemporalDateTimeFields(c,e,p)),u=t.offset,void 0===u&&(T="wall"),h=t.timeZone;}else {let e,f;(({year:r,month:o,day:n,hour:a,minute:i,second:s,millisecond:l,microsecond:d,nanosecond:m,calendar:c,ianaName:e,offset:u,z:f}=ParseISODateTime(ToString(t)))),e&&(h=e),f?T="exact":u||(T="wall"),c||(c=GetISO8601Calendar()),c=ToTemporalCalendar(c),p=!0;}if(void 0!==h){h=ToTemporalTimeZone(h);let e=0;"option"===T&&(e=ParseTimeZoneOffsetString(ToString(u)));return CreateTemporalZonedDateTime(InterpretISODateTimeOffset(r,o,n,a,i,s,l,d,m,T,e,h,"compatible","reject",p),h,c)}return CreateTemporalDate(r,o,n,c)}function DefaultTemporalLargestUnit(e,t,r,o,n,a,i,s,l,d){for(const[m,c]of [["years",e],["months",t],["weeks",r],["days",o],["hours",n],["minutes",a],["seconds",i],["milliseconds",s],["microseconds",l],["nanoseconds",d]])if(0!==c)return Re.get(m);return "nanosecond"}function LargerOfTwoTemporalUnits(e,t){return Pe.indexOf(e)>Pe.indexOf(t)?t:e}function MergeLargestUnitOption(e,t){let r=e;return void 0===r&&(r=le(null)),se(le(null),r,{largestUnit:t})}function PrepareTemporalFields(e,t,r,{emptySourceErrorMessage:o}={emptySourceErrorMessage:"no supported properties found"}){const n=le(null);let a=!1;for(const o of t){let t=e[o];if(void 0!==t)a=!0,Ee.has(o)&&(t=Ee.get(o)(t)),n[o]=t;else if("partial"!==r){if(z.call(r,o))throw new TypeError(`required property '${o}' missing or undefined`);t=be.get(o),n[o]=t;}}if("partial"===r&&!a)throw new TypeError(o);if(void 0===n.era!=(void 0===n.eraYear))throw new RangeError("properties 'era' and 'eraYear' must be provided together");return n}function ToTemporalTimeRecord(e,t="complete"){const r=["hour","microsecond","millisecond","minute","nanosecond","second"],o=PrepareTemporalFields(e,r,"partial",{emptySourceErrorMessage:"invalid time-like"}),n={};for(const e of r){const r=de(o,e);void 0!==r?n[e]=r.value:"complete"===t&&(n[e]=0);}return n}function ToTemporalDate(e,t){let r=e;if(IsObject(r)){if(IsTemporalDate(r))return r;if(IsTemporalZonedDateTime(r)&&(ToTemporalOverflow(t),r=BuiltinTimeZoneGetPlainDateTimeFor(GetSlot(r,p),GetSlot(r,T),GetSlot(r,u))),IsTemporalDateTime(r))return ToTemporalOverflow(t),CreateTemporalDate(GetSlot(r,n),GetSlot(r,a),GetSlot(r,i),GetSlot(r,u));const e=GetTemporalCalendarWithISODefault(r);return CalendarDateFromFields(e,PrepareTemporalFields(r,CalendarFields(e,["day","month","monthCode","year"]),[]),t)}ToTemporalOverflow(t);const{year:o,month:s,day:l,calendar:d,z:m}=function ParseTemporalDateString(e){return ParseISODateTime(e)}(ToString(r));if(m)throw new RangeError("Z designator not supported for PlainDate");return new(GetIntrinsic("%Temporal.PlainDate%"))(o,s,l,d)}function InterpretTemporalDateTimeFields(e,t,r){let{hour:o,minute:s,second:l,millisecond:d,microsecond:m,nanosecond:c}=ToTemporalTimeRecord(t);const h=ToTemporalOverflow(r),u=CalendarDateFromFields(e,t,r),T=GetSlot(u,n),p=GetSlot(u,a),f=GetSlot(u,i);return ({hour:o,minute:s,second:l,millisecond:d,microsecond:m,nanosecond:c}=RegulateTime(o,s,l,d,m,c,h)),{year:T,month:p,day:f,hour:o,minute:s,second:l,millisecond:d,microsecond:m,nanosecond:c}}function ToTemporalDateTime(e,t){let r,o,s,l,d,m,c,h,f,y;if(IsObject(e)){if(IsTemporalDateTime(e))return e;if(IsTemporalZonedDateTime(e))return ToTemporalOverflow(t),BuiltinTimeZoneGetPlainDateTimeFor(GetSlot(e,p),GetSlot(e,T),GetSlot(e,u));if(IsTemporalDate(e))return ToTemporalOverflow(t),CreateTemporalDateTime(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),0,0,0,0,0,0,GetSlot(e,u));y=GetTemporalCalendarWithISODefault(e);const S=PrepareTemporalFields(e,CalendarFields(y,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]);({year:r,month:o,day:s,hour:l,minute:d,second:m,millisecond:c,microsecond:h,nanosecond:f}=InterpretTemporalDateTimeFields(y,S,t));}else {let n;if(ToTemporalOverflow(t),({year:r,month:o,day:s,hour:l,minute:d,second:m,millisecond:c,microsecond:h,nanosecond:f,calendar:y,z:n}=function ParseTemporalDateTimeString(e){return ParseISODateTime(e)}(ToString(e))),n)throw new RangeError("Z designator not supported for PlainDateTime");RejectDateTime(r,o,s,l,d,m,c,h,f),void 0===y&&(y=GetISO8601Calendar()),y=ToTemporalCalendar(y);}return CreateTemporalDateTime(r,o,s,l,d,m,c,h,f,y)}function ToTemporalDuration(e){if(IsTemporalDuration(e))return e;let{years:t,months:r,weeks:o,days:n,hours:a,minutes:i,seconds:s,milliseconds:l,microseconds:d,nanoseconds:m}=ToTemporalDurationRecord(e);return new(GetIntrinsic("%Temporal.Duration%"))(t,r,o,n,a,i,s,l,d,m)}function ToTemporalInstant(e){if(IsTemporalInstant(e))return e;if(IsTemporalZonedDateTime(e)){return new(GetIntrinsic("%Temporal.Instant%"))(GetSlot(e,r))}const t=ParseTemporalInstant(ToString(e));return new(GetIntrinsic("%Temporal.Instant%"))(t)}function ToTemporalMonthDay(e,t){let r=e;if(IsObject(r)){if(IsTemporalMonthDay(r))return r;let e,o;if(HasSlot(r,u))e=GetSlot(r,u),o=!1;else {let t=r.calendar;o=void 0===t,void 0===t&&(t=GetISO8601Calendar()),e=ToTemporalCalendar(t);}r=r;const n=PrepareTemporalFields(r,CalendarFields(e,["day","month","monthCode","year"]),[]);return o&&void 0!==n.month&&void 0===n.monthCode&&void 0===n.year&&(n.year=1972),CalendarMonthDayFromFields(e,n,t)}ToTemporalOverflow(t);let{month:o,day:n,referenceISOYear:a,calendar:i}=ParseTemporalMonthDayString(ToString(r)),s=i;if(void 0===s&&(s=GetISO8601Calendar()),s=ToTemporalCalendar(s),void 0===a)return RejectISODate(1972,o,n),CreateTemporalMonthDay(o,n,s);return CalendarMonthDayFromFields(s,CreateTemporalMonthDay(o,n,s,a))}function ToTemporalTime(e,t="constrain"){let r,o,n,a,i,f,y,S=e;if(IsObject(S)){if(IsTemporalTime(S))return S;if(IsTemporalZonedDateTime(S)&&(S=BuiltinTimeZoneGetPlainDateTimeFor(GetSlot(S,p),GetSlot(S,T),GetSlot(S,u))),IsTemporalDateTime(S)){return new(GetIntrinsic("%Temporal.PlainTime%"))(GetSlot(S,s),GetSlot(S,l),GetSlot(S,d),GetSlot(S,m),GetSlot(S,c),GetSlot(S,h))}if(y=GetTemporalCalendarWithISODefault(S),"iso8601"!==ToString(y))throw new RangeError("PlainTime can only have iso8601 calendar");(({hour:r,minute:o,second:n,millisecond:a,microsecond:i,nanosecond:f}=ToTemporalTimeRecord(S))),({hour:r,minute:o,second:n,millisecond:a,microsecond:i,nanosecond:f}=RegulateTime(r,o,n,a,i,f,t));}else if(({hour:r,minute:o,second:n,millisecond:a,microsecond:i,nanosecond:f,calendar:y}=function ParseTemporalTimeString(e){const t=U.exec(e);let r,o,n,a,i,s,l;if(t){r=ToInteger(t[1]),o=ToInteger(t[2]||t[5]),n=ToInteger(t[3]||t[6]),60===n&&(n=59);const e=(t[4]||t[7])+"000000000";a=ToInteger(e.slice(0,3)),i=ToInteger(e.slice(3,6)),s=ToInteger(e.slice(6,9)),l=t[15];}else {let t,d;if(({hasTime:d,hour:r,minute:o,second:n,millisecond:a,microsecond:i,nanosecond:s,calendar:l,z:t}=ParseISODateTime(e)),!d)throw new RangeError(`time is missing in string: ${e}`);if(t)throw new RangeError("Z designator not supported for PlainTime")}if(/[tT ][0-9][0-9]/.test(e))return {hour:r,minute:o,second:n,millisecond:a,microsecond:i,nanosecond:s,calendar:l};try{const{month:t,day:r}=ParseTemporalMonthDayString(e);RejectISODate(1972,t,r);}catch{try{const{year:t,month:r}=ParseTemporalYearMonthString(e);RejectISODate(t,r,1);}catch{return {hour:r,minute:o,second:n,millisecond:a,microsecond:i,nanosecond:s,calendar:l}}}throw new RangeError(`invalid ISO 8601 time-only string ${e}; may need a T prefix`)}(ToString(S))),RejectTime(r,o,n,a,i,f),void 0!==y&&"iso8601"!==y)throw new RangeError("PlainTime can only have iso8601 calendar");return new(GetIntrinsic("%Temporal.PlainTime%"))(r,o,n,a,i,f)}function ToTemporalYearMonth(e,t){if(IsObject(e)){if(IsTemporalYearMonth(e))return e;const r=GetTemporalCalendarWithISODefault(e);return CalendarYearMonthFromFields(r,PrepareTemporalFields(e,CalendarFields(r,["month","monthCode","year"]),[]),t)}ToTemporalOverflow(t);let{year:r,month:o,referenceISODay:n,calendar:a}=ParseTemporalYearMonthString(ToString(e)),i=a;if(void 0===i&&(i=GetISO8601Calendar()),i=ToTemporalCalendar(i),void 0===n)return RejectISODate(r,o,1),CreateTemporalYearMonth(r,o,i);return CalendarYearMonthFromFields(i,CreateTemporalYearMonth(r,o,i,n))}function InterpretISODateTimeOffset(t,n,a,i,s,l,d,m,c,h,u,T,p,f,y){const S=new(GetIntrinsic("%Temporal.PlainDateTime%"))(t,n,a,i,s,l,d,m,c);if("wall"===h||"ignore"===f){return GetSlot(BuiltinTimeZoneGetInstantFor(T,S,p),r)}if("exact"===h||"use"===f){const r=GetEpochFromISOParts(t,n,a,i,s,l,d,m,c);if(null===r)throw new RangeError("ZonedDateTime outside of supported range");return JSBI.subtract(r,JSBI.BigInt(u))}const w=GetPossibleInstantsFor(T,S);for(const t of w){const o=GetOffsetNanosecondsFor(T,t),n=JSBI.toNumber(RoundNumberToIncrement(JSBI.BigInt(o),6e10,"halfExpand"));if(o===u||y&&n===u)return GetSlot(t,r)}if("reject"===f){const e=FormatTimeZoneOffsetString(u),t=IsTemporalTimeZone(T)?GetSlot(T,o):"time zone";throw new RangeError(`Offset ${e} is invalid for ${S.toString()} in ${t}`)}return GetSlot(DisambiguatePossibleInstants(w,T,S,p),r)}function ToTemporalZonedDateTime(e,t){let r,o,n,a,i,s,l,d,m,c,h,u,T=!1,p="option";if(IsObject(e)){if(IsTemporalZonedDateTime(e))return e;u=GetTemporalCalendarWithISODefault(e);const T=PrepareTemporalFields(e,ArrayPush(CalendarFields(u,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),"timeZone","offset"),["timeZone"]);(({year:r,month:o,day:n,hour:a,minute:i,second:s,millisecond:l,microsecond:d,nanosecond:m}=InterpretTemporalDateTimeFields(u,T,t))),c=ToTemporalTimeZone(T.timeZone),h=T.offset,void 0===h?p="wall":h=ToString(h);}else {let f,y;if(ToTemporalOverflow(t),({year:r,month:o,day:n,hour:a,minute:i,second:s,millisecond:l,microsecond:d,nanosecond:m,ianaName:f,offset:h,z:y,calendar:u}=function ParseTemporalZonedDateTimeString(e){const t=ParseISODateTime(e);if(!t.ianaName)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return t}(ToString(e))),!f)throw new RangeError("time zone ID required in brackets");y?p="exact":h||(p="wall");c=new(GetIntrinsic("%Temporal.TimeZone%"))(f),u||(u=GetISO8601Calendar()),u=ToTemporalCalendar(u),T=!0;}let f=0;"option"===p&&(f=ParseTimeZoneOffsetString(h));return CreateTemporalZonedDateTime(InterpretISODateTimeOffset(r,o,n,a,i,s,l,d,m,p,f,c,ToTemporalDisambiguation(t),ToTemporalOffset(t,"reject"),T),c,u)}function CreateTemporalDateSlots(e,t,r,o,s){RejectISODate(t,r,o),RejectDateRange(t,r,o),CreateSlots(e),SetSlot(e,n,t),SetSlot(e,a,r),SetSlot(e,i,o),SetSlot(e,u,s),SetSlot(e,"slot-date-brand",!0);}function CreateTemporalDate(e,t,r,o=GetISO8601Calendar()){const n=GetIntrinsic("%Temporal.PlainDate%"),a=le(n.prototype);return CreateTemporalDateSlots(a,e,t,r,o),a}function CreateTemporalDateTimeSlots(e,t,r,o,T,p,f,y,S,w,g){RejectDateTime(t,r,o,T,p,f,y,S,w),RejectDateTimeRange(t,r,o,T,p,f,y,S,w),CreateSlots(e),SetSlot(e,n,t),SetSlot(e,a,r),SetSlot(e,i,o),SetSlot(e,s,T),SetSlot(e,l,p),SetSlot(e,d,f),SetSlot(e,m,y),SetSlot(e,c,S),SetSlot(e,h,w),SetSlot(e,u,g);}function CreateTemporalDateTime(e,t,r,o,n,a,i,s,l,d=GetISO8601Calendar()){const m=GetIntrinsic("%Temporal.PlainDateTime%"),c=le(m.prototype);return CreateTemporalDateTimeSlots(c,e,t,r,o,n,a,i,s,l,d),c}function CreateTemporalMonthDaySlots(e,t,r,o,s){RejectISODate(s,t,r),RejectDateRange(s,t,r),CreateSlots(e),SetSlot(e,a,t),SetSlot(e,i,r),SetSlot(e,n,s),SetSlot(e,u,o),SetSlot(e,"slot-month-day-brand",!0);}function CreateTemporalMonthDay(e,t,r=GetISO8601Calendar(),o=1972){const n=GetIntrinsic("%Temporal.PlainMonthDay%"),a=le(n.prototype);return CreateTemporalMonthDaySlots(a,e,t,r,o),a}function CreateTemporalYearMonthSlots(e,t,r,o,s){RejectISODate(t,r,s),function RejectYearMonthRange(e,t){RejectToRange(e,-271821,275760),-271821===e?RejectToRange(t,4,12):275760===e&&RejectToRange(t,1,9);}(t,r),CreateSlots(e),SetSlot(e,n,t),SetSlot(e,a,r),SetSlot(e,i,s),SetSlot(e,u,o),SetSlot(e,"slot-year-month-brand",!0);}function CreateTemporalYearMonth(e,t,r=GetISO8601Calendar(),o=1){const n=GetIntrinsic("%Temporal.PlainYearMonth%"),a=le(n.prototype);return CreateTemporalYearMonthSlots(a,e,t,r,o),a}function CreateTemporalZonedDateTimeSlots(e,t,o,n){ValidateEpochNanoseconds(t),CreateSlots(e),SetSlot(e,r,t),SetSlot(e,p,o),SetSlot(e,u,n);const a=new(GetIntrinsic("%Temporal.Instant%"))(GetSlot(e,r));SetSlot(e,T,a);}function CreateTemporalZonedDateTime(e,t,r=GetISO8601Calendar()){const o=GetIntrinsic("%Temporal.ZonedDateTime%"),n=le(o.prototype);return CreateTemporalZonedDateTimeSlots(n,e,t,r),n}function GetISO8601Calendar(){return new(GetIntrinsic("%Temporal.Calendar%"))("iso8601")}function CalendarFields(e,t){let r=t;e.fields&&(r=e.fields(r));const o=[];for(const e of r){if("string"!=typeof e)throw new TypeError("bad return from calendar.fields()");_.call(o,e);}return o}function CalendarMergeFields(e,t,r){const o=e.mergeFields;if(!o)return {...t,...r};const n=Reflect.apply(o,e,[t,r]);if(!IsObject(n))throw new TypeError("bad return from calendar.mergeFields()");return n}function CalendarDateAdd(e,t,r,o,n){let a=n;void 0===a&&(a=e.dateAdd);const i=ce(a,e,[t,r,o]);if(!IsTemporalDate(i))throw new TypeError("invalid result");return i}function CalendarDateUntil(e,t,r,o,n){let a=n;void 0===a&&(a=e.dateUntil);const i=ce(a,e,[t,r,o]);if(!IsTemporalDuration(i))throw new TypeError("invalid result");return i}function CalendarYear(e,t){const r=e.year(t);if(void 0===r)throw new RangeError("calendar year result must be an integer");return ToIntegerThrowOnInfinity(r)}function CalendarMonth(e,t){const r=e.month(t);if(void 0===r)throw new RangeError("calendar month result must be a positive integer");return ToPositiveInteger(r)}function CalendarMonthCode(e,t){const r=e.monthCode(t);if(void 0===r)throw new RangeError("calendar monthCode result must be a string");return ToString(r)}function CalendarDay(e,t){const r=e.day(t);if(void 0===r)throw new RangeError("calendar day result must be a positive integer");return ToPositiveInteger(r)}function CalendarEra(e,t){let r=e.era(t);return void 0!==r&&(r=ToString(r)),r}function CalendarEraYear(e,t){let r=e.eraYear(t);return void 0!==r&&(r=ToIntegerThrowOnInfinity(r)),r}function CalendarDayOfWeek(e,t){return e.dayOfWeek(t)}function CalendarDayOfYear(e,t){return e.dayOfYear(t)}function CalendarWeekOfYear(e,t){return e.weekOfYear(t)}function CalendarDaysInWeek(e,t){return e.daysInWeek(t)}function CalendarDaysInMonth(e,t){return e.daysInMonth(t)}function CalendarDaysInYear(e,t){return e.daysInYear(t)}function CalendarMonthsInYear(e,t){return e.monthsInYear(t)}function CalendarInLeapYear(e,t){return e.inLeapYear(t)}function ToTemporalCalendar(e){let t=e;if(IsObject(t)){if(HasSlot(t,u))return GetSlot(t,u);if(!("calendar"in t))return t;if(t=t.calendar,IsObject(t)&&!("calendar"in t))return t}const r=ToString(t),o=GetIntrinsic("%Temporal.Calendar%");if(IsBuiltinCalendar(r))return new o(r);let n;try{({calendar:n}=ParseISODateTime(r));}catch{throw new RangeError(`Invalid calendar: ${r}`)}return n||(n="iso8601"),new o(n)}function GetTemporalCalendarWithISODefault(e){if(HasSlot(e,u))return GetSlot(e,u);const{calendar:t}=e;return void 0===t?GetISO8601Calendar():ToTemporalCalendar(t)}function CalendarEquals(e,t){if(e===t)return !0;return ToString(e)===ToString(t)}function ConsolidateCalendars(e,t){if(e===t)return t;const r=ToString(e),o=ToString(t);if(r===o||"iso8601"===r)return t;if("iso8601"===o)return e;throw new RangeError("irreconcilable calendars")}function CalendarDateFromFields(e,t,r){const o=e.dateFromFields(t,r);if(!IsTemporalDate(o))throw new TypeError("invalid result");return o}function CalendarYearMonthFromFields(e,t,r){const o=e.yearMonthFromFields(t,r);if(!IsTemporalYearMonth(o))throw new TypeError("invalid result");return o}function CalendarMonthDayFromFields(e,t,r){const o=e.monthDayFromFields(t,r);if(!IsTemporalMonthDay(o))throw new TypeError("invalid result");return o}function ToTemporalTimeZone(e){let t=e;if(IsObject(t)){if(IsTemporalZonedDateTime(t))return GetSlot(t,p);if(!("timeZone"in t))return t;if(t=t.timeZone,IsObject(t)&&!("timeZone"in t))return t}const r=ParseTemporalTimeZone(ToString(t));return new(GetIntrinsic("%Temporal.TimeZone%"))(r)}function TimeZoneEquals(e,t){if(e===t)return !0;return ToString(e)===ToString(t)}function TemporalDateTimeToDate(e){return CreateTemporalDate(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),GetSlot(e,u))}function TemporalDateTimeToTime(e){return new(GetIntrinsic("%Temporal.PlainTime%"))(GetSlot(e,s),GetSlot(e,l),GetSlot(e,d),GetSlot(e,m),GetSlot(e,c),GetSlot(e,h))}function GetOffsetNanosecondsFor(e,t){let r=e.getOffsetNanosecondsFor;if("function"!=typeof r)throw new TypeError("getOffsetNanosecondsFor not callable");const o=Reflect.apply(r,e,[t]);if("number"!=typeof o)throw new TypeError("bad return from getOffsetNanosecondsFor");if(!IsInteger(o)||K(o)>864e11)throw new RangeError("out-of-range return from getOffsetNanosecondsFor");return o}function BuiltinTimeZoneGetOffsetStringFor(e,t){return FormatTimeZoneOffsetString(GetOffsetNanosecondsFor(e,t))}function BuiltinTimeZoneGetPlainDateTimeFor(e,t,o){const n=GetSlot(t,r),a=GetOffsetNanosecondsFor(e,t);let{year:i,month:s,day:l,hour:d,minute:m,second:c,millisecond:h,microsecond:u,nanosecond:T}=GetISOPartsFromEpoch(n);return ({year:i,month:s,day:l,hour:d,minute:m,second:c,millisecond:h,microsecond:u,nanosecond:T}=BalanceISODateTime(i,s,l,d,m,c,h,u,T+a)),CreateTemporalDateTime(i,s,l,d,m,c,h,u,T,o)}function BuiltinTimeZoneGetInstantFor(e,t,r){return DisambiguatePossibleInstants(GetPossibleInstantsFor(e,t),e,t,r)}function DisambiguatePossibleInstants(t,r,o,T){const p=GetIntrinsic("%Temporal.Instant%"),f=t.length;if(1===f)return t[0];if(f)switch(T){case"compatible":case"earlier":return t[0];case"later":return t[f-1];case"reject":throw new RangeError("multiple instants found")}const y=GetSlot(o,n),S=GetSlot(o,a),w=GetSlot(o,i),g=GetSlot(o,s),I=GetSlot(o,l),D=GetSlot(o,d),G=GetSlot(o,m),v=GetSlot(o,c),O=GetSlot(o,h),C=GetEpochFromISOParts(y,S,w,g,I,D,G,v,O);if(null===C)throw new RangeError("DateTime outside of supported range");const E=new p(JSBI.subtract(C,we)),b=new p(JSBI.add(C,we)),M=GetOffsetNanosecondsFor(r,E),R=GetOffsetNanosecondsFor(r,b)-M;switch(T){case"earlier":{const e=GetSlot(o,u),t=GetIntrinsic("%Temporal.PlainDateTime%"),n=AddDateTime(y,S,w,g,I,D,G,v,O,e,0,0,0,0,0,0,0,0,0,-R,void 0);return GetPossibleInstantsFor(r,new t(n.year,n.month,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond,e))[0]}case"compatible":case"later":{const e=GetSlot(o,u),t=GetIntrinsic("%Temporal.PlainDateTime%"),n=AddDateTime(y,S,w,g,I,D,G,v,O,e,0,0,0,0,0,0,0,0,0,R,void 0),a=GetPossibleInstantsFor(r,new t(n.year,n.month,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond,e));return a[a.length-1]}case"reject":throw new RangeError("no such instant found")}}function GetPossibleInstantsFor(e,t){const r=e.getPossibleInstantsFor(t),o=[];for(const e of r){if(!IsTemporalInstant(e))throw new TypeError("bad return from getPossibleInstantsFor");_.call(o,e);}return o}function ISOYearString(e){let t;if(e<0||e>9999){t=(e<0?"-":"+")+`000000${K(e)}`.slice(-6);}else t=`0000${e}`.slice(-4);return t}function ISODateTimePartString(e){return `00${e}`.slice(-2)}function FormatSecondsStringPart(e,t,r,o,n){if("minute"===n)return "";const a=`:${ISODateTimePartString(e)}`;let i,s=1e6*t+1e3*r+o;if("auto"===n){if(0===s)return a;for(i=`${s}`.padStart(9,"0");"0"===i[i.length-1];)i=i.slice(0,-1);}else {if(0===n)return a;i=`${s}`.padStart(9,"0").slice(0,n);}return `${a}.${i}`}function TemporalInstantToString(e,t,r){let o=t;if(void 0===o){o=new(GetIntrinsic("%Temporal.TimeZone%"))("UTC");}const u=BuiltinTimeZoneGetPlainDateTimeFor(o,e,GetISO8601Calendar()),T=ISOYearString(GetSlot(u,n)),p=ISODateTimePartString(GetSlot(u,a)),f=ISODateTimePartString(GetSlot(u,i)),y=ISODateTimePartString(GetSlot(u,s)),S=ISODateTimePartString(GetSlot(u,l)),w=FormatSecondsStringPart(GetSlot(u,d),GetSlot(u,m),GetSlot(u,c),GetSlot(u,h),r);let g="Z";if(void 0!==t){g=FormatISOTimeZoneOffsetString(GetOffsetNanosecondsFor(o,e));}return `${T}-${p}-${f}T${y}:${S}${w}${g}`}function TemporalDurationToString(t,r="auto",o){function formatNumber(t){return t<=ie?t.toString(10):JSBI.BigInt(t).toString(10)}const n=GetSlot(t,f),a=GetSlot(t,y),i=GetSlot(t,S),s=GetSlot(t,w),l=GetSlot(t,g),d=GetSlot(t,I);let m=GetSlot(t,D),c=GetSlot(t,G),h=GetSlot(t,v),u=GetSlot(t,O);const T=DurationSign(n,a,i,s,l,d,m,c,h,u);if(o){const{unit:e,increment:t,roundingMode:r}=o;({seconds:m,milliseconds:c,microseconds:h,nanoseconds:u}=RoundDuration(0,0,0,0,0,0,m,c,h,u,t,e,r));}const p=[];n&&p.push(`${formatNumber(K(n))}Y`),a&&p.push(`${formatNumber(K(a))}M`),i&&p.push(`${formatNumber(K(i))}W`),s&&p.push(`${formatNumber(K(s))}D`);const C=[];l&&C.push(`${formatNumber(K(l))}H`),d&&C.push(`${formatNumber(K(d))}M`);const E=[];let b,M,R,Z,P=TotalDurationNanoseconds(0,0,0,m,c,h,u,0);(({quotient:P,remainder:b}=divmod(P,pe))),({quotient:P,remainder:M}=divmod(P,pe)),({quotient:Z,remainder:R}=divmod(P,pe));const F=1e6*K(JSBI.toNumber(R))+1e3*K(JSBI.toNumber(M))+K(JSBI.toNumber(b));let Y;if("auto"===r){if(0!==F)for(Y=`${F}`.padStart(9,"0");"0"===Y[Y.length-1];)Y=Y.slice(0,-1);}else 0!==r&&(Y=`${F}`.padStart(9,"0").slice(0,r));return Y&&E.unshift(".",Y),JSBI.equal(Z,he)&&!E.length&&"auto"===r||E.unshift(abs(Z).toString()),E.length&&C.push(`${E.join("")}S`),C.length&&C.unshift("T"),p.length||C.length?`${T<0?"-":""}P${p.join("")}${C.join("")}`:"PT0S"}function TemporalDateToString(e,t="auto"){return `${ISOYearString(GetSlot(e,n))}-${ISODateTimePartString(GetSlot(e,a))}-${ISODateTimePartString(GetSlot(e,i))}${FormatCalendarAnnotation(ToString(GetSlot(e,u)),t)}`}function TemporalDateTimeToString(e,t,r="auto",o){let T=GetSlot(e,n),p=GetSlot(e,a),f=GetSlot(e,i),y=GetSlot(e,s),S=GetSlot(e,l),w=GetSlot(e,d),g=GetSlot(e,m),I=GetSlot(e,c),D=GetSlot(e,h);if(o){const{unit:e,increment:t,roundingMode:r}=o;({year:T,month:p,day:f,hour:y,minute:S,second:w,millisecond:g,microsecond:I,nanosecond:D}=RoundISODateTime(T,p,f,y,S,w,g,I,D,t,e,r));}return `${ISOYearString(T)}-${ISODateTimePartString(p)}-${ISODateTimePartString(f)}T${ISODateTimePartString(y)}:${ISODateTimePartString(S)}${FormatSecondsStringPart(w,g,I,D,t)}${FormatCalendarAnnotation(ToString(GetSlot(e,u)),r)}`}function TemporalMonthDayToString(e,t="auto"){let r=`${ISODateTimePartString(GetSlot(e,a))}-${ISODateTimePartString(GetSlot(e,i))}`;const o=ToString(GetSlot(e,u));if("always"===t||"iso8601"!==o){r=`${ISOYearString(GetSlot(e,n))}-${r}`;}const s=FormatCalendarAnnotation(o,t);return s&&(r+=s),r}function TemporalYearMonthToString(e,t="auto"){let r=`${ISOYearString(GetSlot(e,n))}-${ISODateTimePartString(GetSlot(e,a))}`;const o=ToString(GetSlot(e,u));if("always"===t||"iso8601"!==o){r+=`-${ISODateTimePartString(GetSlot(e,i))}`;}const s=FormatCalendarAnnotation(o,t);return s&&(r+=s),r}function TemporalZonedDateTimeToString(e,t,o="auto",f="auto",y="auto",S){let w=GetSlot(e,T);if(S){const{unit:t,increment:o,roundingMode:n}=S,a=RoundInstant(GetSlot(e,r),o,t,n);w=new(GetIntrinsic("%Temporal.Instant%"))(a);}const g=GetSlot(e,p),I=BuiltinTimeZoneGetPlainDateTimeFor(g,w,GetISO8601Calendar());let D=`${ISOYearString(GetSlot(I,n))}-${ISODateTimePartString(GetSlot(I,a))}-${ISODateTimePartString(GetSlot(I,i))}T${ISODateTimePartString(GetSlot(I,s))}:${ISODateTimePartString(GetSlot(I,l))}${FormatSecondsStringPart(GetSlot(I,d),GetSlot(I,m),GetSlot(I,c),GetSlot(I,h),t)}`;if("never"!==y){D+=FormatISOTimeZoneOffsetString(GetOffsetNanosecondsFor(g,w));}"never"!==f&&(D+=`[${g}]`);return D+=FormatCalendarAnnotation(ToString(GetSlot(e,u)),o),D}function TestTimeZoneOffsetString(e){return Be.test(ae(e))}function ParseTimeZoneOffsetString(e){const t=Be.exec(ae(e));if(!t)throw new RangeError(`invalid time zone offset: ${e}`);return ("-"===t[1]||"−"===t[1]?-1:1)*(1e9*(60*(60*+t[2]+ +(t[3]||0))+ +(t[4]||0))+ +((t[5]||0)+"000000000").slice(0,9))}function GetCanonicalTimeZoneIdentifier(e){if(TestTimeZoneOffsetString(e)){return FormatTimeZoneOffsetString(ParseTimeZoneOffsetString(e))}return getIntlDateTimeFormatEnUsForTimeZone(ae(e)).resolvedOptions().timeZone}function GetIANATimeZoneOffsetNanoseconds(t,r){const{year:o,month:n,day:a,hour:i,minute:s,second:l,millisecond:d,microsecond:m,nanosecond:c}=GetIANATimeZoneDateTimeParts(t,r),h=GetEpochFromISOParts(o,n,a,i,s,l,d,m,c);if(null===h)throw new RangeError("Date outside of supported range");return JSBI.toNumber(JSBI.subtract(h,t))}function FormatTimeZoneOffsetString(e){const t=e<0?"-":"+",r=K(e),o=r%1e9,n=Q(r/1e9)%60,a=Q(r/6e10)%60,i=ISODateTimePartString(Q(r/36e11)),s=ISODateTimePartString(a),l=ISODateTimePartString(n);let d="";if(o){let e=`${o}`.padStart(9,"0");for(;"0"===e[e.length-1];)e=e.slice(0,-1);d=`:${l}.${e}`;}else n&&(d=`:${l}`);return `${t}${i}:${s}${d}`}function FormatISOTimeZoneOffsetString(t){let r=JSBI.toNumber(RoundNumberToIncrement(JSBI.BigInt(t),6e10,"halfExpand"));const o=r<0?"-":"+";r=K(r);const n=r/6e10%60;return `${o}${ISODateTimePartString(Q(r/36e11))}:${ISODateTimePartString(n)}`}function GetEpochFromISOParts(t,r,o,n,a,i,s,l,d){const m=new Date;m.setUTCHours(n,a,i,s),m.setUTCFullYear(t,r-1,o);const c=m.getTime();if(re(c))return null;let h=JSBI.multiply(JSBI.BigInt(c),fe);return h=JSBI.add(h,JSBI.multiply(JSBI.BigInt(l),pe)),h=JSBI.add(h,JSBI.BigInt(d)),JSBI.lessThan(h,ge)||JSBI.greaterThan(h,Ie)?null:h}function GetISOPartsFromEpoch(t){const{quotient:r,remainder:o}=divmod(t,fe);let n=JSBI.toNumber(r),a=JSBI.toNumber(o);a<0&&(a+=1e6,n-=1);const i=Q(a/1e3)%1e3,s=a%1e3,l=new Date(n);return {epochMilliseconds:n,year:l.getUTCFullYear(),month:l.getUTCMonth()+1,day:l.getUTCDate(),hour:l.getUTCHours(),minute:l.getUTCMinutes(),second:l.getUTCSeconds(),millisecond:l.getUTCMilliseconds(),microsecond:i,nanosecond:s}}function GetIANATimeZoneDateTimeParts(e,t){const{epochMilliseconds:r,millisecond:o,microsecond:n,nanosecond:a}=GetISOPartsFromEpoch(e),{year:i,month:s,day:l,hour:d,minute:m,second:c}=function GetFormatterParts(e,t){const r=getIntlDateTimeFormatEnUsForTimeZone(e);return function parseFromEnUsFormat(e){const t=e.split(/[^\w]+/);if(7!==t.length)throw new RangeError(`expected 7 parts in "${e}`);const r=+t[0],o=+t[1];let n=+t[2];const a=t[3].toUpperCase();if("B"===a||"BC"===a)n=1-n;else if("A"!==a&&"AD"!==a)throw new RangeError(`Unknown era ${a} in "${e}`);let i=+t[4];24===i&&(i=0);const s=+t[5],l=+t[6];if(!(oe(n)&&oe(r)&&oe(o)&&oe(i)&&oe(s)&&oe(l)))throw new RangeError(`Invalid number in "${e}`);return {year:n,month:r,day:o,hour:i,minute:s,second:l}}(r.format(new Date(t)))}(t,r);return BalanceISODateTime(i,s,l,d,m,c,o,n,a)}function maxJSBI(t,r){return JSBI.lessThan(t,r)?r:t}function afterLatestPossibleTzdbRuleChange(){return JSBI.add($e(),Ge)}function GetIANATimeZonePreviousTransition(t,r){const o=afterLatestPossibleTzdbRuleChange(),n=JSBI.greaterThan(t,o),a=n?JSBI.subtract(t,ve):De;let i=JSBI.subtract(t,ue);const s=GetIANATimeZoneOffsetNanoseconds(i,r);let l=i,d=s;for(;s===d&&JSBI.greaterThan(i,a);)l=JSBI.subtract(i,Oe),d=GetIANATimeZoneOffsetNanoseconds(l,r),s===d&&(i=l);if(s===d){if(n){return GetIANATimeZonePreviousTransition(JSBI.subtract(o,we),r)}return null}return bisect((e=>GetIANATimeZoneOffsetNanoseconds(e,r)),l,i,d,s)}function LeapYear(e){if(void 0===e)return !1;return e%4==0&&(!(e%100==0)||e%400==0)}function ISODaysInMonth(e,t){return {standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[LeapYear(e)?"leapyear":"standard"][t-1]}function DayOfWeek(e,t,r){const o=t+(t<3?10:-2),n=e-(t<3?1:0),a=Q(n/100),i=n-100*a,s=(r+Q(2.6*o-.2)+(i+Q(i/4))+(Q(a/4)-2*a))%7;return s+(s<=0?7:0)}function DayOfYear(e,t,r){let o=r;for(let r=t-1;r>0;r--)o+=ISODaysInMonth(e,r);return o}function DurationSign(e,t,r,o,n,a,i,s,l,d){for(const m of [e,t,r,o,n,a,i,s,l,d])if(0!==m)return m<0?-1:1;return 0}function BalanceISOYearMonth(e,t){let r=e,o=t;if(!oe(r)||!oe(o))throw new RangeError("infinity is out of range");return o-=1,r+=Q(o/12),o%=12,o<0&&(o+=12),o+=1,{year:r,month:o}}function BalanceISODate(e,t,r){let o=e,n=t,a=r;if(!oe(a))throw new RangeError("infinity is out of range");({year:o,month:n}=BalanceISOYearMonth(o,n));let i=0,s=n>2?o:o-1;for(;i=LeapYear(s)?366:365,a<-i;)o-=1,s-=1,a+=i;for(s+=1;i=LeapYear(s)?366:365,a>i;)o+=1,s+=1,a-=i;for(;a<1;)(({year:o,month:n}=BalanceISOYearMonth(o,n-1))),a+=ISODaysInMonth(o,n);for(;a>ISODaysInMonth(o,n);)a-=ISODaysInMonth(o,n),({year:o,month:n}=BalanceISOYearMonth(o,n+1));return {year:o,month:n,day:a}}function BalanceISODateTime(e,t,r,o,n,a,i,s,l){const{deltaDays:d,hour:m,minute:c,second:h,millisecond:u,microsecond:T,nanosecond:p}=BalanceTime(o,n,a,i,s,l),{year:f,month:y,day:S}=BalanceISODate(e,t,r+d);return {year:f,month:y,day:S,hour:m,minute:c,second:h,millisecond:u,microsecond:T,nanosecond:p}}function BalanceTime(e,t,r,o,n,a){let i=e,s=t,l=r,d=o,m=n,c=a;if(!(oe(i)&&oe(s)&&oe(l)&&oe(d)&&oe(m)&&oe(c)))throw new RangeError("infinity is out of range");m+=Q(c/1e3),c=NonNegativeModulo(c,1e3),d+=Q(m/1e3),m=NonNegativeModulo(m,1e3),l+=Q(d/1e3),d=NonNegativeModulo(d,1e3),s+=Q(l/60),l=NonNegativeModulo(l,60),i+=Q(s/60),s=NonNegativeModulo(s,60);const h=Q(i/24);return i=NonNegativeModulo(i,24),{deltaDays:h,hour:i,minute:s,second:l,millisecond:d,microsecond:m,nanosecond:c}}function TotalDurationNanoseconds(t,r,o,n,a,i,s,l){const d=JSBI.BigInt(t);let m=JSBI.BigInt(s);0!==t&&(m=JSBI.subtract(JSBI.BigInt(s),JSBI.BigInt(l)));const c=JSBI.add(JSBI.BigInt(r),JSBI.multiply(d,JSBI.BigInt(24))),h=JSBI.add(JSBI.BigInt(o),JSBI.multiply(c,Te)),u=JSBI.add(JSBI.BigInt(n),JSBI.multiply(h,Te)),T=JSBI.add(JSBI.BigInt(a),JSBI.multiply(u,pe)),p=JSBI.add(JSBI.BigInt(i),JSBI.multiply(T,pe));return JSBI.add(JSBI.BigInt(m),JSBI.multiply(p,pe))}function NanosecondsToDays(t,o){const f=GetIntrinsic("%Temporal.Instant%"),y=ee(JSBI.toNumber(t));let S=JSBI.BigInt(t),w=864e11;if(0===y)return {days:0,nanoseconds:he,dayLengthNs:w};if(!IsTemporalZonedDateTime(o)){let t;return ({quotient:t,remainder:S}=divmod(S,JSBI.BigInt(w))),{days:JSBI.toNumber(t),nanoseconds:S,dayLengthNs:w}}const g=GetSlot(o,r),I=GetSlot(o,T),D=JSBI.add(g,S),G=new f(D),v=GetSlot(o,p),O=GetSlot(o,u),C=BuiltinTimeZoneGetPlainDateTimeFor(v,I,O),E=BuiltinTimeZoneGetPlainDateTimeFor(v,G,O);let{days:b}=DifferenceISODateTime(GetSlot(C,n),GetSlot(C,a),GetSlot(C,i),GetSlot(C,s),GetSlot(C,l),GetSlot(C,d),GetSlot(C,m),GetSlot(C,c),GetSlot(C,h),GetSlot(E,n),GetSlot(E,a),GetSlot(E,i),GetSlot(E,s),GetSlot(E,l),GetSlot(E,d),GetSlot(E,m),GetSlot(E,c),GetSlot(E,h),O,"day",le(null)),M=AddZonedDateTime(I,v,O,0,0,0,b,0,0,0,0,0,0);if(1===y)for(;b>0&&JSBI.greaterThan(M,D);)--b,M=AddZonedDateTime(I,v,O,0,0,0,b,0,0,0,0,0,0);S=JSBI.subtract(D,M);let R=!1,Z=new f(M);do{const t=AddZonedDateTime(Z,v,O,0,0,0,y,0,0,0,0,0,0),o=GetSlot(Z,r);w=JSBI.toNumber(JSBI.subtract(t,o)),R=JSBI.greaterThan(JSBI.multiply(JSBI.subtract(S,JSBI.BigInt(w)),JSBI.BigInt(y)),he),R&&(S=JSBI.subtract(S,JSBI.BigInt(w)),Z=new f(t),b+=y);}while(R);return {days:b,nanoseconds:S,dayLengthNs:K(w)}}function BalanceDuration(t,o,n,a,i,s,l,d,m){let c,h,f,y,S,w,g=t;if(IsTemporalZonedDateTime(m)){const t=AddZonedDateTime(GetSlot(m,T),GetSlot(m,p),GetSlot(m,u),0,0,0,g,o,n,a,i,s,l),d=GetSlot(m,r);c=JSBI.subtract(t,d);}else c=TotalDurationNanoseconds(g,o,n,a,i,s,l,0);"year"===d||"month"===d||"week"===d||"day"===d?({days:g,nanoseconds:c}=NanosecondsToDays(c,m)):g=0;const I=JSBI.lessThan(c,he)?-1:1;switch(c=abs(c),h=f=y=S=w=he,d){case"year":case"month":case"week":case"day":case"hour":(({quotient:h,remainder:c}=divmod(c,pe))),({quotient:f,remainder:h}=divmod(h,pe)),({quotient:y,remainder:f}=divmod(f,pe)),({quotient:S,remainder:y}=divmod(y,Te)),({quotient:w,remainder:S}=divmod(S,Te));break;case"minute":(({quotient:h,remainder:c}=divmod(c,pe))),({quotient:f,remainder:h}=divmod(h,pe)),({quotient:y,remainder:f}=divmod(f,pe)),({quotient:S,remainder:y}=divmod(y,Te));break;case"second":(({quotient:h,remainder:c}=divmod(c,pe))),({quotient:f,remainder:h}=divmod(h,pe)),({quotient:y,remainder:f}=divmod(f,pe));break;case"millisecond":(({quotient:h,remainder:c}=divmod(c,pe))),({quotient:f,remainder:h}=divmod(h,pe));break;case"microsecond":({quotient:h,remainder:c}=divmod(c,pe));break;case"nanosecond":break;default:throw new Error("assert not reached")}return {days:g,hours:JSBI.toNumber(w)*I,minutes:JSBI.toNumber(S)*I,seconds:JSBI.toNumber(y)*I,milliseconds:JSBI.toNumber(f)*I,microseconds:JSBI.toNumber(h)*I,nanoseconds:JSBI.toNumber(c)*I}}function UnbalanceDurationRelative(e,t,r,o,n,a){let i=e,s=t,l=r,d=o;const m=GetIntrinsic("%Temporal.Duration%"),c=DurationSign(i,s,l,d,0,0,0,0,0,0);let h,T;a&&(T=ToTemporalDate(a),h=GetSlot(T,u));const p=new m(c),f=new m(0,c),S=new m(0,0,c);switch(n){case"year":break;case"month":{if(!h)throw new RangeError("a starting point is required for months balancing");const e=h.dateAdd,t=h.dateUntil;let r=T;for(;K(i)>0;){const o=CalendarDateAdd(h,r,p,void 0,e),n=le(null);n.largestUnit="month";const a=GetSlot(CalendarDateUntil(h,r,o,n,t),y);r=o,s+=a,i-=c;}}break;case"week":if(!h)throw new RangeError("a starting point is required for weeks balancing");for(;K(i)>0;){let e;(({relativeTo:T,days:e}=MoveRelativeDate(h,T,p))),d+=e,i-=c;}for(;K(s)>0;){let e;(({relativeTo:T,days:e}=MoveRelativeDate(h,T,f))),d+=e,s-=c;}break;default:for(;K(i)>0;){if(!h)throw new RangeError("a starting point is required for balancing calendar units");let e;(({relativeTo:T,days:e}=MoveRelativeDate(h,T,p))),d+=e,i-=c;}for(;K(s)>0;){if(!h)throw new RangeError("a starting point is required for balancing calendar units");let e;(({relativeTo:T,days:e}=MoveRelativeDate(h,T,f))),d+=e,s-=c;}for(;K(l)>0;){if(!h)throw new RangeError("a starting point is required for balancing calendar units");let e;(({relativeTo:T,days:e}=MoveRelativeDate(h,T,S))),d+=e,l-=c;}}return {years:i,months:s,weeks:l,days:d}}function CalculateOffsetShift(e,t,r,o,n){if(IsTemporalZonedDateTime(e)){const a=GetSlot(e,T),i=GetSlot(e,p),s=GetSlot(e,u),l=GetOffsetNanosecondsFor(i,a),d=AddZonedDateTime(a,i,s,t,r,o,n,0,0,0,0,0,0);return GetOffsetNanosecondsFor(i,new(GetIntrinsic("%Temporal.Instant%"))(d))-l}return 0}function CreateNegatedTemporalDuration(e){return new(GetIntrinsic("%Temporal.Duration%"))(-GetSlot(e,f),-GetSlot(e,y),-GetSlot(e,S),-GetSlot(e,w),-GetSlot(e,g),-GetSlot(e,I),-GetSlot(e,D),-GetSlot(e,G),-GetSlot(e,v),-GetSlot(e,O))}function ConstrainToRange(e,t,r){return V(r,X(t,e))}function ConstrainISODate(e,t,r){const o=ConstrainToRange(t,1,12);return {year:e,month:o,day:ConstrainToRange(r,1,ISODaysInMonth(e,o))}}function RejectToRange(e,t,r){if(e<t||e>r)throw new RangeError(`value out of range: ${t} <= ${e} <= ${r}`)}function RejectISODate(e,t,r){RejectToRange(t,1,12),RejectToRange(r,1,ISODaysInMonth(e,t));}function RejectDateRange(e,t,r){RejectDateTimeRange(e,t,r,12,0,0,0,0,0);}function RejectTime(e,t,r,o,n,a){RejectToRange(e,0,23),RejectToRange(t,0,59),RejectToRange(r,0,59),RejectToRange(o,0,999),RejectToRange(n,0,999),RejectToRange(a,0,999);}function RejectDateTime(e,t,r,o,n,a,i,s,l){RejectISODate(e,t,r),RejectTime(o,n,a,i,s,l);}function RejectDateTimeRange(e,t,r,o,n,a,i,s,l){if(RejectToRange(e,-271821,275760),-271821===e&&null==GetEpochFromISOParts(e,t,r+1,o,n,a,i,s,l-1)||275760===e&&null==GetEpochFromISOParts(e,t,r-1,o,n,a,i,s,l+1))throw new RangeError("DateTime outside of supported range")}function ValidateEpochNanoseconds(t){if(JSBI.lessThan(t,ge)||JSBI.greaterThan(t,Ie))throw new RangeError("Instant outside of supported range")}function RejectDuration(e,t,r,o,n,a,i,s,l,d){const m=DurationSign(e,t,r,o,n,a,i,s,l,d);for(const c of [e,t,r,o,n,a,i,s,l,d]){if(!oe(c))throw new RangeError("infinite values not allowed as duration fields");const e=ee(c);if(0!==e&&e!==m)throw new RangeError("mixed-sign values not allowed as duration fields")}}function DifferenceISODate(e,t,r,o,n,a,i){switch(i){case"year":case"month":{const s=-CompareISODate(e,t,r,o,n,a);if(0===s)return {years:0,months:0,weeks:0,days:0};const l={year:e,month:t,day:r},d={year:o,month:n,day:a};let m=d.year-l.year,c=AddISODate(e,t,r,m,0,0,0,"constrain"),h=-CompareISODate(c.year,c.month,c.day,o,n,a);if(0===h)return "year"===i?{years:m,months:0,weeks:0,days:0}:{years:0,months:12*m,weeks:0,days:0};let u=d.month-l.month;if(h!==s&&(m-=s,u+=12*s),c=AddISODate(e,t,r,m,u,0,0,"constrain"),h=-CompareISODate(c.year,c.month,c.day,o,n,a),0===h)return "year"===i?{years:m,months:u,weeks:0,days:0}:{years:0,months:u+12*m,weeks:0,days:0};h!==s&&(u-=s,u===-s&&(m-=s,u=11*s),c=AddISODate(e,t,r,m,u,0,0,"constrain"));let T=0;return T=c.month===d.month?d.day-c.day:s<0?-c.day-(ISODaysInMonth(d.year,d.month)-d.day):d.day+(ISODaysInMonth(c.year,c.month)-c.day),"month"===i&&(u+=12*m,m=0),{years:m,months:u,weeks:0,days:T}}case"week":case"day":{let s,l,d;CompareISODate(e,t,r,o,n,a)<0?(l={year:e,month:t,day:r},s={year:o,month:n,day:a},d=1):(l={year:o,month:n,day:a},s={year:e,month:t,day:r},d=-1);let m=DayOfYear(s.year,s.month,s.day)-DayOfYear(l.year,l.month,l.day);for(let e=l.year;e<s.year;++e)m+=LeapYear(e)?366:365;let c=0;return "week"===i&&(c=Q(m/7),m%=7),c*=d,m*=d,{years:0,months:0,weeks:c,days:m}}default:throw new Error("assert not reached")}}function DifferenceTime(e,t,r,o,n,a,i,s,l,d,m,c){let h=i-e,u=s-t,T=l-r,p=d-o,f=m-n,y=c-a;const S=DurationSign(0,0,0,0,h,u,T,p,f,y);h*=S,u*=S,T*=S,p*=S,f*=S,y*=S;let w=0;if(({deltaDays:w,hour:h,minute:u,second:T,millisecond:p,microsecond:f,nanosecond:y}=BalanceTime(h,u,T,p,f,y)),0!=w)throw new Error("assertion failure in DifferenceTime: _bt_.[[Days]] should be 0");return h*=S,u*=S,T*=S,p*=S,f*=S,y*=S,{hours:h,minutes:u,seconds:T,milliseconds:p,microseconds:f,nanoseconds:y}}function DifferenceInstant(t,r,o,n,a){const i=JSBI.subtract(r,t),s=JSBI.remainder(i,JSBI.BigInt(864e11)),l=JSBI.subtract(i,s),d=RoundNumberToIncrement(s,Ne[n]*o,a),m=JSBI.add(l,d),c=JSBI.toNumber(JSBI.remainder(m,pe)),h=JSBI.toNumber(JSBI.remainder(JSBI.divide(m,pe),pe)),u=JSBI.toNumber(JSBI.remainder(JSBI.divide(m,fe),pe));return {seconds:JSBI.toNumber(JSBI.divide(m,ye)),milliseconds:u,microseconds:h,nanoseconds:c}}function DifferenceISODateTime(e,t,r,o,n,a,i,s,l,d,m,c,h,u,T,p,f,y,S,w,g){let I=e,D=t,G=r,{hours:v,minutes:O,seconds:C,milliseconds:E,microseconds:b,nanoseconds:M}=DifferenceTime(o,n,a,i,s,l,h,u,T,p,f,y);const R=DurationSign(0,0,0,0,v,O,C,E,b,M);CompareISODate(d,m,c,I,D,G)===-R&&(({year:I,month:D,day:G}=BalanceISODate(I,D,G-R)),({hours:v,minutes:O,seconds:C,milliseconds:E,microseconds:b,nanoseconds:M}=BalanceDuration(-R,v,O,C,E,b,M,w)));const Z=CreateTemporalDate(I,D,G,S),P=CreateTemporalDate(d,m,c,S),F=MergeLargestUnitOption(g,LargerOfTwoTemporalUnits("day",w));let{years:Y,months:j,weeks:$,days:B}=CalendarDateUntil(S,Z,P,F);return ({days:B,hours:v,minutes:O,seconds:C,milliseconds:E,microseconds:b,nanoseconds:M}=BalanceDuration(B,v,O,C,E,b,M,w)),{years:Y,months:j,weeks:$,days:B,hours:v,minutes:O,seconds:C,milliseconds:E,microseconds:b,nanoseconds:M}}function DifferenceZonedDateTime(t,r,o,u,T,p){const f=JSBI.subtract(r,t);if(JSBI.equal(f,he))return {years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};const y=GetIntrinsic("%Temporal.Instant%"),S=new y(t),w=new y(r),g=BuiltinTimeZoneGetPlainDateTimeFor(o,S,u),I=BuiltinTimeZoneGetPlainDateTimeFor(o,w,u);let{years:D,months:G,weeks:v,days:O}=DifferenceISODateTime(GetSlot(g,n),GetSlot(g,a),GetSlot(g,i),GetSlot(g,s),GetSlot(g,l),GetSlot(g,d),GetSlot(g,m),GetSlot(g,c),GetSlot(g,h),GetSlot(I,n),GetSlot(I,a),GetSlot(I,i),GetSlot(I,s),GetSlot(I,l),GetSlot(I,d),GetSlot(I,m),GetSlot(I,c),GetSlot(I,h),u,T,p);const C=AddZonedDateTime(S,o,u,D,G,v,0,0,0,0,0,0,0);let E=JSBI.subtract(r,C);const b=CreateTemporalZonedDateTime(C,o,u);({nanoseconds:E,days:O}=NanosecondsToDays(E,b));const{hours:M,minutes:R,seconds:Z,milliseconds:P,microseconds:F,nanoseconds:Y}=BalanceDuration(0,0,0,0,0,0,JSBI.toNumber(E),"hour");return {years:D,months:G,weeks:v,days:O,hours:M,minutes:R,seconds:Z,milliseconds:P,microseconds:F,nanoseconds:Y}}function DifferenceTemporalInstant(e,t,o,n){const a=ToTemporalInstant(o);let i,s;[i,s]="until"===e?[t,a]:[a,t];const l=GetOptionsObject(n),d=GetTemporalUnit(l,"smallestUnit","time","nanosecond"),m=LargerOfTwoTemporalUnits("second",d);let c=GetTemporalUnit(l,"largestUnit","time","auto");if("auto"===c&&(c=m),LargerOfTwoTemporalUnits(c,d)!==c)throw new RangeError(`largestUnit ${c} cannot be smaller than smallestUnit ${d}`);const h=ToTemporalRoundingMode(l,"trunc"),u=ToTemporalRoundingIncrement(l,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[d],!1),T=GetSlot(i,r),p=GetSlot(s,r);let f,y,{seconds:S,milliseconds:w,microseconds:g,nanoseconds:I}=DifferenceInstant(T,p,u,d,h);({hours:f,minutes:y,seconds:S,milliseconds:w,microseconds:g,nanoseconds:I}=BalanceDuration(0,0,0,S,w,g,I,c));return new(GetIntrinsic("%Temporal.Duration%"))(0,0,0,0,f,y,S,w,g,I)}function DifferenceTemporalPlainDate(e,t,r,o){const n="since"===e?-1:1,a=ToTemporalDate(r),i=GetSlot(t,u),s=GetSlot(a,u),l=ToString(i),d=ToString(s);if(l!==d)throw new RangeError(`cannot compute difference between dates of ${l} and ${d} calendars`);const m=GetOptionsObject(o),c=GetTemporalUnit(m,"smallestUnit","date","day"),h=LargerOfTwoTemporalUnits("day",c);let T=GetTemporalUnit(m,"largestUnit","date","auto");if("auto"===T&&(T=h),LargerOfTwoTemporalUnits(T,c)!==T)throw new RangeError(`largestUnit ${T} cannot be smaller than smallestUnit ${c}`);let p=ToTemporalRoundingMode(m,"trunc");"since"===e&&(p=NegateTemporalRoundingMode(p));const f=ToTemporalRoundingIncrement(m,void 0,!1),y=MergeLargestUnitOption(m,T);let{years:S,months:w,weeks:g,days:I}=CalendarDateUntil(i,t,a,y);"day"===c&&1===f||({years:S,months:w,weeks:g,days:I}=RoundDuration(S,w,g,I,0,0,0,0,0,0,f,c,p,t));return new(GetIntrinsic("%Temporal.Duration%"))(n*S,n*w,n*g,n*I,0,0,0,0,0,0)}function DifferenceTemporalPlainDateTime(e,t,r,o){const T="since"===e?-1:1,p=ToTemporalDateTime(r),f=GetSlot(t,u),y=GetSlot(p,u),S=ToString(f),w=ToString(y);if(S!==w)throw new RangeError(`cannot compute difference between dates of ${S} and ${w} calendars`);const g=GetOptionsObject(o),I=GetTemporalUnit(g,"smallestUnit","datetime","nanosecond"),D=LargerOfTwoTemporalUnits("day",I);let G=GetTemporalUnit(g,"largestUnit","datetime","auto");if("auto"===G&&(G=D),LargerOfTwoTemporalUnits(G,I)!==G)throw new RangeError(`largestUnit ${G} cannot be smaller than smallestUnit ${I}`);let v=ToTemporalRoundingMode(g,"trunc");"since"===e&&(v=NegateTemporalRoundingMode(v));const O=ToTemporalDateTimeRoundingIncrement(g,I);let{years:C,months:E,weeks:b,days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=DifferenceISODateTime(GetSlot(t,n),GetSlot(t,a),GetSlot(t,i),GetSlot(t,s),GetSlot(t,l),GetSlot(t,d),GetSlot(t,m),GetSlot(t,c),GetSlot(t,h),GetSlot(p,n),GetSlot(p,a),GetSlot(p,i),GetSlot(p,s),GetSlot(p,l),GetSlot(p,d),GetSlot(p,m),GetSlot(p,c),GetSlot(p,h),f,G,g);const $=TemporalDateTimeToDate(t);(({years:C,months:E,weeks:b,days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=RoundDuration(C,E,b,M,R,Z,P,F,Y,j,O,I,v,$))),({days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=BalanceDuration(M,R,Z,P,F,Y,j,G));return new(GetIntrinsic("%Temporal.Duration%"))(T*C,T*E,T*b,T*M,T*R,T*Z,T*P,T*F,T*Y,T*j)}function DifferenceTemporalPlainTime(e,t,r,o){const n="since"===e?-1:1,a=ToTemporalTime(r),i=GetOptionsObject(o);let u=GetTemporalUnit(i,"largestUnit","time","auto");"auto"===u&&(u="hour");const T=GetTemporalUnit(i,"smallestUnit","time","nanosecond");if(LargerOfTwoTemporalUnits(u,T)!==u)throw new RangeError(`largestUnit ${u} cannot be smaller than smallestUnit ${T}`);let p=ToTemporalRoundingMode(i,"trunc");"since"===e&&(p=NegateTemporalRoundingMode(p));const f=ToTemporalRoundingIncrement(i,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[T],!1);let{hours:y,minutes:S,seconds:w,milliseconds:g,microseconds:I,nanoseconds:D}=DifferenceTime(GetSlot(t,s),GetSlot(t,l),GetSlot(t,d),GetSlot(t,m),GetSlot(t,c),GetSlot(t,h),GetSlot(a,s),GetSlot(a,l),GetSlot(a,d),GetSlot(a,m),GetSlot(a,c),GetSlot(a,h));(({hours:y,minutes:S,seconds:w,milliseconds:g,microseconds:I,nanoseconds:D}=RoundDuration(0,0,0,0,y,S,w,g,I,D,f,T,p))),({hours:y,minutes:S,seconds:w,milliseconds:g,microseconds:I,nanoseconds:D}=BalanceDuration(0,y,S,w,g,I,D,u));return new(GetIntrinsic("%Temporal.Duration%"))(0,0,0,0,n*y,n*S,n*w,n*g,n*I,n*D)}function DifferenceTemporalPlainYearMonth(e,t,r,o){const n="since"===e?-1:1,a=ToTemporalYearMonth(r),i=GetSlot(t,u),s=GetSlot(a,u),l=ToString(i),d=ToString(s);if(l!==d)throw new RangeError(`cannot compute difference between months of ${l} and ${d} calendars`);const m=GetOptionsObject(o),c=Me.reduce(((e,[t,r,o])=>("date"===o&&"week"!==r&&"day"!==r&&e.push(r,t),e)),[]),h=GetTemporalUnit(m,"smallestUnit","date","month");if("week"===h||"day"===h)throw new RangeError(`smallestUnit must be one of ${c.join(", ")}, not ${h}`);let T=GetTemporalUnit(m,"largestUnit","date","auto");if("week"===T||"day"===T)throw new RangeError(`largestUnit must be one of ${c.join(", ")}, not ${T}`);if("auto"===T&&(T="year"),LargerOfTwoTemporalUnits(T,h)!==T)throw new RangeError(`largestUnit ${T} cannot be smaller than smallestUnit ${h}`);let p=ToTemporalRoundingMode(m,"trunc");"since"===e&&(p=NegateTemporalRoundingMode(p));const f=ToTemporalRoundingIncrement(m,void 0,!1),y=CalendarFields(i,["monthCode","year"]),S=PrepareTemporalFields(a,y,[]);S.day=1;const w=PrepareTemporalFields(t,y,[]);w.day=1;const g=CalendarDateFromFields(i,S),I=CalendarDateFromFields(i,w),D=MergeLargestUnitOption(m,T);let{years:G,months:v}=CalendarDateUntil(i,I,g,D);"month"===h&&1===f||({years:G,months:v}=RoundDuration(G,v,0,0,0,0,0,0,0,0,f,h,p,I));return new(GetIntrinsic("%Temporal.Duration%"))(n*G,n*v,0,0,0,0,0,0,0,0)}function DifferenceTemporalZonedDateTime(e,t,o,n){const a="since"===e?-1:1,i=ToTemporalZonedDateTime(o),s=GetSlot(t,u),l=GetSlot(i,u),d=ToString(s),m=ToString(l);if(d!==m)throw new RangeError(`cannot compute difference between dates of ${d} and ${m} calendars`);const c=GetOptionsObject(n),h=GetTemporalUnit(c,"smallestUnit","datetime","nanosecond"),T=LargerOfTwoTemporalUnits("hour",h);let f=GetTemporalUnit(c,"largestUnit","datetime","auto");if("auto"===f&&(f=T),LargerOfTwoTemporalUnits(f,h)!==f)throw new RangeError(`largestUnit ${f} cannot be smaller than smallestUnit ${h}`);let y=ToTemporalRoundingMode(c,"trunc");"since"===e&&(y=NegateTemporalRoundingMode(y));const S=ToTemporalDateTimeRoundingIncrement(c,h),w=GetSlot(t,r),g=GetSlot(i,r);let I,D,G,v,O,C,E,b,M,R;if("year"!==f&&"month"!==f&&"week"!==f&&"day"!==f)I=0,D=0,G=0,v=0,({seconds:E,milliseconds:b,microseconds:M,nanoseconds:R}=DifferenceInstant(w,g,S,h,y)),({hours:O,minutes:C,seconds:E,milliseconds:b,microseconds:M,nanoseconds:R}=BalanceDuration(0,0,0,E,b,M,R,f));else {const e=GetSlot(t,p);if(!TimeZoneEquals(e,GetSlot(i,p)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");const r=MergeLargestUnitOption(c,f);(({years:I,months:D,weeks:G,days:v,hours:O,minutes:C,seconds:E,milliseconds:b,microseconds:M,nanoseconds:R}=DifferenceZonedDateTime(w,g,e,s,f,r))),({years:I,months:D,weeks:G,days:v,hours:O,minutes:C,seconds:E,milliseconds:b,microseconds:M,nanoseconds:R}=RoundDuration(I,D,G,v,O,C,E,b,M,R,S,h,y,t)),({years:I,months:D,weeks:G,days:v,hours:O,minutes:C,seconds:E,milliseconds:b,microseconds:M,nanoseconds:R}=AdjustRoundedDurationDays(I,D,G,v,O,C,E,b,M,R,S,h,y,t));}return new(GetIntrinsic("%Temporal.Duration%"))(a*I,a*D,a*G,a*v,a*O,a*C,a*E,a*b,a*M,a*R)}function AddISODate(e,t,r,o,n,a,i,s){let l=e,d=t,m=r,c=a,h=i;return l+=o,d+=n,({year:l,month:d}=BalanceISOYearMonth(l,d)),({year:l,month:d,day:m}=RegulateISODate(l,d,m,s)),h+=7*c,m+=h,({year:l,month:d,day:m}=BalanceISODate(l,d,m)),{year:l,month:d,day:m}}function AddTime(e,t,r,o,n,a,i,s,l,d,m,c){let h=e,u=t,T=r,p=o,f=n,y=a;h+=i,u+=s,T+=l,p+=d,f+=m,y+=c;let S=0;return ({deltaDays:S,hour:h,minute:u,second:T,millisecond:p,microsecond:f,nanosecond:y}=BalanceTime(h,u,T,p,f,y)),{deltaDays:S,hour:h,minute:u,second:T,millisecond:p,microsecond:f,nanosecond:y}}function AddDuration(e,t,o,n,a,i,s,l,d,m,c,h,f,y,S,w,g,I,D,G,v){const O=LargerOfTwoTemporalUnits(DefaultTemporalLargestUnit(e,t,o,n,a,i,s,l,d,m),DefaultTemporalLargestUnit(c,h,f,y,S,w,g,I,D,G));let C,E,b,M,R,Z,P,F,Y,j;if(v)if(IsTemporalDate(v)){const r=GetIntrinsic("%Temporal.Duration%"),T=GetSlot(v,u),p=new r(e,t,o,n,0,0,0,0,0,0),$=new r(c,h,f,y,0,0,0,0,0,0),B=T.dateAdd,N=CalendarDateAdd(T,v,p,void 0,B),k=CalendarDateAdd(T,N,$,void 0,B),A=LargerOfTwoTemporalUnits("day",O),U=le(null);U.largestUnit=A,({years:C,months:E,weeks:b,days:M}=CalendarDateUntil(T,v,k,U)),({days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=BalanceDuration(M,a+S,i+w,s+g,l+I,d+D,m+G,O));}else {const $=GetIntrinsic("%Temporal.Instant%"),B=GetSlot(v,p),N=GetSlot(v,u),k=AddZonedDateTime(GetSlot(v,T),B,N,e,t,o,n,a,i,s,l,d,m),A=AddZonedDateTime(new $(k),B,N,c,h,f,y,S,w,g,I,D,G);"year"!==O&&"month"!==O&&"week"!==O&&"day"!==O?(C=0,E=0,b=0,M=0,({seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=DifferenceInstant(GetSlot(v,r),A,1,"nanosecond","halfExpand")),({hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=BalanceDuration(0,0,0,P,F,Y,j,O))):({years:C,months:E,weeks:b,days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=DifferenceZonedDateTime(GetSlot(v,r),A,B,N,O,le(null)));}else {if("year"===O||"month"===O||"week"===O)throw new RangeError("relativeTo is required for years, months, or weeks arithmetic");C=E=b=0,({days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}=BalanceDuration(n+y,a+S,i+w,s+g,l+I,d+D,m+G,O));}return RejectDuration(C,E,b,M,R,Z,P,F,Y,j),{years:C,months:E,weeks:b,days:M,hours:R,minutes:Z,seconds:P,milliseconds:F,microseconds:Y,nanoseconds:j}}function AddInstant(t,r,o,n,a,i,s){let l=he;l=JSBI.add(l,JSBI.BigInt(s)),l=JSBI.add(l,JSBI.multiply(JSBI.BigInt(i),pe)),l=JSBI.add(l,JSBI.multiply(JSBI.BigInt(a),fe)),l=JSBI.add(l,JSBI.multiply(JSBI.BigInt(n),ye)),l=JSBI.add(l,JSBI.multiply(JSBI.BigInt(o),JSBI.BigInt(6e10))),l=JSBI.add(l,JSBI.multiply(JSBI.BigInt(r),JSBI.BigInt(36e11)));const d=JSBI.add(t,l);return ValidateEpochNanoseconds(d),d}function AddDateTime(e,t,r,o,s,l,d,m,c,h,u,T,p,f,y,S,w,g,I,D,G){let v=f,{deltaDays:O,hour:C,minute:E,second:b,millisecond:M,microsecond:R,nanosecond:Z}=AddTime(o,s,l,d,m,c,y,S,w,g,I,D);v+=O;const P=GetIntrinsic("%Temporal.Duration%"),F=CalendarDateAdd(h,CreateTemporalDate(e,t,r,h),new P(u,T,p,v,0,0,0,0,0,0),G);return {year:GetSlot(F,n),month:GetSlot(F,a),day:GetSlot(F,i),hour:C,minute:E,second:b,millisecond:M,microsecond:R,nanosecond:Z}}function AddZonedDateTime(e,t,o,u,T,p,f,y,S,w,g,I,D,G){const v=GetIntrinsic("%Temporal.Duration%");if(0===DurationSign(u,T,p,f,0,0,0,0,0,0))return AddInstant(GetSlot(e,r),y,S,w,g,I,D);const O=BuiltinTimeZoneGetPlainDateTimeFor(t,e,o),C=CalendarDateAdd(o,CreateTemporalDate(GetSlot(O,n),GetSlot(O,a),GetSlot(O,i),o),new v(u,T,p,f,0,0,0,0,0,0),G),E=CreateTemporalDateTime(GetSlot(C,n),GetSlot(C,a),GetSlot(C,i),GetSlot(O,s),GetSlot(O,l),GetSlot(O,d),GetSlot(O,m),GetSlot(O,c),GetSlot(O,h),o);return AddInstant(GetSlot(BuiltinTimeZoneGetInstantFor(t,E,"compatible"),r),y,S,w,g,I,D)}function AddDurationToOrSubtractDurationFromDuration(e,t,r,o){const n="subtract"===e?-1:1;let{years:a,months:i,weeks:s,days:l,hours:d,minutes:m,seconds:c,milliseconds:h,microseconds:u,nanoseconds:T}=ToTemporalDurationRecord(r);const p=ToRelativeTemporalObject(GetOptionsObject(o));({years:a,months:i,weeks:s,days:l,hours:d,minutes:m,seconds:c,milliseconds:h,microseconds:u,nanoseconds:T}=AddDuration(GetSlot(t,f),GetSlot(t,y),GetSlot(t,S),GetSlot(t,w),GetSlot(t,g),GetSlot(t,I),GetSlot(t,D),GetSlot(t,G),GetSlot(t,v),GetSlot(t,O),n*a,n*i,n*s,n*l,n*d,n*m,n*c,n*h,n*u,n*T,p));return new(GetIntrinsic("%Temporal.Duration%"))(a,i,s,l,d,m,c,h,u,T)}function AddDurationToOrSubtractDurationFromInstant(e,t,o){const n="subtract"===e?-1:1,{hours:a,minutes:i,seconds:s,milliseconds:l,microseconds:d,nanoseconds:m}=function ToLimitedTemporalDuration(e,t){let r=ToTemporalDurationRecord(e);for(const e of t)if(0!==r[e])throw new RangeError(`Duration field ${e} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);return r}(o,["years","months","weeks","days"]),c=AddInstant(GetSlot(t,r),n*a,n*i,n*s,n*l,n*d,n*m);return new(GetIntrinsic("%Temporal.Instant%"))(c)}function AddDurationToOrSubtractDurationFromPlainDateTime(e,t,r,o){const T="subtract"===e?-1:1,{years:p,months:f,weeks:y,days:S,hours:w,minutes:g,seconds:I,milliseconds:D,microseconds:G,nanoseconds:v}=ToTemporalDurationRecord(r),O=GetOptionsObject(o),C=GetSlot(t,u),{year:E,month:b,day:M,hour:R,minute:Z,second:P,millisecond:F,microsecond:Y,nanosecond:j}=AddDateTime(GetSlot(t,n),GetSlot(t,a),GetSlot(t,i),GetSlot(t,s),GetSlot(t,l),GetSlot(t,d),GetSlot(t,m),GetSlot(t,c),GetSlot(t,h),C,T*p,T*f,T*y,T*S,T*w,T*g,T*I,T*D,T*G,T*v,O);return CreateTemporalDateTime(E,b,M,R,Z,P,F,Y,j,C)}function AddDurationToOrSubtractDurationFromPlainTime(e,t,r){const o="subtract"===e?-1:1,{hours:n,minutes:a,seconds:i,milliseconds:u,microseconds:T,nanoseconds:p}=ToTemporalDurationRecord(r);let{hour:f,minute:y,second:S,millisecond:w,microsecond:g,nanosecond:I}=AddTime(GetSlot(t,s),GetSlot(t,l),GetSlot(t,d),GetSlot(t,m),GetSlot(t,c),GetSlot(t,h),o*n,o*a,o*i,o*u,o*T,o*p);({hour:f,minute:y,second:S,millisecond:w,microsecond:g,nanosecond:I}=RegulateTime(f,y,S,w,g,I,"reject"));return new(GetIntrinsic("%Temporal.PlainTime%"))(f,y,S,w,g,I)}function AddDurationToOrSubtractDurationFromPlainYearMonth(e,t,r,o){let n=ToTemporalDurationRecord(r);"subtract"===e&&(n={years:-n.years,months:-n.months,weeks:-n.weeks,days:-n.days,hours:-n.hours,minutes:-n.minutes,seconds:-n.seconds,milliseconds:-n.milliseconds,microseconds:-n.microseconds,nanoseconds:-n.nanoseconds});let{years:a,months:i,weeks:s,days:l,hours:d,minutes:m,seconds:c,milliseconds:h,microseconds:T,nanoseconds:p}=n;({days:l}=BalanceDuration(l,d,m,c,h,T,p,"day"));const f=GetOptionsObject(o),y=GetSlot(t,u),S=CalendarFields(y,["monthCode","year"]),w=PrepareTemporalFields(t,S,[]),g=DurationSign(a,i,s,l,0,0,0,0,0,0);w.day=g<0?ToPositiveInteger(CalendarDaysInMonth(y,t)):1;const I=CalendarDateFromFields(y,w),D=new(GetIntrinsic("%Temporal.Duration%"))(a,i,s,l,0,0,0,0,0,0),G=se(le(null),f);return CalendarYearMonthFromFields(y,PrepareTemporalFields(CalendarDateAdd(y,I,D,f),S,[]),G)}function AddDurationToOrSubtractDurationFromZonedDateTime(e,t,r,o){const n="subtract"===e?-1:1,{years:a,months:i,weeks:s,days:l,hours:d,minutes:m,seconds:c,milliseconds:h,microseconds:f,nanoseconds:y}=ToTemporalDurationRecord(r),S=GetOptionsObject(o),w=GetSlot(t,p),g=GetSlot(t,u);return CreateTemporalZonedDateTime(AddZonedDateTime(GetSlot(t,T),w,g,n*a,n*i,n*s,n*l,n*d,n*m,n*c,n*h,n*f,n*y,S),w,g)}function RoundNumberToIncrement(t,r,o){if(1===r)return t;let{quotient:n,remainder:a}=divmod(t,JSBI.BigInt(r));if(JSBI.equal(a,he))return t;const i=JSBI.lessThan(a,he)?-1:1;switch(o){case"ceil":i>0&&(n=JSBI.add(n,JSBI.BigInt(i)));break;case"floor":i<0&&(n=JSBI.add(n,JSBI.BigInt(i)));break;case"trunc":break;case"halfExpand":JSBI.toNumber(abs(JSBI.multiply(a,JSBI.BigInt(2))))>=r&&(n=JSBI.add(n,JSBI.BigInt(i)));}return JSBI.multiply(n,JSBI.BigInt(r))}function RoundInstant(t,r,o,n){let a=JSBI.remainder(t,JSBI.BigInt(864e11));JSBI.lessThan(a,he)&&(a=JSBI.add(a,JSBI.BigInt(864e11)));const i=JSBI.subtract(t,a),s=RoundNumberToIncrement(a,Ne[o]*r,n);return JSBI.add(i,s)}function RoundISODateTime(e,t,r,o,n,a,i,s,l,d,m,c,h=864e11){const{deltaDays:u,hour:T,minute:p,second:f,millisecond:y,microsecond:S,nanosecond:w}=RoundTime(o,n,a,i,s,l,d,m,c,h),{year:g,month:I,day:D}=BalanceISODate(e,t,r+u);return {year:g,month:I,day:D,hour:T,minute:p,second:f,millisecond:y,microsecond:S,nanosecond:w}}function RoundTime(t,r,o,n,a,i,s,l,d,m=864e11){let c=he;switch(l){case"day":case"hour":c=JSBI.BigInt(t);case"minute":c=JSBI.add(JSBI.multiply(c,Te),JSBI.BigInt(r));case"second":c=JSBI.add(JSBI.multiply(c,Te),JSBI.BigInt(o));case"millisecond":c=JSBI.add(JSBI.multiply(c,pe),JSBI.BigInt(n));case"microsecond":c=JSBI.add(JSBI.multiply(c,pe),JSBI.BigInt(a));case"nanosecond":c=JSBI.add(JSBI.multiply(c,pe),JSBI.BigInt(i));}const h="day"===l?m:Ne[l],u=RoundNumberToIncrement(c,h*s,d),T=JSBI.toNumber(JSBI.divide(u,JSBI.BigInt(h)));switch(l){case"day":return {deltaDays:T,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return BalanceTime(T,0,0,0,0,0);case"minute":return BalanceTime(t,T,0,0,0,0);case"second":return BalanceTime(t,r,T,0,0,0);case"millisecond":return BalanceTime(t,r,o,T,0,0);case"microsecond":return BalanceTime(t,r,o,n,T,0);case"nanosecond":return BalanceTime(t,r,o,n,a,T);default:throw new Error(`Invalid unit ${l}`)}}function DaysUntil(e,t){return DifferenceISODate(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),GetSlot(t,n),GetSlot(t,a),GetSlot(t,i),"day").days}function MoveRelativeDate(e,t,r){const o=CalendarDateAdd(e,t,r,void 0);return {relativeTo:o,days:DaysUntil(t,o)}}function MoveRelativeZonedDateTime(e,t,r,o,n){const a=GetSlot(e,p),i=GetSlot(e,u);return CreateTemporalZonedDateTime(AddZonedDateTime(GetSlot(e,T),a,i,t,r,o,n,0,0,0,0,0,0),a,i)}function AdjustRoundedDurationDays(t,r,o,n,a,i,s,l,d,m,c,h,f,y){let S=t,w=r,g=o,I=n,D=a,G=i,v=s,O=l,C=d,E=m;if(!IsTemporalZonedDateTime(y)||"year"===h||"month"===h||"week"===h||"day"===h||"nanosecond"===h&&1===c)return {years:S,months:w,weeks:g,days:I,hours:D,minutes:G,seconds:v,milliseconds:O,microseconds:C,nanoseconds:E};let b=TotalDurationNanoseconds(0,D,G,v,O,C,E,0);const M=ee(JSBI.toNumber(b)),R=GetSlot(y,p),Z=GetSlot(y,u),P=AddZonedDateTime(GetSlot(y,T),R,Z,S,w,g,I,0,0,0,0,0,0),F=AddZonedDateTime(new(GetIntrinsic("%Temporal.Instant%"))(P),R,Z,0,0,0,M,0,0,0,0,0,0),Y=JSBI.subtract(F,P);return JSBI.greaterThanOrEqual(JSBI.multiply(JSBI.subtract(b,Y),JSBI.BigInt(M)),he)&&(({years:S,months:w,weeks:g,days:I}=AddDuration(S,w,g,I,0,0,0,0,0,0,0,0,0,M,0,0,0,0,0,0,y)),b=RoundInstant(JSBI.subtract(b,Y),c,h,f),({hours:D,minutes:G,seconds:v,milliseconds:O,microseconds:C,nanoseconds:E}=BalanceDuration(0,0,0,0,0,0,JSBI.toNumber(b),"hour"))),{years:S,months:w,weeks:g,days:I,hours:D,minutes:G,seconds:v,milliseconds:O,microseconds:C,nanoseconds:E}}function RoundDuration(t,r,o,n,a,i,s,l,d,m,c,h,T,p){let f=t,y=r,S=o,w=n,g=a,I=i,D=s,G=l,v=d,O=JSBI.BigInt(m);const C=GetIntrinsic("%Temporal.Duration%");let E,b,M,R,Z=p;if(Z){if(IsTemporalZonedDateTime(Z))b=Z,Z=ToTemporalDate(Z);else if(!IsTemporalDate(Z))throw new TypeError("starting point must be PlainDate or ZonedDateTime");E=GetSlot(Z,u);}if("year"===h||"month"===h||"week"===h||"day"===h){let t,r,o;O=TotalDurationNanoseconds(0,g,I,D,G,v,m,0),b&&(t=MoveRelativeZonedDateTime(b,f,y,S,w)),({days:r,nanoseconds:O,dayLengthNs:o}=NanosecondsToDays(O,t)),M=JSBI.BigInt(o),w+=r,g=I=D=G=v=0;}switch(h){case"year":{if(!E)throw new RangeError("A starting point is required for years rounding");const t=new C(f),r=E.dateAdd,o=CalendarDateAdd(E,Z,t,void 0,r),n=CalendarDateAdd(E,Z,new C(f,y,S),void 0,r);Z=o,w+=DaysUntil(o,n);const a=CalendarDateAdd(E,Z,{days:w},void 0,r),i=le(null);i.largestUnit="year";const s=CalendarDateUntil(E,Z,a,i).years;f+=s;const l=Z;Z=CalendarDateAdd(E,Z,{years:s},void 0,r);w-=DaysUntil(l,Z);const d=new C(w<0?-1:1);let{days:m}=MoveRelativeDate(E,Z,d);m=K(m);const h=JSBI.multiply(JSBI.BigInt(m),M);O=JSBI.add(JSBI.add(JSBI.multiply(h,JSBI.BigInt(f)),JSBI.multiply(JSBI.BigInt(w),M)),O);const u=RoundNumberToIncrement(O,JSBI.toNumber(JSBI.multiply(h,JSBI.BigInt(c))),T);R=JSBI.toNumber(O)/JSBI.toNumber(h),f=JSBI.toNumber(JSBI.divide(u,h)),O=he,y=S=w=0;break}case"month":{if(!E)throw new RangeError("A starting point is required for months rounding");const t=new C(f,y),r=E.dateAdd,o=CalendarDateAdd(E,Z,t,void 0,r),n=CalendarDateAdd(E,Z,new C(f,y,S),void 0,r);Z=o,w+=DaysUntil(o,n);const a=ee(w),i=new C(0,w<0?-1:1);let s;for(({relativeTo:Z,days:s}=MoveRelativeDate(E,Z,i));K(w)>=K(s);)y+=a,w-=s,({relativeTo:Z,days:s}=MoveRelativeDate(E,Z,i));s=K(s);const l=JSBI.multiply(JSBI.BigInt(s),M);O=JSBI.add(JSBI.add(JSBI.multiply(l,JSBI.BigInt(y)),JSBI.multiply(JSBI.BigInt(w),M)),O);const d=RoundNumberToIncrement(O,JSBI.toNumber(JSBI.multiply(l,JSBI.BigInt(c))),T);R=JSBI.toNumber(O)/JSBI.toNumber(l),y=JSBI.toNumber(JSBI.divide(d,l)),O=he,S=w=0;break}case"week":{if(!E)throw new RangeError("A starting point is required for weeks rounding");const t=ee(w),r=new C(0,0,w<0?-1:1);let o;for(({relativeTo:Z,days:o}=MoveRelativeDate(E,Z,r));K(w)>=K(o);)S+=t,w-=o,({relativeTo:Z,days:o}=MoveRelativeDate(E,Z,r));o=K(o);const n=JSBI.multiply(JSBI.BigInt(o),M);O=JSBI.add(JSBI.add(JSBI.multiply(n,JSBI.BigInt(S)),JSBI.multiply(JSBI.BigInt(w),M)),O);const a=RoundNumberToIncrement(O,JSBI.toNumber(JSBI.multiply(n,JSBI.BigInt(c))),T);R=JSBI.toNumber(O)/JSBI.toNumber(n),S=JSBI.toNumber(JSBI.divide(a,n)),O=he,w=0;break}case"day":{const t=M;O=JSBI.add(JSBI.multiply(t,JSBI.BigInt(w)),O);const r=RoundNumberToIncrement(O,JSBI.toNumber(JSBI.multiply(t,JSBI.BigInt(c))),T);R=JSBI.toNumber(O)/JSBI.toNumber(t),w=JSBI.toNumber(JSBI.divide(r,t)),O=he;break}case"hour":{const t=36e11;let r=JSBI.multiply(JSBI.BigInt(g),JSBI.BigInt(36e11));r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(I),JSBI.BigInt(6e10))),r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(D),ye)),r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(G),fe)),r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(v),pe)),r=JSBI.add(r,O),R=JSBI.toNumber(r)/t;const o=RoundNumberToIncrement(r,t*c,T);g=JSBI.toNumber(JSBI.divide(o,JSBI.BigInt(t))),O=he,I=D=G=v=0;break}case"minute":{const t=6e10;let r=JSBI.multiply(JSBI.BigInt(I),JSBI.BigInt(6e10));r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(D),ye)),r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(G),fe)),r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(v),pe)),r=JSBI.add(r,O),R=JSBI.toNumber(r)/t;const o=RoundNumberToIncrement(r,t*c,T);I=JSBI.toNumber(JSBI.divide(o,JSBI.BigInt(t))),O=he,D=G=v=0;break}case"second":{const t=1e9;let r=JSBI.multiply(JSBI.BigInt(D),ye);r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(G),fe)),r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(v),pe)),r=JSBI.add(r,O),R=JSBI.toNumber(r)/t;const o=RoundNumberToIncrement(r,t*c,T);D=JSBI.toNumber(JSBI.divide(o,JSBI.BigInt(t))),O=he,G=v=0;break}case"millisecond":{const t=1e6;let r=JSBI.multiply(JSBI.BigInt(G),fe);r=JSBI.add(r,JSBI.multiply(JSBI.BigInt(v),pe)),r=JSBI.add(r,O),R=JSBI.toNumber(r)/t;const o=RoundNumberToIncrement(r,t*c,T);G=JSBI.toNumber(JSBI.divide(o,JSBI.BigInt(t))),O=he,v=0;break}case"microsecond":{const t=1e3;let r=JSBI.multiply(JSBI.BigInt(v),pe);r=JSBI.add(r,O),R=JSBI.toNumber(r)/t;const o=RoundNumberToIncrement(r,t*c,T);v=JSBI.toNumber(JSBI.divide(o,JSBI.BigInt(t))),O=he;break}case"nanosecond":R=JSBI.toNumber(O),O=RoundNumberToIncrement(O,c,T);}return {years:f,months:y,weeks:S,days:w,hours:g,minutes:I,seconds:D,milliseconds:G,microseconds:v,nanoseconds:JSBI.toNumber(O),total:R}}function CompareISODate(e,t,r,o,n,a){for(const[i,s]of [[e,o],[t,n],[r,a]])if(i!==s)return ComparisonResult(i-s);return 0}function NonNegativeModulo(e,t){let r=e%t;return me(r,-0)?0:(r<0&&(r+=t),r)}function ToBigIntExternal(e){const t=ToBigInt(e);return void 0!==globalThis.BigInt?globalThis.BigInt(t.toString(10)):t}function ToBigInt(t){if(t instanceof JSBI)return t;let r=t;if("object"==typeof t){const e=t[Symbol.toPrimitive];e&&"function"==typeof e&&(r=ce(e,t,["number"]));}switch(typeof r){case"undefined":case"object":case"number":case"symbol":default:throw new TypeError(`cannot convert ${typeof t} to bigint`);case"string":if(!r.match(/^\s*(?:[+-]?\d+\s*)?$/))throw new SyntaxError("invalid BigInt syntax");case"bigint":try{return JSBI.BigInt(r.toString())}catch(e){if(e instanceof Error&&e.message.startsWith("Invalid integer"))throw new SyntaxError(e.message);throw e}case"boolean":return r?ue:he}}const $e=(()=>{let t=JSBI.BigInt(Date.now()%1e6);return ()=>{const r=JSBI.BigInt(Date.now()),o=JSBI.add(JSBI.multiply(r,fe),t);return t=JSBI.remainder(r,fe),JSBI.greaterThan(o,Ie)?Ie:JSBI.lessThan(o,ge)?ge:o}})();function ComparisonResult(e){return e<0?-1:e>0?1:e}function GetOptionsObject(e){if(void 0===e)return le(null);if(IsObject(e)&&null!==e)return e;throw new TypeError("Options parameter must be an object, not "+(null===e?"null":""+typeof e))}function CreateOnePropObject(e,t){const r=le(null);return r[e]=t,r}function GetOption(e,t,r,o){let n=e[t];if(void 0!==n){if(n=ToString(n),!r.includes(n))throw new RangeError(`${t} must be one of ${r.join(", ")}, not ${n}`);return n}return o}function IsBuiltinCalendar(e){return z.call(Ce,e)}const Be=new RegExp(`^${B.source}$`);function bisect(t,r,o,n=t(r),a=t(o)){let i=JSBI.BigInt(r),s=JSBI.BigInt(o),l=n,d=a;for(;JSBI.greaterThan(JSBI.subtract(s,i),ue);){const r=JSBI.divide(JSBI.add(i,s),JSBI.BigInt(2)),o=t(r);if(o===l)i=r,l=o;else {if(o!==d)throw new Error(`invalid state in bisection ${l} - ${o} - ${d}`);s=r,d=o;}}return s}const Ne={hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},ke=Symbol("date"),Ae=Symbol("ym"),Ue=Symbol("md"),Le=Symbol("time"),xe=Symbol("datetime"),He=Symbol("zoneddatetime"),qe=Symbol("instant"),We=Symbol("original"),ze=Symbol("timezone"),_e=Symbol("timezone-id-given"),Je=Symbol("calendar-id"),Ve=Symbol("locale"),Xe=Symbol("options"),descriptor=e=>({value:e,enumerable:!0,writable:!1,configurable:!0}),Ke=globalThis.Intl.DateTimeFormat,Qe=Object.assign,et=Object.prototype.hasOwnProperty,tt=Reflect.apply;function getPropLazy(e,t){let r=e[t];return "function"==typeof r&&(r=new Ke(e[Ve],r(e[Xe])),e[t]=r),r}function getResolvedTimeZoneLazy(e){let t=e[ze];return "string"==typeof t&&(t=ToTemporalTimeZone(t),e[ze]=t),t}function DateTimeFormatImpl(e,t={}){if(!(this instanceof DateTimeFormatImpl))return new DateTimeFormatImpl(e,t);const r=void 0!==t,o=r?Qe({},t):{},n=new Ke(e,o),a=n.resolvedOptions();if(r){const e=Qe({},a);for(const t in e)tt(et,o,[t])||delete e[t];this[Xe]=e;}else this[Xe]=o;this[_e]=o.timeZone?o.timeZone:null,this[Ve]=a.locale,this[We]=n,this[ze]=a.timeZone,this[Je]=a.calendar,this[ke]=dateAmend,this[Ae]=yearMonthAmend,this[Ue]=monthDayAmend,this[Le]=timeAmend,this[xe]=datetimeAmend,this[He]=zonedDateTimeAmend,this[qe]=instantAmend;}Object.defineProperty(DateTimeFormatImpl,"name",{writable:!0,value:"DateTimeFormat"}),DateTimeFormatImpl.supportedLocalesOf=function(e,t){return Ke.supportedLocalesOf(e,t)};const rt={resolvedOptions:descriptor((function resolvedOptions(){return this[We].resolvedOptions()})),format:descriptor((function format(e,...t){let{instant:r,formatter:o,timeZone:n}=extractOverrides(e,this);if(r&&o)return o=adjustFormatterTimeZone(o,n),o.format(r.epochMilliseconds);return this[We].format(e,...t)})),formatRange:descriptor((function formatRange(e,t){if(isTemporalObject(e)||isTemporalObject(t)){if(!sameTemporalType(e,t))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");const{instant:r,formatter:o,timeZone:n}=extractOverrides(e,this),{instant:a,formatter:i,timeZone:s}=extractOverrides(t,this);if(n&&s&&n!==s)throw new RangeError("cannot format range between different time zones");if(r&&a&&o&&i&&o===i){return adjustFormatterTimeZone(o,n).formatRange(r.epochMilliseconds,a.epochMilliseconds)}}return this[We].formatRange(e,t)}))};"formatToParts"in Ke.prototype&&(rt.formatToParts=descriptor((function formatToParts(e,...t){let{instant:r,formatter:o,timeZone:n}=extractOverrides(e,this);if(r&&o)return o=adjustFormatterTimeZone(o,n),o.formatToParts(r.epochMilliseconds);return this[We].formatToParts(e,...t)}))),"formatRangeToParts"in Ke.prototype&&(rt.formatRangeToParts=descriptor((function formatRangeToParts(e,t){if(isTemporalObject(e)||isTemporalObject(t)){if(!sameTemporalType(e,t))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");const{instant:r,formatter:o,timeZone:n}=extractOverrides(e,this),{instant:a,formatter:i,timeZone:s}=extractOverrides(t,this);if(n&&s&&n!==s)throw new RangeError("cannot format range between different time zones");if(r&&a&&o&&i&&o===i){return adjustFormatterTimeZone(o,n).formatRangeToParts(r.epochMilliseconds,a.epochMilliseconds)}}return this[We].formatRangeToParts(e,t)}))),DateTimeFormatImpl.prototype=Object.create(Ke.prototype,rt),Object.defineProperty(DateTimeFormatImpl,"prototype",{writable:!1,enumerable:!1,configurable:!1});const ot=DateTimeFormatImpl;function adjustFormatterTimeZone(e,t){if(!t)return e;const r=e.resolvedOptions();return r.timeZone===t?e:((r.dateStyle||r.timeStyle)&&(delete r.weekday,delete r.era,delete r.year,delete r.month,delete r.day,delete r.hour,delete r.minute,delete r.second,delete r.timeZoneName,delete r.hourCycle,delete r.hour12,delete r.dayPeriod),new Ke(r.locale,{...r,timeZone:t}))}function amend(e={},t={}){const r=Qe({},e);for(const e of ["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"])r[e]=e in t?t[e]:r[e],!1!==r[e]&&void 0!==r[e]||delete r[e];return r}function timeAmend(e){let t=amend(e,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});return hasTimeOptions(t)||(t=Qe({},t,{hour:"numeric",minute:"numeric",second:"numeric"})),t}function yearMonthAmend(e){let t=amend(e,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return "year"in t||"month"in t||(t=Qe(t,{year:"numeric",month:"numeric"})),t}function monthDayAmend(e){let t=amend(e,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return "month"in t||"day"in t||(t=Qe({},t,{month:"numeric",day:"numeric"})),t}function dateAmend(e){let t=amend(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});return hasDateOptions(t)||(t=Qe({},t,{year:"numeric",month:"numeric",day:"numeric"})),t}function datetimeAmend(e){let t=amend(e,{timeZoneName:!1});return hasTimeOptions(t)||hasDateOptions(t)||(t=Qe({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),t}function zonedDateTimeAmend(e){let t=e;return hasTimeOptions(t)||hasDateOptions(t)||(t=Qe({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),void 0===t.timeZoneName&&(t.timeZoneName="short")),t}function instantAmend(e){let t=e;return hasTimeOptions(t)||hasDateOptions(t)||(t=Qe({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),t}function hasDateOptions(e){return "year"in e||"month"in e||"day"in e||"weekday"in e||"dateStyle"in e}function hasTimeOptions(e){return "hour"in e||"minute"in e||"second"in e||"timeStyle"in e||"dayPeriod"in e}function isTemporalObject(e){return IsTemporalDate(e)||IsTemporalTime(e)||IsTemporalDateTime(e)||IsTemporalZonedDateTime(e)||IsTemporalYearMonth(e)||IsTemporalMonthDay(e)||IsTemporalInstant(e)}function sameTemporalType(e,t){return !(!isTemporalObject(e)||!isTemporalObject(t))&&(!(IsTemporalTime(e)&&!IsTemporalTime(t))&&(!(IsTemporalDate(e)&&!IsTemporalDate(t))&&(!(IsTemporalDateTime(e)&&!IsTemporalDateTime(t))&&(!(IsTemporalZonedDateTime(e)&&!IsTemporalZonedDateTime(t))&&(!(IsTemporalYearMonth(e)&&!IsTemporalYearMonth(t))&&(!(IsTemporalMonthDay(e)&&!IsTemporalMonthDay(t))&&!(IsTemporalInstant(e)&&!IsTemporalInstant(t))))))))}function extractOverrides(e,t){const r=GetIntrinsic("%Temporal.PlainDateTime%");if(IsTemporalTime(e)){const o=new r(1970,1,1,GetSlot(e,s),GetSlot(e,l),GetSlot(e,d),GetSlot(e,m),GetSlot(e,c),GetSlot(e,h),t[Je]);return {instant:BuiltinTimeZoneGetInstantFor(getResolvedTimeZoneLazy(t),o,"compatible"),formatter:getPropLazy(t,Le)}}if(IsTemporalYearMonth(e)){const o=GetSlot(e,n),s=GetSlot(e,a),l=GetSlot(e,i),d=ToString(GetSlot(e,u));if(d!==t[Je])throw new RangeError(`cannot format PlainYearMonth with calendar ${d} in locale with calendar ${t[Je]}`);const m=new r(o,s,l,12,0,0,0,0,0,d);return {instant:BuiltinTimeZoneGetInstantFor(getResolvedTimeZoneLazy(t),m,"compatible"),formatter:getPropLazy(t,Ae)}}if(IsTemporalMonthDay(e)){const o=GetSlot(e,n),s=GetSlot(e,a),l=GetSlot(e,i),d=ToString(GetSlot(e,u));if(d!==t[Je])throw new RangeError(`cannot format PlainMonthDay with calendar ${d} in locale with calendar ${t[Je]}`);const m=new r(o,s,l,12,0,0,0,0,0,d);return {instant:BuiltinTimeZoneGetInstantFor(getResolvedTimeZoneLazy(t),m,"compatible"),formatter:getPropLazy(t,Ue)}}if(IsTemporalDate(e)){const o=GetSlot(e,n),s=GetSlot(e,a),l=GetSlot(e,i),d=ToString(GetSlot(e,u));if("iso8601"!==d&&d!==t[Je])throw new RangeError(`cannot format PlainDate with calendar ${d} in locale with calendar ${t[Je]}`);const m=new r(o,s,l,12,0,0,0,0,0,t[Je]);return {instant:BuiltinTimeZoneGetInstantFor(getResolvedTimeZoneLazy(t),m,"compatible"),formatter:getPropLazy(t,ke)}}if(IsTemporalDateTime(e)){const o=GetSlot(e,n),T=GetSlot(e,a),p=GetSlot(e,i),f=GetSlot(e,s),y=GetSlot(e,l),S=GetSlot(e,d),w=GetSlot(e,m),g=GetSlot(e,c),I=GetSlot(e,h),D=ToString(GetSlot(e,u));if("iso8601"!==D&&D!==t[Je])throw new RangeError(`cannot format PlainDateTime with calendar ${D} in locale with calendar ${t[Je]}`);let G=e;return "iso8601"===D&&(G=new r(o,T,p,f,y,S,w,g,I,t[Je])),{instant:BuiltinTimeZoneGetInstantFor(getResolvedTimeZoneLazy(t),G,"compatible"),formatter:getPropLazy(t,xe)}}if(IsTemporalZonedDateTime(e)){const r=ToString(GetSlot(e,u));if("iso8601"!==r&&r!==t[Je])throw new RangeError(`cannot format ZonedDateTime with calendar ${r} in locale with calendar ${t[Je]}`);const o=ToString(GetSlot(e,p));if(t[_e]&&t[_e]!==o)throw new RangeError(`timeZone option ${t[_e]} doesn't match actual time zone ${o}`);return {instant:GetSlot(e,T),formatter:getPropLazy(t,He),timeZone:o}}return IsTemporalInstant(e)?{instant:e,formatter:getPropLazy(t,qe)}:{}}Object.freeze({__proto__:null,DateTimeFormat:ot});class Instant{constructor(e){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");const t=ToBigInt(e);ValidateEpochNanoseconds(t),CreateSlots(this),SetSlot(this,r,t);}get epochSeconds(){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");const t=GetSlot(this,r);return JSBI.toNumber(JSBI.divide(t,ye))}get epochMilliseconds(){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");const t=JSBI.BigInt(GetSlot(this,r));return JSBI.toNumber(JSBI.divide(t,fe))}get epochMicroseconds(){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");const t=JSBI.BigInt(GetSlot(this,r));return ToBigIntExternal(JSBI.divide(t,pe))}get epochNanoseconds(){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return ToBigIntExternal(JSBI.BigInt(GetSlot(this,r)))}add(e){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromInstant("add",this,e)}subtract(e){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromInstant("subtract",this,e)}until(e,t){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return DifferenceTemporalInstant("until",this,e,t)}since(e,t){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return DifferenceTemporalInstant("since",this,e,t)}round(e){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?CreateOnePropObject("smallestUnit",e):GetOptionsObject(e),o=GetTemporalUnit(t,"smallestUnit","time",je),n=ToTemporalRoundingMode(t,"halfExpand"),a=ToTemporalRoundingIncrement(t,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[o],!0),i=RoundInstant(GetSlot(this,r),a,o,n);return new Instant(i)}equals(t){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");const o=ToTemporalInstant(t),n=GetSlot(this,r),a=GetSlot(o,r);return JSBI.equal(JSBI.BigInt(n),JSBI.BigInt(a))}toString(e){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");const t=GetOptionsObject(e);let o=t.timeZone;void 0!==o&&(o=ToTemporalTimeZone(o));const{precision:n,unit:a,increment:i}=ToSecondsStringPrecision(t),s=ToTemporalRoundingMode(t,"trunc"),l=RoundInstant(GetSlot(this,r),i,a,s);return TemporalInstantToString(new Instant(l),o,n)}toJSON(){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return TemporalInstantToString(this,void 0,"auto")}toLocaleString(e,t){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.Instant")}toZonedDateTime(e){if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument in toZonedDateTime");const t=e.calendar;if(void 0===t)throw new TypeError("missing calendar property in toZonedDateTime");const o=ToTemporalCalendar(t),n=e.timeZone;if(void 0===n)throw new TypeError("missing timeZone property in toZonedDateTime");const a=ToTemporalTimeZone(n);return CreateTemporalZonedDateTime(GetSlot(this,r),a,o)}toZonedDateTimeISO(e){let t=e;if(!IsTemporalInstant(this))throw new TypeError("invalid receiver");if(IsObject(t)){const e=t.timeZone;void 0!==e&&(t=e);}const o=ToTemporalTimeZone(t),n=GetISO8601Calendar();return CreateTemporalZonedDateTime(GetSlot(this,r),o,n)}static fromEpochSeconds(t){const r=ToNumber(t),o=JSBI.multiply(JSBI.BigInt(r),ye);return ValidateEpochNanoseconds(o),new Instant(o)}static fromEpochMilliseconds(t){const r=ToNumber(t),o=JSBI.multiply(JSBI.BigInt(r),fe);return ValidateEpochNanoseconds(o),new Instant(o)}static fromEpochMicroseconds(t){const r=ToBigInt(t),o=JSBI.multiply(r,pe);return ValidateEpochNanoseconds(o),new Instant(o)}static fromEpochNanoseconds(e){const t=ToBigInt(e);return ValidateEpochNanoseconds(t),new Instant(t)}static from(e){return IsTemporalInstant(e)?new Instant(GetSlot(e,r)):ToTemporalInstant(e)}static compare(t,o){const n=ToTemporalInstant(t),a=ToTemporalInstant(o),i=GetSlot(n,r),s=GetSlot(a,r);return JSBI.lessThan(i,s)?-1:JSBI.greaterThan(i,s)?1:0}}MakeIntrinsicClass(Instant,"Temporal.Instant");const at=Array.prototype.includes,it=Array.prototype.push,st=globalThis.Intl.DateTimeFormat,lt=Array.prototype.sort,dt=Math.abs,mt=Math.floor,ct=Object.entries,ht=Object.keys,ut={};class Calendar{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: id is required");const t=ToString(e);if(!IsBuiltinCalendar(t))throw new RangeError(`invalid calendar identifier ${t}`);CreateSlots(this),SetSlot(this,C,t);}get id(){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return ToString(this)}dateFromFields(e,t){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid fields");const r=GetOptionsObject(t);return ut[GetSlot(this,C)].dateFromFields(e,r,this)}yearMonthFromFields(e,t){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid fields");const r=GetOptionsObject(t);return ut[GetSlot(this,C)].yearMonthFromFields(e,r,this)}monthDayFromFields(e,t){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid fields");const r=GetOptionsObject(t);return ut[GetSlot(this,C)].monthDayFromFields(e,r,this)}fields(e){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const t=[],r=new Set(["year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond"]);for(const o of e){if("string"!=typeof o)throw new TypeError("invalid fields");if(!r.has(o))throw new RangeError(`invalid field name ${o}`);r.delete(o),it.call(t,o);}return ut[GetSlot(this,C)].fields(t)}mergeFields(e,t){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return ut[GetSlot(this,C)].mergeFields(e,t)}dateAdd(e,t,r){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const o=ToTemporalDate(e),n=ToTemporalDuration(t),a=ToTemporalOverflow(GetOptionsObject(r)),{days:i}=BalanceDuration(GetSlot(n,w),GetSlot(n,g),GetSlot(n,I),GetSlot(n,D),GetSlot(n,G),GetSlot(n,v),GetSlot(n,O),"day");return ut[GetSlot(this,C)].dateAdd(o,GetSlot(n,f),GetSlot(n,y),GetSlot(n,S),i,a,this)}dateUntil(e,t,r){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const o=ToTemporalDate(e),n=ToTemporalDate(t);let a=GetTemporalUnit(GetOptionsObject(r),"largestUnit","date","auto");"auto"===a&&(a="day");const{years:i,months:s,weeks:l,days:d}=ut[GetSlot(this,C)].dateUntil(o,n,a);return new(GetIntrinsic("%Temporal.Duration%"))(i,s,l,d,0,0,0,0,0,0)}year(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].year(t)}month(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");if(IsTemporalMonthDay(t))throw new TypeError("use monthCode on PlainMonthDay instead");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].month(t)}monthCode(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||IsTemporalMonthDay(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].monthCode(t)}day(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalMonthDay(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].day(t)}era(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].era(t)}eraYear(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].eraYear(t)}dayOfWeek(e){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e);return ut[GetSlot(this,C)].dayOfWeek(t)}dayOfYear(e){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e);return ut[GetSlot(this,C)].dayOfYear(t)}weekOfYear(e){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e);return ut[GetSlot(this,C)].weekOfYear(t)}daysInWeek(e){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e);return ut[GetSlot(this,C)].daysInWeek(t)}daysInMonth(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].daysInMonth(t)}daysInYear(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].daysInYear(t)}monthsInYear(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].monthsInYear(t)}inLeapYear(e){let t=e;if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return IsTemporalYearMonth(t)||(t=ToTemporalDate(t)),ut[GetSlot(this,C)].inLeapYear(t)}toString(){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return GetSlot(this,C)}toJSON(){if(!IsTemporalCalendar(this))throw new TypeError("invalid receiver");return ToString(this)}static from(e){return ToTemporalCalendar(e)}}function monthCodeNumberPart(e){if(!e.startsWith("M"))throw new RangeError(`Invalid month code: ${e}. Month codes must start with M.`);const t=+e.slice(1);if(isNaN(t))throw new RangeError(`Invalid month code: ${e}`);return t}function buildMonthCode(e,t=!1){return `M${e.toString().padStart(2,"0")}${t?"L":""}`}function resolveNonLunisolarMonth(e,t,r=12){let{month:o,monthCode:n}=e;if(void 0===n){if(void 0===o)throw new TypeError("Either month or monthCode are required");"reject"===t&&RejectToRange(o,1,r),"constrain"===t&&(o=ConstrainToRange(o,1,r)),n=buildMonthCode(o);}else {const e=monthCodeNumberPart(n);if(void 0!==o&&o!==e)throw new RangeError(`monthCode ${n} and month ${o} must match if both are present`);if(n!==buildMonthCode(e))throw new RangeError(`Invalid month code: ${n}`);if(o=e,o<1||o>r)throw new RangeError(`Invalid monthCode: ${n}`)}return {...e,month:o,monthCode:n}}MakeIntrinsicClass(Calendar,"Temporal.Calendar"),DefineIntrinsic("Temporal.Calendar.from",Calendar.from),ut.iso8601={dateFromFields(e,t,r){const o=ToTemporalOverflow(t);let n=PrepareTemporalFields(e,["day","month","monthCode","year"],["year","day"]);n=resolveNonLunisolarMonth(n);let{year:a,month:i,day:s}=n;return ({year:a,month:i,day:s}=RegulateISODate(a,i,s,o)),CreateTemporalDate(a,i,s,r)},yearMonthFromFields(e,t,r){const o=ToTemporalOverflow(t);let n=PrepareTemporalFields(e,["month","monthCode","year"],["year"]);n=resolveNonLunisolarMonth(n);let{year:a,month:i}=n;return ({year:a,month:i}=function RegulateISOYearMonth(e,t,r){let o=e,n=t;switch(r){case"reject":RejectISODate(o,n,1);break;case"constrain":({year:o,month:n}=ConstrainISODate(o,n));}return {year:o,month:n}}(a,i,o)),CreateTemporalYearMonth(a,i,r,1)},monthDayFromFields(e,t,r){const o=ToTemporalOverflow(t);let n=PrepareTemporalFields(e,["day","month","monthCode","year"],["day"]);if(void 0!==n.month&&void 0===n.year&&void 0===n.monthCode)throw new TypeError("either year or monthCode required with month");const a=void 0===n.monthCode;n=resolveNonLunisolarMonth(n);let{month:i,day:s,year:l}=n;return ({month:i,day:s}=RegulateISODate(a?l:1972,i,s,o)),CreateTemporalMonthDay(i,s,r,1972)},fields:e=>e,mergeFields(e,t){const r={};for(const t of ht(e))"month"!==t&&"monthCode"!==t&&(r[t]=e[t]);const o=ht(t);for(const e of o)r[e]=t[e];if(!at.call(o,"month")&&!at.call(o,"monthCode")){const{month:t,monthCode:o}=e;void 0!==t&&(r.month=t),void 0!==o&&(r.monthCode=o);}return r},dateAdd(e,t,r,o,s,l,d){let m=GetSlot(e,n),c=GetSlot(e,a),h=GetSlot(e,i);return ({year:m,month:c,day:h}=AddISODate(m,c,h,t,r,o,s,l)),CreateTemporalDate(m,c,h,d)},dateUntil:(e,t,r)=>DifferenceISODate(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),GetSlot(t,n),GetSlot(t,a),GetSlot(t,i),r),year:e=>GetSlot(e,n),era(){},eraYear(){},month:e=>GetSlot(e,a),monthCode:e=>buildMonthCode(GetSlot(e,a)),day:e=>GetSlot(e,i),dayOfWeek:e=>DayOfWeek(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i)),dayOfYear:e=>DayOfYear(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i)),weekOfYear:e=>function WeekOfYear(e,t,r){const o=DayOfYear(e,t,r),n=DayOfWeek(e,t,r)||7,a=DayOfWeek(e,1,1),i=Q((o-n+10)/7);return i<1?5===a||6===a&&LeapYear(e-1)?53:52:53===i&&(LeapYear(e)?366:365)-o<4-n?1:i}(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i)),daysInWeek:()=>7,daysInMonth:e=>ISODaysInMonth(GetSlot(e,n),GetSlot(e,a)),daysInYear(e){let t=e;return HasSlot(t,n)||(t=ToTemporalDate(t)),LeapYear(GetSlot(t,n))?366:365},monthsInYear:()=>12,inLeapYear(e){let t=e;return HasSlot(t,n)||(t=ToTemporalDate(t)),LeapYear(GetSlot(t,n))}};class OneObjectCache{constructor(e){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,this.now=globalThis.performance?globalThis.performance.now():Date.now(),void 0!==e){let t=0;for(const r of e.map.entries()){if(++t>OneObjectCache.MAX_CACHE_ENTRIES)break;this.map.set(...r);}}}get(e){const t=this.map.get(e);return t&&(this.hits++,this.report()),this.calls++,t}set(e,t){this.map.set(e,t),this.misses++,this.report();}report(){}setObject(e){if(OneObjectCache.objectMap.get(e))throw new RangeError("object already cached");OneObjectCache.objectMap.set(e,this),this.report();}static getCacheForObject(e){let t=OneObjectCache.objectMap.get(e);return t||(t=new OneObjectCache,OneObjectCache.objectMap.set(e,t)),t}}function toUtcIsoDateString({isoYear:e,isoMonth:t,isoDay:r}){return `${ISOYearString(e)}-${ISODateTimePartString(t)}-${ISODateTimePartString(r)}T00:00Z`}function simpleDateDiff(e,t){return {years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}OneObjectCache.objectMap=new WeakMap,OneObjectCache.MAX_CACHE_ENTRIES=1e3;class HelperBase{constructor(){this.eraLength="short",this.hasEra=!0;}getFormatter(){return void 0===this.formatter&&(this.formatter=new st(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:this.eraLength,timeZone:"UTC"})),this.formatter}isoToCalendarDate(e,t){const{year:r,month:o,day:n}=e,a=JSON.stringify({func:"isoToCalendarDate",isoYear:r,isoMonth:o,isoDay:n,id:this.id}),i=t.get(a);if(i)return i;const s=this.getFormatter();let l,d;try{d=toUtcIsoDateString({isoYear:r,isoMonth:o,isoDay:n}),l=s.formatToParts(new Date(d));}catch(e){throw new RangeError(`Invalid ISO date: ${JSON.stringify({isoYear:r,isoMonth:o,isoDay:n})}`)}const m={};for(let{type:e,value:t}of l){if("year"===e&&(m.eraYear=+t),"relatedYear"===e&&(m.eraYear=+t),"month"===e){const e=/^([0-9]*)(.*?)$/.exec(t);if(!e||3!=e.length||!e[1]&&!e[2])throw new RangeError(`Unexpected month: ${t}`);if(m.month=e[1]?+e[1]:1,m.month<1)throw new RangeError(`Invalid month ${t} from ${d}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(m.month>13)throw new RangeError(`Invalid month ${t} from ${d}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);e[2]&&(m.monthExtra=e[2]);}"day"===e&&(m.day=+t),this.hasEra&&"era"===e&&null!=t&&""!==t&&(t=t.split(" (")[0],m.era=t.normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(" ","-").toLowerCase());}if(void 0===m.eraYear)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.reviseIntlEra){const{era:t,eraYear:r}=this.reviseIntlEra(m,e);m.era=t,m.eraYear=r;}this.checkIcuBugs&&this.checkIcuBugs(e);const c=this.adjustCalendarDate(m,t,"constrain",!0);if(void 0===c.year)throw new RangeError(`Missing year converting ${JSON.stringify(e)}`);if(void 0===c.month)throw new RangeError(`Missing month converting ${JSON.stringify(e)}`);if(void 0===c.day)throw new RangeError(`Missing day converting ${JSON.stringify(e)}`);return t.set(a,c),["constrain","reject"].forEach((r=>{const o=JSON.stringify({func:"calendarToIsoDate",year:c.year,month:c.month,day:c.day,overflow:r,id:this.id});t.set(o,e);})),c}validateCalendarDate(e){const{era:t,month:r,year:o,day:n,eraYear:a,monthCode:i,monthExtra:s}=e;if(void 0!==s)throw new RangeError("Unexpected `monthExtra` value");if(void 0===o&&void 0===a)throw new TypeError("year or eraYear is required");if(void 0===r&&void 0===i)throw new TypeError("month or monthCode is required");if(void 0===n)throw new RangeError("Missing day");if(void 0!==i){if("string"!=typeof i)throw new RangeError("monthCode must be a string, not "+typeof i);if(!/^M([01]?\d)(L?)$/.test(i))throw new RangeError(`Invalid monthCode: ${i}`)}if(this.constantEra){if(void 0!==t&&t!==this.constantEra)throw new RangeError(`era must be ${this.constantEra}, not ${t}`);if(void 0!==a&&void 0!==o&&a!==o)throw new RangeError(`eraYear ${a} does not match year ${o}`)}}adjustCalendarDate(e,t,r="constrain",o=!1){if("lunisolar"===this.calendarType)throw new RangeError("Override required for lunisolar calendars");let n=e;if(this.validateCalendarDate(n),this.constantEra){const{year:e,eraYear:t}=n;n={...n,era:this.constantEra,year:void 0!==e?e:t,eraYear:void 0!==t?t:e};}const a=this.monthsInYear(n,t);let{month:i,monthCode:s}=n;return ({month:i,monthCode:s}=resolveNonLunisolarMonth(n,r,a)),{...n,month:i,monthCode:s}}regulateMonthDayNaive(e,t,r){const o=this.monthsInYear(e,r);let{month:n,day:a}=e;return "reject"===t?(RejectToRange(n,1,o),RejectToRange(a,1,this.maximumMonthLength(e))):(n=ConstrainToRange(n,1,o),a=ConstrainToRange(a,1,this.maximumMonthLength({...e,month:n}))),{...e,month:n,day:a}}calendarToIsoDate(e,t="constrain",r){const o=e;let n=this.adjustCalendarDate(e,r,t,!1);n=this.regulateMonthDayNaive(n,t,r);const{year:a,month:i,day:s}=n,l=JSON.stringify({func:"calendarToIsoDate",year:a,month:i,day:s,overflow:t,id:this.id});let d,m=r.get(l);if(m)return m;if(void 0!==o.year&&void 0!==o.month&&void 0!==o.day&&(o.year!==n.year||o.month!==n.month||o.day!==n.day)&&(d=JSON.stringify({func:"calendarToIsoDate",year:o.year,month:o.month,day:o.day,overflow:t,id:this.id}),m=r.get(d),m))return m;let c=this.estimateIsoDate({year:a,month:i,day:s});const calculateSameMonthResult=e=>{let o=this.addDaysIso(c,e);if(n.day>this.minimumMonthLength(n)){let e=this.isoToCalendarDate(o,r);for(;e.month!==i||e.year!==a;){if("reject"===t)throw new RangeError(`day ${s} does not exist in month ${i} of year ${a}`);o=this.addDaysIso(o,-1),e=this.isoToCalendarDate(o,r);}}return o};let h=0,u=this.isoToCalendarDate(c,r),T=simpleDateDiff(n,u);if(0!==T.years||0!==T.months||0!==T.days){const e=365*T.years+30*T.months+T.days;c=this.addDaysIso(c,e),u=this.isoToCalendarDate(c,r),T=simpleDateDiff(n,u),0===T.years&&0===T.months?c=calculateSameMonthResult(T.days):h=this.compareCalendarDates(n,u);}let p=8,f=!1;for(;h;){c=this.addDaysIso(c,h*p);const e=u;u=this.isoToCalendarDate(c,r);const a=h;if(h=this.compareCalendarDates(n,u),h)if(T=simpleDateDiff(n,u),0===T.years&&0===T.months)c=calculateSameMonthResult(T.days),h=0,f=n.day>this.minimumMonthLength(n);else if(a&&h!==a)if(p>1)p/=2;else {if("reject"===t)throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...o})}`);this.compareCalendarDates(u,e)>0&&(c=this.addDaysIso(c,-1)),f=!0,h=0;}}if(r.set(l,c),d&&r.set(d,c),void 0===n.year||void 0===n.month||void 0===n.day||void 0===n.monthCode||this.hasEra&&(void 0===n.era||void 0===n.eraYear))throw new RangeError("Unexpected missing property");if(!f){const e=JSON.stringify({func:"isoToCalendarDate",isoYear:c.year,isoMonth:c.month,isoDay:c.day,id:this.id});r.set(e,n);}return c}temporalToCalendarDate(e,t){const r={year:GetSlot(e,n),month:GetSlot(e,a),day:GetSlot(e,i)};return this.isoToCalendarDate(r,t)}compareCalendarDates(e,t){const r=PrepareTemporalFields(e,["day","month","year"],["day","month","year"]),o=PrepareTemporalFields(t,["day","month","year"],["day","month","year"]);return r.year!==o.year?ComparisonResult(r.year-o.year):r.month!==o.month?ComparisonResult(r.month-o.month):r.day!==o.day?ComparisonResult(r.day-o.day):0}regulateDate(e,t="constrain",r){const o=this.calendarToIsoDate(e,t,r);return this.isoToCalendarDate(o,r)}addDaysIso(e,t){return AddISODate(e.year,e.month,e.day,0,0,0,t,"constrain")}addDaysCalendar(e,t,r){const o=this.calendarToIsoDate(e,"constrain",r),n=this.addDaysIso(o,t);return this.isoToCalendarDate(n,r)}addMonthsCalendar(e,t,r,o){let n=e;const{day:a}=n;for(let e=0,r=dt(t);e<r;e++){const{month:e}=n,r=n,i=t<0?-Math.max(a,this.daysInPreviousMonth(n,o)):this.daysInMonth(n,o),s=this.calendarToIsoDate(n,"constrain",o);let l=this.addDaysIso(s,i);if(n=this.isoToCalendarDate(l,o),t>0){const t=this.monthsInYear(r,o);for(;n.month-1!=e%t;)l=this.addDaysIso(l,-1),n=this.isoToCalendarDate(l,o);}n.day!==a&&(n=this.regulateDate({...n,day:a},"constrain",o));}if("reject"===r&&n.day!==a)throw new RangeError(`Day ${a} does not exist in resulting calendar month`);return n}addCalendar(e,{years:t=0,months:r=0,weeks:o=0,days:n=0},a,i){const{year:s,day:l,monthCode:d}=e,m=this.adjustCalendarDate({year:s+t,monthCode:d,day:l},i),c=this.addMonthsCalendar(m,r,a,i),h=n+7*o;return this.addDaysCalendar(c,h,i)}untilCalendar(e,t,r,o){let n=0,a=0,i=0,s=0;switch(r){case"day":n=this.calendarDaysUntil(e,t,o);break;case"week":{const r=this.calendarDaysUntil(e,t,o);n=r%7,a=(r-n)/7;break}case"month":case"year":{const a=t.year-e.year,l=t.month-e.month,d=t.day-e.day,m=this.compareCalendarDates(t,e);if(!m)return {years:0,months:0,weeks:0,days:0};if("year"===r&&a){s=l*m<0||0===l&&d*m<0?a-m:a;}let c,h=s?this.addCalendar(e,{years:s},"constrain",o):e;do{i+=m,c=h,h=this.addMonthsCalendar(c,m,"constrain",o),h.day!==e.day&&(h=this.regulateDate({...h,day:e.day},"constrain",o));}while(this.compareCalendarDates(t,h)*m>=0);i-=m;n=this.calendarDaysUntil(c,t,o);break}}return {years:s,months:i,weeks:a,days:n}}daysInMonth(e,t){const{day:r}=e,o=this.maximumMonthLength(e),n=this.minimumMonthLength(e);if(n===o)return n;const a=r<=o-n?o:n,i=this.calendarToIsoDate(e,"constrain",t),s=this.addDaysIso(i,a),l=this.isoToCalendarDate(s,t),d=this.addDaysIso(s,-l.day);return this.isoToCalendarDate(d,t).day}daysInPreviousMonth(e,t){const{day:r,month:o,year:n}=e;let a={year:o>1?n:n-1,month:o,day:1};const i=o>1?o-1:this.monthsInYear(a,t);a={...a,month:i};const s=this.minimumMonthLength(a),l=this.maximumMonthLength(a);if(s===l)return l;const d=this.calendarToIsoDate(e,"constrain",t),m=this.addDaysIso(d,-r);return this.isoToCalendarDate(m,t).day}startOfCalendarYear(e){return {year:e.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth(e){return {year:e.year,month:e.month,day:1}}calendarDaysUntil(e,t,r){const o=this.calendarToIsoDate(e,"constrain",r),n=this.calendarToIsoDate(t,"constrain",r);return this.isoDaysUntil(o,n)}isoDaysUntil(e,t){return DifferenceISODate(e.year,e.month,e.day,t.year,t.month,t.day,"day").days}monthDayFromFields(e,t,r){let o,n,a,i,s,{year:l,month:d,monthCode:m,day:c,era:h,eraYear:u}=e;if(void 0===m){if(void 0===l&&(void 0===h||void 0===u))throw new TypeError("`monthCode`, `year`, or `era` and `eraYear` is required");({monthCode:m,year:l}=this.adjustCalendarDate({year:l,month:d,monthCode:m,day:c,era:h,eraYear:u},r,t));}const{year:T}=this.isoToCalendarDate({year:1972,month:1,day:1},r);for(let e=0;e<100;e++){const l=this.adjustCalendarDate({day:c,monthCode:m,year:T-e},r),d=this.calendarToIsoDate(l,"constrain",r),h=this.isoToCalendarDate(d,r);if(({year:o,month:n,day:a}=d),h.monthCode===m&&h.day===c)return {month:n,day:a,year:o};"constrain"===t&&(void 0===i||h.monthCode===i.monthCode&&h.day>i.day)&&(i=h,s=d);}if("constrain"===t&&void 0!==s)return s;throw new RangeError(`No recent ${this.id} year with monthCode ${m} and day ${c}`)}}class HebrewHelper extends HelperBase{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}},this.hasEra=!1;}inLeapYear(e){const{year:t}=e;return (7*t+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,"min")}maximumMonthLength(e){return this.minMaxMonthLength(e,"max")}minMaxMonthLength(e,t){const{month:r,year:o}=e,n=this.getMonthCode(o,r),a=ct(this.months).find((e=>e[1].monthCode===n));if(void 0===a)throw new RangeError(`unmatched Hebrew month: ${r}`);const i=a[1].days;return "number"==typeof i?i:i[t]}estimateIsoDate(e){const{year:t}=e;return {year:t-3760,month:1,day:1}}getMonthCode(e,t){return this.inLeapYear({year:e})?6===t?buildMonthCode(5,!0):buildMonthCode(t<6?t:t-1):buildMonthCode(t)}adjustCalendarDate(e,t,r="constrain",o=!1){let{year:n,eraYear:a,month:i,monthCode:s,day:l,monthExtra:d}=e;if(void 0===n&&void 0!==a&&(n=a),void 0===a&&void 0!==n&&(a=n),o){if(d){const e=this.months[d];if(!e)throw new RangeError(`Unrecognized month from formatToParts: ${d}`);i=this.inLeapYear({year:n})?e.leap:e.regular;}s=this.getMonthCode(n,i);return {year:n,month:i,day:l,era:void 0,eraYear:a,monthCode:s}}if(this.validateCalendarDate(e),void 0===i)if(s.endsWith("L")){if("M05L"!==s)throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${s}`);if(i=6,!this.inLeapYear({year:n})){if("reject"===r)throw new RangeError(`Hebrew monthCode M05L is invalid in year ${n} which is not a leap year`);i=5,l=30,s="M05";}}else {i=monthCodeNumberPart(s),this.inLeapYear({year:n})&&i>=6&&i++;const e=this.monthsInYear({year:n});if(i<1||i>e)throw new RangeError(`Invalid monthCode: ${s}`)}else if("reject"===r?(RejectToRange(i,1,this.monthsInYear({year:n})),RejectToRange(l,1,this.maximumMonthLength({year:n,month:i}))):(i=ConstrainToRange(i,1,this.monthsInYear({year:n})),l=ConstrainToRange(l,1,this.maximumMonthLength({year:n,month:i}))),void 0===s)s=this.getMonthCode(n,i);else {if(this.getMonthCode(n,i)!==s)throw new RangeError(`monthCode ${s} doesn't correspond to month ${i} in Hebrew year ${n}`)}return {...e,day:l,month:i,monthCode:s,year:n,eraYear:a}}}class IslamicBaseHelper extends HelperBase{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425,this.constantEra="ah";}inLeapYear(e,t){return 30===this.daysInMonth({year:e.year,month:12,day:1},t)}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}estimateIsoDate(e){const{year:t}=this.adjustCalendarDate(e);return {year:mt(t*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class IslamicHelper extends IslamicBaseHelper{constructor(){super(...arguments),this.id="islamic";}}class IslamicUmalquraHelper extends IslamicBaseHelper{constructor(){super(...arguments),this.id="islamic-umalqura";}}class IslamicTblaHelper extends IslamicBaseHelper{constructor(){super(...arguments),this.id="islamic-tbla";}}class IslamicCivilHelper extends IslamicBaseHelper{constructor(){super(...arguments),this.id="islamic-civil";}}class IslamicRgsaHelper extends IslamicBaseHelper{constructor(){super(...arguments),this.id="islamic-rgsa";}}class IslamicCcHelper extends IslamicBaseHelper{constructor(){super(...arguments),this.id="islamicc";}}class PersianHelper extends HelperBase{constructor(){super(...arguments),this.id="persian",this.calendarType="solar",this.constantEra="ap";}inLeapYear(e,t){return IslamicHelper.prototype.inLeapYear.call(this,e,t)}monthsInYear(){return 12}minimumMonthLength(e){const{month:t}=e;return 12===t?29:t<=6?31:30}maximumMonthLength(e){const{month:t}=e;return 12===t?30:t<=6?31:30}estimateIsoDate(e){const{year:t}=this.adjustCalendarDate(e);return {year:t+621,month:1,day:1}}}class IndianHelper extends HelperBase{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.constantEra="saka",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug="10/11/-79 Saka"!==new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"});}inLeapYear(e){return isGregorianLeapYear(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}getMonthInfo(e){const{month:t}=e;let r=this.months[t];if(void 0===r)throw new RangeError(`Invalid month: ${t}`);return this.inLeapYear(e)&&r.leap&&(r=r.leap),r}estimateIsoDate(e){const t=this.adjustCalendarDate(e),r=this.getMonthInfo(t);return AddISODate(t.year+78+(r.nextYear?1:0),r.month,r.day,0,0,0,t.day-1,"constrain")}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function isGregorianLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}class GregorianBaseHelper extends HelperBase{constructor(e,t){super(),this.calendarType="solar",this.v8IsVulnerableToJulianBug=new Date("+001001-01-01T00:00Z").toLocaleDateString("en-US-u-ca-japanese",{timeZone:"UTC"}).startsWith("12"),this.calendarIsVulnerableToJulianBug=!1,this.id=e;const{eras:r,anchorEra:o}=function adjustEras(e){let t,r=e;if(0===r.length)throw new RangeError("Invalid era data: eras are required");if(1===r.length&&r[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(1===r.length&&!r[0].name)throw new RangeError("Invalid era data: at least one named era is required");if(r.filter((e=>null!=e.reverseOf)).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");r.forEach((e=>{if(e.isAnchor||!e.anchorEpoch&&!e.reverseOf){if(t)throw new RangeError("Invalid era data: cannot have multiple anchor eras");t=e,e.anchorEpoch={year:e.hasYearZero?0:1};}else if(!e.name)throw new RangeError("If era name is blank, it must be the anchor era")})),r=r.filter((e=>e.name)),r.forEach((e=>{const{reverseOf:t}=e;if(t){const o=r.find((e=>e.name===t));if(void 0===o)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${t}`);e.reverseOf=o,e.anchorEpoch=o.anchorEpoch,e.isoEpoch=o.isoEpoch;}void 0===e.anchorEpoch.month&&(e.anchorEpoch.month=1),void 0===e.anchorEpoch.day&&(e.anchorEpoch.day=1);})),lt.call(r,((e,t)=>{if(e.reverseOf)return 1;if(t.reverseOf)return -1;if(!e.isoEpoch||!t.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return t.isoEpoch.year-e.isoEpoch.year}));const o=r[r.length-1].reverseOf;if(o&&o!==r[r.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return r.forEach(((e,t)=>{e.genericName="era"+(r.length-1-t);})),{eras:r,anchorEra:t||r[0]}}(t);this.anchorEra=o,this.eras=r;}inLeapYear(e){const{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return isGregorianLeapYear(t)}monthsInYear(){return 12}minimumMonthLength(e){const{month:t}=e;return 2===t?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}completeEraYear(e){const checkField=(t,r)=>{const o=e[t];if(null!=o&&o!=r)throw new RangeError(`Input ${t} ${o} doesn't match calculated value ${r}`)},eraFromYear=t=>{let r;const o={...e,year:t},n=this.eras.find(((e,n)=>{if(n===this.eras.length-1){if(e.reverseOf){if(t>0)throw new RangeError(`Signed year ${t} is invalid for era ${e.name}`);return r=e.anchorEpoch.year-t,!0}return r=t-e.anchorEpoch.year+(e.hasYearZero?0:1),!0}return this.compareCalendarDates(o,e.anchorEpoch)>=0&&(r=t-e.anchorEpoch.year+(e.hasYearZero?0:1),!0)}));if(!n)throw new RangeError(`Year ${t} was not matched by any era`);return {eraYear:r,era:n.name}};let{year:t,eraYear:r,era:o}=e;if(null!=t)(({eraYear:r,era:o}=eraFromYear(t))),checkField("era",o),checkField("eraYear",r);else {if(null==r)throw new RangeError("Either `year` or `eraYear` and `era` are required");{const e=void 0===o?void 0:this.eras.find((e=>e.name===o||e.genericName===o));if(!e)throw new RangeError(`Era ${o} (ISO year ${r}) was not matched by any era`);if(r<1&&e.reverseOf)throw new RangeError(`Years in ${o} era must be positive, not ${t}`);t=e.reverseOf?e.anchorEpoch.year-r:r+e.anchorEpoch.year-(e.hasYearZero?0:1),checkField("year",t),({eraYear:r,era:o}=eraFromYear(t));}}return {...e,year:t,eraYear:r,era:o}}adjustCalendarDate(e,t,r="constrain"){let o=e;const{month:n,monthCode:a}=o;return void 0===n&&(o={...o,month:monthCodeNumberPart(a)}),this.validateCalendarDate(o),o=this.completeEraYear(o),super.adjustCalendarDate(o,t,r)}estimateIsoDate(e){const t=this.adjustCalendarDate(e),{year:r,month:o,day:n}=t,{anchorEra:a}=this;return RegulateISODate(r+a.isoEpoch.year-(a.hasYearZero?0:1),o,n,"constrain")}checkIcuBugs(e){if(this.calendarIsVulnerableToJulianBug&&this.v8IsVulnerableToJulianBug){if(CompareISODate(e.year,e.month,e.day,1582,10,15)<0)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 1582-10-15 (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)`)}}}class OrthodoxBaseHelper extends GregorianBaseHelper{constructor(e,t){super(e,t);}inLeapYear(e){const{year:t}=e;return (t+1)%4==0}monthsInYear(){return 13}minimumMonthLength(e){const{month:t}=e;return 13===t?this.inLeapYear(e)?6:5:30}maximumMonthLength(e){return this.minimumMonthLength(e)}}class EthioaaHelper extends OrthodoxBaseHelper{constructor(){super("ethioaa",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}}]);}}class CopticHelper extends OrthodoxBaseHelper{constructor(){super("coptic",[{name:"era1",isoEpoch:{year:284,month:8,day:29}},{name:"era0",reverseOf:"era1"}]);}}class EthiopicHelper extends OrthodoxBaseHelper{constructor(){super("ethiopic",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}},{name:"era1",isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}]);}}class RocHelper extends GregorianBaseHelper{constructor(){super("roc",[{name:"minguo",isoEpoch:{year:1912,month:1,day:1}},{name:"before-roc",reverseOf:"minguo"}]),this.calendarIsVulnerableToJulianBug=!0;}}class BuddhistHelper extends GregorianBaseHelper{constructor(){super("buddhist",[{name:"be",hasYearZero:!0,isoEpoch:{year:-543,month:1,day:1}}]),this.calendarIsVulnerableToJulianBug=!0;}}class GregoryHelper extends GregorianBaseHelper{constructor(){super("gregory",[{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]);}reviseIntlEra(e){let{era:t,eraYear:r}=e;return "bc"!==t&&"b"!==t||(t="bce"),"ad"!==t&&"a"!==t||(t="ce"),{era:t,eraYear:r}}}class JapaneseHelper extends GregorianBaseHelper{constructor(){super("japanese",[{name:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{name:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{name:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{name:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{name:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]),this.calendarIsVulnerableToJulianBug=!0,this.eraLength="long";}reviseIntlEra(e,t){const{era:r,eraYear:o}=e,{year:n}=t;return this.eras.find((e=>e.name===r))?{era:r,eraYear:o}:n<1?{era:"bce",eraYear:1-n}:{era:"ce",eraYear:n}}}class ChineseBaseHelper extends HelperBase{constructor(){super(...arguments),this.calendarType="lunisolar",this.hasEra=!1;}inLeapYear(e,t){const r=this.getMonthList(e.year,t);return 13===ct(r).length}monthsInYear(e,t){return this.inLeapYear(e,t)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}getMonthList(e,t){if(void 0===e)throw new TypeError("Missing year");const r=JSON.stringify({func:"getMonthList",calendarYear:e,id:this.id}),o=t.get(r);if(o)return o;const n=this.getFormatter(),getCalendarDate=(e,t)=>{const r=toUtcIsoDateString({isoYear:e,isoMonth:2,isoDay:1}),o=new Date(r);o.setUTCDate(t+1);const a=n.formatToParts(o),i=a.find((e=>"month"===e.type)).value,s=+a.find((e=>"day"===e.type)).value;let l=a.find((e=>"relatedYear"===e.type));if(void 0===l)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return l=+l.value,{calendarMonthString:i,calendarDay:s,calendarYearToVerify:l}};let a=17,{calendarMonthString:i,calendarDay:s,calendarYearToVerify:l}=getCalendarDate(e,a);"1"!==i&&(a+=29,({calendarMonthString:i,calendarDay:s}=getCalendarDate(e,a))),a-=s-5;const d={};let m,c,h=1,u=!1;do{(({calendarMonthString:i,calendarDay:s,calendarYearToVerify:l}=getCalendarDate(e,a))),m&&(d[c].daysInMonth=m+30-s),l!==e?u=!0:(d[i]={monthIndex:h++},a+=30),m=s,c=i;}while(!u);return d[c].daysInMonth=m+30-s,t.set(r,d),d}estimateIsoDate(e){const{year:t,month:r}=e;return {year:t,month:r>=12?12:r+1,day:1}}adjustCalendarDate(e,t,r="constrain",o=!1){let{year:n,month:a,monthExtra:i,day:s,monthCode:l,eraYear:d}=e;if(o){if(n=d,i&&"bis"!==i)throw new RangeError(`Unexpected leap month suffix: ${i}`);const e=buildMonthCode(a,void 0!==i),r=`${a}${i||""}`,o=this.getMonthList(n,t)[r];if(void 0===o)throw new RangeError(`Unmatched month ${r} in Chinese year ${n}`);return a=o.monthIndex,{year:n,month:a,day:s,era:void 0,eraYear:d,monthCode:e}}if(this.validateCalendarDate(e),void 0===n&&(n=d),void 0===d&&(d=n),void 0===a){const e=this.getMonthList(n,t);let o=l.replace("L","bis").slice(1);"0"===o[0]&&(o=o.slice(1));let i=e[o];if(a=i&&i.monthIndex,void 0===a&&l.endsWith("L")&&!at.call(["M01L","M12L","M13L"],l)&&"constrain"===r){let t=l.slice(1,-1);"0"===t[0]&&(t=t.slice(1)),i=e[t],i&&(({daysInMonth:s,monthIndex:a}=i),l=buildMonthCode(t));}if(void 0===a)throw new RangeError(`Unmatched month ${l} in Chinese year ${n}`)}else if(void 0===l){const e=this.getMonthList(n,t),o=ct(e),i=o.length;"reject"===r?(RejectToRange(a,1,i),RejectToRange(s,1,this.maximumMonthLength())):(a=ConstrainToRange(a,1,i),s=ConstrainToRange(s,1,this.maximumMonthLength()));const d=o.find((([,e])=>e.monthIndex===a));if(void 0===d)throw new RangeError(`Invalid month ${a} in Chinese year ${n}`);l=buildMonthCode(d[0].replace("bis",""),-1!==d[0].indexOf("bis"));}else {const e=this.getMonthList(n,t);let r=l.replace("L","bis").slice(1);"0"===r[0]&&(r=r.slice(1));const o=e[r];if(!o)throw new RangeError(`Unmatched monthCode ${l} in Chinese year ${n}`);if(a!==o.monthIndex)throw new RangeError(`monthCode ${l} doesn't correspond to month ${a} in Chinese year ${n}`)}return {...e,year:n,eraYear:d,month:a,monthCode:l,day:s}}}class ChineseHelper extends ChineseBaseHelper{constructor(){super(...arguments),this.id="chinese";}}class DangiHelper extends ChineseBaseHelper{constructor(){super(...arguments),this.id="dangi";}}const Tt={helper:void 0,dateFromFields(e,t,r){const o=ToTemporalOverflow(t),n=new OneObjectCache,a=PrepareTemporalFields(e,["day","era","eraYear","month","monthCode","year"],["day"]),{year:i,month:s,day:l}=this.helper.calendarToIsoDate(a,o,n),d=CreateTemporalDate(i,s,l,r);return n.setObject(d),d},yearMonthFromFields(e,t,r){const o=ToTemporalOverflow(t),n=new OneObjectCache,a=PrepareTemporalFields(e,["era","eraYear","month","monthCode","year"],[]),{year:i,month:s,day:l}=this.helper.calendarToIsoDate({...a,day:1},o,n),d=CreateTemporalYearMonth(i,s,r,l);return n.setObject(d),d},monthDayFromFields(e,t,r){const o=ToTemporalOverflow(t),n=new OneObjectCache,a=PrepareTemporalFields(e,["day","era","eraYear","month","monthCode","year"],["day"]),{year:i,month:s,day:l}=this.helper.monthDayFromFields(a,o,n),d=CreateTemporalMonthDay(s,l,r,i);return n.setObject(d),d},fields(e){let t=e;return at.call(t,"year")&&(t=[...t,"era","eraYear"]),t},mergeFields(e,t){const r={...e},o={...t},{month:n,monthCode:a,year:i,era:s,eraYear:l,...d}=r,{month:m,monthCode:c,year:h,era:u,eraYear:T}=o;return void 0===m&&void 0===c&&(d.month=n,d.monthCode=a),void 0===h&&void 0===u&&void 0===T&&(d.year=i),{...d,...o}},dateAdd(e,t,r,o,n,a,i){const s=OneObjectCache.getCacheForObject(e),l=this.helper.temporalToCalendarDate(e,s),d=this.helper.addCalendar(l,{years:t,months:r,weeks:o,days:n},a,s),m=this.helper.calendarToIsoDate(d,"constrain",s),{year:c,month:h,day:u}=m,T=CreateTemporalDate(c,h,u,i);return new OneObjectCache(s).setObject(T),T},dateUntil(e,t,r){const o=OneObjectCache.getCacheForObject(e),n=OneObjectCache.getCacheForObject(t),a=this.helper.temporalToCalendarDate(e,o),i=this.helper.temporalToCalendarDate(t,n);return this.helper.untilCalendar(a,i,r,o)},year(e){const t=OneObjectCache.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).year},month(e){const t=OneObjectCache.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).month},day(e){const t=OneObjectCache.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).day},era(e){if(!this.helper.hasEra)return;const t=OneObjectCache.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).era},eraYear(e){if(!this.helper.hasEra)return;const t=OneObjectCache.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).eraYear},monthCode(e){const t=OneObjectCache.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).monthCode},dayOfWeek:e=>ut.iso8601.dayOfWeek(e),dayOfYear(e){const t=OneObjectCache.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,t),o=this.helper.startOfCalendarYear(r);return this.helper.calendarDaysUntil(o,r,t)+1},weekOfYear:e=>ut.iso8601.weekOfYear(e),daysInWeek:e=>ut.iso8601.daysInWeek(e),daysInMonth(e){const t=OneObjectCache.getCacheForObject(e),r=this.helper.temporalToCalendarDate(e,t),o=this.helper.maximumMonthLength(r);if(o===this.helper.minimumMonthLength(r))return o;const n=this.helper.startOfCalendarMonth(r),a=this.helper.addMonthsCalendar(n,1,"constrain",t);return this.helper.calendarDaysUntil(n,a,t)},daysInYear(e){let t=e;HasSlot(t,n)||(t=ToTemporalDate(t));const r=OneObjectCache.getCacheForObject(t),o=this.helper.temporalToCalendarDate(t,r),a=this.helper.startOfCalendarYear(o),i=this.helper.addCalendar(a,{years:1},"constrain",r);return this.helper.calendarDaysUntil(a,i,r)},monthsInYear(e){const t=OneObjectCache.getCacheForObject(e),r=this.helper.temporalToCalendarDate(e,t);return this.helper.monthsInYear(r,t)},inLeapYear(e){let t=e;HasSlot(t,n)||(t=ToTemporalDate(t));const r=OneObjectCache.getCacheForObject(t),o=this.helper.temporalToCalendarDate(t,r);return this.helper.inLeapYear(o,r)}};for(const e of [HebrewHelper,PersianHelper,EthiopicHelper,EthioaaHelper,CopticHelper,ChineseHelper,DangiHelper,RocHelper,IndianHelper,BuddhistHelper,GregoryHelper,JapaneseHelper,IslamicHelper,IslamicUmalquraHelper,IslamicTblaHelper,IslamicCivilHelper,IslamicRgsaHelper,IslamicCcHelper]){const t=new e;ut[t.id]={...Tt,helper:t};}class PlainDate{constructor(e,t,r,o=GetISO8601Calendar()){const n=ToIntegerThrowOnInfinity(e),a=ToIntegerThrowOnInfinity(t),i=ToIntegerThrowOnInfinity(r),s=ToTemporalCalendar(o);if(arguments.length<3)throw new RangeError("missing argument: isoYear, isoMonth and isoDay are required");CreateTemporalDateSlots(this,n,a,i,s);}get calendar(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return GetSlot(this,u)}get era(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarEra(GetSlot(this,u),this)}get eraYear(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarEraYear(GetSlot(this,u),this)}get year(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarYear(GetSlot(this,u),this)}get month(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarMonth(GetSlot(this,u),this)}get monthCode(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarMonthCode(GetSlot(this,u),this)}get day(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarDay(GetSlot(this,u),this)}get dayOfWeek(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarDayOfWeek(GetSlot(this,u),this)}get dayOfYear(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarDayOfYear(GetSlot(this,u),this)}get weekOfYear(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarWeekOfYear(GetSlot(this,u),this)}get daysInWeek(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarDaysInWeek(GetSlot(this,u),this)}get daysInMonth(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarDaysInMonth(GetSlot(this,u),this)}get daysInYear(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarDaysInYear(GetSlot(this,u),this)}get monthsInYear(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarMonthsInYear(GetSlot(this,u),this)}get inLeapYear(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return CalendarInLeapYear(GetSlot(this,u),this)}with(e,t){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument");RejectObjectWithCalendarOrTimeZone(e);const r=GetSlot(this,u),o=CalendarFields(r,["day","month","monthCode","year"]),n=PrepareTemporalFields(e,o,"partial");if(!n)throw new TypeError("invalid date-like");let a=PrepareTemporalFields(this,o,[]);a=CalendarMergeFields(r,a,n),a=PrepareTemporalFields(a,o,[]);return CalendarDateFromFields(r,a,GetOptionsObject(t))}withCalendar(e){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const t=ToTemporalCalendar(e);return new PlainDate(GetSlot(this,n),GetSlot(this,a),GetSlot(this,i),t)}add(e,t){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const r=ToTemporalDuration(e),o=GetOptionsObject(t);return CalendarDateAdd(GetSlot(this,u),this,r,o)}subtract(e,t){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const r=CreateNegatedTemporalDuration(ToTemporalDuration(e)),o=GetOptionsObject(t);return CalendarDateAdd(GetSlot(this,u),this,r,o)}until(e,t){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainDate("until",this,e,t)}since(e,t){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainDate("since",this,e,t)}equals(e){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e);for(const e of [n,a,i]){if(GetSlot(this,e)!==GetSlot(t,e))return !1}return CalendarEquals(GetSlot(this,u),GetSlot(t,u))}toString(e){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return TemporalDateToString(this,ToShowCalendarOption(GetOptionsObject(e)))}toJSON(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return TemporalDateToString(this)}toLocaleString(e,t){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDate")}toPlainDateTime(e){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const t=GetSlot(this,n),r=GetSlot(this,a),o=GetSlot(this,i),T=GetSlot(this,u);if(void 0===e)return CreateTemporalDateTime(t,r,o,0,0,0,0,0,0,T);const p=ToTemporalTime(e);return CreateTemporalDateTime(t,r,o,GetSlot(p,s),GetSlot(p,l),GetSlot(p,d),GetSlot(p,m),GetSlot(p,c),GetSlot(p,h),T)}toZonedDateTime(e){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");let t,o;if(IsObject(e)){const r=e.timeZone;void 0===r?t=ToTemporalTimeZone(e):(t=ToTemporalTimeZone(r),o=e.plainTime);}else t=ToTemporalTimeZone(e);const T=GetSlot(this,n),p=GetSlot(this,a),f=GetSlot(this,i),y=GetSlot(this,u);let S=0,w=0,g=0,I=0,D=0,G=0;void 0!==o&&(o=ToTemporalTime(o),S=GetSlot(o,s),w=GetSlot(o,l),g=GetSlot(o,d),I=GetSlot(o,m),D=GetSlot(o,c),G=GetSlot(o,h));return CreateTemporalZonedDateTime(GetSlot(BuiltinTimeZoneGetInstantFor(t,CreateTemporalDateTime(T,p,f,S,w,g,I,D,G,y),"compatible"),r),t,y)}toPlainYearMonth(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const e=GetSlot(this,u);return CalendarYearMonthFromFields(e,PrepareTemporalFields(this,CalendarFields(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");const e=GetSlot(this,u);return CalendarMonthDayFromFields(e,PrepareTemporalFields(this,CalendarFields(e,["day","monthCode"]),[]))}getISOFields(){if(!IsTemporalDate(this))throw new TypeError("invalid receiver");return {calendar:GetSlot(this,u),isoDay:GetSlot(this,i),isoMonth:GetSlot(this,a),isoYear:GetSlot(this,n)}}static from(e,t){const r=GetOptionsObject(t);return IsTemporalDate(e)?(ToTemporalOverflow(r),CreateTemporalDate(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),GetSlot(e,u))):ToTemporalDate(e,r)}static compare(e,t){const r=ToTemporalDate(e),o=ToTemporalDate(t);return CompareISODate(GetSlot(r,n),GetSlot(r,a),GetSlot(r,i),GetSlot(o,n),GetSlot(o,a),GetSlot(o,i))}}MakeIntrinsicClass(PlainDate,"Temporal.PlainDate");class PlainDateTime{constructor(e,t,r,o=0,n=0,a=0,i=0,s=0,l=0,d=GetISO8601Calendar()){const m=ToIntegerThrowOnInfinity(e),c=ToIntegerThrowOnInfinity(t),h=ToIntegerThrowOnInfinity(r),u=ToIntegerThrowOnInfinity(o),T=ToIntegerThrowOnInfinity(n),p=ToIntegerThrowOnInfinity(a),f=ToIntegerThrowOnInfinity(i),y=ToIntegerThrowOnInfinity(s),S=ToIntegerThrowOnInfinity(l),w=ToTemporalCalendar(d);if(arguments.length<3)throw new RangeError("missing argument: isoYear, isoMonth and isoDay are required");CreateTemporalDateTimeSlots(this,m,c,h,u,T,p,f,y,S,w);}get calendar(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,u)}get year(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarYear(GetSlot(this,u),this)}get month(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarMonth(GetSlot(this,u),this)}get monthCode(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarMonthCode(GetSlot(this,u),this)}get day(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarDay(GetSlot(this,u),this)}get hour(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,s)}get minute(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,l)}get second(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,d)}get millisecond(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,m)}get microsecond(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,c)}get nanosecond(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,h)}get era(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarEra(GetSlot(this,u),this)}get eraYear(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarEraYear(GetSlot(this,u),this)}get dayOfWeek(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarDayOfWeek(GetSlot(this,u),this)}get dayOfYear(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarDayOfYear(GetSlot(this,u),this)}get weekOfYear(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarWeekOfYear(GetSlot(this,u),this)}get daysInWeek(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarDaysInWeek(GetSlot(this,u),this)}get daysInYear(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarDaysInYear(GetSlot(this,u),this)}get daysInMonth(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarDaysInMonth(GetSlot(this,u),this)}get monthsInYear(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarMonthsInYear(GetSlot(this,u),this)}get inLeapYear(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return CalendarInLeapYear(GetSlot(this,u),this)}with(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument");RejectObjectWithCalendarOrTimeZone(e);const r=GetOptionsObject(t),o=GetSlot(this,u),n=CalendarFields(o,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),a=PrepareTemporalFields(e,n,"partial");if(!a)throw new TypeError("invalid date-time-like");let i=PrepareTemporalFields(this,n,[]);i=CalendarMergeFields(o,i,a),i=PrepareTemporalFields(i,n,[]);const{year:s,month:l,day:d,hour:m,minute:c,second:h,millisecond:T,microsecond:p,nanosecond:f}=InterpretTemporalDateTimeFields(o,i,r);return CreateTemporalDateTime(s,l,d,m,c,h,T,p,f,o)}withPlainTime(e){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const t=GetSlot(this,n),r=GetSlot(this,a),o=GetSlot(this,i),T=GetSlot(this,u);if(void 0===e)return CreateTemporalDateTime(t,r,o,0,0,0,0,0,0,T);const p=ToTemporalTime(e);return CreateTemporalDateTime(t,r,o,GetSlot(p,s),GetSlot(p,l),GetSlot(p,d),GetSlot(p,m),GetSlot(p,c),GetSlot(p,h),T)}withPlainDate(e){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e),r=GetSlot(t,n),o=GetSlot(t,a),T=GetSlot(t,i);let p=GetSlot(t,u);const f=GetSlot(this,s),y=GetSlot(this,l),S=GetSlot(this,d),w=GetSlot(this,m),g=GetSlot(this,c),I=GetSlot(this,h);return p=ConsolidateCalendars(GetSlot(this,u),p),CreateTemporalDateTime(r,o,T,f,y,S,w,g,I,p)}withCalendar(e){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const t=ToTemporalCalendar(e);return new PlainDateTime(GetSlot(this,n),GetSlot(this,a),GetSlot(this,i),GetSlot(this,s),GetSlot(this,l),GetSlot(this,d),GetSlot(this,m),GetSlot(this,c),GetSlot(this,h),t)}add(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromPlainDateTime("add",this,e,t)}subtract(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromPlainDateTime("subtract",this,e,t)}until(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainDateTime("until",this,e,t)}since(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainDateTime("since",this,e,t)}round(e){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?CreateOnePropObject("smallestUnit",e):GetOptionsObject(e),r=GetTemporalUnit(t,"smallestUnit","time",je,["day"]),o=ToTemporalRoundingMode(t,"halfExpand"),T=ToTemporalRoundingIncrement(t,{day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[r],!1);let p=GetSlot(this,n),f=GetSlot(this,a),y=GetSlot(this,i),S=GetSlot(this,s),w=GetSlot(this,l),g=GetSlot(this,d),I=GetSlot(this,m),D=GetSlot(this,c),G=GetSlot(this,h);return ({year:p,month:f,day:y,hour:S,minute:w,second:g,millisecond:I,microsecond:D,nanosecond:G}=RoundISODateTime(p,f,y,S,w,g,I,D,G,T,r,o)),CreateTemporalDateTime(p,f,y,S,w,g,I,D,G,GetSlot(this,u))}equals(e){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const t=ToTemporalDateTime(e);for(const e of [n,a,i,s,l,d,m,c,h]){if(GetSlot(this,e)!==GetSlot(t,e))return !1}return CalendarEquals(GetSlot(this,u),GetSlot(t,u))}toString(e){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const t=GetOptionsObject(e),{precision:r,unit:o,increment:n}=ToSecondsStringPrecision(t);return TemporalDateTimeToString(this,r,ToShowCalendarOption(t),{unit:o,increment:n,roundingMode:ToTemporalRoundingMode(t,"trunc")})}toJSON(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return TemporalDateTimeToString(this,"auto")}toLocaleString(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDateTime")}toZonedDateTime(e,t){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const o=ToTemporalTimeZone(e);return CreateTemporalZonedDateTime(GetSlot(BuiltinTimeZoneGetInstantFor(o,this,ToTemporalDisambiguation(GetOptionsObject(t))),r),o,GetSlot(this,u))}toPlainDate(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return TemporalDateTimeToDate(this)}toPlainYearMonth(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const e=GetSlot(this,u);return CalendarYearMonthFromFields(e,PrepareTemporalFields(this,CalendarFields(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");const e=GetSlot(this,u);return CalendarMonthDayFromFields(e,PrepareTemporalFields(this,CalendarFields(e,["day","monthCode"]),[]))}toPlainTime(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return TemporalDateTimeToTime(this)}getISOFields(){if(!IsTemporalDateTime(this))throw new TypeError("invalid receiver");return {calendar:GetSlot(this,u),isoDay:GetSlot(this,i),isoHour:GetSlot(this,s),isoMicrosecond:GetSlot(this,c),isoMillisecond:GetSlot(this,m),isoMinute:GetSlot(this,l),isoMonth:GetSlot(this,a),isoNanosecond:GetSlot(this,h),isoSecond:GetSlot(this,d),isoYear:GetSlot(this,n)}}static from(e,t){const r=GetOptionsObject(t);return IsTemporalDateTime(e)?(ToTemporalOverflow(r),CreateTemporalDateTime(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),GetSlot(e,s),GetSlot(e,l),GetSlot(e,d),GetSlot(e,m),GetSlot(e,c),GetSlot(e,h),GetSlot(e,u))):ToTemporalDateTime(e,r)}static compare(e,t){const r=ToTemporalDateTime(e),o=ToTemporalDateTime(t);for(const e of [n,a,i,s,l,d,m,c,h]){const t=GetSlot(r,e),n=GetSlot(o,e);if(t!==n)return ComparisonResult(t-n)}return 0}}MakeIntrinsicClass(PlainDateTime,"Temporal.PlainDateTime");class Duration{constructor(e=0,t=0,r=0,o=0,n=0,a=0,i=0,s=0,l=0,d=0){const m=ToIntegerWithoutRounding(e),c=ToIntegerWithoutRounding(t),h=ToIntegerWithoutRounding(r),u=ToIntegerWithoutRounding(o),T=ToIntegerWithoutRounding(n),p=ToIntegerWithoutRounding(a),C=ToIntegerWithoutRounding(i),E=ToIntegerWithoutRounding(s),b=ToIntegerWithoutRounding(l),M=ToIntegerWithoutRounding(d);RejectDuration(m,c,h,u,T,p,C,E,b,M),CreateSlots(this),SetSlot(this,f,m),SetSlot(this,y,c),SetSlot(this,S,h),SetSlot(this,w,u),SetSlot(this,g,T),SetSlot(this,I,p),SetSlot(this,D,C),SetSlot(this,G,E),SetSlot(this,v,b),SetSlot(this,O,M);}get years(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,f)}get months(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,y)}get weeks(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,S)}get days(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,w)}get hours(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,g)}get minutes(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,I)}get seconds(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,D)}get milliseconds(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,G)}get microseconds(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,v)}get nanoseconds(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return GetSlot(this,O)}get sign(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return DurationSign(GetSlot(this,f),GetSlot(this,y),GetSlot(this,S),GetSlot(this,w),GetSlot(this,g),GetSlot(this,I),GetSlot(this,D),GetSlot(this,G),GetSlot(this,v),GetSlot(this,O))}get blank(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return 0===DurationSign(GetSlot(this,f),GetSlot(this,y),GetSlot(this,S),GetSlot(this,w),GetSlot(this,g),GetSlot(this,I),GetSlot(this,D),GetSlot(this,G),GetSlot(this,v),GetSlot(this,O))}with(e){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");const t=PrepareTemporalFields(e,["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],"partial");if(!t)throw new TypeError("invalid duration-like");const{years:r=GetSlot(this,f),months:o=GetSlot(this,y),weeks:n=GetSlot(this,S),days:a=GetSlot(this,w),hours:i=GetSlot(this,g),minutes:s=GetSlot(this,I),seconds:l=GetSlot(this,D),milliseconds:d=GetSlot(this,G),microseconds:m=GetSlot(this,v),nanoseconds:c=GetSlot(this,O)}=t;return new Duration(r,o,n,a,i,s,l,d,m,c)}negated(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return CreateNegatedTemporalDuration(this)}abs(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return new Duration(Math.abs(GetSlot(this,f)),Math.abs(GetSlot(this,y)),Math.abs(GetSlot(this,S)),Math.abs(GetSlot(this,w)),Math.abs(GetSlot(this,g)),Math.abs(GetSlot(this,I)),Math.abs(GetSlot(this,D)),Math.abs(GetSlot(this,G)),Math.abs(GetSlot(this,v)),Math.abs(GetSlot(this,O)))}add(e,t){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromDuration("add",this,e,t)}subtract(e,t){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromDuration("subtract",this,e,t)}round(e){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");let t=GetSlot(this,f),r=GetSlot(this,y),o=GetSlot(this,S),n=GetSlot(this,w),a=GetSlot(this,g),i=GetSlot(this,I),s=GetSlot(this,D),l=GetSlot(this,G),d=GetSlot(this,v),m=GetSlot(this,O),c=DefaultTemporalLargestUnit(t,r,o,n,a,i,s,l,d,m);const h="string"==typeof e?CreateOnePropObject("smallestUnit",e):GetOptionsObject(e);let T=GetTemporalUnit(h,"smallestUnit","datetime",void 0),p=!0;T||(p=!1,T="nanosecond"),c=LargerOfTwoTemporalUnits(c,T);let C=GetTemporalUnit(h,"largestUnit","datetime",void 0,["auto"]),E=!0;if(C||(E=!1,C=c),"auto"===C&&(C=c),!p&&!E)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(LargerOfTwoTemporalUnits(C,T)!==C)throw new RangeError(`largestUnit ${C} cannot be smaller than smallestUnit ${T}`);const b=ToTemporalRoundingMode(h,"halfExpand"),M=ToTemporalDateTimeRoundingIncrement(h,T);let R=ToRelativeTemporalObject(h);return ({years:t,months:r,weeks:o,days:n}=UnbalanceDurationRelative(t,r,o,n,C,R)),({years:t,months:r,weeks:o,days:n,hours:a,minutes:i,seconds:s,milliseconds:l,microseconds:d,nanoseconds:m}=RoundDuration(t,r,o,n,a,i,s,l,d,m,M,T,b,R)),({years:t,months:r,weeks:o,days:n,hours:a,minutes:i,seconds:s,milliseconds:l,microseconds:d,nanoseconds:m}=AdjustRoundedDurationDays(t,r,o,n,a,i,s,l,d,m,M,T,b,R)),({years:t,months:r,weeks:o,days:n}=function BalanceDurationRelative(e,t,r,o,n,a){let i=e,s=t,l=r,d=o;const m=GetIntrinsic("%Temporal.Duration%"),c=DurationSign(i,s,l,d,0,0,0,0,0,0);if(0===c)return {years:i,months:s,weeks:l,days:d};let h,T;a&&(T=ToTemporalDate(a),h=GetSlot(T,u));const p=new m(c),f=new m(0,c),S=new m(0,0,c);switch(n){case"year":{if(!h)throw new RangeError("a starting point is required for years balancing");let e,t,r;for(({relativeTo:e,days:t}=MoveRelativeDate(h,T,p));K(d)>=K(t);)d-=t,i+=c,T=e,({relativeTo:e,days:t}=MoveRelativeDate(h,T,p));for(({relativeTo:e,days:r}=MoveRelativeDate(h,T,f));K(d)>=K(r);)d-=r,s+=c,T=e,({relativeTo:e,days:r}=MoveRelativeDate(h,T,f));const o=h.dateAdd;e=CalendarDateAdd(h,T,p,void 0,o);const n=h.dateUntil,a=le(null);a.largestUnit="month";let l=CalendarDateUntil(h,T,e,a,n),m=GetSlot(l,y);for(;K(s)>=K(m);){s-=m,i+=c,T=e,e=CalendarDateAdd(h,T,p,void 0,o);const t=le(null);t.largestUnit="month",l=CalendarDateUntil(h,T,e,t,n),m=GetSlot(l,y);}break}case"month":{if(!h)throw new RangeError("a starting point is required for months balancing");let e,t;for(({relativeTo:e,days:t}=MoveRelativeDate(h,T,f));K(d)>=K(t);)d-=t,s+=c,T=e,({relativeTo:e,days:t}=MoveRelativeDate(h,T,f));break}case"week":{if(!h)throw new RangeError("a starting point is required for weeks balancing");let e,t;for(({relativeTo:e,days:t}=MoveRelativeDate(h,T,S));K(d)>=K(t);)d-=t,l+=c,T=e,({relativeTo:e,days:t}=MoveRelativeDate(h,T,S));break}}return {years:i,months:s,weeks:l,days:d}}(t,r,o,n,C,R)),IsTemporalZonedDateTime(R)&&(R=MoveRelativeZonedDateTime(R,t,r,o,0)),({days:n,hours:a,minutes:i,seconds:s,milliseconds:l,microseconds:d,nanoseconds:m}=BalanceDuration(n,a,i,s,l,d,m,C,R)),new Duration(t,r,o,n,a,i,s,l,d,m)}total(e){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");let t=GetSlot(this,f),r=GetSlot(this,y),o=GetSlot(this,S),n=GetSlot(this,w),a=GetSlot(this,g),i=GetSlot(this,I),s=GetSlot(this,D),l=GetSlot(this,G),d=GetSlot(this,v),m=GetSlot(this,O);if(void 0===e)throw new TypeError("options argument is required");const c="string"==typeof e?CreateOnePropObject("unit",e):GetOptionsObject(e),h=GetTemporalUnit(c,"unit","datetime",je),u=ToRelativeTemporalObject(c);let T;(({years:t,months:r,weeks:o,days:n}=UnbalanceDurationRelative(t,r,o,n,h,u))),IsTemporalZonedDateTime(u)&&(T=MoveRelativeZonedDateTime(u,t,r,o,0)),({days:n,hours:a,minutes:i,seconds:s,milliseconds:l,microseconds:d,nanoseconds:m}=BalanceDuration(n,a,i,s,l,d,m,h,T));const{total:p}=RoundDuration(t,r,o,n,a,i,s,l,d,m,1,h,"trunc",u);return p}toString(e){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");const t=GetOptionsObject(e),{precision:r,unit:o,increment:n}=ToSecondsStringPrecision(t);if("minute"===r)throw new RangeError('smallestUnit must not be "minute"');return TemporalDurationToString(this,r,{unit:o,increment:n,roundingMode:ToTemporalRoundingMode(t,"trunc")})}toJSON(){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return TemporalDurationToString(this)}toLocaleString(e,t){if(!IsTemporalDuration(this))throw new TypeError("invalid receiver");return "undefined"!=typeof Intl&&void 0!==Intl.DurationFormat?new Intl.DurationFormat(e,t).format(this):(console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),TemporalDurationToString(this))}valueOf(){throw new TypeError("use compare() to compare Temporal.Duration")}static from(e){return IsTemporalDuration(e)?new Duration(GetSlot(e,f),GetSlot(e,y),GetSlot(e,S),GetSlot(e,w),GetSlot(e,g),GetSlot(e,I),GetSlot(e,D),GetSlot(e,G),GetSlot(e,v),GetSlot(e,O)):ToTemporalDuration(e)}static compare(t,r,o){const n=ToTemporalDuration(t),a=ToTemporalDuration(r),i=ToRelativeTemporalObject(GetOptionsObject(o)),s=GetSlot(n,f),l=GetSlot(n,y),d=GetSlot(n,S);let m=GetSlot(n,w);const c=GetSlot(n,g),h=GetSlot(n,I),u=GetSlot(n,D),T=GetSlot(n,G),p=GetSlot(n,v);let C=GetSlot(n,O);const E=GetSlot(a,f),b=GetSlot(a,y),M=GetSlot(a,S);let R=GetSlot(a,w);const Z=GetSlot(a,g),P=GetSlot(a,I),F=GetSlot(a,D),Y=GetSlot(a,G),j=GetSlot(a,v);let $=GetSlot(a,O);const B=CalculateOffsetShift(i,s,l,d,m),N=CalculateOffsetShift(i,E,b,M,R);0===s&&0===E&&0===l&&0===b&&0===d&&0===M||(({days:m}=UnbalanceDurationRelative(s,l,d,m,"day",i)),({days:R}=UnbalanceDurationRelative(E,b,M,R,"day",i)));const k=TotalDurationNanoseconds(m,c,h,u,T,p,C,B),A=TotalDurationNanoseconds(R,Z,P,F,Y,j,$,N);return ComparisonResult(JSBI.toNumber(JSBI.subtract(k,A)))}}MakeIntrinsicClass(Duration,"Temporal.Duration");const pt=Object.create;class PlainMonthDay{constructor(e,t,r=GetISO8601Calendar(),o=1972){const n=ToIntegerThrowOnInfinity(e),a=ToIntegerThrowOnInfinity(t),i=ToTemporalCalendar(r),s=ToIntegerThrowOnInfinity(o);if(arguments.length<2)throw new RangeError("missing argument: isoMonth and isoDay are required");CreateTemporalMonthDaySlots(this,n,a,i,s);}get monthCode(){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return CalendarMonthCode(GetSlot(this,u),this)}get day(){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return CalendarDay(GetSlot(this,u),this)}get calendar(){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return GetSlot(this,u)}with(e,t){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument");RejectObjectWithCalendarOrTimeZone(e);const r=GetSlot(this,u),o=CalendarFields(r,["day","month","monthCode","year"]),n=PrepareTemporalFields(e,o,"partial");if(!n)throw new TypeError("invalid month-day-like");let a=PrepareTemporalFields(this,o,[]);a=CalendarMergeFields(r,a,n),a=PrepareTemporalFields(a,o,[]);return CalendarMonthDayFromFields(r,a,GetOptionsObject(t))}equals(e){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");const t=ToTemporalMonthDay(e);for(const e of [a,i,n]){if(GetSlot(this,e)!==GetSlot(t,e))return !1}return CalendarEquals(GetSlot(this,u),GetSlot(t,u))}toString(e){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return TemporalMonthDayToString(this,ToShowCalendarOption(GetOptionsObject(e)))}toJSON(){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return TemporalMonthDayToString(this)}toLocaleString(e,t){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}valueOf(){throw new TypeError("use equals() to compare Temporal.PlainMonthDay")}toPlainDate(e){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("argument should be an object");const t=GetSlot(this,u),r=CalendarFields(t,["day","monthCode"]),o=PrepareTemporalFields(this,r,[]),n=CalendarFields(t,["year"]);let a=CalendarMergeFields(t,o,PrepareTemporalFields(e,n,[]));a=PrepareTemporalFields(a,[...new Set([...r,...n])],[]);const i=pt(null);return i.overflow="reject",CalendarDateFromFields(t,a,i)}getISOFields(){if(!IsTemporalMonthDay(this))throw new TypeError("invalid receiver");return {calendar:GetSlot(this,u),isoDay:GetSlot(this,i),isoMonth:GetSlot(this,a),isoYear:GetSlot(this,n)}}static from(e,t){const r=GetOptionsObject(t);return IsTemporalMonthDay(e)?(ToTemporalOverflow(r),CreateTemporalMonthDay(GetSlot(e,a),GetSlot(e,i),GetSlot(e,u),GetSlot(e,n))):ToTemporalMonthDay(e,r)}}MakeIntrinsicClass(PlainMonthDay,"Temporal.PlainMonthDay");const instant=()=>new(GetIntrinsic("%Temporal.Instant%"))($e()),plainDateTime=(e,t=timeZone())=>{const r=ToTemporalTimeZone(t),o=ToTemporalCalendar(e);return BuiltinTimeZoneGetPlainDateTimeFor(r,instant(),o)},plainDateTimeISO=(e=timeZone())=>{const t=ToTemporalTimeZone(e),r=GetISO8601Calendar();return BuiltinTimeZoneGetPlainDateTimeFor(t,instant(),r)},zonedDateTime=(e,t=timeZone())=>{const r=ToTemporalTimeZone(t),o=ToTemporalCalendar(e);return CreateTemporalZonedDateTime($e(),r,o)},timeZone=()=>function SystemTimeZone(){const e=new J("en-us");return new(GetIntrinsic("%Temporal.TimeZone%"))(ParseTemporalTimeZone(e.resolvedOptions().timeZone))}(),ft={instant,plainDateTime,plainDateTimeISO,plainDate:(e,t=timeZone())=>TemporalDateTimeToDate(plainDateTime(e,t)),plainDateISO:(e=timeZone())=>TemporalDateTimeToDate(plainDateTimeISO(e)),plainTimeISO:(e=timeZone())=>TemporalDateTimeToTime(plainDateTimeISO(e)),timeZone,zonedDateTime,zonedDateTimeISO:(e=timeZone())=>zonedDateTime(GetISO8601Calendar(),e),[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(ft,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});const yt=Object.assign;function TemporalTimeToString(e,t,r){let o=GetSlot(e,s),n=GetSlot(e,l),a=GetSlot(e,d),i=GetSlot(e,m),u=GetSlot(e,c),T=GetSlot(e,h);if(r){const{unit:e,increment:t,roundingMode:s}=r;({hour:o,minute:n,second:a,millisecond:i,microsecond:u,nanosecond:T}=RoundTime(o,n,a,i,u,T,t,e,s));}return `${ISODateTimePartString(o)}:${ISODateTimePartString(n)}${FormatSecondsStringPart(a,i,u,T,t)}`}class PlainTime{constructor(e=0,t=0,r=0,o=0,n=0,a=0){const i=ToIntegerThrowOnInfinity(e),T=ToIntegerThrowOnInfinity(t),p=ToIntegerThrowOnInfinity(r),f=ToIntegerThrowOnInfinity(o),y=ToIntegerThrowOnInfinity(n),S=ToIntegerThrowOnInfinity(a);RejectTime(i,T,p,f,y,S),CreateSlots(this),SetSlot(this,s,i),SetSlot(this,l,T),SetSlot(this,d,p),SetSlot(this,m,f),SetSlot(this,c,y),SetSlot(this,h,S),SetSlot(this,u,GetISO8601Calendar());}get calendar(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,u)}get hour(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,s)}get minute(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,l)}get second(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,d)}get millisecond(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,m)}get microsecond(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,c)}get nanosecond(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return GetSlot(this,h)}with(e,t){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument");RejectObjectWithCalendarOrTimeZone(e);const r=ToTemporalTimeRecord(e,"partial"),o=ToTemporalOverflow(GetOptionsObject(t)),n=ToTemporalTimeRecord(this);let{hour:a,minute:i,second:s,millisecond:l,microsecond:d,nanosecond:m}=yt(n,r);return ({hour:a,minute:i,second:s,millisecond:l,microsecond:d,nanosecond:m}=RegulateTime(a,i,s,l,d,m,o)),new PlainTime(a,i,s,l,d,m)}add(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromPlainTime("add",this,e)}subtract(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromPlainTime("subtract",this,e)}until(e,t){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainTime("until",this,e,t)}since(e,t){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainTime("since",this,e,t)}round(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?CreateOnePropObject("smallestUnit",e):GetOptionsObject(e),r=GetTemporalUnit(t,"smallestUnit","time",je),o=ToTemporalRoundingMode(t,"halfExpand"),n=ToTemporalRoundingIncrement(t,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[r],!1);let a=GetSlot(this,s),i=GetSlot(this,l),u=GetSlot(this,d),T=GetSlot(this,m),p=GetSlot(this,c),f=GetSlot(this,h);return ({hour:a,minute:i,second:u,millisecond:T,microsecond:p,nanosecond:f}=RoundTime(a,i,u,T,p,f,n,r,o)),new PlainTime(a,i,u,T,p,f)}equals(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");const t=ToTemporalTime(e);for(const e of [s,l,d,m,c,h]){if(GetSlot(this,e)!==GetSlot(t,e))return !1}return !0}toString(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");const t=GetOptionsObject(e),{precision:r,unit:o,increment:n}=ToSecondsStringPrecision(t);return TemporalTimeToString(this,r,{unit:o,increment:n,roundingMode:ToTemporalRoundingMode(t,"trunc")})}toJSON(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return TemporalTimeToString(this,"auto")}toLocaleString(e,t){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainTime")}toPlainDateTime(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e),r=GetSlot(t,n),o=GetSlot(t,a),T=GetSlot(t,i),p=GetSlot(t,u);return CreateTemporalDateTime(r,o,T,GetSlot(this,s),GetSlot(this,l),GetSlot(this,d),GetSlot(this,m),GetSlot(this,c),GetSlot(this,h),p)}toZonedDateTime(e){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument");const t=e.plainDate;if(void 0===t)throw new TypeError("missing date property");const o=ToTemporalDate(t),T=e.timeZone;if(void 0===T)throw new TypeError("missing timeZone property");const p=ToTemporalTimeZone(T),f=GetSlot(o,n),y=GetSlot(o,a),S=GetSlot(o,i),w=GetSlot(o,u),g=GetSlot(this,s),I=GetSlot(this,l),D=GetSlot(this,d),G=GetSlot(this,m),v=GetSlot(this,c),O=GetSlot(this,h);return CreateTemporalZonedDateTime(GetSlot(BuiltinTimeZoneGetInstantFor(p,new(GetIntrinsic("%Temporal.PlainDateTime%"))(f,y,S,g,I,D,G,v,O,w),"compatible"),r),p,w)}getISOFields(){if(!IsTemporalTime(this))throw new TypeError("invalid receiver");return {calendar:GetSlot(this,u),isoHour:GetSlot(this,s),isoMicrosecond:GetSlot(this,c),isoMillisecond:GetSlot(this,m),isoMinute:GetSlot(this,l),isoNanosecond:GetSlot(this,h),isoSecond:GetSlot(this,d)}}static from(e,t){const r=ToTemporalOverflow(GetOptionsObject(t));return IsTemporalTime(e)?new PlainTime(GetSlot(e,s),GetSlot(e,l),GetSlot(e,d),GetSlot(e,m),GetSlot(e,c),GetSlot(e,h)):ToTemporalTime(e,r)}static compare(e,t){const r=ToTemporalTime(e),o=ToTemporalTime(t);for(const e of [s,l,d,m,c,h]){const t=GetSlot(r,e),n=GetSlot(o,e);if(t!==n)return ComparisonResult(t-n)}return 0}}MakeIntrinsicClass(PlainTime,"Temporal.PlainTime");class TimeZone{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: identifier is required");const t=GetCanonicalTimeZoneIdentifier(e);CreateSlots(this),SetSlot(this,o,t);}get id(){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");return ToString(this)}getOffsetNanosecondsFor(e){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");const t=ToTemporalInstant(e),n=GetSlot(this,o);return TestTimeZoneOffsetString(n)?ParseTimeZoneOffsetString(n):GetIANATimeZoneOffsetNanoseconds(GetSlot(t,r),n)}getOffsetStringFor(e){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");return BuiltinTimeZoneGetOffsetStringFor(this,ToTemporalInstant(e))}getPlainDateTimeFor(e,t=GetISO8601Calendar()){return BuiltinTimeZoneGetPlainDateTimeFor(this,ToTemporalInstant(e),ToTemporalCalendar(t))}getInstantFor(e,t){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");return BuiltinTimeZoneGetInstantFor(this,ToTemporalDateTime(e),ToTemporalDisambiguation(GetOptionsObject(t)))}getPossibleInstantsFor(t){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");const r=ToTemporalDateTime(t),u=GetIntrinsic("%Temporal.Instant%"),T=GetSlot(this,o);if(TestTimeZoneOffsetString(T)){const t=GetEpochFromISOParts(GetSlot(r,n),GetSlot(r,a),GetSlot(r,i),GetSlot(r,s),GetSlot(r,l),GetSlot(r,d),GetSlot(r,m),GetSlot(r,c),GetSlot(r,h));if(null===t)throw new RangeError("DateTime outside of supported range");const o=ParseTimeZoneOffsetString(T);return [new u(JSBI.subtract(t,JSBI.BigInt(o)))]}return function GetIANATimeZoneEpochValue(t,r,o,n,a,i,s,l,d,m){const c=GetEpochFromISOParts(r,o,n,a,i,s,l,d,m);if(null===c)throw new RangeError("DateTime outside of supported range");let h=JSBI.subtract(c,we);JSBI.lessThan(h,ge)&&(h=c);let u=JSBI.add(c,we);JSBI.greaterThan(u,Ie)&&(u=c);const T=GetIANATimeZoneOffsetNanoseconds(h,t),p=GetIANATimeZoneOffsetNanoseconds(u,t);return (T===p?[T]:[T,p]).map((h=>{const u=JSBI.subtract(c,JSBI.BigInt(h)),T=GetIANATimeZoneDateTimeParts(u,t);if(r===T.year&&o===T.month&&n===T.day&&a===T.hour&&i===T.minute&&s===T.second&&l===T.millisecond&&d===T.microsecond&&m===T.nanosecond)return u})).filter((e=>void 0!==e))}(T,GetSlot(r,n),GetSlot(r,a),GetSlot(r,i),GetSlot(r,s),GetSlot(r,l),GetSlot(r,d),GetSlot(r,m),GetSlot(r,c),GetSlot(r,h)).map((e=>new u(e)))}getNextTransition(t){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");const n=ToTemporalInstant(t),a=GetSlot(this,o);if(TestTimeZoneOffsetString(a)||"UTC"===a)return null;let i=GetSlot(n,r);const s=GetIntrinsic("%Temporal.Instant%");return i=function GetIANATimeZoneNextTransition(t,r){const o=JSBI.add(t,ve),n=maxJSBI(afterLatestPossibleTzdbRuleChange(),o);let a=maxJSBI(De,t);const i=GetIANATimeZoneOffsetNanoseconds(a,r);let s=a,l=i;for(;i===l&&JSBI.lessThan(JSBI.BigInt(a),n);)s=JSBI.add(a,Oe),l=GetIANATimeZoneOffsetNanoseconds(s,r),i===l&&(a=s);return i===l?null:bisect((e=>GetIANATimeZoneOffsetNanoseconds(e,r)),a,s,i,l)}(i,a),null===i?null:new s(i)}getPreviousTransition(e){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");const t=ToTemporalInstant(e),n=GetSlot(this,o);if(TestTimeZoneOffsetString(n)||"UTC"===n)return null;let a=GetSlot(t,r);const i=GetIntrinsic("%Temporal.Instant%");return a=GetIANATimeZonePreviousTransition(a,n),null===a?null:new i(a)}toString(){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");return ToString(GetSlot(this,o))}toJSON(){if(!IsTemporalTimeZone(this))throw new TypeError("invalid receiver");return ToString(this)}static from(e){return ToTemporalTimeZone(e)}}MakeIntrinsicClass(TimeZone,"Temporal.TimeZone");const St=Object.create;class PlainYearMonth{constructor(e,t,r=GetISO8601Calendar(),o=1){const n=ToIntegerThrowOnInfinity(e),a=ToIntegerThrowOnInfinity(t),i=ToTemporalCalendar(r),s=ToIntegerThrowOnInfinity(o);if(arguments.length<2)throw new RangeError("missing argument: isoYear and isoMonth are required");CreateTemporalYearMonthSlots(this,n,a,i,s);}get year(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarYear(GetSlot(this,u),this)}get month(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarMonth(GetSlot(this,u),this)}get monthCode(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarMonthCode(GetSlot(this,u),this)}get calendar(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return GetSlot(this,u)}get era(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarEra(GetSlot(this,u),this)}get eraYear(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarEraYear(GetSlot(this,u),this)}get daysInMonth(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarDaysInMonth(GetSlot(this,u),this)}get daysInYear(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarDaysInYear(GetSlot(this,u),this)}get monthsInYear(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarMonthsInYear(GetSlot(this,u),this)}get inLeapYear(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return CalendarInLeapYear(GetSlot(this,u),this)}with(e,t){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid argument");RejectObjectWithCalendarOrTimeZone(e);const r=GetSlot(this,u),o=CalendarFields(r,["month","monthCode","year"]),n=PrepareTemporalFields(e,o,"partial");if(!n)throw new TypeError("invalid year-month-like");let a=PrepareTemporalFields(this,o,[]);a=CalendarMergeFields(r,a,n),a=PrepareTemporalFields(a,o,[]);return CalendarYearMonthFromFields(r,a,GetOptionsObject(t))}add(e,t){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromPlainYearMonth("add",this,e,t)}subtract(e,t){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromPlainYearMonth("subtract",this,e,t)}until(e,t){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainYearMonth("until",this,e,t)}since(e,t){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return DifferenceTemporalPlainYearMonth("since",this,e,t)}equals(e){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");const t=ToTemporalYearMonth(e);for(const e of [n,a,i]){if(GetSlot(this,e)!==GetSlot(t,e))return !1}return CalendarEquals(GetSlot(this,u),GetSlot(t,u))}toString(e){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return TemporalYearMonthToString(this,ToShowCalendarOption(GetOptionsObject(e)))}toJSON(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return TemporalYearMonthToString(this)}toLocaleString(e,t){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainYearMonth")}toPlainDate(e){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("argument should be an object");const t=GetSlot(this,u),r=CalendarFields(t,["monthCode","year"]),o=PrepareTemporalFields(this,r,[]),n=CalendarFields(t,["day"]);let a=CalendarMergeFields(t,o,PrepareTemporalFields(e,n,[]));a=PrepareTemporalFields(a,[...new Set([...r,...n])],[]);const i=St(null);return i.overflow="reject",CalendarDateFromFields(t,a,i)}getISOFields(){if(!IsTemporalYearMonth(this))throw new TypeError("invalid receiver");return {calendar:GetSlot(this,u),isoDay:GetSlot(this,i),isoMonth:GetSlot(this,a),isoYear:GetSlot(this,n)}}static from(e,t){const r=GetOptionsObject(t);return IsTemporalYearMonth(e)?(ToTemporalOverflow(r),CreateTemporalYearMonth(GetSlot(e,n),GetSlot(e,a),GetSlot(e,u),GetSlot(e,i))):ToTemporalYearMonth(e,r)}static compare(e,t){const r=ToTemporalYearMonth(e),o=ToTemporalYearMonth(t);return CompareISODate(GetSlot(r,n),GetSlot(r,a),GetSlot(r,i),GetSlot(o,n),GetSlot(o,a),GetSlot(o,i))}}MakeIntrinsicClass(PlainYearMonth,"Temporal.PlainYearMonth");class ZonedDateTime{constructor(e,t,r=GetISO8601Calendar()){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");CreateTemporalZonedDateTimeSlots(this,ToBigInt(e),ToTemporalTimeZone(t),ToTemporalCalendar(r));}get calendar(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,u)}get timeZone(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(this,p)}get year(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarYear(GetSlot(this,u),dateTime(this))}get month(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarMonth(GetSlot(this,u),dateTime(this))}get monthCode(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarMonthCode(GetSlot(this,u),dateTime(this))}get day(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarDay(GetSlot(this,u),dateTime(this))}get hour(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(dateTime(this),s)}get minute(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(dateTime(this),l)}get second(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(dateTime(this),d)}get millisecond(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(dateTime(this),m)}get microsecond(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(dateTime(this),c)}get nanosecond(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetSlot(dateTime(this),h)}get era(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarEra(GetSlot(this,u),dateTime(this))}get eraYear(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarEraYear(GetSlot(this,u),dateTime(this))}get epochSeconds(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=GetSlot(this,r);return JSBI.toNumber(JSBI.divide(t,ye))}get epochMilliseconds(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=GetSlot(this,r);return JSBI.toNumber(JSBI.divide(t,fe))}get epochMicroseconds(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=GetSlot(this,r);return ToBigIntExternal(JSBI.divide(t,pe))}get epochNanoseconds(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return ToBigIntExternal(GetSlot(this,r))}get dayOfWeek(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarDayOfWeek(GetSlot(this,u),dateTime(this))}get dayOfYear(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarDayOfYear(GetSlot(this,u),dateTime(this))}get weekOfYear(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarWeekOfYear(GetSlot(this,u),dateTime(this))}get hoursInDay(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=dateTime(this),o=GetIntrinsic("%Temporal.PlainDateTime%"),s=GetSlot(t,n),l=GetSlot(t,a),d=GetSlot(t,i),m=new o(s,l,d,0,0,0,0,0,0),c=AddISODate(s,l,d,0,0,0,1,"reject"),h=new o(c.year,c.month,c.day,0,0,0,0,0,0),u=GetSlot(this,p),T=GetSlot(BuiltinTimeZoneGetInstantFor(u,m,"compatible"),r),f=GetSlot(BuiltinTimeZoneGetInstantFor(u,h,"compatible"),r);return JSBI.toNumber(JSBI.subtract(f,T))/36e11}get daysInWeek(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarDaysInWeek(GetSlot(this,u),dateTime(this))}get daysInMonth(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarDaysInMonth(GetSlot(this,u),dateTime(this))}get daysInYear(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarDaysInYear(GetSlot(this,u),dateTime(this))}get monthsInYear(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarMonthsInYear(GetSlot(this,u),dateTime(this))}get inLeapYear(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return CalendarInLeapYear(GetSlot(this,u),dateTime(this))}get offset(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return BuiltinTimeZoneGetOffsetStringFor(GetSlot(this,p),GetSlot(this,T))}get offsetNanoseconds(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return GetOffsetNanosecondsFor(GetSlot(this,p),GetSlot(this,T))}with(e,t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");if(!IsObject(e))throw new TypeError("invalid zoned-date-time-like");RejectObjectWithCalendarOrTimeZone(e);const r=GetOptionsObject(t),o=ToTemporalDisambiguation(r),n=ToTemporalOffset(r,"prefer"),a=GetSlot(this,p),i=GetSlot(this,u),s=ArrayPush(CalendarFields(i,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),"offset"),l=PrepareTemporalFields(e,s,"partial"),d=ArrayPush(s,"timeZone");let m=PrepareTemporalFields(this,d,["timeZone","offset"]);m=CalendarMergeFields(i,m,l),m=PrepareTemporalFields(m,d,["timeZone","offset"]);let{year:c,month:h,day:T,hour:f,minute:y,second:S,millisecond:w,microsecond:g,nanosecond:I}=InterpretTemporalDateTimeFields(i,m,r);return CreateTemporalZonedDateTime(InterpretISODateTimeOffset(c,h,T,f,y,S,w,g,I,"option",ParseTimeZoneOffsetString(m.offset),a,o,n,!1),GetSlot(this,p),i)}withPlainDate(e){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=ToTemporalDate(e),o=GetSlot(t,n),T=GetSlot(t,a),f=GetSlot(t,i);let y=GetSlot(t,u);const S=dateTime(this),w=GetSlot(S,s),g=GetSlot(S,l),I=GetSlot(S,d),D=GetSlot(S,m),G=GetSlot(S,c),v=GetSlot(S,h);y=ConsolidateCalendars(GetSlot(this,u),y);const O=GetSlot(this,p);return CreateTemporalZonedDateTime(GetSlot(BuiltinTimeZoneGetInstantFor(O,new(GetIntrinsic("%Temporal.PlainDateTime%"))(o,T,f,w,g,I,D,G,v,y),"compatible"),r),O,y)}withPlainTime(e){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=GetIntrinsic("%Temporal.PlainTime%"),o=void 0===e?new t:ToTemporalTime(e),T=dateTime(this),f=GetSlot(T,n),y=GetSlot(T,a),S=GetSlot(T,i),w=GetSlot(this,u),g=GetSlot(o,s),I=GetSlot(o,l),D=GetSlot(o,d),G=GetSlot(o,m),v=GetSlot(o,c),O=GetSlot(o,h),C=GetSlot(this,p);return CreateTemporalZonedDateTime(GetSlot(BuiltinTimeZoneGetInstantFor(C,new(GetIntrinsic("%Temporal.PlainDateTime%"))(f,y,S,g,I,D,G,v,O,w),"compatible"),r),C,w)}withTimeZone(e){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=ToTemporalTimeZone(e);return CreateTemporalZonedDateTime(GetSlot(this,r),t,GetSlot(this,u))}withCalendar(e){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=ToTemporalCalendar(e);return CreateTemporalZonedDateTime(GetSlot(this,r),GetSlot(this,p),t)}add(e,t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromZonedDateTime("add",this,e,t)}subtract(e,t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return AddDurationToOrSubtractDurationFromZonedDateTime("subtract",this,e,t)}until(e,t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return DifferenceTemporalZonedDateTime("until",this,e,t)}since(e,t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return DifferenceTemporalZonedDateTime("since",this,e,t)}round(t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");if(void 0===t)throw new TypeError("options parameter is required");const o="string"==typeof t?CreateOnePropObject("smallestUnit",t):GetOptionsObject(t),f=GetTemporalUnit(o,"smallestUnit","time",je,["day"]),y=ToTemporalRoundingMode(o,"halfExpand"),S=ToTemporalRoundingIncrement(o,{day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[f],!1),w=dateTime(this);let g=GetSlot(w,n),I=GetSlot(w,a),D=GetSlot(w,i),G=GetSlot(w,s),v=GetSlot(w,l),O=GetSlot(w,d),C=GetSlot(w,m),E=GetSlot(w,c),b=GetSlot(w,h);const M=GetIntrinsic("%Temporal.PlainDateTime%"),R=GetSlot(this,p),Z=GetSlot(this,u),P=BuiltinTimeZoneGetInstantFor(R,new M(GetSlot(w,n),GetSlot(w,a),GetSlot(w,i),0,0,0,0,0,0),"compatible"),F=AddZonedDateTime(P,R,Z,0,0,0,1,0,0,0,0,0,0),Y=JSBI.subtract(F,JSBI.BigInt(GetSlot(P,r)));if(JSBI.equal(Y,he))throw new RangeError("cannot round a ZonedDateTime in a calendar with zero-length days");({year:g,month:I,day:D,hour:G,minute:v,second:O,millisecond:C,microsecond:E,nanosecond:b}=RoundISODateTime(g,I,D,G,v,O,C,E,b,S,f,y,JSBI.toNumber(Y)));return CreateTemporalZonedDateTime(InterpretISODateTimeOffset(g,I,D,G,v,O,C,E,b,"option",GetOffsetNanosecondsFor(R,GetSlot(this,T)),R,"compatible","prefer",!1),R,GetSlot(this,u))}equals(t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const o=ToTemporalZonedDateTime(t),n=GetSlot(this,r),a=GetSlot(o,r);return !!JSBI.equal(JSBI.BigInt(n),JSBI.BigInt(a))&&(!!TimeZoneEquals(GetSlot(this,p),GetSlot(o,p))&&CalendarEquals(GetSlot(this,u),GetSlot(o,u)))}toString(e){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const t=GetOptionsObject(e),{precision:r,unit:o,increment:n}=ToSecondsStringPrecision(t),a=ToTemporalRoundingMode(t,"trunc");return TemporalZonedDateTimeToString(this,r,ToShowCalendarOption(t),function ToShowTimeZoneNameOption(e){return GetOption(e,"timeZoneName",["auto","never"],"auto")}(t),function ToShowOffsetOption(e){return GetOption(e,"offset",["auto","never"],"auto")}(t),{unit:o,increment:n,roundingMode:a})}toLocaleString(e,t){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return new ot(e,t).format(this)}toJSON(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return TemporalZonedDateTimeToString(this,"auto")}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.ZonedDateTime")}startOfDay(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const e=dateTime(this),t=GetIntrinsic("%Temporal.PlainDateTime%"),o=GetSlot(this,u),s=new t(GetSlot(e,n),GetSlot(e,a),GetSlot(e,i),0,0,0,0,0,0,o),l=GetSlot(this,p);return CreateTemporalZonedDateTime(GetSlot(BuiltinTimeZoneGetInstantFor(l,s,"compatible"),r),l,o)}toInstant(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return new(GetIntrinsic("%Temporal.Instant%"))(GetSlot(this,r))}toPlainDate(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return TemporalDateTimeToDate(dateTime(this))}toPlainTime(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return TemporalDateTimeToTime(dateTime(this))}toPlainDateTime(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");return dateTime(this)}toPlainYearMonth(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const e=GetSlot(this,u);return CalendarYearMonthFromFields(e,PrepareTemporalFields(this,CalendarFields(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const e=GetSlot(this,u);return CalendarMonthDayFromFields(e,PrepareTemporalFields(this,CalendarFields(e,["day","monthCode"]),[]))}getISOFields(){if(!IsTemporalZonedDateTime(this))throw new TypeError("invalid receiver");const e=dateTime(this),t=GetSlot(this,p);return {calendar:GetSlot(this,u),isoDay:GetSlot(e,i),isoHour:GetSlot(e,s),isoMicrosecond:GetSlot(e,c),isoMillisecond:GetSlot(e,m),isoMinute:GetSlot(e,l),isoMonth:GetSlot(e,a),isoNanosecond:GetSlot(e,h),isoSecond:GetSlot(e,d),isoYear:GetSlot(e,n),offset:BuiltinTimeZoneGetOffsetStringFor(t,GetSlot(this,T)),timeZone:t}}static from(e,t){const o=GetOptionsObject(t);return IsTemporalZonedDateTime(e)?(ToTemporalOverflow(o),ToTemporalDisambiguation(o),ToTemporalOffset(o,"reject"),CreateTemporalZonedDateTime(GetSlot(e,r),GetSlot(e,p),GetSlot(e,u))):ToTemporalZonedDateTime(e,o)}static compare(t,o){const n=ToTemporalZonedDateTime(t),a=ToTemporalZonedDateTime(o),i=GetSlot(n,r),s=GetSlot(a,r);return JSBI.lessThan(JSBI.BigInt(i),JSBI.BigInt(s))?-1:JSBI.greaterThan(JSBI.BigInt(i),JSBI.BigInt(s))?1:0}}function dateTime(e){return BuiltinTimeZoneGetPlainDateTimeFor(GetSlot(e,p),GetSlot(e,T),GetSlot(e,u))}MakeIntrinsicClass(ZonedDateTime,"Temporal.ZonedDateTime");var wt=Object.freeze({__proto__:null,Instant,Calendar,PlainDate,PlainDateTime,Duration,PlainMonthDay,Now:ft,PlainTime,TimeZone,PlainYearMonth,ZonedDateTime});const gt=[Instant,Calendar,PlainDate,PlainDateTime,Duration,PlainMonthDay,PlainTime,TimeZone,PlainYearMonth,ZonedDateTime];for(const e of gt){const t=Object.getOwnPropertyDescriptor(e,"prototype");(t.configurable||t.enumerable||t.writable)&&(t.configurable=!1,t.enumerable=!1,t.writable=!1,Object.defineProperty(e,"prototype",t));}
8
8
 
9
+ /**
10
+ * Returns a list of all supported time zones.
11
+ *
12
+ * @returns {string[]}
13
+ */
14
+ const timeZonesAvailable = Intl.supportedValuesOf("timeZone");
9
15
  /**
10
16
  * Formats a temporal date according to the specified format, time zone, and locale.
11
17
  *
@@ -631,6 +637,50 @@ const isPastUtil = (date) => {
631
637
  const isTodayUtil = (date) => {
632
638
  return wt.PlainDate.compare(toZonedDateTimeUtil(wt.Now.instant()), toZonedDateTimeUtil(date)) === 0;
633
639
  };
640
+ /**
641
+ * Checks if a date is same day as current.
642
+ *
643
+ * @param {TemporalDate} date - The date to check.
644
+ * @returns {boolean} `true` if the date is current day, `false` otherwise.
645
+ */
646
+ const isSameDayUtil = (date) => {
647
+ const today = toZonedDateTimeUtil(wt.Now.instant());
648
+ const input = toZonedDateTimeUtil(date);
649
+ return today.dayOfYear === input.dayOfYear && today.year === input.year;
650
+ };
651
+ /**
652
+ * Checks if a date is same week as current.
653
+ *
654
+ * @param {TemporalDate} date - The date to check.
655
+ * @returns {boolean} `true` if the date is current week, `false` otherwise.
656
+ */
657
+ const isSameWeekUtil = (date) => {
658
+ const today = toZonedDateTimeUtil(wt.Now.instant());
659
+ const input = toZonedDateTimeUtil(date);
660
+ return today.weekOfYear === input.weekOfYear && today.year === input.year;
661
+ };
662
+ /**
663
+ * Checks if a date is same month as current.
664
+ *
665
+ * @param {TemporalDate} date - The date to check.
666
+ * @returns {boolean} `true` if the date is current month, `false` otherwise.
667
+ */
668
+ const isSameMonthUtil = (date) => {
669
+ const today = toZonedDateTimeUtil(wt.Now.instant());
670
+ const input = toZonedDateTimeUtil(date);
671
+ return today.month === input.month && today.year === input.year;
672
+ };
673
+ /**
674
+ * Checks if a date is same year as current.
675
+ *
676
+ * @param {TemporalDate} date - The date to check.
677
+ * @returns {boolean} `true` if the date is current year, `false` otherwise.
678
+ */
679
+ const isSameYearUtil = (date) => {
680
+ const today = toZonedDateTimeUtil(wt.Now.instant());
681
+ const input = toZonedDateTimeUtil(date);
682
+ return today.year === input.year;
683
+ };
634
684
  /**
635
685
  * Checks if two dates are equal.
636
686
  *
@@ -941,6 +991,34 @@ const monthNameUtil = (date, format, locale) => {
941
991
  month: format,
942
992
  });
943
993
  };
994
+ /**
995
+ * Returns the day name for the given date.
996
+ *
997
+ * @param {TemporalDate | Date} date - The temporal or JavaScript Date object to get day name from.
998
+ * @param {TemporalFormatStyle} [format] - The format options for the name of the day.
999
+ * @param {string} [locale] - The locale to use for formatting. If not provided, the system's default locale will be used.
1000
+ * @returns {string} The the name of the day from passed date.
1001
+ * @example
1002
+ * const dateString = "2023-04-10"
1003
+ * const date = new Date(dateString);
1004
+ * const dayName = dayNameUtil(date, "long");
1005
+ * Output: "Monday"
1006
+ * @example
1007
+ * const dateString = "2023-04-10"
1008
+ * const date = new Date(dateString);
1009
+ * const dayName = dayNameUtil(date, "short");
1010
+ * Output: "Mon"
1011
+ * @example
1012
+ * const dateString = "2023-04-10"
1013
+ * const date = new Date(dateString);
1014
+ * const dayName = dayNameUtil(date, "narrow");
1015
+ * Output: "M"
1016
+ */
1017
+ const dayNameUtil = (date, format, locale) => {
1018
+ return toZonedDateTimeUtil(date).toLocaleString(locale, {
1019
+ weekday: format,
1020
+ });
1021
+ };
944
1022
 
945
1023
  exports.addDaysUtil = addDaysUtil;
946
1024
  exports.addHoursUtil = addHoursUtil;
@@ -948,6 +1026,7 @@ exports.addMinutesUtil = addMinutesUtil;
948
1026
  exports.addMonthsUtil = addMonthsUtil;
949
1027
  exports.addWeeksUtil = addWeeksUtil;
950
1028
  exports.addYearsUtil = addYearsUtil;
1029
+ exports.dayNameUtil = dayNameUtil;
951
1030
  exports.differenceInDaysUtil = differenceInDaysUtil;
952
1031
  exports.differenceInHoursUtil = differenceInHoursUtil;
953
1032
  exports.differenceInMinutesUtil = differenceInMinutesUtil;
@@ -963,6 +1042,10 @@ exports.formatRangeUtil = formatRangeUtil;
963
1042
  exports.isEqualUtil = isEqualUtil;
964
1043
  exports.isFutureUtil = isFutureUtil;
965
1044
  exports.isPastUtil = isPastUtil;
1045
+ exports.isSameDayUtil = isSameDayUtil;
1046
+ exports.isSameMonthUtil = isSameMonthUtil;
1047
+ exports.isSameWeekUtil = isSameWeekUtil;
1048
+ exports.isSameYearUtil = isSameYearUtil;
966
1049
  exports.isTodayUtil = isTodayUtil;
967
1050
  exports.monthNameUtil = monthNameUtil;
968
1051
  exports.startOfDayUtil = startOfDayUtil;
@@ -983,6 +1066,7 @@ exports.timeSinceInMinutes = timeSinceInMinutes;
983
1066
  exports.timeSinceInMonths = timeSinceInMonths;
984
1067
  exports.timeSinceInSeconds = timeSinceInSeconds;
985
1068
  exports.timeSinceInYears = timeSinceInYears;
1069
+ exports.timeZonesAvailable = timeZonesAvailable;
986
1070
  exports.toDateUtil = toDateUtil;
987
1071
  exports.toInstantUtil = toInstantUtil;
988
1072
  exports.toTemporalUtil = toTemporalUtil;