- Add GETTING_STARTED.md with quick start guide and development modes - Add INSTALL.sh automated installation script - Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md - Add QUICK_REFERENCE.md for common commands - Add SETUP_GUIDE.md with detailed setup instructions - Update README.md with improved project overview - Add did-wallet app dependencies and node_modules
1 line
759 KiB
Plaintext
1 line
759 KiB
Plaintext
{"version":3,"file":"index.cjs","sources":["../lib/intrinsicclass.ts","../lib/slots.ts","../lib/regex.ts","../lib/ecmascript.ts","../lib/intl.ts","../lib/instant.ts","../lib/calendar.ts","../lib/plaindate.ts","../lib/plaindatetime.ts","../lib/duration.ts","../lib/plainmonthday.ts","../lib/now.ts","../lib/plaintime.ts","../lib/timezone.ts","../lib/plainyearmonth.ts","../lib/zoneddatetime.ts","../lib/index.ts","../lib/legacydate.ts"],"sourcesContent":["import type JSBI from 'jsbi';\nimport type { Temporal } from '..';\n\nimport { DEBUG } from './debug';\n\ntype OmitConstructor<T> = { [P in keyof T as T[P] extends new (...args: any[]) => any ? P : never]: T[P] };\n\ntype TemporalIntrinsics = Omit<typeof Temporal, 'Now' | 'Instant' | 'ZonedDateTime'> & {\n Instant: OmitConstructor<Temporal.Instant> &\n (new (epochNanoseconds: JSBI) => Temporal.Instant) & { prototype: typeof Temporal.Instant.prototype };\n ZonedDateTime: OmitConstructor<Temporal.ZonedDateTime> &\n (new (\n epochNanoseconds: JSBI,\n timeZone: string | Temporal.TimeZoneProtocol,\n calendar?: string | Temporal.CalendarProtocol\n ) => Temporal.ZonedDateTime) & {\n prototype: typeof Temporal.ZonedDateTime.prototype;\n from: typeof Temporal.ZonedDateTime.from;\n compare: typeof Temporal.ZonedDateTime.compare;\n };\n};\ntype TemporalIntrinsicRegistrations = {\n [key in keyof TemporalIntrinsics as `Temporal.${key}`]: TemporalIntrinsics[key];\n};\ntype TemporalIntrinsicPrototypeRegistrations = {\n [key in keyof TemporalIntrinsics as `Temporal.${key}.prototype`]: TemporalIntrinsics[key]['prototype'];\n};\ntype TemporalIntrinsicRegisteredKeys = {\n [key in keyof TemporalIntrinsicRegistrations as `%${key}%`]: TemporalIntrinsicRegistrations[key];\n};\ntype TemporalIntrinsicPrototypeRegisteredKeys = {\n [key in keyof TemporalIntrinsicPrototypeRegistrations as `%${key}%`]: TemporalIntrinsicPrototypeRegistrations[key];\n};\n\ntype CalendarPrototypeKeys = keyof Omit<Temporal.Calendar, typeof Symbol.toStringTag>;\ntype TemporalCalendarIntrinsicRegistrations = {\n [key in CalendarPrototypeKeys as `Temporal.Calendar.prototype.${key}`]: Temporal.Calendar[key];\n} & {\n 'Temporal.Calendar.from': typeof Temporal.Calendar.from;\n};\ntype TemporalCalendarIntrinsicRegisteredKeys = {\n [key in keyof TemporalCalendarIntrinsicRegistrations as `%${key}%`]: TemporalCalendarIntrinsicRegistrations[key];\n};\n\ntype TimeZonePrototypeKeys = 'getOffsetNanosecondsFor' | 'getPossibleInstantsFor';\ntype TemporalTimeZoneIntrinsicRegistrations = {\n [key in TimeZonePrototypeKeys as `Temporal.TimeZone.prototype.${key}`]: Temporal.TimeZone[key];\n} & {\n 'Temporal.TimeZone.from': typeof Temporal.TimeZone.from;\n};\ntype TemporalTimeZoneIntrinsicRegisteredKeys = {\n [key in keyof TemporalTimeZoneIntrinsicRegistrations as `%${key}%`]: TemporalTimeZoneIntrinsicRegistrations[key];\n};\n\nconst INTRINSICS = {} as TemporalIntrinsicRegisteredKeys &\n TemporalIntrinsicPrototypeRegisteredKeys &\n TemporalTimeZoneIntrinsicRegisteredKeys &\n TemporalCalendarIntrinsicRegisteredKeys;\n\ntype customFormatFunction<T> = (\n this: T,\n depth: number,\n options: { stylize: (value: unknown, type: 'number' | 'special') => string }\n) => string;\nconst customUtilInspectFormatters: Partial<{\n [key in keyof TemporalIntrinsicRegistrations]: customFormatFunction<\n InstanceType<TemporalIntrinsicRegistrations[key]>\n >;\n}> = {\n ['Temporal.Duration'](depth, options) {\n const descr = options.stylize(`${this[Symbol.toStringTag]} <${this}>`, 'special');\n if (depth < 1) return descr;\n const entries = [];\n for (const prop of [\n 'years',\n 'months',\n 'weeks',\n 'days',\n 'hours',\n 'minutes',\n 'seconds',\n 'milliseconds',\n 'microseconds',\n 'nanoseconds'\n ] as const) {\n if (this[prop] !== 0) entries.push(` ${prop}: ${options.stylize(this[prop], 'number')}`);\n }\n return descr + ' {\\n' + entries.join(',\\n') + '\\n}';\n }\n};\n\ntype InspectFormatterOptions = { stylize: (str: string, styleType: string) => string };\nfunction defaultUtilInspectFormatter(this: any, depth: number, options: InspectFormatterOptions) {\n return options.stylize(`${this[Symbol.toStringTag]} <${this}>`, 'special');\n}\n\nexport function MakeIntrinsicClass(\n Class: TemporalIntrinsicRegistrations[typeof name],\n name: keyof TemporalIntrinsicRegistrations\n) {\n Object.defineProperty(Class.prototype, Symbol.toStringTag, {\n value: name,\n writable: false,\n enumerable: false,\n configurable: true\n });\n if (DEBUG) {\n Object.defineProperty(Class.prototype, Symbol.for('nodejs.util.inspect.custom'), {\n value: customUtilInspectFormatters[name] || defaultUtilInspectFormatter,\n writable: false,\n enumerable: false,\n configurable: true\n });\n }\n for (const prop of Object.getOwnPropertyNames(Class)) {\n // we know that `prop` is present, so the descriptor is never undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const desc = Object.getOwnPropertyDescriptor(Class, prop)!;\n if (!desc.configurable || !desc.enumerable) continue;\n desc.enumerable = false;\n Object.defineProperty(Class, prop, desc);\n }\n for (const prop of Object.getOwnPropertyNames(Class.prototype)) {\n // we know that `prop` is present, so the descriptor is never undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const desc = Object.getOwnPropertyDescriptor(Class.prototype, prop)!;\n if (!desc.configurable || !desc.enumerable) continue;\n desc.enumerable = false;\n Object.defineProperty(Class.prototype, prop, desc);\n }\n\n DefineIntrinsic(name, Class);\n DefineIntrinsic(`${name}.prototype`, Class.prototype);\n}\n\ntype IntrinsicDefinitionKeys =\n | keyof TemporalIntrinsicRegistrations\n | keyof TemporalIntrinsicPrototypeRegistrations\n | keyof TemporalCalendarIntrinsicRegistrations\n | keyof TemporalTimeZoneIntrinsicRegistrations;\nexport function DefineIntrinsic<KeyT extends keyof TemporalIntrinsicRegistrations>(\n name: KeyT,\n value: TemporalIntrinsicRegistrations[KeyT]\n): void;\nexport function DefineIntrinsic<KeyT extends keyof TemporalIntrinsicPrototypeRegistrations>(\n name: KeyT,\n value: TemporalIntrinsicPrototypeRegistrations[KeyT]\n): void;\nexport function DefineIntrinsic<KeyT extends keyof TemporalCalendarIntrinsicRegistrations>(\n name: KeyT,\n value: TemporalCalendarIntrinsicRegistrations[KeyT]\n): void;\nexport function DefineIntrinsic<KeyT extends keyof TemporalTimeZoneIntrinsicRegistrations>(\n name: KeyT,\n value: TemporalTimeZoneIntrinsicRegistrations[KeyT]\n): void;\nexport function DefineIntrinsic<KeyT>(name: KeyT, value: never): void;\nexport function DefineIntrinsic<KeyT extends IntrinsicDefinitionKeys>(name: KeyT, value: unknown): void {\n const key: `%${IntrinsicDefinitionKeys}%` = `%${name}%`;\n if (INTRINSICS[key] !== undefined) throw new Error(`intrinsic ${name} already exists`);\n INTRINSICS[key] = value;\n}\nexport function GetIntrinsic<KeyT extends keyof typeof INTRINSICS>(intrinsic: KeyT): typeof INTRINSICS[KeyT] {\n return INTRINSICS[intrinsic];\n}\n","import type JSBI from 'jsbi';\nimport type { Temporal } from '..';\nimport type { BuiltinCalendarId, AnyTemporalType, CalendarSlot, TimeZoneSlot } from './internaltypes';\n\n// Instant\nexport const EPOCHNANOSECONDS = 'slot-epochNanoSeconds';\n\n// TimeZone\nexport const TIMEZONE_ID = 'slot-timezone-identifier';\n\n// DateTime, Date, Time, YearMonth, MonthDay\nexport const ISO_YEAR = 'slot-year';\nexport const ISO_MONTH = 'slot-month';\nexport const ISO_DAY = 'slot-day';\nexport const ISO_HOUR = 'slot-hour';\nexport const ISO_MINUTE = 'slot-minute';\nexport const ISO_SECOND = 'slot-second';\nexport const ISO_MILLISECOND = 'slot-millisecond';\nexport const ISO_MICROSECOND = 'slot-microsecond';\nexport const ISO_NANOSECOND = 'slot-nanosecond';\nexport const CALENDAR = 'slot-calendar';\n// Date, YearMonth, and MonthDay all have the same slots, disambiguation needed:\nexport const DATE_BRAND = 'slot-date-brand';\nexport const YEAR_MONTH_BRAND = 'slot-year-month-brand';\nexport const MONTH_DAY_BRAND = 'slot-month-day-brand';\n\n// ZonedDateTime\nexport const INSTANT = 'slot-cached-instant';\nexport const TIME_ZONE = 'slot-time-zone';\n\n// Duration\nexport const YEARS = 'slot-years';\nexport const MONTHS = 'slot-months';\nexport const WEEKS = 'slot-weeks';\nexport const DAYS = 'slot-days';\nexport const HOURS = 'slot-hours';\nexport const MINUTES = 'slot-minutes';\nexport const SECONDS = 'slot-seconds';\nexport const MILLISECONDS = 'slot-milliseconds';\nexport const MICROSECONDS = 'slot-microseconds';\nexport const NANOSECONDS = 'slot-nanoseconds';\n\n// Calendar\nexport const CALENDAR_ID = 'slot-calendar-identifier';\n\ninterface SlotInfo<ValueType, UsedByType extends AnyTemporalType> {\n value: ValueType;\n usedBy: UsedByType;\n}\n\ninterface SlotInfoRecord {\n [k: string]: SlotInfo<unknown, AnyTemporalType>;\n}\n\ninterface Slots extends SlotInfoRecord {\n // Instant\n [EPOCHNANOSECONDS]: SlotInfo<JSBI, Temporal.Instant | Temporal.ZonedDateTime>; // number? JSBI?\n\n // TimeZone\n [TIMEZONE_ID]: SlotInfo<string, Temporal.TimeZone>;\n\n // DateTime, Date, Time, YearMonth, MonthDay\n [ISO_YEAR]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_MONTH]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_DAY]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_HOUR]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_MINUTE]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_SECOND]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_MILLISECOND]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_MICROSECOND]: SlotInfo<number, TypesWithCalendarUnits>;\n [ISO_NANOSECOND]: SlotInfo<number, TypesWithCalendarUnits>;\n [CALENDAR]: SlotInfo<CalendarSlot, TypesWithCalendarUnits>;\n\n // Date, YearMonth, MonthDay common slots\n [DATE_BRAND]: SlotInfo<true, Temporal.PlainDate>;\n [YEAR_MONTH_BRAND]: SlotInfo<true, Temporal.PlainYearMonth>;\n [MONTH_DAY_BRAND]: SlotInfo<true, Temporal.PlainMonthDay>;\n\n // ZonedDateTime\n [INSTANT]: SlotInfo<Temporal.Instant, Temporal.ZonedDateTime>;\n [TIME_ZONE]: SlotInfo<TimeZoneSlot, Temporal.ZonedDateTime>;\n\n // Duration\n [YEARS]: SlotInfo<number, Temporal.Duration>;\n [MONTHS]: SlotInfo<number, Temporal.Duration>;\n [WEEKS]: SlotInfo<number, Temporal.Duration>;\n [DAYS]: SlotInfo<number, Temporal.Duration>;\n [HOURS]: SlotInfo<number, Temporal.Duration>;\n [MINUTES]: SlotInfo<number, Temporal.Duration>;\n [SECONDS]: SlotInfo<number, Temporal.Duration>;\n [MILLISECONDS]: SlotInfo<number, Temporal.Duration>;\n [MICROSECONDS]: SlotInfo<number, Temporal.Duration>;\n [NANOSECONDS]: SlotInfo<number, Temporal.Duration>;\n\n // Calendar\n [CALENDAR_ID]: SlotInfo<BuiltinCalendarId, Temporal.Calendar>;\n}\n\ntype TypesWithCalendarUnits =\n | Temporal.PlainDateTime\n | Temporal.PlainDate\n | Temporal.PlainTime\n | Temporal.PlainYearMonth\n | Temporal.PlainMonthDay\n | Temporal.ZonedDateTime;\n\ninterface SlotsToTypes {\n // Instant\n [EPOCHNANOSECONDS]: Temporal.Instant;\n\n // TimeZone\n [TIMEZONE_ID]: Temporal.TimeZone;\n\n // DateTime, Date, Time, YearMonth, MonthDay\n [ISO_YEAR]: TypesWithCalendarUnits;\n [ISO_MONTH]: TypesWithCalendarUnits;\n [ISO_DAY]: TypesWithCalendarUnits;\n [ISO_HOUR]: TypesWithCalendarUnits;\n [ISO_MINUTE]: TypesWithCalendarUnits;\n [ISO_SECOND]: TypesWithCalendarUnits;\n [ISO_MILLISECOND]: TypesWithCalendarUnits;\n [ISO_MICROSECOND]: TypesWithCalendarUnits;\n [ISO_NANOSECOND]: TypesWithCalendarUnits;\n [CALENDAR]: TypesWithCalendarUnits;\n\n // Date, YearMonth, MonthDay common slots\n [DATE_BRAND]: Temporal.PlainDate;\n [YEAR_MONTH_BRAND]: Temporal.PlainYearMonth;\n [MONTH_DAY_BRAND]: Temporal.PlainMonthDay;\n\n // ZonedDateTime\n [INSTANT]: Temporal.ZonedDateTime;\n [TIME_ZONE]: Temporal.ZonedDateTime;\n\n // Duration\n [YEARS]: Temporal.Duration;\n [MONTHS]: Temporal.Duration;\n [WEEKS]: Temporal.Duration;\n [DAYS]: Temporal.Duration;\n [HOURS]: Temporal.Duration;\n [MINUTES]: Temporal.Duration;\n [SECONDS]: Temporal.Duration;\n [MILLISECONDS]: Temporal.Duration;\n [MICROSECONDS]: Temporal.Duration;\n [NANOSECONDS]: Temporal.Duration;\n\n // Calendar\n [CALENDAR_ID]: Temporal.Calendar;\n}\n\ntype SlotKey = keyof SlotsToTypes;\n\nconst globalSlots = new WeakMap<Slots[keyof Slots]['usedBy'], Record<keyof Slots, Slots[keyof Slots]['value']>>();\n\nfunction _GetSlots(container: Slots[keyof Slots]['usedBy']) {\n return globalSlots.get(container);\n}\n\nconst GetSlotsSymbol = Symbol.for('@@Temporal__GetSlots');\n\n// expose GetSlots to avoid dual package hazards\n(globalThis as any)[GetSlotsSymbol] ||= _GetSlots;\n\nconst GetSlots = (globalThis as any)[GetSlotsSymbol] as typeof _GetSlots;\n\nfunction _CreateSlots(container: Slots[keyof Slots]['usedBy']): void {\n globalSlots.set(container, Object.create(null));\n}\n\nconst CreateSlotsSymbol = Symbol.for('@@Temporal__CreateSlots');\n\n// expose CreateSlots to avoid dual package hazards\n(globalThis as any)[CreateSlotsSymbol] ||= _CreateSlots;\n\nexport const CreateSlots = (globalThis as any)[CreateSlotsSymbol] as typeof _CreateSlots;\n\n// TODO: is there a better way than 9 overloads to make HasSlot into a type\n// guard that takes a variable number of parameters?\nexport function HasSlot<ID1 extends SlotKey>(container: unknown, id1: ID1): container is Slots[ID1]['usedBy'];\nexport function HasSlot<ID1 extends SlotKey, ID2 extends SlotKey>(\n container: unknown,\n id1: ID1,\n id2: ID2\n): container is Slots[ID1]['usedBy'] | Slots[ID2]['usedBy'];\nexport function HasSlot<ID1 extends SlotKey, ID2 extends SlotKey, ID3 extends SlotKey>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3\n): container is Slots[ID1]['usedBy'] | Slots[ID2]['usedBy'] | Slots[ID3]['usedBy'];\nexport function HasSlot<ID1 extends SlotKey, ID2 extends SlotKey, ID3 extends SlotKey, ID4 extends SlotKey>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3,\n id4: ID4\n): container is Slots[ID1 | ID2 | ID3 | ID4]['usedBy'];\nexport function HasSlot<\n ID1 extends SlotKey,\n ID2 extends SlotKey,\n ID3 extends SlotKey,\n ID4 extends SlotKey,\n ID5 extends SlotKey\n>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3,\n id4: ID4,\n id5: ID5\n): container is Slots[ID1 | ID2 | ID3 | ID4 | ID5]['usedBy'];\nexport function HasSlot<\n ID1 extends SlotKey,\n ID2 extends SlotKey,\n ID3 extends SlotKey,\n ID4 extends SlotKey,\n ID5 extends SlotKey,\n ID6 extends SlotKey\n>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3,\n id4: ID4,\n id5: ID5,\n id6: ID6\n): container is Slots[ID1 | ID2 | ID3 | ID4 | ID5 | ID6]['usedBy'];\nexport function HasSlot<\n ID1 extends SlotKey,\n ID2 extends SlotKey,\n ID3 extends SlotKey,\n ID4 extends SlotKey,\n ID5 extends SlotKey,\n ID6 extends SlotKey,\n ID7 extends SlotKey\n>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3,\n id4: ID4,\n id5: ID5,\n id6: ID6,\n id7: ID7\n): container is Slots[ID1 | ID2 | ID3 | ID4 | ID5 | ID6 | ID7]['usedBy'];\nexport function HasSlot<\n ID1 extends SlotKey,\n ID2 extends SlotKey,\n ID3 extends SlotKey,\n ID4 extends SlotKey,\n ID5 extends SlotKey,\n ID6 extends SlotKey,\n ID7 extends SlotKey,\n ID8 extends SlotKey\n>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3,\n id4: ID4,\n id5: ID5,\n id6: ID6,\n id7: ID7,\n id8: ID8\n): container is Slots[ID1 | ID2 | ID3 | ID4 | ID5 | ID6 | ID7 | ID8]['usedBy'];\nexport function HasSlot<\n ID1 extends SlotKey,\n ID2 extends SlotKey,\n ID3 extends SlotKey,\n ID4 extends SlotKey,\n ID5 extends SlotKey,\n ID6 extends SlotKey,\n ID7 extends SlotKey,\n ID8 extends SlotKey,\n ID9 extends SlotKey\n>(\n container: unknown,\n id1: ID1,\n id2: ID2,\n id3: ID3,\n id4: ID4,\n id5: ID5,\n id6: ID6,\n id7: ID7,\n id8: ID8,\n id9: ID9\n): container is Slots[ID1 | ID2 | ID3 | ID4 | ID5 | ID6 | ID7 | ID8 | ID9]['usedBy'];\nexport function HasSlot(container: unknown, ...ids: (keyof Slots)[]): boolean {\n if (!container || 'object' !== typeof container) return false;\n const myslots = GetSlots(container as AnyTemporalType);\n return !!myslots && ids.every((id) => id in myslots);\n}\nexport function GetSlot<KeyT extends keyof Slots>(\n container: Slots[typeof id]['usedBy'],\n id: KeyT\n): Slots[KeyT]['value'] {\n const value = GetSlots(container)?.[id];\n if (value === undefined) throw new TypeError(`Missing internal slot ${id}`);\n return value;\n}\nexport function SetSlot<KeyT extends SlotKey>(\n container: Slots[KeyT]['usedBy'],\n id: KeyT,\n value: Slots[KeyT]['value']\n): void {\n const slots = GetSlots(container);\n\n if (slots === undefined) throw new TypeError('Missing slots for the given container');\n\n const existingSlot = slots[id];\n\n if (existingSlot) throw new TypeError(`${id} already has set`);\n\n slots[id] = value;\n}\n","const tzComponent = /\\.[-A-Za-z_]|\\.\\.[-A-Za-z._]{1,12}|\\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/;\nconst offsetNoCapture = /(?:[+\\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\\d{1,9})?)?)?)/;\nexport const timeZoneID = new RegExp(\n '(?:' +\n [\n `(?:${tzComponent.source})(?:\\\\/(?:${tzComponent.source}))*`,\n 'Etc/GMT(?:0|[-+]\\\\d{1,2})',\n 'GMT[-+]?0',\n 'EST5EDT',\n 'CST6CDT',\n 'MST7MDT',\n 'PST8PDT',\n offsetNoCapture.source\n ].join('|') +\n ')'\n);\n\nconst yearpart = /(?:[+\\u2212-]\\d{6}|\\d{4})/;\nconst monthpart = /(?:0[1-9]|1[0-2])/;\nconst daypart = /(?:0[1-9]|[12]\\d|3[01])/;\nconst datesplit = new RegExp(\n `(${yearpart.source})(?:-(${monthpart.source})-(${daypart.source})|(${monthpart.source})(${daypart.source}))`\n);\nconst timesplit = /(\\d{2})(?::(\\d{2})(?::(\\d{2})(?:[.,](\\d{1,9}))?)?|(\\d{2})(?:(\\d{2})(?:[.,](\\d{1,9}))?)?)?/;\nexport const offset = /([+\\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?/;\nconst offsetpart = new RegExp(`([zZ])|${offset.source}?`);\nexport const annotation = /\\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\\]/g;\n\nexport const zoneddatetime = new RegExp(\n [\n `^${datesplit.source}`,\n `(?:(?:T|\\\\s+)${timesplit.source}(?:${offsetpart.source})?)?`,\n `(?:\\\\[!?(${timeZoneID.source})\\\\])?`,\n `((?:${annotation.source})*)$`\n ].join(''),\n 'i'\n);\n\nexport const time = new RegExp(\n [\n `^T?${timesplit.source}`,\n `(?:${offsetpart.source})?`,\n `(?:\\\\[!?${timeZoneID.source}\\\\])?`,\n `((?:${annotation.source})*)$`\n ].join(''),\n 'i'\n);\n\n// The short forms of YearMonth and MonthDay are only for the ISO calendar, but\n// annotations are still allowed, and will throw if the calendar annotation is\n// not ISO.\n// Non-ISO calendar YearMonth and MonthDay have to parse as a Temporal.PlainDate,\n// with the reference fields.\n// YYYYMM forbidden by ISO 8601 because ambiguous with YYMMDD, but allowed by\n// RFC 3339 and we don't allow 2-digit years, so we allow it.\n// Not ambiguous with HHMMSS because that requires a 'T' prefix\n// UTC offsets are not allowed, because they are not allowed with any date-only\n// format; also, YYYY-MM-UU is ambiguous with YYYY-MM-DD\nexport const yearmonth = new RegExp(\n `^(${yearpart.source})-?(${monthpart.source})(?:\\\\[!?${timeZoneID.source}\\\\])?((?:${annotation.source})*)$`\n);\nexport const monthday = new RegExp(\n `^(?:--)?(${monthpart.source})-?(${daypart.source})(?:\\\\[!?${timeZoneID.source}\\\\])?((?:${annotation.source})*)$`\n);\n\nconst fraction = /(\\d+)(?:[.,](\\d{1,9}))?/;\n\nconst durationDate = /(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?/;\nconst durationTime = new RegExp(`(?:${fraction.source}H)?(?:${fraction.source}M)?(?:${fraction.source}S)?`);\nexport const duration = new RegExp(`^([+\\u2212-])?P${durationDate.source}(?:T(?!$)${durationTime.source})?$`, 'i');\n","const ArrayIncludes = Array.prototype.includes;\nconst ArrayPrototypePush = Array.prototype.push;\nconst IntlDateTimeFormat = globalThis.Intl.DateTimeFormat;\nconst MathMin = Math.min;\nconst MathMax = Math.max;\nconst MathAbs = Math.abs;\nconst MathFloor = Math.floor;\nconst MathSign = Math.sign;\nconst MathTrunc = Math.trunc;\nconst NumberIsNaN = Number.isNaN;\nconst NumberIsFinite = Number.isFinite;\nconst NumberCtor = Number;\nconst StringCtor = String;\nconst NumberMaxSafeInteger = Number.MAX_SAFE_INTEGER;\nconst ObjectCreate = Object.create;\nconst ObjectDefineProperty = Object.defineProperty;\nconst ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nconst ReflectApply = Reflect.apply;\nconst ReflectOwnKeys = Reflect.ownKeys;\n\nimport { DEBUG } from './debug';\nimport JSBI from 'jsbi';\n\nimport type { Temporal } from '..';\nimport type {\n AnyTemporalLikeType,\n UnitSmallerThanOrEqualTo,\n CalendarProtocolParams,\n TimeZoneProtocolParams,\n InstantParams,\n PlainMonthDayParams,\n ZonedDateTimeParams,\n CalendarParams,\n TimeZoneParams,\n PlainDateParams,\n PlainTimeParams,\n DurationParams,\n PlainDateTimeParams,\n PlainYearMonthParams,\n PrimitiveFieldsOf,\n BuiltinCalendarId,\n Keys,\n AnyTemporalKey,\n CalendarSlot,\n TimeZoneSlot\n} from './internaltypes';\nimport { GetIntrinsic } from './intrinsicclass';\nimport {\n CreateSlots,\n GetSlot,\n HasSlot,\n SetSlot,\n EPOCHNANOSECONDS,\n TIMEZONE_ID,\n CALENDAR_ID,\n INSTANT,\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND,\n DATE_BRAND,\n YEAR_MONTH_BRAND,\n MONTH_DAY_BRAND,\n TIME_ZONE,\n CALENDAR,\n YEARS,\n MONTHS,\n WEEKS,\n DAYS,\n HOURS,\n MINUTES,\n SECONDS,\n MILLISECONDS,\n MICROSECONDS,\n NANOSECONDS\n} from './slots';\n\nexport const ZERO = JSBI.BigInt(0);\nconst ONE = JSBI.BigInt(1);\nconst SIXTY = JSBI.BigInt(60);\nconst TWENTY_FOUR = JSBI.BigInt(24);\nexport const THOUSAND = JSBI.BigInt(1e3);\nexport const MILLION = JSBI.BigInt(1e6);\nexport const BILLION = JSBI.BigInt(1e9);\nconst NEGATIVE_ONE = JSBI.BigInt(-1);\nconst HOUR_SECONDS = 3600;\nexport const HOUR_NANOS = JSBI.multiply(JSBI.BigInt(HOUR_SECONDS), BILLION);\nconst MINUTE_NANOS = JSBI.multiply(SIXTY, BILLION);\nconst DAY_NANOS = JSBI.multiply(HOUR_NANOS, TWENTY_FOUR);\nconst NS_MIN = JSBI.multiply(JSBI.BigInt(-86400), JSBI.BigInt(1e17));\nconst NS_MAX = JSBI.multiply(JSBI.BigInt(86400), JSBI.BigInt(1e17));\nconst YEAR_MIN = -271821;\nconst YEAR_MAX = 275760;\nconst BEFORE_FIRST_OFFSET_TRANSITION = JSBI.multiply(JSBI.BigInt(-388152), JSBI.BigInt(1e13)); // 1847-01-01T00:00:00Z\nconst ABOUT_TEN_YEARS_NANOS = JSBI.multiply(DAY_NANOS, JSBI.BigInt(366 * 10));\nconst ABOUT_ONE_YEAR_NANOS = JSBI.multiply(DAY_NANOS, JSBI.BigInt(366 * 1));\nconst TWO_WEEKS_NANOS = JSBI.multiply(DAY_NANOS, JSBI.BigInt(2 * 7));\n\nconst BUILTIN_CALENDAR_IDS = [\n 'iso8601',\n 'hebrew',\n 'islamic',\n 'islamic-umalqura',\n 'islamic-tbla',\n 'islamic-civil',\n 'islamic-rgsa',\n 'islamicc',\n 'persian',\n 'ethiopic',\n 'ethioaa',\n 'coptic',\n 'chinese',\n 'dangi',\n 'roc',\n 'indian',\n 'buddhist',\n 'japanese',\n 'gregory'\n];\n\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function */\n/**\n * uncheckedAssertNarrowedType forces TypeScript to change the type of the argument to the one given in\n * the type parameter. This should only be used to help TS understand when variables change types,\n * but TS can't or won't infer this automatically. They should be used sparingly, because\n * if used incorrectly can lead to difficult-to-diagnose problems.\n * */\nexport function uncheckedAssertNarrowedType<T = unknown>(\n arg: unknown,\n justification: string\n): asserts arg is T extends typeof arg ? T : never {}\n/* eslint-enable */\n\ntype ArrayElement<ArrayType> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;\ntype ArrayWithNewKeys<T, Keys> = Array<ArrayElement<T> | Keys>;\n\n/**\n * In debug builds, this function verifies that the given argument \"exists\" (is not\n * null or undefined). This function becomes a no-op in the final bundles distributed via NPM.\n * @param arg\n */\nexport function assertExists<A>(arg: A): asserts arg is NonNullable<A> {\n if (DEBUG) {\n if (arg != null) {\n throw new Error('Expected arg to be set.');\n }\n }\n}\n\nfunction isZero(value: JSBI): boolean {\n return JSBI.equal(value, ZERO);\n}\n\ntype Stringless<T> = Exclude<T, string>;\n\nfunction GetMethod<T extends { [s in M]?: (...args: any[]) => unknown }, M extends string & keyof T>(\n obj: T,\n methodName: M\n): T[M];\nfunction GetMethod<\n T extends string | { [s in M]?: (...args: any[]) => unknown },\n M extends string & keyof Stringless<T>\n>(obj: T, methodName: M): Stringless<T>[M] | undefined;\nfunction GetMethod<\n T extends string | { [s in M]?: undefined | ((...args: any[]) => unknown) },\n M extends string & keyof T\n>(obj: T, methodName: M): T[M] | undefined {\n const result = obj[methodName];\n if (result === undefined) return undefined;\n if (DEBUG) {\n if (typeof result !== 'function') throw new TypeError(`'${methodName}' must be a function`);\n }\n return result;\n}\n\nexport function Call<T, A extends readonly any[], R>(\n target: (this: T, ...args: A) => R,\n thisArgument: T,\n argumentsList: Readonly<A>\n): R {\n const args = arguments.length > 2 ? argumentsList : [];\n if (DEBUG) {\n if (!Array.isArray(argumentsList)) {\n throw new TypeError('Assertion failed: optional `argumentsList`, if provided, must be an array');\n }\n }\n return ReflectApply(target, thisArgument, args);\n}\n\n// For unknown values, this narrows the result to a Record. But for union types\n// like `Temporal.DurationLike | string`, it'll strip the primitive types while\n// leaving the object type(s) unchanged.\nexport function IsObject<T>(\n value: T\n): value is Exclude<T, string | null | undefined | number | bigint | symbol | boolean>;\nexport function IsObject(value: unknown): value is Record<string | number | symbol, unknown> {\n return (typeof value === 'object' && value !== null) || typeof value === 'function';\n}\n\nexport function ToNumber(value: unknown): number {\n // ES 2022's es-abstract made minor changes to ToNumber, but polyfilling these\n // changes adds zero benefit to Temporal and brings in a lot of extra code. So\n // we'll leave ToNumber as-is.\n // See https://github.com/ljharb/es-abstract/blob/main/2022/ToNumber.js\n if (typeof value === 'bigint') throw new TypeError('Cannot convert BigInt to number');\n return NumberCtor(value);\n}\n\nfunction ToIntegerOrInfinity(value: unknown) {\n const number = ToNumber(value);\n if (NumberIsNaN(number) || number === 0) {\n return 0;\n }\n if (!NumberIsFinite(number)) {\n return number;\n }\n const integer = MathFloor(MathAbs(number));\n if (integer === 0) {\n return 0;\n }\n return MathSign(number) * integer;\n}\n\nfunction IsIntegralNumber(argument: unknown) {\n if (typeof argument !== 'number' || NumberIsNaN(argument) || !NumberIsFinite(argument)) {\n return false;\n }\n const absValue = MathAbs(argument);\n return MathFloor(absValue) === absValue;\n}\n\nexport function ToString(value: unknown): string {\n if (typeof value === 'symbol') {\n throw new TypeError('Cannot convert a Symbol value to a String');\n }\n return StringCtor(value);\n}\n\nexport function ToIntegerWithTruncation(value: unknown): number {\n const number = ToNumber(value);\n if (number === 0) return 0;\n if (NumberIsNaN(number) || !NumberIsFinite(number)) {\n throw new RangeError('invalid number value');\n }\n const integer = MathTrunc(number);\n if (integer === 0) return 0; // ℝ(value) in spec text; converts -0 to 0\n return integer;\n}\n\nfunction ToPositiveIntegerWithTruncation(valueParam: unknown, property?: string): number {\n const integer = ToIntegerWithTruncation(valueParam);\n if (integer <= 0) {\n if (property !== undefined) {\n throw new RangeError(`property '${property}' cannot be a a number less than one`);\n }\n throw new RangeError('Cannot convert a number less than one to a positive integer');\n }\n return integer;\n}\n\nexport function ToIntegerIfIntegral(valueParam: unknown): number {\n const number = ToNumber(valueParam);\n if (!NumberIsFinite(number)) throw new RangeError('infinity is out of range');\n if (!IsIntegralNumber(number)) throw new RangeError(`unsupported fractional value ${valueParam}`);\n if (number === 0) return 0; // ℝ(value) in spec text; converts -0 to 0\n return number;\n}\n\nfunction divmod(x: JSBI, y: JSBI): { quotient: JSBI; remainder: JSBI } {\n const quotient = JSBI.divide(x, y);\n const remainder = JSBI.remainder(x, y);\n return { quotient, remainder };\n}\n\nfunction isNegativeJSBI(value: JSBI): boolean {\n return JSBI.lessThan(value, ZERO);\n}\n\nfunction signJSBI(value: JSBI): 1 | 0 | -1 {\n if (isZero(value)) return 0;\n if (isNegativeJSBI(value)) return -1;\n return 1;\n}\nfunction abs(x: JSBI): JSBI {\n if (JSBI.lessThan(x, ZERO)) return JSBI.multiply(x, NEGATIVE_ONE);\n return x;\n}\n\ntype BuiltinCastFunction = (v: unknown) => string | number;\nconst BUILTIN_CASTS = new Map<AnyTemporalKey, BuiltinCastFunction>([\n ['year', ToIntegerWithTruncation],\n ['month', ToPositiveIntegerWithTruncation],\n ['monthCode', ToString],\n ['day', ToPositiveIntegerWithTruncation],\n ['hour', ToIntegerWithTruncation],\n ['minute', ToIntegerWithTruncation],\n ['second', ToIntegerWithTruncation],\n ['millisecond', ToIntegerWithTruncation],\n ['microsecond', ToIntegerWithTruncation],\n ['nanosecond', ToIntegerWithTruncation],\n ['years', ToIntegerIfIntegral],\n ['months', ToIntegerIfIntegral],\n ['weeks', ToIntegerIfIntegral],\n ['days', ToIntegerIfIntegral],\n ['hours', ToIntegerIfIntegral],\n ['minutes', ToIntegerIfIntegral],\n ['seconds', ToIntegerIfIntegral],\n ['milliseconds', ToIntegerIfIntegral],\n ['microseconds', ToIntegerIfIntegral],\n ['nanoseconds', ToIntegerIfIntegral],\n ['era', ToString],\n ['eraYear', ToIntegerOrInfinity],\n ['offset', ToString]\n]);\n\nconst BUILTIN_DEFAULTS = new Map([\n ['hour', 0],\n ['minute', 0],\n ['second', 0],\n ['millisecond', 0],\n ['microsecond', 0],\n ['nanosecond', 0]\n]);\n\n// each item is [plural, singular, category]\nconst SINGULAR_PLURAL_UNITS = [\n ['years', 'year', 'date'],\n ['months', 'month', 'date'],\n ['weeks', 'week', 'date'],\n ['days', 'day', 'date'],\n ['hours', 'hour', 'time'],\n ['minutes', 'minute', 'time'],\n ['seconds', 'second', 'time'],\n ['milliseconds', 'millisecond', 'time'],\n ['microseconds', 'microsecond', 'time'],\n ['nanoseconds', 'nanosecond', 'time']\n] as const;\nconst SINGULAR_FOR = new Map(SINGULAR_PLURAL_UNITS.map((e) => [e[0], e[1]] as const));\nconst PLURAL_FOR = new Map(SINGULAR_PLURAL_UNITS.map(([p, s]) => [s, p]));\nconst UNITS_DESCENDING = SINGULAR_PLURAL_UNITS.map(([, s]) => s);\n\nconst DURATION_FIELDS = Array.from(SINGULAR_FOR.keys()).sort();\n\nimport * as PARSE from './regex';\n\nconst IntlDateTimeFormatEnUsCache = new Map<string, Intl.DateTimeFormat>();\n\nfunction getIntlDateTimeFormatEnUsForTimeZone(timeZoneIdentifier: string) {\n let instance = IntlDateTimeFormatEnUsCache.get(timeZoneIdentifier);\n if (instance === undefined) {\n instance = new IntlDateTimeFormat('en-us', {\n timeZone: StringCtor(timeZoneIdentifier),\n hour12: false,\n era: 'short',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n IntlDateTimeFormatEnUsCache.set(timeZoneIdentifier, instance);\n }\n return instance;\n}\n\nexport function ToObject<T>(value: T): T extends Record<string, unknown> ? T : object {\n if (typeof value === 'undefined' || value === null) {\n throw new TypeError(`Expected object not ${value}`);\n }\n return Object(value);\n}\n\n// Adapted from https://github.com/ljharb/es-abstract/blob/main/2022/CopyDataProperties.js\n// but simplified (e.g. removed assertions) for this polyfill to reduce bundle size.\nexport function CopyDataProperties<K extends string | symbol, T extends Record<K, unknown>>(\n target: T,\n source: T | undefined,\n excludedKeys: K[],\n excludedValues?: unknown[]\n) {\n if (typeof source === 'undefined' || source === null) return;\n\n const keys = ReflectOwnKeys(source) as (keyof T)[];\n for (const nextKey of keys) {\n if (excludedKeys.some((e) => Object.is(e, nextKey))) continue;\n if (Object.prototype.propertyIsEnumerable.call(source, nextKey)) {\n const propValue = source[nextKey];\n if (excludedValues && excludedValues.some((e) => Object.is(e, propValue))) continue;\n\n target[nextKey] = propValue;\n }\n }\n}\n\nexport function IsTemporalInstant(item: unknown): item is Temporal.Instant {\n return HasSlot(item, EPOCHNANOSECONDS) && !HasSlot(item, TIME_ZONE, CALENDAR);\n}\n\nexport function IsTemporalTimeZone(item: unknown): item is Temporal.TimeZone {\n return HasSlot(item, TIMEZONE_ID);\n}\nexport function IsTemporalCalendar(item: unknown): item is Temporal.Calendar {\n return HasSlot(item, CALENDAR_ID);\n}\nexport function IsTemporalDuration(item: unknown): item is Temporal.Duration {\n return HasSlot(item, YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS, MICROSECONDS, NANOSECONDS);\n}\nexport function IsTemporalDate(item: unknown): item is Temporal.PlainDate {\n return HasSlot(item, DATE_BRAND);\n}\nexport function IsTemporalTime(item: unknown): item is Temporal.PlainTime {\n return (\n HasSlot(item, ISO_HOUR, ISO_MINUTE, ISO_SECOND, ISO_MILLISECOND, ISO_MICROSECOND, ISO_NANOSECOND) &&\n !HasSlot(item, ISO_YEAR, ISO_MONTH, ISO_DAY)\n );\n}\nexport function IsTemporalDateTime(item: unknown): item is Temporal.PlainDateTime {\n return HasSlot(\n item,\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND\n );\n}\nexport function IsTemporalYearMonth(item: unknown): item is Temporal.PlainYearMonth {\n return HasSlot(item, YEAR_MONTH_BRAND);\n}\nexport function IsTemporalMonthDay(item: unknown): item is Temporal.PlainMonthDay {\n return HasSlot(item, MONTH_DAY_BRAND);\n}\nexport function IsTemporalZonedDateTime(item: unknown): item is Temporal.ZonedDateTime {\n return HasSlot(item, EPOCHNANOSECONDS, TIME_ZONE, CALENDAR);\n}\nexport function RejectTemporalLikeObject(item: AnyTemporalLikeType) {\n if (HasSlot(item, CALENDAR) || HasSlot(item, TIME_ZONE)) {\n throw new TypeError('with() does not support a calendar or timeZone property');\n }\n if (IsTemporalTime(item)) {\n throw new TypeError('with() does not accept Temporal.PlainTime, use withPlainTime() instead');\n }\n if ((item as { calendar: unknown }).calendar !== undefined) {\n throw new TypeError('with() does not support a calendar property');\n }\n if ((item as { timeZone: unknown }).timeZone !== undefined) {\n throw new TypeError('with() does not support a timeZone property');\n }\n}\nfunction ParseTemporalTimeZone(stringIdent: string) {\n const { ianaName, offset, z } = ParseTemporalTimeZoneString(stringIdent);\n if (ianaName) return GetCanonicalTimeZoneIdentifier(ianaName);\n if (z) return 'UTC';\n // if !ianaName && !z then offset must be present\n assertExists(offset);\n const offsetNs = ParseTimeZoneOffsetString(offset);\n return FormatTimeZoneOffsetString(offsetNs);\n}\n\nfunction MaybeFormatCalendarAnnotation(\n calendar: CalendarSlot,\n showCalendar: Temporal.ShowCalendarOption['calendarName']\n): string {\n if (showCalendar === 'never') return '';\n return FormatCalendarAnnotation(ToTemporalCalendarIdentifier(calendar), showCalendar);\n}\n\nfunction FormatCalendarAnnotation(id: string, showCalendar: Temporal.ShowCalendarOption['calendarName']) {\n if (showCalendar === 'never') return '';\n if (showCalendar === 'auto' && id === 'iso8601') return '';\n const flag = showCalendar === 'critical' ? '!' : '';\n return `[${flag}u-ca=${id}]`;\n}\n\nfunction ParseISODateTime(isoString: string) {\n // ZDT is the superset of fields for every other Temporal type\n const match = PARSE.zoneddatetime.exec(isoString);\n if (!match) throw new RangeError(`invalid ISO 8601 string: ${isoString}`);\n let yearString = match[1];\n if (yearString[0] === '\\u2212') yearString = `-${yearString.slice(1)}`;\n if (yearString === '-000000') throw new RangeError(`invalid ISO 8601 string: ${isoString}`);\n const year = ToIntegerOrInfinity(yearString);\n const month = ToIntegerOrInfinity(match[2] || match[4]);\n const day = ToIntegerOrInfinity(match[3] || match[5]);\n const hour = ToIntegerOrInfinity(match[6]);\n const hasTime = match[6] !== undefined;\n const minute = ToIntegerOrInfinity(match[7] || match[10]);\n let second = ToIntegerOrInfinity(match[8] || match[11]);\n if (second === 60) second = 59;\n const fraction = (match[9] || match[12]) + '000000000';\n const millisecond = ToIntegerOrInfinity(fraction.slice(0, 3));\n const microsecond = ToIntegerOrInfinity(fraction.slice(3, 6));\n const nanosecond = ToIntegerOrInfinity(fraction.slice(6, 9));\n let offset;\n let z = false;\n if (match[13]) {\n offset = undefined;\n z = true;\n } else if (match[14] && match[15]) {\n const offsetSign = match[14] === '-' || match[14] === '\\u2212' ? '-' : '+';\n const offsetHours = match[15] || '00';\n const offsetMinutes = match[16] || '00';\n const offsetSeconds = match[17] || '00';\n let offsetFraction = match[18] || '0';\n offset = `${offsetSign}${offsetHours}:${offsetMinutes}`;\n if (+offsetFraction) {\n while (offsetFraction.endsWith('0')) offsetFraction = offsetFraction.slice(0, -1);\n offset += `:${offsetSeconds}.${offsetFraction}`;\n } else if (+offsetSeconds) {\n offset += `:${offsetSeconds}`;\n }\n if (offset === '-00:00') offset = '+00:00';\n }\n const ianaName = match[19];\n const annotations = match[20];\n let calendar;\n for (const [, critical, key, value] of annotations.matchAll(PARSE.annotation)) {\n if (key === 'u-ca') {\n if (calendar === undefined) calendar = value;\n } else if (critical === '!') {\n throw new RangeError(`Unrecognized annotation: !${key}=${value}`);\n }\n }\n RejectDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n return {\n year,\n month,\n day,\n hasTime,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n ianaName,\n offset,\n z,\n calendar\n };\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalInstantString(isoString: string) {\n const result = ParseISODateTime(isoString);\n if (!result.z && !result.offset) throw new RangeError('Temporal.Instant requires a time zone offset');\n return result;\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalZonedDateTimeString(isoString: string) {\n const result = ParseISODateTime(isoString);\n if (!result.ianaName) throw new RangeError('Temporal.ZonedDateTime requires a time zone ID in brackets');\n return result;\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalDateTimeString(isoString: string) {\n return ParseISODateTime(isoString);\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalDateString(isoString: string) {\n return ParseISODateTime(isoString);\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalTimeString(isoString: string) {\n const match = PARSE.time.exec(isoString);\n let hour, minute, second, millisecond, microsecond, nanosecond, annotations;\n if (match) {\n hour = ToIntegerOrInfinity(match[1]);\n minute = ToIntegerOrInfinity(match[2] || match[5]);\n second = ToIntegerOrInfinity(match[3] || match[6]);\n if (second === 60) second = 59;\n const fraction = (match[4] || match[7]) + '000000000';\n millisecond = ToIntegerOrInfinity(fraction.slice(0, 3));\n microsecond = ToIntegerOrInfinity(fraction.slice(3, 6));\n nanosecond = ToIntegerOrInfinity(fraction.slice(6, 9));\n annotations = match[14];\n for (const [, critical, key, value] of annotations.matchAll(PARSE.annotation)) {\n if (key !== 'u-ca' && critical === '!') {\n throw new RangeError(`Unrecognized annotation: !${key}=${value}`);\n }\n }\n if (match[8]) throw new RangeError('Z designator not supported for PlainTime');\n } else {\n let z, hasTime;\n ({ hasTime, hour, minute, second, millisecond, microsecond, nanosecond, z } = ParseISODateTime(isoString));\n if (!hasTime) throw new RangeError(`time is missing in string: ${isoString}`);\n if (z) throw new RangeError('Z designator not supported for PlainTime');\n }\n // if it's a date-time string, OK\n if (/[tT ][0-9][0-9]/.test(isoString)) {\n return { hour, minute, second, millisecond, microsecond, nanosecond };\n }\n try {\n const { month, day } = ParseTemporalMonthDayString(isoString);\n RejectISODate(1972, month, day);\n } catch {\n try {\n const { year, month } = ParseTemporalYearMonthString(isoString);\n RejectISODate(year, month, 1);\n } catch {\n return { hour, minute, second, millisecond, microsecond, nanosecond };\n }\n }\n throw new RangeError(`invalid ISO 8601 time-only string ${isoString}; may need a T prefix`);\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalYearMonthString(isoString: string) {\n const match = PARSE.yearmonth.exec(isoString);\n let year, month, calendar, referenceISODay;\n if (match) {\n let yearString = match[1];\n if (yearString[0] === '\\u2212') yearString = `-${yearString.slice(1)}`;\n if (yearString === '-000000') throw new RangeError(`invalid ISO 8601 string: ${isoString}`);\n year = ToIntegerOrInfinity(yearString);\n month = ToIntegerOrInfinity(match[2]);\n const annotations = match[3];\n for (const [, critical, key, value] of annotations.matchAll(PARSE.annotation)) {\n if (key === 'u-ca') {\n if (calendar === undefined) calendar = value;\n } else if (critical === '!') {\n throw new RangeError(`Unrecognized annotation: !${key}=${value}`);\n }\n }\n if (calendar !== undefined && calendar !== 'iso8601') {\n throw new RangeError('YYYY-MM format is only valid with iso8601 calendar');\n }\n } else {\n let z;\n ({ year, month, calendar, day: referenceISODay, z } = ParseISODateTime(isoString));\n if (z) throw new RangeError('Z designator not supported for PlainYearMonth');\n }\n return { year, month, calendar, referenceISODay };\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalMonthDayString(isoString: string) {\n const match = PARSE.monthday.exec(isoString);\n let month, day, calendar, referenceISOYear;\n if (match) {\n month = ToIntegerOrInfinity(match[1]);\n day = ToIntegerOrInfinity(match[2]);\n const annotations = match[3];\n for (const [, critical, key, value] of annotations.matchAll(PARSE.annotation)) {\n if (key === 'u-ca') {\n if (calendar === undefined) calendar = value;\n } else if (critical === '!') {\n throw new RangeError(`Unrecognized annotation: !${key}=${value}`);\n }\n }\n if (calendar !== undefined && calendar !== 'iso8601') {\n throw new RangeError('MM-DD format is only valid with iso8601 calendar');\n }\n } else {\n let z;\n ({ month, day, calendar, year: referenceISOYear, z } = ParseISODateTime(isoString));\n if (z) throw new RangeError('Z designator not supported for PlainMonthDay');\n }\n return { month, day, calendar, referenceISOYear };\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalTimeZoneString(stringIdent: string): Partial<{\n ianaName: string | undefined;\n offset: string | undefined;\n z: boolean | undefined;\n}> {\n const bareID = new RegExp(`^${PARSE.timeZoneID.source}$`, 'i');\n if (bareID.test(stringIdent)) return { ianaName: stringIdent };\n try {\n // Try parsing ISO string instead\n const result = ParseISODateTime(stringIdent);\n if (result.z || result.offset || result.ianaName) {\n return result;\n }\n } catch {\n // fall through\n }\n throw new RangeError(`Invalid time zone: ${stringIdent}`);\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalDurationString(isoString: string) {\n const match = PARSE.duration.exec(isoString);\n if (!match) throw new RangeError(`invalid duration: ${isoString}`);\n if (match.slice(2).every((element) => element === undefined)) {\n throw new RangeError(`invalid duration: ${isoString}`);\n }\n const sign = match[1] === '-' || match[1] === '\\u2212' ? -1 : 1;\n const years = match[2] === undefined ? 0 : ToIntegerWithTruncation(match[2]) * sign;\n const months = match[3] === undefined ? 0 : ToIntegerWithTruncation(match[3]) * sign;\n const weeks = match[4] === undefined ? 0 : ToIntegerWithTruncation(match[4]) * sign;\n const days = match[5] === undefined ? 0 : ToIntegerWithTruncation(match[5]) * sign;\n const hours = match[6] === undefined ? 0 : ToIntegerWithTruncation(match[6]) * sign;\n const fHours = match[7];\n const minutesStr = match[8];\n const fMinutes = match[9];\n const secondsStr = match[10];\n const fSeconds = match[11];\n let minutes = 0;\n let seconds = 0;\n // fractional hours, minutes, or seconds, expressed in whole nanoseconds:\n let excessNanoseconds = 0;\n\n if (fHours !== undefined) {\n if (minutesStr ?? fMinutes ?? secondsStr ?? fSeconds ?? false) {\n throw new RangeError('only the smallest unit can be fractional');\n }\n excessNanoseconds = ToIntegerOrInfinity((fHours + '000000000').slice(0, 9)) * 3600 * sign;\n } else {\n minutes = minutesStr === undefined ? 0 : ToIntegerWithTruncation(minutesStr) * sign;\n if (fMinutes !== undefined) {\n if (secondsStr ?? fSeconds ?? false) {\n throw new RangeError('only the smallest unit can be fractional');\n }\n excessNanoseconds = ToIntegerOrInfinity((fMinutes + '000000000').slice(0, 9)) * 60 * sign;\n } else {\n seconds = secondsStr === undefined ? 0 : ToIntegerWithTruncation(secondsStr) * sign;\n if (fSeconds !== undefined) {\n excessNanoseconds = ToIntegerOrInfinity((fSeconds + '000000000').slice(0, 9)) * sign;\n }\n }\n }\n\n const nanoseconds = excessNanoseconds % 1000;\n const microseconds = MathTrunc(excessNanoseconds / 1000) % 1000;\n const milliseconds = MathTrunc(excessNanoseconds / 1e6) % 1000;\n seconds += MathTrunc(excessNanoseconds / 1e9) % 60;\n minutes += MathTrunc(excessNanoseconds / 6e10);\n\n RejectDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\n// ts-prune-ignore-next TODO: remove if test/validStrings is converted to TS.\nexport function ParseTemporalInstant(isoString: string) {\n let { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, offset, z } =\n ParseTemporalInstantString(isoString);\n\n if (!z && !offset) throw new RangeError('Temporal.Instant requires a time zone offset');\n // At least one of z or offset is defined, but TS doesn't seem to understand\n // that we only use offset if z is not defined (and thus offset must be defined).\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion\n const offsetNs = z ? 0 : ParseTimeZoneOffsetString(offset!);\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = BalanceISODateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond - offsetNs\n ));\n\n const epochNs = GetUTCEpochNanoseconds(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n if (epochNs === null) throw new RangeError('DateTime outside of supported range');\n return epochNs;\n}\n\nexport function RegulateISODate(\n yearParam: number,\n monthParam: number,\n dayParam: number,\n overflow: Temporal.ArithmeticOptions['overflow']\n) {\n let year = yearParam;\n let month = monthParam;\n let day = dayParam;\n switch (overflow) {\n case 'reject':\n RejectISODate(year, month, day);\n break;\n case 'constrain':\n ({ year, month, day } = ConstrainISODate(year, month, day));\n break;\n }\n return { year, month, day };\n}\n\nexport function RegulateTime(\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number,\n overflow: Temporal.ArithmeticOptions['overflow']\n) {\n let hour = hourParam;\n let minute = minuteParam;\n let second = secondParam;\n let millisecond = millisecondParam;\n let microsecond = microsecondParam;\n let nanosecond = nanosecondParam;\n\n switch (overflow) {\n case 'reject':\n RejectTime(hour, minute, second, millisecond, microsecond, nanosecond);\n break;\n case 'constrain':\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = ConstrainTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond\n ));\n break;\n }\n return { hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\nexport function RegulateISOYearMonth(\n yearParam: number,\n monthParam: number,\n overflow: Temporal.ArithmeticOptions['overflow']\n) {\n let year = yearParam;\n let month = monthParam;\n const referenceISODay = 1;\n switch (overflow) {\n case 'reject':\n RejectISODate(year, month, referenceISODay);\n break;\n case 'constrain':\n ({ year, month } = ConstrainISODate(year, month));\n break;\n }\n return { year, month };\n}\n\nfunction ToTemporalDurationRecord(item: Temporal.DurationLike | string) {\n if (!IsObject(item)) {\n return ParseTemporalDurationString(ToString(item));\n }\n if (IsTemporalDuration(item)) {\n return {\n years: GetSlot(item, YEARS),\n months: GetSlot(item, MONTHS),\n weeks: GetSlot(item, WEEKS),\n days: GetSlot(item, DAYS),\n hours: GetSlot(item, HOURS),\n minutes: GetSlot(item, MINUTES),\n seconds: GetSlot(item, SECONDS),\n milliseconds: GetSlot(item, MILLISECONDS),\n microseconds: GetSlot(item, MICROSECONDS),\n nanoseconds: GetSlot(item, NANOSECONDS)\n };\n }\n const result = {\n years: 0,\n months: 0,\n weeks: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0,\n microseconds: 0,\n nanoseconds: 0\n };\n let partial = ToTemporalPartialDurationRecord(item);\n for (const property of DURATION_FIELDS) {\n const value = partial[property];\n if (value !== undefined) {\n result[property] = value;\n }\n }\n let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = result;\n RejectDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\nfunction ToTemporalPartialDurationRecord(temporalDurationLike: Temporal.DurationLike | string) {\n if (!IsObject(temporalDurationLike)) {\n throw new TypeError('invalid duration-like');\n }\n const result: Record<typeof DURATION_FIELDS[number], number | undefined> = {\n years: undefined,\n months: undefined,\n weeks: undefined,\n days: undefined,\n hours: undefined,\n minutes: undefined,\n seconds: undefined,\n milliseconds: undefined,\n microseconds: undefined,\n nanoseconds: undefined\n };\n let any = false;\n for (const property of DURATION_FIELDS) {\n const value = temporalDurationLike[property];\n if (value !== undefined) {\n any = true;\n result[property] = ToIntegerIfIntegral(value);\n }\n }\n if (!any) {\n throw new TypeError('invalid duration-like');\n }\n return result;\n}\n\nfunction ToLimitedTemporalDuration(\n item: Temporal.DurationLike | string,\n disallowedProperties: (keyof Temporal.DurationLike)[]\n) {\n let record = ToTemporalDurationRecord(item);\n for (const property of disallowedProperties) {\n if (record[property] !== 0) {\n throw new RangeError(\n `Duration field ${property} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`\n );\n }\n }\n return record;\n}\n\nexport function ToTemporalOverflow(options: Temporal.AssignmentOptions | undefined) {\n if (options === undefined) return 'constrain';\n return GetOption(options, 'overflow', ['constrain', 'reject'], 'constrain');\n}\n\nexport function ToTemporalDisambiguation(options: Temporal.ToInstantOptions | undefined) {\n if (options === undefined) return 'compatible';\n return GetOption(options, 'disambiguation', ['compatible', 'earlier', 'later', 'reject'], 'compatible');\n}\n\nexport function ToTemporalRoundingMode(\n options: { roundingMode?: Temporal.RoundingMode },\n fallback: Temporal.RoundingMode\n) {\n return GetOption(\n options,\n 'roundingMode',\n ['ceil', 'floor', 'expand', 'trunc', 'halfCeil', 'halfFloor', 'halfExpand', 'halfTrunc', 'halfEven'],\n fallback\n );\n}\n\nfunction NegateTemporalRoundingMode(roundingMode: Temporal.RoundingMode) {\n switch (roundingMode) {\n case 'ceil':\n return 'floor';\n case 'floor':\n return 'ceil';\n case 'halfCeil':\n return 'halfFloor';\n case 'halfFloor':\n return 'halfCeil';\n default:\n return roundingMode;\n }\n}\n\nexport function ToTemporalOffset(\n options: Temporal.OffsetDisambiguationOptions | undefined,\n fallback: Required<Temporal.OffsetDisambiguationOptions>['offset']\n) {\n if (options === undefined) return fallback;\n return GetOption(options, 'offset', ['prefer', 'use', 'ignore', 'reject'], fallback);\n}\n\nexport function ToCalendarNameOption(options: Temporal.ShowCalendarOption) {\n return GetOption(options, 'calendarName', ['auto', 'always', 'never', 'critical'], 'auto');\n}\n\nexport function ToTimeZoneNameOption(options: Temporal.ZonedDateTimeToStringOptions) {\n return GetOption(options, 'timeZoneName', ['auto', 'never', 'critical'], 'auto');\n}\n\nexport function ToShowOffsetOption(options: Temporal.ZonedDateTimeToStringOptions) {\n return GetOption(options, 'offset', ['auto', 'never'], 'auto');\n}\n\nexport function ToTemporalRoundingIncrement(options: { roundingIncrement?: number }) {\n let increment = options.roundingIncrement;\n if (increment === undefined) return 1;\n increment = ToNumber(increment);\n if (!NumberIsFinite(increment)) {\n throw new RangeError('roundingIncrement must be finite');\n }\n const integerIncrement = MathTrunc(increment);\n if (integerIncrement < 1 || integerIncrement > 1e9) {\n throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${increment}`);\n }\n return integerIncrement;\n}\nexport function ValidateTemporalRoundingIncrement(increment: number, dividend: number, inclusive: boolean) {\n const maximum = inclusive ? dividend : dividend - 1;\n if (increment > maximum) {\n throw new RangeError(`roundingIncrement must be at least 1 and less than ${maximum}, not ${increment}`);\n }\n if (dividend % increment !== 0) {\n throw new RangeError(`Rounding increment must divide evenly into ${dividend}`);\n }\n}\n\nexport function ToFractionalSecondDigits(\n normalizedOptions: Temporal.ToStringPrecisionOptions\n): Temporal.ToStringPrecisionOptions['fractionalSecondDigits'] {\n const digitsValue = normalizedOptions.fractionalSecondDigits;\n if (digitsValue === undefined) return 'auto';\n if (typeof digitsValue !== 'number') {\n if (ToString(digitsValue) !== 'auto') {\n throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${digitsValue}`);\n }\n return 'auto';\n }\n const digitCount = MathFloor(digitsValue);\n if (!NumberIsFinite(digitCount) || digitCount < 0 || digitCount > 9) {\n throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${digitsValue}`);\n }\n return digitCount as Exclude<Temporal.ToStringPrecisionOptions['fractionalSecondDigits'], 'auto'>;\n}\n\nexport function ToSecondsStringPrecisionRecord(\n smallestUnit: Temporal.ToStringPrecisionOptions['smallestUnit'],\n precision: Temporal.ToStringPrecisionOptions['fractionalSecondDigits']\n): {\n precision: Temporal.ToStringPrecisionOptions['fractionalSecondDigits'] | 'minute';\n unit: UnitSmallerThanOrEqualTo<'minute'>;\n increment: number;\n} {\n switch (smallestUnit) {\n case 'minute':\n return { precision: 'minute', unit: 'minute', increment: 1 };\n case 'second':\n return { precision: 0, unit: 'second', increment: 1 };\n case 'millisecond':\n return { precision: 3, unit: 'millisecond', increment: 1 };\n case 'microsecond':\n return { precision: 6, unit: 'microsecond', increment: 1 };\n case 'nanosecond':\n return { precision: 9, unit: 'nanosecond', increment: 1 };\n default: // fall through if option not given\n }\n switch (precision) {\n case 'auto':\n return { precision, unit: 'nanosecond', increment: 1 };\n case 0:\n return { precision, unit: 'second', increment: 1 };\n case 1:\n case 2:\n case 3:\n return { precision, unit: 'millisecond', increment: 10 ** (3 - precision) };\n case 4:\n case 5:\n case 6:\n return { precision, unit: 'microsecond', increment: 10 ** (6 - precision) };\n case 7:\n case 8:\n case 9:\n return { precision, unit: 'nanosecond', increment: 10 ** (9 - precision) };\n default:\n throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${precision}`);\n }\n}\n\nexport const REQUIRED = Symbol('~required~');\n\ninterface TemporalUnitOptionsBag {\n smallestUnit?: Temporal.PluralUnit<Temporal.DateTimeUnit> | Temporal.DateTimeUnit;\n largestUnit?: Temporal.PluralUnit<Temporal.DateTimeUnit> | Temporal.DateTimeUnit | 'auto';\n unit?: Temporal.PluralUnit<Temporal.DateTimeUnit> | Temporal.DateTimeUnit;\n}\ntype UnitTypeMapping = {\n date: Temporal.DateUnit;\n time: Temporal.TimeUnit;\n datetime: Temporal.DateTimeUnit;\n};\n// This type specifies the allowed defaults for each unit key type.\ntype AllowedGetTemporalUnitDefaultValues = {\n smallestUnit: undefined;\n largestUnit: 'auto' | undefined;\n unit: undefined;\n};\n\nexport function GetTemporalUnit<\n U extends keyof TemporalUnitOptionsBag,\n T extends keyof UnitTypeMapping,\n D extends typeof REQUIRED | UnitTypeMapping[T] | AllowedGetTemporalUnitDefaultValues[U],\n R extends Exclude<D, typeof REQUIRED> | UnitTypeMapping[T]\n>(options: TemporalUnitOptionsBag, key: U, unitGroup: T, requiredOrDefault: D): R;\nexport function GetTemporalUnit<\n U extends keyof TemporalUnitOptionsBag,\n T extends keyof UnitTypeMapping,\n D extends typeof REQUIRED | UnitTypeMapping[T] | AllowedGetTemporalUnitDefaultValues[U],\n E extends 'auto' | Temporal.DateTimeUnit,\n R extends UnitTypeMapping[T] | Exclude<D, typeof REQUIRED> | E\n>(options: TemporalUnitOptionsBag, key: U, unitGroup: T, requiredOrDefault: D, extraValues: ReadonlyArray<E>): R;\n// This signature of the function is NOT used in type-checking, so restricting\n// the default value via generic binding like the other overloads isn't\n// necessary.\nexport function GetTemporalUnit<\n T extends keyof UnitTypeMapping,\n D extends typeof REQUIRED | UnitTypeMapping[T] | 'auto' | undefined,\n E extends 'auto' | Temporal.DateTimeUnit,\n R extends UnitTypeMapping[T] | Exclude<D, typeof REQUIRED> | E\n>(\n options: TemporalUnitOptionsBag,\n key: keyof typeof options,\n unitGroup: T,\n requiredOrDefault: D,\n extraValues: ReadonlyArray<E> | never[] = []\n): R {\n const allowedSingular: Array<Temporal.DateTimeUnit | 'auto'> = [];\n for (const [, singular, category] of SINGULAR_PLURAL_UNITS) {\n if (unitGroup === 'datetime' || unitGroup === category) {\n allowedSingular.push(singular);\n }\n }\n allowedSingular.push(...extraValues);\n let defaultVal: typeof REQUIRED | Temporal.DateTimeUnit | 'auto' | undefined = requiredOrDefault;\n if (defaultVal === REQUIRED) {\n defaultVal = undefined;\n } else if (defaultVal !== undefined) {\n allowedSingular.push(defaultVal);\n }\n const allowedValues: Array<Temporal.DateTimeUnit | Temporal.PluralUnit<Temporal.DateTimeUnit> | 'auto'> = [\n ...allowedSingular\n ];\n for (const singular of allowedSingular) {\n const plural = PLURAL_FOR.get(singular as Parameters<typeof PLURAL_FOR.get>[0]);\n if (plural !== undefined) allowedValues.push(plural);\n }\n let retval = GetOption(options, key, allowedValues, defaultVal);\n if (retval === undefined && requiredOrDefault === REQUIRED) {\n throw new RangeError(`${key} is required`);\n }\n // Coerce any plural units into their singular form\n if (SINGULAR_FOR.has(retval as Temporal.PluralUnit<Temporal.DateTimeUnit>)) {\n // We just has-checked this, but tsc doesn't understand that.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return SINGULAR_FOR.get(retval as Temporal.PluralUnit<Temporal.DateTimeUnit>)! as R;\n }\n return retval as R;\n}\n\nexport function ToRelativeTemporalObject(options: {\n relativeTo?:\n | Temporal.ZonedDateTime\n | Temporal.PlainDateTime\n | Temporal.ZonedDateTimeLike\n | Temporal.PlainDateTimeLike\n | string\n | undefined;\n}): Temporal.ZonedDateTime | Temporal.PlainDate | undefined {\n const relativeTo = options.relativeTo;\n if (relativeTo === undefined) return relativeTo;\n\n let offsetBehaviour: OffsetBehaviour = 'option';\n let matchMinutes = false;\n let year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar, timeZone, offset;\n if (IsObject(relativeTo)) {\n if (IsTemporalZonedDateTime(relativeTo) || IsTemporalDate(relativeTo)) return relativeTo;\n if (IsTemporalDateTime(relativeTo)) return TemporalDateTimeToDate(relativeTo);\n calendar = GetTemporalCalendarSlotValueWithISODefault(relativeTo);\n const fieldNames = CalendarFields(calendar, [\n 'day',\n 'hour',\n 'microsecond',\n 'millisecond',\n 'minute',\n 'month',\n 'monthCode',\n 'nanosecond',\n 'second',\n 'year'\n ] as const);\n type FieldNamesWithTimeZoneAndOffset = ArrayWithNewKeys<typeof fieldNames, 'timeZone' | 'offset'>;\n (fieldNames as FieldNamesWithTimeZoneAndOffset).push('timeZone', 'offset');\n const fields = PrepareTemporalFields(relativeTo, fieldNames, []);\n const dateOptions = ObjectCreate(null) as Temporal.AssignmentOptions;\n dateOptions.overflow = 'constrain';\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = InterpretTemporalDateTimeFields(\n calendar,\n fields,\n dateOptions\n ));\n offset = fields.offset;\n if (offset === undefined) offsetBehaviour = 'wall';\n timeZone = fields.timeZone;\n if (timeZone !== undefined) timeZone = ToTemporalTimeZoneSlotValue(timeZone);\n } else {\n let ianaName, z;\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar, ianaName, offset, z } =\n ParseISODateTime(ToString(relativeTo)));\n if (ianaName) {\n timeZone = ToTemporalTimeZoneSlotValue(ianaName);\n if (z) {\n offsetBehaviour = 'exact';\n } else if (!offset) {\n offsetBehaviour = 'wall';\n }\n matchMinutes = true;\n } else if (z) {\n throw new RangeError(\n 'Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone'\n );\n }\n if (!calendar) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n calendar = ASCIILowercase(calendar);\n }\n if (timeZone === undefined) return CreateTemporalDate(year, month, day, calendar);\n // If offset is missing here, then offsetBehavior will never be be 'option'.\n assertExists(offset);\n const offsetNs = offsetBehaviour === 'option' ? ParseTimeZoneOffsetString(offset) : 0;\n const epochNanoseconds = InterpretISODateTimeOffset(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n offsetBehaviour,\n offsetNs,\n timeZone,\n 'compatible',\n 'reject',\n matchMinutes\n );\n return CreateTemporalZonedDateTime(epochNanoseconds, timeZone, calendar);\n}\n\nexport function DefaultTemporalLargestUnit(\n years: number,\n months: number,\n weeks: number,\n days: number,\n hours: number,\n minutes: number,\n seconds: number,\n milliseconds: number,\n microseconds: number,\n nanoseconds: number\n): Temporal.DateTimeUnit {\n for (const [prop, v] of [\n ['years', years],\n ['months', months],\n ['weeks', weeks],\n ['days', days],\n ['hours', hours],\n ['minutes', minutes],\n ['seconds', seconds],\n ['milliseconds', milliseconds],\n ['microseconds', microseconds],\n ['nanoseconds', nanoseconds]\n ] as const) {\n if (v !== 0) {\n // All the above keys are definitely in SINGULAR_FOR\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return SINGULAR_FOR.get(prop)!;\n }\n }\n return 'nanosecond';\n}\n\nexport function LargerOfTwoTemporalUnits<T1 extends Temporal.DateTimeUnit, T2 extends Temporal.DateTimeUnit>(\n unit1: T1,\n unit2: T2\n) {\n if (UNITS_DESCENDING.indexOf(unit1) > UNITS_DESCENDING.indexOf(unit2)) return unit2;\n return unit1;\n}\n\ntype FieldCompleteness = 'complete' | 'partial';\ninterface FieldPrepareOptions {\n emptySourceErrorMessage: string;\n}\n\n// Returns all potential owners from all Temporal Like-types for a given union\n// of keys in K.\n// e.g.\n// Owner<'nanosecond'> => PlainDateTimeLike | ZonedDateTimeLike | PlainDateTimeLike | ZonedDateTimeLike\n// Owner<'nanoseconds'> => Duration (the only type with plural keys)\ntype Owner<K extends AnyTemporalKey> =\n // Conditional typing maps over all of the types given in AnyTemporalLikeType\n // union\n K extends unknown ? OwnerOf<K, AnyTemporalLikeType> : 'ThisShouldNeverHappen';\n\n// Returns T iff T has K as all of the key(s) (even if those keys are optional\n// in T), never otherwise. This is a private type for use only in the Owner type\n// above.\ntype OwnerOf<K extends AnyTemporalKey, T> =\n // Distribute the union before passing to Required\n // Without distributing, this is\n // Required<ZonedDateTimeLike | DurationLike> extends Record\n // vs (with distribution)\n // Required<ZonedDateTimeLike> extends Record<....> | Required<DurationLike> extends Record<....>\n T extends unknown\n ? // All the keys in the Like-types are optional, so in order for them to\n // 'extend Record<K,...>', where K indicates the required fields, we pass T\n // through Required to make all the keys non-optional.\n // Note this doesn't work the other way around: using Partial<Record<K, ..>>\n // will always be extended by any object (as all the keys are optional).\n Required<T> extends Record<K, unknown>\n ? T\n : // never is the 'identity' type for unions - nothing will be added or\n // removed from the union.\n never\n : 'ThisShouldNeverHappen';\n\ntype Prop<T, K> = T extends unknown ? (K extends keyof T ? T[K] : undefined) : 'ThisShouldNeverHappen';\n\n// Resolve copies the keys and values of a given object type so that TS will\n// stop using type names in error messages / autocomplete. Generally, those\n// names can be more useful, but sometimes having the primitive object shape is\n// significantly easier to reason about (e.g. deeply-nested types).\n// Resolve is an identity function for function types.\ntype Resolve<T> =\n // Re-mapping doesn't work very well for functions, so exclude them\n T extends (...args: never[]) => unknown\n ? T\n : // Re-map all the keys in T to the same value. This forces TS into no longer\n // using type aliases, etc.\n { [K in keyof T]: T[K] };\n\ntype FieldObjectFromOwners<OwnerT, FieldKeys extends AnyTemporalKey> = Resolve<\n // The resulting object type contains:\n // - All keys in FieldKeys, which are required properties and their values\n // don't include undefined.\n // - All the other keys in OwnerT that aren't in FieldKeys, which are optional\n // properties and their value types explicitly include undefined.\n {\n -readonly [k in FieldKeys]: Exclude<Prop<OwnerT, k>, undefined>;\n } & {\n -readonly [k in Exclude<Keys<OwnerT>, FieldKeys>]?: Prop<OwnerT, k> | undefined;\n }\n>;\n\ntype PrepareTemporalFieldsReturn<\n FieldKeys extends AnyTemporalKey,\n RequiredFieldsOpt extends ReadonlyArray<FieldKeys> | FieldCompleteness,\n OwnerT extends Owner<FieldKeys>\n> = RequiredFieldsOpt extends 'partial' ? Partial<OwnerT> : FieldObjectFromOwners<OwnerT, FieldKeys>;\nexport function PrepareTemporalFields<\n FieldKeys extends AnyTemporalKey,\n // Constrains the Required keys to be a subset of the given field keys\n // This could have been written directly into the parameter type, but that\n // causes an unintended effect where the required fields are added to the list\n // of field keys, even if that key isn't present in 'fields'.\n // RequiredFieldKeys extends FieldKeys,\n RequiredFields extends ReadonlyArray<FieldKeys> | FieldCompleteness\n>(\n bag: Partial<Record<FieldKeys, unknown>>,\n fields: Array<FieldKeys>,\n requiredFields: RequiredFields,\n { emptySourceErrorMessage }: FieldPrepareOptions = { emptySourceErrorMessage: 'no supported properties found' }\n): PrepareTemporalFieldsReturn<FieldKeys, RequiredFields, Owner<FieldKeys>> {\n const result: Partial<Record<AnyTemporalKey, unknown>> = ObjectCreate(null);\n let any = false;\n fields.sort();\n for (const property of fields) {\n let value = bag[property];\n if (value !== undefined) {\n any = true;\n if (BUILTIN_CASTS.has(property)) {\n // We just has-checked this map access, so there will definitely be a\n // value.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n value = BUILTIN_CASTS.get(property)!(value);\n }\n result[property] = value;\n } else if (requiredFields !== 'partial') {\n // TODO: using .call in this way is not correctly type-checked by tsc.\n // We might need a type-safe Call wrapper?\n if (ArrayIncludes.call(requiredFields, property)) {\n throw new TypeError(`required property '${property}' missing or undefined`);\n }\n value = BUILTIN_DEFAULTS.get(property);\n result[property] = value;\n }\n }\n if (requiredFields === 'partial' && !any) {\n throw new TypeError(emptySourceErrorMessage);\n }\n return result as unknown as PrepareTemporalFieldsReturn<FieldKeys, RequiredFields, Owner<FieldKeys>>;\n}\n\ninterface TimeRecord {\n hour?: number;\n minute?: number;\n second?: number;\n microsecond?: number;\n millisecond?: number;\n nanosecond?: number;\n}\nexport function ToTemporalTimeRecord(bag: Partial<Record<keyof TimeRecord, string | number>>): Required<TimeRecord>;\nexport function ToTemporalTimeRecord(\n bag: Partial<Record<keyof TimeRecord, string | number | undefined>>,\n completeness: 'partial'\n): Partial<TimeRecord>;\nexport function ToTemporalTimeRecord(\n bag: Partial<Record<keyof TimeRecord, string | number>>,\n completeness: 'complete'\n): Required<TimeRecord>;\nexport function ToTemporalTimeRecord(\n bag: Partial<Record<keyof TimeRecord, string | number | undefined>>,\n completeness: FieldCompleteness = 'complete'\n): Partial<TimeRecord> {\n // NOTE: Field order is sorted to make the sort in PrepareTemporalFields more efficient.\n const fields: (keyof TimeRecord)[] = ['hour', 'microsecond', 'millisecond', 'minute', 'nanosecond', 'second'];\n const partial = PrepareTemporalFields(bag, fields, 'partial', { emptySourceErrorMessage: 'invalid time-like' });\n const result: Partial<TimeRecord> = {};\n for (const field of fields) {\n const valueDesc = ObjectGetOwnPropertyDescriptor(partial, field);\n if (valueDesc !== undefined) {\n result[field] = valueDesc.value;\n } else if (completeness === 'complete') {\n result[field] = 0;\n }\n }\n return result;\n}\n\nexport function ToTemporalDate(\n itemParam: PlainDateParams['from'][0],\n options?: PlainDateParams['from'][1]\n): Temporal.PlainDate {\n let item = itemParam;\n if (IsObject(item)) {\n if (IsTemporalDate(item)) return item;\n if (IsTemporalZonedDateTime(item)) {\n ToTemporalOverflow(options); // validate and ignore\n item = GetPlainDateTimeFor(GetSlot(item, TIME_ZONE), GetSlot(item, INSTANT), GetSlot(item, CALENDAR));\n }\n if (IsTemporalDateTime(item)) {\n ToTemporalOverflow(options); // validate and ignore\n return CreateTemporalDate(\n GetSlot(item, ISO_YEAR),\n GetSlot(item, ISO_MONTH),\n GetSlot(item, ISO_DAY),\n GetSlot(item, CALENDAR)\n );\n }\n const calendar = GetTemporalCalendarSlotValueWithISODefault(item);\n const fieldNames = CalendarFields(calendar, ['day', 'month', 'monthCode', 'year'] as const);\n const fields = PrepareTemporalFields(item, fieldNames, []);\n return CalendarDateFromFields(calendar, fields, options);\n }\n ToTemporalOverflow(options); // validate and ignore\n let { year, month, day, calendar, z } = ParseTemporalDateString(ToString(item));\n if (z) throw new RangeError('Z designator not supported for PlainDate');\n if (!calendar) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n calendar = ASCIILowercase(calendar);\n return CreateTemporalDate(year, month, day, calendar);\n}\n\nexport function InterpretTemporalDateTimeFields(\n calendar: CalendarSlot,\n fields: PrimitiveFieldsOf<Temporal.PlainDateTimeLike> & Parameters<typeof CalendarDateFromFields>[1],\n options?: Temporal.AssignmentOptions\n) {\n let { hour, minute, second, millisecond, microsecond, nanosecond } = ToTemporalTimeRecord(fields);\n const overflow = ToTemporalOverflow(options);\n const date = CalendarDateFromFields(calendar, fields, options);\n const year = GetSlot(date, ISO_YEAR);\n const month = GetSlot(date, ISO_MONTH);\n const day = GetSlot(date, ISO_DAY);\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = RegulateTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n overflow\n ));\n return { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\nexport function ToTemporalDateTime(item: PlainDateTimeParams['from'][0], options?: PlainDateTimeParams['from'][1]) {\n let year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number,\n calendar;\n if (IsObject(item)) {\n if (IsTemporalDateTime(item)) return item;\n if (IsTemporalZonedDateTime(item)) {\n ToTemporalOverflow(options); // validate and ignore\n return GetPlainDateTimeFor(GetSlot(item, TIME_ZONE), GetSlot(item, INSTANT), GetSlot(item, CALENDAR));\n }\n if (IsTemporalDate(item)) {\n ToTemporalOverflow(options); // validate and ignore\n return CreateTemporalDateTime(\n GetSlot(item, ISO_YEAR),\n GetSlot(item, ISO_MONTH),\n GetSlot(item, ISO_DAY),\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n GetSlot(item, CALENDAR)\n );\n }\n\n calendar = GetTemporalCalendarSlotValueWithISODefault(item);\n const fieldNames = CalendarFields(calendar, [\n 'day',\n 'hour',\n 'microsecond',\n 'millisecond',\n 'minute',\n 'month',\n 'monthCode',\n 'nanosecond',\n 'second',\n 'year'\n ] as const);\n const fields = PrepareTemporalFields(item, fieldNames, []);\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = InterpretTemporalDateTimeFields(\n calendar,\n fields,\n options\n ));\n } else {\n ToTemporalOverflow(options); // validate and ignore\n let z;\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar, z } =\n ParseTemporalDateTimeString(ToString(item)));\n if (z) throw new RangeError('Z designator not supported for PlainDateTime');\n RejectDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n if (!calendar) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n calendar = ASCIILowercase(calendar);\n }\n return CreateTemporalDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar);\n}\n\nexport function ToTemporalDuration(item: DurationParams['from'][0]) {\n if (IsTemporalDuration(item)) return item;\n let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n ToTemporalDurationRecord(item);\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n return new TemporalDuration(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds\n );\n}\n\nexport function ToTemporalInstant(item: InstantParams['from'][0]) {\n if (IsTemporalInstant(item)) return item;\n if (IsTemporalZonedDateTime(item)) {\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n return new TemporalInstant(GetSlot(item, EPOCHNANOSECONDS));\n }\n const ns = ParseTemporalInstant(ToString(item));\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n return new TemporalInstant(ns);\n}\n\nexport function ToTemporalMonthDay(\n itemParam: PlainMonthDayParams['from'][0],\n options?: PlainMonthDayParams['from'][1]\n) {\n let item = itemParam;\n if (IsObject(item)) {\n if (IsTemporalMonthDay(item)) return item;\n let calendar: CalendarSlot, calendarAbsent: boolean;\n if (HasSlot(item, CALENDAR)) {\n calendar = GetSlot(item, CALENDAR);\n calendarAbsent = false;\n } else {\n let calendarFromItem = item.calendar;\n calendarAbsent = calendarFromItem === undefined;\n if (calendarFromItem === undefined) calendarFromItem = 'iso8601';\n calendar = ToTemporalCalendarSlotValue(calendarFromItem);\n }\n // HasSlot above adjusts the type of 'item' to include\n // TypesWithCalendarUnits, which causes type-inference failures below.\n // This is probably indicative of problems with HasSlot's typing.\n const fieldNames = CalendarFields(calendar, ['day', 'month', 'monthCode', 'year'] as const);\n const fields = PrepareTemporalFields(item, fieldNames, []);\n // Callers who omit the calendar are not writing calendar-independent\n // code. In that case, `monthCode`/`year` can be omitted; `month` and\n // `day` are sufficient. Add a `year` to satisfy calendar validation.\n if (calendarAbsent && fields.month !== undefined && fields.monthCode === undefined && fields.year === undefined) {\n fields.year = 1972;\n }\n return CalendarMonthDayFromFields(calendar, fields, options);\n }\n\n ToTemporalOverflow(options); // validate and ignore\n let { month, day, referenceISOYear, calendar } = ParseTemporalMonthDayString(ToString(item));\n if (calendar === undefined) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n calendar = ASCIILowercase(calendar);\n\n if (referenceISOYear === undefined) {\n RejectISODate(1972, month, day);\n return CreateTemporalMonthDay(month, day, calendar);\n }\n const result = CreateTemporalMonthDay(month, day, calendar, referenceISOYear);\n return CalendarMonthDayFromFields(calendar, result);\n}\n\nexport function ToTemporalTime(\n itemParam: PlainTimeParams['from'][0],\n overflow: NonNullable<PlainTimeParams['from'][1]>['overflow'] = 'constrain'\n) {\n let item = itemParam;\n let hour, minute, second, millisecond, microsecond, nanosecond;\n if (IsObject(item)) {\n if (IsTemporalTime(item)) return item;\n if (IsTemporalZonedDateTime(item)) {\n item = GetPlainDateTimeFor(GetSlot(item, TIME_ZONE), GetSlot(item, INSTANT), GetSlot(item, CALENDAR));\n }\n if (IsTemporalDateTime(item)) {\n const TemporalPlainTime = GetIntrinsic('%Temporal.PlainTime%');\n return new TemporalPlainTime(\n GetSlot(item, ISO_HOUR),\n GetSlot(item, ISO_MINUTE),\n GetSlot(item, ISO_SECOND),\n GetSlot(item, ISO_MILLISECOND),\n GetSlot(item, ISO_MICROSECOND),\n GetSlot(item, ISO_NANOSECOND)\n );\n }\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = ToTemporalTimeRecord(item));\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = RegulateTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n overflow\n ));\n } else {\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = ParseTemporalTimeString(ToString(item)));\n RejectTime(hour, minute, second, millisecond, microsecond, nanosecond);\n }\n const TemporalPlainTime = GetIntrinsic('%Temporal.PlainTime%');\n return new TemporalPlainTime(hour, minute, second, millisecond, microsecond, nanosecond);\n}\n\nexport function ToTemporalYearMonth(\n item: PlainYearMonthParams['from'][0],\n options?: PlainYearMonthParams['from'][1]\n): Temporal.PlainYearMonth {\n if (IsObject(item)) {\n if (IsTemporalYearMonth(item)) return item;\n const calendar = GetTemporalCalendarSlotValueWithISODefault(item);\n const fieldNames = CalendarFields(calendar, ['month', 'monthCode', 'year'] as const);\n const fields = PrepareTemporalFields(item, fieldNames, []);\n return CalendarYearMonthFromFields(calendar, fields, options);\n }\n\n ToTemporalOverflow(options); // validate and ignore\n let { year, month, referenceISODay, calendar } = ParseTemporalYearMonthString(ToString(item));\n if (calendar === undefined) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n calendar = ASCIILowercase(calendar);\n\n if (referenceISODay === undefined) {\n RejectISODate(year, month, 1);\n return CreateTemporalYearMonth(year, month, calendar);\n }\n const result = CreateTemporalYearMonth(year, month, calendar, referenceISODay);\n return CalendarYearMonthFromFields(calendar, result);\n}\n\ntype OffsetBehaviour = 'wall' | 'exact' | 'option';\n\nexport function InterpretISODateTimeOffset(\n year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number,\n offsetBehaviour: OffsetBehaviour,\n offsetNs: number,\n timeZone: string | Temporal.TimeZoneProtocol,\n disambiguation: NonNullable<Temporal.ToInstantOptions['disambiguation']>,\n offsetOpt: Temporal.OffsetDisambiguationOptions['offset'],\n matchMinute: boolean\n) {\n const DateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const dt = new DateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n\n if (offsetBehaviour === 'wall' || offsetOpt === 'ignore') {\n // Simple case: ISO string without a TZ offset (or caller wants to ignore\n // the offset), so just convert DateTime to Instant in the given time zone\n const instant = GetInstantFor(timeZone, dt, disambiguation);\n return GetSlot(instant, EPOCHNANOSECONDS);\n }\n\n // The caller wants the offset to always win ('use') OR the caller is OK\n // with the offset winning ('prefer' or 'reject') as long as it's valid\n // for this timezone and date/time.\n if (offsetBehaviour === 'exact' || offsetOpt === 'use') {\n // Calculate the instant for the input's date/time and offset\n const epochNs = GetUTCEpochNanoseconds(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond\n );\n if (epochNs === null) throw new RangeError('ZonedDateTime outside of supported range');\n return JSBI.subtract(epochNs, JSBI.BigInt(offsetNs));\n }\n\n // \"prefer\" or \"reject\"\n const possibleInstants = GetPossibleInstantsFor(timeZone, dt);\n for (const candidate of possibleInstants) {\n const candidateOffset = GetOffsetNanosecondsFor(timeZone, candidate);\n const roundedCandidateOffset = JSBI.toNumber(\n RoundNumberToIncrement(JSBI.BigInt(candidateOffset), MINUTE_NANOS, 'halfExpand')\n );\n if (candidateOffset === offsetNs || (matchMinute && roundedCandidateOffset === offsetNs)) {\n return GetSlot(candidate, EPOCHNANOSECONDS);\n }\n }\n\n // the user-provided offset doesn't match any instants for this time\n // zone and date/time.\n if (offsetOpt === 'reject') {\n const offsetStr = FormatTimeZoneOffsetString(offsetNs);\n const timeZoneString = IsTemporalTimeZone(timeZone) ? GetSlot(timeZone, TIMEZONE_ID) : 'time zone';\n // The tsc emit for this line rewrites to invoke the PlainDateTime's valueOf method, NOT\n // toString (which is invoked by Node when using template literals directly).\n // See https://github.com/microsoft/TypeScript/issues/39744 for the proposed fix in tsc emit\n throw new RangeError(`Offset ${offsetStr} is invalid for ${dt.toString()} in ${timeZoneString}`);\n }\n // fall through: offsetOpt === 'prefer', but the offset doesn't match\n // so fall back to use the time zone instead.\n const instant = DisambiguatePossibleInstants(possibleInstants, timeZone, dt, disambiguation);\n return GetSlot(instant, EPOCHNANOSECONDS);\n}\n\nexport function ToTemporalZonedDateTime(\n item: ZonedDateTimeParams['from'][0],\n options?: ZonedDateTimeParams['from'][1]\n) {\n let year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number,\n timeZone,\n offset: string | undefined,\n calendar: string | Temporal.CalendarProtocol | undefined;\n let disambiguation: NonNullable<Temporal.ToInstantOptions['disambiguation']>;\n let offsetOpt: NonNullable<Temporal.OffsetDisambiguationOptions['offset']>;\n let matchMinute = false;\n let offsetBehaviour: OffsetBehaviour = 'option';\n if (IsObject(item)) {\n if (IsTemporalZonedDateTime(item)) return item;\n calendar = GetTemporalCalendarSlotValueWithISODefault(item);\n const fieldNames: (keyof Temporal.ZonedDateTimeLike)[] = CalendarFields(calendar, [\n 'day',\n 'hour',\n 'microsecond',\n 'millisecond',\n 'minute',\n 'month',\n 'monthCode',\n 'nanosecond',\n 'second',\n 'year'\n ] as const);\n fieldNames.push('timeZone', 'offset');\n const fields = PrepareTemporalFields(item, fieldNames, ['timeZone']);\n timeZone = ToTemporalTimeZoneSlotValue(fields.timeZone);\n offset = fields.offset;\n if (offset === undefined) {\n offsetBehaviour = 'wall';\n }\n disambiguation = ToTemporalDisambiguation(options);\n offsetOpt = ToTemporalOffset(options, 'reject');\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = InterpretTemporalDateTimeFields(\n calendar,\n fields,\n options\n ));\n } else {\n let ianaName, z;\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, ianaName, offset, z, calendar } =\n ParseTemporalZonedDateTimeString(ToString(item)));\n timeZone = ToTemporalTimeZoneSlotValue(ianaName);\n if (z) {\n offsetBehaviour = 'exact';\n } else if (!offset) {\n offsetBehaviour = 'wall';\n }\n if (!calendar) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n calendar = ASCIILowercase(calendar);\n matchMinute = true; // ISO strings may specify offset with less precision\n disambiguation = ToTemporalDisambiguation(options);\n offsetOpt = ToTemporalOffset(options, 'reject');\n ToTemporalOverflow(options); // validate and ignore\n }\n let offsetNs = 0;\n // The code above guarantees that if offsetBehaviour === 'option', then\n // `offset` is not undefined.\n if (offsetBehaviour === 'option') offsetNs = ParseTimeZoneOffsetString(offset as string);\n const epochNanoseconds = InterpretISODateTimeOffset(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n offsetBehaviour,\n offsetNs,\n timeZone,\n disambiguation,\n offsetOpt,\n matchMinute\n );\n return CreateTemporalZonedDateTime(epochNanoseconds, timeZone, calendar);\n}\n\nexport function CreateTemporalDateSlots(\n result: Temporal.PlainDate,\n isoYear: number,\n isoMonth: number,\n isoDay: number,\n calendar: CalendarSlot\n) {\n RejectISODate(isoYear, isoMonth, isoDay);\n RejectDateRange(isoYear, isoMonth, isoDay);\n\n CreateSlots(result);\n SetSlot(result, ISO_YEAR, isoYear);\n SetSlot(result, ISO_MONTH, isoMonth);\n SetSlot(result, ISO_DAY, isoDay);\n SetSlot(result, CALENDAR, calendar);\n SetSlot(result, DATE_BRAND, true);\n\n if (DEBUG) {\n ObjectDefineProperty(result, '_repr_', {\n value: `${result[Symbol.toStringTag]} <${TemporalDateToString(result)}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n}\n\nexport function CreateTemporalDate(\n isoYear: number,\n isoMonth: number,\n isoDay: number,\n calendar: CalendarSlot = 'iso8601'\n) {\n const TemporalPlainDate = GetIntrinsic('%Temporal.PlainDate%');\n const result = ObjectCreate(TemporalPlainDate.prototype);\n CreateTemporalDateSlots(result, isoYear, isoMonth, isoDay, calendar);\n return result;\n}\n\nexport function CreateTemporalDateTimeSlots(\n result: Temporal.PlainDateTime,\n isoYear: number,\n isoMonth: number,\n isoDay: number,\n h: number,\n min: number,\n s: number,\n ms: number,\n µs: number,\n ns: number,\n calendar: CalendarSlot\n) {\n RejectDateTime(isoYear, isoMonth, isoDay, h, min, s, ms, µs, ns);\n RejectDateTimeRange(isoYear, isoMonth, isoDay, h, min, s, ms, µs, ns);\n\n CreateSlots(result);\n SetSlot(result, ISO_YEAR, isoYear);\n SetSlot(result, ISO_MONTH, isoMonth);\n SetSlot(result, ISO_DAY, isoDay);\n SetSlot(result, ISO_HOUR, h);\n SetSlot(result, ISO_MINUTE, min);\n SetSlot(result, ISO_SECOND, s);\n SetSlot(result, ISO_MILLISECOND, ms);\n SetSlot(result, ISO_MICROSECOND, µs);\n SetSlot(result, ISO_NANOSECOND, ns);\n SetSlot(result, CALENDAR, calendar);\n\n if (DEBUG) {\n Object.defineProperty(result, '_repr_', {\n value: `${result[Symbol.toStringTag]} <${TemporalDateTimeToString(result, 'auto')}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n}\n\nexport function CreateTemporalDateTime(\n isoYear: number,\n isoMonth: number,\n isoDay: number,\n h: number,\n min: number,\n s: number,\n ms: number,\n µs: number,\n ns: number,\n calendar: CalendarSlot = 'iso8601'\n) {\n const TemporalPlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const result = ObjectCreate(TemporalPlainDateTime.prototype);\n CreateTemporalDateTimeSlots(result, isoYear, isoMonth, isoDay, h, min, s, ms, µs, ns, calendar);\n return result as Temporal.PlainDateTime;\n}\n\nexport function CreateTemporalMonthDaySlots(\n result: Temporal.PlainMonthDay,\n isoMonth: number,\n isoDay: number,\n calendar: CalendarSlot,\n referenceISOYear: number\n) {\n RejectISODate(referenceISOYear, isoMonth, isoDay);\n RejectDateRange(referenceISOYear, isoMonth, isoDay);\n\n CreateSlots(result);\n SetSlot(result, ISO_MONTH, isoMonth);\n SetSlot(result, ISO_DAY, isoDay);\n SetSlot(result, ISO_YEAR, referenceISOYear);\n SetSlot(result, CALENDAR, calendar);\n SetSlot(result, MONTH_DAY_BRAND, true);\n\n if (DEBUG) {\n Object.defineProperty(result, '_repr_', {\n value: `${result[Symbol.toStringTag]} <${TemporalMonthDayToString(result)}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n}\n\nexport function CreateTemporalMonthDay(\n isoMonth: number,\n isoDay: number,\n calendar: CalendarSlot = 'iso8601',\n referenceISOYear = 1972\n) {\n const TemporalPlainMonthDay = GetIntrinsic('%Temporal.PlainMonthDay%');\n const result = ObjectCreate(TemporalPlainMonthDay.prototype);\n CreateTemporalMonthDaySlots(result, isoMonth, isoDay, calendar, referenceISOYear);\n return result;\n}\n\nexport function CreateTemporalYearMonthSlots(\n result: Temporal.PlainYearMonth,\n isoYear: number,\n isoMonth: number,\n calendar: CalendarSlot,\n referenceISODay: number\n) {\n RejectISODate(isoYear, isoMonth, referenceISODay);\n RejectYearMonthRange(isoYear, isoMonth);\n\n CreateSlots(result);\n SetSlot(result, ISO_YEAR, isoYear);\n SetSlot(result, ISO_MONTH, isoMonth);\n SetSlot(result, ISO_DAY, referenceISODay);\n SetSlot(result, CALENDAR, calendar);\n SetSlot(result, YEAR_MONTH_BRAND, true);\n\n if (DEBUG) {\n Object.defineProperty(result, '_repr_', {\n value: `${result[Symbol.toStringTag]} <${TemporalYearMonthToString(result)}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n}\n\nexport function CreateTemporalYearMonth(\n isoYear: number,\n isoMonth: number,\n calendar: CalendarSlot = 'iso8601',\n referenceISODay = 1\n) {\n const TemporalPlainYearMonth = GetIntrinsic('%Temporal.PlainYearMonth%');\n const result = ObjectCreate(TemporalPlainYearMonth.prototype);\n CreateTemporalYearMonthSlots(result, isoYear, isoMonth, calendar, referenceISODay);\n return result;\n}\n\nexport function CreateTemporalZonedDateTimeSlots(\n result: Temporal.ZonedDateTime,\n epochNanoseconds: JSBI,\n timeZone: string | Temporal.TimeZoneProtocol,\n calendar: CalendarSlot\n) {\n ValidateEpochNanoseconds(epochNanoseconds);\n\n CreateSlots(result);\n SetSlot(result, EPOCHNANOSECONDS, epochNanoseconds);\n SetSlot(result, TIME_ZONE, timeZone);\n SetSlot(result, CALENDAR, calendar);\n\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n const instant = new TemporalInstant(GetSlot(result, EPOCHNANOSECONDS));\n SetSlot(result, INSTANT, instant);\n\n if (DEBUG) {\n Object.defineProperty(result, '_repr_', {\n value: `${result[Symbol.toStringTag]} <${TemporalZonedDateTimeToString(result, 'auto')}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n}\n\nexport function CreateTemporalZonedDateTime(\n epochNanoseconds: JSBI,\n timeZone: string | Temporal.TimeZoneProtocol,\n calendar: CalendarSlot = 'iso8601'\n) {\n const TemporalZonedDateTime = GetIntrinsic('%Temporal.ZonedDateTime%');\n const result = ObjectCreate(TemporalZonedDateTime.prototype);\n CreateTemporalZonedDateTimeSlots(result, epochNanoseconds, timeZone, calendar);\n return result;\n}\n\n// TODO: should (can?) we make this generic so the field names are checked\n// against the type that the calendar is a property of?\nexport function CalendarFields<K extends AnyTemporalKey>(calendar: CalendarSlot, fieldNamesParam: ReadonlyArray<K>) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.fields%'), calendarObj, [fieldNamesParam]) as K[];\n }\n const fields = GetMethod(calendar, 'fields');\n const fieldNames = Call(fields, calendar, [fieldNamesParam]);\n const result: K[] = [];\n for (const name of fieldNames) {\n if (typeof name !== 'string') throw new TypeError('bad return from calendar.fields()');\n ArrayPrototypePush.call(result, name);\n }\n return result;\n}\n\nexport function CalendarMergeFields<Base extends Record<string, unknown>, ToAdd extends Record<string, unknown>>(\n calendar: CalendarSlot,\n fields: Base,\n additionalFields: ToAdd\n) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.mergeFields%'), calendarObj, [\n fields,\n additionalFields\n ]) as Base & ToAdd;\n }\n const mergeFields = GetMethod(calendar, 'mergeFields');\n const result = Call(mergeFields, calendar, [fields, additionalFields]);\n if (!IsObject(result)) throw new TypeError('bad return from calendar.mergeFields()');\n return result as Base & ToAdd;\n}\n\nexport function CalendarDateAdd(\n calendar: CalendarSlot,\n date: CalendarProtocolParams['dateAdd'][0],\n duration: CalendarProtocolParams['dateAdd'][1],\n options: CalendarProtocolParams['dateAdd'][2],\n dateAddParam?: Temporal.CalendarProtocol['dateAdd'] | undefined\n) {\n let dateAdd = dateAddParam;\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.dateAdd%'), calendarObj, [date, duration, options]);\n }\n if (dateAdd === undefined) {\n dateAdd = GetMethod(calendar, 'dateAdd');\n }\n const result = ReflectApply(dateAdd, calendar, [date, duration, options]);\n if (!IsTemporalDate(result)) throw new TypeError('invalid result');\n return result;\n}\n\nfunction CalendarDateUntil(\n calendar: CalendarSlot,\n date: CalendarProtocolParams['dateUntil'][0],\n otherDate: CalendarProtocolParams['dateUntil'][1],\n options: CalendarProtocolParams['dateUntil'][2],\n dateUntilParam?: Temporal.CalendarProtocol['dateUntil'] | undefined\n) {\n let dateUntil = dateUntilParam;\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.dateUntil%'), calendarObj, [date, otherDate, options]);\n }\n if (dateUntil === undefined) {\n dateUntil = GetMethod(calendar, 'dateUntil');\n }\n const result = ReflectApply(dateUntil, calendar, [date, otherDate, options]);\n if (!IsTemporalDuration(result)) throw new TypeError('invalid result');\n return result;\n}\n\nexport function CalendarYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['year'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.year%'), calendarObj, [dateLike]);\n }\n const year = GetMethod(calendar, 'year');\n let result = Call(year, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar year result must be an integer');\n }\n if (!IsIntegralNumber(result)) {\n throw new RangeError('calendar year result must be an integer');\n }\n return result;\n}\n\nexport function CalendarMonth(calendar: CalendarSlot, dateLike: CalendarProtocolParams['month'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.month%'), calendarObj, [dateLike]);\n }\n const month = GetMethod(calendar, 'month');\n let result = Call(month, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar month result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar month result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarMonthCode(calendar: CalendarSlot, dateLike: CalendarProtocolParams['monthCode'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.monthCode%'), calendarObj, [dateLike]);\n }\n const monthCode = GetMethod(calendar, 'monthCode');\n let result = Call(monthCode, calendar, [dateLike]);\n if (typeof result !== 'string') {\n throw new TypeError('calendar monthCode result must be a string');\n }\n return result;\n}\n\nexport function CalendarDay(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.day%'), calendarObj, [dateLike]);\n }\n const day = GetMethod(calendar, 'day');\n const result = Call(day, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar day result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar day result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarEra(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.era%'), calendarObj, [dateLike]);\n }\n const era = GetMethod(calendar, 'era');\n let result = Call(era, calendar, [dateLike]);\n if (result === undefined) {\n return result;\n }\n if (typeof result !== 'string') {\n throw new TypeError('calendar era result must be a string or undefined');\n }\n return result;\n}\n\nexport function CalendarEraYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.eraYear%'), calendarObj, [dateLike]);\n }\n const eraYear = GetMethod(calendar, 'eraYear');\n let result = Call(eraYear, calendar, [dateLike]);\n if (result === undefined) {\n return result;\n }\n if (typeof result !== 'number') {\n throw new TypeError('calendar eraYear result must be an integer or undefined');\n }\n if (!IsIntegralNumber(result)) {\n throw new RangeError('calendar eraYear result must be an integer or undefined');\n }\n return result;\n}\n\nexport function CalendarDayOfWeek(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.dayOfWeek%'), calendarObj, [dateLike]);\n }\n const dayOfWeek = GetMethod(calendar, 'dayOfWeek');\n const result = Call(dayOfWeek, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar dayOfWeek result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar dayOfWeek result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarDayOfYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.dayOfYear%'), calendarObj, [dateLike]);\n }\n const dayOfYear = GetMethod(calendar, 'dayOfYear');\n const result = Call(dayOfYear, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar dayOfYear result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar dayOfYear result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarWeekOfYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.weekOfYear%'), calendarObj, [dateLike]);\n }\n const weekOfYear = GetMethod(calendar, 'weekOfYear');\n const result = Call(weekOfYear, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar weekOfYear result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar weekOfYear result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarYearOfWeek(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.yearOfWeek%'), calendarObj, [dateLike]);\n }\n const yearOfWeek = GetMethod(calendar, 'yearOfWeek');\n const result = Call(yearOfWeek, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar yearOfWeek result must be an integer');\n }\n if (!IsIntegralNumber(result)) {\n throw new RangeError('calendar yearOfWeek result must be an integer');\n }\n return result;\n}\n\nexport function CalendarDaysInWeek(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.daysInWeek%'), calendarObj, [dateLike]);\n }\n const daysInWeek = GetMethod(calendar, 'daysInWeek');\n const result = Call(daysInWeek, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar daysInWeek result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar daysInWeek result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarDaysInMonth(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.daysInMonth%'), calendarObj, [dateLike]);\n }\n const daysInMonth = GetMethod(calendar, 'daysInMonth');\n const result = Call(daysInMonth, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar daysInMonth result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar daysInMonth result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarDaysInYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.daysInYear%'), calendarObj, [dateLike]);\n }\n const daysInYear = GetMethod(calendar, 'daysInYear');\n const result = Call(daysInYear, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar daysInYear result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar daysInYear result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarMonthsInYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.monthsInYear%'), calendarObj, [dateLike]);\n }\n const monthsInYear = GetMethod(calendar, 'monthsInYear');\n const result = Call(monthsInYear, calendar, [dateLike]);\n if (typeof result !== 'number') {\n throw new TypeError('calendar monthsInYear result must be a positive integer');\n }\n if (!IsIntegralNumber(result) || result < 1) {\n throw new RangeError('calendar monthsInYear result must be a positive integer');\n }\n return result;\n}\n\nexport function CalendarInLeapYear(calendar: CalendarSlot, dateLike: CalendarProtocolParams['era'][0]) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.inLeapYear%'), calendarObj, [dateLike]);\n }\n const inLeapYear = GetMethod(calendar, 'inLeapYear');\n const result = Call(inLeapYear, calendar, [dateLike]);\n if (typeof result !== 'boolean') {\n throw new TypeError('calendar inLeapYear result must be a boolean');\n }\n return result;\n}\n\ntype MaybeCalendarProtocol = Partial<Omit<Temporal.CalendarProtocol, 'toString' | 'toJSON'>>;\nfunction ObjectImplementsTemporalCalendarProtocol(object: MaybeCalendarProtocol) {\n if (IsTemporalCalendar(object)) return true;\n return (\n 'dateAdd' in object &&\n 'dateFromFields' in object &&\n 'dateUntil' in object &&\n 'day' in object &&\n 'dayOfWeek' in object &&\n 'dayOfYear' in object &&\n 'daysInMonth' in object &&\n 'daysInWeek' in object &&\n 'daysInYear' in object &&\n 'fields' in object &&\n 'id' in object &&\n 'inLeapYear' in object &&\n 'mergeFields' in object &&\n 'month' in object &&\n 'monthCode' in object &&\n 'monthDayFromFields' in object &&\n 'monthsInYear' in object &&\n 'weekOfYear' in object &&\n 'year' in object &&\n 'yearMonthFromFields' in object &&\n 'yearOfWeek' in object\n );\n}\n\nexport function ToTemporalCalendarSlotValue(calendarLike: string): string;\nexport function ToTemporalCalendarSlotValue(calendarLike: Temporal.CalendarProtocol): Temporal.CalendarProtocol;\nexport function ToTemporalCalendarSlotValue(calendarLike: Temporal.CalendarLike): string | Temporal.CalendarProtocol;\nexport function ToTemporalCalendarSlotValue(calendarLike: CalendarParams['from'][0]) {\n if (IsObject(calendarLike)) {\n if (HasSlot(calendarLike, CALENDAR)) return GetSlot(calendarLike, CALENDAR);\n if (!ObjectImplementsTemporalCalendarProtocol(calendarLike)) {\n throw new TypeError('expected a Temporal.Calendar or object implementing the Temporal.Calendar protocol');\n }\n return calendarLike;\n }\n const identifier = ToString(calendarLike);\n if (IsBuiltinCalendar(identifier)) return ASCIILowercase(identifier);\n let calendar;\n try {\n ({ calendar } = ParseISODateTime(identifier));\n } catch {\n try {\n ({ calendar } = ParseTemporalYearMonthString(identifier));\n } catch {\n ({ calendar } = ParseTemporalMonthDayString(identifier));\n }\n }\n if (!calendar) calendar = 'iso8601';\n if (!IsBuiltinCalendar(calendar)) throw new RangeError(`invalid calendar identifier ${calendar}`);\n return ASCIILowercase(calendar);\n}\n\nfunction GetTemporalCalendarSlotValueWithISODefault(item: { calendar?: Temporal.CalendarLike }): CalendarSlot {\n if (HasSlot(item, CALENDAR)) return GetSlot(item, CALENDAR);\n const { calendar } = item;\n if (calendar === undefined) return 'iso8601';\n return ToTemporalCalendarSlotValue(calendar);\n}\n\nexport function ToTemporalCalendarIdentifier(slotValue: CalendarSlot) {\n if (typeof slotValue === 'string') return slotValue;\n const result = slotValue.id;\n if (typeof result !== 'string') throw new TypeError('calendar.id should be a string');\n return result;\n}\n\nexport function ToTemporalCalendarObject(slotValue: CalendarSlot) {\n if (IsObject(slotValue)) return slotValue;\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n return new TemporalCalendar(slotValue);\n}\n\nexport function CalendarEquals(one: CalendarSlot, two: CalendarSlot) {\n if (one === two) return true;\n const cal1 = ToTemporalCalendarIdentifier(one);\n const cal2 = ToTemporalCalendarIdentifier(two);\n return cal1 === cal2;\n}\n\n// This operation is not in the spec, it implements the following:\n// \"If ? CalendarEquals(one, two) is false, throw a RangeError exception.\"\n// This is so that we can build an informative error message without\n// re-getting the .id properties.\nfunction ThrowIfCalendarsNotEqual(one: CalendarSlot, two: CalendarSlot, errorMessageAction: string) {\n if (one === two) return;\n const cal1 = ToTemporalCalendarIdentifier(one);\n const cal2 = ToTemporalCalendarIdentifier(two);\n if (cal1 !== cal2) {\n throw new RangeError(`cannot ${errorMessageAction} of ${cal1} and ${cal2} calendars`);\n }\n}\n\nexport function ConsolidateCalendars(one: CalendarSlot, two: CalendarSlot) {\n if (one === two) return two;\n const sOne = ToTemporalCalendarIdentifier(one);\n const sTwo = ToTemporalCalendarIdentifier(two);\n if (sOne === sTwo || sOne === 'iso8601') {\n return two;\n } else if (sTwo === 'iso8601') {\n return one;\n } else {\n throw new RangeError('irreconcilable calendars');\n }\n}\n\nexport function CalendarDateFromFields(\n calendar: CalendarSlot,\n fields: CalendarProtocolParams['dateFromFields'][0],\n options?: Partial<CalendarProtocolParams['dateFromFields'][1]>,\n dateFromFieldsParam?: Temporal.CalendarProtocol['dateFromFields']\n) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.dateFromFields%'), calendarObj, [fields, options]);\n }\n const dateFromFields = dateFromFieldsParam ?? GetMethod(calendar, 'dateFromFields');\n const result = Call(dateFromFields, calendar, [fields, options]);\n if (!IsTemporalDate(result)) throw new TypeError('invalid result');\n return result;\n}\n\nexport function CalendarYearMonthFromFields(\n calendar: CalendarSlot,\n fields: CalendarProtocolParams['yearMonthFromFields'][0],\n options?: CalendarProtocolParams['yearMonthFromFields'][1]\n) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.yearMonthFromFields%'), calendarObj, [fields, options]);\n }\n const yearMonthFromFields = GetMethod(calendar, 'yearMonthFromFields');\n let result = Call(yearMonthFromFields, calendar, [fields, options]);\n if (!IsTemporalYearMonth(result)) throw new TypeError('invalid result');\n return result;\n}\n\nexport function CalendarMonthDayFromFields(\n calendar: CalendarSlot,\n fields: CalendarProtocolParams['monthDayFromFields'][0],\n options?: CalendarProtocolParams['monthDayFromFields'][1]\n) {\n if (typeof calendar === 'string') {\n const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%');\n const calendarObj = new TemporalCalendar(calendar);\n return Call(GetIntrinsic('%Temporal.Calendar.prototype.monthDayFromFields%'), calendarObj, [fields, options]);\n }\n const monthDayFromFields = GetMethod(calendar, 'monthDayFromFields');\n let result = Call(monthDayFromFields, calendar, [fields, options]);\n if (!IsTemporalMonthDay(result)) throw new TypeError('invalid result');\n return result;\n}\n\ntype MaybeTimeZoneProtocol = Partial<\n Pick<Temporal.TimeZoneProtocol, 'getOffsetNanosecondsFor' | 'getPossibleInstantsFor'>\n>;\nfunction ObjectImplementsTemporalTimeZoneProtocol(object: MaybeTimeZoneProtocol) {\n if (IsTemporalTimeZone(object)) return true;\n return 'getOffsetNanosecondsFor' in object && 'getPossibleInstantsFor' in object && 'id' in object;\n}\n\nexport function ToTemporalTimeZoneSlotValue(temporalTimeZoneLike: string): string;\nexport function ToTemporalTimeZoneSlotValue(temporalTimeZoneLike: Temporal.TimeZoneProtocol): Temporal.TimeZoneProtocol;\nexport function ToTemporalTimeZoneSlotValue(\n temporalTimeZoneLike: Temporal.TimeZoneLike\n): string | Temporal.TimeZoneProtocol;\nexport function ToTemporalTimeZoneSlotValue(temporalTimeZoneLike: TimeZoneParams['from'][0]) {\n if (IsObject(temporalTimeZoneLike)) {\n if (IsTemporalZonedDateTime(temporalTimeZoneLike)) return GetSlot(temporalTimeZoneLike, TIME_ZONE);\n if (!ObjectImplementsTemporalTimeZoneProtocol(temporalTimeZoneLike)) {\n throw new TypeError('expected a Temporal.TimeZone or object implementing the Temporal.TimeZone protocol');\n }\n return temporalTimeZoneLike;\n }\n const identifier = ToString(temporalTimeZoneLike);\n return ParseTemporalTimeZone(identifier);\n}\n\nexport function ToTemporalTimeZoneIdentifier(slotValue: TimeZoneSlot) {\n if (typeof slotValue === 'string') return slotValue;\n const result = slotValue.id;\n if (typeof result !== 'string') throw new TypeError('timeZone.id should be a string');\n return result;\n}\n\nexport function ToTemporalTimeZoneObject(slotValue: TimeZoneSlot) {\n if (IsObject(slotValue)) return slotValue;\n const TemporalTimeZone = GetIntrinsic('%Temporal.TimeZone%');\n return new TemporalTimeZone(slotValue);\n}\n\nexport function TimeZoneEquals(one: string | Temporal.TimeZoneProtocol, two: string | Temporal.TimeZoneProtocol) {\n if (one === two) return true;\n const tz1 = ToTemporalTimeZoneIdentifier(one);\n const tz2 = ToTemporalTimeZoneIdentifier(two);\n return tz1 === tz2;\n}\n\nexport function TemporalDateTimeToDate(dateTime: Temporal.PlainDateTime) {\n return CreateTemporalDate(\n GetSlot(dateTime, ISO_YEAR),\n GetSlot(dateTime, ISO_MONTH),\n GetSlot(dateTime, ISO_DAY),\n GetSlot(dateTime, CALENDAR)\n );\n}\n\nexport function TemporalDateTimeToTime(dateTime: Temporal.PlainDateTime) {\n const Time = GetIntrinsic('%Temporal.PlainTime%');\n return new Time(\n GetSlot(dateTime, ISO_HOUR),\n GetSlot(dateTime, ISO_MINUTE),\n GetSlot(dateTime, ISO_SECOND),\n GetSlot(dateTime, ISO_MILLISECOND),\n GetSlot(dateTime, ISO_MICROSECOND),\n GetSlot(dateTime, ISO_NANOSECOND)\n );\n}\n\nexport function GetOffsetNanosecondsFor(\n timeZone: string | Temporal.TimeZoneProtocol,\n instant: TimeZoneProtocolParams['getOffsetNanosecondsFor'][0],\n getOffsetNanosecondsForParam?: Temporal.TimeZoneProtocol['getOffsetNanosecondsFor']\n) {\n if (typeof timeZone === 'string') {\n const TemporalTimeZone = GetIntrinsic('%Temporal.TimeZone%');\n const timeZoneObject = new TemporalTimeZone(timeZone);\n return Call(GetIntrinsic('%Temporal.TimeZone.prototype.getOffsetNanosecondsFor%'), timeZoneObject, [instant]);\n }\n const getOffsetNanosecondsFor = getOffsetNanosecondsForParam ?? GetMethod(timeZone, 'getOffsetNanosecondsFor');\n const offsetNs = Call(getOffsetNanosecondsFor, timeZone, [instant]);\n if (typeof offsetNs !== 'number') {\n throw new TypeError('bad return from getOffsetNanosecondsFor');\n }\n if (!IsIntegralNumber(offsetNs) || MathAbs(offsetNs) >= 86400e9) {\n throw new RangeError('out-of-range return from getOffsetNanosecondsFor');\n }\n return offsetNs;\n}\n\nexport function GetOffsetStringFor(timeZone: string | Temporal.TimeZoneProtocol, instant: Temporal.Instant) {\n const offsetNs = GetOffsetNanosecondsFor(timeZone, instant);\n return FormatTimeZoneOffsetString(offsetNs);\n}\n\nexport function GetPlainDateTimeFor(\n timeZone: string | Temporal.TimeZoneProtocol,\n instant: Temporal.Instant,\n calendar: CalendarSlot\n) {\n const ns = GetSlot(instant, EPOCHNANOSECONDS);\n const offsetNs = GetOffsetNanosecondsFor(timeZone, instant);\n let { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = GetISOPartsFromEpoch(ns);\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = BalanceISODateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond + offsetNs\n ));\n return CreateTemporalDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar);\n}\n\nexport function GetInstantFor(\n timeZone: string | Temporal.TimeZoneProtocol,\n dateTime: Temporal.PlainDateTime,\n disambiguation: NonNullable<Temporal.ToInstantOptions['disambiguation']>\n) {\n const possibleInstants = GetPossibleInstantsFor(timeZone, dateTime);\n return DisambiguatePossibleInstants(possibleInstants, timeZone, dateTime, disambiguation);\n}\n\nfunction DisambiguatePossibleInstants(\n possibleInstants: Temporal.Instant[],\n timeZone: string | Temporal.TimeZoneProtocol,\n dateTime: Temporal.PlainDateTime,\n disambiguation: NonNullable<Temporal.ToInstantOptions['disambiguation']>\n) {\n const Instant = GetIntrinsic('%Temporal.Instant%');\n const numInstants = possibleInstants.length;\n\n if (numInstants === 1) return possibleInstants[0];\n if (numInstants) {\n switch (disambiguation) {\n case 'compatible':\n // fall through because 'compatible' means 'earlier' for \"fall back\" transitions\n case 'earlier':\n return possibleInstants[0];\n case 'later':\n return possibleInstants[numInstants - 1];\n case 'reject': {\n throw new RangeError('multiple instants found');\n }\n }\n }\n\n const year = GetSlot(dateTime, ISO_YEAR);\n const month = GetSlot(dateTime, ISO_MONTH);\n const day = GetSlot(dateTime, ISO_DAY);\n const hour = GetSlot(dateTime, ISO_HOUR);\n const minute = GetSlot(dateTime, ISO_MINUTE);\n const second = GetSlot(dateTime, ISO_SECOND);\n const millisecond = GetSlot(dateTime, ISO_MILLISECOND);\n const microsecond = GetSlot(dateTime, ISO_MICROSECOND);\n const nanosecond = GetSlot(dateTime, ISO_NANOSECOND);\n const utcns = GetUTCEpochNanoseconds(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n if (utcns === null) throw new RangeError('DateTime outside of supported range');\n const dayBefore = new Instant(JSBI.subtract(utcns, DAY_NANOS));\n const dayAfter = new Instant(JSBI.add(utcns, DAY_NANOS));\n const offsetBefore = GetOffsetNanosecondsFor(timeZone, dayBefore);\n const offsetAfter = GetOffsetNanosecondsFor(timeZone, dayAfter);\n const nanoseconds = offsetAfter - offsetBefore;\n switch (disambiguation) {\n case 'earlier': {\n const calendar = GetSlot(dateTime, CALENDAR);\n const PlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const earlier = AddDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n -nanoseconds,\n undefined\n );\n const earlierPlainDateTime = new PlainDateTime(\n earlier.year,\n earlier.month,\n earlier.day,\n earlier.hour,\n earlier.minute,\n earlier.second,\n earlier.millisecond,\n earlier.microsecond,\n earlier.nanosecond,\n calendar\n );\n return GetPossibleInstantsFor(timeZone, earlierPlainDateTime)[0];\n }\n case 'compatible':\n // fall through because 'compatible' means 'later' for \"spring forward\" transitions\n case 'later': {\n const calendar = GetSlot(dateTime, CALENDAR);\n const PlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const later = AddDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n nanoseconds,\n undefined\n );\n const laterPlainDateTime = new PlainDateTime(\n later.year,\n later.month,\n later.day,\n later.hour,\n later.minute,\n later.second,\n later.millisecond,\n later.microsecond,\n later.nanosecond,\n calendar\n );\n const possible = GetPossibleInstantsFor(timeZone, laterPlainDateTime);\n return possible[possible.length - 1];\n }\n case 'reject': {\n throw new RangeError('no such instant found');\n }\n }\n}\n\nfunction GetPossibleInstantsFor(\n timeZone: string | Temporal.TimeZoneProtocol,\n dateTime: TimeZoneProtocolParams['getPossibleInstantsFor'][0],\n getPossibleInstantsForParam?: Temporal.TimeZoneProtocol['getPossibleInstantsFor']\n) {\n if (typeof timeZone === 'string') {\n const TemporalTimeZone = GetIntrinsic('%Temporal.TimeZone%');\n const timeZoneObject = new TemporalTimeZone(timeZone);\n return Call(GetIntrinsic('%Temporal.TimeZone.prototype.getPossibleInstantsFor%'), timeZoneObject, [dateTime]);\n }\n const getPossibleInstantsFor = getPossibleInstantsForParam ?? GetMethod(timeZone, 'getPossibleInstantsFor');\n const possibleInstants = Call(getPossibleInstantsFor, timeZone, [dateTime]);\n const result: Temporal.Instant[] = [];\n for (const instant of possibleInstants) {\n if (!IsTemporalInstant(instant)) {\n throw new TypeError('bad return from getPossibleInstantsFor');\n }\n ArrayPrototypePush.call(result, instant);\n }\n return result;\n}\n\nexport function ISOYearString(year: number) {\n let yearString;\n if (year < 0 || year > 9999) {\n const sign = year < 0 ? '-' : '+';\n const yearNumber = MathAbs(year);\n yearString = sign + `000000${yearNumber}`.slice(-6);\n } else {\n yearString = `0000${year}`.slice(-4);\n }\n return yearString;\n}\n\nexport function ISODateTimePartString(part: number) {\n return `00${part}`.slice(-2);\n}\nexport function FormatSecondsStringPart(\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number,\n precision: ReturnType<typeof ToSecondsStringPrecisionRecord>['precision']\n) {\n if (precision === 'minute') return '';\n\n const secs = `:${ISODateTimePartString(second)}`;\n let fractionNumber = millisecond * 1e6 + microsecond * 1e3 + nanosecond;\n let fraction: string;\n\n if (precision === 'auto') {\n if (fractionNumber === 0) return secs;\n fraction = `${fractionNumber}`.padStart(9, '0');\n while (fraction[fraction.length - 1] === '0') fraction = fraction.slice(0, -1);\n } else {\n if (precision === 0) return secs;\n fraction = `${fractionNumber}`.padStart(9, '0').slice(0, precision);\n }\n return `${secs}.${fraction}`;\n}\n\nexport function TemporalInstantToString(\n instant: Temporal.Instant,\n timeZone: string | Temporal.TimeZoneProtocol | undefined,\n precision: ReturnType<typeof ToSecondsStringPrecisionRecord>['precision']\n) {\n let outputTimeZone = timeZone;\n if (outputTimeZone === undefined) outputTimeZone = 'UTC';\n const dateTime = GetPlainDateTimeFor(outputTimeZone, instant, 'iso8601');\n const year = ISOYearString(GetSlot(dateTime, ISO_YEAR));\n const month = ISODateTimePartString(GetSlot(dateTime, ISO_MONTH));\n const day = ISODateTimePartString(GetSlot(dateTime, ISO_DAY));\n const hour = ISODateTimePartString(GetSlot(dateTime, ISO_HOUR));\n const minute = ISODateTimePartString(GetSlot(dateTime, ISO_MINUTE));\n const seconds = FormatSecondsStringPart(\n GetSlot(dateTime, ISO_SECOND),\n GetSlot(dateTime, ISO_MILLISECOND),\n GetSlot(dateTime, ISO_MICROSECOND),\n GetSlot(dateTime, ISO_NANOSECOND),\n precision\n );\n let timeZoneString = 'Z';\n if (timeZone !== undefined) {\n const offsetNs = GetOffsetNanosecondsFor(outputTimeZone, instant);\n timeZoneString = FormatISOTimeZoneOffsetString(offsetNs);\n }\n return `${year}-${month}-${day}T${hour}:${minute}${seconds}${timeZoneString}`;\n}\n\ninterface ToStringOptions {\n unit: ReturnType<typeof ToSecondsStringPrecisionRecord>['unit'];\n increment: number;\n roundingMode: ReturnType<typeof ToTemporalRoundingMode>;\n}\n\nexport function TemporalDurationToString(\n duration: Temporal.Duration,\n precision: Temporal.ToStringPrecisionOptions['fractionalSecondDigits'] = 'auto',\n options: ToStringOptions | undefined = undefined\n) {\n function formatNumber(num: number) {\n if (num <= NumberMaxSafeInteger) return num.toString(10);\n return JSBI.BigInt(num).toString(10);\n }\n\n const years = GetSlot(duration, YEARS);\n const months = GetSlot(duration, MONTHS);\n const weeks = GetSlot(duration, WEEKS);\n const days = GetSlot(duration, DAYS);\n const hours = GetSlot(duration, HOURS);\n const minutes = GetSlot(duration, MINUTES);\n let seconds = GetSlot(duration, SECONDS);\n let ms = GetSlot(duration, MILLISECONDS);\n let µs = GetSlot(duration, MICROSECONDS);\n let ns = GetSlot(duration, NANOSECONDS);\n const sign = DurationSign(years, months, weeks, days, hours, minutes, seconds, ms, µs, ns);\n\n if (options) {\n const { unit, increment, roundingMode } = options;\n ({\n seconds,\n milliseconds: ms,\n microseconds: µs,\n nanoseconds: ns\n } = RoundDuration(0, 0, 0, 0, 0, 0, seconds, ms, µs, ns, increment, unit, roundingMode));\n }\n\n const dateParts: string[] = [];\n if (years) dateParts.push(`${formatNumber(MathAbs(years))}Y`);\n if (months) dateParts.push(`${formatNumber(MathAbs(months))}M`);\n if (weeks) dateParts.push(`${formatNumber(MathAbs(weeks))}W`);\n if (days) dateParts.push(`${formatNumber(MathAbs(days))}D`);\n\n const timeParts: string[] = [];\n if (hours) timeParts.push(`${formatNumber(MathAbs(hours))}H`);\n if (minutes) timeParts.push(`${formatNumber(MathAbs(minutes))}M`);\n\n const secondParts: string[] = [];\n let total = TotalDurationNanoseconds(0, 0, 0, seconds, ms, µs, ns, 0);\n let nsBigInt: JSBI, µsBigInt: JSBI, msBigInt: JSBI, secondsBigInt: JSBI;\n ({ quotient: total, remainder: nsBigInt } = divmod(total, THOUSAND));\n ({ quotient: total, remainder: µsBigInt } = divmod(total, THOUSAND));\n ({ quotient: secondsBigInt, remainder: msBigInt } = divmod(total, THOUSAND));\n const fraction =\n MathAbs(JSBI.toNumber(msBigInt)) * 1e6 + MathAbs(JSBI.toNumber(µsBigInt)) * 1e3 + MathAbs(JSBI.toNumber(nsBigInt));\n let decimalPart;\n if (precision === 'auto') {\n if (fraction !== 0) {\n decimalPart = `${fraction}`.padStart(9, '0');\n while (decimalPart[decimalPart.length - 1] === '0') {\n decimalPart = decimalPart.slice(0, -1);\n }\n }\n } else if (precision !== 0) {\n decimalPart = `${fraction}`.padStart(9, '0').slice(0, precision);\n }\n if (decimalPart) secondParts.unshift('.', decimalPart);\n if (!JSBI.equal(secondsBigInt, ZERO) || secondParts.length || precision !== 'auto') {\n secondParts.unshift(abs(secondsBigInt).toString());\n }\n if (secondParts.length) timeParts.push(`${secondParts.join('')}S`);\n if (timeParts.length) timeParts.unshift('T');\n if (!dateParts.length && !timeParts.length) return 'PT0S';\n return `${sign < 0 ? '-' : ''}P${dateParts.join('')}${timeParts.join('')}`;\n}\n\nexport function TemporalDateToString(\n date: Temporal.PlainDate,\n showCalendar: Temporal.ShowCalendarOption['calendarName'] = 'auto'\n) {\n const year = ISOYearString(GetSlot(date, ISO_YEAR));\n const month = ISODateTimePartString(GetSlot(date, ISO_MONTH));\n const day = ISODateTimePartString(GetSlot(date, ISO_DAY));\n const calendar = MaybeFormatCalendarAnnotation(GetSlot(date, CALENDAR), showCalendar);\n return `${year}-${month}-${day}${calendar}`;\n}\n\nexport function TemporalDateTimeToString(\n dateTime: Temporal.PlainDateTime,\n precision: ReturnType<typeof ToSecondsStringPrecisionRecord>['precision'],\n showCalendar: ReturnType<typeof ToCalendarNameOption> = 'auto',\n options: ToStringOptions | undefined = undefined\n) {\n let year = GetSlot(dateTime, ISO_YEAR);\n let month = GetSlot(dateTime, ISO_MONTH);\n let day = GetSlot(dateTime, ISO_DAY);\n let hour = GetSlot(dateTime, ISO_HOUR);\n let minute = GetSlot(dateTime, ISO_MINUTE);\n let second = GetSlot(dateTime, ISO_SECOND);\n let millisecond = GetSlot(dateTime, ISO_MILLISECOND);\n let microsecond = GetSlot(dateTime, ISO_MICROSECOND);\n let nanosecond = GetSlot(dateTime, ISO_NANOSECOND);\n\n if (options) {\n const { unit, increment, roundingMode } = options;\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = RoundISODateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n increment,\n unit,\n roundingMode\n ));\n }\n\n const yearString = ISOYearString(year);\n const monthString = ISODateTimePartString(month);\n const dayString = ISODateTimePartString(day);\n const hourString = ISODateTimePartString(hour);\n const minuteString = ISODateTimePartString(minute);\n const secondsString = FormatSecondsStringPart(second, millisecond, microsecond, nanosecond, precision);\n const calendar = MaybeFormatCalendarAnnotation(GetSlot(dateTime, CALENDAR), showCalendar);\n return `${yearString}-${monthString}-${dayString}T${hourString}:${minuteString}${secondsString}${calendar}`;\n}\n\nexport function TemporalMonthDayToString(\n monthDay: Temporal.PlainMonthDay,\n showCalendar: Temporal.ShowCalendarOption['calendarName'] = 'auto'\n) {\n const month = ISODateTimePartString(GetSlot(monthDay, ISO_MONTH));\n const day = ISODateTimePartString(GetSlot(monthDay, ISO_DAY));\n let resultString = `${month}-${day}`;\n const calendar = GetSlot(monthDay, CALENDAR);\n const calendarID = ToTemporalCalendarIdentifier(calendar);\n if (showCalendar === 'always' || showCalendar === 'critical' || calendarID !== 'iso8601') {\n const year = ISOYearString(GetSlot(monthDay, ISO_YEAR));\n resultString = `${year}-${resultString}`;\n }\n const calendarString = FormatCalendarAnnotation(calendarID, showCalendar);\n if (calendarString) resultString += calendarString;\n return resultString;\n}\n\nexport function TemporalYearMonthToString(\n yearMonth: Temporal.PlainYearMonth,\n showCalendar: Temporal.ShowCalendarOption['calendarName'] = 'auto'\n) {\n const year = ISOYearString(GetSlot(yearMonth, ISO_YEAR));\n const month = ISODateTimePartString(GetSlot(yearMonth, ISO_MONTH));\n let resultString = `${year}-${month}`;\n const calendar = GetSlot(yearMonth, CALENDAR);\n const calendarID = ToTemporalCalendarIdentifier(calendar);\n if (showCalendar === 'always' || showCalendar === 'critical' || calendarID !== 'iso8601') {\n const day = ISODateTimePartString(GetSlot(yearMonth, ISO_DAY));\n resultString += `-${day}`;\n }\n const calendarString = FormatCalendarAnnotation(calendarID, showCalendar);\n if (calendarString) resultString += calendarString;\n return resultString;\n}\n\nexport function TemporalZonedDateTimeToString(\n zdt: Temporal.ZonedDateTime,\n precision: ReturnType<typeof ToSecondsStringPrecisionRecord>['precision'],\n showCalendar: ReturnType<typeof ToCalendarNameOption> = 'auto',\n showTimeZone: ReturnType<typeof ToTimeZoneNameOption> = 'auto',\n showOffset: ReturnType<typeof ToShowOffsetOption> = 'auto',\n options: ToStringOptions | undefined = undefined\n) {\n let instant = GetSlot(zdt, INSTANT);\n\n if (options) {\n const { unit, increment, roundingMode } = options;\n const ns = RoundInstant(GetSlot(zdt, EPOCHNANOSECONDS), increment, unit, roundingMode);\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n instant = new TemporalInstant(ns);\n }\n\n const tz = GetSlot(zdt, TIME_ZONE);\n const dateTime = GetPlainDateTimeFor(tz, instant, 'iso8601');\n\n const year = ISOYearString(GetSlot(dateTime, ISO_YEAR));\n const month = ISODateTimePartString(GetSlot(dateTime, ISO_MONTH));\n const day = ISODateTimePartString(GetSlot(dateTime, ISO_DAY));\n const hour = ISODateTimePartString(GetSlot(dateTime, ISO_HOUR));\n const minute = ISODateTimePartString(GetSlot(dateTime, ISO_MINUTE));\n const seconds = FormatSecondsStringPart(\n GetSlot(dateTime, ISO_SECOND),\n GetSlot(dateTime, ISO_MILLISECOND),\n GetSlot(dateTime, ISO_MICROSECOND),\n GetSlot(dateTime, ISO_NANOSECOND),\n precision\n );\n let result = `${year}-${month}-${day}T${hour}:${minute}${seconds}`;\n if (showOffset !== 'never') {\n const offsetNs = GetOffsetNanosecondsFor(tz, instant);\n result += FormatISOTimeZoneOffsetString(offsetNs);\n }\n if (showTimeZone !== 'never') {\n const identifier = ToTemporalTimeZoneIdentifier(tz);\n const flag = showTimeZone === 'critical' ? '!' : '';\n result += `[${flag}${identifier}]`;\n }\n result += MaybeFormatCalendarAnnotation(GetSlot(zdt, CALENDAR), showCalendar);\n return result;\n}\n\nexport function IsTimeZoneOffsetString(string: string) {\n return OFFSET.test(StringCtor(string));\n}\n\nexport function ParseTimeZoneOffsetString(string: string): number {\n const match = OFFSET.exec(StringCtor(string));\n if (!match) {\n throw new RangeError(`invalid time zone offset: ${string}`);\n }\n const sign = match[1] === '-' || match[1] === '\\u2212' ? -1 : +1;\n const hours = +match[2];\n const minutes = +(match[3] || 0);\n const seconds = +(match[4] || 0);\n const nanoseconds = +((match[5] || 0) + '000000000').slice(0, 9);\n return sign * (((hours * 60 + minutes) * 60 + seconds) * 1e9 + nanoseconds);\n}\n\nexport function GetCanonicalTimeZoneIdentifier(timeZoneIdentifier: string): string {\n if (IsTimeZoneOffsetString(timeZoneIdentifier)) {\n const offsetNs = ParseTimeZoneOffsetString(timeZoneIdentifier);\n return FormatTimeZoneOffsetString(offsetNs);\n }\n const formatter = getIntlDateTimeFormatEnUsForTimeZone(StringCtor(timeZoneIdentifier));\n return formatter.resolvedOptions().timeZone;\n}\n\nexport function GetNamedTimeZoneOffsetNanoseconds(id: string, epochNanoseconds: JSBI) {\n const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } =\n GetNamedTimeZoneDateTimeParts(id, epochNanoseconds);\n\n // The pattern of leap years in the ISO 8601 calendar repeats every 400\n // years. To avoid overflowing at the edges of the range, we reduce the year\n // to the remainder after dividing by 400, and then add back all the\n // nanoseconds from the multiples of 400 years at the end.\n const reducedYear = year % 400;\n const yearCycles = (year - reducedYear) / 400;\n const nsIn400YearCycle = JSBI.multiply(JSBI.BigInt(400 * 365 + 97), DAY_NANOS);\n\n const reducedUTC = GetUTCEpochNanoseconds(\n reducedYear,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond\n );\n assertExists(reducedUTC);\n const utc = JSBI.add(reducedUTC, JSBI.multiply(nsIn400YearCycle, JSBI.BigInt(yearCycles)));\n return JSBI.toNumber(JSBI.subtract(utc, epochNanoseconds));\n}\n\nfunction FormatTimeZoneOffsetString(offsetNanosecondsParam: number): string {\n const sign = offsetNanosecondsParam < 0 ? '-' : '+';\n const offsetNanoseconds = MathAbs(offsetNanosecondsParam);\n const nanoseconds = offsetNanoseconds % 1e9;\n const seconds = MathFloor(offsetNanoseconds / 1e9) % 60;\n const minutes = MathFloor(offsetNanoseconds / 60e9) % 60;\n const hours = MathFloor(offsetNanoseconds / 3600e9);\n\n const hourString = ISODateTimePartString(hours);\n const minuteString = ISODateTimePartString(minutes);\n const secondString = ISODateTimePartString(seconds);\n let post = '';\n if (nanoseconds) {\n let fraction = `${nanoseconds}`.padStart(9, '0');\n while (fraction[fraction.length - 1] === '0') fraction = fraction.slice(0, -1);\n post = `:${secondString}.${fraction}`;\n } else if (seconds) {\n post = `:${secondString}`;\n }\n return `${sign}${hourString}:${minuteString}${post}`;\n}\n\nfunction FormatISOTimeZoneOffsetString(offsetNanosecondsParam: number): string {\n let offsetNanoseconds = JSBI.toNumber(\n RoundNumberToIncrement(JSBI.BigInt(offsetNanosecondsParam), MINUTE_NANOS, 'halfExpand')\n );\n const sign = offsetNanoseconds < 0 ? '-' : '+';\n offsetNanoseconds = MathAbs(offsetNanoseconds);\n const minutes = (offsetNanoseconds / 60e9) % 60;\n const hours = MathFloor(offsetNanoseconds / 3600e9);\n\n const hourString = ISODateTimePartString(hours);\n const minuteString = ISODateTimePartString(minutes);\n return `${sign}${hourString}:${minuteString}`;\n}\nexport function GetUTCEpochNanoseconds(\n year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number\n) {\n // Note: Date.UTC() interprets one and two-digit years as being in the\n // 20th century, so don't use it\n const legacyDate = new Date();\n legacyDate.setUTCHours(hour, minute, second, millisecond);\n legacyDate.setUTCFullYear(year, month - 1, day);\n const ms = legacyDate.getTime();\n if (NumberIsNaN(ms)) return null;\n let ns = JSBI.multiply(JSBI.BigInt(ms), MILLION);\n ns = JSBI.add(ns, JSBI.multiply(JSBI.BigInt(microsecond), THOUSAND));\n ns = JSBI.add(ns, JSBI.BigInt(nanosecond));\n if (JSBI.lessThan(ns, NS_MIN) || JSBI.greaterThan(ns, NS_MAX)) return null;\n return ns;\n}\n\nfunction GetISOPartsFromEpoch(epochNanoseconds: JSBI) {\n const { quotient, remainder } = divmod(epochNanoseconds, MILLION);\n let epochMilliseconds = JSBI.toNumber(quotient);\n let nanos = JSBI.toNumber(remainder);\n if (nanos < 0) {\n nanos += 1e6;\n epochMilliseconds -= 1;\n }\n const microsecond = MathFloor(nanos / 1e3) % 1e3;\n const nanosecond = nanos % 1e3;\n\n const item = new Date(epochMilliseconds);\n const year = item.getUTCFullYear();\n const month = item.getUTCMonth() + 1;\n const day = item.getUTCDate();\n const hour = item.getUTCHours();\n const minute = item.getUTCMinutes();\n const second = item.getUTCSeconds();\n const millisecond = item.getUTCMilliseconds();\n\n return { epochMilliseconds, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\n// ts-prune-ignore-next TODO: remove this after tests are converted to TS\nexport function GetNamedTimeZoneDateTimeParts(id: string, epochNanoseconds: JSBI) {\n const { epochMilliseconds, millisecond, microsecond, nanosecond } = GetISOPartsFromEpoch(epochNanoseconds);\n const { year, month, day, hour, minute, second } = GetFormatterParts(id, epochMilliseconds);\n return BalanceISODateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n}\n\nfunction maxJSBI(one: JSBI, two: JSBI) {\n return JSBI.lessThan(one, two) ? two : one;\n}\n\n/**\n * Our best guess at how far in advance new rules will be put into the TZDB for\n * future offset transitions. We'll pick 10 years but can always revise it if\n * we find that countries are being unusually proactive in their announcing\n * of offset changes.\n */\nfunction afterLatestPossibleTzdbRuleChange() {\n return JSBI.add(SystemUTCEpochNanoSeconds(), ABOUT_TEN_YEARS_NANOS);\n}\n\nexport function GetNamedTimeZoneNextTransition(id: string, epochNanoseconds: JSBI): JSBI | null {\n if (JSBI.lessThan(epochNanoseconds, BEFORE_FIRST_OFFSET_TRANSITION)) {\n return GetNamedTimeZoneNextTransition(id, BEFORE_FIRST_OFFSET_TRANSITION);\n }\n // Decide how far in the future after `epochNanoseconds` we'll look for an\n // offset change. There are two cases:\n // 1. If it's a past date (or a date in the near future) then it's possible\n // that the time zone may have newly added DST in the next few years. So\n // we'll have to look from the provided time until a few years after the\n // current system time. (Changes to DST policy are usually announced a few\n // years in the future.) Note that the first DST anywhere started in 1847,\n // so we'll start checks in 1847 instead of wasting cycles on years where\n // there will never be transitions.\n // 2. If it's a future date beyond the next few years, then we'll just assume\n // that the latest DST policy in TZDB will still be in effect. In this\n // case, we only need to look one year in the future to see if there are\n // any DST transitions. We actually only need to look 9-10 months because\n // DST has two transitions per year, but we'll use a year just to be safe.\n const oneYearLater = JSBI.add(epochNanoseconds, ABOUT_ONE_YEAR_NANOS);\n const uppercap = maxJSBI(afterLatestPossibleTzdbRuleChange(), oneYearLater);\n // The first transition (in any timezone) recorded in the TZDB was in 1847, so\n // start there if an earlier date is supplied.\n let leftNanos = maxJSBI(BEFORE_FIRST_OFFSET_TRANSITION, epochNanoseconds);\n const leftOffsetNs = GetNamedTimeZoneOffsetNanoseconds(id, leftNanos);\n let rightNanos = leftNanos;\n let rightOffsetNs = leftOffsetNs;\n while (leftOffsetNs === rightOffsetNs && JSBI.lessThan(JSBI.BigInt(leftNanos), uppercap)) {\n rightNanos = JSBI.add(leftNanos, TWO_WEEKS_NANOS);\n if (JSBI.greaterThan(rightNanos, NS_MAX)) return null;\n rightOffsetNs = GetNamedTimeZoneOffsetNanoseconds(id, rightNanos);\n if (leftOffsetNs === rightOffsetNs) {\n leftNanos = rightNanos;\n }\n }\n if (leftOffsetNs === rightOffsetNs) return null;\n const result = bisect(\n (epochNs: JSBI) => GetNamedTimeZoneOffsetNanoseconds(id, epochNs),\n leftNanos,\n rightNanos,\n leftOffsetNs,\n rightOffsetNs\n );\n return result;\n}\n\nexport function GetNamedTimeZonePreviousTransition(id: string, epochNanoseconds: JSBI): JSBI | null {\n // If a time zone uses DST (at the time of `epochNanoseconds`), then we only\n // have to look back one year to find a transition. But if it doesn't use DST,\n // then we need to look all the way back to 1847 (the earliest rule in the\n // TZDB) to see if it had other offset transitions in the past. Looping back\n // from a far-future date to 1847 is very slow (minutes of 100% CPU!), and is\n // also unnecessary because DST rules aren't put into the TZDB more than a few\n // years in the future because the political changes in time zones happen with\n // only a few years' warning. Therefore, if a far-future date is provided,\n // then we'll run the check in two parts:\n // 1. First, we'll look back for up to one year to see if the latest TZDB\n // rules have DST.\n // 2. If not, then we'll \"fast-reverse\" back to a few years later than the\n // current system time, and then look back to 1847. This reduces the\n // worst-case loop from 273K years to 175 years, for a ~1500x improvement\n // in worst-case perf.\n const afterLatestRule = afterLatestPossibleTzdbRuleChange();\n const isFarFuture = JSBI.greaterThan(epochNanoseconds, afterLatestRule);\n const lowercap = isFarFuture ? JSBI.subtract(epochNanoseconds, ABOUT_ONE_YEAR_NANOS) : BEFORE_FIRST_OFFSET_TRANSITION;\n\n // TODO: proposal-temporal polyfill has different code for very similar\n // optimizations as above, as well as in GetNamedTimeZonePreviousTransition.\n // We should figure out if we should change one polyfill to match the other.\n\n // We assume most time zones either have regular DST rules that extend\n // indefinitely into the future, or they have no DST transitions between now\n // and next year. Africa/Casablanca and Africa/El_Aaiun are unique cases\n // that fit neither of these. Their irregular DST transitions are\n // precomputed until 2087 in the current time zone database, so requesting\n // the previous transition for an instant far in the future may take an\n // extremely long time as it loops backward 2 weeks at a time.\n if (id === 'Africa/Casablanca' || id === 'Africa/El_Aaiun') {\n const lastPrecomputed = GetSlot(ToTemporalInstant('2088-01-01T00Z'), EPOCHNANOSECONDS);\n if (JSBI.lessThan(lastPrecomputed, epochNanoseconds)) {\n return GetNamedTimeZonePreviousTransition(id, lastPrecomputed);\n }\n }\n\n let rightNanos = JSBI.subtract(epochNanoseconds, ONE);\n if (JSBI.lessThan(rightNanos, BEFORE_FIRST_OFFSET_TRANSITION)) return null;\n const rightOffsetNs = GetNamedTimeZoneOffsetNanoseconds(id, rightNanos);\n let leftNanos = rightNanos;\n let leftOffsetNs = rightOffsetNs;\n while (rightOffsetNs === leftOffsetNs && JSBI.greaterThan(rightNanos, lowercap)) {\n leftNanos = JSBI.subtract(rightNanos, TWO_WEEKS_NANOS);\n if (JSBI.lessThan(leftNanos, BEFORE_FIRST_OFFSET_TRANSITION)) return null;\n leftOffsetNs = GetNamedTimeZoneOffsetNanoseconds(id, leftNanos);\n if (rightOffsetNs === leftOffsetNs) {\n rightNanos = leftNanos;\n }\n }\n if (rightOffsetNs === leftOffsetNs) {\n if (isFarFuture) {\n // There was no DST after looking back one year, which means that the most\n // recent TZDB rules don't have any recurring transitions. To check for\n // transitions in older rules, back up to a few years after the current\n // date and then look all the way back to 1847. Note that we move back one\n // day from the latest possible rule so that when the recursion runs it\n // won't consider the new time to be \"far future\" because the system clock\n // has advanced in the meantime.\n const newTimeToCheck = JSBI.subtract(afterLatestRule, DAY_NANOS);\n return GetNamedTimeZonePreviousTransition(id, newTimeToCheck);\n }\n return null;\n }\n const result = bisect(\n (epochNs: JSBI) => GetNamedTimeZoneOffsetNanoseconds(id, epochNs),\n leftNanos,\n rightNanos,\n leftOffsetNs,\n rightOffsetNs\n );\n return result;\n}\n\n// ts-prune-ignore-next TODO: remove this after tests are converted to TS\nexport function parseFromEnUsFormat(datetime: string) {\n const parts = datetime.split(/[^\\w]+/);\n\n if (parts.length !== 7) {\n throw new RangeError(`expected 7 parts in \"${datetime}`);\n }\n\n const month = +parts[0];\n const day = +parts[1];\n let year = +parts[2];\n const era = parts[3].toUpperCase();\n if (era === 'B' || era === 'BC') {\n year = -year + 1;\n } else if (era !== 'A' && era !== 'AD') {\n throw new RangeError(`Unknown era ${era} in \"${datetime}`);\n }\n let hour = +parts[4];\n if (hour === 24) {\n // bugs.chromium.org/p/chromium/issues/detail?id=1045791\n hour = 0;\n }\n const minute = +parts[5];\n const second = +parts[6];\n\n if (\n !NumberIsFinite(year) ||\n !NumberIsFinite(month) ||\n !NumberIsFinite(day) ||\n !NumberIsFinite(hour) ||\n !NumberIsFinite(minute) ||\n !NumberIsFinite(second)\n ) {\n throw new RangeError(`Invalid number in \"${datetime}`);\n }\n\n return { year, month, day, hour, minute, second };\n}\n\n// ts-prune-ignore-next TODO: remove this after tests are converted to TS\nexport function GetFormatterParts(timeZone: string, epochMilliseconds: number) {\n const formatter = getIntlDateTimeFormatEnUsForTimeZone(timeZone);\n // Using `format` instead of `formatToParts` for compatibility with older clients\n const datetime = formatter.format(new Date(epochMilliseconds));\n return parseFromEnUsFormat(datetime);\n}\n\nexport function GetNamedTimeZoneEpochNanoseconds(\n id: string,\n year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number\n) {\n const ns = GetUTCEpochNanoseconds(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);\n if (ns === null) throw new RangeError('DateTime outside of supported range');\n let nsEarlier = JSBI.subtract(ns, DAY_NANOS);\n if (JSBI.lessThan(nsEarlier, NS_MIN)) nsEarlier = ns;\n let nsLater = JSBI.add(ns, DAY_NANOS);\n if (JSBI.greaterThan(nsLater, NS_MAX)) nsLater = ns;\n const earliest = GetNamedTimeZoneOffsetNanoseconds(id, nsEarlier);\n const latest = GetNamedTimeZoneOffsetNanoseconds(id, nsLater);\n const found = earliest === latest ? [earliest] : [earliest, latest];\n return found\n .map((offsetNanoseconds) => {\n const epochNanoseconds = JSBI.subtract(ns, JSBI.BigInt(offsetNanoseconds));\n const parts = GetNamedTimeZoneDateTimeParts(id, epochNanoseconds);\n if (\n year !== parts.year ||\n month !== parts.month ||\n day !== parts.day ||\n hour !== parts.hour ||\n minute !== parts.minute ||\n second !== parts.second ||\n millisecond !== parts.millisecond ||\n microsecond !== parts.microsecond ||\n nanosecond !== parts.nanosecond\n ) {\n return undefined;\n }\n return epochNanoseconds;\n })\n .filter((x) => x !== undefined) as JSBI[];\n}\n\nexport function LeapYear(year: number) {\n if (undefined === year) return false;\n const isDiv4 = year % 4 === 0;\n const isDiv100 = year % 100 === 0;\n const isDiv400 = year % 400 === 0;\n return isDiv4 && (!isDiv100 || isDiv400);\n}\n\nexport function ISODaysInMonth(year: number, month: number) {\n const DoM = {\n standard: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n leapyear: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n };\n return DoM[LeapYear(year) ? 'leapyear' : 'standard'][month - 1];\n}\n\nexport function DayOfWeek(year: number, month: number, day: number) {\n const m = month + (month < 3 ? 10 : -2);\n const Y = year - (month < 3 ? 1 : 0);\n\n const c = MathFloor(Y / 100);\n const y = Y - c * 100;\n const d = day;\n\n const pD = d;\n const pM = MathFloor(2.6 * m - 0.2);\n const pY = y + MathFloor(y / 4);\n const pC = MathFloor(c / 4) - 2 * c;\n\n const dow = (pD + pM + pY + pC) % 7;\n\n return dow + (dow <= 0 ? 7 : 0);\n}\n\nexport function DayOfYear(year: number, month: number, day: number) {\n let days = day;\n for (let m = month - 1; m > 0; m--) {\n days += ISODaysInMonth(year, m);\n }\n return days;\n}\n\nexport function WeekOfYear(year: number, month: number, day: number) {\n const doy = DayOfYear(year, month, day);\n const dow = DayOfWeek(year, month, day) || 7;\n const doj = DayOfWeek(year, 1, 1);\n\n const week = MathFloor((doy - dow + 10) / 7);\n\n if (week < 1) {\n if (doj === 5 || (doj === 6 && LeapYear(year - 1))) {\n return { week: 53, year: year - 1 };\n } else {\n return { week: 52, year: year - 1 };\n }\n }\n if (week === 53) {\n if ((LeapYear(year) ? 366 : 365) - doy < 4 - dow) {\n return { week: 1, year: year + 1 };\n }\n }\n\n return { week, year };\n}\n\nexport function DurationSign(\n y: number,\n mon: number,\n w: number,\n d: number,\n h: number,\n min: number,\n s: number,\n ms: number,\n µs: number,\n ns: number\n) {\n for (const prop of [y, mon, w, d, h, min, s, ms, µs, ns]) {\n if (prop !== 0) return prop < 0 ? -1 : 1;\n }\n return 0;\n}\n\nfunction BalanceISOYearMonth(yearParam: number, monthParam: number) {\n let year = yearParam;\n let month = monthParam;\n if (!NumberIsFinite(year) || !NumberIsFinite(month)) throw new RangeError('infinity is out of range');\n month -= 1;\n year += MathFloor(month / 12);\n month %= 12;\n if (month < 0) month += 12;\n month += 1;\n return { year, month };\n}\n\nfunction BalanceISODate(yearParam: number, monthParam: number, dayParam: number) {\n let year = yearParam;\n let month = monthParam;\n let day = dayParam;\n if (!NumberIsFinite(day)) throw new RangeError('infinity is out of range');\n ({ year, month } = BalanceISOYearMonth(year, month));\n\n // The pattern of leap years in the ISO 8601 calendar repeats every 400\n // years. So if we have more than 400 years in days, there's no need to\n // convert days to a year 400 times. We can convert a multiple of 400 all at\n // once.\n const daysIn400YearCycle = 400 * 365 + 97;\n if (MathAbs(day) > daysIn400YearCycle) {\n const nCycles = MathTrunc(day / daysIn400YearCycle);\n year += 400 * nCycles;\n day -= nCycles * daysIn400YearCycle;\n }\n\n let daysInYear = 0;\n let testYear = month > 2 ? year : year - 1;\n while (((daysInYear = LeapYear(testYear) ? 366 : 365), day < -daysInYear)) {\n year -= 1;\n testYear -= 1;\n day += daysInYear;\n }\n testYear += 1;\n while (((daysInYear = LeapYear(testYear) ? 366 : 365), day > daysInYear)) {\n year += 1;\n testYear += 1;\n day -= daysInYear;\n }\n\n while (day < 1) {\n ({ year, month } = BalanceISOYearMonth(year, month - 1));\n day += ISODaysInMonth(year, month);\n }\n while (day > ISODaysInMonth(year, month)) {\n day -= ISODaysInMonth(year, month);\n ({ year, month } = BalanceISOYearMonth(year, month + 1));\n }\n\n return { year, month, day };\n}\n\nfunction BalanceISODateTime(\n yearParam: number,\n monthParam: number,\n dayParam: number,\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number\n) {\n const { deltaDays, hour, minute, second, millisecond, microsecond, nanosecond } = BalanceTime(\n hourParam,\n minuteParam,\n secondParam,\n millisecondParam,\n microsecondParam,\n nanosecondParam\n );\n const { year, month, day } = BalanceISODate(yearParam, monthParam, dayParam + deltaDays);\n return { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\nfunction BalanceTime(\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number\n) {\n let hour = JSBI.BigInt(hourParam);\n let minute = JSBI.BigInt(minuteParam);\n let second = JSBI.BigInt(secondParam);\n let millisecond = JSBI.BigInt(millisecondParam);\n let microsecond = JSBI.BigInt(microsecondParam);\n let nanosecond = JSBI.BigInt(nanosecondParam);\n let quotient;\n\n ({ quotient, remainder: nanosecond } = NonNegativeBigIntDivmod(nanosecond, THOUSAND));\n microsecond = JSBI.add(microsecond, quotient);\n\n ({ quotient, remainder: microsecond } = NonNegativeBigIntDivmod(microsecond, THOUSAND));\n millisecond = JSBI.add(millisecond, quotient);\n\n ({ quotient, remainder: millisecond } = NonNegativeBigIntDivmod(millisecond, THOUSAND));\n second = JSBI.add(second, quotient);\n\n ({ quotient, remainder: second } = NonNegativeBigIntDivmod(second, SIXTY));\n minute = JSBI.add(minute, quotient);\n\n ({ quotient, remainder: minute } = NonNegativeBigIntDivmod(minute, SIXTY));\n hour = JSBI.add(hour, quotient);\n\n ({ quotient, remainder: hour } = NonNegativeBigIntDivmod(hour, TWENTY_FOUR));\n\n return {\n deltaDays: JSBI.toNumber(quotient),\n hour: JSBI.toNumber(hour),\n minute: JSBI.toNumber(minute),\n second: JSBI.toNumber(second),\n millisecond: JSBI.toNumber(millisecond),\n microsecond: JSBI.toNumber(microsecond),\n nanosecond: JSBI.toNumber(nanosecond)\n };\n}\n\nexport function TotalDurationNanoseconds(\n daysParam: number,\n hoursParam: number | JSBI,\n minutesParam: number | JSBI,\n secondsParam: number | JSBI,\n millisecondsParam: number | JSBI,\n microsecondsParam: number | JSBI,\n nanosecondsParam: number | JSBI,\n offsetShift: number\n) {\n const days: JSBI = JSBI.BigInt(daysParam);\n let nanoseconds: JSBI = JSBI.BigInt(nanosecondsParam);\n if (daysParam !== 0) nanoseconds = JSBI.subtract(JSBI.BigInt(nanosecondsParam), JSBI.BigInt(offsetShift));\n const hours = JSBI.add(JSBI.BigInt(hoursParam), JSBI.multiply(days, JSBI.BigInt(24)));\n const minutes = JSBI.add(JSBI.BigInt(minutesParam), JSBI.multiply(hours, SIXTY));\n const seconds = JSBI.add(JSBI.BigInt(secondsParam), JSBI.multiply(minutes, SIXTY));\n const milliseconds = JSBI.add(JSBI.BigInt(millisecondsParam), JSBI.multiply(seconds, THOUSAND));\n const microseconds = JSBI.add(JSBI.BigInt(microsecondsParam), JSBI.multiply(milliseconds, THOUSAND));\n return JSBI.add(JSBI.BigInt(nanoseconds), JSBI.multiply(microseconds, THOUSAND));\n}\n\nfunction NanosecondsToDays(nanosecondsParam: JSBI, relativeTo: ReturnType<typeof ToRelativeTemporalObject>) {\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n const sign = MathSign(JSBI.toNumber(nanosecondsParam));\n let nanoseconds = JSBI.BigInt(nanosecondsParam);\n let dayLengthNs = 86400e9;\n if (sign === 0) return { days: 0, nanoseconds: ZERO, dayLengthNs };\n if (!IsTemporalZonedDateTime(relativeTo)) {\n let days: JSBI;\n ({ quotient: days, remainder: nanoseconds } = divmod(nanoseconds, JSBI.BigInt(dayLengthNs)));\n return { days: JSBI.toNumber(days), nanoseconds, dayLengthNs };\n }\n\n const startNs = GetSlot(relativeTo, EPOCHNANOSECONDS);\n const start = GetSlot(relativeTo, INSTANT);\n const endNs = JSBI.add(startNs, nanoseconds);\n const end = new TemporalInstant(endNs);\n const timeZone = GetSlot(relativeTo, TIME_ZONE);\n const calendar = GetSlot(relativeTo, CALENDAR);\n\n // Find the difference in days only.\n const dtStart = GetPlainDateTimeFor(timeZone, start, calendar);\n const dtEnd = GetPlainDateTimeFor(timeZone, end, calendar);\n let { days: daysNumber } = DifferenceISODateTime(\n GetSlot(dtStart, ISO_YEAR),\n GetSlot(dtStart, ISO_MONTH),\n GetSlot(dtStart, ISO_DAY),\n GetSlot(dtStart, ISO_HOUR),\n GetSlot(dtStart, ISO_MINUTE),\n GetSlot(dtStart, ISO_SECOND),\n GetSlot(dtStart, ISO_MILLISECOND),\n GetSlot(dtStart, ISO_MICROSECOND),\n GetSlot(dtStart, ISO_NANOSECOND),\n GetSlot(dtEnd, ISO_YEAR),\n GetSlot(dtEnd, ISO_MONTH),\n GetSlot(dtEnd, ISO_DAY),\n GetSlot(dtEnd, ISO_HOUR),\n GetSlot(dtEnd, ISO_MINUTE),\n GetSlot(dtEnd, ISO_SECOND),\n GetSlot(dtEnd, ISO_MILLISECOND),\n GetSlot(dtEnd, ISO_MICROSECOND),\n GetSlot(dtEnd, ISO_NANOSECOND),\n calendar,\n 'day',\n ObjectCreate(null) as Temporal.DifferenceOptions<Temporal.DateTimeUnit>\n );\n let intermediateNs = AddZonedDateTime(start, timeZone, calendar, 0, 0, 0, daysNumber, 0, 0, 0, 0, 0, 0);\n // may disambiguate\n\n // If clock time after addition was in the middle of a skipped period, the\n // endpoint was disambiguated to a later clock time. So it's possible that\n // the resulting disambiguated result is later than endNs. If so, then back\n // up one day and try again. Repeat if necessary (some transitions are\n // > 24 hours) until either there's zero days left or the date duration is\n // back inside the period where it belongs. Note that this case only can\n // happen for positive durations because the only direction that\n // `disambiguation: 'compatible'` can change clock time is forwards.\n let daysBigInt = JSBI.BigInt(daysNumber);\n if (sign === 1) {\n while (JSBI.greaterThan(daysBigInt, ZERO) && JSBI.greaterThan(intermediateNs, endNs)) {\n daysBigInt = JSBI.subtract(daysBigInt, ONE);\n intermediateNs = AddZonedDateTime(\n start,\n timeZone,\n calendar,\n 0,\n 0,\n 0,\n JSBI.toNumber(daysBigInt),\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n );\n // may do disambiguation\n }\n }\n nanoseconds = JSBI.subtract(endNs, intermediateNs);\n\n let isOverflow = false;\n let relativeInstant = new TemporalInstant(intermediateNs);\n do {\n // calculate length of the next day (day that contains the time remainder)\n const oneDayFartherNs = AddZonedDateTime(relativeInstant, timeZone, calendar, 0, 0, 0, sign, 0, 0, 0, 0, 0, 0);\n const relativeNs = GetSlot(relativeInstant, EPOCHNANOSECONDS);\n dayLengthNs = JSBI.toNumber(JSBI.subtract(oneDayFartherNs, relativeNs));\n isOverflow = JSBI.greaterThanOrEqual(\n JSBI.multiply(JSBI.subtract(nanoseconds, JSBI.BigInt(dayLengthNs)), JSBI.BigInt(sign)),\n ZERO\n );\n if (isOverflow) {\n nanoseconds = JSBI.subtract(nanoseconds, JSBI.BigInt(dayLengthNs));\n relativeInstant = new TemporalInstant(oneDayFartherNs);\n daysBigInt = JSBI.add(daysBigInt, JSBI.BigInt(sign));\n }\n } while (isOverflow);\n if (!isZero(daysBigInt) && signJSBI(daysBigInt) !== sign) {\n throw new RangeError('Time zone or calendar converted nanoseconds into a number of days with the opposite sign');\n }\n if (!isZero(nanoseconds) && signJSBI(nanoseconds) !== sign) {\n if (isNegativeJSBI(nanoseconds) && sign === 1) {\n throw new Error('assert not reached');\n }\n throw new RangeError('Time zone or calendar ended up with a remainder of nanoseconds with the opposite sign');\n }\n if (JSBI.greaterThanOrEqual(abs(nanoseconds), abs(JSBI.BigInt(dayLengthNs)))) {\n throw new Error('assert not reached');\n }\n return { days: JSBI.toNumber(daysBigInt), nanoseconds, dayLengthNs: MathAbs(dayLengthNs) };\n}\n\nexport function BalanceDuration(\n daysParam: number,\n hoursParam: number | JSBI,\n minutesParam: number | JSBI,\n secondsParam: number | JSBI,\n millisecondsParam: number | JSBI,\n microsecondsParam: number | JSBI,\n nanosecondsParam: number | JSBI,\n largestUnit: Temporal.DateTimeUnit,\n relativeTo: ReturnType<typeof ToRelativeTemporalObject> = undefined\n) {\n let result = BalancePossiblyInfiniteDuration(\n daysParam,\n hoursParam,\n minutesParam,\n secondsParam,\n millisecondsParam,\n microsecondsParam,\n nanosecondsParam,\n largestUnit,\n relativeTo\n );\n if (result === 'positive overflow' || result === 'negative overflow') {\n throw new RangeError('Duration out of range');\n } else {\n return result;\n }\n}\n\nexport function BalancePossiblyInfiniteDuration(\n daysParam: number,\n hoursParam: number | JSBI,\n minutesParam: number | JSBI,\n secondsParam: number | JSBI,\n millisecondsParam: number | JSBI,\n microsecondsParam: number | JSBI,\n nanosecondsParam: number | JSBI,\n largestUnit: Temporal.DateTimeUnit,\n relativeTo: ReturnType<typeof ToRelativeTemporalObject> = undefined\n) {\n let days = daysParam;\n let nanosecondsBigInt: JSBI,\n microsecondsBigInt: JSBI,\n millisecondsBigInt: JSBI,\n secondsBigInt: JSBI,\n minutesBigInt: JSBI,\n hoursBigInt: JSBI;\n if (IsTemporalZonedDateTime(relativeTo)) {\n const endNs = AddZonedDateTime(\n GetSlot(relativeTo, INSTANT),\n GetSlot(relativeTo, TIME_ZONE),\n GetSlot(relativeTo, CALENDAR),\n 0,\n 0,\n 0,\n days,\n hoursParam,\n minutesParam,\n secondsParam,\n millisecondsParam,\n microsecondsParam,\n nanosecondsParam\n );\n const startNs = GetSlot(relativeTo, EPOCHNANOSECONDS);\n nanosecondsBigInt = JSBI.subtract(endNs, startNs);\n } else {\n nanosecondsBigInt = TotalDurationNanoseconds(\n days,\n hoursParam,\n minutesParam,\n secondsParam,\n millisecondsParam,\n microsecondsParam,\n nanosecondsParam,\n 0\n );\n }\n if (largestUnit === 'year' || largestUnit === 'month' || largestUnit === 'week' || largestUnit === 'day') {\n ({ days, nanoseconds: nanosecondsBigInt } = NanosecondsToDays(nanosecondsBigInt, relativeTo));\n } else {\n days = 0;\n }\n\n const sign = JSBI.lessThan(nanosecondsBigInt, ZERO) ? -1 : 1;\n nanosecondsBigInt = abs(nanosecondsBigInt);\n microsecondsBigInt = millisecondsBigInt = secondsBigInt = minutesBigInt = hoursBigInt = ZERO;\n\n switch (largestUnit) {\n case 'year':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n ({ quotient: microsecondsBigInt, remainder: nanosecondsBigInt } = divmod(nanosecondsBigInt, THOUSAND));\n ({ quotient: millisecondsBigInt, remainder: microsecondsBigInt } = divmod(microsecondsBigInt, THOUSAND));\n ({ quotient: secondsBigInt, remainder: millisecondsBigInt } = divmod(millisecondsBigInt, THOUSAND));\n ({ quotient: minutesBigInt, remainder: secondsBigInt } = divmod(secondsBigInt, SIXTY));\n ({ quotient: hoursBigInt, remainder: minutesBigInt } = divmod(minutesBigInt, SIXTY));\n break;\n case 'minute':\n ({ quotient: microsecondsBigInt, remainder: nanosecondsBigInt } = divmod(nanosecondsBigInt, THOUSAND));\n ({ quotient: millisecondsBigInt, remainder: microsecondsBigInt } = divmod(microsecondsBigInt, THOUSAND));\n ({ quotient: secondsBigInt, remainder: millisecondsBigInt } = divmod(millisecondsBigInt, THOUSAND));\n ({ quotient: minutesBigInt, remainder: secondsBigInt } = divmod(secondsBigInt, SIXTY));\n break;\n case 'second':\n ({ quotient: microsecondsBigInt, remainder: nanosecondsBigInt } = divmod(nanosecondsBigInt, THOUSAND));\n ({ quotient: millisecondsBigInt, remainder: microsecondsBigInt } = divmod(microsecondsBigInt, THOUSAND));\n ({ quotient: secondsBigInt, remainder: millisecondsBigInt } = divmod(millisecondsBigInt, THOUSAND));\n break;\n case 'millisecond':\n ({ quotient: microsecondsBigInt, remainder: nanosecondsBigInt } = divmod(nanosecondsBigInt, THOUSAND));\n ({ quotient: millisecondsBigInt, remainder: microsecondsBigInt } = divmod(microsecondsBigInt, THOUSAND));\n break;\n case 'microsecond':\n ({ quotient: microsecondsBigInt, remainder: nanosecondsBigInt } = divmod(nanosecondsBigInt, THOUSAND));\n break;\n case 'nanosecond':\n break;\n default:\n throw new Error('assert not reached');\n }\n\n const hours = JSBI.toNumber(hoursBigInt) * sign;\n const minutes = JSBI.toNumber(minutesBigInt) * sign;\n const seconds = JSBI.toNumber(secondsBigInt) * sign;\n const milliseconds = JSBI.toNumber(millisecondsBigInt) * sign;\n const microseconds = JSBI.toNumber(microsecondsBigInt) * sign;\n const nanoseconds = JSBI.toNumber(nanosecondsBigInt) * sign;\n\n for (const prop of [days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds]) {\n if (!NumberIsFinite(prop)) {\n if (sign === 1) {\n return 'positive overflow' as const;\n } else {\n return 'negative overflow' as const;\n }\n }\n }\n\n return { days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\nexport function UnbalanceDurationRelative(\n yearsParam: number,\n monthsParam: number,\n weeksParam: number,\n daysParam: number,\n largestUnit: Temporal.DateTimeUnit,\n relativeToParam: ReturnType<typeof ToRelativeTemporalObject>\n): {\n years: number;\n months: number;\n weeks: number;\n days: number;\n} {\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n const sign = DurationSign(yearsParam, monthsParam, weeksParam, daysParam, 0, 0, 0, 0, 0, 0);\n if (sign === 0) return { years: yearsParam, months: monthsParam, weeks: weeksParam, days: daysParam };\n const signBI = JSBI.BigInt(sign);\n\n let years = JSBI.BigInt(yearsParam);\n let months = JSBI.BigInt(monthsParam);\n let weeks = JSBI.BigInt(weeksParam);\n let days = JSBI.BigInt(daysParam);\n\n let calendar;\n let relativeTo: Temporal.PlainDate | undefined;\n if (relativeToParam) {\n relativeTo = ToTemporalDate(relativeToParam);\n calendar = GetSlot(relativeTo, CALENDAR);\n }\n\n const oneYear = new TemporalDuration(sign);\n const oneMonth = new TemporalDuration(0, sign);\n const oneWeek = new TemporalDuration(0, 0, sign);\n\n switch (largestUnit) {\n case 'year':\n // no-op\n break;\n case 'month':\n {\n if (!calendar) throw new RangeError('a starting point is required for months balancing');\n assertExists(relativeTo);\n // balance years down to months\n let dateAdd, dateUntil;\n if (typeof calendar !== 'string') {\n dateAdd = GetMethod(calendar, 'dateAdd');\n dateUntil = GetMethod(calendar, 'dateUntil');\n }\n while (!isZero(years)) {\n const newRelativeTo = CalendarDateAdd(calendar, relativeTo, oneYear, undefined, dateAdd);\n const untilOptions = ObjectCreate(null) as Temporal.DifferenceOptions<typeof largestUnit>;\n untilOptions.largestUnit = 'month';\n const untilResult = CalendarDateUntil(calendar, relativeTo, newRelativeTo, untilOptions, dateUntil);\n const oneYearMonths = JSBI.BigInt(GetSlot(untilResult, MONTHS));\n relativeTo = newRelativeTo;\n months = JSBI.add(months, oneYearMonths);\n years = JSBI.subtract(years, signBI);\n }\n }\n break;\n case 'week': {\n if (!calendar) throw new RangeError('a starting point is required for weeks balancing');\n assertExists(relativeTo);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n // balance years down to days\n while (!isZero(years)) {\n let oneYearDays;\n ({ relativeTo, days: oneYearDays } = MoveRelativeDate(calendar, relativeTo, oneYear, dateAdd));\n days = JSBI.add(days, JSBI.BigInt(oneYearDays));\n years = JSBI.subtract(years, signBI);\n }\n\n // balance months down to days\n while (!isZero(months)) {\n let oneMonthDays;\n ({ relativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n days = JSBI.add(days, JSBI.BigInt(oneMonthDays));\n months = JSBI.subtract(months, signBI);\n }\n break;\n }\n default: {\n // balance years down to days\n if (isZero(years) && isZero(months) && isZero(weeks)) break;\n if (!calendar) throw new RangeError('a starting point is required for balancing calendar units');\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n while (!isZero(years)) {\n assertExists(relativeTo);\n let oneYearDays;\n ({ relativeTo, days: oneYearDays } = MoveRelativeDate(calendar, relativeTo, oneYear, dateAdd));\n days = JSBI.add(days, JSBI.BigInt(oneYearDays));\n years = JSBI.subtract(years, signBI);\n }\n\n // balance months down to days\n while (!isZero(months)) {\n assertExists(relativeTo);\n let oneMonthDays;\n ({ relativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n days = JSBI.add(days, JSBI.BigInt(oneMonthDays));\n months = JSBI.subtract(months, signBI);\n }\n\n // balance weeks down to days\n while (!isZero(weeks)) {\n assertExists(relativeTo);\n let oneWeekDays;\n ({ relativeTo, days: oneWeekDays } = MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd));\n days = JSBI.add(days, JSBI.BigInt(oneWeekDays));\n weeks = JSBI.subtract(weeks, signBI);\n }\n break;\n }\n }\n\n return {\n years: JSBI.toNumber(years),\n months: JSBI.toNumber(months),\n weeks: JSBI.toNumber(weeks),\n days: JSBI.toNumber(days)\n };\n}\n\nexport function BalanceDurationRelative(\n yearsParam: number,\n monthsParam: number,\n weeksParam: number,\n daysParam: number,\n largestUnit: Temporal.DateTimeUnit,\n relativeToParam: ReturnType<typeof ToRelativeTemporalObject>\n): {\n years: number;\n months: number;\n weeks: number;\n days: number;\n} {\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n const sign = DurationSign(yearsParam, monthsParam, weeksParam, daysParam, 0, 0, 0, 0, 0, 0);\n if (sign === 0) return { years: yearsParam, months: monthsParam, weeks: weeksParam, days: daysParam };\n const signBI = JSBI.BigInt(sign);\n\n let years = JSBI.BigInt(yearsParam);\n let months = JSBI.BigInt(monthsParam);\n let weeks = JSBI.BigInt(weeksParam);\n let days = JSBI.BigInt(daysParam);\n\n let calendar;\n let relativeTo: Temporal.PlainDate | undefined;\n if (relativeToParam) {\n relativeTo = ToTemporalDate(relativeToParam);\n calendar = GetSlot(relativeTo, CALENDAR);\n }\n\n const oneYear = new TemporalDuration(sign);\n const oneMonth = new TemporalDuration(0, sign);\n const oneWeek = new TemporalDuration(0, 0, sign);\n\n switch (largestUnit) {\n case 'year': {\n if (!calendar) throw new RangeError('a starting point is required for years balancing');\n assertExists(relativeTo);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n // balance days up to years\n let newRelativeTo, oneYearDays;\n ({ relativeTo: newRelativeTo, days: oneYearDays } = MoveRelativeDate(calendar, relativeTo, oneYear, dateAdd));\n while (JSBI.greaterThanOrEqual(abs(days), JSBI.BigInt(MathAbs(oneYearDays)))) {\n days = JSBI.subtract(days, JSBI.BigInt(oneYearDays));\n years = JSBI.add(years, signBI);\n relativeTo = newRelativeTo;\n ({ relativeTo: newRelativeTo, days: oneYearDays } = MoveRelativeDate(calendar, relativeTo, oneYear, dateAdd));\n }\n\n // balance days up to months\n let oneMonthDays;\n ({ relativeTo: newRelativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n while (JSBI.greaterThanOrEqual(abs(days), JSBI.BigInt(MathAbs(oneMonthDays)))) {\n days = JSBI.subtract(days, JSBI.BigInt(oneMonthDays));\n months = JSBI.add(months, signBI);\n relativeTo = newRelativeTo;\n ({ relativeTo: newRelativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n }\n\n // balance months up to years\n newRelativeTo = CalendarDateAdd(calendar, relativeTo, oneYear, undefined, dateAdd);\n const dateUntil = typeof calendar !== 'string' ? GetMethod(calendar, 'dateUntil') : undefined;\n const untilOptions = ObjectCreate(null) as Temporal.DifferenceOptions<'month'>;\n untilOptions.largestUnit = 'month';\n let untilResult = CalendarDateUntil(calendar, relativeTo, newRelativeTo, untilOptions, dateUntil);\n let oneYearMonths = GetSlot(untilResult, MONTHS);\n while (JSBI.greaterThanOrEqual(abs(months), JSBI.BigInt(MathAbs(oneYearMonths)))) {\n months = JSBI.subtract(months, JSBI.BigInt(oneYearMonths));\n years = JSBI.add(years, signBI);\n relativeTo = newRelativeTo;\n newRelativeTo = CalendarDateAdd(calendar, relativeTo, oneYear, undefined, dateAdd);\n const untilOptions = ObjectCreate(null) as Temporal.DifferenceOptions<'month'>;\n untilOptions.largestUnit = 'month';\n untilResult = CalendarDateUntil(calendar, relativeTo, newRelativeTo, untilOptions, dateUntil);\n oneYearMonths = GetSlot(untilResult, MONTHS);\n }\n break;\n }\n case 'month': {\n if (!calendar) throw new RangeError('a starting point is required for months balancing');\n assertExists(relativeTo);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n // balance days up to months\n let newRelativeTo, oneMonthDays;\n ({ relativeTo: newRelativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n while (JSBI.greaterThanOrEqual(abs(days), JSBI.BigInt(MathAbs(oneMonthDays)))) {\n days = JSBI.subtract(days, JSBI.BigInt(oneMonthDays));\n months = JSBI.add(months, signBI);\n relativeTo = newRelativeTo;\n ({ relativeTo: newRelativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n }\n break;\n }\n case 'week': {\n if (!calendar) throw new RangeError('a starting point is required for weeks balancing');\n assertExists(relativeTo);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n // balance days up to weeks\n let newRelativeTo, oneWeekDays;\n ({ relativeTo: newRelativeTo, days: oneWeekDays } = MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd));\n while (JSBI.greaterThanOrEqual(abs(days), JSBI.BigInt(MathAbs(oneWeekDays)))) {\n days = JSBI.subtract(days, JSBI.BigInt(oneWeekDays));\n weeks = JSBI.add(weeks, signBI);\n relativeTo = newRelativeTo;\n ({ relativeTo: newRelativeTo, days: oneWeekDays } = MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd));\n }\n break;\n }\n default:\n // no-op\n break;\n }\n\n return {\n years: JSBI.toNumber(years),\n months: JSBI.toNumber(months),\n weeks: JSBI.toNumber(weeks),\n days: JSBI.toNumber(days)\n };\n}\n\nexport function CalculateOffsetShift(\n relativeTo: ReturnType<typeof ToRelativeTemporalObject>,\n y: number,\n mon: number,\n w: number,\n d: number\n) {\n if (IsTemporalZonedDateTime(relativeTo)) {\n const instant = GetSlot(relativeTo, INSTANT);\n const timeZone = GetSlot(relativeTo, TIME_ZONE);\n const calendar = GetSlot(relativeTo, CALENDAR);\n const offsetBefore = GetOffsetNanosecondsFor(timeZone, instant);\n const after = AddZonedDateTime(instant, timeZone, calendar, y, mon, w, d, 0, 0, 0, 0, 0, 0);\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n const instantAfter = new TemporalInstant(after);\n const offsetAfter = GetOffsetNanosecondsFor(timeZone, instantAfter);\n return offsetAfter - offsetBefore;\n }\n return 0;\n}\n\nexport function CreateNegatedTemporalDuration(duration: Temporal.Duration) {\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n return new TemporalDuration(\n -GetSlot(duration, YEARS),\n -GetSlot(duration, MONTHS),\n -GetSlot(duration, WEEKS),\n -GetSlot(duration, DAYS),\n -GetSlot(duration, HOURS),\n -GetSlot(duration, MINUTES),\n -GetSlot(duration, SECONDS),\n -GetSlot(duration, MILLISECONDS),\n -GetSlot(duration, MICROSECONDS),\n -GetSlot(duration, NANOSECONDS)\n );\n}\n\nexport function ConstrainToRange(value: number | undefined, min: number, max: number) {\n // Math.Max accepts undefined values and returns NaN. Undefined values are\n // used for optional params in the method below.\n return MathMin(max, MathMax(min, value as number));\n}\nfunction ConstrainISODate(year: number, monthParam: number, dayParam?: number) {\n const month = ConstrainToRange(monthParam, 1, 12);\n const day = ConstrainToRange(dayParam, 1, ISODaysInMonth(year, month));\n return { year, month, day };\n}\n\nfunction ConstrainTime(\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number\n) {\n const hour = ConstrainToRange(hourParam, 0, 23);\n const minute = ConstrainToRange(minuteParam, 0, 59);\n const second = ConstrainToRange(secondParam, 0, 59);\n const millisecond = ConstrainToRange(millisecondParam, 0, 999);\n const microsecond = ConstrainToRange(microsecondParam, 0, 999);\n const nanosecond = ConstrainToRange(nanosecondParam, 0, 999);\n return { hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\nexport function RejectToRange(value: number, min: number, max: number) {\n if (value < min || value > max) throw new RangeError(`value out of range: ${min} <= ${value} <= ${max}`);\n}\n\nfunction RejectISODate(year: number, month: number, day: number) {\n RejectToRange(month, 1, 12);\n RejectToRange(day, 1, ISODaysInMonth(year, month));\n}\n\nfunction RejectDateRange(year: number, month: number, day: number) {\n // Noon avoids trouble at edges of DateTime range (excludes midnight)\n RejectDateTimeRange(year, month, day, 12, 0, 0, 0, 0, 0);\n}\n\nexport function RejectTime(\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number\n) {\n RejectToRange(hour, 0, 23);\n RejectToRange(minute, 0, 59);\n RejectToRange(second, 0, 59);\n RejectToRange(millisecond, 0, 999);\n RejectToRange(microsecond, 0, 999);\n RejectToRange(nanosecond, 0, 999);\n}\n\nfunction RejectDateTime(\n year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number\n) {\n RejectISODate(year, month, day);\n RejectTime(hour, minute, second, millisecond, microsecond, nanosecond);\n}\n\nfunction RejectDateTimeRange(\n year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number\n) {\n RejectToRange(year, YEAR_MIN, YEAR_MAX);\n // Reject any DateTime 24 hours or more outside the Instant range\n if (\n (year === YEAR_MIN &&\n null ==\n GetUTCEpochNanoseconds(year, month, day + 1, hour, minute, second, millisecond, microsecond, nanosecond - 1)) ||\n (year === YEAR_MAX &&\n null ==\n GetUTCEpochNanoseconds(year, month, day - 1, hour, minute, second, millisecond, microsecond, nanosecond + 1))\n ) {\n throw new RangeError('DateTime outside of supported range');\n }\n}\n\nexport function ValidateEpochNanoseconds(epochNanoseconds: JSBI) {\n if (JSBI.lessThan(epochNanoseconds, NS_MIN) || JSBI.greaterThan(epochNanoseconds, NS_MAX)) {\n throw new RangeError('Instant outside of supported range');\n }\n}\n\nfunction RejectYearMonthRange(year: number, month: number) {\n RejectToRange(year, YEAR_MIN, YEAR_MAX);\n if (year === YEAR_MIN) {\n RejectToRange(month, 4, 12);\n } else if (year === YEAR_MAX) {\n RejectToRange(month, 1, 9);\n }\n}\n\nexport function RejectDuration(\n y: number,\n mon: number,\n w: number,\n d: number,\n h: number,\n min: number,\n s: number,\n ms: number,\n µs: number,\n ns: number\n) {\n const sign = DurationSign(y, mon, w, d, h, min, s, ms, µs, ns);\n for (const prop of [y, mon, w, d, h, min, s, ms, µs, ns]) {\n if (!NumberIsFinite(prop)) throw new RangeError('infinite values not allowed as duration fields');\n const propSign = MathSign(prop);\n if (propSign !== 0 && propSign !== sign) throw new RangeError('mixed-sign values not allowed as duration fields');\n }\n}\n\nexport function DifferenceISODate<Allowed extends Temporal.DateTimeUnit>(\n y1: number,\n m1: number,\n d1: number,\n y2: number,\n m2: number,\n d2: number,\n largestUnit: Allowed\n) {\n switch (largestUnit) {\n case 'year':\n case 'month': {\n const sign = -CompareISODate(y1, m1, d1, y2, m2, d2);\n if (sign === 0) return { years: 0, months: 0, weeks: 0, days: 0 };\n\n const start = { year: y1, month: m1, day: d1 };\n const end = { year: y2, month: m2, day: d2 };\n\n let years = end.year - start.year;\n let mid = AddISODate(y1, m1, d1, years, 0, 0, 0, 'constrain');\n let midSign = -CompareISODate(mid.year, mid.month, mid.day, y2, m2, d2);\n if (midSign === 0) {\n return largestUnit === 'year'\n ? { years, months: 0, weeks: 0, days: 0 }\n : { years: 0, months: years * 12, weeks: 0, days: 0 };\n }\n let months = end.month - start.month;\n if (midSign !== sign) {\n years -= sign;\n months += sign * 12;\n }\n mid = AddISODate(y1, m1, d1, years, months, 0, 0, 'constrain');\n midSign = -CompareISODate(mid.year, mid.month, mid.day, y2, m2, d2);\n if (midSign === 0) {\n return largestUnit === 'year'\n ? { years, months, weeks: 0, days: 0 }\n : { years: 0, months: months + years * 12, weeks: 0, days: 0 };\n }\n if (midSign !== sign) {\n // The end date is later in the month than mid date (or earlier for\n // negative durations). Back up one month.\n months -= sign;\n if (months === -sign) {\n years -= sign;\n months = 11 * sign;\n }\n mid = AddISODate(y1, m1, d1, years, months, 0, 0, 'constrain');\n }\n\n let days = 0;\n // If we get here, months and years are correct (no overflow), and `mid`\n // is within the range from `start` to `end`. To count the days between\n // `mid` and `end`, there are 3 cases:\n // 1) same month: use simple subtraction\n // 2) end is previous month from intermediate (negative duration)\n // 3) end is next month from intermediate (positive duration)\n if (mid.month === end.month) {\n // 1) same month: use simple subtraction\n days = end.day - mid.day;\n } else if (sign < 0) {\n // 2) end is previous month from intermediate (negative duration)\n // Example: intermediate: Feb 1, end: Jan 30, DaysInMonth = 31, days = -2\n days = -mid.day - (ISODaysInMonth(end.year, end.month) - end.day);\n } else {\n // 3) end is next month from intermediate (positive duration)\n // Example: intermediate: Jan 29, end: Feb 1, DaysInMonth = 31, days = 3\n days = end.day + (ISODaysInMonth(mid.year, mid.month) - mid.day);\n }\n\n if (largestUnit === 'month') {\n months += years * 12;\n years = 0;\n }\n return { years, months, weeks: 0, days };\n }\n case 'week':\n case 'day': {\n let larger, smaller, sign;\n if (CompareISODate(y1, m1, d1, y2, m2, d2) < 0) {\n smaller = { year: y1, month: m1, day: d1 };\n larger = { year: y2, month: m2, day: d2 };\n sign = 1;\n } else {\n smaller = { year: y2, month: m2, day: d2 };\n larger = { year: y1, month: m1, day: d1 };\n sign = -1;\n }\n let days = DayOfYear(larger.year, larger.month, larger.day) - DayOfYear(smaller.year, smaller.month, smaller.day);\n for (let year = smaller.year; year < larger.year; ++year) {\n days += LeapYear(year) ? 366 : 365;\n }\n let weeks = 0;\n if (largestUnit === 'week') {\n weeks = MathFloor(days / 7);\n days %= 7;\n }\n weeks *= sign;\n days *= sign;\n return { years: 0, months: 0, weeks, days };\n }\n default:\n throw new Error('assert not reached');\n }\n}\n\nfunction DifferenceTime(\n h1: number,\n min1: number,\n s1: number,\n ms1: number,\n µs1: number,\n ns1: number,\n h2: number,\n min2: number,\n s2: number,\n ms2: number,\n µs2: number,\n ns2: number\n) {\n let hours = h2 - h1;\n let minutes = min2 - min1;\n let seconds = s2 - s1;\n let milliseconds = ms2 - ms1;\n let microseconds = µs2 - µs1;\n let nanoseconds = ns2 - ns1;\n\n const sign = DurationSign(0, 0, 0, 0, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n hours *= sign;\n minutes *= sign;\n seconds *= sign;\n milliseconds *= sign;\n microseconds *= sign;\n nanoseconds *= sign;\n\n let deltaDays = 0;\n ({\n deltaDays,\n hour: hours,\n minute: minutes,\n second: seconds,\n millisecond: milliseconds,\n microsecond: microseconds,\n nanosecond: nanoseconds\n } = BalanceTime(hours, minutes, seconds, milliseconds, microseconds, nanoseconds));\n\n if (deltaDays != 0) throw new Error('assertion failure in DifferenceTime: _bt_.[[Days]] should be 0');\n hours *= sign;\n minutes *= sign;\n seconds *= sign;\n milliseconds *= sign;\n microseconds *= sign;\n nanoseconds *= sign;\n\n return { hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\nfunction DifferenceInstant(\n ns1: JSBI,\n ns2: JSBI,\n increment: number,\n smallestUnit: keyof typeof nsPerTimeUnit,\n largestUnit: keyof typeof nsPerTimeUnit,\n roundingMode: Temporal.RoundingMode\n) {\n const diff = JSBI.subtract(ns2, ns1);\n\n let hours = 0;\n let minutes = 0;\n let nanoseconds = JSBI.toNumber(JSBI.remainder(diff, THOUSAND));\n let microseconds = JSBI.toNumber(JSBI.remainder(JSBI.divide(diff, THOUSAND), THOUSAND));\n let milliseconds = JSBI.toNumber(JSBI.remainder(JSBI.divide(diff, MILLION), THOUSAND));\n let seconds = JSBI.toNumber(JSBI.divide(diff, BILLION));\n\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = RoundDuration(\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n increment,\n smallestUnit,\n roundingMode\n ));\n return BalanceDuration(0, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, largestUnit);\n}\n\nfunction DifferenceISODateTime(\n y1Param: number,\n mon1Param: number,\n d1Param: number,\n h1: number,\n min1: number,\n s1: number,\n ms1: number,\n µs1: number,\n ns1: number,\n y2: number,\n mon2: number,\n d2: number,\n h2: number,\n min2: number,\n s2: number,\n ms2: number,\n µs2: number,\n ns2: number,\n calendar: CalendarSlot,\n largestUnit: Temporal.DateTimeUnit,\n options: Temporal.DifferenceOptions<Temporal.DateTimeUnit> | undefined\n) {\n let y1 = y1Param;\n let mon1 = mon1Param;\n let d1 = d1Param;\n\n let { hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = DifferenceTime(\n h1,\n min1,\n s1,\n ms1,\n µs1,\n ns1,\n h2,\n min2,\n s2,\n ms2,\n µs2,\n ns2\n );\n\n const timeSign = DurationSign(0, 0, 0, 0, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n const dateSign = CompareISODate(y2, mon2, d2, y1, mon1, d1);\n if (dateSign === -timeSign) {\n ({ year: y1, month: mon1, day: d1 } = BalanceISODate(y1, mon1, d1 - timeSign));\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n -timeSign,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n largestUnit\n ));\n }\n\n const date1 = CreateTemporalDate(y1, mon1, d1, calendar);\n const date2 = CreateTemporalDate(y2, mon2, d2, calendar);\n const dateLargestUnit = LargerOfTwoTemporalUnits('day', largestUnit);\n const untilOptions = CopyOptions(options);\n untilOptions.largestUnit = dateLargestUnit;\n // TODO untilOptions doesn't want to compile as it seems that smallestUnit is not clamped?\n // Type 'SmallestUnit<DateTimeUnit> | undefined' is not assignable to type\n // 'SmallestUnit<\"year\" | \"month\" | \"day\" | \"week\"> | undefined'.\n // Type '\"hour\"' is not assignable to type\n // 'SmallestUnit<\"year\" | \"month\" | \"day\" | \"week\"> | undefined'.ts(2345)\n let { years, months, weeks, days } = CalendarDateUntil(calendar, date1, date2, untilOptions as any);\n // Signs of date part and time part may not agree; balance them together\n ({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n largestUnit\n ));\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\nfunction DifferenceZonedDateTime(\n ns1: JSBI,\n ns2: JSBI,\n timeZone: string | Temporal.TimeZoneProtocol,\n calendar: CalendarSlot,\n largestUnit: Temporal.DateTimeUnit,\n options: Temporal.DifferenceOptions<Temporal.DateTimeUnit>\n) {\n const nsDiff = JSBI.subtract(ns2, ns1);\n if (JSBI.equal(nsDiff, ZERO)) {\n return {\n years: 0,\n months: 0,\n weeks: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0,\n microseconds: 0,\n nanoseconds: 0\n };\n }\n\n // Find the difference in dates only.\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n const start = new TemporalInstant(ns1);\n const end = new TemporalInstant(ns2);\n const dtStart = GetPlainDateTimeFor(timeZone, start, calendar);\n const dtEnd = GetPlainDateTimeFor(timeZone, end, calendar);\n let { years, months, weeks, days } = DifferenceISODateTime(\n GetSlot(dtStart, ISO_YEAR),\n GetSlot(dtStart, ISO_MONTH),\n GetSlot(dtStart, ISO_DAY),\n GetSlot(dtStart, ISO_HOUR),\n GetSlot(dtStart, ISO_MINUTE),\n GetSlot(dtStart, ISO_SECOND),\n GetSlot(dtStart, ISO_MILLISECOND),\n GetSlot(dtStart, ISO_MICROSECOND),\n GetSlot(dtStart, ISO_NANOSECOND),\n GetSlot(dtEnd, ISO_YEAR),\n GetSlot(dtEnd, ISO_MONTH),\n GetSlot(dtEnd, ISO_DAY),\n GetSlot(dtEnd, ISO_HOUR),\n GetSlot(dtEnd, ISO_MINUTE),\n GetSlot(dtEnd, ISO_SECOND),\n GetSlot(dtEnd, ISO_MILLISECOND),\n GetSlot(dtEnd, ISO_MICROSECOND),\n GetSlot(dtEnd, ISO_NANOSECOND),\n calendar,\n largestUnit,\n options\n );\n const intermediateNs = AddZonedDateTime(start, timeZone, calendar, years, months, weeks, 0, 0, 0, 0, 0, 0, 0);\n // may disambiguate\n let timeRemainderNs = JSBI.subtract(ns2, intermediateNs);\n const intermediate = CreateTemporalZonedDateTime(intermediateNs, timeZone, calendar);\n ({ nanoseconds: timeRemainderNs, days } = NanosecondsToDays(timeRemainderNs, intermediate));\n\n // Finally, merge the date and time durations and return the merged result.\n const { hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n JSBI.toNumber(timeRemainderNs),\n 'hour'\n );\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\ntype DifferenceOperation = 'since' | 'until';\n\nfunction GetDifferenceSettings<T extends Temporal.DateTimeUnit>(\n op: DifferenceOperation,\n options: Temporal.DifferenceOptions<T>,\n group: 'datetime' | 'date' | 'time',\n disallowed: (Temporal.DateTimeUnit | 'auto')[],\n fallbackSmallest: T,\n smallestLargestDefaultUnit: T\n) {\n const ALLOWED_UNITS = SINGULAR_PLURAL_UNITS.reduce((allowed, unitInfo) => {\n const p = unitInfo[0];\n const s = unitInfo[1];\n const c = unitInfo[2];\n if ((group === 'datetime' || c === group) && !disallowed.includes(s)) {\n allowed.push(s, p);\n }\n return allowed;\n }, [] as (Temporal.DateTimeUnit | Temporal.PluralUnit<Temporal.DateTimeUnit>)[]);\n\n let largestUnit = GetTemporalUnit(options, 'largestUnit', group, 'auto');\n if (disallowed.includes(largestUnit)) {\n throw new RangeError(`largestUnit must be one of ${ALLOWED_UNITS.join(', ')}, not ${largestUnit}`);\n }\n\n const roundingIncrement = ToTemporalRoundingIncrement(options);\n\n let roundingMode = ToTemporalRoundingMode(options, 'trunc');\n if (op === 'since') roundingMode = NegateTemporalRoundingMode(roundingMode);\n\n const smallestUnit = GetTemporalUnit(options, 'smallestUnit', group, fallbackSmallest);\n if (disallowed.includes(smallestUnit)) {\n throw new RangeError(`smallestUnit must be one of ${ALLOWED_UNITS.join(', ')}, not ${smallestUnit}`);\n }\n\n const defaultLargestUnit = LargerOfTwoTemporalUnits(smallestLargestDefaultUnit, smallestUnit);\n if (largestUnit === 'auto') largestUnit = defaultLargestUnit;\n if (LargerOfTwoTemporalUnits(largestUnit, smallestUnit) !== largestUnit) {\n throw new RangeError(`largestUnit ${largestUnit} cannot be smaller than smallestUnit ${smallestUnit}`);\n }\n const MAX_DIFFERENCE_INCREMENTS: { [k in Temporal.DateTimeUnit]?: number } = {\n hour: 24,\n minute: 60,\n second: 60,\n millisecond: 1000,\n microsecond: 1000,\n nanosecond: 1000\n };\n const maximum = MAX_DIFFERENCE_INCREMENTS[smallestUnit];\n if (maximum !== undefined) ValidateTemporalRoundingIncrement(roundingIncrement, maximum, false);\n\n return { largestUnit: largestUnit as T, roundingIncrement, roundingMode, smallestUnit: smallestUnit as T };\n}\n\nexport function DifferenceTemporalInstant(\n operation: DifferenceOperation,\n instant: Temporal.Instant,\n otherParam: InstantParams['until'][0],\n options: InstantParams['until'][1] | undefined\n): Temporal.Duration {\n const sign = operation === 'since' ? -1 : 1;\n const other = ToTemporalInstant(otherParam);\n\n const resolvedOptions = CopyOptions(options);\n const settings = GetDifferenceSettings(operation, resolvedOptions, 'time', [], 'nanosecond', 'second');\n\n const onens = GetSlot(instant, EPOCHNANOSECONDS);\n const twons = GetSlot(other, EPOCHNANOSECONDS);\n let { hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = DifferenceInstant(\n onens,\n twons,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.largestUnit,\n settings.roundingMode\n );\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(\n 0,\n 0,\n 0,\n 0,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds\n );\n}\n\nexport function DifferenceTemporalPlainDate(\n operation: DifferenceOperation,\n plainDate: Temporal.PlainDate,\n otherParam: PlainDateParams['until'][0],\n options: PlainDateParams['until'][1]\n): Temporal.Duration {\n const sign = operation === 'since' ? -1 : 1;\n const other = ToTemporalDate(otherParam);\n const calendar = GetSlot(plainDate, CALENDAR);\n const otherCalendar = GetSlot(other, CALENDAR);\n ThrowIfCalendarsNotEqual(calendar, otherCalendar, 'compute difference between dates');\n\n const resolvedOptions = CopyOptions(options);\n const settings = GetDifferenceSettings(operation, resolvedOptions, 'date', [], 'day', 'day');\n resolvedOptions.largestUnit = settings.largestUnit;\n\n let { years, months, weeks, days } = CalendarDateUntil(calendar, plainDate, other, resolvedOptions);\n\n if (settings.smallestUnit !== 'day' || settings.roundingIncrement !== 1) {\n ({ years, months, weeks, days } = RoundDuration(\n years,\n months,\n weeks,\n days,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.roundingMode,\n plainDate\n ));\n }\n\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(sign * years, sign * months, sign * weeks, sign * days, 0, 0, 0, 0, 0, 0);\n}\n\nexport function DifferenceTemporalPlainDateTime(\n operation: DifferenceOperation,\n plainDateTime: Temporal.PlainDateTime,\n otherParam: PlainDateTimeParams['until'][0],\n options: PlainDateTimeParams['until'][1]\n): Temporal.Duration {\n const sign = operation === 'since' ? -1 : 1;\n const other = ToTemporalDateTime(otherParam);\n const calendar = GetSlot(plainDateTime, CALENDAR);\n const otherCalendar = GetSlot(other, CALENDAR);\n ThrowIfCalendarsNotEqual(calendar, otherCalendar, 'compute difference between dates');\n\n const resolvedOptions = CopyOptions(options);\n const settings = GetDifferenceSettings(operation, resolvedOptions, 'datetime', [], 'nanosecond', 'day');\n\n let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n DifferenceISODateTime(\n GetSlot(plainDateTime, ISO_YEAR),\n GetSlot(plainDateTime, ISO_MONTH),\n GetSlot(plainDateTime, ISO_DAY),\n GetSlot(plainDateTime, ISO_HOUR),\n GetSlot(plainDateTime, ISO_MINUTE),\n GetSlot(plainDateTime, ISO_SECOND),\n GetSlot(plainDateTime, ISO_MILLISECOND),\n GetSlot(plainDateTime, ISO_MICROSECOND),\n GetSlot(plainDateTime, ISO_NANOSECOND),\n GetSlot(other, ISO_YEAR),\n GetSlot(other, ISO_MONTH),\n GetSlot(other, ISO_DAY),\n GetSlot(other, ISO_HOUR),\n GetSlot(other, ISO_MINUTE),\n GetSlot(other, ISO_SECOND),\n GetSlot(other, ISO_MILLISECOND),\n GetSlot(other, ISO_MICROSECOND),\n GetSlot(other, ISO_NANOSECOND),\n calendar,\n settings.largestUnit,\n resolvedOptions\n );\n\n const relativeTo = TemporalDateTimeToDate(plainDateTime);\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = RoundDuration(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.roundingMode,\n relativeTo\n ));\n ({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n settings.largestUnit\n ));\n\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(\n sign * years,\n sign * months,\n sign * weeks,\n sign * days,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds\n );\n}\n\nexport function DifferenceTemporalPlainTime(\n operation: DifferenceOperation,\n plainTime: Temporal.PlainTime,\n otherParam: PlainTimeParams['until'][0],\n options: PlainTimeParams['until'][1]\n): Temporal.Duration {\n const sign = operation === 'since' ? -1 : 1;\n const other = ToTemporalTime(otherParam);\n\n const resolvedOptions = CopyOptions(options);\n const settings = GetDifferenceSettings(operation, resolvedOptions, 'time', [], 'nanosecond', 'hour');\n\n let { hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = DifferenceTime(\n GetSlot(plainTime, ISO_HOUR),\n GetSlot(plainTime, ISO_MINUTE),\n GetSlot(plainTime, ISO_SECOND),\n GetSlot(plainTime, ISO_MILLISECOND),\n GetSlot(plainTime, ISO_MICROSECOND),\n GetSlot(plainTime, ISO_NANOSECOND),\n GetSlot(other, ISO_HOUR),\n GetSlot(other, ISO_MINUTE),\n GetSlot(other, ISO_SECOND),\n GetSlot(other, ISO_MILLISECOND),\n GetSlot(other, ISO_MICROSECOND),\n GetSlot(other, ISO_NANOSECOND)\n );\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = RoundDuration(\n 0,\n 0,\n 0,\n 0,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.roundingMode\n ));\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n 0,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n settings.largestUnit\n ));\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(\n 0,\n 0,\n 0,\n 0,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds\n );\n}\n\nexport function DifferenceTemporalPlainYearMonth(\n operation: DifferenceOperation,\n yearMonth: Temporal.PlainYearMonth,\n otherParam: PlainYearMonthParams['until'][0],\n options: PlainYearMonthParams['until'][1]\n): Temporal.Duration {\n const sign = operation === 'since' ? -1 : 1;\n const other = ToTemporalYearMonth(otherParam);\n const calendar = GetSlot(yearMonth, CALENDAR);\n const otherCalendar = GetSlot(other, CALENDAR);\n ThrowIfCalendarsNotEqual(calendar, otherCalendar, 'compute difference between months');\n\n const resolvedOptions = CopyOptions(options);\n const settings = GetDifferenceSettings(operation, resolvedOptions, 'date', ['week', 'day'], 'month', 'year');\n resolvedOptions.largestUnit = settings.largestUnit;\n\n const fieldNames = CalendarFields(calendar, ['monthCode', 'year']) as AnyTemporalKey[];\n const thisFields = PrepareTemporalFields(yearMonth, fieldNames, []);\n thisFields.day = 1;\n const thisDate = CalendarDateFromFields(calendar, thisFields);\n const otherFields = PrepareTemporalFields(other, fieldNames, []);\n otherFields.day = 1;\n const otherDate = CalendarDateFromFields(calendar, otherFields);\n\n let { years, months } = CalendarDateUntil(calendar, thisDate, otherDate, resolvedOptions);\n\n if (settings.smallestUnit !== 'month' || settings.roundingIncrement !== 1) {\n ({ years, months } = RoundDuration(\n years,\n months,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.roundingMode,\n thisDate\n ));\n }\n\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(sign * years, sign * months, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n\nexport function DifferenceTemporalZonedDateTime(\n operation: DifferenceOperation,\n zonedDateTime: Temporal.ZonedDateTime,\n otherParam: ZonedDateTimeParams['until'][0],\n options: ZonedDateTimeParams['until'][1]\n): Temporal.Duration {\n const sign = operation === 'since' ? -1 : 1;\n const other = ToTemporalZonedDateTime(otherParam);\n const calendar = GetSlot(zonedDateTime, CALENDAR);\n const otherCalendar = GetSlot(other, CALENDAR);\n ThrowIfCalendarsNotEqual(calendar, otherCalendar, 'compute difference between dates');\n\n const resolvedOptions = CopyOptions(options);\n const settings = GetDifferenceSettings(operation, resolvedOptions, 'datetime', [], 'nanosecond', 'hour');\n resolvedOptions.largestUnit = settings.largestUnit;\n\n const ns1 = GetSlot(zonedDateTime, EPOCHNANOSECONDS);\n const ns2 = GetSlot(other, EPOCHNANOSECONDS);\n let years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds;\n if (\n settings.largestUnit !== 'year' &&\n settings.largestUnit !== 'month' &&\n settings.largestUnit !== 'week' &&\n settings.largestUnit !== 'day'\n ) {\n // The user is only asking for a time difference, so return difference of instants.\n years = 0;\n months = 0;\n weeks = 0;\n days = 0;\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = DifferenceInstant(\n ns1,\n ns2,\n settings.roundingIncrement,\n settings.smallestUnit as Temporal.TimeUnit,\n settings.largestUnit as Temporal.TimeUnit,\n settings.roundingMode\n ));\n } else {\n const timeZone = GetSlot(zonedDateTime, TIME_ZONE);\n if (!TimeZoneEquals(timeZone, GetSlot(other, TIME_ZONE))) {\n throw new RangeError(\n \"When calculating difference between time zones, largestUnit must be 'hours' \" +\n 'or smaller because day lengths can vary between time zones due to DST or time zone offset changes.'\n );\n }\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n DifferenceZonedDateTime(ns1, ns2, timeZone, calendar, settings.largestUnit, resolvedOptions));\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = RoundDuration(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.roundingMode,\n zonedDateTime\n ));\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n AdjustRoundedDurationDays(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n settings.roundingIncrement,\n settings.smallestUnit,\n settings.roundingMode,\n zonedDateTime\n ));\n }\n\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(\n sign * years,\n sign * months,\n sign * weeks,\n sign * days,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds\n );\n}\n\nexport function AddISODate(\n yearParam: number,\n monthParam: number,\n dayParam: number,\n yearsParam: number,\n monthsParam: number,\n weeksParam: number,\n daysParam: number,\n overflow: Temporal.ArithmeticOptions['overflow']\n) {\n let year = yearParam;\n let month = monthParam;\n let day = dayParam;\n let years = yearsParam;\n let months = monthsParam;\n let weeks = weeksParam;\n let days = daysParam;\n\n year += years;\n month += months;\n ({ year, month } = BalanceISOYearMonth(year, month));\n ({ year, month, day } = RegulateISODate(year, month, day, overflow));\n days += 7 * weeks;\n day += days;\n ({ year, month, day } = BalanceISODate(year, month, day));\n return { year, month, day };\n}\n\nfunction AddTime(\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number,\n hours: number,\n minutes: number,\n seconds: number,\n milliseconds: number,\n microseconds: number,\n nanoseconds: number\n) {\n let hour = hourParam;\n let minute = minuteParam;\n let second = secondParam;\n let millisecond = millisecondParam;\n let microsecond = microsecondParam;\n let nanosecond = nanosecondParam;\n\n hour += hours;\n minute += minutes;\n second += seconds;\n millisecond += milliseconds;\n microsecond += microseconds;\n nanosecond += nanoseconds;\n let deltaDays = 0;\n ({ deltaDays, hour, minute, second, millisecond, microsecond, nanosecond } = BalanceTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond\n ));\n return { deltaDays, hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\nfunction AddDuration(\n y1: number,\n mon1: number,\n w1: number,\n d1: number,\n h1: number,\n min1: number,\n s1: number,\n ms1: number,\n µs1: number,\n ns1: number,\n y2: number,\n mon2: number,\n w2: number,\n d2: number,\n h2: number,\n min2: number,\n s2: number,\n ms2: number,\n µs2: number,\n ns2: number,\n relativeTo: ReturnType<typeof ToRelativeTemporalObject>\n) {\n const largestUnit1 = DefaultTemporalLargestUnit(y1, mon1, w1, d1, h1, min1, s1, ms1, µs1, ns1);\n const largestUnit2 = DefaultTemporalLargestUnit(y2, mon2, w2, d2, h2, min2, s2, ms2, µs2, ns2);\n const largestUnit = LargerOfTwoTemporalUnits(largestUnit1, largestUnit2);\n\n let years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds;\n if (!relativeTo) {\n if (largestUnit === 'year' || largestUnit === 'month' || largestUnit === 'week') {\n throw new RangeError('relativeTo is required for years, months, or weeks arithmetic');\n }\n years = months = weeks = 0;\n ({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n d1 + d2,\n JSBI.add(JSBI.BigInt(h1), JSBI.BigInt(h2)),\n JSBI.add(JSBI.BigInt(min1), JSBI.BigInt(min2)),\n JSBI.add(JSBI.BigInt(s1), JSBI.BigInt(s2)),\n JSBI.add(JSBI.BigInt(ms1), JSBI.BigInt(ms2)),\n JSBI.add(JSBI.BigInt(µs1), JSBI.BigInt(µs2)),\n JSBI.add(JSBI.BigInt(ns1), JSBI.BigInt(ns2)),\n largestUnit\n ));\n } else if (IsTemporalDate(relativeTo)) {\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n const calendar = GetSlot(relativeTo, CALENDAR);\n\n const dateDuration1 = new TemporalDuration(y1, mon1, w1, d1, 0, 0, 0, 0, 0, 0);\n const dateDuration2 = new TemporalDuration(y2, mon2, w2, d2, 0, 0, 0, 0, 0, 0);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n const intermediate = CalendarDateAdd(calendar, relativeTo, dateDuration1, undefined, dateAdd);\n const end = CalendarDateAdd(calendar, intermediate, dateDuration2, undefined, dateAdd);\n\n const dateLargestUnit = LargerOfTwoTemporalUnits('day', largestUnit) as Temporal.DateUnit;\n const differenceOptions = ObjectCreate(null) as Temporal.DifferenceOptions<Temporal.DateUnit>;\n differenceOptions.largestUnit = dateLargestUnit;\n ({ years, months, weeks, days } = CalendarDateUntil(calendar, relativeTo, end, differenceOptions));\n // Signs of date part and time part may not agree; balance them together\n ({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n days,\n JSBI.add(JSBI.BigInt(h1), JSBI.BigInt(h2)),\n JSBI.add(JSBI.BigInt(min1), JSBI.BigInt(min2)),\n JSBI.add(JSBI.BigInt(s1), JSBI.BigInt(s2)),\n JSBI.add(JSBI.BigInt(ms1), JSBI.BigInt(ms2)),\n JSBI.add(JSBI.BigInt(µs1), JSBI.BigInt(µs2)),\n JSBI.add(JSBI.BigInt(ns1), JSBI.BigInt(ns2)),\n largestUnit\n ));\n } else {\n // relativeTo is a ZonedDateTime\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n const timeZone = GetSlot(relativeTo, TIME_ZONE);\n const calendar = GetSlot(relativeTo, CALENDAR);\n const intermediateNs = AddZonedDateTime(\n GetSlot(relativeTo, INSTANT),\n timeZone,\n calendar,\n y1,\n mon1,\n w1,\n d1,\n h1,\n min1,\n s1,\n ms1,\n µs1,\n ns1\n );\n const endNs = AddZonedDateTime(\n new TemporalInstant(intermediateNs),\n timeZone,\n calendar,\n y2,\n mon2,\n w2,\n d2,\n h2,\n min2,\n s2,\n ms2,\n µs2,\n ns2\n );\n if (largestUnit !== 'year' && largestUnit !== 'month' && largestUnit !== 'week' && largestUnit !== 'day') {\n // The user is only asking for a time difference, so return difference of instants.\n years = 0;\n months = 0;\n weeks = 0;\n days = 0;\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = DifferenceInstant(\n GetSlot(relativeTo, EPOCHNANOSECONDS),\n endNs,\n 1,\n 'nanosecond',\n largestUnit,\n 'halfExpand'\n ));\n } else {\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n DifferenceZonedDateTime(\n GetSlot(relativeTo, EPOCHNANOSECONDS),\n endNs,\n timeZone,\n calendar,\n largestUnit,\n ObjectCreate(null) as Temporal.DifferenceOptions<Temporal.DateTimeUnit>\n ));\n }\n }\n\n RejectDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\nfunction AddInstant(\n epochNanoseconds: JSBI,\n h: number | JSBI,\n min: number | JSBI,\n s: number | JSBI,\n ms: number | JSBI,\n µs: number | JSBI,\n ns: number | JSBI\n) {\n let sum = ZERO;\n sum = JSBI.add(sum, JSBI.BigInt(ns));\n sum = JSBI.add(sum, JSBI.multiply(JSBI.BigInt(µs), THOUSAND));\n sum = JSBI.add(sum, JSBI.multiply(JSBI.BigInt(ms), MILLION));\n sum = JSBI.add(sum, JSBI.multiply(JSBI.BigInt(s), BILLION));\n sum = JSBI.add(sum, JSBI.multiply(JSBI.BigInt(min), JSBI.BigInt(60 * 1e9)));\n sum = JSBI.add(sum, JSBI.multiply(JSBI.BigInt(h), JSBI.BigInt(60 * 60 * 1e9)));\n\n const result = JSBI.add(epochNanoseconds, sum);\n ValidateEpochNanoseconds(result);\n return result;\n}\n\nfunction AddDateTime(\n year: number,\n month: number,\n day: number,\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number,\n calendar: CalendarSlot,\n years: number,\n months: number,\n weeks: number,\n daysParam: number,\n hours: number,\n minutes: number,\n seconds: number,\n milliseconds: number,\n microseconds: number,\n nanoseconds: number,\n options?: Temporal.ArithmeticOptions\n) {\n let days = daysParam;\n // Add the time part\n let { deltaDays, hour, minute, second, millisecond, microsecond, nanosecond } = AddTime(\n hourParam,\n minuteParam,\n secondParam,\n millisecondParam,\n microsecondParam,\n nanosecondParam,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds\n );\n days += deltaDays;\n\n // Delegate the date part addition to the calendar\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n const datePart = CreateTemporalDate(year, month, day, calendar);\n const dateDuration = new TemporalDuration(years, months, weeks, days, 0, 0, 0, 0, 0, 0);\n const addedDate = CalendarDateAdd(calendar, datePart, dateDuration, options);\n\n return {\n year: GetSlot(addedDate, ISO_YEAR),\n month: GetSlot(addedDate, ISO_MONTH),\n day: GetSlot(addedDate, ISO_DAY),\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond\n };\n}\n\nexport function AddZonedDateTime(\n instant: Temporal.Instant,\n timeZone: string | Temporal.TimeZoneProtocol,\n calendar: CalendarSlot,\n years: number,\n months: number,\n weeks: number,\n days: number,\n h: number | JSBI,\n min: number | JSBI,\n s: number | JSBI,\n ms: number | JSBI,\n µs: number | JSBI,\n ns: number | JSBI,\n options?: Temporal.ArithmeticOptions\n) {\n // If only time is to be added, then use Instant math. It's not OK to fall\n // through to the date/time code below because compatible disambiguation in\n // the PlainDateTime=>Instant conversion will change the offset of any\n // ZonedDateTime in the repeated clock time after a backwards transition.\n // When adding/subtracting time units and not dates, this disambiguation is\n // not expected and so is avoided below via a fast path for time-only\n // arithmetic.\n // BTW, this behavior is similar in spirit to offset: 'prefer' in `with`.\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n if (DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0) === 0) {\n return AddInstant(GetSlot(instant, EPOCHNANOSECONDS), h, min, s, ms, µs, ns);\n }\n\n // RFC 5545 requires the date portion to be added in calendar days and the\n // time portion to be added in exact time.\n const dt = GetPlainDateTimeFor(timeZone, instant, calendar);\n const datePart = CreateTemporalDate(GetSlot(dt, ISO_YEAR), GetSlot(dt, ISO_MONTH), GetSlot(dt, ISO_DAY), calendar);\n const dateDuration = new TemporalDuration(years, months, weeks, days, 0, 0, 0, 0, 0, 0);\n const addedDate = CalendarDateAdd(calendar, datePart, dateDuration, options);\n const dtIntermediate = CreateTemporalDateTime(\n GetSlot(addedDate, ISO_YEAR),\n GetSlot(addedDate, ISO_MONTH),\n GetSlot(addedDate, ISO_DAY),\n GetSlot(dt, ISO_HOUR),\n GetSlot(dt, ISO_MINUTE),\n GetSlot(dt, ISO_SECOND),\n GetSlot(dt, ISO_MILLISECOND),\n GetSlot(dt, ISO_MICROSECOND),\n GetSlot(dt, ISO_NANOSECOND),\n calendar\n );\n\n // Note that 'compatible' is used below because this disambiguation behavior\n // is required by RFC 5545.\n const instantIntermediate = GetInstantFor(timeZone, dtIntermediate, 'compatible');\n return AddInstant(GetSlot(instantIntermediate, EPOCHNANOSECONDS), h, min, s, ms, µs, ns);\n}\n\ntype AddSubtractOperation = 'add' | 'subtract';\n\nexport function AddDurationToOrSubtractDurationFromDuration(\n operation: AddSubtractOperation,\n duration: Temporal.Duration,\n other: DurationParams['add'][0],\n optionsParam: DurationParams['add'][1]\n): Temporal.Duration {\n const sign = operation === 'subtract' ? -1 : 1;\n let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n ToTemporalDurationRecord(other);\n const options = GetOptionsObject(optionsParam);\n const relativeTo = ToRelativeTemporalObject(options);\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = AddDuration(\n GetSlot(duration, YEARS),\n GetSlot(duration, MONTHS),\n GetSlot(duration, WEEKS),\n GetSlot(duration, DAYS),\n GetSlot(duration, HOURS),\n GetSlot(duration, MINUTES),\n GetSlot(duration, SECONDS),\n GetSlot(duration, MILLISECONDS),\n GetSlot(duration, MICROSECONDS),\n GetSlot(duration, NANOSECONDS),\n sign * years,\n sign * months,\n sign * weeks,\n sign * days,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds,\n relativeTo\n ));\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n}\n\nexport function AddDurationToOrSubtractDurationFromInstant(\n operation: AddSubtractOperation,\n instant: Temporal.Instant,\n durationLike: InstantParams['add'][0]\n): Temporal.Instant {\n const sign = operation === 'subtract' ? -1 : 1;\n const { hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ToLimitedTemporalDuration(durationLike, [\n 'years',\n 'months',\n 'weeks',\n 'days'\n ]);\n const ns = AddInstant(\n GetSlot(instant, EPOCHNANOSECONDS),\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds\n );\n const Instant = GetIntrinsic('%Temporal.Instant%');\n return new Instant(ns);\n}\n\nexport function AddDurationToOrSubtractDurationFromPlainDateTime(\n operation: AddSubtractOperation,\n dateTime: Temporal.PlainDateTime,\n durationLike: PlainDateTimeParams['add'][0],\n optionsParam: PlainDateTimeParams['add'][1]\n): Temporal.PlainDateTime {\n const sign = operation === 'subtract' ? -1 : 1;\n const { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n ToTemporalDurationRecord(durationLike);\n const options = GetOptionsObject(optionsParam);\n const calendar = GetSlot(dateTime, CALENDAR);\n const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = AddDateTime(\n GetSlot(dateTime, ISO_YEAR),\n GetSlot(dateTime, ISO_MONTH),\n GetSlot(dateTime, ISO_DAY),\n GetSlot(dateTime, ISO_HOUR),\n GetSlot(dateTime, ISO_MINUTE),\n GetSlot(dateTime, ISO_SECOND),\n GetSlot(dateTime, ISO_MILLISECOND),\n GetSlot(dateTime, ISO_MICROSECOND),\n GetSlot(dateTime, ISO_NANOSECOND),\n calendar,\n sign * years,\n sign * months,\n sign * weeks,\n sign * days,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds,\n options\n );\n return CreateTemporalDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar);\n}\n\nexport function AddDurationToOrSubtractDurationFromPlainTime(\n operation: AddSubtractOperation,\n temporalTime: Temporal.PlainTime,\n durationLike: PlainTimeParams['add'][0]\n): Temporal.PlainTime {\n const sign = operation === 'subtract' ? -1 : 1;\n const { hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ToTemporalDurationRecord(durationLike);\n let { hour, minute, second, millisecond, microsecond, nanosecond } = AddTime(\n GetSlot(temporalTime, ISO_HOUR),\n GetSlot(temporalTime, ISO_MINUTE),\n GetSlot(temporalTime, ISO_SECOND),\n GetSlot(temporalTime, ISO_MILLISECOND),\n GetSlot(temporalTime, ISO_MICROSECOND),\n GetSlot(temporalTime, ISO_NANOSECOND),\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds\n );\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = RegulateTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n 'reject'\n ));\n const PlainTime = GetIntrinsic('%Temporal.PlainTime%');\n return new PlainTime(hour, minute, second, millisecond, microsecond, nanosecond);\n}\n\nexport function AddDurationToOrSubtractDurationFromPlainYearMonth(\n operation: AddSubtractOperation,\n yearMonth: Temporal.PlainYearMonth,\n durationLike: PlainYearMonthParams['add'][0],\n optionsParam: PlainYearMonthParams['add'][1]\n): Temporal.PlainYearMonth {\n let duration = ToTemporalDurationRecord(durationLike);\n if (operation === 'subtract') {\n duration = {\n years: -duration.years,\n months: -duration.months,\n weeks: -duration.weeks,\n days: -duration.days,\n hours: -duration.hours,\n minutes: -duration.minutes,\n seconds: -duration.seconds,\n milliseconds: -duration.milliseconds,\n microseconds: -duration.microseconds,\n nanoseconds: -duration.nanoseconds\n };\n }\n let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;\n ({ days } = BalanceDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'day'));\n\n const options = GetOptionsObject(optionsParam);\n\n const calendar = GetSlot(yearMonth, CALENDAR);\n const fieldNames = CalendarFields(calendar, ['monthCode', 'year'] as const);\n const fields = PrepareTemporalFields(yearMonth, fieldNames, []);\n const fieldsCopy = ObjectCreate(null);\n CopyDataProperties(fieldsCopy, fields, []);\n fields.day = 1;\n // PrepareTemporalFields returns a type where 'day' is potentially undefined,\n // but TS doesn't narrow the type as a result of the assignment above.\n uncheckedAssertNarrowedType<typeof fields & { day: number }>(fields, '`day` is guaranteed to be non-undefined');\n let startDate = CalendarDateFromFields(calendar, fields);\n const sign = DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0);\n const dateAdd = GetMethod(calendar, 'dateAdd');\n const Duration = GetIntrinsic('%Temporal.Duration%');\n if (sign < 0) {\n const oneMonthDuration = new Duration(0, 1, 0, 0, 0, 0, 0, 0, 0, 0);\n const nextMonth = CalendarDateAdd(calendar, startDate, oneMonthDuration, undefined, dateAdd);\n const minusDayDuration = new Duration(0, 0, 0, -1, 0, 0, 0, 0, 0, 0);\n const endOfMonth = CalendarDateAdd(calendar, nextMonth, minusDayDuration, undefined, dateAdd);\n fieldsCopy.day = CalendarDay(calendar, endOfMonth);\n startDate = CalendarDateFromFields(calendar, fieldsCopy);\n }\n const durationToAdd = new Duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0);\n const optionsCopy = CopyOptions(options);\n const addedDate = CalendarDateAdd(calendar, startDate, durationToAdd, options, dateAdd);\n const addedDateFields = PrepareTemporalFields(addedDate, fieldNames, []);\n\n return CalendarYearMonthFromFields(calendar, addedDateFields, optionsCopy);\n}\n\nexport function AddDurationToOrSubtractDurationFromZonedDateTime(\n operation: AddSubtractOperation,\n zonedDateTime: Temporal.ZonedDateTime,\n durationLike: ZonedDateTimeParams['add'][0],\n optionsParam: ZonedDateTimeParams['add'][1]\n): Temporal.ZonedDateTime {\n const sign = operation === 'subtract' ? -1 : 1;\n const { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n ToTemporalDurationRecord(durationLike);\n const options = GetOptionsObject(optionsParam);\n const timeZone = GetSlot(zonedDateTime, TIME_ZONE);\n const calendar = GetSlot(zonedDateTime, CALENDAR);\n const epochNanoseconds = AddZonedDateTime(\n GetSlot(zonedDateTime, INSTANT),\n timeZone,\n calendar,\n sign * years,\n sign * months,\n sign * weeks,\n sign * days,\n sign * hours,\n sign * minutes,\n sign * seconds,\n sign * milliseconds,\n sign * microseconds,\n sign * nanoseconds,\n options\n );\n return CreateTemporalZonedDateTime(epochNanoseconds, timeZone, calendar);\n}\n\nfunction RoundNumberToIncrement(quantity: JSBI, increment: JSBI, mode: Temporal.RoundingMode) {\n if (JSBI.equal(increment, ONE)) return quantity;\n let { quotient, remainder } = divmod(quantity, increment);\n if (JSBI.equal(remainder, ZERO)) return quantity;\n const sign = JSBI.lessThan(remainder, ZERO) ? -1 : 1;\n const tiebreaker = abs(JSBI.multiply(remainder, JSBI.BigInt(2)));\n const tie = JSBI.equal(tiebreaker, increment);\n const expandIsNearer = JSBI.greaterThan(tiebreaker, increment);\n switch (mode) {\n case 'ceil':\n if (sign > 0) quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n break;\n case 'floor':\n if (sign < 0) quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n break;\n case 'expand':\n // always expand if there is a remainder\n quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n break;\n case 'trunc':\n // no change needed, because divmod is a truncation\n break;\n case 'halfCeil':\n if (expandIsNearer || (tie && sign > 0)) {\n quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n }\n break;\n case 'halfFloor':\n if (expandIsNearer || (tie && sign < 0)) {\n quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n }\n break;\n case 'halfExpand':\n // \"half up away from zero\"\n if (expandIsNearer || tie) {\n quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n }\n break;\n case 'halfTrunc':\n if (expandIsNearer) {\n quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n }\n break;\n case 'halfEven':\n if (expandIsNearer || (tie && JSBI.toNumber(JSBI.remainder(abs(quotient), JSBI.BigInt(2))) === 1)) {\n quotient = JSBI.add(quotient, JSBI.BigInt(sign));\n }\n break;\n }\n return JSBI.multiply(quotient, increment);\n}\n\nexport function RoundInstant(\n epochNs: JSBI,\n increment: number,\n unit: keyof typeof nsPerTimeUnit,\n roundingMode: Temporal.RoundingMode\n) {\n let { remainder } = NonNegativeBigIntDivmod(epochNs, DAY_NANOS);\n const wholeDays = JSBI.subtract(epochNs, remainder);\n const roundedRemainder = RoundNumberToIncrement(\n remainder,\n JSBI.BigInt(nsPerTimeUnit[unit] * increment),\n roundingMode\n );\n return JSBI.add(wholeDays, roundedRemainder);\n}\n\nexport function RoundISODateTime(\n yearParam: number,\n monthParam: number,\n dayParam: number,\n hourParam: number,\n minuteParam: number,\n secondParam: number,\n millisecondParam: number,\n microsecondParam: number,\n nanosecondParam: number,\n increment: number,\n unit: UnitSmallerThanOrEqualTo<'day'>,\n roundingMode: Temporal.RoundingMode,\n dayLengthNs = 86400e9\n) {\n const { deltaDays, hour, minute, second, millisecond, microsecond, nanosecond } = RoundTime(\n hourParam,\n minuteParam,\n secondParam,\n millisecondParam,\n microsecondParam,\n nanosecondParam,\n increment,\n unit,\n roundingMode,\n dayLengthNs\n );\n const { year, month, day } = BalanceISODate(yearParam, monthParam, dayParam + deltaDays);\n return { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond };\n}\n\nexport function RoundTime(\n hour: number,\n minute: number,\n second: number,\n millisecond: number,\n microsecond: number,\n nanosecond: number,\n increment: number,\n unit: keyof typeof nsPerTimeUnit | 'day',\n roundingMode: Temporal.RoundingMode,\n dayLengthNs = 86400e9\n) {\n let quantity = ZERO;\n switch (unit) {\n case 'day':\n case 'hour':\n quantity = JSBI.BigInt(hour);\n // fall through\n case 'minute':\n quantity = JSBI.add(JSBI.multiply(quantity, SIXTY), JSBI.BigInt(minute));\n // fall through\n case 'second':\n quantity = JSBI.add(JSBI.multiply(quantity, SIXTY), JSBI.BigInt(second));\n // fall through\n case 'millisecond':\n quantity = JSBI.add(JSBI.multiply(quantity, THOUSAND), JSBI.BigInt(millisecond));\n // fall through\n case 'microsecond':\n quantity = JSBI.add(JSBI.multiply(quantity, THOUSAND), JSBI.BigInt(microsecond));\n // fall through\n case 'nanosecond':\n quantity = JSBI.add(JSBI.multiply(quantity, THOUSAND), JSBI.BigInt(nanosecond));\n }\n const nsPerUnit = unit === 'day' ? dayLengthNs : nsPerTimeUnit[unit];\n const rounded = RoundNumberToIncrement(quantity, JSBI.BigInt(nsPerUnit * increment), roundingMode);\n const result = JSBI.toNumber(JSBI.divide(rounded, JSBI.BigInt(nsPerUnit)));\n switch (unit) {\n case 'day':\n return { deltaDays: result, hour: 0, minute: 0, second: 0, millisecond: 0, microsecond: 0, nanosecond: 0 };\n case 'hour':\n return BalanceTime(result, 0, 0, 0, 0, 0);\n case 'minute':\n return BalanceTime(hour, result, 0, 0, 0, 0);\n case 'second':\n return BalanceTime(hour, minute, result, 0, 0, 0);\n case 'millisecond':\n return BalanceTime(hour, minute, second, result, 0, 0);\n case 'microsecond':\n return BalanceTime(hour, minute, second, millisecond, result, 0);\n case 'nanosecond':\n return BalanceTime(hour, minute, second, millisecond, microsecond, result);\n default:\n throw new Error(`Invalid unit ${unit}`);\n }\n}\n\nfunction DaysUntil(\n earlier: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime,\n later: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime\n) {\n return DifferenceISODate(\n GetSlot(earlier, ISO_YEAR),\n GetSlot(earlier, ISO_MONTH),\n GetSlot(earlier, ISO_DAY),\n GetSlot(later, ISO_YEAR),\n GetSlot(later, ISO_MONTH),\n GetSlot(later, ISO_DAY),\n 'day'\n ).days;\n}\n\nfunction MoveRelativeDate(\n calendar: CalendarSlot,\n relativeToParam: NonNullable<ReturnType<typeof ToRelativeTemporalObject>>,\n duration: Temporal.Duration,\n dateAdd: Temporal.CalendarProtocol['dateAdd'] | undefined\n) {\n const later = CalendarDateAdd(calendar, relativeToParam, duration, undefined, dateAdd);\n const days = DaysUntil(relativeToParam, later);\n return { relativeTo: later, days };\n}\n\nexport function MoveRelativeZonedDateTime(\n relativeTo: Temporal.ZonedDateTime,\n years: number,\n months: number,\n weeks: number,\n days: number\n) {\n const timeZone = GetSlot(relativeTo, TIME_ZONE);\n const calendar = GetSlot(relativeTo, CALENDAR);\n const intermediateNs = AddZonedDateTime(\n GetSlot(relativeTo, INSTANT),\n timeZone,\n calendar,\n years,\n months,\n weeks,\n days,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n );\n return CreateTemporalZonedDateTime(intermediateNs, timeZone, calendar);\n}\n\nexport function AdjustRoundedDurationDays(\n yearsParam: number,\n monthsParam: number,\n weeksParam: number,\n daysParam: number,\n hoursParam: number,\n minutesParam: number,\n secondsParam: number,\n millisecondsParam: number,\n microsecondsParam: number,\n nanosecondsParam: number,\n increment: number,\n unit: Temporal.DateTimeUnit,\n roundingMode: Temporal.RoundingMode,\n relativeTo: ReturnType<typeof ToRelativeTemporalObject>\n) {\n let years = yearsParam;\n let months = monthsParam;\n let weeks = weeksParam;\n let days = daysParam;\n let hours = hoursParam;\n let minutes = minutesParam;\n let seconds = secondsParam;\n let milliseconds = millisecondsParam;\n let microseconds = microsecondsParam;\n let nanoseconds = nanosecondsParam;\n if (\n !IsTemporalZonedDateTime(relativeTo) ||\n unit === 'year' ||\n unit === 'month' ||\n unit === 'week' ||\n unit === 'day' ||\n (unit === 'nanosecond' && increment === 1)\n ) {\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n }\n\n // There's one more round of rounding possible: if relativeTo is a\n // ZonedDateTime, the time units could have rounded up into enough hours\n // to exceed the day length. If this happens, grow the date part by a\n // single day and re-run exact time rounding on the smaller remainder. DO\n // NOT RECURSE, because once the extra hours are sucked up into the date\n // duration, there's no way for another full day to come from the next\n // round of rounding. And if it were possible (e.g. contrived calendar\n // with 30-minute-long \"days\") then it'd risk an infinite loop.\n let timeRemainderNs = TotalDurationNanoseconds(\n 0,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n 0\n );\n const direction = MathSign(JSBI.toNumber(timeRemainderNs));\n\n const timeZone = GetSlot(relativeTo, TIME_ZONE);\n const calendar = GetSlot(relativeTo, CALENDAR);\n const dayStart = AddZonedDateTime(\n GetSlot(relativeTo, INSTANT),\n timeZone,\n calendar,\n years,\n months,\n weeks,\n days,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n );\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n const dayEnd = AddZonedDateTime(\n new TemporalInstant(dayStart),\n timeZone,\n calendar,\n 0,\n 0,\n 0,\n direction,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n );\n const dayLengthNs = JSBI.subtract(dayEnd, dayStart);\n\n if (\n JSBI.greaterThanOrEqual(JSBI.multiply(JSBI.subtract(timeRemainderNs, dayLengthNs), JSBI.BigInt(direction)), ZERO)\n ) {\n ({ years, months, weeks, days } = AddDuration(\n years,\n months,\n weeks,\n days,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n direction,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n relativeTo\n ));\n timeRemainderNs = RoundInstant(JSBI.subtract(timeRemainderNs, dayLengthNs), increment, unit, roundingMode);\n ({ hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = BalanceDuration(\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n JSBI.toNumber(timeRemainderNs),\n 'hour'\n ));\n }\n return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };\n}\n\nexport function RoundDuration(\n yearsParam: number,\n monthsParam: number,\n weeksParam: number,\n daysParam: number,\n hoursParam: number,\n minutesParam: number,\n secondsParam: number,\n millisecondsParam: number,\n microsecondsParam: number,\n nanosecondsParam: number,\n increment: number,\n unit: Temporal.DateTimeUnit,\n roundingMode: Temporal.RoundingMode,\n relativeToParam: ReturnType<typeof ToRelativeTemporalObject> = undefined\n) {\n let years = yearsParam;\n let months = monthsParam;\n let weeks = weeksParam;\n let days = daysParam;\n let hours = hoursParam;\n let minutes = minutesParam;\n let seconds = secondsParam;\n let milliseconds = millisecondsParam;\n let microseconds = microsecondsParam;\n let nanoseconds = JSBI.BigInt(nanosecondsParam);\n const TemporalDuration = GetIntrinsic('%Temporal.Duration%');\n let calendar, zdtRelative;\n // A cast is used below because relativeTo will be either PlainDate or\n // undefined for the rest of this long method (after any ZDT=>PlainDate\n // conversion below), and TS isn't smart enough to know that the type has\n // changed. See https://github.com/microsoft/TypeScript/issues/27706.\n let relativeTo = relativeToParam as Temporal.PlainDate | undefined;\n if (relativeTo) {\n if (IsTemporalZonedDateTime(relativeTo)) {\n zdtRelative = relativeTo;\n relativeTo = ToTemporalDate(relativeTo);\n } else if (!IsTemporalDate(relativeTo)) {\n throw new TypeError('starting point must be PlainDate or ZonedDateTime');\n }\n calendar = GetSlot(relativeTo, CALENDAR);\n }\n\n // First convert time units up to days, if rounding to days or higher units.\n // If rounding relative to a ZonedDateTime, then some days may not be 24h.\n // TS doesn't know that `dayLengthNs` is only used if the unit is day or\n // larger. We'll cast away `undefined` when it's used lower down below.\n let dayLengthNs: JSBI | undefined;\n if (unit === 'year' || unit === 'month' || unit === 'week' || unit === 'day') {\n nanoseconds = TotalDurationNanoseconds(0, hours, minutes, seconds, milliseconds, microseconds, nanosecondsParam, 0);\n let intermediate;\n if (zdtRelative) {\n intermediate = MoveRelativeZonedDateTime(zdtRelative, years, months, weeks, days);\n }\n let deltaDays;\n let dayLength: number;\n ({ days: deltaDays, nanoseconds, dayLengthNs: dayLength } = NanosecondsToDays(nanoseconds, intermediate));\n dayLengthNs = JSBI.BigInt(dayLength);\n days += deltaDays;\n hours = minutes = seconds = milliseconds = microseconds = 0;\n }\n\n let total: number;\n switch (unit) {\n case 'year': {\n if (!calendar) throw new RangeError('A starting point is required for years rounding');\n assertExists(relativeTo);\n\n // convert months and weeks to days by calculating difference(\n // relativeTo + years, relativeTo + { years, months, weeks })\n const yearsDuration = new TemporalDuration(years);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n const yearsLater = CalendarDateAdd(calendar, relativeTo, yearsDuration, undefined, dateAdd);\n const yearsMonthsWeeks = new TemporalDuration(years, months, weeks);\n const yearsMonthsWeeksLater = CalendarDateAdd(calendar, relativeTo, yearsMonthsWeeks, undefined, dateAdd);\n const monthsWeeksInDays = DaysUntil(yearsLater, yearsMonthsWeeksLater);\n relativeTo = yearsLater;\n days += monthsWeeksInDays;\n\n const wholeDays = new TemporalDuration(0, 0, 0, days);\n const wholeDaysLater = CalendarDateAdd(calendar, relativeTo, wholeDays, undefined, dateAdd);\n const untilOptions = ObjectCreate(null) as Temporal.DifferenceOptions<typeof unit>;\n untilOptions.largestUnit = 'year';\n const yearsPassed = CalendarDateUntil(calendar, relativeTo, wholeDaysLater, untilOptions).years;\n years += yearsPassed;\n const oldRelativeTo = relativeTo;\n const yearsPassedDuration = new TemporalDuration(yearsPassed);\n relativeTo = CalendarDateAdd(calendar, relativeTo, yearsPassedDuration, undefined, dateAdd);\n const daysPassed = DaysUntil(oldRelativeTo, relativeTo);\n days -= daysPassed;\n const oneYear = new TemporalDuration(days < 0 ? -1 : 1);\n let { days: oneYearDays } = MoveRelativeDate(calendar, relativeTo, oneYear, dateAdd);\n\n // Note that `nanoseconds` below (here and in similar code for months,\n // weeks, and days further below) isn't actually nanoseconds for the\n // full date range. Instead, it's a BigInt representation of total\n // days multiplied by the number of nanoseconds in the last day of\n // the duration. This lets us do days-or-larger rounding using BigInt\n // math which reduces precision loss.\n oneYearDays = MathAbs(oneYearDays);\n // dayLengthNs is never undefined if unit is `day` or larger.\n assertExists(dayLengthNs);\n const divisor = JSBI.multiply(JSBI.BigInt(oneYearDays), dayLengthNs);\n nanoseconds = JSBI.add(\n JSBI.add(JSBI.multiply(divisor, JSBI.BigInt(years)), JSBI.multiply(JSBI.BigInt(days), dayLengthNs)),\n nanoseconds\n );\n const rounded = RoundNumberToIncrement(nanoseconds, JSBI.multiply(divisor, JSBI.BigInt(increment)), roundingMode);\n total = BigIntDivideToNumber(nanoseconds, divisor);\n years = JSBI.toNumber(JSBI.divide(rounded, divisor));\n nanoseconds = ZERO;\n months = weeks = days = 0;\n break;\n }\n case 'month': {\n if (!calendar) throw new RangeError('A starting point is required for months rounding');\n assertExists(relativeTo);\n\n // convert weeks to days by calculating difference(relativeTo +\n // { years, months }, relativeTo + { years, months, weeks })\n const yearsMonths = new TemporalDuration(years, months);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n const yearsMonthsLater = CalendarDateAdd(calendar, relativeTo, yearsMonths, undefined, dateAdd);\n const yearsMonthsWeeks = new TemporalDuration(years, months, weeks);\n const yearsMonthsWeeksLater = CalendarDateAdd(calendar, relativeTo, yearsMonthsWeeks, undefined, dateAdd);\n const weeksInDays = DaysUntil(yearsMonthsLater, yearsMonthsWeeksLater);\n relativeTo = yearsMonthsLater;\n days += weeksInDays;\n\n // Months may be different lengths of days depending on the calendar,\n // convert days to months in a loop as described above under 'years'.\n const sign = MathSign(days);\n const oneMonth = new TemporalDuration(0, days < 0 ? -1 : 1);\n let oneMonthDays: number;\n ({ relativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n while (MathAbs(days) >= MathAbs(oneMonthDays)) {\n months += sign;\n days -= oneMonthDays;\n ({ relativeTo, days: oneMonthDays } = MoveRelativeDate(calendar, relativeTo, oneMonth, dateAdd));\n }\n oneMonthDays = MathAbs(oneMonthDays);\n // dayLengthNs is never undefined if unit is `day` or larger.\n assertExists(dayLengthNs);\n const divisor = JSBI.multiply(JSBI.BigInt(oneMonthDays), dayLengthNs);\n nanoseconds = JSBI.add(\n JSBI.add(JSBI.multiply(divisor, JSBI.BigInt(months)), JSBI.multiply(JSBI.BigInt(days), dayLengthNs)),\n nanoseconds\n );\n const rounded = RoundNumberToIncrement(nanoseconds, JSBI.multiply(divisor, JSBI.BigInt(increment)), roundingMode);\n total = BigIntDivideToNumber(nanoseconds, divisor);\n months = JSBI.toNumber(JSBI.divide(rounded, divisor));\n nanoseconds = ZERO;\n weeks = days = 0;\n break;\n }\n case 'week': {\n if (!calendar) throw new RangeError('A starting point is required for weeks rounding');\n assertExists(relativeTo);\n\n // Weeks may be different lengths of days depending on the calendar,\n // convert days to weeks in a loop as described above under 'years'.\n const sign = MathSign(days);\n const oneWeek = new TemporalDuration(0, 0, days < 0 ? -1 : 1);\n const dateAdd = typeof calendar !== 'string' ? GetMethod(calendar, 'dateAdd') : undefined;\n let oneWeekDays;\n ({ relativeTo, days: oneWeekDays } = MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd));\n while (MathAbs(days) >= MathAbs(oneWeekDays)) {\n weeks += sign;\n days -= oneWeekDays;\n ({ relativeTo, days: oneWeekDays } = MoveRelativeDate(calendar, relativeTo, oneWeek, dateAdd));\n }\n oneWeekDays = MathAbs(oneWeekDays);\n // dayLengthNs is never undefined if unit is `day` or larger.\n assertExists(dayLengthNs);\n const divisor = JSBI.multiply(JSBI.BigInt(oneWeekDays), dayLengthNs);\n nanoseconds = JSBI.add(\n JSBI.add(JSBI.multiply(divisor, JSBI.BigInt(weeks)), JSBI.multiply(JSBI.BigInt(days), dayLengthNs)),\n nanoseconds\n );\n const rounded = RoundNumberToIncrement(nanoseconds, JSBI.multiply(divisor, JSBI.BigInt(increment)), roundingMode);\n total = BigIntDivideToNumber(nanoseconds, divisor);\n weeks = JSBI.toNumber(JSBI.divide(rounded, divisor));\n nanoseconds = ZERO;\n days = 0;\n break;\n }\n case 'day': {\n // dayLengthNs is never undefined if unit is `day` or larger.\n assertExists(dayLengthNs);\n const divisor = dayLengthNs;\n nanoseconds = JSBI.add(JSBI.multiply(divisor, JSBI.BigInt(days)), nanoseconds);\n const rounded = RoundNumberToIncrement(nanoseconds, JSBI.multiply(divisor, JSBI.BigInt(increment)), roundingMode);\n total = BigIntDivideToNumber(nanoseconds, divisor);\n days = JSBI.toNumber(JSBI.divide(rounded, divisor));\n nanoseconds = ZERO;\n break;\n }\n case 'hour': {\n const divisor = 3600e9;\n let allNanoseconds = JSBI.multiply(JSBI.BigInt(hours), JSBI.BigInt(3600e9));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(minutes), JSBI.BigInt(60e9)));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(seconds), BILLION));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(milliseconds), MILLION));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(microseconds), THOUSAND));\n allNanoseconds = JSBI.add(allNanoseconds, nanoseconds);\n total = BigIntDivideToNumber(allNanoseconds, JSBI.BigInt(divisor));\n const rounded = RoundNumberToIncrement(allNanoseconds, JSBI.BigInt(divisor * increment), roundingMode);\n hours = JSBI.toNumber(JSBI.divide(rounded, JSBI.BigInt(divisor)));\n nanoseconds = ZERO;\n minutes = seconds = milliseconds = microseconds = 0;\n break;\n }\n case 'minute': {\n const divisor = 60e9;\n let allNanoseconds = JSBI.multiply(JSBI.BigInt(minutes), JSBI.BigInt(60e9));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(seconds), BILLION));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(milliseconds), MILLION));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(microseconds), THOUSAND));\n allNanoseconds = JSBI.add(allNanoseconds, nanoseconds);\n total = BigIntDivideToNumber(allNanoseconds, JSBI.BigInt(divisor));\n const rounded = RoundNumberToIncrement(allNanoseconds, JSBI.BigInt(divisor * increment), roundingMode);\n minutes = JSBI.toNumber(JSBI.divide(rounded, JSBI.BigInt(divisor)));\n nanoseconds = ZERO;\n seconds = milliseconds = microseconds = 0;\n break;\n }\n case 'second': {\n const divisor = 1e9;\n let allNanoseconds = JSBI.multiply(JSBI.BigInt(seconds), BILLION);\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(milliseconds), MILLION));\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(microseconds), THOUSAND));\n allNanoseconds = JSBI.add(allNanoseconds, nanoseconds);\n total = BigIntDivideToNumber(allNanoseconds, JSBI.BigInt(divisor));\n const rounded = RoundNumberToIncrement(allNanoseconds, JSBI.BigInt(divisor * increment), roundingMode);\n seconds = JSBI.toNumber(JSBI.divide(rounded, JSBI.BigInt(divisor)));\n nanoseconds = ZERO;\n milliseconds = microseconds = 0;\n break;\n }\n case 'millisecond': {\n const divisor = 1e6;\n let allNanoseconds = JSBI.multiply(JSBI.BigInt(milliseconds), MILLION);\n allNanoseconds = JSBI.add(allNanoseconds, JSBI.multiply(JSBI.BigInt(microseconds), THOUSAND));\n allNanoseconds = JSBI.add(allNanoseconds, nanoseconds);\n total = BigIntDivideToNumber(allNanoseconds, JSBI.BigInt(divisor));\n const rounded = RoundNumberToIncrement(allNanoseconds, JSBI.BigInt(divisor * increment), roundingMode);\n milliseconds = JSBI.toNumber(JSBI.divide(rounded, JSBI.BigInt(divisor)));\n nanoseconds = ZERO;\n microseconds = 0;\n break;\n }\n case 'microsecond': {\n const divisor = 1e3;\n let allNanoseconds = JSBI.multiply(JSBI.BigInt(microseconds), THOUSAND);\n allNanoseconds = JSBI.add(allNanoseconds, nanoseconds);\n total = BigIntDivideToNumber(allNanoseconds, JSBI.BigInt(divisor));\n const rounded = RoundNumberToIncrement(allNanoseconds, JSBI.BigInt(divisor * increment), roundingMode);\n microseconds = JSBI.toNumber(JSBI.divide(rounded, JSBI.BigInt(divisor)));\n nanoseconds = ZERO;\n break;\n }\n case 'nanosecond': {\n total = JSBI.toNumber(nanoseconds);\n nanoseconds = RoundNumberToIncrement(JSBI.BigInt(nanoseconds), JSBI.BigInt(increment), roundingMode);\n break;\n }\n }\n return {\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds: JSBI.toNumber(nanoseconds),\n total\n };\n}\n\nexport function CompareISODate(y1: number, m1: number, d1: number, y2: number, m2: number, d2: number) {\n for (const [x, y] of [\n [y1, y2],\n [m1, m2],\n [d1, d2]\n ]) {\n if (x !== y) return ComparisonResult(x - y);\n }\n return 0;\n}\n\n// Not abstract operations from the spec\n\nfunction NonNegativeBigIntDivmod(x: JSBI, y: JSBI) {\n let { quotient, remainder } = divmod(x, y);\n if (JSBI.lessThan(remainder, ZERO)) {\n quotient = JSBI.subtract(quotient, ONE);\n remainder = JSBI.add(remainder, y);\n }\n return { quotient, remainder };\n}\n\nexport function BigIntFloorDiv(left: JSBI, right: JSBI) {\n const { quotient, remainder } = divmod(left, right);\n if (!isZero(remainder) && !isNegativeJSBI(left) != !isNegativeJSBI(right)) {\n return JSBI.subtract(quotient, ONE);\n }\n return quotient;\n}\n\n/** Divide two JSBIs, and return the result as a Number, including the remainder. */\nexport function BigIntDivideToNumber(dividend: JSBI, divisor: JSBI) {\n const { quotient, remainder } = divmod(dividend, divisor);\n const result = JSBI.toNumber(quotient) + JSBI.toNumber(remainder) / JSBI.toNumber(divisor);\n return result;\n}\n\n// Defaults to native bigint, or something \"native bigint-like\".\n// For users of Temporal that are running in environments without native BigInt,\n// the only guarantee we should give is that the returned object's toString will\n// return a string containing an accurate base 10 value of this bigint. This\n// form factor should correctly interop with other bigint compat libraries\n// easily.\ntype ExternalBigInt = bigint;\n\nexport function ToBigIntExternal(arg: unknown): ExternalBigInt {\n const jsbiBI = ToBigInt(arg);\n if (typeof (globalThis as any).BigInt !== 'undefined') return (globalThis as any).BigInt(jsbiBI.toString(10));\n return jsbiBI as unknown as ExternalBigInt;\n}\n\nexport function ToBigInt(arg: unknown): JSBI {\n let prim = arg;\n if (typeof arg === 'object') {\n const toPrimFn = (arg as { [Symbol.toPrimitive]: unknown })[Symbol.toPrimitive];\n if (toPrimFn && typeof toPrimFn === 'function') {\n prim = ReflectApply(toPrimFn, arg, ['number']);\n }\n }\n\n // The AO ToBigInt throws on numbers because it does not allow implicit\n // conversion between number and bigint (unlike the bigint constructor).\n if (typeof prim === 'number') {\n throw new TypeError('cannot convert number to bigint');\n }\n if (typeof prim === 'bigint') {\n // JSBI doesn't know anything about the bigint type, and intentionally\n // assumes it doesn't exist. Passing one to the BigInt function will throw\n // an error.\n return JSBI.BigInt(prim.toString(10));\n }\n // JSBI will properly coerce types into a BigInt the same as the native BigInt\n // constructor will, with the exception of native bigint which is handled\n // above.\n // As of 2023-04-07, the only runtime type that neither of those can handle is\n // 'symbol', and both native bigint and the JSBI.BigInt function will throw an\n // error if they are given a Symbol.\n return JSBI.BigInt(prim as string | boolean | object);\n}\n\n// Note: This method returns values with bogus nanoseconds based on the previous iteration's\n// milliseconds. That way there is a guarantee that the full nanoseconds are always going to be\n// increasing at least and that the microsecond and nanosecond fields are likely to be non-zero.\nexport const SystemUTCEpochNanoSeconds: () => JSBI = (() => {\n let ns = JSBI.BigInt(Date.now() % 1e6);\n return () => {\n const ms = JSBI.BigInt(Date.now());\n const result = JSBI.add(JSBI.multiply(ms, MILLION), ns);\n ns = JSBI.remainder(ms, MILLION);\n if (JSBI.greaterThan(result, NS_MAX)) return NS_MAX;\n if (JSBI.lessThan(result, NS_MIN)) return NS_MIN;\n return result;\n };\n})();\n\nexport function DefaultTimeZone() {\n return new IntlDateTimeFormat().resolvedOptions().timeZone;\n}\n\nexport function ComparisonResult(value: number) {\n return value < 0 ? -1 : value > 0 ? 1 : (value as 0);\n}\n\nexport function GetOptionsObject<T>(options: T) {\n if (options === undefined) return ObjectCreate(null) as NonNullable<T>;\n if (IsObject(options) && options !== null) return options;\n throw new TypeError(`Options parameter must be an object, not ${options === null ? 'null' : `${typeof options}`}`);\n}\n\nexport function CreateOnePropObject<K extends string, V>(propName: K, propValue: V): { [k in K]: V } {\n const o = ObjectCreate(null);\n o[propName] = propValue;\n return o;\n}\n\nfunction CopyOptions<T extends { [s in K]?: unknown }, K extends string & keyof T>(options: T | undefined) {\n const optionsCopy = ObjectCreate(null) as T;\n CopyDataProperties(optionsCopy, GetOptionsObject(options), []);\n return optionsCopy;\n}\n\ntype StringlyTypedKeys<T> = Exclude<keyof T, symbol | number>;\nfunction GetOption<P extends StringlyTypedKeys<O>, O extends Partial<Record<P, unknown>>>(\n options: O,\n property: P,\n allowedValues: ReadonlyArray<O[P]>,\n fallback: undefined\n): O[P];\nfunction GetOption<\n P extends StringlyTypedKeys<O>,\n O extends Partial<Record<P, unknown>>,\n Fallback extends Required<O>[P] | undefined\n>(\n options: O,\n property: P,\n allowedValues: ReadonlyArray<O[P]>,\n fallback: Fallback\n): Fallback extends undefined ? O[P] | undefined : Required<O>[P];\nfunction GetOption<\n P extends StringlyTypedKeys<O>,\n O extends Partial<Record<P, unknown>>,\n Fallback extends Required<O>[P] | undefined\n>(\n options: O,\n property: P,\n allowedValues: ReadonlyArray<O[P]>,\n fallback: O[P]\n): Fallback extends undefined ? O[P] | undefined : Required<O>[P] {\n let value = options[property];\n if (value !== undefined) {\n value = ToString(value) as O[P];\n if (!allowedValues.includes(value)) {\n throw new RangeError(`${property} must be one of ${allowedValues.join(', ')}, not ${value}`);\n }\n return value;\n }\n return fallback;\n}\n\nexport function IsBuiltinCalendar(id: string): id is BuiltinCalendarId {\n return BUILTIN_CALENDAR_IDS.includes(ASCIILowercase(id));\n}\n\nexport function ASCIILowercase<T extends string>(str: T): T {\n // The spec defines this operation distinct from String.prototype.lowercase,\n // so we'll follow the spec here. Note that nasty security issues that can\n // happen for some use cases if you're comparing case-modified non-ASCII\n // values. For example, Turkish's \"I\" character was the source of a security\n // issue involving \"file://\" URLs. See\n // https://haacked.com/archive/2012/07/05/turkish-i-problem-and-why-you-should-care.aspx/.\n return str.replace(/[A-Z]/g, (l) => {\n const code = l.charCodeAt(0);\n return String.fromCharCode(code + 0x20);\n }) as T;\n}\n\nconst OFFSET = new RegExp(`^${PARSE.offset.source}$`);\n\nfunction bisect(\n getState: (epochNs: JSBI) => number,\n leftParam: JSBI,\n rightParam: JSBI,\n lstateParam: number = getState(leftParam),\n rstateParam: number = getState(rightParam)\n) {\n // This doesn't make much sense - why do these get converted unnecessarily?\n let left = JSBI.BigInt(leftParam);\n let right = JSBI.BigInt(rightParam);\n let lstate = lstateParam;\n let rstate = rstateParam;\n while (JSBI.greaterThan(JSBI.subtract(right, left), ONE)) {\n const middle = JSBI.divide(JSBI.add(left, right), JSBI.BigInt(2));\n const mstate = getState(middle);\n if (mstate === lstate) {\n left = middle;\n lstate = mstate;\n } else if (mstate === rstate) {\n right = middle;\n rstate = mstate;\n } else {\n throw new Error(`invalid state in bisection ${lstate} - ${mstate} - ${rstate}`);\n }\n }\n return right;\n}\n\nconst nsPerTimeUnit = {\n hour: 3600e9,\n minute: 60e9,\n second: 1e9,\n millisecond: 1e6,\n microsecond: 1e3,\n nanosecond: 1\n};\n","import * as ES from './ecmascript';\nimport { GetIntrinsic } from './intrinsicclass';\nimport {\n GetSlot,\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND,\n CALENDAR\n} from './slots';\nimport type { Temporal, Intl } from '..';\nimport type { DateTimeFormatParams as Params, DateTimeFormatReturn as Return } from './internaltypes';\n\nconst DATE = Symbol('date');\nconst YM = Symbol('ym');\nconst MD = Symbol('md');\nconst TIME = Symbol('time');\nconst DATETIME = Symbol('datetime');\nconst INST = Symbol('instant');\nconst ORIGINAL = Symbol('original');\nconst TZ_RESOLVED = Symbol('timezone');\nconst CAL_ID = Symbol('calendar-id');\nconst LOCALE = Symbol('locale');\nconst OPTIONS = Symbol('options');\n\nconst descriptor = <T extends (...args: any[]) => any>(value: T) => {\n return {\n value,\n enumerable: true,\n writable: false,\n configurable: true\n };\n};\n\nconst IntlDateTimeFormat = globalThis.Intl.DateTimeFormat;\nconst ObjectAssign = Object.assign;\nconst ObjectHasOwnProperty = Object.prototype.hasOwnProperty;\nconst ReflectApply = Reflect.apply;\n\ninterface CustomFormatters {\n [DATE]: typeof dateAmend | globalThis.Intl.DateTimeFormat;\n [YM]: typeof yearMonthAmend | typeof globalThis.Intl.DateTimeFormat;\n [MD]: typeof monthDayAmend | typeof globalThis.Intl.DateTimeFormat;\n [TIME]: typeof timeAmend | typeof globalThis.Intl.DateTimeFormat;\n [DATETIME]: typeof datetimeAmend | typeof globalThis.Intl.DateTimeFormat;\n [INST]: typeof instantAmend | typeof globalThis.Intl.DateTimeFormat;\n}\n\ninterface PrivateProps extends CustomFormatters {\n [ORIGINAL]: globalThis.Intl.DateTimeFormat;\n [TZ_RESOLVED]: string | Temporal.TimeZoneProtocol;\n [CAL_ID]: globalThis.Intl.ResolvedDateTimeFormatOptions['calendar'];\n [LOCALE]: globalThis.Intl.ResolvedDateTimeFormatOptions['locale'];\n [OPTIONS]: Intl.DateTimeFormatOptions;\n}\n\ntype OptionsAmenderFunction = (options: Intl.DateTimeFormatOptions) => globalThis.Intl.DateTimeFormatOptions;\ntype FormatterOrAmender = globalThis.Intl.DateTimeFormat | OptionsAmenderFunction;\n\n// Construction of built-in Intl.DateTimeFormat objects is sloooooow,\n// so we'll only create those instances when we need them.\n// See https://bugs.chromium.org/p/v8/issues/detail?id=6528\nfunction getPropLazy<T extends PrivateProps, P extends keyof CustomFormatters>(\n obj: T,\n prop: P\n): globalThis.Intl.DateTimeFormat {\n let val = obj[prop] as FormatterOrAmender;\n if (typeof val === 'function') {\n // If we get here, `val` is an \"amender function\". It will take the user's\n // options and transform them into suitable options to be passed into the\n // built-in (non-polyfill) Intl.DateTimeFormat constructor. These options\n // will vary depending on the Temporal type, so that's why we store separate\n // formatters in separate props on the polyfill's DateTimeFormat instances.\n // The efficiency happens because we don't create an (expensive) formatter\n // until the user calls toLocaleString for that Temporal type.\n val = new IntlDateTimeFormat(obj[LOCALE], val(obj[OPTIONS]));\n // TODO: can this be typed more cleanly?\n (obj[prop] as globalThis.Intl.DateTimeFormat) = val;\n }\n return val;\n}\n\ntype DateTimeFormatImpl = Intl.DateTimeFormat & PrivateProps;\n\nfunction DateTimeFormatImpl(\n this: Intl.DateTimeFormat & PrivateProps,\n locale: Params['constructor'][0] = undefined,\n optionsParam: Params['constructor'][1] = {}\n) {\n if (!(this instanceof DateTimeFormatImpl)) {\n type Construct = new (\n locale: Params['constructor'][0],\n optionsParam: Params['constructor'][1]\n ) => Intl.DateTimeFormat;\n return new (DateTimeFormatImpl as unknown as Construct)(locale, optionsParam);\n }\n const hasOptions = typeof optionsParam !== 'undefined';\n const options = hasOptions ? ObjectAssign({}, optionsParam) : {};\n // TODO: remove type assertion after Temporal types land in TS lib types\n const original = new IntlDateTimeFormat(locale, options as globalThis.Intl.DateTimeFormatOptions);\n const ro = original.resolvedOptions();\n\n // DateTimeFormat instances are very expensive to create. Therefore, they will\n // be lazily created only when needed, using the locale and options provided.\n // But it's possible for callers to mutate those inputs before lazy creation\n // happens. For this reason, we clone the inputs instead of caching the\n // original objects. To avoid the complexity of deep cloning any inputs that\n // are themselves objects (e.g. the locales array, or options property values\n // that will be coerced to strings), we rely on `resolvedOptions()` to do the\n // coercion and cloning for us. Unfortunately, we can't just use the resolved\n // options as-is because our options-amending logic adds additional fields if\n // the user doesn't supply any unit fields like year, month, day, hour, etc.\n // Therefore, we limit the properties in the clone to properties that were\n // present in the original input.\n if (hasOptions) {\n const clonedResolved = ObjectAssign({}, ro);\n for (const prop in clonedResolved) {\n if (!ReflectApply(ObjectHasOwnProperty, options, [prop])) {\n delete clonedResolved[prop as keyof typeof clonedResolved];\n }\n }\n this[OPTIONS] = clonedResolved as Intl.DateTimeFormatOptions;\n } else {\n this[OPTIONS] = options;\n }\n\n this[LOCALE] = ro.locale;\n this[ORIGINAL] = original;\n this[TZ_RESOLVED] = ro.timeZone;\n this[CAL_ID] = ro.calendar;\n this[DATE] = dateAmend;\n this[YM] = yearMonthAmend;\n this[MD] = monthDayAmend;\n this[TIME] = timeAmend;\n this[DATETIME] = datetimeAmend;\n this[INST] = instantAmend;\n return undefined; // TODO: I couldn't satisfy TS without adding this. Is there another way?\n}\n\nObject.defineProperty(DateTimeFormatImpl, 'name', {\n writable: true,\n value: 'DateTimeFormat'\n});\n\nDateTimeFormatImpl.supportedLocalesOf = function (\n locales: Params['supportedLocalesOf'][0],\n options: Params['supportedLocalesOf'][1]\n) {\n return IntlDateTimeFormat.supportedLocalesOf(locales, options as globalThis.Intl.DateTimeFormatOptions);\n};\n\nconst propertyDescriptors: Partial<Record<keyof Intl.DateTimeFormat, PropertyDescriptor>> = {\n resolvedOptions: descriptor(resolvedOptions),\n format: descriptor(format),\n formatRange: descriptor(formatRange)\n};\n\nif ('formatToParts' in IntlDateTimeFormat.prototype) {\n propertyDescriptors.formatToParts = descriptor(formatToParts);\n}\n\nif ('formatRangeToParts' in IntlDateTimeFormat.prototype) {\n propertyDescriptors.formatRangeToParts = descriptor(formatRangeToParts);\n}\n\nDateTimeFormatImpl.prototype = Object.create(IntlDateTimeFormat.prototype, propertyDescriptors);\n\n// Ensure that the prototype isn't writeable.\nObject.defineProperty(DateTimeFormatImpl, 'prototype', {\n writable: false,\n enumerable: false,\n configurable: false\n});\n\nexport const DateTimeFormat = DateTimeFormatImpl as unknown as typeof Intl.DateTimeFormat;\n\nfunction resolvedOptions(this: DateTimeFormatImpl): Return['resolvedOptions'] {\n return this[ORIGINAL].resolvedOptions();\n}\n\n// TODO: investigate why there's a rest parameter here. Does this function really need to accept extra params?\n// And if so, why doesn't formatRange also accept extra params?\nfunction format<P extends readonly unknown[]>(\n this: DateTimeFormatImpl,\n datetime: Params['format'][0],\n ...rest: P\n): Return['format'] {\n let { instant, formatter } = extractOverrides(datetime, this);\n if (instant && formatter) {\n return formatter.format(instant.epochMilliseconds);\n }\n // Support spreading additional args for future expansion of this Intl method\n type AllowExtraParams = (datetime: Parameters<Intl.DateTimeFormat['format']>[0], ...rest: P) => Return['format'];\n return (this[ORIGINAL].format as unknown as AllowExtraParams)(datetime, ...rest);\n}\n\nfunction formatToParts<P extends readonly unknown[]>(\n this: DateTimeFormatImpl,\n datetime: Params['formatToParts'][0],\n ...rest: P\n): Return['formatToParts'] {\n let { instant, formatter } = extractOverrides(datetime, this);\n if (instant && formatter) {\n return formatter.formatToParts(instant.epochMilliseconds);\n }\n // Support spreading additional args for future expansion of this Intl method\n type AllowExtraParams = (\n datetime: Parameters<Intl.DateTimeFormat['formatToParts']>[0],\n ...rest: P\n ) => Return['formatToParts'];\n return (this[ORIGINAL].formatToParts as unknown as AllowExtraParams)(datetime, ...rest);\n}\n\nfunction formatRange(this: DateTimeFormatImpl, a: Params['formatRange'][0], b: Params['formatRange'][1]) {\n if (isTemporalObject(a) || isTemporalObject(b)) {\n if (!sameTemporalType(a, b)) {\n throw new TypeError('Intl.DateTimeFormat.formatRange accepts two values of the same type');\n }\n const { instant: aa, formatter: aformatter } = extractOverrides(a as unknown as TypesWithToLocaleString, this);\n const { instant: bb, formatter: bformatter } = extractOverrides(b as unknown as TypesWithToLocaleString, this);\n if (aa && bb && aformatter && bformatter && aformatter === bformatter) {\n // TODO: Remove type assertion after this method lands in TS lib types\n return (aformatter as Intl.DateTimeFormat).formatRange(aa.epochMilliseconds, bb.epochMilliseconds);\n }\n }\n // TODO: Remove type assertion after this method lands in TS lib types\n return (this[ORIGINAL] as Intl.DateTimeFormat).formatRange(a, b);\n}\n\nfunction formatRangeToParts(\n this: DateTimeFormatImpl,\n a: Params['formatRangeToParts'][0],\n b: Params['formatRangeToParts'][1]\n) {\n if (isTemporalObject(a) || isTemporalObject(b)) {\n if (!sameTemporalType(a, b)) {\n throw new TypeError('Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type');\n }\n const { instant: aa, formatter: aformatter } = extractOverrides(a, this);\n const { instant: bb, formatter: bformatter } = extractOverrides(b, this);\n if (aa && bb && aformatter && bformatter && aformatter === bformatter) {\n // TODO: Remove type assertion after this method lands in TS lib types\n return (aformatter as Intl.DateTimeFormat).formatRangeToParts(aa.epochMilliseconds, bb.epochMilliseconds);\n }\n }\n // TODO: Remove type assertion after this method lands in TS lib types\n return (this[ORIGINAL] as Intl.DateTimeFormat).formatRangeToParts(a, b);\n}\n\n// \"false\" is a signal to delete this option\ntype MaybeFalseOptions = {\n [K in keyof Intl.DateTimeFormatOptions]?: Intl.DateTimeFormatOptions[K] | false;\n};\n\nfunction amend(optionsParam: Intl.DateTimeFormatOptions = {}, amended: MaybeFalseOptions = {}) {\n const options = ObjectAssign({}, optionsParam);\n for (const opt of [\n 'year',\n 'month',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'weekday',\n 'dayPeriod',\n 'timeZoneName',\n 'dateStyle',\n 'timeStyle'\n ] as const) {\n // TODO: can this be typed more cleanly?\n type OptionMaybeFalse = typeof options[typeof opt] | false;\n (options[opt] as OptionMaybeFalse) = opt in amended ? amended[opt] : options[opt];\n if ((options[opt] as OptionMaybeFalse) === false || options[opt] === undefined) delete options[opt];\n }\n return options as globalThis.Intl.DateTimeFormatOptions;\n}\n\ntype OptionsType<T extends TypesWithToLocaleString> = NonNullable<Parameters<T['toLocaleString']>[1]>;\n\nfunction timeAmend(optionsParam: OptionsType<Temporal.PlainTime>) {\n let options = amend(optionsParam, {\n year: false,\n month: false,\n day: false,\n weekday: false,\n timeZoneName: false,\n dateStyle: false\n });\n if (!hasTimeOptions(options)) {\n options = ObjectAssign({}, options, {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n }\n return options;\n}\n\nfunction yearMonthAmend(optionsParam: OptionsType<Temporal.PlainYearMonth>) {\n let options = amend(optionsParam, {\n day: false,\n hour: false,\n minute: false,\n second: false,\n weekday: false,\n dayPeriod: false,\n timeZoneName: false,\n dateStyle: false,\n timeStyle: false\n });\n if (!('year' in options || 'month' in options)) {\n options = ObjectAssign(options, { year: 'numeric', month: 'numeric' });\n }\n return options;\n}\n\nfunction monthDayAmend(optionsParam: OptionsType<Temporal.PlainMonthDay>) {\n let options = amend(optionsParam, {\n year: false,\n hour: false,\n minute: false,\n second: false,\n weekday: false,\n dayPeriod: false,\n timeZoneName: false,\n dateStyle: false,\n timeStyle: false\n });\n if (!('month' in options || 'day' in options)) {\n options = ObjectAssign({}, options, { month: 'numeric', day: 'numeric' });\n }\n return options;\n}\n\nfunction dateAmend(optionsParam: OptionsType<Temporal.PlainDate>) {\n let options = amend(optionsParam, {\n hour: false,\n minute: false,\n second: false,\n dayPeriod: false,\n timeZoneName: false,\n timeStyle: false\n });\n if (!hasDateOptions(options)) {\n options = ObjectAssign({}, options, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric'\n });\n }\n return options;\n}\n\nfunction datetimeAmend(optionsParam: OptionsType<Temporal.PlainDateTime>) {\n let options = amend(optionsParam, { timeZoneName: false });\n if (!hasTimeOptions(options) && !hasDateOptions(options)) {\n options = ObjectAssign({}, options, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n }\n return options;\n}\n\nfunction instantAmend(optionsParam: OptionsType<Temporal.Instant>) {\n let options = optionsParam;\n if (!hasTimeOptions(options) && !hasDateOptions(options)) {\n options = ObjectAssign({}, options, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n }\n return options;\n}\n\nfunction hasDateOptions(options: OptionsType<TypesWithToLocaleString>) {\n return 'year' in options || 'month' in options || 'day' in options || 'weekday' in options || 'dateStyle' in options;\n}\n\nfunction hasTimeOptions(options: OptionsType<TypesWithToLocaleString>) {\n return (\n 'hour' in options || 'minute' in options || 'second' in options || 'timeStyle' in options || 'dayPeriod' in options\n );\n}\n\nfunction isTemporalObject(\n obj: unknown\n): obj is\n | Temporal.PlainDate\n | Temporal.PlainTime\n | Temporal.PlainDateTime\n | Temporal.ZonedDateTime\n | Temporal.PlainYearMonth\n | Temporal.PlainMonthDay\n | Temporal.Instant {\n return (\n ES.IsTemporalDate(obj) ||\n ES.IsTemporalTime(obj) ||\n ES.IsTemporalDateTime(obj) ||\n ES.IsTemporalZonedDateTime(obj) ||\n ES.IsTemporalYearMonth(obj) ||\n ES.IsTemporalMonthDay(obj) ||\n ES.IsTemporalInstant(obj)\n );\n}\n\nfunction sameTemporalType(x: unknown, y: unknown) {\n if (!isTemporalObject(x) || !isTemporalObject(y)) return false;\n if (ES.IsTemporalTime(x) && !ES.IsTemporalTime(y)) return false;\n if (ES.IsTemporalDate(x) && !ES.IsTemporalDate(y)) return false;\n if (ES.IsTemporalDateTime(x) && !ES.IsTemporalDateTime(y)) return false;\n if (ES.IsTemporalZonedDateTime(x) && !ES.IsTemporalZonedDateTime(y)) return false;\n if (ES.IsTemporalYearMonth(x) && !ES.IsTemporalYearMonth(y)) return false;\n if (ES.IsTemporalMonthDay(x) && !ES.IsTemporalMonthDay(y)) return false;\n if (ES.IsTemporalInstant(x) && !ES.IsTemporalInstant(y)) return false;\n return true;\n}\n\ntype TypesWithToLocaleString =\n | Temporal.PlainDateTime\n | Temporal.PlainDate\n | Temporal.PlainTime\n | Temporal.PlainYearMonth\n | Temporal.PlainMonthDay\n | Temporal.ZonedDateTime\n | Temporal.Instant;\n\nfunction extractOverrides(temporalObj: Params['format'][0], main: DateTimeFormatImpl) {\n const DateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n\n if (ES.IsTemporalTime(temporalObj)) {\n const hour = GetSlot(temporalObj, ISO_HOUR);\n const minute = GetSlot(temporalObj, ISO_MINUTE);\n const second = GetSlot(temporalObj, ISO_SECOND);\n const millisecond = GetSlot(temporalObj, ISO_MILLISECOND);\n const microsecond = GetSlot(temporalObj, ISO_MICROSECOND);\n const nanosecond = GetSlot(temporalObj, ISO_NANOSECOND);\n const datetime = new DateTime(1970, 1, 1, hour, minute, second, millisecond, microsecond, nanosecond, main[CAL_ID]);\n return {\n instant: ES.GetInstantFor(main[TZ_RESOLVED], datetime, 'compatible'),\n formatter: getPropLazy(main, TIME)\n };\n }\n\n if (ES.IsTemporalYearMonth(temporalObj)) {\n const isoYear = GetSlot(temporalObj, ISO_YEAR);\n const isoMonth = GetSlot(temporalObj, ISO_MONTH);\n const referenceISODay = GetSlot(temporalObj, ISO_DAY);\n const calendar = ES.ToTemporalCalendarIdentifier(GetSlot(temporalObj, CALENDAR));\n if (calendar !== main[CAL_ID]) {\n throw new RangeError(\n `cannot format PlainYearMonth with calendar ${calendar} in locale with calendar ${main[CAL_ID]}`\n );\n }\n const datetime = new DateTime(isoYear, isoMonth, referenceISODay, 12, 0, 0, 0, 0, 0, calendar);\n return {\n instant: ES.GetInstantFor(main[TZ_RESOLVED], datetime, 'compatible'),\n formatter: getPropLazy(main, YM)\n };\n }\n\n if (ES.IsTemporalMonthDay(temporalObj)) {\n const referenceISOYear = GetSlot(temporalObj, ISO_YEAR);\n const isoMonth = GetSlot(temporalObj, ISO_MONTH);\n const isoDay = GetSlot(temporalObj, ISO_DAY);\n const calendar = ES.ToTemporalCalendarIdentifier(GetSlot(temporalObj, CALENDAR));\n if (calendar !== main[CAL_ID]) {\n throw new RangeError(\n `cannot format PlainMonthDay with calendar ${calendar} in locale with calendar ${main[CAL_ID]}`\n );\n }\n const datetime = new DateTime(referenceISOYear, isoMonth, isoDay, 12, 0, 0, 0, 0, 0, calendar);\n return {\n instant: ES.GetInstantFor(main[TZ_RESOLVED], datetime, 'compatible'),\n formatter: getPropLazy(main, MD)\n };\n }\n\n if (ES.IsTemporalDate(temporalObj)) {\n const isoYear = GetSlot(temporalObj, ISO_YEAR);\n const isoMonth = GetSlot(temporalObj, ISO_MONTH);\n const isoDay = GetSlot(temporalObj, ISO_DAY);\n const calendar = ES.ToTemporalCalendarIdentifier(GetSlot(temporalObj, CALENDAR));\n if (calendar !== 'iso8601' && calendar !== main[CAL_ID]) {\n throw new RangeError(`cannot format PlainDate with calendar ${calendar} in locale with calendar ${main[CAL_ID]}`);\n }\n const datetime = new DateTime(isoYear, isoMonth, isoDay, 12, 0, 0, 0, 0, 0, main[CAL_ID]);\n return {\n instant: ES.GetInstantFor(main[TZ_RESOLVED], datetime, 'compatible'),\n formatter: getPropLazy(main, DATE)\n };\n }\n\n if (ES.IsTemporalDateTime(temporalObj)) {\n const isoYear = GetSlot(temporalObj, ISO_YEAR);\n const isoMonth = GetSlot(temporalObj, ISO_MONTH);\n const isoDay = GetSlot(temporalObj, ISO_DAY);\n const hour = GetSlot(temporalObj, ISO_HOUR);\n const minute = GetSlot(temporalObj, ISO_MINUTE);\n const second = GetSlot(temporalObj, ISO_SECOND);\n const millisecond = GetSlot(temporalObj, ISO_MILLISECOND);\n const microsecond = GetSlot(temporalObj, ISO_MICROSECOND);\n const nanosecond = GetSlot(temporalObj, ISO_NANOSECOND);\n const calendar = ES.ToTemporalCalendarIdentifier(GetSlot(temporalObj, CALENDAR));\n if (calendar !== 'iso8601' && calendar !== main[CAL_ID]) {\n throw new RangeError(\n `cannot format PlainDateTime with calendar ${calendar} in locale with calendar ${main[CAL_ID]}`\n );\n }\n let datetime = temporalObj;\n if (calendar === 'iso8601') {\n datetime = new DateTime(\n isoYear,\n isoMonth,\n isoDay,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n main[CAL_ID]\n );\n }\n return {\n instant: ES.GetInstantFor(main[TZ_RESOLVED], datetime, 'compatible'),\n formatter: getPropLazy(main, DATETIME)\n };\n }\n\n if (ES.IsTemporalZonedDateTime(temporalObj)) {\n throw new TypeError(\n 'Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.'\n );\n }\n\n if (ES.IsTemporalInstant(temporalObj)) {\n return {\n instant: temporalObj,\n formatter: getPropLazy(main, INST)\n };\n }\n\n return {};\n}\n","import { DEBUG } from './debug';\nimport * as ES from './ecmascript';\nimport { MakeIntrinsicClass } from './intrinsicclass';\nimport { EPOCHNANOSECONDS, CreateSlots, GetSlot, SetSlot } from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { InstantParams as Params, InstantReturn as Return } from './internaltypes';\n\nimport JSBI from 'jsbi';\nimport { BILLION, MILLION, THOUSAND } from './ecmascript';\n\nexport class Instant implements Temporal.Instant {\n constructor(epochNanoseconds: bigint | JSBI) {\n // Note: if the argument is not passed, ToBigInt(undefined) will throw. This check exists only\n // to improve the error message.\n if (arguments.length < 1) {\n throw new TypeError('missing argument: epochNanoseconds is required');\n }\n\n const ns = ES.ToBigInt(epochNanoseconds);\n ES.ValidateEpochNanoseconds(ns);\n CreateSlots(this);\n SetSlot(this, EPOCHNANOSECONDS, ns);\n\n if (DEBUG) {\n const repr = ES.TemporalInstantToString(this, undefined, 'auto');\n Object.defineProperty(this, '_repr_', {\n value: `${this[Symbol.toStringTag]} <${repr}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n }\n\n get epochSeconds(): Return['epochSeconds'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n const value = GetSlot(this, EPOCHNANOSECONDS);\n return JSBI.toNumber(ES.BigIntFloorDiv(value, BILLION));\n }\n get epochMilliseconds(): Return['epochMilliseconds'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n const value = JSBI.BigInt(GetSlot(this, EPOCHNANOSECONDS));\n return JSBI.toNumber(ES.BigIntFloorDiv(value, MILLION));\n }\n get epochMicroseconds(): Return['epochMicroseconds'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n const value = JSBI.BigInt(GetSlot(this, EPOCHNANOSECONDS));\n return ES.ToBigIntExternal(ES.BigIntFloorDiv(value, THOUSAND));\n }\n get epochNanoseconds(): Return['epochNanoseconds'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return ES.ToBigIntExternal(JSBI.BigInt(GetSlot(this, EPOCHNANOSECONDS)));\n }\n\n add(temporalDurationLike: Params['add'][0]): Return['add'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromInstant('add', this, temporalDurationLike);\n }\n subtract(temporalDurationLike: Params['subtract'][0]): Return['subtract'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromInstant('subtract', this, temporalDurationLike);\n }\n until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalInstant('until', this, other, options);\n }\n since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalInstant('since', this, other, options);\n }\n round(roundToParam: Params['round'][0]): Return['round'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n if (roundToParam === undefined) throw new TypeError('options parameter is required');\n const roundTo =\n typeof roundToParam === 'string'\n ? (ES.CreateOnePropObject('smallestUnit', roundToParam) as Exclude<typeof roundToParam, string>)\n : ES.GetOptionsObject(roundToParam);\n const roundingIncrement = ES.ToTemporalRoundingIncrement(roundTo);\n const roundingMode = ES.ToTemporalRoundingMode(roundTo, 'halfExpand');\n const smallestUnit = ES.GetTemporalUnit(roundTo, 'smallestUnit', 'time', ES.REQUIRED);\n const maximumIncrements = {\n hour: 24,\n minute: 1440,\n second: 86400,\n millisecond: 86400e3,\n microsecond: 86400e6,\n nanosecond: 86400e9\n };\n ES.ValidateTemporalRoundingIncrement(roundingIncrement, maximumIncrements[smallestUnit], true);\n const ns = GetSlot(this, EPOCHNANOSECONDS);\n const roundedNs = ES.RoundInstant(ns, roundingIncrement, smallestUnit, roundingMode);\n return new Instant(roundedNs);\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalInstant(otherParam);\n const one = GetSlot(this, EPOCHNANOSECONDS);\n const two = GetSlot(other, EPOCHNANOSECONDS);\n return JSBI.equal(JSBI.BigInt(one), JSBI.BigInt(two));\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const digits = ES.ToFractionalSecondDigits(options);\n const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');\n const smallestUnit = ES.GetTemporalUnit(options, 'smallestUnit', 'time', undefined);\n if (smallestUnit === 'hour') throw new RangeError('smallestUnit must be a time unit other than \"hour\"');\n let timeZone = options.timeZone;\n if (timeZone !== undefined) timeZone = ES.ToTemporalTimeZoneSlotValue(timeZone);\n const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits);\n const ns = GetSlot(this, EPOCHNANOSECONDS);\n const roundedNs = ES.RoundInstant(ns, increment, unit, roundingMode);\n const roundedInstant = new Instant(roundedNs);\n return ES.TemporalInstantToString(roundedInstant, timeZone as Temporal.TimeZoneProtocol, precision);\n }\n toJSON(): string {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return ES.TemporalInstantToString(this, undefined, 'auto');\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n return new DateTimeFormat(locales, options).format(this);\n }\n valueOf(): never {\n throw new TypeError('use compare() or equals() to compare Temporal.Instant');\n }\n toZonedDateTime(item: Params['toZonedDateTime'][0]): Return['toZonedDateTime'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(item)) {\n throw new TypeError('invalid argument in toZonedDateTime');\n }\n const calendarLike = item.calendar;\n if (calendarLike === undefined) {\n throw new TypeError('missing calendar property in toZonedDateTime');\n }\n const calendar = ES.ToTemporalCalendarSlotValue(calendarLike);\n const temporalTimeZoneLike = item.timeZone;\n if (temporalTimeZoneLike === undefined) {\n throw new TypeError('missing timeZone property in toZonedDateTime');\n }\n const timeZone = ES.ToTemporalTimeZoneSlotValue(temporalTimeZoneLike);\n return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), timeZone, calendar);\n }\n toZonedDateTimeISO(timeZoneParam: Params['toZonedDateTimeISO'][0]): Return['toZonedDateTimeISO'] {\n if (!ES.IsTemporalInstant(this)) throw new TypeError('invalid receiver');\n const timeZone = ES.ToTemporalTimeZoneSlotValue(timeZoneParam);\n return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), timeZone, 'iso8601');\n }\n\n static fromEpochSeconds(epochSecondsParam: Params['fromEpochSeconds'][0]): Return['fromEpochSeconds'] {\n const epochSeconds = ES.ToNumber(epochSecondsParam);\n const epochNanoseconds = JSBI.multiply(JSBI.BigInt(epochSeconds), BILLION);\n ES.ValidateEpochNanoseconds(epochNanoseconds);\n return new Instant(epochNanoseconds);\n }\n static fromEpochMilliseconds(\n epochMillisecondsParam: Params['fromEpochMilliseconds'][0]\n ): Return['fromEpochMilliseconds'] {\n const epochMilliseconds = ES.ToNumber(epochMillisecondsParam);\n const epochNanoseconds = JSBI.multiply(JSBI.BigInt(epochMilliseconds), MILLION);\n ES.ValidateEpochNanoseconds(epochNanoseconds);\n return new Instant(epochNanoseconds);\n }\n static fromEpochMicroseconds(\n epochMicrosecondsParam: Params['fromEpochMicroseconds'][0]\n ): Return['fromEpochMicroseconds'] {\n const epochMicroseconds = ES.ToBigInt(epochMicrosecondsParam);\n const epochNanoseconds = JSBI.multiply(epochMicroseconds, THOUSAND);\n ES.ValidateEpochNanoseconds(epochNanoseconds);\n return new Instant(epochNanoseconds);\n }\n static fromEpochNanoseconds(\n epochNanosecondsParam: Params['fromEpochNanoseconds'][0]\n ): Return['fromEpochNanoseconds'] {\n const epochNanoseconds = ES.ToBigInt(epochNanosecondsParam);\n ES.ValidateEpochNanoseconds(epochNanoseconds);\n return new Instant(epochNanoseconds);\n }\n static from(item: Params['from'][0]): Return['from'] {\n if (ES.IsTemporalInstant(item)) {\n return new Instant(GetSlot(item, EPOCHNANOSECONDS));\n }\n return ES.ToTemporalInstant(item);\n }\n static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {\n const one = ES.ToTemporalInstant(oneParam);\n const two = ES.ToTemporalInstant(twoParam);\n const oneNs = GetSlot(one, EPOCHNANOSECONDS);\n const twoNs = GetSlot(two, EPOCHNANOSECONDS);\n if (JSBI.lessThan(oneNs, twoNs)) return -1;\n if (JSBI.greaterThan(oneNs, twoNs)) return 1;\n return 0;\n }\n [Symbol.toStringTag]!: 'Temporal.Instant';\n}\n\nMakeIntrinsicClass(Instant, 'Temporal.Instant');\n","import { DEBUG } from './debug';\nimport * as ES from './ecmascript';\nimport { GetIntrinsic, MakeIntrinsicClass, DefineIntrinsic } from './intrinsicclass';\nimport {\n CALENDAR_ID,\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n YEARS,\n MONTHS,\n WEEKS,\n DAYS,\n HOURS,\n MINUTES,\n SECONDS,\n MILLISECONDS,\n MICROSECONDS,\n NANOSECONDS,\n CreateSlots,\n GetSlot,\n HasSlot,\n SetSlot\n} from './slots';\nimport type { Temporal } from '..';\nimport type {\n BuiltinCalendarId,\n CalendarParams as Params,\n CalendarReturn as Return,\n AnyTemporalKey,\n CalendarSlot\n} from './internaltypes';\n\nconst ArrayIncludes = Array.prototype.includes;\nconst ArrayPrototypePush = Array.prototype.push;\nconst IntlDateTimeFormat = globalThis.Intl.DateTimeFormat;\nconst ArraySort = Array.prototype.sort;\nconst MathAbs = Math.abs;\nconst MathFloor = Math.floor;\nconst ObjectCreate = Object.create;\nconst ObjectEntries = Object.entries;\nconst OriginalSet = Set;\nconst ReflectOwnKeys = Reflect.ownKeys;\nconst SetPrototypeAdd = Set.prototype.add;\nconst SetPrototypeValues = Set.prototype.values;\n\n/**\n * Shape of internal implementation of each built-in calendar. Note that\n * parameter types are simpler than CalendarProtocol because the `Calendar`\n * class performs validation and parameter normalization before handing control\n * over to CalendarImpl.\n *\n * There are two instances of this interface: one for the ISO calendar and\n * another that handles logic that's the same across all non-ISO calendars. The\n * latter is cloned for each non-ISO calendar at the end of this file.\n */\ninterface CalendarImpl {\n year(date: Temporal.PlainDate | Temporal.PlainYearMonth): number;\n month(date: Temporal.PlainDate | Temporal.PlainYearMonth | Temporal.PlainMonthDay): number;\n monthCode(date: Temporal.PlainDate | Temporal.PlainYearMonth | Temporal.PlainMonthDay): string;\n day(date: Temporal.PlainDate | Temporal.PlainMonthDay): number;\n era(date: Temporal.PlainDate | Temporal.PlainYearMonth): string | undefined;\n eraYear(date: Temporal.PlainDate | Temporal.PlainYearMonth): number | undefined;\n dayOfWeek(date: Temporal.PlainDate): number;\n dayOfYear(date: Temporal.PlainDate): number;\n weekOfYear(date: Temporal.PlainDate): number;\n yearOfWeek(date: Temporal.PlainDate): number;\n daysInWeek(date: Temporal.PlainDate): number;\n daysInMonth(date: Temporal.PlainDate | Temporal.PlainYearMonth): number;\n daysInYear(date: Temporal.PlainDate | Temporal.PlainYearMonth): number;\n monthsInYear(date: Temporal.PlainDate | Temporal.PlainYearMonth): number;\n inLeapYear(date: Temporal.PlainDate | Temporal.PlainYearMonth): boolean;\n dateFromFields(\n fields: Params['dateFromFields'][0],\n options: NonNullable<Params['dateFromFields'][1]>,\n calendar: string\n ): Temporal.PlainDate;\n yearMonthFromFields(\n fields: Params['yearMonthFromFields'][0],\n options: NonNullable<Params['yearMonthFromFields'][1]>,\n calendar: string\n ): Temporal.PlainYearMonth;\n monthDayFromFields(\n fields: Params['monthDayFromFields'][0],\n options: NonNullable<Params['monthDayFromFields'][1]>,\n calendar: string\n ): Temporal.PlainMonthDay;\n dateAdd(\n date: Temporal.PlainDate,\n years: number,\n months: number,\n weeks: number,\n days: number,\n overflow: Overflow,\n calendar: string\n ): Temporal.PlainDate;\n dateUntil(\n one: Temporal.PlainDate,\n two: Temporal.PlainDate,\n largestUnit: 'year' | 'month' | 'week' | 'day'\n ): { years: number; months: number; weeks: number; days: number };\n fields(fields: string[]): string[];\n fieldKeysToIgnore(keys: string[]): string[];\n}\n\ntype CalendarImplementations = {\n [k in BuiltinCalendarId]: CalendarImpl;\n};\n\n/**\n * Implementations for each calendar.\n * Registration for each of these calendars happens throughout this file. The ISO and non-ISO calendars are registered\n * separately - look for 'iso8601' for the ISO calendar registration, and all non-ISO calendar registrations happens\n * at the bottom of the file.\n */\nconst impl: CalendarImplementations = {} as unknown as CalendarImplementations;\n\n/**\n * Thin wrapper around the implementation of each built-in calendar. This\n * class's methods follow a similar pattern:\n * 1. Validate parameters\n * 2. Fill in default options (for methods where options are present)\n * 3. Simplify and/or normalize parameters. For example, some methods accept\n * PlainDate, PlainDateTime, ZonedDateTime, etc. and these are normalized to\n * PlainDate.\n * 4. Look up the ID of the built-in calendar\n * 5. Fetch the implementation object for that ID.\n * 6. Call the corresponding method in the implementation object.\n */\nexport class Calendar implements Temporal.Calendar {\n constructor(idParam: Params['constructor'][0]) {\n // Note: if the argument is not passed, IsBuiltinCalendar(\"undefined\") will fail. This check\n // exists only to improve the error message.\n if (arguments.length < 1) {\n throw new RangeError('missing argument: id is required');\n }\n\n const id = ES.ToString(idParam);\n if (!ES.IsBuiltinCalendar(id)) throw new RangeError(`invalid calendar identifier ${id}`);\n CreateSlots(this);\n SetSlot(this, CALENDAR_ID, ES.ASCIILowercase(id));\n\n if (DEBUG) {\n Object.defineProperty(this, '_repr_', {\n value: `${this[Symbol.toStringTag]} <${id}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n }\n get id(): Return['id'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, CALENDAR_ID);\n }\n dateFromFields(\n fields: Params['dateFromFields'][0],\n optionsParam: Params['dateFromFields'][1] = undefined\n ): Return['dateFromFields'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(fields)) throw new TypeError('invalid fields');\n const options = ES.GetOptionsObject(optionsParam);\n const id = GetSlot(this, CALENDAR_ID);\n return impl[id].dateFromFields(fields, options, id);\n }\n yearMonthFromFields(\n fields: Params['yearMonthFromFields'][0],\n optionsParam: Params['yearMonthFromFields'][1] = undefined\n ): Return['yearMonthFromFields'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(fields)) throw new TypeError('invalid fields');\n const options = ES.GetOptionsObject(optionsParam);\n const id = GetSlot(this, CALENDAR_ID);\n return impl[id].yearMonthFromFields(fields, options, id);\n }\n monthDayFromFields(\n fields: Params['monthDayFromFields'][0],\n optionsParam: Params['monthDayFromFields'][1] = undefined\n ): Return['monthDayFromFields'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(fields)) throw new TypeError('invalid fields');\n const options = ES.GetOptionsObject(optionsParam);\n const id = GetSlot(this, CALENDAR_ID);\n return impl[id].monthDayFromFields(fields, options, id);\n }\n fields(fields: Params['fields'][0]): Return['fields'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const fieldsArray = [] as string[];\n const allowed = new Set([\n 'year',\n 'month',\n 'monthCode',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'millisecond',\n 'microsecond',\n 'nanosecond'\n ]);\n for (const name of fields) {\n if (typeof name !== 'string') throw new TypeError('invalid fields');\n if (!allowed.has(name)) throw new RangeError(`invalid field name ${name}`);\n allowed.delete(name);\n ArrayPrototypePush.call(fieldsArray, name);\n }\n return impl[GetSlot(this, CALENDAR_ID)].fields(fieldsArray);\n }\n mergeFields(\n fieldsParam: Params['mergeFields'][0],\n additionalFieldsParam: Params['mergeFields'][1]\n ): Return['mergeFields'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const fields = ES.ToObject(fieldsParam);\n const fieldsCopy = ObjectCreate(null);\n ES.CopyDataProperties(fieldsCopy, fields, [], [undefined]);\n const additionalFields = ES.ToObject(additionalFieldsParam);\n const additionalFieldsCopy = ObjectCreate(null);\n ES.CopyDataProperties(additionalFieldsCopy, additionalFields, [], [undefined]);\n const additionalKeys = ReflectOwnKeys(additionalFieldsCopy) as (keyof typeof additionalFields)[];\n const overriddenKeys = impl[GetSlot(this, CALENDAR_ID)].fieldKeysToIgnore(additionalKeys);\n const merged = ObjectCreate(null);\n const fieldsKeys = ReflectOwnKeys(fieldsCopy);\n for (const key of fieldsKeys) {\n let propValue = undefined;\n if (ES.Call(ArrayIncludes, overriddenKeys, [key])) propValue = additionalFieldsCopy[key];\n else propValue = fieldsCopy[key];\n if (propValue !== undefined) merged[key] = propValue;\n }\n ES.CopyDataProperties(merged, additionalFieldsCopy, []);\n return merged;\n }\n dateAdd(\n dateParam: Params['dateAdd'][0],\n durationParam: Params['dateAdd'][1],\n optionsParam: Params['dateAdd'][2] = undefined\n ): Return['dateAdd'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const date = ES.ToTemporalDate(dateParam);\n const duration = ES.ToTemporalDuration(durationParam);\n const options = ES.GetOptionsObject(optionsParam);\n const overflow = ES.ToTemporalOverflow(options);\n const { days } = ES.BalanceDuration(\n GetSlot(duration, DAYS),\n GetSlot(duration, HOURS),\n GetSlot(duration, MINUTES),\n GetSlot(duration, SECONDS),\n GetSlot(duration, MILLISECONDS),\n GetSlot(duration, MICROSECONDS),\n GetSlot(duration, NANOSECONDS),\n 'day'\n );\n const id = GetSlot(this, CALENDAR_ID);\n return impl[id].dateAdd(\n date,\n GetSlot(duration, YEARS),\n GetSlot(duration, MONTHS),\n GetSlot(duration, WEEKS),\n days,\n overflow,\n id\n );\n }\n dateUntil(\n oneParam: Params['dateUntil'][0],\n twoParam: Params['dateUntil'][1],\n optionsParam: Params['dateUntil'][2] = undefined\n ): Return['dateUntil'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const one = ES.ToTemporalDate(oneParam);\n const two = ES.ToTemporalDate(twoParam);\n const options = ES.GetOptionsObject(optionsParam);\n let largestUnit = ES.GetTemporalUnit(options, 'largestUnit', 'date', 'auto');\n if (largestUnit === 'auto') largestUnit = 'day';\n const { years, months, weeks, days } = impl[GetSlot(this, CALENDAR_ID)].dateUntil(one, two, largestUnit);\n const Duration = GetIntrinsic('%Temporal.Duration%');\n return new Duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0);\n }\n year(dateParam: Params['year'][0]): Return['year'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].year(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n month(dateParam: Params['month'][0]): Return['month'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (ES.IsTemporalMonthDay(date)) throw new TypeError('use monthCode on PlainMonthDay instead');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].month(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n monthCode(dateParam: Params['monthCode'][0]): Return['monthCode'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date) && !ES.IsTemporalMonthDay(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].monthCode(\n date as Temporal.PlainDate | Temporal.PlainMonthDay | Temporal.PlainYearMonth\n );\n }\n day(dateParam: Params['day'][0]): Return['day'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalMonthDay(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].day(date as Temporal.PlainDate | Temporal.PlainMonthDay);\n }\n era(dateParam: Params['era'][0]): Return['era'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].era(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n eraYear(dateParam: Params['eraYear'][0]): Return['eraYear'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].eraYear(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n dayOfWeek(dateParam: Params['dayOfWeek'][0]): Return['dayOfWeek'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const date = ES.ToTemporalDate(dateParam);\n return impl[GetSlot(this, CALENDAR_ID)].dayOfWeek(date);\n }\n dayOfYear(dateParam: Params['dayOfYear'][0]): Return['dayOfYear'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const date = ES.ToTemporalDate(dateParam);\n return impl[GetSlot(this, CALENDAR_ID)].dayOfYear(date);\n }\n weekOfYear(dateParam: Params['weekOfYear'][0]): Return['weekOfYear'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const date = ES.ToTemporalDate(dateParam);\n return impl[GetSlot(this, CALENDAR_ID)].weekOfYear(date);\n }\n yearOfWeek(dateParam: Params['yearOfWeek'][0]): Return['yearOfWeek'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const date = ES.ToTemporalDate(dateParam);\n return impl[GetSlot(this, CALENDAR_ID)].yearOfWeek(date);\n }\n daysInWeek(dateParam: Params['daysInWeek'][0]): Return['daysInWeek'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n const date = ES.ToTemporalDate(dateParam);\n return impl[GetSlot(this, CALENDAR_ID)].daysInWeek(date);\n }\n daysInMonth(dateParam: Params['daysInMonth'][0]): Return['daysInMonth'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].daysInMonth(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n daysInYear(dateParam: Params['daysInYear'][0]): Return['daysInYear'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].daysInYear(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n monthsInYear(dateParam: Params['monthsInYear'][0]): Return['monthsInYear'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].monthsInYear(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n inLeapYear(dateParam: Params['inLeapYear'][0]): Return['inLeapYear'] {\n let date = dateParam;\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n if (!ES.IsTemporalYearMonth(date)) date = ES.ToTemporalDate(date);\n return impl[GetSlot(this, CALENDAR_ID)].inLeapYear(date as Temporal.PlainDate | Temporal.PlainYearMonth);\n }\n toString(): string {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, CALENDAR_ID);\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, CALENDAR_ID);\n }\n static from(item: Params['from'][0]): Return['from'] {\n const calendarSlotValue = ES.ToTemporalCalendarSlotValue(item);\n return ES.ToTemporalCalendarObject(calendarSlotValue);\n }\n [Symbol.toStringTag]!: 'Temporal.Calendar';\n}\n\nMakeIntrinsicClass(Calendar, 'Temporal.Calendar');\nDefineIntrinsic('Temporal.Calendar.from', Calendar.from);\nDefineIntrinsic('Temporal.Calendar.prototype.dateAdd', Calendar.prototype.dateAdd);\nDefineIntrinsic('Temporal.Calendar.prototype.dateFromFields', Calendar.prototype.dateFromFields);\nDefineIntrinsic('Temporal.Calendar.prototype.dateUntil', Calendar.prototype.dateUntil);\nDefineIntrinsic('Temporal.Calendar.prototype.day', Calendar.prototype.day);\nDefineIntrinsic('Temporal.Calendar.prototype.dayOfWeek', Calendar.prototype.dayOfWeek);\nDefineIntrinsic('Temporal.Calendar.prototype.dayOfYear', Calendar.prototype.dayOfYear);\nDefineIntrinsic('Temporal.Calendar.prototype.daysInMonth', Calendar.prototype.daysInMonth);\nDefineIntrinsic('Temporal.Calendar.prototype.daysInWeek', Calendar.prototype.daysInWeek);\nDefineIntrinsic('Temporal.Calendar.prototype.daysInYear', Calendar.prototype.daysInYear);\nDefineIntrinsic('Temporal.Calendar.prototype.era', Calendar.prototype.era);\nDefineIntrinsic('Temporal.Calendar.prototype.eraYear', Calendar.prototype.eraYear);\nDefineIntrinsic('Temporal.Calendar.prototype.fields', Calendar.prototype.fields);\nDefineIntrinsic('Temporal.Calendar.prototype.inLeapYear', Calendar.prototype.inLeapYear);\nDefineIntrinsic('Temporal.Calendar.prototype.mergeFields', Calendar.prototype.mergeFields);\nDefineIntrinsic('Temporal.Calendar.prototype.month', Calendar.prototype.month);\nDefineIntrinsic('Temporal.Calendar.prototype.monthCode', Calendar.prototype.monthCode);\nDefineIntrinsic('Temporal.Calendar.prototype.monthDayFromFields', Calendar.prototype.monthDayFromFields);\nDefineIntrinsic('Temporal.Calendar.prototype.monthsInYear', Calendar.prototype.monthsInYear);\nDefineIntrinsic('Temporal.Calendar.prototype.weekOfYear', Calendar.prototype.weekOfYear);\nDefineIntrinsic('Temporal.Calendar.prototype.year', Calendar.prototype.year);\nDefineIntrinsic('Temporal.Calendar.prototype.yearMonthFromFields', Calendar.prototype.yearMonthFromFields);\nDefineIntrinsic('Temporal.Calendar.prototype.yearOfWeek', Calendar.prototype.yearOfWeek);\n\n/**\n * Implementation for the ISO 8601 calendar. This is the only calendar that's\n * guaranteed to be supported by all ECMAScript implementations, including those\n * without Intl (ECMA-402) support.\n */\nimpl['iso8601'] = {\n dateFromFields(fieldsParam, options, calendarSlotValue) {\n let fields = ES.PrepareTemporalFields(fieldsParam, ['day', 'month', 'monthCode', 'year'], ['year', 'day']);\n const overflow = ES.ToTemporalOverflow(options);\n fields = resolveNonLunisolarMonth(fields);\n let { year, month, day } = fields;\n ({ year, month, day } = ES.RegulateISODate(year, month, day, overflow));\n return ES.CreateTemporalDate(year, month, day, calendarSlotValue);\n },\n yearMonthFromFields(fieldsParam, options, calendarSlotValue) {\n let fields = ES.PrepareTemporalFields(fieldsParam, ['month', 'monthCode', 'year'], ['year']);\n const overflow = ES.ToTemporalOverflow(options);\n fields = resolveNonLunisolarMonth(fields);\n let { year, month } = fields;\n ({ year, month } = ES.RegulateISOYearMonth(year, month, overflow));\n return ES.CreateTemporalYearMonth(year, month, calendarSlotValue, /* referenceISODay = */ 1);\n },\n monthDayFromFields(fieldsParam, options, calendarSlotValue) {\n let fields = ES.PrepareTemporalFields(fieldsParam, ['day', 'month', 'monthCode', 'year'], ['day']);\n const overflow = ES.ToTemporalOverflow(options);\n if (fields.month !== undefined && fields.year === undefined && fields.monthCode === undefined) {\n throw new TypeError('either year or monthCode required with month');\n }\n const useYear = fields.monthCode === undefined;\n const referenceISOYear = 1972;\n fields = resolveNonLunisolarMonth(fields);\n let { month, day, year } = fields;\n ({ month, day } = ES.RegulateISODate(useYear ? year : referenceISOYear, month, day, overflow));\n return ES.CreateTemporalMonthDay(month, day, calendarSlotValue, referenceISOYear);\n },\n fields(fields) {\n return fields;\n },\n fieldKeysToIgnore(keys) {\n const result = new OriginalSet();\n for (let ix = 0; ix < keys.length; ix++) {\n const key = keys[ix];\n ES.Call(SetPrototypeAdd, result, [key]);\n if (key === 'month') {\n ES.Call(SetPrototypeAdd, result, ['monthCode']);\n } else if (key === 'monthCode') {\n ES.Call(SetPrototypeAdd, result, ['month']);\n }\n }\n return [...ES.Call(SetPrototypeValues, result, [])];\n },\n dateAdd(date, years, months, weeks, days, overflow, calendarSlotValue) {\n let year = GetSlot(date, ISO_YEAR);\n let month = GetSlot(date, ISO_MONTH);\n let day = GetSlot(date, ISO_DAY);\n ({ year, month, day } = ES.AddISODate(year, month, day, years, months, weeks, days, overflow));\n return ES.CreateTemporalDate(year, month, day, calendarSlotValue);\n },\n dateUntil(one, two, largestUnit) {\n return ES.DifferenceISODate(\n GetSlot(one, ISO_YEAR),\n GetSlot(one, ISO_MONTH),\n GetSlot(one, ISO_DAY),\n GetSlot(two, ISO_YEAR),\n GetSlot(two, ISO_MONTH),\n GetSlot(two, ISO_DAY),\n largestUnit\n );\n },\n year(date) {\n return GetSlot(date, ISO_YEAR);\n },\n era() {\n return undefined;\n },\n eraYear() {\n return undefined;\n },\n month(date) {\n return GetSlot(date, ISO_MONTH);\n },\n monthCode(date) {\n return buildMonthCode(GetSlot(date, ISO_MONTH));\n },\n day(date) {\n return GetSlot(date, ISO_DAY);\n },\n dayOfWeek(date) {\n return ES.DayOfWeek(GetSlot(date, ISO_YEAR), GetSlot(date, ISO_MONTH), GetSlot(date, ISO_DAY));\n },\n dayOfYear(date) {\n return ES.DayOfYear(GetSlot(date, ISO_YEAR), GetSlot(date, ISO_MONTH), GetSlot(date, ISO_DAY));\n },\n weekOfYear(date) {\n return ES.WeekOfYear(GetSlot(date, ISO_YEAR), GetSlot(date, ISO_MONTH), GetSlot(date, ISO_DAY)).week;\n },\n yearOfWeek(date) {\n return ES.WeekOfYear(GetSlot(date, ISO_YEAR), GetSlot(date, ISO_MONTH), GetSlot(date, ISO_DAY)).year;\n },\n daysInWeek() {\n return 7;\n },\n daysInMonth(date) {\n return ES.ISODaysInMonth(GetSlot(date, ISO_YEAR), GetSlot(date, ISO_MONTH));\n },\n daysInYear(dateParam) {\n let date = dateParam;\n if (!HasSlot(date, ISO_YEAR)) date = ES.ToTemporalDate(date);\n return ES.LeapYear(GetSlot(date, ISO_YEAR)) ? 366 : 365;\n },\n monthsInYear() {\n return 12;\n },\n inLeapYear(dateParam) {\n let date = dateParam;\n if (!HasSlot(date, ISO_YEAR)) date = ES.ToTemporalDate(date);\n return ES.LeapYear(GetSlot(date, ISO_YEAR));\n }\n};\n\n// Note: Built-in calendars other than iso8601 are not part of the Temporal\n// proposal for ECMA-262. These calendars will be standardized as part of\n// ECMA-402. Code below here includes an implementation of these calendars to\n// validate the Temporal API and to get feedback. However, native non-ISO\n// calendar behavior is at least somewhat implementation-defined, so may not\n// match this polyfill's output exactly.\n//\n// Some ES implementations don't include ECMA-402. For this reason, it's helpful\n// to ensure a clean separation between the ISO calendar implementation which is\n// a part of ECMA-262 and the non-ISO calendar implementation which requires\n// ECMA-402.\n//\n// To ensure this separation, the implementation is split. A `CalendarImpl`\n// interface defines the common operations between both ISO and non-ISO\n// calendars.\n\n/**\n * This type is passed through from Calendar#dateFromFields().\n * `monthExtra` is additional information used internally to identify lunisolar leap months.\n */\ntype CalendarDateFields = Params['dateFromFields'][0] & { monthExtra?: string };\n\n/**\n * This is a \"fully populated\" calendar date record. It's only lacking\n * `era`/`eraYear` (which may not be present in all calendars) and `monthExtra`\n * which is only used in some cases.\n */\ntype FullCalendarDate = {\n era?: string;\n eraYear?: number;\n year: number;\n month: number;\n monthCode: string;\n day: number;\n monthExtra?: string;\n};\n\n// The types below are various subsets of calendar dates\ntype CalendarYMD = { year: number; month: number; day: number };\ntype CalendarYM = { year: number; month: number };\ntype CalendarYearOnly = { year: number };\ntype EraAndEraYear = { era: string; eraYear: number };\n\n/** Record representing YMD of an ISO calendar date */\ntype IsoYMD = { year: number; month: number; day: number };\n\ntype Overflow = NonNullable<Temporal.AssignmentOptions['overflow']>;\n\nfunction monthCodeNumberPart(monthCode: string) {\n if (!monthCode.startsWith('M')) {\n throw new RangeError(`Invalid month code: ${monthCode}. Month codes must start with M.`);\n }\n const month = +monthCode.slice(1);\n if (isNaN(month)) throw new RangeError(`Invalid month code: ${monthCode}`);\n return month;\n}\n\nfunction buildMonthCode(month: number | string, leap = false) {\n return `M${month.toString().padStart(2, '0')}${leap ? 'L' : ''}`;\n}\n\n/**\n * Safely merge a month, monthCode pair into an integer month.\n * If both are present, make sure they match.\n * This logic doesn't work for lunisolar calendars!\n * */\nfunction resolveNonLunisolarMonth<T extends { monthCode?: string; month?: number }>(\n calendarDate: T,\n overflow: Overflow | undefined = undefined,\n monthsPerYear = 12\n) {\n let { month, monthCode } = calendarDate;\n if (monthCode === undefined) {\n if (month === undefined) throw new TypeError('Either month or monthCode are required');\n // The ISO calendar uses the default (undefined) value because it does\n // constrain/reject after this method returns. Non-ISO calendars, however,\n // rely on this function to constrain/reject out-of-range `month` values.\n if (overflow === 'reject') ES.RejectToRange(month, 1, monthsPerYear);\n if (overflow === 'constrain') month = ES.ConstrainToRange(month, 1, monthsPerYear);\n monthCode = buildMonthCode(month);\n } else {\n const numberPart = monthCodeNumberPart(monthCode);\n if (month !== undefined && month !== numberPart) {\n throw new RangeError(`monthCode ${monthCode} and month ${month} must match if both are present`);\n }\n if (monthCode !== buildMonthCode(numberPart)) {\n throw new RangeError(`Invalid month code: ${monthCode}`);\n }\n month = numberPart;\n if (month < 1 || month > monthsPerYear) throw new RangeError(`Invalid monthCode: ${monthCode}`);\n }\n return { ...calendarDate, month, monthCode };\n}\n\ntype CachedTypes = Temporal.PlainYearMonth | Temporal.PlainDate | Temporal.PlainMonthDay;\n\n/**\n * This prototype implementation of non-ISO calendars makes many repeated calls\n * to Intl APIs which may be slow (e.g. >0.2ms). This trivial cache will speed\n * up these repeat accesses. Each cache instance is associated (via a WeakMap)\n * to a specific Temporal object, which speeds up multiple calendar calls on the\n * same Temporal object instance. No invalidation or pruning is necessary\n * because each object's cache is thrown away when the object is GC-ed.\n */\nclass OneObjectCache {\n map = new Map();\n calls = 0;\n now: number;\n hits = 0;\n misses = 0;\n constructor(cacheToClone?: OneObjectCache) {\n this.now = globalThis.performance ? globalThis.performance.now() : Date.now();\n if (cacheToClone !== undefined) {\n let i = 0;\n for (const entry of cacheToClone.map.entries()) {\n if (++i > OneObjectCache.MAX_CACHE_ENTRIES) break;\n this.map.set(...entry);\n }\n }\n }\n get(key: string) {\n const result = this.map.get(key);\n if (result) {\n this.hits++;\n this.report();\n }\n this.calls++;\n return result;\n }\n set(key: string, value: unknown) {\n this.map.set(key, value);\n this.misses++;\n this.report();\n }\n report() {\n /*\n if (this.calls === 0) return;\n const ms = (globalThis.performance ? globalThis.performance.now() : Date.now()) - this.now;\n const hitRate = ((100 * this.hits) / this.calls).toFixed(0);\n console.log(`${this.calls} calls in ${ms.toFixed(2)}ms. Hits: ${this.hits} (${hitRate}%). Misses: ${this.misses}.`);\n */\n }\n setObject(obj: CachedTypes) {\n if (OneObjectCache.objectMap.get(obj)) throw new RangeError('object already cached');\n OneObjectCache.objectMap.set(obj, this);\n this.report();\n }\n\n static objectMap = new WeakMap();\n static MAX_CACHE_ENTRIES = 1000;\n\n /**\n * Returns a WeakMap-backed cache that's used to store expensive results\n * that are associated with a particular Temporal object instance.\n *\n * @param obj - object to associate with the cache\n */\n static getCacheForObject(obj: CachedTypes) {\n let cache = OneObjectCache.objectMap.get(obj);\n if (!cache) {\n cache = new OneObjectCache();\n OneObjectCache.objectMap.set(obj, cache);\n }\n return cache;\n }\n}\n\nfunction toUtcIsoDateString({ isoYear, isoMonth, isoDay }: { isoYear: number; isoMonth: number; isoDay: number }) {\n const yearString = ES.ISOYearString(isoYear);\n const monthString = ES.ISODateTimePartString(isoMonth);\n const dayString = ES.ISODateTimePartString(isoDay);\n return `${yearString}-${monthString}-${dayString}T00:00Z`;\n}\n\nfunction simpleDateDiff(one: CalendarYMD, two: CalendarYMD) {\n return {\n years: one.year - two.year,\n months: one.month - two.month,\n days: one.day - two.day\n };\n}\n\n/**\n * Implementation helper that's common to all non-ISO calendars\n */\nabstract class HelperBase {\n abstract id: BuiltinCalendarId;\n abstract monthsInYear(calendarDate: CalendarYearOnly, cache?: OneObjectCache): number;\n abstract maximumMonthLength(calendarDate?: CalendarYM): number;\n abstract minimumMonthLength(calendarDate?: CalendarYM): number;\n abstract estimateIsoDate(calendarDate: CalendarYMD): IsoYMD;\n abstract inLeapYear(calendarDate: CalendarYearOnly, cache?: OneObjectCache): boolean;\n abstract calendarType: 'solar' | 'lunar' | 'lunisolar';\n reviseIntlEra?<T extends Partial<EraAndEraYear>>(calendarDate: T, isoDate: IsoYMD): T;\n constantEra?: string;\n checkIcuBugs?(isoDate: IsoYMD): void;\n private formatter?: globalThis.Intl.DateTimeFormat;\n getFormatter() {\n // `new Intl.DateTimeFormat()` is amazingly slow and chews up RAM. Per\n // https://bugs.chromium.org/p/v8/issues/detail?id=6528#c4, we cache one\n // DateTimeFormat instance per calendar. Caching is lazy so we only pay for\n // calendars that are used. Note that the nonIsoHelperBase object is spread\n // into each each calendar's implementation before any cache is created, so\n // each calendar gets its own separate cached formatter.\n if (typeof this.formatter === 'undefined') {\n this.formatter = new IntlDateTimeFormat(`en-US-u-ca-${this.id}`, {\n day: 'numeric',\n month: 'numeric',\n year: 'numeric',\n era: this.eraLength,\n timeZone: 'UTC'\n });\n }\n return this.formatter;\n }\n isoToCalendarDate(isoDate: IsoYMD, cache: OneObjectCache): FullCalendarDate {\n const { year: isoYear, month: isoMonth, day: isoDay } = isoDate;\n const key = JSON.stringify({ func: 'isoToCalendarDate', isoYear, isoMonth, isoDay, id: this.id });\n const cached = cache.get(key);\n if (cached) return cached;\n\n const dateTimeFormat = this.getFormatter();\n let parts, isoString;\n try {\n isoString = toUtcIsoDateString({ isoYear, isoMonth, isoDay });\n parts = dateTimeFormat.formatToParts(new Date(isoString));\n } catch (e: unknown) {\n throw new RangeError(`Invalid ISO date: ${JSON.stringify({ isoYear, isoMonth, isoDay })}`);\n }\n const result: Partial<FullCalendarDate> = {};\n for (let { type, value } of parts) {\n if (type === 'year') result.eraYear = +value;\n // TODO: remove this type annotation when `relatedYear` gets into TS lib types\n if (type === ('relatedYear' as Intl.DateTimeFormatPartTypes)) result.eraYear = +value;\n if (type === 'month') {\n const matches = /^([0-9]*)(.*?)$/.exec(value);\n if (!matches || matches.length != 3 || (!matches[1] && !matches[2])) {\n throw new RangeError(`Unexpected month: ${value}`);\n }\n // If the month has no numeric part (should only see this for the Hebrew\n // calendar with newer FF / Chromium versions; see\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1751833) then set a\n // placeholder month index of `1` and rely on the derived class to\n // calculate the correct month index from the month name stored in\n // `monthExtra`.\n result.month = matches[1] ? +matches[1] : 1;\n if (result.month < 1) {\n throw new RangeError(\n `Invalid month ${value} from ${isoString}[u-ca-${this.id}]` +\n ' (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)'\n );\n }\n if (result.month > 13) {\n throw new RangeError(\n `Invalid month ${value} from ${isoString}[u-ca-${this.id}]` +\n ' (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)'\n );\n }\n\n // The ICU formats for the Hebrew calendar no longer support a numeric\n // month format. So we'll rely on the derived class to interpret it.\n // `monthExtra` is also used on the Chinese calendar to handle a suffix\n // \"bis\" indicating a leap month.\n if (matches[2]) result.monthExtra = matches[2];\n }\n if (type === 'day') result.day = +value;\n if (this.hasEra && type === 'era' && value != null && value !== '') {\n // The convention for Temporal era values is lowercase, so following\n // that convention in this prototype. Punctuation is removed, accented\n // letters are normalized, and spaces are replaced with dashes.\n // E.g.: \"ERA0\" => \"era0\", \"Before R.O.C.\" => \"before-roc\", \"En’ō\" => \"eno\"\n // The call to normalize() and the replacement regex deals with era\n // names that contain non-ASCII characters like Japanese eras. Also\n // ignore extra content in parentheses like JPN era date ranges.\n value = value.split(' (')[0];\n result.era = value\n .normalize('NFD')\n .replace(/[^-0-9 \\p{L}]/gu, '')\n .replace(' ', '-')\n .toLowerCase();\n }\n }\n if (result.eraYear === undefined) {\n // Node 12 has outdated ICU data that lacks the `relatedYear` field in the\n // output of Intl.DateTimeFormat.formatToParts.\n throw new RangeError(\n `Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`\n );\n }\n // Translate eras that may be handled differently by Temporal vs. by Intl\n // (e.g. Japanese pre-Meiji eras). See https://github.com/tc39/proposal-temporal/issues/526.\n if (this.reviseIntlEra) {\n const { era, eraYear } = this.reviseIntlEra(result, isoDate);\n result.era = era;\n result.eraYear = eraYear;\n }\n if (this.checkIcuBugs) this.checkIcuBugs(isoDate);\n\n const calendarDate = this.adjustCalendarDate(result, cache, 'constrain', true);\n if (calendarDate.year === undefined) throw new RangeError(`Missing year converting ${JSON.stringify(isoDate)}`);\n if (calendarDate.month === undefined) throw new RangeError(`Missing month converting ${JSON.stringify(isoDate)}`);\n if (calendarDate.day === undefined) throw new RangeError(`Missing day converting ${JSON.stringify(isoDate)}`);\n cache.set(key, calendarDate);\n // Also cache the reverse mapping\n ['constrain', 'reject'].forEach((overflow) => {\n const keyReverse = JSON.stringify({\n func: 'calendarToIsoDate',\n year: calendarDate.year,\n month: calendarDate.month,\n day: calendarDate.day,\n overflow,\n id: this.id\n });\n cache.set(keyReverse, isoDate);\n });\n return calendarDate;\n }\n validateCalendarDate(calendarDate: Partial<FullCalendarDate>): asserts calendarDate is FullCalendarDate {\n const { era, month, year, day, eraYear, monthCode, monthExtra } = calendarDate;\n // When there's a suffix (e.g. \"5bis\" for a leap month in Chinese calendar)\n // the derived class must deal with it.\n if (monthExtra !== undefined) throw new RangeError('Unexpected `monthExtra` value');\n if (year === undefined && eraYear === undefined) throw new TypeError('year or eraYear is required');\n if (month === undefined && monthCode === undefined) throw new TypeError('month or monthCode is required');\n if (day === undefined) throw new RangeError('Missing day');\n if (monthCode !== undefined) {\n if (typeof monthCode !== 'string') {\n throw new RangeError(`monthCode must be a string, not ${typeof monthCode}`);\n }\n if (!/^M([01]?\\d)(L?)$/.test(monthCode)) throw new RangeError(`Invalid monthCode: ${monthCode}`);\n }\n if (this.constantEra) {\n if (era !== undefined && era !== this.constantEra) {\n throw new RangeError(`era must be ${this.constantEra}, not ${era}`);\n }\n if (eraYear !== undefined && year !== undefined && eraYear !== year) {\n throw new RangeError(`eraYear ${eraYear} does not match year ${year}`);\n }\n }\n if (this.hasEra) {\n if ((calendarDate['era'] === undefined) !== (calendarDate['eraYear'] === undefined)) {\n throw new RangeError(\"properties 'era' and 'eraYear' must be provided together\");\n }\n }\n }\n /**\n * Allows derived calendars to add additional fields and/or to make\n * adjustments e.g. to set the era based on the date or to revise the month\n * number in lunisolar calendars per\n * https://github.com/tc39/proposal-temporal/issues/1203.\n *\n * The base implementation fills in missing values by assuming the simplest\n * possible calendar:\n * - no eras or a constant era defined in `.constantEra`\n * - non-lunisolar calendar (no leap months)\n * */\n adjustCalendarDate(\n calendarDateParam: Partial<FullCalendarDate>,\n cache: OneObjectCache | undefined = undefined,\n overflow: Overflow = 'constrain',\n // This param is only used by derived classes\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fromLegacyDate = false\n ): FullCalendarDate {\n if (this.calendarType === 'lunisolar') throw new RangeError('Override required for lunisolar calendars');\n let calendarDate = calendarDateParam;\n this.validateCalendarDate(calendarDate);\n // For calendars that always use the same era, set it here so that derived\n // calendars won't need to implement this method simply to set the era.\n if (this.constantEra) {\n // year and eraYear always match when there's only one possible era\n const { year, eraYear } = calendarDate;\n calendarDate = {\n ...calendarDate,\n era: this.constantEra,\n year: year !== undefined ? year : eraYear,\n eraYear: eraYear !== undefined ? eraYear : year\n };\n }\n\n const largestMonth = this.monthsInYear(calendarDate as CalendarYearOnly, cache);\n let { month, monthCode } = calendarDate;\n\n ({ month, monthCode } = resolveNonLunisolarMonth(calendarDate, overflow, largestMonth));\n return { ...(calendarDate as typeof calendarDate & CalendarYMD), month, monthCode };\n }\n regulateMonthDayNaive(calendarDate: FullCalendarDate, overflow: Overflow, cache: OneObjectCache): FullCalendarDate {\n const largestMonth = this.monthsInYear(calendarDate, cache);\n let { month, day } = calendarDate;\n if (overflow === 'reject') {\n ES.RejectToRange(month, 1, largestMonth);\n ES.RejectToRange(day, 1, this.maximumMonthLength(calendarDate));\n } else {\n month = ES.ConstrainToRange(month, 1, largestMonth);\n day = ES.ConstrainToRange(day, 1, this.maximumMonthLength({ ...calendarDate, month }));\n }\n return { ...calendarDate, month, day };\n }\n calendarToIsoDate(dateParam: CalendarDateFields, overflow: Overflow = 'constrain', cache: OneObjectCache): IsoYMD {\n const originalDate = dateParam as Partial<FullCalendarDate>;\n // First, normalize the calendar date to ensure that (year, month, day)\n // are all present, converting monthCode and eraYear if needed.\n let date = this.adjustCalendarDate(dateParam, cache, overflow, false);\n\n // Fix obviously out-of-bounds values. Values that are valid generally, but\n // not in this particular year, may not be caught here for some calendars.\n // If so, these will be handled lower below.\n date = this.regulateMonthDayNaive(date, overflow, cache);\n\n const { year, month, day } = date;\n const key = JSON.stringify({ func: 'calendarToIsoDate', year, month, day, overflow, id: this.id });\n let cached = cache.get(key);\n if (cached) return cached;\n // If YMD are present in the input but the input has been constrained\n // already, then cache both the original value and the constrained value.\n let keyOriginal;\n if (\n originalDate.year !== undefined &&\n originalDate.month !== undefined &&\n originalDate.day !== undefined &&\n (originalDate.year !== date.year || originalDate.month !== date.month || originalDate.day !== date.day)\n ) {\n keyOriginal = JSON.stringify({\n func: 'calendarToIsoDate',\n year: originalDate.year,\n month: originalDate.month,\n day: originalDate.day,\n overflow,\n id: this.id\n });\n cached = cache.get(keyOriginal);\n if (cached) return cached;\n }\n\n // First, try to roughly guess the result\n let isoEstimate = this.estimateIsoDate({ year, month, day });\n const calculateSameMonthResult = (diffDays: number) => {\n // If the estimate is in the same year & month as the target, then we can\n // calculate the result exactly and short-circuit any additional logic.\n // This optimization assumes that months are continuous. It would break if\n // a calendar skipped days, like the Julian->Gregorian switchover. But the\n // only ICU calendars that currently skip days (japanese/roc/buddhist) is\n // a bug (https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)\n // that's currently detected by `checkIcuBugs()` which will throw. So\n // this optimization should be safe for all ICU calendars.\n let testIsoEstimate = this.addDaysIso(isoEstimate, diffDays);\n if (date.day > this.minimumMonthLength(date)) {\n // There's a chance that the calendar date is out of range. Throw or\n // constrain if so.\n let testCalendarDate = this.isoToCalendarDate(testIsoEstimate, cache);\n while (testCalendarDate.month !== month || testCalendarDate.year !== year) {\n if (overflow === 'reject') {\n throw new RangeError(`day ${day} does not exist in month ${month} of year ${year}`);\n }\n // Back up a day at a time until we're not hanging over the month end\n testIsoEstimate = this.addDaysIso(testIsoEstimate, -1);\n testCalendarDate = this.isoToCalendarDate(testIsoEstimate, cache);\n }\n }\n return testIsoEstimate;\n };\n let sign = 0;\n let roundtripEstimate = this.isoToCalendarDate(isoEstimate, cache);\n let diff = simpleDateDiff(date, roundtripEstimate);\n if (diff.years !== 0 || diff.months !== 0 || diff.days !== 0) {\n const diffTotalDaysEstimate = diff.years * 365 + diff.months * 30 + diff.days;\n isoEstimate = this.addDaysIso(isoEstimate, diffTotalDaysEstimate);\n roundtripEstimate = this.isoToCalendarDate(isoEstimate, cache);\n diff = simpleDateDiff(date, roundtripEstimate);\n if (diff.years === 0 && diff.months === 0) {\n isoEstimate = calculateSameMonthResult(diff.days);\n } else {\n sign = this.compareCalendarDates(date, roundtripEstimate);\n }\n }\n // If the initial guess is not in the same month, then then bisect the\n // distance to the target, starting with 8 days per step.\n let increment = 8;\n while (sign) {\n isoEstimate = this.addDaysIso(isoEstimate, sign * increment);\n const oldRoundtripEstimate = roundtripEstimate;\n roundtripEstimate = this.isoToCalendarDate(isoEstimate, cache);\n const oldSign = sign;\n sign = this.compareCalendarDates(date, roundtripEstimate);\n if (sign) {\n diff = simpleDateDiff(date, roundtripEstimate);\n if (diff.years === 0 && diff.months === 0) {\n isoEstimate = calculateSameMonthResult(diff.days);\n // Signal the loop condition that there's a match.\n sign = 0;\n } else if (oldSign && sign !== oldSign) {\n if (increment > 1) {\n // If the estimate overshot the target, try again with a smaller increment\n // in the reverse direction.\n increment /= 2;\n } else {\n // Increment is 1, and neither the previous estimate nor the new\n // estimate is correct. The only way that can happen is if the\n // original date was an invalid value that will be constrained or\n // rejected here.\n if (overflow === 'reject') {\n throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({ ...originalDate })}`);\n } else {\n // To constrain, pick the earliest value\n const order = this.compareCalendarDates(roundtripEstimate, oldRoundtripEstimate);\n // If current value is larger, then back up to the previous value.\n if (order > 0) isoEstimate = this.addDaysIso(isoEstimate, -1);\n sign = 0;\n }\n }\n }\n }\n }\n cache.set(key, isoEstimate);\n if (keyOriginal) cache.set(keyOriginal, isoEstimate);\n if (\n date.year === undefined ||\n date.month === undefined ||\n date.day === undefined ||\n date.monthCode === undefined ||\n (this.hasEra && (date.era === undefined || date.eraYear === undefined))\n ) {\n throw new RangeError('Unexpected missing property');\n }\n return isoEstimate;\n }\n temporalToCalendarDate(\n date: Temporal.PlainDate | Temporal.PlainMonthDay | Temporal.PlainYearMonth,\n cache: OneObjectCache\n ): FullCalendarDate {\n const isoDate = { year: GetSlot(date, ISO_YEAR), month: GetSlot(date, ISO_MONTH), day: GetSlot(date, ISO_DAY) };\n const result = this.isoToCalendarDate(isoDate, cache);\n return result;\n }\n compareCalendarDates(date1Param: Partial<CalendarYMD>, date2Param: Partial<CalendarYMD>): 0 | 1 | -1 {\n // `date1` and `date2` are already records. The calls below simply validate\n // that all three required fields are present.\n const date1 = ES.PrepareTemporalFields(date1Param, ['day', 'month', 'year'], ['day', 'month', 'year']);\n const date2 = ES.PrepareTemporalFields(date2Param, ['day', 'month', 'year'], ['day', 'month', 'year']);\n if (date1.year !== date2.year) return ES.ComparisonResult(date1.year - date2.year);\n if (date1.month !== date2.month) return ES.ComparisonResult(date1.month - date2.month);\n if (date1.day !== date2.day) return ES.ComparisonResult(date1.day - date2.day);\n return 0;\n }\n /** Ensure that a calendar date actually exists. If not, return the closest earlier date. */\n regulateDate(calendarDate: CalendarYMD, overflow: Overflow = 'constrain', cache: OneObjectCache): FullCalendarDate {\n const isoDate = this.calendarToIsoDate(calendarDate, overflow, cache);\n return this.isoToCalendarDate(isoDate, cache);\n }\n addDaysIso(isoDate: IsoYMD, days: number): IsoYMD {\n const added = ES.AddISODate(isoDate.year, isoDate.month, isoDate.day, 0, 0, 0, days, 'constrain');\n return added;\n }\n addDaysCalendar(calendarDate: CalendarYMD, days: number, cache: OneObjectCache): FullCalendarDate {\n const isoDate = this.calendarToIsoDate(calendarDate, 'constrain', cache);\n const addedIso = this.addDaysIso(isoDate, days);\n const addedCalendar = this.isoToCalendarDate(addedIso, cache);\n return addedCalendar;\n }\n addMonthsCalendar(\n calendarDateParam: CalendarYMD,\n months: number,\n overflow: Overflow,\n cache: OneObjectCache\n ): CalendarYMD {\n let calendarDate = calendarDateParam;\n const { day } = calendarDate;\n for (let i = 0, absMonths = MathAbs(months); i < absMonths; i++) {\n const { month } = calendarDate;\n const oldCalendarDate = calendarDate;\n const days =\n months < 0\n ? -Math.max(day, this.daysInPreviousMonth(calendarDate, cache))\n : this.daysInMonth(calendarDate, cache);\n const isoDate = this.calendarToIsoDate(calendarDate, 'constrain', cache);\n let addedIso = this.addDaysIso(isoDate, days);\n calendarDate = this.isoToCalendarDate(addedIso, cache);\n\n // Normally, we can advance one month by adding the number of days in the\n // current month. However, if we're at the end of the current month and\n // the next month has fewer days, then we rolled over to the after-next\n // month. Below we detect this condition and back up until we're back in\n // the desired month.\n if (months > 0) {\n const monthsInOldYear = this.monthsInYear(oldCalendarDate, cache);\n while (calendarDate.month - 1 !== month % monthsInOldYear) {\n addedIso = this.addDaysIso(addedIso, -1);\n calendarDate = this.isoToCalendarDate(addedIso, cache);\n }\n }\n\n if (calendarDate.day !== day) {\n // try to retain the original day-of-month, if possible\n calendarDate = this.regulateDate({ ...calendarDate, day }, 'constrain', cache);\n }\n }\n if (overflow === 'reject' && calendarDate.day !== day) {\n throw new RangeError(`Day ${day} does not exist in resulting calendar month`);\n }\n return calendarDate;\n }\n addCalendar(\n calendarDate: CalendarYMD & { monthCode: string },\n { years = 0, months = 0, weeks = 0, days = 0 },\n overflow: Overflow,\n cache: OneObjectCache\n ): FullCalendarDate {\n const { year, day, monthCode } = calendarDate;\n const addedYears = this.adjustCalendarDate({ year: year + years, monthCode, day }, cache);\n const addedMonths = this.addMonthsCalendar(addedYears, months, overflow, cache);\n const initialDays = days + weeks * 7;\n const addedDays = this.addDaysCalendar(addedMonths, initialDays, cache);\n return addedDays;\n }\n untilCalendar(\n calendarOne: FullCalendarDate,\n calendarTwo: FullCalendarDate,\n largestUnit: Temporal.DateUnit,\n cache: OneObjectCache\n ): { years: number; months: number; weeks: number; days: number } {\n let days = 0;\n let weeks = 0;\n let months = 0;\n let years = 0;\n switch (largestUnit) {\n case 'day':\n days = this.calendarDaysUntil(calendarOne, calendarTwo, cache);\n break;\n case 'week': {\n const totalDays = this.calendarDaysUntil(calendarOne, calendarTwo, cache);\n days = totalDays % 7;\n weeks = (totalDays - days) / 7;\n break;\n }\n case 'month':\n case 'year': {\n const sign = this.compareCalendarDates(calendarTwo, calendarOne);\n if (!sign) {\n return { years: 0, months: 0, weeks: 0, days: 0 };\n }\n const diffYears = calendarTwo.year - calendarOne.year;\n const diffDays = calendarTwo.day - calendarOne.day;\n if (largestUnit === 'year' && diffYears) {\n let diffInYearSign = 0;\n if (calendarTwo.monthCode > calendarOne.monthCode) diffInYearSign = 1;\n if (calendarTwo.monthCode < calendarOne.monthCode) diffInYearSign = -1;\n if (!diffInYearSign) diffInYearSign = Math.sign(diffDays);\n const isOneFurtherInYear = diffInYearSign * sign < 0;\n years = isOneFurtherInYear ? diffYears - sign : diffYears;\n }\n const yearsAdded = years ? this.addCalendar(calendarOne, { years }, 'constrain', cache) : calendarOne;\n // Now we have less than one year remaining. Add one month at a time\n // until we go over the target, then back up one month and calculate\n // remaining days and weeks.\n let current;\n let next: CalendarYMD = yearsAdded;\n do {\n months += sign;\n current = next;\n next = this.addMonthsCalendar(current, sign, 'constrain', cache);\n if (next.day !== calendarOne.day) {\n // In case the day was constrained down, try to un-constrain it\n next = this.regulateDate({ ...next, day: calendarOne.day }, 'constrain', cache);\n }\n } while (this.compareCalendarDates(calendarTwo, next) * sign >= 0);\n months -= sign; // correct for loop above which overshoots by 1\n const remainingDays = this.calendarDaysUntil(current, calendarTwo, cache);\n days = remainingDays;\n break;\n }\n }\n return { years, months, weeks, days };\n }\n daysInMonth(calendarDate: CalendarYMD, cache: OneObjectCache): number {\n // Add enough days to roll over to the next month. One we're in the next\n // month, we can calculate the length of the current month. NOTE: This\n // algorithm assumes that months are continuous. It would break if a\n // calendar skipped days, like the Julian->Gregorian switchover. But the\n // only ICU calendars that currently skip days (japanese/roc/buddhist) is a\n // bug (https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)\n // that's currently detected by `checkIcuBugs()` which will throw. So this\n // code should be safe for all ICU calendars.\n const { day } = calendarDate;\n const max = this.maximumMonthLength(calendarDate);\n const min = this.minimumMonthLength(calendarDate);\n // easiest case: we already know the month length if min and max are the same.\n if (min === max) return min;\n\n // Add enough days to get into the next month, without skipping it\n const increment = day <= max - min ? max : min;\n const isoDate = this.calendarToIsoDate(calendarDate, 'constrain', cache);\n const addedIsoDate = this.addDaysIso(isoDate, increment);\n const addedCalendarDate = this.isoToCalendarDate(addedIsoDate, cache);\n\n // Now back up to the last day of the original month\n const endOfMonthIso = this.addDaysIso(addedIsoDate, -addedCalendarDate.day);\n const endOfMonthCalendar = this.isoToCalendarDate(endOfMonthIso, cache);\n return endOfMonthCalendar.day;\n }\n daysInPreviousMonth(calendarDate: CalendarYMD, cache: OneObjectCache): number {\n const { day, month, year } = calendarDate;\n\n // Check to see if we already know the month length, and return it if so\n const previousMonthYear = month > 1 ? year : year - 1;\n let previousMonthDate = { year: previousMonthYear, month, day: 1 };\n const previousMonth = month > 1 ? month - 1 : this.monthsInYear(previousMonthDate, cache);\n previousMonthDate = { ...previousMonthDate, month: previousMonth };\n const min = this.minimumMonthLength(previousMonthDate);\n const max = this.maximumMonthLength(previousMonthDate);\n if (min === max) return max;\n\n const isoDate = this.calendarToIsoDate(calendarDate, 'constrain', cache);\n const lastDayOfPreviousMonthIso = this.addDaysIso(isoDate, -day);\n const lastDayOfPreviousMonthCalendar = this.isoToCalendarDate(lastDayOfPreviousMonthIso, cache);\n return lastDayOfPreviousMonthCalendar.day;\n }\n startOfCalendarYear(calendarDate: CalendarYearOnly): CalendarYMD & { monthCode: string } {\n return { year: calendarDate.year, month: 1, monthCode: 'M01', day: 1 };\n }\n startOfCalendarMonth(calendarDate: CalendarYM): CalendarYMD {\n return { year: calendarDate.year, month: calendarDate.month, day: 1 };\n }\n calendarDaysUntil(calendarOne: CalendarYMD, calendarTwo: CalendarYMD, cache: OneObjectCache): number {\n const oneIso = this.calendarToIsoDate(calendarOne, 'constrain', cache);\n const twoIso = this.calendarToIsoDate(calendarTwo, 'constrain', cache);\n return this.isoDaysUntil(oneIso, twoIso);\n }\n isoDaysUntil(oneIso: IsoYMD, twoIso: IsoYMD): number {\n const duration = ES.DifferenceISODate(\n oneIso.year,\n oneIso.month,\n oneIso.day,\n twoIso.year,\n twoIso.month,\n twoIso.day,\n 'day'\n );\n return duration.days;\n }\n // The short era format works for all calendars except Japanese, which will\n // override.\n eraLength: Intl.DateTimeFormatOptions['era'] = 'short';\n // All built-in calendars except Chinese/Dangi and Hebrew use an era\n hasEra = true;\n // See https://github.com/tc39/proposal-temporal/issues/1784\n erasBeginMidYear = false;\n monthDayFromFields(fields: FullCalendarDate, overflow: Overflow, cache: OneObjectCache): IsoYMD {\n let { monthCode, day } = fields;\n if (monthCode === undefined) {\n let { year, era, eraYear } = fields;\n if (year === undefined && (era === undefined || eraYear === undefined)) {\n throw new TypeError('when `monthCode` is omitted, `year` (or `era` and `eraYear`) and `month` are required');\n }\n // Apply overflow behaviour to year/month/day, to get correct monthCode/day\n ({ monthCode, day } = this.isoToCalendarDate(this.calendarToIsoDate(fields, overflow, cache), cache));\n }\n\n let isoYear, isoMonth, isoDay;\n let closestCalendar, closestIso;\n // Look backwards starting from one of the calendar years spanning ISO year\n // 1972, up to 100 calendar years prior, to find a year that has this month\n // and day. Normal months and days will match immediately, but for leap days\n // and leap months we may have to look for a while.\n const startDateIso = { year: 1972, month: 12, day: 31 };\n const calendarOfStartDateIso = this.isoToCalendarDate(startDateIso, cache);\n // Note: relies on lexicographical ordering of monthCodes\n const calendarYear =\n calendarOfStartDateIso.monthCode > monthCode ||\n (calendarOfStartDateIso.monthCode === monthCode && calendarOfStartDateIso.day >= day)\n ? calendarOfStartDateIso.year\n : calendarOfStartDateIso.year - 1;\n for (let i = 0; i < 100; i++) {\n const testCalendarDate: FullCalendarDate = this.adjustCalendarDate(\n { day, monthCode, year: calendarYear - i },\n cache\n );\n const isoDate = this.calendarToIsoDate(testCalendarDate, 'constrain', cache);\n const roundTripCalendarDate = this.isoToCalendarDate(isoDate, cache);\n ({ year: isoYear, month: isoMonth, day: isoDay } = isoDate);\n if (roundTripCalendarDate.monthCode === monthCode && roundTripCalendarDate.day === day) {\n return { month: isoMonth, day: isoDay, year: isoYear };\n } else if (overflow === 'constrain') {\n // non-ISO constrain algorithm tries to find the closest date in a matching month\n if (\n closestCalendar === undefined ||\n (roundTripCalendarDate.monthCode === closestCalendar.monthCode &&\n roundTripCalendarDate.day > closestCalendar.day)\n ) {\n closestCalendar = roundTripCalendarDate;\n closestIso = isoDate;\n }\n }\n }\n if (overflow === 'constrain' && closestIso !== undefined) return closestIso;\n throw new RangeError(`No recent ${this.id} year with monthCode ${monthCode} and day ${day}`);\n }\n}\n\ninterface HebrewMonthInfo {\n [m: string]: (\n | {\n leap: undefined;\n regular: number;\n }\n | {\n leap: number;\n regular: undefined;\n }\n | {\n leap: number;\n regular: number;\n }\n ) & {\n monthCode: string;\n days:\n | number\n | {\n min: number;\n max: number;\n };\n };\n}\n\nclass HebrewHelper extends HelperBase {\n id = 'hebrew' as const;\n calendarType = 'lunisolar' as const;\n inLeapYear(calendarDate: CalendarYearOnly) {\n const { year } = calendarDate;\n // FYI: In addition to adding a month in leap years, the Hebrew calendar\n // also has per-year changes to the number of days of Heshvan and Kislev.\n // Given that these can be calculated by counting the number of days in\n // those months, I assume that these DO NOT need to be exposed as\n // Hebrew-only prototype fields or methods.\n return (7 * year + 1) % 19 < 7;\n }\n monthsInYear(calendarDate: CalendarYearOnly) {\n return this.inLeapYear(calendarDate) ? 13 : 12;\n }\n minimumMonthLength(calendarDate: CalendarYM) {\n return this.minMaxMonthLength(calendarDate, 'min');\n }\n maximumMonthLength(calendarDate: CalendarYM) {\n return this.minMaxMonthLength(calendarDate, 'max');\n }\n minMaxMonthLength(calendarDate: CalendarYM, minOrMax: 'min' | 'max') {\n const { month, year } = calendarDate;\n const monthCode = this.getMonthCode(year, month);\n const monthInfo = ObjectEntries(this.months).find((m) => m[1].monthCode === monthCode);\n if (monthInfo === undefined) throw new RangeError(`unmatched Hebrew month: ${month}`);\n const daysInMonth = monthInfo[1].days;\n return typeof daysInMonth === 'number' ? daysInMonth : daysInMonth[minOrMax];\n }\n /** Take a guess at what ISO date a particular calendar date corresponds to */\n estimateIsoDate(calendarDate: CalendarYMD) {\n const { year } = calendarDate;\n return { year: year - 3760, month: 1, day: 1 };\n }\n months: HebrewMonthInfo = {\n Tishri: { leap: 1, regular: 1, monthCode: 'M01', days: 30 },\n Heshvan: { leap: 2, regular: 2, monthCode: 'M02', days: { min: 29, max: 30 } },\n Kislev: { leap: 3, regular: 3, monthCode: 'M03', days: { min: 29, max: 30 } },\n Tevet: { leap: 4, regular: 4, monthCode: 'M04', days: 29 },\n Shevat: { leap: 5, regular: 5, monthCode: 'M05', days: 30 },\n Adar: { leap: undefined, regular: 6, monthCode: 'M06', days: 29 },\n 'Adar I': { leap: 6, regular: undefined, monthCode: 'M05L', days: 30 },\n 'Adar II': { leap: 7, regular: undefined, monthCode: 'M06', days: 29 },\n Nisan: { leap: 8, regular: 7, monthCode: 'M07', days: 30 },\n Iyar: { leap: 9, regular: 8, monthCode: 'M08', days: 29 },\n Sivan: { leap: 10, regular: 9, monthCode: 'M09', days: 30 },\n Tamuz: { leap: 11, regular: 10, monthCode: 'M10', days: 29 },\n Av: { leap: 12, regular: 11, monthCode: 'M11', days: 30 },\n Elul: { leap: 13, regular: 12, monthCode: 'M12', days: 29 }\n };\n getMonthCode(year: number, month: number) {\n if (this.inLeapYear({ year })) {\n return month === 6 ? buildMonthCode(5, true) : buildMonthCode(month < 6 ? month : month - 1);\n } else {\n return buildMonthCode(month);\n }\n }\n override adjustCalendarDate(\n calendarDate: Partial<FullCalendarDate>,\n cache?: OneObjectCache,\n overflow: Overflow = 'constrain',\n fromLegacyDate = false\n ): FullCalendarDate {\n // The incoming type is actually CalendarDate (same as args to\n // Calendar.dateFromParams) but TS isn't smart enough to follow all the\n // reassignments below, so as an alternative to 10+ type casts, we'll lie\n // here and claim that the type has `day` and `year` filled in already.\n let { year, eraYear, month, monthCode, day, monthExtra } = calendarDate as Omit<\n typeof calendarDate,\n 'year' | 'day'\n > & { year: number; day: number };\n if (year === undefined && eraYear !== undefined) year = eraYear;\n if (eraYear === undefined && year !== undefined) eraYear = year;\n if (fromLegacyDate) {\n // In Pre Node-14 V8, DateTimeFormat.formatToParts `month: 'numeric'`\n // output returns the numeric equivalent of `month` as a string, meaning\n // that `'6'` in a leap year is Adar I, while `'6'` in a non-leap year\n // means Adar. In this case, `month` will already be correct and no action\n // is needed. However, in Node 14 and later formatToParts returns the name\n // of the Hebrew month (e.g. \"Tevet\"), so we'll need to look up the\n // correct `month` using the string name as a key.\n if (monthExtra) {\n const monthInfo = this.months[monthExtra];\n if (!monthInfo) throw new RangeError(`Unrecognized month from formatToParts: ${monthExtra}`);\n month = this.inLeapYear({ year }) ? monthInfo.leap : monthInfo.regular;\n }\n // Because we're getting data from legacy Date, then `month` will always be present\n monthCode = this.getMonthCode(year, month as number);\n const result = { year, month: month as number, day, era: undefined as string | undefined, eraYear, monthCode };\n return result;\n } else {\n // When called without input coming from legacy Date output, simply ensure\n // that all fields are present.\n this.validateCalendarDate(calendarDate);\n if (month === undefined) {\n if ((monthCode as string).endsWith('L')) {\n if (monthCode !== 'M05L') {\n throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${monthCode}`);\n }\n month = 6;\n if (!this.inLeapYear({ year })) {\n if (overflow === 'reject') {\n throw new RangeError(`Hebrew monthCode M05L is invalid in year ${year} which is not a leap year`);\n } else {\n // constrain to same day of next month (Adar)\n month = 6;\n monthCode = 'M06';\n }\n }\n } else {\n month = monthCodeNumberPart(monthCode as string);\n // if leap month is before this one, the month index is one more than the month code\n if (this.inLeapYear({ year }) && month >= 6) month++;\n const largestMonth = this.monthsInYear({ year });\n if (month < 1 || month > largestMonth) throw new RangeError(`Invalid monthCode: ${monthCode}`);\n }\n } else {\n if (overflow === 'reject') {\n ES.RejectToRange(month, 1, this.monthsInYear({ year }));\n ES.RejectToRange(day, 1, this.maximumMonthLength({ year, month }));\n } else {\n month = ES.ConstrainToRange(month, 1, this.monthsInYear({ year }));\n day = ES.ConstrainToRange(day, 1, this.maximumMonthLength({ year, month }));\n }\n if (monthCode === undefined) {\n monthCode = this.getMonthCode(year, month);\n } else {\n const calculatedMonthCode = this.getMonthCode(year, month);\n if (calculatedMonthCode !== monthCode) {\n throw new RangeError(`monthCode ${monthCode} doesn't correspond to month ${month} in Hebrew year ${year}`);\n }\n }\n }\n return { ...calendarDate, day, month, monthCode: monthCode as string, year, eraYear };\n }\n }\n // All built-in calendars except Chinese/Dangi and Hebrew use an era\n override hasEra = false;\n}\n\n/**\n * For Temporal purposes, the Islamic calendar is simple because it's always the\n * same 12 months in the same order.\n */\nabstract class IslamicBaseHelper extends HelperBase {\n abstract override id: BuiltinCalendarId;\n calendarType = 'lunar' as const;\n inLeapYear(calendarDate: CalendarYearOnly, cache: OneObjectCache) {\n // In leap years, the 12th month has 30 days. In non-leap years: 29.\n const days = this.daysInMonth({ year: calendarDate.year, month: 12, day: 1 }, cache);\n return days === 30;\n }\n monthsInYear(/* calendarYear, cache */) {\n return 12;\n }\n minimumMonthLength(/* calendarDate */) {\n return 29;\n }\n maximumMonthLength(/* calendarDate */) {\n return 30;\n }\n DAYS_PER_ISLAMIC_YEAR = 354 + 11 / 30;\n DAYS_PER_ISO_YEAR = 365.2425;\n override constantEra = 'ah';\n estimateIsoDate(calendarDate: CalendarYMD) {\n const { year } = this.adjustCalendarDate(calendarDate);\n return { year: MathFloor((year * this.DAYS_PER_ISLAMIC_YEAR) / this.DAYS_PER_ISO_YEAR) + 622, month: 1, day: 1 };\n }\n}\n\n// There are 6 Islamic calendars with the same implementation in this polyfill.\n// They vary only in their ID. They do emit different output from the underlying\n// Intl implementation, but our code for each of them is identical.\nclass IslamicHelper extends IslamicBaseHelper {\n id = 'islamic' as const;\n}\nclass IslamicUmalquraHelper extends IslamicBaseHelper {\n id = 'islamic-umalqura' as const;\n}\nclass IslamicTblaHelper extends IslamicBaseHelper {\n id = 'islamic-tbla' as const;\n}\nclass IslamicCivilHelper extends IslamicBaseHelper {\n id = 'islamic-civil' as const;\n}\nclass IslamicRgsaHelper extends IslamicBaseHelper {\n id = 'islamic-rgsa' as const;\n}\nclass IslamicCcHelper extends IslamicBaseHelper {\n id = 'islamicc' as const;\n}\n\nclass PersianHelper extends HelperBase {\n id = 'persian' as const;\n calendarType = 'solar' as const;\n inLeapYear(calendarDate: CalendarYearOnly, cache: OneObjectCache) {\n // Same logic (count days in the last month) for Persian as for Islamic,\n // even though Persian is solar and Islamic is lunar.\n return IslamicHelper.prototype.inLeapYear.call(this, calendarDate, cache);\n }\n monthsInYear(/* calendarYear, cache */) {\n return 12;\n }\n minimumMonthLength(calendarDate: CalendarYM) {\n const { month } = calendarDate;\n if (month === 12) return 29;\n return month <= 6 ? 31 : 30;\n }\n maximumMonthLength(calendarDate: CalendarYM) {\n const { month } = calendarDate;\n if (month === 12) return 30;\n return month <= 6 ? 31 : 30;\n }\n override constantEra = 'ap';\n estimateIsoDate(calendarDate: CalendarYMD) {\n const { year } = this.adjustCalendarDate(calendarDate);\n return { year: year + 621, month: 1, day: 1 };\n }\n}\n\ninterface IndianMonthInfo {\n [month: number]: {\n length: number;\n month: number;\n day: number;\n leap?: {\n length: number;\n month: number;\n day: number;\n };\n nextYear?: true | undefined;\n };\n}\n\nclass IndianHelper extends HelperBase {\n id = 'indian' as const;\n calendarType = 'solar' as const;\n inLeapYear(calendarDate: CalendarYearOnly) {\n // From https://en.wikipedia.org/wiki/Indian_national_calendar:\n // Years are counted in the Saka era, which starts its year 0 in the year 78\n // of the Common Era. To determine leap years, add 78 to the Saka year – if\n // the result is a leap year in the Gregorian calendar, then the Saka year\n // is a leap year as well.\n return isGregorianLeapYear(calendarDate.year + 78);\n }\n monthsInYear(/* calendarYear, cache */) {\n return 12;\n }\n minimumMonthLength(calendarDate: CalendarYM) {\n return this.getMonthInfo(calendarDate).length;\n }\n maximumMonthLength(calendarDate: CalendarYM) {\n return this.getMonthInfo(calendarDate).length;\n }\n override constantEra = 'saka';\n // Indian months always start at the same well-known Gregorian month and\n // day. So this conversion is easy and fast. See\n // https://en.wikipedia.org/wiki/Indian_national_calendar\n months: IndianMonthInfo = {\n 1: { length: 30, month: 3, day: 22, leap: { length: 31, month: 3, day: 21 } },\n 2: { length: 31, month: 4, day: 21 },\n 3: { length: 31, month: 5, day: 22 },\n 4: { length: 31, month: 6, day: 22 },\n 5: { length: 31, month: 7, day: 23 },\n 6: { length: 31, month: 8, day: 23 },\n 7: { length: 30, month: 9, day: 23 },\n 8: { length: 30, month: 10, day: 23 },\n 9: { length: 30, month: 11, day: 22 },\n 10: { length: 30, month: 12, day: 22 },\n 11: { length: 30, month: 1, nextYear: true, day: 21 },\n 12: { length: 30, month: 2, nextYear: true, day: 20 }\n };\n getMonthInfo(calendarDate: CalendarYM) {\n const { month } = calendarDate;\n let monthInfo = this.months[month];\n if (monthInfo === undefined) throw new RangeError(`Invalid month: ${month}`);\n if (this.inLeapYear(calendarDate) && monthInfo.leap) monthInfo = monthInfo.leap;\n return monthInfo;\n }\n estimateIsoDate(calendarDateParam: CalendarYMD) {\n // FYI, this \"estimate\" is always the exact ISO date, which makes the Indian\n // calendar fast!\n const calendarDate = this.adjustCalendarDate(calendarDateParam);\n const monthInfo = this.getMonthInfo(calendarDate);\n const isoYear = calendarDate.year + 78 + (monthInfo.nextYear ? 1 : 0);\n const isoMonth = monthInfo.month;\n const isoDay = monthInfo.day;\n const isoDate = ES.AddISODate(isoYear, isoMonth, isoDay, 0, 0, 0, calendarDate.day - 1, 'constrain');\n return isoDate;\n }\n // https://bugs.chromium.org/p/v8/issues/detail?id=10529 causes Intl's Indian\n // calendar output to fail for all dates before 0001-01-01 ISO. For example,\n // in Node 12 0000-01-01 is calculated as 6146/12/-583 instead of 10/11/-79 as\n // expected.\n vulnerableToBceBug =\n new Date('0000-01-01T00:00Z').toLocaleDateString('en-US-u-ca-indian', { timeZone: 'UTC' }) !== '10/11/-79 Saka';\n override checkIcuBugs(isoDate: IsoYMD) {\n if (this.vulnerableToBceBug && isoDate.year < 1) {\n throw new RangeError(\n `calendar '${this.id}' is broken for ISO dates before 0001-01-01` +\n ' (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)'\n );\n }\n }\n}\n\n/**\n * Era metadata defined for each calendar.\n * TODO: instead of optional properties, this should really have rules\n * encoded in the type, e.g. isoEpoch is required unless reverseOf is present.\n * */\ninterface InputEra {\n /** name of the era */\n name: string;\n\n /**\n * Signed calendar year where this era begins.Will be\n * 1 (or 0 for zero-based eras) for the anchor era assuming that `year`\n * numbering starts at the beginning of the anchor era, which is true\n * for all ICU calendars except Japanese. If an era starts mid-year\n * then a calendar month and day are included. Otherwise\n * `{ month: 1, day: 1 }` is assumed.\n */\n anchorEpoch?: CalendarYearOnly | CalendarYMD;\n\n /** ISO date of the first day of this era */\n isoEpoch?: { year: number; month: number; day: number };\n\n /**\n * If present, then this era counts years backwards like BC\n * and this property points to the forward era. This must be\n * the last (oldest) era in the array.\n * */\n reverseOf?: string;\n\n /**\n * If true, the era's years are 0-based. If omitted or false,\n * then the era's years are 1-based.\n * */\n hasYearZero?: boolean;\n\n /**\n * Override if this era is the anchor. Not normally used because\n * anchor eras are inferred.\n * */\n isAnchor?: boolean;\n}\n/**\n * Transformation of the `InputEra` type with all fields filled in by\n * `adjustEras()`\n * */\ninterface Era {\n /** name of the era */\n name: string;\n\n /**\n * alternate name of the era used in old versions of ICU data\n * format is `era{n}` where n is the zero-based index of the era\n * with the oldest era being 0.\n * */\n genericName: string;\n\n /**\n * Signed calendar year where this era begins. Will be 1 (or 0 for zero-based\n * eras) for the anchor era assuming that `year` numbering starts at the\n * beginning of the anchor era, which is true for all ICU calendars except\n * Japanese. For input, the month and day are optional. If an era starts\n * mid-year then a calendar month and day are included.\n * Otherwise `{ month: 1, day: 1 }` is assumed.\n */\n anchorEpoch: CalendarYMD;\n\n /** ISO date of the first day of this era */\n isoEpoch: IsoYMD;\n\n /**\n * If present, then this era counts years backwards like BC\n * and this property points to the forward era. This must be\n * the last (oldest) era in the array.\n * */\n reverseOf?: Era;\n\n /**\n * If true, the era's years are 0-based. If omitted or false,\n * then the era's years are 1-based.\n * */\n hasYearZero?: boolean;\n\n /**\n * Override if this era is the anchor. Not normally used because\n * anchor eras are inferred.\n * */\n isAnchor?: boolean;\n}\n\n/**\n * This function adds additional metadata that makes it easier to work with\n * eras. Note that it mutates and normalizes the original era objects, which is\n * OK because this is non-observable, internal-only metadata.\n *\n * The result is an array of eras with the shape defined above.\n * */\nfunction adjustEras(erasParam: InputEra[]): { eras: Era[]; anchorEra: Era } {\n let eras: (InputEra | Era)[] = erasParam;\n if (eras.length === 0) {\n throw new RangeError('Invalid era data: eras are required');\n }\n if (eras.length === 1 && eras[0].reverseOf) {\n throw new RangeError('Invalid era data: anchor era cannot count years backwards');\n }\n if (eras.length === 1 && !eras[0].name) {\n throw new RangeError('Invalid era data: at least one named era is required');\n }\n if (eras.filter((e) => e.reverseOf != null).length > 1) {\n throw new RangeError('Invalid era data: only one era can count years backwards');\n }\n\n // Find the \"anchor era\" which is the era used for (era-less) `year`. Reversed\n // eras can never be anchors. The era without an `anchorEpoch` property is the\n // anchor.\n let anchorEra: Era | InputEra | undefined;\n eras.forEach((e) => {\n if (e.isAnchor || (!e.anchorEpoch && !e.reverseOf)) {\n if (anchorEra) throw new RangeError('Invalid era data: cannot have multiple anchor eras');\n anchorEra = e;\n e.anchorEpoch = { year: e.hasYearZero ? 0 : 1 };\n } else if (!e.name) {\n throw new RangeError('If era name is blank, it must be the anchor era');\n }\n });\n\n // If the era name is undefined, then it's an anchor that doesn't interact\n // with eras at all. For example, Japanese `year` is always the same as ISO\n // `year`. So this \"era\" is the anchor era but isn't used for era matching.\n // Strip it from the list that's returned.\n eras = eras.filter((e) => e.name);\n\n eras.forEach((e) => {\n // Some eras are mirror images of another era e.g. B.C. is the reverse of A.D.\n // Replace the string-valued \"reverseOf\" property with the actual era object\n // that's reversed.\n const { reverseOf } = e;\n if (reverseOf) {\n const reversedEra = eras.find((era) => era.name === reverseOf);\n if (reversedEra === undefined) throw new RangeError(`Invalid era data: unmatched reverseOf era: ${reverseOf}`);\n e.reverseOf = reversedEra as Era;\n e.anchorEpoch = reversedEra.anchorEpoch;\n e.isoEpoch = reversedEra.isoEpoch;\n }\n type YMD = {\n year: number;\n month: number;\n day: number;\n };\n if ((e.anchorEpoch as YMD).month === undefined) (e.anchorEpoch as YMD).month = 1;\n if ((e.anchorEpoch as YMD).day === undefined) (e.anchorEpoch as YMD).day = 1;\n });\n\n // Ensure that the latest epoch is first in the array. This lets us try to\n // match eras in index order, with the last era getting the remaining older\n // years. Any reverse-signed era must be at the end.\n ArraySort.call(eras, (e1, e2) => {\n if (e1.reverseOf) return 1;\n if (e2.reverseOf) return -1;\n if (!e1.isoEpoch || !e2.isoEpoch) throw new RangeError('Invalid era data: missing ISO epoch');\n return e2.isoEpoch.year - e1.isoEpoch.year;\n });\n\n // If there's a reversed era, then the one before it must be the era that's\n // being reversed.\n const lastEraReversed = eras[eras.length - 1].reverseOf;\n if (lastEraReversed) {\n if (lastEraReversed !== eras[eras.length - 2]) throw new RangeError('Invalid era data: invalid reverse-sign era');\n }\n\n // Finally, add a \"genericName\" property in the format \"era{n} where `n` is\n // zero-based index, with the oldest era being zero. This format is used by\n // older versions of ICU data.\n eras.forEach((e, i) => {\n (e as Era).genericName = `era${eras.length - 1 - i}`;\n });\n\n return { eras: eras as Era[], anchorEra: (anchorEra || eras[0]) as Era };\n}\n\nfunction isGregorianLeapYear(year: number) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\n/** Base for all Gregorian-like calendars. */\nabstract class GregorianBaseHelper extends HelperBase {\n id: BuiltinCalendarId;\n eras: Era[];\n anchorEra: Era;\n\n constructor(id: BuiltinCalendarId, originalEras: InputEra[]) {\n super();\n this.id = id;\n const { eras, anchorEra } = adjustEras(originalEras);\n this.anchorEra = anchorEra;\n this.eras = eras;\n }\n calendarType = 'solar' as const;\n inLeapYear(calendarDate: CalendarYearOnly) {\n // Calendars that don't override this method use the same months and leap\n // years as Gregorian. Once we know the ISO year corresponding to the\n // calendar year, we'll know if it's a leap year or not.\n const { year } = this.estimateIsoDate({ month: 1, day: 1, year: calendarDate.year });\n return isGregorianLeapYear(year);\n }\n monthsInYear(/* calendarDate */) {\n return 12;\n }\n minimumMonthLength(calendarDate: CalendarYM): number {\n const { month } = calendarDate;\n if (month === 2) return this.inLeapYear(calendarDate) ? 29 : 28;\n return [4, 6, 9, 11].indexOf(month) >= 0 ? 30 : 31;\n }\n maximumMonthLength(calendarDate: CalendarYM): number {\n return this.minimumMonthLength(calendarDate);\n }\n /** Fill in missing parts of the (year, era, eraYear) tuple */\n completeEraYear(calendarDate: Partial<FullCalendarDate>) {\n const checkField = (name: keyof FullCalendarDate, value: string | number | undefined) => {\n const currentValue = calendarDate[name];\n if (currentValue != null && currentValue != value) {\n throw new RangeError(`Input ${name} ${currentValue} doesn't match calculated value ${value}`);\n }\n };\n const eraFromYear = (year: number) => {\n let eraYear;\n const adjustedCalendarDate = { ...calendarDate, year };\n const matchingEra = this.eras.find((e, i) => {\n if (i === this.eras.length - 1) {\n if (e.reverseOf) {\n // This is a reverse-sign era (like BCE) which must be the oldest\n // era. Count years backwards.\n if (year > 0) throw new RangeError(`Signed year ${year} is invalid for era ${e.name}`);\n eraYear = e.anchorEpoch.year - year;\n return true;\n }\n // last era always gets all \"leftover\" (older than epoch) years,\n // so no need for a comparison like below.\n eraYear = year - e.anchorEpoch.year + (e.hasYearZero ? 0 : 1);\n return true;\n }\n const comparison = this.compareCalendarDates(adjustedCalendarDate, e.anchorEpoch);\n if (comparison >= 0) {\n eraYear = year - e.anchorEpoch.year + (e.hasYearZero ? 0 : 1);\n return true;\n }\n return false;\n });\n if (!matchingEra) throw new RangeError(`Year ${year} was not matched by any era`);\n return { eraYear: eraYear as unknown as number, era: matchingEra.name };\n };\n\n let { year, eraYear, era } = calendarDate;\n if (year != null) {\n ({ eraYear, era } = eraFromYear(year));\n checkField('era', era);\n checkField('eraYear', eraYear);\n } else if (eraYear != null) {\n const matchingEra =\n era === undefined ? undefined : this.eras.find((e) => e.name === era || e.genericName === era);\n if (!matchingEra) throw new RangeError(`Era ${era} (ISO year ${eraYear}) was not matched by any era`);\n if (eraYear < 1 && matchingEra.reverseOf) {\n throw new RangeError(`Years in ${era} era must be positive, not ${year}`);\n }\n if (matchingEra.reverseOf) {\n year = matchingEra.anchorEpoch.year - eraYear;\n } else {\n year = eraYear + matchingEra.anchorEpoch.year - (matchingEra.hasYearZero ? 0 : 1);\n }\n checkField('year', year);\n // We'll accept dates where the month/day is earlier than the start of\n // the era or after its end as long as it's in the same year. If that\n // happens, we'll adjust the era/eraYear pair to be the correct era for\n // the `year`.\n ({ eraYear, era } = eraFromYear(year));\n } else {\n throw new RangeError('Either `year` or `eraYear` and `era` are required');\n }\n return { ...calendarDate, year, eraYear, era };\n }\n override adjustCalendarDate(\n calendarDateParam: Partial<FullCalendarDate>,\n cache?: OneObjectCache,\n overflow: Overflow = 'constrain'\n ): FullCalendarDate {\n let calendarDate = calendarDateParam;\n // Because this is not a lunisolar calendar, it's safe to convert monthCode to a number\n const { month, monthCode } = calendarDate;\n if (month === undefined) calendarDate = { ...calendarDate, month: monthCodeNumberPart(monthCode as string) };\n this.validateCalendarDate(calendarDate);\n calendarDate = this.completeEraYear(calendarDate);\n return super.adjustCalendarDate(calendarDate, cache, overflow);\n }\n estimateIsoDate(calendarDateParam: CalendarYMD) {\n const calendarDate = this.adjustCalendarDate(calendarDateParam);\n const { year, month, day } = calendarDate;\n const { anchorEra } = this;\n const isoYearEstimate = year + anchorEra.isoEpoch.year - (anchorEra.hasYearZero ? 0 : 1);\n return ES.RegulateISODate(isoYearEstimate, month, day, 'constrain');\n }\n // Several calendars based on the Gregorian calendar use Julian dates (not\n // proleptic Gregorian dates) before the Julian switchover in Oct 1582. See\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1173158.\n v8IsVulnerableToJulianBug = new Date('+001001-01-01T00:00Z')\n .toLocaleDateString('en-US-u-ca-japanese', { timeZone: 'UTC' })\n .startsWith('12');\n calendarIsVulnerableToJulianBug = false;\n override checkIcuBugs(isoDate: IsoYMD) {\n if (this.calendarIsVulnerableToJulianBug && this.v8IsVulnerableToJulianBug) {\n const beforeJulianSwitch = ES.CompareISODate(isoDate.year, isoDate.month, isoDate.day, 1582, 10, 15) < 0;\n if (beforeJulianSwitch) {\n throw new RangeError(\n `calendar '${this.id}' is broken for ISO dates before 1582-10-15` +\n ' (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)'\n );\n }\n }\n }\n}\n\nabstract class OrthodoxBaseHelper extends GregorianBaseHelper {\n constructor(id: BuiltinCalendarId, originalEras: InputEra[]) {\n super(id, originalEras);\n }\n override inLeapYear(calendarDate: CalendarYearOnly) {\n // Leap years happen one year before the Julian leap year. Note that this\n // calendar is based on the Julian calendar which has a leap year every 4\n // years, unlike the Gregorian calendar which doesn't have leap years on\n // years divisible by 100 except years divisible by 400.\n //\n // Note that we're assuming that leap years in before-epoch times match\n // how leap years are defined now. This is probably not accurate but I'm\n // not sure how better to do it.\n const { year } = calendarDate;\n return (year + 1) % 4 === 0;\n }\n override monthsInYear(/* calendarDate */) {\n return 13;\n }\n override minimumMonthLength(calendarDate: CalendarYM) {\n const { month } = calendarDate;\n // Ethiopian/Coptic calendars have 12 30-day months and an extra 5-6 day 13th month.\n if (month === 13) return this.inLeapYear(calendarDate) ? 6 : 5;\n return 30;\n }\n override maximumMonthLength(calendarDate: CalendarYM) {\n return this.minimumMonthLength(calendarDate);\n }\n}\n\n// `coptic` and `ethiopic` calendars are very similar to `ethioaa` calendar,\n// with the following differences:\n// - Coptic uses BCE-like positive numbers for years before its epoch (the other\n// two use negative year numbers before epoch)\n// - Coptic has a different epoch date\n// - Ethiopic has an additional second era that starts at the same date as the\n// zero era of ethioaa.\nclass EthioaaHelper extends OrthodoxBaseHelper {\n constructor() {\n super('ethioaa', [{ name: 'era0', isoEpoch: { year: -5492, month: 7, day: 17 } }]);\n }\n}\nclass CopticHelper extends OrthodoxBaseHelper {\n constructor() {\n super('coptic', [\n { name: 'era1', isoEpoch: { year: 284, month: 8, day: 29 } },\n { name: 'era0', reverseOf: 'era1' }\n ]);\n }\n}\n\n// Anchor is currently the older era to match ethioaa, but should it be the newer era?\n// See https://github.com/tc39/ecma402/issues/534 for discussion.\nclass EthiopicHelper extends OrthodoxBaseHelper {\n constructor() {\n super('ethiopic', [\n { name: 'era0', isoEpoch: { year: -5492, month: 7, day: 17 } },\n { name: 'era1', isoEpoch: { year: 8, month: 8, day: 27 }, anchorEpoch: { year: 5501 } }\n ]);\n }\n}\n\nclass RocHelper extends GregorianBaseHelper {\n constructor() {\n super('roc', [\n { name: 'minguo', isoEpoch: { year: 1912, month: 1, day: 1 } },\n { name: 'before-roc', reverseOf: 'minguo' }\n ]);\n }\n override calendarIsVulnerableToJulianBug = true;\n}\n\nclass BuddhistHelper extends GregorianBaseHelper {\n constructor() {\n super('buddhist', [{ name: 'be', hasYearZero: true, isoEpoch: { year: -543, month: 1, day: 1 } }]);\n }\n override calendarIsVulnerableToJulianBug = true;\n}\n\nclass GregoryHelper extends GregorianBaseHelper {\n constructor() {\n super('gregory', [\n { name: 'ce', isoEpoch: { year: 1, month: 1, day: 1 } },\n { name: 'bce', reverseOf: 'ce' }\n ]);\n }\n override reviseIntlEra<T extends Partial<EraAndEraYear>>(calendarDate: T /*, isoDate: IsoDate*/): T {\n let { era, eraYear } = calendarDate;\n // Firefox 96 introduced a bug where the `'short'` format of the era\n // option mistakenly returns the one-letter (narrow) format instead. The\n // code below handles either the correct or Firefox-buggy format. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1752253\n if (era === 'bc' || era === 'b') era = 'bce';\n if (era === 'ad' || era === 'a') era = 'ce';\n return { era, eraYear } as T;\n }\n}\n\n// NOTE: Only the 5 modern eras (Meiji and later) are included. For dates\n// before Meiji 1, the `ce` and `bce` eras are used. Challenges with pre-Meiji\n// eras include:\n// - Start/end dates of older eras are not precisely defined, which is\n// challenging given Temporal's need for precision\n// - Some era dates and/or names are disputed by historians\n// - As historical research proceeds, new eras are discovered and existing era\n// dates are modified, leading to considerable churn which is not good for\n// Temporal use.\n// - The earliest era (in 645 CE) may not end up being the earliest depending\n// on future historical scholarship\n// - Before Meiji, Japan used a lunar (or lunisolar?) calendar but AFAIK\n// that's not reflected in the ICU implementation.\n//\n// For more discussion: https://github.com/tc39/proposal-temporal/issues/526.\n//\n// Here's a full list of CLDR/ICU eras:\n// https://github.com/unicode-org/icu/blob/master/icu4c/source/data/locales/root.txt#L1582-L1818\n// https://github.com/unicode-org/cldr/blob/master/common/supplemental/supplementalData.xml#L4310-L4546\n//\n// NOTE: Japan started using the Gregorian calendar in 6 Meiji, replacing a\n// lunisolar calendar. So the day before January 1 of 6 Meiji (1873) was not\n// December 31, but December 2, of 5 Meiji (1872). The existing Ecma-402\n// Japanese calendar doesn't seem to take this into account, so neither do we:\n// > args = ['en-ca-u-ca-japanese', { era: 'short' }]\n// > new Date('1873-01-01T12:00').toLocaleString(...args)\n// '1 1, 6 Meiji, 12:00:00 PM'\n// > new Date('1872-12-31T12:00').toLocaleString(...args)\n// '12 31, 5 Meiji, 12:00:00 PM'\nclass JapaneseHelper extends GregorianBaseHelper {\n constructor() {\n super('japanese', [\n // The Japanese calendar `year` is just the ISO year, because (unlike other\n // ICU calendars) there's no obvious \"default era\", we use the ISO year.\n { name: 'reiwa', isoEpoch: { year: 2019, month: 5, day: 1 }, anchorEpoch: { year: 2019, month: 5, day: 1 } },\n { name: 'heisei', isoEpoch: { year: 1989, month: 1, day: 8 }, anchorEpoch: { year: 1989, month: 1, day: 8 } },\n { name: 'showa', isoEpoch: { year: 1926, month: 12, day: 25 }, anchorEpoch: { year: 1926, month: 12, day: 25 } },\n { name: 'taisho', isoEpoch: { year: 1912, month: 7, day: 30 }, anchorEpoch: { year: 1912, month: 7, day: 30 } },\n { name: 'meiji', isoEpoch: { year: 1868, month: 9, day: 8 }, anchorEpoch: { year: 1868, month: 9, day: 8 } },\n { name: 'ce', isoEpoch: { year: 1, month: 1, day: 1 } },\n { name: 'bce', reverseOf: 'ce' }\n ]);\n }\n override calendarIsVulnerableToJulianBug = true;\n\n // The last 3 Japanese eras confusingly return only one character in the\n // default \"short\" era, so need to use the long format.\n override eraLength = 'long' as const;\n\n override erasBeginMidYear = true;\n\n override reviseIntlEra<T extends Partial<EraAndEraYear>>(calendarDate: T, isoDate: IsoYMD): T {\n const { era, eraYear } = calendarDate;\n const { year: isoYear } = isoDate;\n if (this.eras.find((e) => e.name === era)) return { era, eraYear } as T;\n return (isoYear < 1 ? { era: 'bce', eraYear: 1 - isoYear } : { era: 'ce', eraYear: isoYear }) as T;\n }\n}\n\ninterface ChineseMonthInfo {\n [key: string]: { monthIndex: number; daysInMonth: number };\n}\ninterface ChineseDraftMonthInfo {\n [key: string]: { monthIndex: number; daysInMonth?: number };\n}\n\nabstract class ChineseBaseHelper extends HelperBase {\n abstract override id: BuiltinCalendarId;\n calendarType = 'lunisolar' as const;\n inLeapYear(calendarDate: CalendarYearOnly, cache: OneObjectCache) {\n const months = this.getMonthList(calendarDate.year, cache);\n return ObjectEntries(months).length === 13;\n }\n monthsInYear(calendarDate: CalendarYearOnly, cache: OneObjectCache) {\n return this.inLeapYear(calendarDate, cache) ? 13 : 12;\n }\n minimumMonthLength(/* calendarDate */) {\n return 29;\n }\n maximumMonthLength(/* calendarDate */) {\n return 30;\n }\n getMonthList(calendarYear: number, cache: OneObjectCache): ChineseMonthInfo {\n if (calendarYear === undefined) {\n throw new TypeError('Missing year');\n }\n const key = JSON.stringify({ func: 'getMonthList', calendarYear, id: this.id });\n const cached = cache.get(key);\n if (cached) return cached;\n const dateTimeFormat = this.getFormatter();\n const getCalendarDate = (isoYear: number, daysPastFeb1: number) => {\n const isoStringFeb1 = toUtcIsoDateString({ isoYear, isoMonth: 2, isoDay: 1 });\n const legacyDate = new Date(isoStringFeb1);\n // Now add the requested number of days, which may wrap to the next month.\n legacyDate.setUTCDate(daysPastFeb1 + 1);\n const newYearGuess = dateTimeFormat.formatToParts(legacyDate);\n const calendarMonthString = (newYearGuess.find((tv) => tv.type === 'month') as Intl.DateTimeFormatPart).value;\n const calendarDay = +(newYearGuess.find((tv) => tv.type === 'day') as Intl.DateTimeFormatPart).value;\n let calendarYearToVerify: globalThis.Intl.DateTimeFormatPart | number | undefined = newYearGuess.find(\n (tv) => (tv.type as string) === 'relatedYear'\n );\n if (calendarYearToVerify !== undefined) {\n calendarYearToVerify = +calendarYearToVerify.value;\n } else {\n // Node 12 has outdated ICU data that lacks the `relatedYear` field in the\n // output of Intl.DateTimeFormat.formatToParts.\n throw new RangeError(\n `Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`\n );\n }\n return { calendarMonthString, calendarDay, calendarYearToVerify };\n };\n\n // First, find a date close to Chinese New Year. Feb 17 will either be in\n // the first month or near the end of the last month of the previous year.\n let isoDaysDelta = 17;\n let { calendarMonthString, calendarDay, calendarYearToVerify } = getCalendarDate(calendarYear, isoDaysDelta);\n\n // If we didn't guess the first month correctly, add (almost in some months)\n // a lunar month\n if (calendarMonthString !== '1') {\n isoDaysDelta += 29;\n ({ calendarMonthString, calendarDay } = getCalendarDate(calendarYear, isoDaysDelta));\n }\n\n // Now back up to near the start of the first month, but not too near that\n // off-by-one issues matter.\n isoDaysDelta -= calendarDay - 5;\n const result = {} as ChineseDraftMonthInfo;\n let monthIndex = 1;\n let oldCalendarDay: number | undefined;\n let oldMonthString: string | undefined;\n let done = false;\n do {\n ({ calendarMonthString, calendarDay, calendarYearToVerify } = getCalendarDate(calendarYear, isoDaysDelta));\n if (oldCalendarDay) {\n result[oldMonthString as string].daysInMonth = oldCalendarDay + 30 - calendarDay;\n }\n if (calendarYearToVerify !== calendarYear) {\n done = true;\n } else {\n result[calendarMonthString] = { monthIndex: monthIndex++ };\n // Move to the next month. Because months are sometimes 29 days, the day of the\n // calendar month will move forward slowly but not enough to flip over to a new\n // month before the loop ends at 12-13 months.\n isoDaysDelta += 30;\n }\n oldCalendarDay = calendarDay;\n oldMonthString = calendarMonthString;\n } while (!done);\n result[oldMonthString].daysInMonth = oldCalendarDay + 30 - calendarDay;\n\n cache.set(key, result);\n return result as ChineseMonthInfo;\n }\n estimateIsoDate(calendarDate: CalendarYMD) {\n const { year, month } = calendarDate;\n return { year, month: month >= 12 ? 12 : month + 1, day: 1 };\n }\n override adjustCalendarDate(\n calendarDate: Partial<FullCalendarDate>,\n cache: OneObjectCache,\n overflow: Overflow = 'constrain',\n fromLegacyDate = false\n ): FullCalendarDate {\n let { year, month, monthExtra, day, monthCode, eraYear } = calendarDate;\n if (fromLegacyDate) {\n // Legacy Date output returns a string that's an integer with an optional\n // \"bis\" suffix used only by the Chinese/Dangi calendar to indicate a leap\n // month. Below we'll normalize the output.\n year = eraYear;\n if (monthExtra && monthExtra !== 'bis') throw new RangeError(`Unexpected leap month suffix: ${monthExtra}`);\n const monthCode = buildMonthCode(month as number, monthExtra !== undefined);\n const monthString = `${month}${monthExtra || ''}`;\n const months = this.getMonthList(year as number, cache);\n const monthInfo = months[monthString];\n if (monthInfo === undefined) throw new RangeError(`Unmatched month ${monthString} in Chinese year ${year}`);\n month = monthInfo.monthIndex;\n return { year: year as number, month, day: day as number, era: undefined, eraYear, monthCode };\n } else {\n // When called without input coming from legacy Date output,\n // simply ensure that all fields are present.\n this.validateCalendarDate(calendarDate);\n if (year === undefined) year = eraYear;\n if (eraYear === undefined) eraYear = year;\n if (month === undefined) {\n ES.assertExists(monthCode);\n const months = this.getMonthList(year as number, cache);\n let numberPart = monthCode.replace('L', 'bis').slice(1);\n if (numberPart[0] === '0') numberPart = numberPart.slice(1);\n let monthInfo = months[numberPart];\n month = monthInfo && monthInfo.monthIndex;\n\n // If this leap month isn't present in this year, constrain to the same\n // day of the previous month.\n if (month === undefined && monthCode.endsWith('L') && monthCode != 'M13L' && overflow === 'constrain') {\n let withoutML = monthCode.slice(1, -1);\n if (withoutML[0] === '0') withoutML = withoutML.slice(1);\n monthInfo = months[withoutML];\n if (monthInfo) {\n month = monthInfo.monthIndex;\n monthCode = buildMonthCode(withoutML);\n }\n }\n if (month === undefined) {\n throw new RangeError(`Unmatched month ${monthCode} in Chinese year ${year}`);\n }\n } else if (monthCode === undefined) {\n const months = this.getMonthList(year as number, cache);\n const monthEntries = ObjectEntries(months);\n const largestMonth = monthEntries.length;\n if (overflow === 'reject') {\n ES.RejectToRange(month, 1, largestMonth);\n ES.RejectToRange(day as number, 1, this.maximumMonthLength());\n } else {\n month = ES.ConstrainToRange(month, 1, largestMonth);\n day = ES.ConstrainToRange(day, 1, this.maximumMonthLength());\n }\n const matchingMonthEntry = monthEntries.find(([, v]) => v.monthIndex === month);\n if (matchingMonthEntry === undefined) {\n throw new RangeError(`Invalid month ${month} in Chinese year ${year}`);\n }\n monthCode = buildMonthCode(\n matchingMonthEntry[0].replace('bis', ''),\n matchingMonthEntry[0].indexOf('bis') !== -1\n );\n } else {\n // Both month and monthCode are present. Make sure they don't conflict.\n const months = this.getMonthList(year as number, cache);\n let numberPart = monthCode.replace('L', 'bis').slice(1);\n if (numberPart[0] === '0') numberPart = numberPart.slice(1);\n const monthInfo = months[numberPart];\n if (!monthInfo) throw new RangeError(`Unmatched monthCode ${monthCode} in Chinese year ${year}`);\n if (month !== monthInfo.monthIndex) {\n throw new RangeError(`monthCode ${monthCode} doesn't correspond to month ${month} in Chinese year ${year}`);\n }\n }\n return {\n ...calendarDate,\n year: year as number,\n eraYear,\n month,\n monthCode: monthCode,\n day: day as number\n };\n }\n }\n // All built-in calendars except Chinese/Dangi and Hebrew use an era\n override hasEra = false;\n}\n\nclass ChineseHelper extends ChineseBaseHelper {\n id = 'chinese' as const;\n}\n\n// Dangi (Korean) calendar has same implementation as Chinese\nclass DangiHelper extends ChineseBaseHelper {\n id = 'dangi' as const;\n}\n\n/**\n * Common implementation of all non-ISO calendars.\n * Per-calendar id and logic live in `id` and `helper` properties attached later.\n * This split allowed an easy separation between code that was similar between\n * ISO and non-ISO implementations vs. code that was very different.\n */\nclass NonIsoCalendar implements CalendarImpl {\n constructor(private readonly helper: HelperBase) {}\n dateFromFields(\n fieldsParam: Params['dateFromFields'][0],\n options: NonNullable<Params['dateFromFields'][1]>,\n calendarSlotValue: string\n ): Temporal.PlainDate {\n const cache = new OneObjectCache();\n const fieldNames = this.fields(['day', 'month', 'monthCode', 'year']) as AnyTemporalKey[];\n const fields = ES.PrepareTemporalFields(fieldsParam, fieldNames, []);\n const overflow = ES.ToTemporalOverflow(options);\n const { year, month, day } = this.helper.calendarToIsoDate(fields, overflow, cache);\n const result = ES.CreateTemporalDate(year, month, day, calendarSlotValue);\n cache.setObject(result);\n return result;\n }\n yearMonthFromFields(\n fieldsParam: Params['yearMonthFromFields'][0],\n options: NonNullable<Params['yearMonthFromFields'][1]>,\n calendarSlotValue: CalendarSlot\n ): Temporal.PlainYearMonth {\n const cache = new OneObjectCache();\n const fieldNames = this.fields(['month', 'monthCode', 'year']) as AnyTemporalKey[];\n const fields = ES.PrepareTemporalFields(fieldsParam, fieldNames, []);\n const overflow = ES.ToTemporalOverflow(options);\n const { year, month, day } = this.helper.calendarToIsoDate({ ...fields, day: 1 }, overflow, cache);\n const result = ES.CreateTemporalYearMonth(year, month, calendarSlotValue, /* referenceISODay = */ day);\n cache.setObject(result);\n return result;\n }\n monthDayFromFields(\n fieldsParam: Params['monthDayFromFields'][0],\n options: NonNullable<Params['monthDayFromFields'][1]>,\n calendarSlotValue: CalendarSlot\n ): Temporal.PlainMonthDay {\n const cache = new OneObjectCache();\n // For lunisolar calendars, either `monthCode` or `year` must be provided\n // because `month` is ambiguous without a year or a code.\n const fieldNames = this.fields(['day', 'month', 'monthCode', 'year']) as AnyTemporalKey[];\n const fields = ES.PrepareTemporalFields(fieldsParam, fieldNames, []);\n const overflow = ES.ToTemporalOverflow(options);\n const { year, month, day } = this.helper.monthDayFromFields(fields, overflow, cache);\n // `year` is a reference year where this month/day exists in this calendar\n const result = ES.CreateTemporalMonthDay(month, day, calendarSlotValue, /* referenceISOYear = */ year);\n cache.setObject(result);\n return result;\n }\n fields(fieldsParam: string[]): string[] {\n let fields = fieldsParam;\n if (ArrayIncludes.call(fields, 'year')) fields = [...fields, 'era', 'eraYear'];\n return fields;\n }\n fieldKeysToIgnore(\n keys: Exclude<keyof Temporal.PlainDateLike, 'calendar'>[]\n ): Exclude<keyof Temporal.PlainDateLike, 'calendar'>[] {\n const result = new OriginalSet();\n for (let ix = 0; ix < keys.length; ix++) {\n const key = keys[ix];\n ES.Call(SetPrototypeAdd, result, [key]);\n switch (key) {\n case 'era':\n ES.Call(SetPrototypeAdd, result, ['eraYear']);\n ES.Call(SetPrototypeAdd, result, ['year']);\n break;\n case 'eraYear':\n ES.Call(SetPrototypeAdd, result, ['era']);\n ES.Call(SetPrototypeAdd, result, ['year']);\n break;\n case 'year':\n ES.Call(SetPrototypeAdd, result, ['era']);\n ES.Call(SetPrototypeAdd, result, ['eraYear']);\n break;\n case 'month':\n ES.Call(SetPrototypeAdd, result, ['monthCode']);\n // See https://github.com/tc39/proposal-temporal/issues/1784\n if (this.helper.erasBeginMidYear) {\n ES.Call(SetPrototypeAdd, result, ['era']);\n ES.Call(SetPrototypeAdd, result, ['eraYear']);\n }\n break;\n case 'monthCode':\n ES.Call(SetPrototypeAdd, result, ['month']);\n if (this.helper.erasBeginMidYear) {\n ES.Call(SetPrototypeAdd, result, ['era']);\n ES.Call(SetPrototypeAdd, result, ['eraYear']);\n }\n break;\n case 'day':\n if (this.helper.erasBeginMidYear) {\n ES.Call(SetPrototypeAdd, result, ['era']);\n ES.Call(SetPrototypeAdd, result, ['eraYear']);\n }\n break;\n }\n }\n return [...ES.Call(SetPrototypeValues, result, [])];\n }\n dateAdd(\n date: Temporal.PlainDate,\n years: number,\n months: number,\n weeks: number,\n days: number,\n overflow: Overflow,\n calendarSlotValue: CalendarSlot\n ): Temporal.PlainDate {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n const added = this.helper.addCalendar(calendarDate, { years, months, weeks, days }, overflow, cache);\n const isoAdded = this.helper.calendarToIsoDate(added, 'constrain', cache);\n const { year, month, day } = isoAdded;\n const newTemporalObject = ES.CreateTemporalDate(year, month, day, calendarSlotValue);\n // The new object's cache starts with the cache of the old object\n const newCache = new OneObjectCache(cache);\n newCache.setObject(newTemporalObject);\n return newTemporalObject;\n }\n dateUntil(one: Temporal.PlainDate, two: Temporal.PlainDate, largestUnit: Temporal.DateUnit) {\n const cacheOne = OneObjectCache.getCacheForObject(one);\n const cacheTwo = OneObjectCache.getCacheForObject(two);\n const calendarOne = this.helper.temporalToCalendarDate(one, cacheOne);\n const calendarTwo = this.helper.temporalToCalendarDate(two, cacheTwo);\n const result = this.helper.untilCalendar(calendarOne, calendarTwo, largestUnit, cacheOne);\n return result;\n }\n year(date: Temporal.PlainDate | Temporal.PlainYearMonth): number {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n return calendarDate.year;\n }\n month(date: Temporal.PlainDate | Temporal.PlainYearMonth | Temporal.PlainMonthDay): number {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n return calendarDate.month;\n }\n day(date: Temporal.PlainDate | Temporal.PlainMonthDay): number {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n return calendarDate.day;\n }\n era(date: Temporal.PlainDate | Temporal.PlainYearMonth): string | undefined {\n if (!this.helper.hasEra) return undefined;\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n return calendarDate.era;\n }\n eraYear(date: Temporal.PlainDate | Temporal.PlainYearMonth): number | undefined {\n if (!this.helper.hasEra) return undefined;\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n return calendarDate.eraYear;\n }\n monthCode(date: Temporal.PlainDate | Temporal.PlainYearMonth | Temporal.PlainMonthDay): string {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n return calendarDate.monthCode;\n }\n dayOfWeek(date: Temporal.PlainDate): number {\n return impl['iso8601'].dayOfWeek(date);\n }\n dayOfYear(date: Temporal.PlainDate): number {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.isoToCalendarDate(date, cache);\n const startOfYear = this.helper.startOfCalendarYear(calendarDate);\n const diffDays = this.helper.calendarDaysUntil(startOfYear, calendarDate, cache);\n return diffDays + 1;\n }\n weekOfYear(date: Temporal.PlainDate): number {\n return impl['iso8601'].weekOfYear(date);\n }\n yearOfWeek(date: Temporal.PlainDate): number {\n return impl['iso8601'].yearOfWeek(date);\n }\n daysInWeek(date: Temporal.PlainDate): number {\n return impl['iso8601'].daysInWeek(date);\n }\n daysInMonth(date: Temporal.PlainDate | Temporal.PlainYearMonth): number {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n\n // Easy case: if the helper knows the length without any heavy calculation.\n const max = this.helper.maximumMonthLength(calendarDate);\n const min = this.helper.minimumMonthLength(calendarDate);\n if (max === min) return max;\n\n // The harder case is where months vary every year, e.g. islamic calendars.\n // Find the answer by calculating the difference in days between the first\n // day of the current month and the first day of the next month.\n const startOfMonthCalendar = this.helper.startOfCalendarMonth(calendarDate);\n const startOfNextMonthCalendar = this.helper.addMonthsCalendar(startOfMonthCalendar, 1, 'constrain', cache);\n const result = this.helper.calendarDaysUntil(startOfMonthCalendar, startOfNextMonthCalendar, cache);\n return result;\n }\n daysInYear(dateParam: Temporal.PlainDate | Temporal.PlainYearMonth): number {\n let date = dateParam;\n if (!HasSlot(date, ISO_YEAR)) date = ES.ToTemporalDate(date);\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n const startOfYearCalendar = this.helper.startOfCalendarYear(calendarDate);\n const startOfNextYearCalendar = this.helper.addCalendar(startOfYearCalendar, { years: 1 }, 'constrain', cache);\n const result = this.helper.calendarDaysUntil(startOfYearCalendar, startOfNextYearCalendar, cache);\n return result;\n }\n monthsInYear(date: Temporal.PlainDate | Temporal.PlainYearMonth): number {\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n const result = this.helper.monthsInYear(calendarDate, cache);\n return result;\n }\n inLeapYear(dateParam: Temporal.PlainDate | Temporal.PlainYearMonth): boolean {\n let date = dateParam;\n if (!HasSlot(date, ISO_YEAR)) date = ES.ToTemporalDate(date);\n const cache = OneObjectCache.getCacheForObject(date);\n const calendarDate = this.helper.temporalToCalendarDate(date, cache);\n const result = this.helper.inLeapYear(calendarDate, cache);\n return result;\n }\n}\n\nfor (const Helper of [\n HebrewHelper,\n PersianHelper,\n EthiopicHelper,\n EthioaaHelper,\n CopticHelper,\n ChineseHelper,\n DangiHelper,\n RocHelper,\n IndianHelper,\n BuddhistHelper,\n GregoryHelper,\n JapaneseHelper,\n IslamicHelper,\n IslamicUmalquraHelper,\n IslamicTblaHelper,\n IslamicCivilHelper,\n IslamicRgsaHelper,\n IslamicCcHelper\n]) {\n const helper = new Helper();\n // Construct a new NonIsoCalendar instance with the given Helper implementation that contains\n // per-calendar logic.\n impl[helper.id] = new NonIsoCalendar(helper);\n}\n","import * as ES from './ecmascript';\nimport { MakeIntrinsicClass } from './intrinsicclass';\nimport {\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND,\n CALENDAR,\n EPOCHNANOSECONDS,\n GetSlot\n} from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { PlainDateParams as Params, PlainDateReturn as Return } from './internaltypes';\n\nexport class PlainDate implements Temporal.PlainDate {\n constructor(\n isoYearParam: Params['constructor'][0],\n isoMonthParam: Params['constructor'][1],\n isoDayParam: Params['constructor'][2],\n calendarParam: Params['constructor'][3] = 'iso8601'\n ) {\n const isoYear = ES.ToIntegerWithTruncation(isoYearParam);\n const isoMonth = ES.ToIntegerWithTruncation(isoMonthParam);\n const isoDay = ES.ToIntegerWithTruncation(isoDayParam);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n\n ES.CreateTemporalDateSlots(this, isoYear, isoMonth, isoDay, calendar);\n }\n get calendarId(): Return['calendarId'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarIdentifier(GetSlot(this, CALENDAR));\n }\n get era(): Return['era'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEra(GetSlot(this, CALENDAR), this);\n }\n get eraYear(): Return['eraYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEraYear(GetSlot(this, CALENDAR), this);\n }\n get year(): Return['year'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYear(GetSlot(this, CALENDAR), this);\n }\n get month(): Return['month'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonth(GetSlot(this, CALENDAR), this);\n }\n get monthCode(): Return['monthCode'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthCode(GetSlot(this, CALENDAR), this);\n }\n get day(): Return['day'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDay(GetSlot(this, CALENDAR), this);\n }\n get dayOfWeek(): Return['dayOfWeek'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDayOfWeek(GetSlot(this, CALENDAR), this);\n }\n get dayOfYear(): Return['dayOfYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDayOfYear(GetSlot(this, CALENDAR), this);\n }\n get weekOfYear(): Return['weekOfYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarWeekOfYear(GetSlot(this, CALENDAR), this);\n }\n get yearOfWeek(): Return['weekOfYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYearOfWeek(GetSlot(this, CALENDAR), this);\n }\n get daysInWeek(): Return['daysInWeek'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInWeek(GetSlot(this, CALENDAR), this);\n }\n get daysInMonth(): Return['daysInMonth'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInMonth(GetSlot(this, CALENDAR), this);\n }\n get daysInYear(): Return['daysInYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInYear(GetSlot(this, CALENDAR), this);\n }\n get monthsInYear(): Return['monthsInYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthsInYear(GetSlot(this, CALENDAR), this);\n }\n get inLeapYear(): Return['inLeapYear'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.CalendarInLeapYear(GetSlot(this, CALENDAR), this);\n }\n with(temporalDateLike: Params['with'][0], optionsParam: Params['with'][1] = undefined): Return['with'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(temporalDateLike)) {\n throw new TypeError('invalid argument');\n }\n ES.RejectTemporalLikeObject(temporalDateLike);\n const options = ES.GetOptionsObject(optionsParam);\n\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['day', 'month', 'monthCode', 'year'] as const);\n let fields = ES.PrepareTemporalFields(this, fieldNames, []);\n const partialDate = ES.PrepareTemporalFields(temporalDateLike, fieldNames, 'partial');\n fields = ES.CalendarMergeFields(calendar, fields, partialDate);\n fields = ES.PrepareTemporalFields(fields, fieldNames, []);\n\n return ES.CalendarDateFromFields(calendar, fields, options);\n }\n withCalendar(calendarParam: Params['withCalendar'][0]): Return['withCalendar'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n return new PlainDate(GetSlot(this, ISO_YEAR), GetSlot(this, ISO_MONTH), GetSlot(this, ISO_DAY), calendar);\n }\n add(temporalDurationLike: Params['add'][0], optionsParam: Params['add'][1] = undefined): Return['add'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n\n const duration = ES.ToTemporalDuration(temporalDurationLike);\n const options = ES.GetOptionsObject(optionsParam);\n\n return ES.CalendarDateAdd(GetSlot(this, CALENDAR), this, duration, options);\n }\n subtract(\n temporalDurationLike: Params['subtract'][0],\n optionsParam: Params['subtract'][1] = undefined\n ): Return['subtract'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n\n const duration = ES.CreateNegatedTemporalDuration(ES.ToTemporalDuration(temporalDurationLike));\n const options = ES.GetOptionsObject(optionsParam);\n\n return ES.CalendarDateAdd(GetSlot(this, CALENDAR), this, duration, options);\n }\n until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainDate('until', this, other, options);\n }\n since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainDate('since', this, other, options);\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalDate(otherParam);\n for (const slot of [ISO_YEAR, ISO_MONTH, ISO_DAY]) {\n const val1 = GetSlot(this, slot);\n const val2 = GetSlot(other, slot);\n if (val1 !== val2) return false;\n }\n return ES.CalendarEquals(GetSlot(this, CALENDAR), GetSlot(other, CALENDAR));\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const showCalendar = ES.ToCalendarNameOption(options);\n return ES.TemporalDateToString(this, showCalendar);\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDateToString(this);\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return new DateTimeFormat(locales, options).format(this);\n }\n valueOf(): never {\n throw new TypeError('use compare() or equals() to compare Temporal.PlainDate');\n }\n toPlainDateTime(temporalTimeParam: Params['toPlainDateTime'][0] = undefined): Return['toPlainDateTime'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n const year = GetSlot(this, ISO_YEAR);\n const month = GetSlot(this, ISO_MONTH);\n const day = GetSlot(this, ISO_DAY);\n const calendar = GetSlot(this, CALENDAR);\n\n if (temporalTimeParam === undefined) return ES.CreateTemporalDateTime(year, month, day, 0, 0, 0, 0, 0, 0, calendar);\n\n const temporalTime = ES.ToTemporalTime(temporalTimeParam);\n const hour = GetSlot(temporalTime, ISO_HOUR);\n const minute = GetSlot(temporalTime, ISO_MINUTE);\n const second = GetSlot(temporalTime, ISO_SECOND);\n const millisecond = GetSlot(temporalTime, ISO_MILLISECOND);\n const microsecond = GetSlot(temporalTime, ISO_MICROSECOND);\n const nanosecond = GetSlot(temporalTime, ISO_NANOSECOND);\n\n return ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n }\n toZonedDateTime(item: Params['toZonedDateTime'][0]): Return['toZonedDateTime'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n\n type TimeZoneAndPlainTimeProps = Exclude<typeof item, string | Temporal.TimeZoneProtocol>;\n let timeZone: Temporal.TimeZoneLike, temporalTime: TimeZoneAndPlainTimeProps['plainTime'];\n if (ES.IsObject(item)) {\n if (ES.IsTemporalTimeZone(item)) {\n timeZone = item;\n } else {\n const timeZoneLike = (item as TimeZoneAndPlainTimeProps).timeZone;\n if (timeZoneLike === undefined) {\n ES.uncheckedAssertNarrowedType<Temporal.TimeZoneProtocol>(\n item,\n \"if no timeZone property, then assume it's a custom time zone object\"\n );\n timeZone = ES.ToTemporalTimeZoneSlotValue(item);\n } else {\n timeZone = ES.ToTemporalTimeZoneSlotValue(timeZoneLike);\n ES.uncheckedAssertNarrowedType<TimeZoneAndPlainTimeProps>(\n item,\n \"it's a property bag with a timeZone and optional plainTime\"\n );\n temporalTime = item.plainTime;\n }\n }\n } else {\n timeZone = ES.ToTemporalTimeZoneSlotValue(item);\n }\n\n const year = GetSlot(this, ISO_YEAR);\n const month = GetSlot(this, ISO_MONTH);\n const day = GetSlot(this, ISO_DAY);\n const calendar = GetSlot(this, CALENDAR);\n\n let hour = 0,\n minute = 0,\n second = 0,\n millisecond = 0,\n microsecond = 0,\n nanosecond = 0;\n if (temporalTime !== undefined) {\n temporalTime = ES.ToTemporalTime(temporalTime);\n ES.uncheckedAssertNarrowedType<Temporal.PlainTime>(\n temporalTime,\n 'ToTemporalTime above always returns a PlainTime'\n );\n hour = GetSlot(temporalTime, ISO_HOUR);\n minute = GetSlot(temporalTime, ISO_MINUTE);\n second = GetSlot(temporalTime, ISO_SECOND);\n millisecond = GetSlot(temporalTime, ISO_MILLISECOND);\n microsecond = GetSlot(temporalTime, ISO_MICROSECOND);\n nanosecond = GetSlot(temporalTime, ISO_NANOSECOND);\n }\n\n const dt = ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n const instant = ES.GetInstantFor(timeZone, dt, 'compatible');\n return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar);\n }\n toPlainYearMonth(): Return['toPlainYearMonth'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['monthCode', 'year'] as const);\n const fields = ES.PrepareTemporalFields(this, fieldNames, []);\n return ES.CalendarYearMonthFromFields(calendar, fields);\n }\n toPlainMonthDay(): Return['toPlainMonthDay'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['day', 'monthCode'] as const);\n const fields = ES.PrepareTemporalFields(this, fieldNames, []);\n return ES.CalendarMonthDayFromFields(calendar, fields);\n }\n getISOFields(): Return['getISOFields'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return {\n calendar: GetSlot(this, CALENDAR),\n isoDay: GetSlot(this, ISO_DAY),\n isoMonth: GetSlot(this, ISO_MONTH),\n isoYear: GetSlot(this, ISO_YEAR)\n };\n }\n getCalendar(): Return['getCalendar'] {\n if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));\n }\n\n static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {\n const options = ES.GetOptionsObject(optionsParam);\n if (ES.IsTemporalDate(item)) {\n ES.ToTemporalOverflow(options); // validate and ignore\n return ES.CreateTemporalDate(\n GetSlot(item, ISO_YEAR),\n GetSlot(item, ISO_MONTH),\n GetSlot(item, ISO_DAY),\n GetSlot(item, CALENDAR)\n );\n }\n return ES.ToTemporalDate(item, options);\n }\n static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {\n const one = ES.ToTemporalDate(oneParam);\n const two = ES.ToTemporalDate(twoParam);\n return ES.CompareISODate(\n GetSlot(one, ISO_YEAR),\n GetSlot(one, ISO_MONTH),\n GetSlot(one, ISO_DAY),\n GetSlot(two, ISO_YEAR),\n GetSlot(two, ISO_MONTH),\n GetSlot(two, ISO_DAY)\n );\n }\n [Symbol.toStringTag]!: 'Temporal.PlainDate';\n}\n\nMakeIntrinsicClass(PlainDate, 'Temporal.PlainDate');\n","import * as ES from './ecmascript';\nimport { MakeIntrinsicClass } from './intrinsicclass';\n\nimport {\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND,\n CALENDAR,\n EPOCHNANOSECONDS,\n GetSlot\n} from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { PlainDateTimeParams as Params, PlainDateTimeReturn as Return } from './internaltypes';\n\nexport class PlainDateTime implements Temporal.PlainDateTime {\n constructor(\n isoYearParam: Params['constructor'][0],\n isoMonthParam: Params['constructor'][1],\n isoDayParam: Params['constructor'][2],\n hourParam: Params['constructor'][3] = 0,\n minuteParam: Params['constructor'][4] = 0,\n secondParam: Params['constructor'][5] = 0,\n millisecondParam: Params['constructor'][6] = 0,\n microsecondParam: Params['constructor'][7] = 0,\n nanosecondParam: Params['constructor'][8] = 0,\n calendarParam: Params['constructor'][9] = 'iso8601'\n ) {\n const isoYear = ES.ToIntegerWithTruncation(isoYearParam);\n const isoMonth = ES.ToIntegerWithTruncation(isoMonthParam);\n const isoDay = ES.ToIntegerWithTruncation(isoDayParam);\n const hour = hourParam === undefined ? 0 : ES.ToIntegerWithTruncation(hourParam);\n const minute = minuteParam === undefined ? 0 : ES.ToIntegerWithTruncation(minuteParam);\n const second = secondParam === undefined ? 0 : ES.ToIntegerWithTruncation(secondParam);\n const millisecond = millisecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(millisecondParam);\n const microsecond = microsecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(microsecondParam);\n const nanosecond = nanosecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(nanosecondParam);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n\n ES.CreateTemporalDateTimeSlots(\n this,\n isoYear,\n isoMonth,\n isoDay,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n }\n get calendarId(): Return['calendarId'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarIdentifier(GetSlot(this, CALENDAR));\n }\n get year(): Return['year'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYear(GetSlot(this, CALENDAR), this);\n }\n get month(): Return['month'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonth(GetSlot(this, CALENDAR), this);\n }\n get monthCode(): Return['monthCode'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthCode(GetSlot(this, CALENDAR), this);\n }\n get day(): Return['day'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDay(GetSlot(this, CALENDAR), this);\n }\n get hour(): Return['hour'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_HOUR);\n }\n get minute(): Return['minute'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_MINUTE);\n }\n get second(): Return['second'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_SECOND);\n }\n get millisecond(): Return['millisecond'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_MILLISECOND);\n }\n get microsecond(): Return['microsecond'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_MICROSECOND);\n }\n get nanosecond(): Return['nanosecond'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_NANOSECOND);\n }\n get era(): Return['era'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEra(GetSlot(this, CALENDAR), this);\n }\n get eraYear(): Return['eraYear'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEraYear(GetSlot(this, CALENDAR), this);\n }\n get dayOfWeek(): Return['dayOfWeek'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDayOfWeek(GetSlot(this, CALENDAR), this);\n }\n get dayOfYear(): Return['dayOfYear'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDayOfYear(GetSlot(this, CALENDAR), this);\n }\n get weekOfYear(): Return['weekOfYear'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarWeekOfYear(GetSlot(this, CALENDAR), this);\n }\n get yearOfWeek(): Return['yearOfWeek'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYearOfWeek(GetSlot(this, CALENDAR), this);\n }\n get daysInWeek(): Return['daysInWeek'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInWeek(GetSlot(this, CALENDAR), this);\n }\n get daysInYear(): Return['daysInYear'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInYear(GetSlot(this, CALENDAR), this);\n }\n get daysInMonth(): Return['daysInMonth'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInMonth(GetSlot(this, CALENDAR), this);\n }\n get monthsInYear(): Return['monthsInYear'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthsInYear(GetSlot(this, CALENDAR), this);\n }\n get inLeapYear(): Return['inLeapYear'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarInLeapYear(GetSlot(this, CALENDAR), this);\n }\n with(temporalDateTimeLike: Params['with'][0], optionsParam: Params['with'][1] = undefined): Return['with'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(temporalDateTimeLike)) {\n throw new TypeError('invalid argument');\n }\n ES.RejectTemporalLikeObject(temporalDateTimeLike);\n\n const options = ES.GetOptionsObject(optionsParam);\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, [\n 'day',\n 'hour',\n 'microsecond',\n 'millisecond',\n 'minute',\n 'month',\n 'monthCode',\n 'nanosecond',\n 'second',\n 'year'\n ] as const);\n let fields = ES.PrepareTemporalFields(this, fieldNames, []);\n const partialDateTime = ES.PrepareTemporalFields(temporalDateTimeLike, fieldNames, 'partial');\n fields = ES.CalendarMergeFields(calendar, fields, partialDateTime);\n fields = ES.PrepareTemporalFields(fields, fieldNames, []);\n const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } =\n ES.InterpretTemporalDateTimeFields(calendar, fields, options);\n\n return ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n }\n withPlainTime(temporalTimeParam: Params['withPlainTime'][0] = undefined): Return['withPlainTime'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const year = GetSlot(this, ISO_YEAR);\n const month = GetSlot(this, ISO_MONTH);\n const day = GetSlot(this, ISO_DAY);\n const calendar = GetSlot(this, CALENDAR);\n\n if (temporalTimeParam === undefined) return ES.CreateTemporalDateTime(year, month, day, 0, 0, 0, 0, 0, 0, calendar);\n\n const temporalTime = ES.ToTemporalTime(temporalTimeParam);\n const hour = GetSlot(temporalTime, ISO_HOUR);\n const minute = GetSlot(temporalTime, ISO_MINUTE);\n const second = GetSlot(temporalTime, ISO_SECOND);\n const millisecond = GetSlot(temporalTime, ISO_MILLISECOND);\n const microsecond = GetSlot(temporalTime, ISO_MICROSECOND);\n const nanosecond = GetSlot(temporalTime, ISO_NANOSECOND);\n\n return ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n }\n withPlainDate(temporalDateParam: Params['withPlainDate'][0]): Return['withPlainDate'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n\n const temporalDate = ES.ToTemporalDate(temporalDateParam);\n const year = GetSlot(temporalDate, ISO_YEAR);\n const month = GetSlot(temporalDate, ISO_MONTH);\n const day = GetSlot(temporalDate, ISO_DAY);\n let calendar = GetSlot(temporalDate, CALENDAR);\n\n const hour = GetSlot(this, ISO_HOUR);\n const minute = GetSlot(this, ISO_MINUTE);\n const second = GetSlot(this, ISO_SECOND);\n const millisecond = GetSlot(this, ISO_MILLISECOND);\n const microsecond = GetSlot(this, ISO_MICROSECOND);\n const nanosecond = GetSlot(this, ISO_NANOSECOND);\n\n calendar = ES.ConsolidateCalendars(GetSlot(this, CALENDAR), calendar);\n return ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n }\n withCalendar(calendarParam: Params['withCalendar'][0]): Return['withCalendar'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n return new PlainDateTime(\n GetSlot(this, ISO_YEAR),\n GetSlot(this, ISO_MONTH),\n GetSlot(this, ISO_DAY),\n GetSlot(this, ISO_HOUR),\n GetSlot(this, ISO_MINUTE),\n GetSlot(this, ISO_SECOND),\n GetSlot(this, ISO_MILLISECOND),\n GetSlot(this, ISO_MICROSECOND),\n GetSlot(this, ISO_NANOSECOND),\n calendar\n );\n }\n add(temporalDurationLike: Params['add'][0], options: Params['add'][1] = undefined): Return['add'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromPlainDateTime('add', this, temporalDurationLike, options);\n }\n subtract(\n temporalDurationLike: Params['subtract'][0],\n options: Params['subtract'][1] = undefined\n ): Return['subtract'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromPlainDateTime('subtract', this, temporalDurationLike, options);\n }\n until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainDateTime('until', this, other, options);\n }\n since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainDateTime('since', this, other, options);\n }\n round(roundToParam: Params['round'][0]): Return['round'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n if (roundToParam === undefined) throw new TypeError('options parameter is required');\n const roundTo =\n typeof roundToParam === 'string'\n ? (ES.CreateOnePropObject('smallestUnit', roundToParam) as Exclude<typeof roundToParam, string>)\n : ES.GetOptionsObject(roundToParam);\n const roundingIncrement = ES.ToTemporalRoundingIncrement(roundTo);\n const roundingMode = ES.ToTemporalRoundingMode(roundTo, 'halfExpand');\n const smallestUnit = ES.GetTemporalUnit(roundTo, 'smallestUnit', 'time', ES.REQUIRED, ['day']);\n const maximumIncrements = {\n day: 1,\n hour: 24,\n minute: 60,\n second: 60,\n millisecond: 1000,\n microsecond: 1000,\n nanosecond: 1000\n };\n const maximum = maximumIncrements[smallestUnit];\n const inclusive = maximum === 1;\n ES.ValidateTemporalRoundingIncrement(roundingIncrement, maximum, inclusive);\n\n let year = GetSlot(this, ISO_YEAR);\n let month = GetSlot(this, ISO_MONTH);\n let day = GetSlot(this, ISO_DAY);\n let hour = GetSlot(this, ISO_HOUR);\n let minute = GetSlot(this, ISO_MINUTE);\n let second = GetSlot(this, ISO_SECOND);\n let millisecond = GetSlot(this, ISO_MILLISECOND);\n let microsecond = GetSlot(this, ISO_MICROSECOND);\n let nanosecond = GetSlot(this, ISO_NANOSECOND);\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = ES.RoundISODateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n roundingIncrement,\n smallestUnit,\n roundingMode\n ));\n\n return ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n GetSlot(this, CALENDAR)\n );\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalDateTime(otherParam);\n for (const slot of [\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND\n ]) {\n const val1 = GetSlot(this, slot);\n const val2 = GetSlot(other, slot);\n if (val1 !== val2) return false;\n }\n return ES.CalendarEquals(GetSlot(this, CALENDAR), GetSlot(other, CALENDAR));\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const showCalendar = ES.ToCalendarNameOption(options);\n const digits = ES.ToFractionalSecondDigits(options);\n const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');\n const smallestUnit = ES.GetTemporalUnit(options, 'smallestUnit', 'time', undefined);\n if (smallestUnit === 'hour') throw new RangeError('smallestUnit must be a time unit other than \"hour\"');\n const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits);\n return ES.TemporalDateTimeToString(this, precision, showCalendar, { unit, increment, roundingMode });\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDateTimeToString(this, 'auto');\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return new DateTimeFormat(locales, options).format(this);\n }\n valueOf(): never {\n throw new TypeError('use compare() or equals() to compare Temporal.PlainDateTime');\n }\n\n toZonedDateTime(\n temporalTimeZoneLike: Params['toZonedDateTime'][0],\n optionsParam: Params['toZonedDateTime'][1] = undefined\n ): Return['toZonedDateTime'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const timeZone = ES.ToTemporalTimeZoneSlotValue(temporalTimeZoneLike);\n const options = ES.GetOptionsObject(optionsParam);\n const disambiguation = ES.ToTemporalDisambiguation(options);\n const instant = ES.GetInstantFor(timeZone, this, disambiguation);\n return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, GetSlot(this, CALENDAR));\n }\n toPlainDate(): Return['toPlainDate'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDateTimeToDate(this);\n }\n toPlainYearMonth(): Return['toPlainYearMonth'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['monthCode', 'year'] as const);\n const fields = ES.PrepareTemporalFields(this, fieldNames, []);\n return ES.CalendarYearMonthFromFields(calendar, fields);\n }\n toPlainMonthDay(): Return['toPlainMonthDay'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['day', 'monthCode'] as const);\n const fields = ES.PrepareTemporalFields(this, fieldNames, []);\n return ES.CalendarMonthDayFromFields(calendar, fields);\n }\n toPlainTime(): Return['toPlainTime'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDateTimeToTime(this);\n }\n getISOFields(): Return['getISOFields'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return {\n calendar: GetSlot(this, CALENDAR),\n isoDay: GetSlot(this, ISO_DAY),\n isoHour: GetSlot(this, ISO_HOUR),\n isoMicrosecond: GetSlot(this, ISO_MICROSECOND),\n isoMillisecond: GetSlot(this, ISO_MILLISECOND),\n isoMinute: GetSlot(this, ISO_MINUTE),\n isoMonth: GetSlot(this, ISO_MONTH),\n isoNanosecond: GetSlot(this, ISO_NANOSECOND),\n isoSecond: GetSlot(this, ISO_SECOND),\n isoYear: GetSlot(this, ISO_YEAR)\n };\n }\n getCalendar(): Return['getCalendar'] {\n if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));\n }\n\n static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {\n const options = ES.GetOptionsObject(optionsParam);\n if (ES.IsTemporalDateTime(item)) {\n ES.ToTemporalOverflow(options); // validate and ignore\n return ES.CreateTemporalDateTime(\n GetSlot(item, ISO_YEAR),\n GetSlot(item, ISO_MONTH),\n GetSlot(item, ISO_DAY),\n GetSlot(item, ISO_HOUR),\n GetSlot(item, ISO_MINUTE),\n GetSlot(item, ISO_SECOND),\n GetSlot(item, ISO_MILLISECOND),\n GetSlot(item, ISO_MICROSECOND),\n GetSlot(item, ISO_NANOSECOND),\n GetSlot(item, CALENDAR)\n );\n }\n return ES.ToTemporalDateTime(item, options);\n }\n static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {\n const one = ES.ToTemporalDateTime(oneParam);\n const two = ES.ToTemporalDateTime(twoParam);\n for (const slot of [\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND\n ] as const) {\n const val1 = GetSlot(one, slot);\n const val2 = GetSlot(two, slot);\n if (val1 !== val2) return ES.ComparisonResult(val1 - val2);\n }\n return 0;\n }\n [Symbol.toStringTag]!: 'Temporal.PlainDateTime';\n}\n\nMakeIntrinsicClass(PlainDateTime, 'Temporal.PlainDateTime');\n","import { DEBUG } from './debug';\nimport * as ES from './ecmascript';\nimport { MakeIntrinsicClass } from './intrinsicclass';\nimport {\n YEARS,\n MONTHS,\n WEEKS,\n DAYS,\n HOURS,\n MINUTES,\n SECONDS,\n MILLISECONDS,\n MICROSECONDS,\n NANOSECONDS,\n CreateSlots,\n GetSlot,\n SetSlot\n} from './slots';\nimport type { Temporal } from '..';\nimport type { DurationParams as Params, DurationReturn as Return } from './internaltypes';\nimport JSBI from 'jsbi';\n\nexport class Duration implements Temporal.Duration {\n constructor(\n yearsParam: Params['constructor'][0] = 0,\n monthsParam: Params['constructor'][1] = 0,\n weeksParam: Params['constructor'][2] = 0,\n daysParam: Params['constructor'][3] = 0,\n hoursParam: Params['constructor'][4] = 0,\n minutesParam: Params['constructor'][5] = 0,\n secondsParam: Params['constructor'][6] = 0,\n millisecondsParam: Params['constructor'][7] = 0,\n microsecondsParam: Params['constructor'][8] = 0,\n nanosecondsParam: Params['constructor'][9] = 0\n ) {\n const years = yearsParam === undefined ? 0 : ES.ToIntegerIfIntegral(yearsParam);\n const months = monthsParam === undefined ? 0 : ES.ToIntegerIfIntegral(monthsParam);\n const weeks = weeksParam === undefined ? 0 : ES.ToIntegerIfIntegral(weeksParam);\n const days = daysParam === undefined ? 0 : ES.ToIntegerIfIntegral(daysParam);\n const hours = hoursParam === undefined ? 0 : ES.ToIntegerIfIntegral(hoursParam);\n const minutes = minutesParam === undefined ? 0 : ES.ToIntegerIfIntegral(minutesParam);\n const seconds = secondsParam === undefined ? 0 : ES.ToIntegerIfIntegral(secondsParam);\n const milliseconds = millisecondsParam === undefined ? 0 : ES.ToIntegerIfIntegral(millisecondsParam);\n const microseconds = microsecondsParam === undefined ? 0 : ES.ToIntegerIfIntegral(microsecondsParam);\n const nanoseconds = nanosecondsParam === undefined ? 0 : ES.ToIntegerIfIntegral(nanosecondsParam);\n\n ES.RejectDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n\n CreateSlots(this);\n SetSlot(this, YEARS, years);\n SetSlot(this, MONTHS, months);\n SetSlot(this, WEEKS, weeks);\n SetSlot(this, DAYS, days);\n SetSlot(this, HOURS, hours);\n SetSlot(this, MINUTES, minutes);\n SetSlot(this, SECONDS, seconds);\n SetSlot(this, MILLISECONDS, milliseconds);\n SetSlot(this, MICROSECONDS, microseconds);\n SetSlot(this, NANOSECONDS, nanoseconds);\n\n if (DEBUG) {\n Object.defineProperty(this, '_repr_', {\n value: `${this[Symbol.toStringTag]} <${ES.TemporalDurationToString(this)}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n }\n get years(): Return['years'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, YEARS);\n }\n get months(): Return['months'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, MONTHS);\n }\n get weeks(): Return['weeks'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, WEEKS);\n }\n get days(): Return['days'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, DAYS);\n }\n get hours(): Return['hours'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, HOURS);\n }\n get minutes(): Return['minutes'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, MINUTES);\n }\n get seconds(): Return['seconds'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, SECONDS);\n }\n get milliseconds(): Return['milliseconds'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, MILLISECONDS);\n }\n get microseconds(): Return['microseconds'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, MICROSECONDS);\n }\n get nanoseconds(): Return['nanoseconds'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, NANOSECONDS);\n }\n get sign(): Return['sign'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return ES.DurationSign(\n GetSlot(this, YEARS),\n GetSlot(this, MONTHS),\n GetSlot(this, WEEKS),\n GetSlot(this, DAYS),\n GetSlot(this, HOURS),\n GetSlot(this, MINUTES),\n GetSlot(this, SECONDS),\n GetSlot(this, MILLISECONDS),\n GetSlot(this, MICROSECONDS),\n GetSlot(this, NANOSECONDS)\n );\n }\n get blank(): Return['blank'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return (\n ES.DurationSign(\n GetSlot(this, YEARS),\n GetSlot(this, MONTHS),\n GetSlot(this, WEEKS),\n GetSlot(this, DAYS),\n GetSlot(this, HOURS),\n GetSlot(this, MINUTES),\n GetSlot(this, SECONDS),\n GetSlot(this, MILLISECONDS),\n GetSlot(this, MICROSECONDS),\n GetSlot(this, NANOSECONDS)\n ) === 0\n );\n }\n with(durationLike: Params['with'][0]): Return['with'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n const partialDuration = ES.PrepareTemporalFields(\n durationLike,\n // NOTE: Field order here is important.\n [\n 'days',\n 'hours',\n 'microseconds',\n 'milliseconds',\n 'minutes',\n 'months',\n 'nanoseconds',\n 'seconds',\n 'weeks',\n 'years'\n ],\n 'partial'\n );\n const {\n years = GetSlot(this, YEARS),\n months = GetSlot(this, MONTHS),\n weeks = GetSlot(this, WEEKS),\n days = GetSlot(this, DAYS),\n hours = GetSlot(this, HOURS),\n minutes = GetSlot(this, MINUTES),\n seconds = GetSlot(this, SECONDS),\n milliseconds = GetSlot(this, MILLISECONDS),\n microseconds = GetSlot(this, MICROSECONDS),\n nanoseconds = GetSlot(this, NANOSECONDS)\n } = partialDuration;\n return new Duration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n }\n negated(): Return['negated'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return ES.CreateNegatedTemporalDuration(this);\n }\n abs(): Return['abs'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return new Duration(\n Math.abs(GetSlot(this, YEARS)),\n Math.abs(GetSlot(this, MONTHS)),\n Math.abs(GetSlot(this, WEEKS)),\n Math.abs(GetSlot(this, DAYS)),\n Math.abs(GetSlot(this, HOURS)),\n Math.abs(GetSlot(this, MINUTES)),\n Math.abs(GetSlot(this, SECONDS)),\n Math.abs(GetSlot(this, MILLISECONDS)),\n Math.abs(GetSlot(this, MICROSECONDS)),\n Math.abs(GetSlot(this, NANOSECONDS))\n );\n }\n add(other: Params['add'][0], options: Params['add'][1] = undefined): Return['add'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromDuration('add', this, other, options);\n }\n subtract(other: Params['subtract'][0], options: Params['subtract'][1] = undefined): Return['subtract'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromDuration('subtract', this, other, options);\n }\n round(roundToParam: Params['round'][0]): Return['round'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n if (roundToParam === undefined) throw new TypeError('options parameter is required');\n let years = GetSlot(this, YEARS);\n let months = GetSlot(this, MONTHS);\n let weeks = GetSlot(this, WEEKS);\n let days = GetSlot(this, DAYS);\n let hours = GetSlot(this, HOURS);\n let minutes = GetSlot(this, MINUTES);\n let seconds = GetSlot(this, SECONDS);\n let milliseconds = GetSlot(this, MILLISECONDS);\n let microseconds = GetSlot(this, MICROSECONDS);\n let nanoseconds = GetSlot(this, NANOSECONDS);\n\n let defaultLargestUnit = ES.DefaultTemporalLargestUnit(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds\n );\n const roundTo =\n typeof roundToParam === 'string'\n ? (ES.CreateOnePropObject('smallestUnit', roundToParam) as Exclude<typeof roundToParam, string>)\n : ES.GetOptionsObject(roundToParam);\n\n let largestUnit = ES.GetTemporalUnit(roundTo, 'largestUnit', 'datetime', undefined, ['auto']);\n let relativeTo = ES.ToRelativeTemporalObject(roundTo);\n const roundingIncrement = ES.ToTemporalRoundingIncrement(roundTo);\n const roundingMode = ES.ToTemporalRoundingMode(roundTo, 'halfExpand');\n let smallestUnit = ES.GetTemporalUnit(roundTo, 'smallestUnit', 'datetime', undefined);\n\n let smallestUnitPresent = true;\n if (!smallestUnit) {\n smallestUnitPresent = false;\n smallestUnit = 'nanosecond';\n }\n defaultLargestUnit = ES.LargerOfTwoTemporalUnits(defaultLargestUnit, smallestUnit);\n let largestUnitPresent = true;\n if (!largestUnit) {\n largestUnitPresent = false;\n largestUnit = defaultLargestUnit;\n }\n if (largestUnit === 'auto') largestUnit = defaultLargestUnit;\n if (!smallestUnitPresent && !largestUnitPresent) {\n throw new RangeError('at least one of smallestUnit or largestUnit is required');\n }\n if (ES.LargerOfTwoTemporalUnits(largestUnit, smallestUnit) !== largestUnit) {\n throw new RangeError(`largestUnit ${largestUnit} cannot be smaller than smallestUnit ${smallestUnit}`);\n }\n\n const maximumIncrements = {\n hour: 24,\n minute: 60,\n second: 60,\n millisecond: 1000,\n microsecond: 1000,\n nanosecond: 1000\n } as { [k in Temporal.DateTimeUnit]?: number };\n const maximum = maximumIncrements[smallestUnit];\n if (maximum !== undefined) ES.ValidateTemporalRoundingIncrement(roundingIncrement, maximum, false);\n\n ({ years, months, weeks, days } = ES.UnbalanceDurationRelative(\n years,\n months,\n weeks,\n days,\n largestUnit,\n relativeTo\n ));\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n ES.RoundDuration(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n roundingIncrement,\n smallestUnit,\n roundingMode,\n relativeTo\n ));\n ({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =\n ES.AdjustRoundedDurationDays(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n roundingIncrement,\n smallestUnit,\n roundingMode,\n relativeTo\n ));\n ({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.BalanceDuration(\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n largestUnit,\n relativeTo\n ));\n ({ years, months, weeks, days } = ES.BalanceDurationRelative(years, months, weeks, days, largestUnit, relativeTo));\n\n return new Duration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);\n }\n total(optionsParam: Params['total'][0]): Return['total'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n let years = GetSlot(this, YEARS);\n let months = GetSlot(this, MONTHS);\n let weeks = GetSlot(this, WEEKS);\n let days = GetSlot(this, DAYS);\n let hours = GetSlot(this, HOURS);\n let minutes = GetSlot(this, MINUTES);\n let seconds = GetSlot(this, SECONDS);\n let milliseconds = GetSlot(this, MILLISECONDS);\n let microseconds = GetSlot(this, MICROSECONDS);\n let nanoseconds = GetSlot(this, NANOSECONDS);\n\n if (optionsParam === undefined) throw new TypeError('options argument is required');\n const options =\n typeof optionsParam === 'string'\n ? (ES.CreateOnePropObject('unit', optionsParam) as Exclude<typeof optionsParam, string>)\n : ES.GetOptionsObject(optionsParam);\n const relativeTo = ES.ToRelativeTemporalObject(options);\n const unit = ES.GetTemporalUnit(options, 'unit', 'datetime', ES.REQUIRED);\n\n // Convert larger units down to days\n ({ years, months, weeks, days } = ES.UnbalanceDurationRelative(years, months, weeks, days, unit, relativeTo));\n // If the unit we're totalling is smaller than `days`, convert days down to that unit.\n let intermediate;\n if (ES.IsTemporalZonedDateTime(relativeTo)) {\n intermediate = ES.MoveRelativeZonedDateTime(relativeTo, years, months, weeks, 0);\n }\n let balanceResult = ES.BalancePossiblyInfiniteDuration(\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n unit,\n intermediate\n );\n if (balanceResult === 'positive overflow') {\n return Infinity;\n } else if (balanceResult === 'negative overflow') {\n return -Infinity;\n }\n ({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = balanceResult);\n // Finally, truncate to the correct unit and calculate remainder\n const { total } = ES.RoundDuration(\n years,\n months,\n weeks,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n microseconds,\n nanoseconds,\n 1,\n unit,\n 'trunc',\n relativeTo\n );\n return total;\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const digits = ES.ToFractionalSecondDigits(options);\n const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');\n const smallestUnit = ES.GetTemporalUnit(options, 'smallestUnit', 'time', undefined);\n if (smallestUnit === 'hour' || smallestUnit === 'minute') {\n throw new RangeError('smallestUnit must be a time unit other than \"hours\" or \"minutes\"');\n }\n const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits);\n ES.uncheckedAssertNarrowedType<Exclude<typeof precision, 'minute'>>(\n precision,\n 'Precision cannot be \"minute\" because of RangeError above'\n );\n return ES.TemporalDurationToString(this, precision, { unit, increment, roundingMode });\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDurationToString(this);\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');\n if (typeof Intl !== 'undefined' && typeof (Intl as any).DurationFormat !== 'undefined') {\n return new (Intl as any).DurationFormat(locales, options).format(this);\n }\n console.warn('Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat.');\n return ES.TemporalDurationToString(this);\n }\n valueOf(): never {\n throw new TypeError('use compare() to compare Temporal.Duration');\n }\n static from(item: Params['from'][0]): Return['from'] {\n if (ES.IsTemporalDuration(item)) {\n return new Duration(\n GetSlot(item, YEARS),\n GetSlot(item, MONTHS),\n GetSlot(item, WEEKS),\n GetSlot(item, DAYS),\n GetSlot(item, HOURS),\n GetSlot(item, MINUTES),\n GetSlot(item, SECONDS),\n GetSlot(item, MILLISECONDS),\n GetSlot(item, MICROSECONDS),\n GetSlot(item, NANOSECONDS)\n );\n }\n return ES.ToTemporalDuration(item);\n }\n static compare(\n oneParam: Params['compare'][0],\n twoParam: Params['compare'][1],\n optionsParam: Params['compare'][2] = undefined\n ) {\n const one = ES.ToTemporalDuration(oneParam);\n const two = ES.ToTemporalDuration(twoParam);\n const options = ES.GetOptionsObject(optionsParam);\n const relativeTo = ES.ToRelativeTemporalObject(options);\n const y1 = GetSlot(one, YEARS);\n const mon1 = GetSlot(one, MONTHS);\n const w1 = GetSlot(one, WEEKS);\n let d1 = GetSlot(one, DAYS);\n const h1 = GetSlot(one, HOURS);\n const min1 = GetSlot(one, MINUTES);\n const s1 = GetSlot(one, SECONDS);\n const ms1 = GetSlot(one, MILLISECONDS);\n const µs1 = GetSlot(one, MICROSECONDS);\n let ns1 = GetSlot(one, NANOSECONDS);\n const y2 = GetSlot(two, YEARS);\n const mon2 = GetSlot(two, MONTHS);\n const w2 = GetSlot(two, WEEKS);\n let d2 = GetSlot(two, DAYS);\n const h2 = GetSlot(two, HOURS);\n const min2 = GetSlot(two, MINUTES);\n const s2 = GetSlot(two, SECONDS);\n const ms2 = GetSlot(two, MILLISECONDS);\n const µs2 = GetSlot(two, MICROSECONDS);\n let ns2 = GetSlot(two, NANOSECONDS);\n const shift1 = ES.CalculateOffsetShift(relativeTo, y1, mon1, w1, d1);\n const shift2 = ES.CalculateOffsetShift(relativeTo, y2, mon2, w2, d2);\n if (y1 !== 0 || y2 !== 0 || mon1 !== 0 || mon2 !== 0 || w1 !== 0 || w2 !== 0) {\n ({ days: d1 } = ES.UnbalanceDurationRelative(y1, mon1, w1, d1, 'day', relativeTo));\n ({ days: d2 } = ES.UnbalanceDurationRelative(y2, mon2, w2, d2, 'day', relativeTo));\n }\n const totalNs1 = ES.TotalDurationNanoseconds(d1, h1, min1, s1, ms1, µs1, ns1, shift1);\n const totalNs2 = ES.TotalDurationNanoseconds(d2, h2, min2, s2, ms2, µs2, ns2, shift2);\n return ES.ComparisonResult(JSBI.toNumber(JSBI.subtract(totalNs1, totalNs2)));\n }\n [Symbol.toStringTag]!: 'Temporal.Duration';\n}\n\nMakeIntrinsicClass(Duration, 'Temporal.Duration');\n","import * as ES from './ecmascript';\nimport { MakeIntrinsicClass } from './intrinsicclass';\nimport { ISO_MONTH, ISO_DAY, ISO_YEAR, CALENDAR, GetSlot } from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { PlainMonthDayParams as Params, PlainMonthDayReturn as Return } from './internaltypes';\n\nconst ObjectCreate = Object.create;\n\nexport class PlainMonthDay implements Temporal.PlainMonthDay {\n constructor(\n isoMonthParam: Params['constructor'][0],\n isoDayParam: Params['constructor'][0],\n calendarParam: string | Temporal.CalendarProtocol = 'iso8601',\n referenceISOYearParam = 1972\n ) {\n const isoMonth = ES.ToIntegerWithTruncation(isoMonthParam);\n const isoDay = ES.ToIntegerWithTruncation(isoDayParam);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n const referenceISOYear = ES.ToIntegerWithTruncation(referenceISOYearParam);\n\n ES.CreateTemporalMonthDaySlots(this, isoMonth, isoDay, calendar, referenceISOYear);\n }\n\n get monthCode(): Return['monthCode'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthCode(GetSlot(this, CALENDAR), this);\n }\n get day(): Return['day'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDay(GetSlot(this, CALENDAR), this);\n }\n get calendarId(): Return['calendarId'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarIdentifier(GetSlot(this, CALENDAR));\n }\n\n with(temporalMonthDayLike: Params['with'][0], optionsParam: Params['with'][1] = undefined): Return['with'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(temporalMonthDayLike)) {\n throw new TypeError('invalid argument');\n }\n ES.RejectTemporalLikeObject(temporalMonthDayLike);\n const options = ES.GetOptionsObject(optionsParam);\n\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['day', 'month', 'monthCode', 'year'] as const);\n let fields = ES.PrepareTemporalFields(this, fieldNames, []);\n const partialMonthDay = ES.PrepareTemporalFields(temporalMonthDayLike, fieldNames, 'partial');\n fields = ES.CalendarMergeFields(calendar, fields, partialMonthDay);\n fields = ES.PrepareTemporalFields(fields, fieldNames, []);\n\n return ES.CalendarMonthDayFromFields(calendar, fields, options);\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalMonthDay(otherParam);\n for (const slot of [ISO_MONTH, ISO_DAY, ISO_YEAR]) {\n const val1 = GetSlot(this, slot);\n const val2 = GetSlot(other, slot);\n if (val1 !== val2) return false;\n }\n return ES.CalendarEquals(GetSlot(this, CALENDAR), GetSlot(other, CALENDAR));\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const showCalendar = ES.ToCalendarNameOption(options);\n return ES.TemporalMonthDayToString(this, showCalendar);\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return ES.TemporalMonthDayToString(this);\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return new DateTimeFormat(locales, options).format(this);\n }\n valueOf(): never {\n throw new TypeError('use equals() to compare Temporal.PlainMonthDay');\n }\n toPlainDate(item: Params['toPlainDate'][0]): Return['toPlainDate'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(item)) throw new TypeError('argument should be an object');\n const calendar = GetSlot(this, CALENDAR);\n\n const receiverFieldNames = ES.CalendarFields(calendar, ['day', 'monthCode'] as const);\n const fields = ES.PrepareTemporalFields(this, receiverFieldNames, []);\n\n const inputFieldNames = ES.CalendarFields(calendar, ['year'] as const);\n const inputFields = ES.PrepareTemporalFields(item, inputFieldNames, []);\n let mergedFields = ES.CalendarMergeFields(calendar, fields, inputFields);\n\n // TODO: Use MergeLists abstract operation.\n const mergedFieldNames = [...new Set([...receiverFieldNames, ...inputFieldNames])];\n mergedFields = ES.PrepareTemporalFields(mergedFields, mergedFieldNames, []);\n const options = ObjectCreate(null);\n options.overflow = 'reject';\n return ES.CalendarDateFromFields(calendar, mergedFields, options);\n }\n getISOFields(): Return['getISOFields'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return {\n calendar: GetSlot(this, CALENDAR),\n isoDay: GetSlot(this, ISO_DAY),\n isoMonth: GetSlot(this, ISO_MONTH),\n isoYear: GetSlot(this, ISO_YEAR)\n };\n }\n getCalendar(): Return['getCalendar'] {\n if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));\n }\n\n static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {\n const options = ES.GetOptionsObject(optionsParam);\n if (ES.IsTemporalMonthDay(item)) {\n ES.ToTemporalOverflow(options); // validate and ignore\n return ES.CreateTemporalMonthDay(\n GetSlot(item, ISO_MONTH),\n GetSlot(item, ISO_DAY),\n GetSlot(item, CALENDAR),\n GetSlot(item, ISO_YEAR)\n );\n }\n return ES.ToTemporalMonthDay(item, options);\n }\n [Symbol.toStringTag]!: 'Temporal.PlainMonthDay';\n}\n\nMakeIntrinsicClass(PlainMonthDay, 'Temporal.PlainMonthDay');\n","import * as ES from './ecmascript';\nimport { GetIntrinsic } from './intrinsicclass';\nimport type { Temporal } from '..';\n\nconst instant: typeof Temporal.Now['instant'] = () => {\n const Instant = GetIntrinsic('%Temporal.Instant%');\n return new Instant(ES.SystemUTCEpochNanoSeconds());\n};\nconst plainDateTime: typeof Temporal.Now['plainDateTime'] = (\n calendarLike,\n temporalTimeZoneLike = ES.DefaultTimeZone()\n) => {\n const tZ = ES.ToTemporalTimeZoneSlotValue(temporalTimeZoneLike);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarLike);\n const inst = instant();\n return ES.GetPlainDateTimeFor(tZ, inst, calendar);\n};\nconst plainDateTimeISO: typeof Temporal.Now['plainDateTimeISO'] = (temporalTimeZoneLike = ES.DefaultTimeZone()) => {\n const tZ = ES.ToTemporalTimeZoneSlotValue(temporalTimeZoneLike);\n const inst = instant();\n return ES.GetPlainDateTimeFor(tZ, inst, 'iso8601');\n};\nconst zonedDateTime: typeof Temporal.Now['zonedDateTime'] = (\n calendarLike,\n temporalTimeZoneLike = ES.DefaultTimeZone()\n) => {\n const tZ = ES.ToTemporalTimeZoneSlotValue(temporalTimeZoneLike);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarLike);\n return ES.CreateTemporalZonedDateTime(ES.SystemUTCEpochNanoSeconds(), tZ, calendar);\n};\nconst zonedDateTimeISO: typeof Temporal.Now['zonedDateTimeISO'] = (temporalTimeZoneLike = ES.DefaultTimeZone()) => {\n return zonedDateTime('iso8601', temporalTimeZoneLike);\n};\nconst plainDate: typeof Temporal.Now['plainDate'] = (calendarLike, temporalTimeZoneLike = ES.DefaultTimeZone()) => {\n return ES.TemporalDateTimeToDate(plainDateTime(calendarLike, temporalTimeZoneLike));\n};\nconst plainDateISO: typeof Temporal.Now['plainDateISO'] = (temporalTimeZoneLike = ES.DefaultTimeZone()) => {\n return ES.TemporalDateTimeToDate(plainDateTimeISO(temporalTimeZoneLike));\n};\nconst plainTimeISO: typeof Temporal.Now['plainTimeISO'] = (temporalTimeZoneLike = ES.DefaultTimeZone()) => {\n return ES.TemporalDateTimeToTime(plainDateTimeISO(temporalTimeZoneLike));\n};\nconst timeZoneId: typeof Temporal.Now['timeZoneId'] = () => {\n return ES.DefaultTimeZone();\n};\n\nexport const Now: typeof Temporal.Now = {\n instant,\n plainDateTime,\n plainDateTimeISO,\n plainDate,\n plainDateISO,\n plainTimeISO,\n timeZoneId,\n zonedDateTime,\n zonedDateTimeISO,\n [Symbol.toStringTag]: 'Temporal.Now'\n};\nObject.defineProperty(Now, Symbol.toStringTag, {\n value: 'Temporal.Now',\n writable: false,\n enumerable: false,\n configurable: true\n});\n","import { DEBUG } from './debug';\nimport * as ES from './ecmascript';\nimport { GetIntrinsic, MakeIntrinsicClass } from './intrinsicclass';\n\nimport {\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND,\n CALENDAR,\n EPOCHNANOSECONDS,\n CreateSlots,\n GetSlot,\n SetSlot\n} from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { PlainTimeParams as Params, PlainTimeReturn as Return } from './internaltypes';\n\nconst ObjectAssign = Object.assign;\n\ntype TemporalTimeToStringOptions = {\n unit: ReturnType<typeof ES.ToSecondsStringPrecisionRecord>['unit'];\n increment: ReturnType<typeof ES.ToSecondsStringPrecisionRecord>['increment'];\n roundingMode: Temporal.RoundingMode;\n};\n\nfunction TemporalTimeToString(\n time: Temporal.PlainTime,\n precision: ReturnType<typeof ES.ToSecondsStringPrecisionRecord>['precision'],\n options: TemporalTimeToStringOptions | undefined = undefined\n) {\n let hour = GetSlot(time, ISO_HOUR);\n let minute = GetSlot(time, ISO_MINUTE);\n let second = GetSlot(time, ISO_SECOND);\n let millisecond = GetSlot(time, ISO_MILLISECOND);\n let microsecond = GetSlot(time, ISO_MICROSECOND);\n let nanosecond = GetSlot(time, ISO_NANOSECOND);\n\n if (options) {\n const { unit, increment, roundingMode } = options;\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = ES.RoundTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n increment,\n unit,\n roundingMode\n ));\n }\n\n const hourString = ES.ISODateTimePartString(hour);\n const minuteString = ES.ISODateTimePartString(minute);\n const seconds = ES.FormatSecondsStringPart(second, millisecond, microsecond, nanosecond, precision);\n return `${hourString}:${minuteString}${seconds}`;\n}\n\nexport class PlainTime implements Temporal.PlainTime {\n constructor(\n isoHourParam = 0,\n isoMinuteParam = 0,\n isoSecondParam = 0,\n isoMillisecondParam = 0,\n isoMicrosecondParam = 0,\n isoNanosecondParam = 0\n ) {\n const isoHour = isoHourParam === undefined ? 0 : ES.ToIntegerWithTruncation(isoHourParam);\n const isoMinute = isoMinuteParam === undefined ? 0 : ES.ToIntegerWithTruncation(isoMinuteParam);\n const isoSecond = isoSecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(isoSecondParam);\n const isoMillisecond = isoMillisecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(isoMillisecondParam);\n const isoMicrosecond = isoMicrosecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(isoMicrosecondParam);\n const isoNanosecond = isoNanosecondParam === undefined ? 0 : ES.ToIntegerWithTruncation(isoNanosecondParam);\n\n ES.RejectTime(isoHour, isoMinute, isoSecond, isoMillisecond, isoMicrosecond, isoNanosecond);\n CreateSlots(this);\n SetSlot(this, ISO_HOUR, isoHour);\n SetSlot(this, ISO_MINUTE, isoMinute);\n SetSlot(this, ISO_SECOND, isoSecond);\n SetSlot(this, ISO_MILLISECOND, isoMillisecond);\n SetSlot(this, ISO_MICROSECOND, isoMicrosecond);\n SetSlot(this, ISO_NANOSECOND, isoNanosecond);\n\n if (DEBUG) {\n Object.defineProperty(this, '_repr_', {\n value: `${this[Symbol.toStringTag]} <${TemporalTimeToString(this, 'auto')}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n }\n\n get hour(): Return['hour'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_HOUR);\n }\n get minute(): Return['minute'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_MINUTE);\n }\n get second(): Return['second'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_SECOND);\n }\n get millisecond(): Return['millisecond'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_MILLISECOND);\n }\n get microsecond(): Return['microsecond'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_MICROSECOND);\n }\n get nanosecond(): Return['nanosecond'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, ISO_NANOSECOND);\n }\n\n with(temporalTimeLike: Params['with'][0], optionsParam: Params['with'][1] = undefined): Return['with'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(temporalTimeLike)) {\n throw new TypeError('invalid argument');\n }\n ES.RejectTemporalLikeObject(temporalTimeLike);\n const options = ES.GetOptionsObject(optionsParam);\n const overflow = ES.ToTemporalOverflow(options);\n\n const partialTime = ES.ToTemporalTimeRecord(temporalTimeLike, 'partial');\n\n const fields = ES.ToTemporalTimeRecord(this);\n let { hour, minute, second, millisecond, microsecond, nanosecond } = ObjectAssign(fields, partialTime);\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = ES.RegulateTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n overflow\n ));\n return new PlainTime(hour, minute, second, millisecond, microsecond, nanosecond);\n }\n add(temporalDurationLike: Params['add'][0]): Return['add'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromPlainTime('add', this, temporalDurationLike);\n }\n subtract(temporalDurationLike: Params['subtract'][0]): Return['subtract'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromPlainTime('subtract', this, temporalDurationLike);\n }\n until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainTime('until', this, other, options);\n }\n since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainTime('since', this, other, options);\n }\n round(roundToParam: Params['round'][0]): Return['round'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n if (roundToParam === undefined) throw new TypeError('options parameter is required');\n const roundTo =\n typeof roundToParam === 'string'\n ? (ES.CreateOnePropObject('smallestUnit', roundToParam) as Exclude<typeof roundToParam, string>)\n : ES.GetOptionsObject(roundToParam);\n const roundingIncrement = ES.ToTemporalRoundingIncrement(roundTo);\n const roundingMode = ES.ToTemporalRoundingMode(roundTo, 'halfExpand');\n const smallestUnit = ES.GetTemporalUnit(roundTo, 'smallestUnit', 'time', ES.REQUIRED);\n const MAX_INCREMENTS = {\n hour: 24,\n minute: 60,\n second: 60,\n millisecond: 1000,\n microsecond: 1000,\n nanosecond: 1000\n };\n ES.ValidateTemporalRoundingIncrement(roundingIncrement, MAX_INCREMENTS[smallestUnit], false);\n\n let hour = GetSlot(this, ISO_HOUR);\n let minute = GetSlot(this, ISO_MINUTE);\n let second = GetSlot(this, ISO_SECOND);\n let millisecond = GetSlot(this, ISO_MILLISECOND);\n let microsecond = GetSlot(this, ISO_MICROSECOND);\n let nanosecond = GetSlot(this, ISO_NANOSECOND);\n ({ hour, minute, second, millisecond, microsecond, nanosecond } = ES.RoundTime(\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n roundingIncrement,\n smallestUnit,\n roundingMode\n ));\n\n return new PlainTime(hour, minute, second, millisecond, microsecond, nanosecond);\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalTime(otherParam);\n for (const slot of [ISO_HOUR, ISO_MINUTE, ISO_SECOND, ISO_MILLISECOND, ISO_MICROSECOND, ISO_NANOSECOND]) {\n const val1 = GetSlot(this, slot);\n const val2 = GetSlot(other, slot);\n if (val1 !== val2) return false;\n }\n return true;\n }\n\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const digits = ES.ToFractionalSecondDigits(options);\n const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');\n const smallestUnit = ES.GetTemporalUnit(options, 'smallestUnit', 'time', undefined);\n if (smallestUnit === 'hour') throw new RangeError('smallestUnit must be a time unit other than \"hour\"');\n const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits);\n return TemporalTimeToString(this, precision, { unit, increment, roundingMode });\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return TemporalTimeToString(this, 'auto');\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return new DateTimeFormat(locales, options).format(this);\n }\n valueOf(): never {\n throw new TypeError('use compare() or equals() to compare Temporal.PlainTime');\n }\n\n toPlainDateTime(temporalDateParam: Params['toPlainDateTime'][0]): Return['toPlainDateTime'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n\n const temporalDate = ES.ToTemporalDate(temporalDateParam);\n const year = GetSlot(temporalDate, ISO_YEAR);\n const month = GetSlot(temporalDate, ISO_MONTH);\n const day = GetSlot(temporalDate, ISO_DAY);\n const calendar = GetSlot(temporalDate, CALENDAR);\n\n const hour = GetSlot(this, ISO_HOUR);\n const minute = GetSlot(this, ISO_MINUTE);\n const second = GetSlot(this, ISO_SECOND);\n const millisecond = GetSlot(this, ISO_MILLISECOND);\n const microsecond = GetSlot(this, ISO_MICROSECOND);\n const nanosecond = GetSlot(this, ISO_NANOSECOND);\n\n return ES.CreateTemporalDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n }\n toZonedDateTime(item: Params['toZonedDateTime'][0]): Return['toZonedDateTime'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n\n if (!ES.IsObject(item)) {\n throw new TypeError('invalid argument');\n }\n\n const dateLike = item.plainDate;\n if (dateLike === undefined) {\n throw new TypeError('missing date property');\n }\n const temporalDate = ES.ToTemporalDate(dateLike);\n\n const timeZoneLike = item.timeZone;\n if (timeZoneLike === undefined) {\n throw new TypeError('missing timeZone property');\n }\n const timeZone = ES.ToTemporalTimeZoneSlotValue(timeZoneLike);\n\n const year = GetSlot(temporalDate, ISO_YEAR);\n const month = GetSlot(temporalDate, ISO_MONTH);\n const day = GetSlot(temporalDate, ISO_DAY);\n const calendar = GetSlot(temporalDate, CALENDAR);\n const hour = GetSlot(this, ISO_HOUR);\n const minute = GetSlot(this, ISO_MINUTE);\n const second = GetSlot(this, ISO_SECOND);\n const millisecond = GetSlot(this, ISO_MILLISECOND);\n const microsecond = GetSlot(this, ISO_MICROSECOND);\n const nanosecond = GetSlot(this, ISO_NANOSECOND);\n\n const PlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const dt = new PlainDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n const instant = ES.GetInstantFor(timeZone, dt, 'compatible');\n return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar);\n }\n getISOFields(): Return['getISOFields'] {\n if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver');\n return {\n isoHour: GetSlot(this, ISO_HOUR),\n isoMicrosecond: GetSlot(this, ISO_MICROSECOND),\n isoMillisecond: GetSlot(this, ISO_MILLISECOND),\n isoMinute: GetSlot(this, ISO_MINUTE),\n isoNanosecond: GetSlot(this, ISO_NANOSECOND),\n isoSecond: GetSlot(this, ISO_SECOND)\n };\n }\n\n static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {\n const options = ES.GetOptionsObject(optionsParam);\n const overflow = ES.ToTemporalOverflow(options);\n if (ES.IsTemporalTime(item)) {\n return new PlainTime(\n GetSlot(item, ISO_HOUR),\n GetSlot(item, ISO_MINUTE),\n GetSlot(item, ISO_SECOND),\n GetSlot(item, ISO_MILLISECOND),\n GetSlot(item, ISO_MICROSECOND),\n GetSlot(item, ISO_NANOSECOND)\n );\n }\n return ES.ToTemporalTime(item, overflow);\n }\n static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {\n const one = ES.ToTemporalTime(oneParam);\n const two = ES.ToTemporalTime(twoParam);\n for (const slot of [ISO_HOUR, ISO_MINUTE, ISO_SECOND, ISO_MILLISECOND, ISO_MICROSECOND, ISO_NANOSECOND] as const) {\n const val1 = GetSlot(one, slot);\n const val2 = GetSlot(two, slot);\n if (val1 !== val2) return ES.ComparisonResult(val1 - val2);\n }\n return 0;\n }\n [Symbol.toStringTag]!: 'Temporal.PlainTime';\n}\n\nMakeIntrinsicClass(PlainTime, 'Temporal.PlainTime');\n","import { DEBUG } from './debug';\nimport * as ES from './ecmascript';\nimport { DefineIntrinsic, GetIntrinsic, MakeIntrinsicClass } from './intrinsicclass';\nimport {\n TIMEZONE_ID,\n EPOCHNANOSECONDS,\n ISO_YEAR,\n ISO_MONTH,\n ISO_DAY,\n ISO_HOUR,\n ISO_MINUTE,\n ISO_SECOND,\n ISO_MILLISECOND,\n ISO_MICROSECOND,\n ISO_NANOSECOND,\n CreateSlots,\n GetSlot,\n SetSlot\n} from './slots';\nimport JSBI from 'jsbi';\nimport type { Temporal } from '..';\nimport type { TimeZoneParams as Params, TimeZoneReturn as Return } from './internaltypes';\n\nexport class TimeZone implements Temporal.TimeZone {\n constructor(timeZoneIdentifierParam: string) {\n // Note: if the argument is not passed, GetCanonicalTimeZoneIdentifier(undefined) will throw.\n // This check exists only to improve the error message.\n if (arguments.length < 1) {\n throw new RangeError('missing argument: identifier is required');\n }\n\n const timeZoneIdentifier = ES.GetCanonicalTimeZoneIdentifier(timeZoneIdentifierParam);\n CreateSlots(this);\n SetSlot(this, TIMEZONE_ID, timeZoneIdentifier);\n\n if (DEBUG) {\n Object.defineProperty(this, '_repr_', {\n value: `${this[Symbol.toStringTag]} <${timeZoneIdentifier}>`,\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n }\n get id(): Return['id'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, TIMEZONE_ID);\n }\n getOffsetNanosecondsFor(instantParam: Params['getOffsetNanosecondsFor'][0]): Return['getOffsetNanosecondsFor'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const instant = ES.ToTemporalInstant(instantParam);\n const id = GetSlot(this, TIMEZONE_ID);\n\n if (ES.IsTimeZoneOffsetString(id)) {\n return ES.ParseTimeZoneOffsetString(id);\n }\n\n return ES.GetNamedTimeZoneOffsetNanoseconds(id, GetSlot(instant, EPOCHNANOSECONDS));\n }\n getOffsetStringFor(instantParam: Params['getOffsetStringFor'][0]): Return['getOffsetStringFor'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const instant = ES.ToTemporalInstant(instantParam);\n return ES.GetOffsetStringFor(this, instant);\n }\n getPlainDateTimeFor(\n instantParam: Params['getPlainDateTimeFor'][0],\n calendarParam: Params['getPlainDateTimeFor'][1] = 'iso8601'\n ): Return['getPlainDateTimeFor'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const instant = ES.ToTemporalInstant(instantParam);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n return ES.GetPlainDateTimeFor(this, instant, calendar);\n }\n getInstantFor(\n dateTimeParam: Params['getInstantFor'][0],\n optionsParam: Params['getInstantFor'][1] = undefined\n ): Return['getInstantFor'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const dateTime = ES.ToTemporalDateTime(dateTimeParam);\n const options = ES.GetOptionsObject(optionsParam);\n const disambiguation = ES.ToTemporalDisambiguation(options);\n return ES.GetInstantFor(this, dateTime, disambiguation);\n }\n getPossibleInstantsFor(dateTimeParam: Params['getPossibleInstantsFor'][0]): Return['getPossibleInstantsFor'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const dateTime = ES.ToTemporalDateTime(dateTimeParam);\n const Instant = GetIntrinsic('%Temporal.Instant%');\n const id = GetSlot(this, TIMEZONE_ID);\n\n if (ES.IsTimeZoneOffsetString(id)) {\n const epochNs = ES.GetUTCEpochNanoseconds(\n GetSlot(dateTime, ISO_YEAR),\n GetSlot(dateTime, ISO_MONTH),\n GetSlot(dateTime, ISO_DAY),\n GetSlot(dateTime, ISO_HOUR),\n GetSlot(dateTime, ISO_MINUTE),\n GetSlot(dateTime, ISO_SECOND),\n GetSlot(dateTime, ISO_MILLISECOND),\n GetSlot(dateTime, ISO_MICROSECOND),\n GetSlot(dateTime, ISO_NANOSECOND)\n );\n if (epochNs === null) throw new RangeError('DateTime outside of supported range');\n const offsetNs = ES.ParseTimeZoneOffsetString(id);\n return [new Instant(JSBI.subtract(epochNs, JSBI.BigInt(offsetNs)))];\n }\n\n const possibleEpochNs = ES.GetNamedTimeZoneEpochNanoseconds(\n id,\n GetSlot(dateTime, ISO_YEAR),\n GetSlot(dateTime, ISO_MONTH),\n GetSlot(dateTime, ISO_DAY),\n GetSlot(dateTime, ISO_HOUR),\n GetSlot(dateTime, ISO_MINUTE),\n GetSlot(dateTime, ISO_SECOND),\n GetSlot(dateTime, ISO_MILLISECOND),\n GetSlot(dateTime, ISO_MICROSECOND),\n GetSlot(dateTime, ISO_NANOSECOND)\n );\n return possibleEpochNs.map((ns) => new Instant(ns));\n }\n getNextTransition(startingPointParam: Params['getNextTransition'][0]): Return['getNextTransition'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const startingPoint = ES.ToTemporalInstant(startingPointParam);\n const id = GetSlot(this, TIMEZONE_ID);\n\n // Offset time zones or UTC have no transitions\n if (ES.IsTimeZoneOffsetString(id) || id === 'UTC') {\n return null;\n }\n\n let epochNanoseconds: JSBI | null = GetSlot(startingPoint, EPOCHNANOSECONDS);\n const Instant = GetIntrinsic('%Temporal.Instant%');\n epochNanoseconds = ES.GetNamedTimeZoneNextTransition(id, epochNanoseconds);\n return epochNanoseconds === null ? null : new Instant(epochNanoseconds);\n }\n getPreviousTransition(startingPointParam: Params['getPreviousTransition'][0]): Return['getPreviousTransition'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n const startingPoint = ES.ToTemporalInstant(startingPointParam);\n const id = GetSlot(this, TIMEZONE_ID);\n\n // Offset time zones or UTC have no transitions\n if (ES.IsTimeZoneOffsetString(id) || id === 'UTC') {\n return null;\n }\n\n let epochNanoseconds: JSBI | null = GetSlot(startingPoint, EPOCHNANOSECONDS);\n const Instant = GetIntrinsic('%Temporal.Instant%');\n epochNanoseconds = ES.GetNamedTimeZonePreviousTransition(id, epochNanoseconds);\n return epochNanoseconds === null ? null : new Instant(epochNanoseconds);\n }\n toString(): string {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, TIMEZONE_ID);\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalTimeZone(this)) throw new TypeError('invalid receiver');\n return GetSlot(this, TIMEZONE_ID);\n }\n static from(item: Params['from'][0]): Return['from'] {\n const timeZoneSlotValue = ES.ToTemporalTimeZoneSlotValue(item);\n return ES.ToTemporalTimeZoneObject(timeZoneSlotValue);\n }\n [Symbol.toStringTag]!: 'Temporal.TimeZone';\n}\n\nMakeIntrinsicClass(TimeZone, 'Temporal.TimeZone');\nDefineIntrinsic('Temporal.TimeZone.prototype.getOffsetNanosecondsFor', TimeZone.prototype.getOffsetNanosecondsFor);\nDefineIntrinsic('Temporal.TimeZone.prototype.getPossibleInstantsFor', TimeZone.prototype.getPossibleInstantsFor);\n","import * as ES from './ecmascript';\nimport { MakeIntrinsicClass } from './intrinsicclass';\nimport { ISO_YEAR, ISO_MONTH, ISO_DAY, CALENDAR, GetSlot } from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { PlainYearMonthParams as Params, PlainYearMonthReturn as Return } from './internaltypes';\n\nconst ObjectCreate = Object.create;\n\nexport class PlainYearMonth implements Temporal.PlainYearMonth {\n constructor(\n isoYearParam: Params['constructor'][0],\n isoMonthParam: Params['constructor'][1],\n calendarParam: Params['constructor'][2] = 'iso8601',\n referenceISODayParam: Params['constructor'][3] = 1\n ) {\n const isoYear = ES.ToIntegerWithTruncation(isoYearParam);\n const isoMonth = ES.ToIntegerWithTruncation(isoMonthParam);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n const referenceISODay = ES.ToIntegerWithTruncation(referenceISODayParam);\n\n ES.CreateTemporalYearMonthSlots(this, isoYear, isoMonth, calendar, referenceISODay);\n }\n get year(): Return['year'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYear(GetSlot(this, CALENDAR), this);\n }\n get month(): Return['month'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonth(GetSlot(this, CALENDAR), this);\n }\n get monthCode(): Return['monthCode'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthCode(GetSlot(this, CALENDAR), this);\n }\n get calendarId(): Return['calendarId'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarIdentifier(GetSlot(this, CALENDAR));\n }\n get era(): Return['era'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEra(GetSlot(this, CALENDAR), this);\n }\n get eraYear(): Return['eraYear'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEraYear(GetSlot(this, CALENDAR), this);\n }\n get daysInMonth(): Return['daysInMonth'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInMonth(GetSlot(this, CALENDAR), this);\n }\n get daysInYear(): Return['daysInYear'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInYear(GetSlot(this, CALENDAR), this);\n }\n get monthsInYear(): Return['monthsInYear'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthsInYear(GetSlot(this, CALENDAR), this);\n }\n get inLeapYear(): Return['inLeapYear'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.CalendarInLeapYear(GetSlot(this, CALENDAR), this);\n }\n with(temporalYearMonthLike: Params['with'][0], optionsParam: Params['with'][1] = undefined): Return['with'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(temporalYearMonthLike)) {\n throw new TypeError('invalid argument');\n }\n ES.RejectTemporalLikeObject(temporalYearMonthLike);\n const options = ES.GetOptionsObject(optionsParam);\n\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['month', 'monthCode', 'year'] as const);\n let fields = ES.PrepareTemporalFields(this, fieldNames, []);\n const partialYearMonth = ES.PrepareTemporalFields(temporalYearMonthLike, fieldNames, 'partial');\n fields = ES.CalendarMergeFields(calendar, fields, partialYearMonth);\n fields = ES.PrepareTemporalFields(fields, fieldNames, []);\n\n return ES.CalendarYearMonthFromFields(calendar, fields, options);\n }\n add(temporalDurationLike: Params['add'][0], options: Params['add'][1] = undefined): Return['add'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromPlainYearMonth('add', this, temporalDurationLike, options);\n }\n subtract(\n temporalDurationLike: Params['subtract'][0],\n options: Params['subtract'][1] = undefined\n ): Return['subtract'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromPlainYearMonth('subtract', this, temporalDurationLike, options);\n }\n until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainYearMonth('until', this, other, options);\n }\n since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalPlainYearMonth('since', this, other, options);\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalYearMonth(otherParam);\n for (const slot of [ISO_YEAR, ISO_MONTH, ISO_DAY]) {\n const val1 = GetSlot(this, slot);\n const val2 = GetSlot(other, slot);\n if (val1 !== val2) return false;\n }\n return ES.CalendarEquals(GetSlot(this, CALENDAR), GetSlot(other, CALENDAR));\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const showCalendar = ES.ToCalendarNameOption(options);\n return ES.TemporalYearMonthToString(this, showCalendar);\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.TemporalYearMonthToString(this);\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n options: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return new DateTimeFormat(locales, options).format(this);\n }\n valueOf(): never {\n throw new TypeError('use compare() or equals() to compare Temporal.PlainYearMonth');\n }\n toPlainDate(item: Params['toPlainDate'][0]): Return['toPlainDate'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(item)) throw new TypeError('argument should be an object');\n const calendar = GetSlot(this, CALENDAR);\n\n const receiverFieldNames = ES.CalendarFields(calendar, ['monthCode', 'year'] as const);\n const fields = ES.PrepareTemporalFields(this, receiverFieldNames, []);\n\n const inputFieldNames = ES.CalendarFields(calendar, ['day'] as const);\n const inputFields = ES.PrepareTemporalFields(item, inputFieldNames, []);\n let mergedFields = ES.CalendarMergeFields(calendar, fields, inputFields);\n\n // TODO: Use MergeLists abstract operation.\n const mergedFieldNames = [...new Set([...receiverFieldNames, ...inputFieldNames])];\n mergedFields = ES.PrepareTemporalFields(mergedFields, mergedFieldNames, []);\n const options = ObjectCreate(null);\n options.overflow = 'reject';\n return ES.CalendarDateFromFields(calendar, mergedFields, options);\n }\n getISOFields(): Return['getISOFields'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return {\n calendar: GetSlot(this, CALENDAR),\n isoDay: GetSlot(this, ISO_DAY),\n isoMonth: GetSlot(this, ISO_MONTH),\n isoYear: GetSlot(this, ISO_YEAR)\n };\n }\n getCalendar(): Return['getCalendar'] {\n if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));\n }\n\n static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {\n const options = ES.GetOptionsObject(optionsParam);\n if (ES.IsTemporalYearMonth(item)) {\n ES.ToTemporalOverflow(options); // validate and ignore\n return ES.CreateTemporalYearMonth(\n GetSlot(item, ISO_YEAR),\n GetSlot(item, ISO_MONTH),\n GetSlot(item, CALENDAR),\n GetSlot(item, ISO_DAY)\n );\n }\n return ES.ToTemporalYearMonth(item, options);\n }\n static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {\n const one = ES.ToTemporalYearMonth(oneParam);\n const two = ES.ToTemporalYearMonth(twoParam);\n return ES.CompareISODate(\n GetSlot(one, ISO_YEAR),\n GetSlot(one, ISO_MONTH),\n GetSlot(one, ISO_DAY),\n GetSlot(two, ISO_YEAR),\n GetSlot(two, ISO_MONTH),\n GetSlot(two, ISO_DAY)\n );\n }\n [Symbol.toStringTag]!: 'Temporal.PlainYearMonth';\n}\n\nMakeIntrinsicClass(PlainYearMonth, 'Temporal.PlainYearMonth');\n","import * as ES from './ecmascript';\nimport { GetIntrinsic, MakeIntrinsicClass } from './intrinsicclass';\nimport {\n CALENDAR,\n EPOCHNANOSECONDS,\n ISO_HOUR,\n INSTANT,\n ISO_DAY,\n ISO_MONTH,\n ISO_YEAR,\n ISO_MICROSECOND,\n ISO_MILLISECOND,\n ISO_MINUTE,\n ISO_NANOSECOND,\n ISO_SECOND,\n TIME_ZONE,\n GetSlot\n} from './slots';\nimport type { Temporal } from '..';\nimport { DateTimeFormat } from './intl';\nimport type { ZonedDateTimeParams as Params, ZonedDateTimeReturn as Return } from './internaltypes';\n\nimport JSBI from 'jsbi';\nimport { BILLION, MILLION, THOUSAND, ZERO, HOUR_NANOS } from './ecmascript';\n\nconst customResolvedOptions = DateTimeFormat.prototype.resolvedOptions as Intl.DateTimeFormat['resolvedOptions'];\nconst ObjectCreate = Object.create;\n\nexport class ZonedDateTime implements Temporal.ZonedDateTime {\n constructor(\n epochNanosecondsParam: bigint | JSBI,\n timeZoneParam: string | Temporal.TimeZoneProtocol,\n calendarParam: string | Temporal.CalendarProtocol = 'iso8601'\n ) {\n // Note: if the argument is not passed, ToBigInt(undefined) will throw. This check exists only\n // to improve the error message.\n // ToTemporalTimeZoneSlotValue(undefined) has a clear enough message.\n if (arguments.length < 1) {\n throw new TypeError('missing argument: epochNanoseconds is required');\n }\n const epochNanoseconds = ES.ToBigInt(epochNanosecondsParam);\n const timeZone = ES.ToTemporalTimeZoneSlotValue(timeZoneParam);\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n\n ES.CreateTemporalZonedDateTimeSlots(this, epochNanoseconds, timeZone, calendar);\n }\n get calendarId(): Return['calendarId'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarIdentifier(GetSlot(this, CALENDAR));\n }\n get timeZoneId(): Return['timeZoneId'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalTimeZoneIdentifier(GetSlot(this, TIME_ZONE));\n }\n get year(): Return['year'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get month(): Return['month'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonth(GetSlot(this, CALENDAR), dateTime(this));\n }\n get monthCode(): Return['monthCode'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthCode(GetSlot(this, CALENDAR), dateTime(this));\n }\n get day(): Return['day'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDay(GetSlot(this, CALENDAR), dateTime(this));\n }\n get hour(): Return['hour'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(dateTime(this), ISO_HOUR);\n }\n get minute(): Return['minute'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(dateTime(this), ISO_MINUTE);\n }\n get second(): Return['second'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(dateTime(this), ISO_SECOND);\n }\n get millisecond(): Return['millisecond'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(dateTime(this), ISO_MILLISECOND);\n }\n get microsecond(): Return['microsecond'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(dateTime(this), ISO_MICROSECOND);\n }\n get nanosecond(): Return['nanosecond'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return GetSlot(dateTime(this), ISO_NANOSECOND);\n }\n get era(): Return['era'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEra(GetSlot(this, CALENDAR), dateTime(this));\n }\n get eraYear(): Return['eraYear'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarEraYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get epochSeconds(): Return['epochSeconds'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const value = GetSlot(this, EPOCHNANOSECONDS);\n return JSBI.toNumber(ES.BigIntFloorDiv(value, BILLION));\n }\n get epochMilliseconds(): Return['epochMilliseconds'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const value = GetSlot(this, EPOCHNANOSECONDS);\n return JSBI.toNumber(ES.BigIntFloorDiv(value, MILLION));\n }\n get epochMicroseconds(): Return['epochMicroseconds'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const value = GetSlot(this, EPOCHNANOSECONDS);\n return ES.ToBigIntExternal(ES.BigIntFloorDiv(value, THOUSAND));\n }\n get epochNanoseconds(): Return['epochNanoseconds'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToBigIntExternal(GetSlot(this, EPOCHNANOSECONDS));\n }\n get dayOfWeek(): Return['dayOfWeek'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDayOfWeek(GetSlot(this, CALENDAR), dateTime(this));\n }\n get dayOfYear(): Return['dayOfYear'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDayOfYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get weekOfYear(): Return['weekOfYear'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarWeekOfYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get yearOfWeek(): Return['yearOfWeek'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarYearOfWeek(GetSlot(this, CALENDAR), dateTime(this));\n }\n get hoursInDay(): Return['hoursInDay'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const dt = dateTime(this);\n const DateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const year = GetSlot(dt, ISO_YEAR);\n const month = GetSlot(dt, ISO_MONTH);\n const day = GetSlot(dt, ISO_DAY);\n const today = new DateTime(year, month, day, 0, 0, 0, 0, 0, 0);\n const tomorrowFields = ES.AddISODate(year, month, day, 0, 0, 0, 1, 'reject');\n const tomorrow = new DateTime(tomorrowFields.year, tomorrowFields.month, tomorrowFields.day, 0, 0, 0, 0, 0, 0);\n const timeZone = GetSlot(this, TIME_ZONE);\n const todayNs = GetSlot(ES.GetInstantFor(timeZone, today, 'compatible'), EPOCHNANOSECONDS);\n const tomorrowNs = GetSlot(ES.GetInstantFor(timeZone, tomorrow, 'compatible'), EPOCHNANOSECONDS);\n const diffNs = JSBI.subtract(tomorrowNs, todayNs);\n return ES.BigIntDivideToNumber(diffNs, HOUR_NANOS);\n }\n get daysInWeek(): Return['daysInWeek'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInWeek(GetSlot(this, CALENDAR), dateTime(this));\n }\n get daysInMonth(): Return['daysInMonth'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInMonth(GetSlot(this, CALENDAR), dateTime(this));\n }\n get daysInYear(): Return['daysInYear'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarDaysInYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get monthsInYear(): Return['monthsInYear'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarMonthsInYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get inLeapYear(): Return['inLeapYear'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.CalendarInLeapYear(GetSlot(this, CALENDAR), dateTime(this));\n }\n get offset(): Return['offset'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.GetOffsetStringFor(GetSlot(this, TIME_ZONE), GetSlot(this, INSTANT));\n }\n get offsetNanoseconds(): Return['offsetNanoseconds'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.GetOffsetNanosecondsFor(GetSlot(this, TIME_ZONE), GetSlot(this, INSTANT));\n }\n with(temporalZonedDateTimeLike: Params['with'][0], optionsParam: Params['with'][1] = undefined): Return['with'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n if (!ES.IsObject(temporalZonedDateTimeLike)) {\n throw new TypeError('invalid zoned-date-time-like');\n }\n ES.RejectTemporalLikeObject(temporalZonedDateTimeLike);\n const options = ES.GetOptionsObject(optionsParam);\n\n const calendar = GetSlot(this, CALENDAR);\n let fieldNames: (keyof Temporal.ZonedDateTimeLike)[] = ES.CalendarFields(calendar, [\n 'day',\n 'hour',\n 'microsecond',\n 'millisecond',\n 'minute',\n 'month',\n 'monthCode',\n 'nanosecond',\n 'second',\n 'year'\n ] as const);\n fieldNames.push('offset');\n let fields = ES.PrepareTemporalFields(this, fieldNames, ['offset']);\n const partialZonedDateTime = ES.PrepareTemporalFields(temporalZonedDateTimeLike, fieldNames, 'partial');\n fields = ES.CalendarMergeFields(calendar, fields, partialZonedDateTime);\n fields = ES.PrepareTemporalFields(fields, fieldNames, ['offset']);\n\n const disambiguation = ES.ToTemporalDisambiguation(options);\n const offset = ES.ToTemporalOffset(options, 'prefer');\n\n let { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } =\n ES.InterpretTemporalDateTimeFields(calendar, fields, options);\n const offsetNs = ES.ParseTimeZoneOffsetString(fields.offset);\n const timeZone = GetSlot(this, TIME_ZONE);\n const epochNanoseconds = ES.InterpretISODateTimeOffset(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n 'option',\n offsetNs,\n timeZone,\n disambiguation,\n offset,\n /* matchMinute = */ false\n );\n\n return ES.CreateTemporalZonedDateTime(epochNanoseconds, timeZone, calendar);\n }\n withPlainDate(temporalDateParam: Params['withPlainDate'][0]): Return['withPlainDate'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n\n const temporalDate = ES.ToTemporalDate(temporalDateParam);\n\n const year = GetSlot(temporalDate, ISO_YEAR);\n const month = GetSlot(temporalDate, ISO_MONTH);\n const day = GetSlot(temporalDate, ISO_DAY);\n let calendar = GetSlot(temporalDate, CALENDAR);\n const thisDt = dateTime(this);\n const hour = GetSlot(thisDt, ISO_HOUR);\n const minute = GetSlot(thisDt, ISO_MINUTE);\n const second = GetSlot(thisDt, ISO_SECOND);\n const millisecond = GetSlot(thisDt, ISO_MILLISECOND);\n const microsecond = GetSlot(thisDt, ISO_MICROSECOND);\n const nanosecond = GetSlot(thisDt, ISO_NANOSECOND);\n\n calendar = ES.ConsolidateCalendars(GetSlot(this, CALENDAR), calendar);\n const timeZone = GetSlot(this, TIME_ZONE);\n const PlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const dt = new PlainDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n const instant = ES.GetInstantFor(timeZone, dt, 'compatible');\n return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar);\n }\n withPlainTime(temporalTimeParam: Params['withPlainTime'][0] = undefined): Return['withPlainTime'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n\n const PlainTime = GetIntrinsic('%Temporal.PlainTime%');\n const temporalTime = temporalTimeParam === undefined ? new PlainTime() : ES.ToTemporalTime(temporalTimeParam);\n\n const thisDt = dateTime(this);\n const year = GetSlot(thisDt, ISO_YEAR);\n const month = GetSlot(thisDt, ISO_MONTH);\n const day = GetSlot(thisDt, ISO_DAY);\n const calendar = GetSlot(this, CALENDAR);\n const hour = GetSlot(temporalTime, ISO_HOUR);\n const minute = GetSlot(temporalTime, ISO_MINUTE);\n const second = GetSlot(temporalTime, ISO_SECOND);\n const millisecond = GetSlot(temporalTime, ISO_MILLISECOND);\n const microsecond = GetSlot(temporalTime, ISO_MICROSECOND);\n const nanosecond = GetSlot(temporalTime, ISO_NANOSECOND);\n\n const timeZone = GetSlot(this, TIME_ZONE);\n const PlainDateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const dt = new PlainDateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n calendar\n );\n const instant = ES.GetInstantFor(timeZone, dt, 'compatible');\n return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar);\n }\n withTimeZone(timeZoneParam: Params['withTimeZone'][0]): Return['withTimeZone'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const timeZone = ES.ToTemporalTimeZoneSlotValue(timeZoneParam);\n return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), timeZone, GetSlot(this, CALENDAR));\n }\n withCalendar(calendarParam: Params['withCalendar'][0]): Return['withCalendar'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const calendar = ES.ToTemporalCalendarSlotValue(calendarParam);\n return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), GetSlot(this, TIME_ZONE), calendar);\n }\n add(temporalDurationLike: Params['add'][0], options: Params['add'][1] = undefined): Return['add'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromZonedDateTime('add', this, temporalDurationLike, options);\n }\n subtract(\n temporalDurationLike: Params['subtract'][0],\n options: Params['subtract'][1] = undefined\n ): Return['subtract'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.AddDurationToOrSubtractDurationFromZonedDateTime('subtract', this, temporalDurationLike, options);\n }\n until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalZonedDateTime('until', this, other, options);\n }\n since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.DifferenceTemporalZonedDateTime('since', this, other, options);\n }\n round(roundToParam: Params['round'][0]): Return['round'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n if (roundToParam === undefined) throw new TypeError('options parameter is required');\n const roundTo =\n typeof roundToParam === 'string'\n ? (ES.CreateOnePropObject('smallestUnit', roundToParam) as Exclude<typeof roundToParam, string>)\n : ES.GetOptionsObject(roundToParam);\n const roundingIncrement = ES.ToTemporalRoundingIncrement(roundTo);\n const roundingMode = ES.ToTemporalRoundingMode(roundTo, 'halfExpand');\n const smallestUnit = ES.GetTemporalUnit(roundTo, 'smallestUnit', 'time', ES.REQUIRED, ['day']);\n const maximumIncrements = {\n day: 1,\n hour: 24,\n minute: 60,\n second: 60,\n millisecond: 1000,\n microsecond: 1000,\n nanosecond: 1000\n };\n const maximum = maximumIncrements[smallestUnit];\n const inclusive = maximum === 1;\n ES.ValidateTemporalRoundingIncrement(roundingIncrement, maximum, inclusive);\n\n // first, round the underlying DateTime fields\n const dt = dateTime(this);\n let year = GetSlot(dt, ISO_YEAR);\n let month = GetSlot(dt, ISO_MONTH);\n let day = GetSlot(dt, ISO_DAY);\n let hour = GetSlot(dt, ISO_HOUR);\n let minute = GetSlot(dt, ISO_MINUTE);\n let second = GetSlot(dt, ISO_SECOND);\n let millisecond = GetSlot(dt, ISO_MILLISECOND);\n let microsecond = GetSlot(dt, ISO_MICROSECOND);\n let nanosecond = GetSlot(dt, ISO_NANOSECOND);\n\n const DateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const timeZone = GetSlot(this, TIME_ZONE);\n const calendar = GetSlot(this, CALENDAR);\n const dtStart = new DateTime(GetSlot(dt, ISO_YEAR), GetSlot(dt, ISO_MONTH), GetSlot(dt, ISO_DAY), 0, 0, 0, 0, 0, 0);\n const instantStart = ES.GetInstantFor(timeZone, dtStart, 'compatible');\n const endNs = ES.AddZonedDateTime(instantStart, timeZone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0);\n const dayLengthNs = JSBI.subtract(endNs, JSBI.BigInt(GetSlot(instantStart, EPOCHNANOSECONDS)));\n if (JSBI.lessThanOrEqual(dayLengthNs, ZERO)) {\n throw new RangeError('cannot round a ZonedDateTime in a calendar with zero or negative length days');\n }\n ({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = ES.RoundISODateTime(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n roundingIncrement,\n smallestUnit,\n roundingMode,\n // Days are guaranteed to be shorter than Number.MAX_SAFE_INTEGER\n // (which can hold up to 104 days in nanoseconds)\n JSBI.toNumber(dayLengthNs)\n ));\n\n // Now reset all DateTime fields but leave the TimeZone. The offset will\n // also be retained if the new date/time values are still OK with the old\n // offset. Otherwise the offset will be changed to be compatible with the\n // new date/time values. If DST disambiguation is required, the `compatible`\n // disambiguation algorithm will be used.\n const offsetNs = ES.GetOffsetNanosecondsFor(timeZone, GetSlot(this, INSTANT));\n const epochNanoseconds = ES.InterpretISODateTimeOffset(\n year,\n month,\n day,\n hour,\n minute,\n second,\n millisecond,\n microsecond,\n nanosecond,\n 'option',\n offsetNs,\n timeZone,\n 'compatible',\n 'prefer',\n /* matchMinute = */ false\n );\n\n return ES.CreateTemporalZonedDateTime(epochNanoseconds, timeZone, GetSlot(this, CALENDAR));\n }\n equals(otherParam: Params['equals'][0]): Return['equals'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const other = ES.ToTemporalZonedDateTime(otherParam);\n const one = GetSlot(this, EPOCHNANOSECONDS);\n const two = GetSlot(other, EPOCHNANOSECONDS);\n if (!JSBI.equal(JSBI.BigInt(one), JSBI.BigInt(two))) return false;\n if (!ES.TimeZoneEquals(GetSlot(this, TIME_ZONE), GetSlot(other, TIME_ZONE))) return false;\n return ES.CalendarEquals(GetSlot(this, CALENDAR), GetSlot(other, CALENDAR));\n }\n toString(optionsParam: Params['toString'][0] = undefined): string {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n const showCalendar = ES.ToCalendarNameOption(options);\n const digits = ES.ToFractionalSecondDigits(options);\n const showOffset = ES.ToShowOffsetOption(options);\n const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');\n const smallestUnit = ES.GetTemporalUnit(options, 'smallestUnit', 'time', undefined);\n if (smallestUnit === 'hour') throw new RangeError('smallestUnit must be a time unit other than \"hour\"');\n const showTimeZone = ES.ToTimeZoneNameOption(options);\n const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits);\n return ES.TemporalZonedDateTimeToString(this, precision, showCalendar, showTimeZone, showOffset, {\n unit,\n increment,\n roundingMode\n });\n }\n toLocaleString(\n locales: Params['toLocaleString'][0] = undefined,\n optionsParam: Params['toLocaleString'][1] = undefined\n ): string {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const options = ES.GetOptionsObject(optionsParam);\n\n const optionsCopy = ObjectCreate(null);\n // This is not quite per specification, but this polyfill's DateTimeFormat\n // already doesn't match the InitializeDateTimeFormat operation, and the\n // access order might change anyway;\n // see https://github.com/tc39/ecma402/issues/747\n ES.CopyDataProperties(optionsCopy, options, ['timeZone']);\n\n if (options.timeZone !== undefined) {\n throw new TypeError('ZonedDateTime toLocaleString does not accept a timeZone option');\n }\n\n if (\n optionsCopy.year === undefined &&\n optionsCopy.month === undefined &&\n optionsCopy.day === undefined &&\n optionsCopy.weekday === undefined &&\n optionsCopy.dateStyle === undefined &&\n optionsCopy.hour === undefined &&\n optionsCopy.minute === undefined &&\n optionsCopy.second === undefined &&\n optionsCopy.timeStyle === undefined &&\n optionsCopy.dayPeriod === undefined &&\n optionsCopy.timeZoneName === undefined\n ) {\n optionsCopy.timeZoneName = 'short';\n // The rest of the defaults will be filled in by formatting the Instant\n }\n\n let timeZone = ES.ToTemporalTimeZoneIdentifier(GetSlot(this, TIME_ZONE));\n if (ES.IsTimeZoneOffsetString(timeZone)) {\n // Note: https://github.com/tc39/ecma402/issues/683 will remove this\n throw new RangeError('toLocaleString does not support offset string time zones');\n }\n timeZone = ES.GetCanonicalTimeZoneIdentifier(timeZone);\n optionsCopy.timeZone = timeZone;\n\n const formatter = new DateTimeFormat(locales, optionsCopy);\n\n const localeCalendarIdentifier = ES.Call(customResolvedOptions, formatter, []).calendar;\n const calendarIdentifier = ES.ToTemporalCalendarIdentifier(GetSlot(this, CALENDAR));\n if (\n calendarIdentifier !== 'iso8601' &&\n localeCalendarIdentifier !== 'iso8601' &&\n localeCalendarIdentifier !== calendarIdentifier\n ) {\n throw new RangeError(\n `cannot format ZonedDateTime with calendar ${calendarIdentifier}` +\n ` in locale with calendar ${localeCalendarIdentifier}`\n );\n }\n\n return formatter.format(GetSlot(this, INSTANT));\n }\n toJSON(): Return['toJSON'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.TemporalZonedDateTimeToString(this, 'auto');\n }\n valueOf(): never {\n throw new TypeError('use compare() or equals() to compare Temporal.ZonedDateTime');\n }\n startOfDay(): Return['startOfDay'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const dt = dateTime(this);\n const DateTime = GetIntrinsic('%Temporal.PlainDateTime%');\n const calendar = GetSlot(this, CALENDAR);\n const dtStart = new DateTime(\n GetSlot(dt, ISO_YEAR),\n GetSlot(dt, ISO_MONTH),\n GetSlot(dt, ISO_DAY),\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n calendar\n );\n const timeZone = GetSlot(this, TIME_ZONE);\n const instant = ES.GetInstantFor(timeZone, dtStart, 'compatible');\n return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar);\n }\n toInstant(): Return['toInstant'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const TemporalInstant = GetIntrinsic('%Temporal.Instant%');\n return new TemporalInstant(GetSlot(this, EPOCHNANOSECONDS));\n }\n toPlainDate(): Return['toPlainDate'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDateTimeToDate(dateTime(this));\n }\n toPlainTime(): Return['toPlainTime'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.TemporalDateTimeToTime(dateTime(this));\n }\n toPlainDateTime(): Return['toPlainDateTime'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return dateTime(this);\n }\n toPlainYearMonth(): Return['toPlainYearMonth'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['monthCode', 'year'] as const);\n const fields = ES.PrepareTemporalFields(this, fieldNames, []);\n return ES.CalendarYearMonthFromFields(calendar, fields);\n }\n toPlainMonthDay(): Return['toPlainMonthDay'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const calendar = GetSlot(this, CALENDAR);\n const fieldNames = ES.CalendarFields(calendar, ['day', 'monthCode'] as const);\n const fields = ES.PrepareTemporalFields(this, fieldNames, []);\n return ES.CalendarMonthDayFromFields(calendar, fields);\n }\n getISOFields(): Return['getISOFields'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n const dt = dateTime(this);\n const tz = GetSlot(this, TIME_ZONE);\n return {\n calendar: GetSlot(this, CALENDAR),\n isoDay: GetSlot(dt, ISO_DAY),\n isoHour: GetSlot(dt, ISO_HOUR),\n isoMicrosecond: GetSlot(dt, ISO_MICROSECOND),\n isoMillisecond: GetSlot(dt, ISO_MILLISECOND),\n isoMinute: GetSlot(dt, ISO_MINUTE),\n isoMonth: GetSlot(dt, ISO_MONTH),\n isoNanosecond: GetSlot(dt, ISO_NANOSECOND),\n isoSecond: GetSlot(dt, ISO_SECOND),\n isoYear: GetSlot(dt, ISO_YEAR),\n offset: ES.GetOffsetStringFor(tz, GetSlot(this, INSTANT)),\n timeZone: tz\n };\n }\n getCalendar(): Return['getCalendar'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));\n }\n getTimeZone(): Return['getTimeZone'] {\n if (!ES.IsTemporalZonedDateTime(this)) throw new TypeError('invalid receiver');\n return ES.ToTemporalTimeZoneObject(GetSlot(this, TIME_ZONE));\n }\n\n static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {\n const options = ES.GetOptionsObject(optionsParam);\n if (ES.IsTemporalZonedDateTime(item)) {\n ES.ToTemporalDisambiguation(options); // validate and ignore\n ES.ToTemporalOffset(options, 'reject');\n ES.ToTemporalOverflow(options);\n return ES.CreateTemporalZonedDateTime(\n GetSlot(item, EPOCHNANOSECONDS),\n GetSlot(item, TIME_ZONE),\n GetSlot(item, CALENDAR)\n );\n }\n return ES.ToTemporalZonedDateTime(item, options);\n }\n static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {\n const one = ES.ToTemporalZonedDateTime(oneParam);\n const two = ES.ToTemporalZonedDateTime(twoParam);\n const ns1 = GetSlot(one, EPOCHNANOSECONDS);\n const ns2 = GetSlot(two, EPOCHNANOSECONDS);\n if (JSBI.lessThan(JSBI.BigInt(ns1), JSBI.BigInt(ns2))) return -1;\n if (JSBI.greaterThan(JSBI.BigInt(ns1), JSBI.BigInt(ns2))) return 1;\n return 0;\n }\n [Symbol.toStringTag]!: 'Temporal.ZonedDateTime';\n}\n\nMakeIntrinsicClass(ZonedDateTime, 'Temporal.ZonedDateTime');\n\nfunction dateTime(zdt: Temporal.ZonedDateTime) {\n return ES.GetPlainDateTimeFor(GetSlot(zdt, TIME_ZONE), GetSlot(zdt, INSTANT), GetSlot(zdt, CALENDAR));\n}\n","// This entry point treats Temporal as a library, and does not polyfill it onto\n// the global object.\n// This is in order to avoid breaking the web in the future, if the polyfill\n// gains wide adoption before the API is finalized. We do not want checks such\n// as `if (typeof Temporal === 'undefined')` in the wild, until browsers start\n// shipping the finalized API.\n\nimport * as Temporal from './temporal';\nimport * as Intl from './intl';\nimport { toTemporalInstant } from './legacydate';\n\n// Work around https://github.com/babel/babel/issues/2025.\nconst types = [\n Temporal.Instant,\n Temporal.Calendar,\n Temporal.PlainDate,\n Temporal.PlainDateTime,\n Temporal.Duration,\n Temporal.PlainMonthDay,\n // Temporal.Now, // plain object (not a constructor), so no `prototype`\n Temporal.PlainTime,\n Temporal.TimeZone,\n Temporal.PlainYearMonth,\n Temporal.ZonedDateTime\n];\nfor (const type of types) {\n const descriptor = Object.getOwnPropertyDescriptor(type, 'prototype') as PropertyDescriptor;\n if (descriptor.configurable || descriptor.enumerable || descriptor.writable) {\n descriptor.configurable = false;\n descriptor.enumerable = false;\n descriptor.writable = false;\n Object.defineProperty(type, 'prototype', descriptor);\n }\n}\n\nexport { Temporal, Intl, toTemporalInstant };\n","import { Instant } from './instant';\n\nimport JSBI from 'jsbi';\nimport { MILLION } from './ecmascript';\n\nexport function toTemporalInstant(this: Date) {\n // Observable access to valueOf is not correct here, but unavoidable\n const epochNanoseconds = JSBI.multiply(JSBI.BigInt(+this), MILLION);\n return new Instant(epochNanoseconds);\n}\n"],"names":["INTRINSICS","MakeIntrinsicClass","Class","name","Object","defineProperty","prototype","Symbol","toStringTag","value","writable","enumerable","configurable","prop","getOwnPropertyNames","desc","getOwnPropertyDescriptor","DefineIntrinsic","key","undefined","Error","GetIntrinsic","intrinsic","EPOCHNANOSECONDS","TIMEZONE_ID","ISO_YEAR","ISO_MONTH","ISO_DAY","ISO_HOUR","ISO_MINUTE","ISO_SECOND","ISO_MILLISECOND","ISO_MICROSECOND","ISO_NANOSECOND","CALENDAR","DATE_BRAND","YEAR_MONTH_BRAND","MONTH_DAY_BRAND","INSTANT","TIME_ZONE","YEARS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS","MICROSECONDS","NANOSECONDS","CALENDAR_ID","globalSlots","WeakMap","GetSlotsSymbol","for","_a","globalThis","_GetSlots","container","get","GetSlots","CreateSlotsSymbol","_b","_CreateSlots","set","create","CreateSlots","HasSlot","ids","myslots","every","id","GetSlot","TypeError","SetSlot","slots","tzComponent","timeZoneID","RegExp","source","join","yearpart","monthpart","daypart","datesplit","timesplit","offset","offsetpart","annotation","zoneddatetime","time","yearmonth","monthday","fraction","durationTime","duration","ArrayIncludes","Array","includes","ArrayPrototypePush","push","IntlDateTimeFormat","Intl","DateTimeFormat","MathMin","Math","min","MathMax","max","MathAbs","abs","MathFloor","floor","MathSign","sign","MathTrunc","trunc","NumberIsNaN","Number","isNaN","NumberIsFinite","isFinite","NumberCtor","StringCtor","String","NumberMaxSafeInteger","MAX_SAFE_INTEGER","ObjectCreate","ObjectGetOwnPropertyDescriptor","ReflectApply","Reflect","apply","ReflectOwnKeys","ownKeys","ZERO","JSBI","BigInt","ONE","SIXTY","TWENTY_FOUR","THOUSAND","MILLION","BILLION","NEGATIVE_ONE","HOUR_NANOS","multiply","MINUTE_NANOS","DAY_NANOS","NS_MIN","NS_MAX","YEAR_MIN","YEAR_MAX","BEFORE_FIRST_OFFSET_TRANSITION","ABOUT_TEN_YEARS_NANOS","ABOUT_ONE_YEAR_NANOS","TWO_WEEKS_NANOS","BUILTIN_CALENDAR_IDS","isZero","equal","GetMethod","obj","methodName","result","Call","target","thisArgument","argumentsList","args","arguments","length","IsObject","ToNumber","ToIntegerOrInfinity","number","integer","IsIntegralNumber","argument","absValue","ToString","ToIntegerWithTruncation","RangeError","ToPositiveIntegerWithTruncation","valueParam","property","ToIntegerIfIntegral","divmod","x","y","quotient","divide","remainder","isNegativeJSBI","lessThan","signJSBI","BUILTIN_CASTS","Map","BUILTIN_DEFAULTS","SINGULAR_PLURAL_UNITS","SINGULAR_FOR","map","e","PLURAL_FOR","p","s","UNITS_DESCENDING","DURATION_FIELDS","from","keys","sort","IntlDateTimeFormatEnUsCache","getIntlDateTimeFormatEnUsForTimeZone","timeZoneIdentifier","instance","timeZone","hour12","era","year","month","day","hour","minute","second","ToObject","CopyDataProperties","excludedKeys","excludedValues","nextKey","some","is","propertyIsEnumerable","call","propValue","IsTemporalInstant","item","IsTemporalTimeZone","IsTemporalCalendar","IsTemporalDuration","IsTemporalDate","IsTemporalTime","IsTemporalDateTime","IsTemporalYearMonth","IsTemporalMonthDay","IsTemporalZonedDateTime","RejectTemporalLikeObject","calendar","ParseTemporalTimeZone","stringIdent","ianaName","z","ParseTemporalTimeZoneString","PARSE.timeZoneID","test","ParseISODateTime","GetCanonicalTimeZoneIdentifier","FormatTimeZoneOffsetString","ParseTimeZoneOffsetString","MaybeFormatCalendarAnnotation","showCalendar","FormatCalendarAnnotation","ToTemporalCalendarIdentifier","isoString","match","PARSE.zoneddatetime","exec","yearString","slice","hasTime","millisecond","microsecond","nanosecond","offsetSign","offsetHours","offsetMinutes","offsetSeconds","offsetFraction","endsWith","annotations","critical","matchAll","PARSE.annotation","RejectDateTime","ParseTemporalYearMonthString","PARSE.yearmonth","referenceISODay","ParseTemporalMonthDayString","PARSE.monthday","referenceISOYear","ParseTemporalInstant","ParseTemporalInstantString","offsetNs","BalanceISODateTime","epochNs","GetUTCEpochNanoseconds","RegulateISODate","yearParam","monthParam","dayParam","overflow","RejectISODate","ConstrainISODate","RegulateTime","hourParam","minuteParam","secondParam","millisecondParam","microsecondParam","nanosecondParam","RejectTime","ConstrainTime","ConstrainToRange","ToTemporalDurationRecord","ParseTemporalDurationString","PARSE.duration","element","years","months","weeks","days","hours","fHours","minutesStr","fMinutes","secondsStr","fSeconds","minutes","seconds","excessNanoseconds","nanoseconds","microseconds","milliseconds","RejectDuration","partial","ToTemporalPartialDurationRecord","temporalDurationLike","any","ToTemporalOverflow","options","GetOption","ToTemporalDisambiguation","ToTemporalRoundingMode","fallback","ToTemporalOffset","ToCalendarNameOption","ToTemporalRoundingIncrement","increment","roundingIncrement","integerIncrement","ValidateTemporalRoundingIncrement","dividend","inclusive","maximum","ToFractionalSecondDigits","normalizedOptions","digitsValue","fractionalSecondDigits","digitCount","ToSecondsStringPrecisionRecord","smallestUnit","precision","unit","REQUIRED","GetTemporalUnit","unitGroup","requiredOrDefault","extraValues","allowedSingular","singular","category","defaultVal","allowedValues","plural","retval","has","ToRelativeTemporalObject","relativeTo","offsetBehaviour","matchMinutes","TemporalDateTimeToDate","GetTemporalCalendarSlotValueWithISODefault","fieldNames","CalendarFields","fields","PrepareTemporalFields","dateOptions","InterpretTemporalDateTimeFields","ToTemporalTimeZoneSlotValue","IsBuiltinCalendar","ASCIILowercase","CreateTemporalDate","CreateTemporalZonedDateTime","InterpretISODateTimeOffset","DefaultTemporalLargestUnit","v","LargerOfTwoTemporalUnits","unit1","unit2","indexOf","bag","requiredFields","emptySourceErrorMessage","ToTemporalTimeRecord","completeness","field","valueDesc","ToTemporalDate","itemParam","GetPlainDateTimeFor","CalendarDateFromFields","ParseTemporalDateString","date","ToTemporalDateTime","CreateTemporalDateTime","ParseTemporalDateTimeString","ToTemporalDuration","ToTemporalInstant","ns","ToTemporalMonthDay","calendarAbsent","calendarFromItem","ToTemporalCalendarSlotValue","monthCode","CalendarMonthDayFromFields","CreateTemporalMonthDay","ToTemporalTime","ParseTemporalTimeString","PARSE.time","ToTemporalYearMonth","CalendarYearMonthFromFields","CreateTemporalYearMonth","disambiguation","offsetOpt","matchMinute","dt","GetInstantFor","subtract","possibleInstants","GetPossibleInstantsFor","candidate","candidateOffset","GetOffsetNanosecondsFor","roundedCandidateOffset","toNumber","RoundNumberToIncrement","offsetStr","timeZoneString","toString","DisambiguatePossibleInstants","ToTemporalZonedDateTime","ParseTemporalZonedDateTimeString","CreateTemporalDateSlots","isoYear","isoMonth","isoDay","RejectDateRange","TemporalPlainDate","CreateTemporalDateTimeSlots","h","ms","RejectDateTimeRange","TemporalPlainDateTime","CreateTemporalMonthDaySlots","TemporalPlainMonthDay","CreateTemporalYearMonthSlots","RejectYearMonthRange","RejectToRange","TemporalPlainYearMonth","CreateTemporalZonedDateTimeSlots","epochNanoseconds","ValidateEpochNanoseconds","instant","TemporalZonedDateTime","fieldNamesParam","calendarObj","CalendarMergeFields","additionalFields","CalendarDateAdd","dateAddParam","dateAdd","CalendarDateUntil","otherDate","dateUntilParam","dateUntil","CalendarYear","dateLike","CalendarMonth","CalendarMonthCode","CalendarDay","CalendarEra","CalendarEraYear","CalendarDayOfWeek","CalendarDayOfYear","CalendarWeekOfYear","CalendarYearOfWeek","CalendarDaysInWeek","CalendarDaysInMonth","CalendarDaysInYear","CalendarMonthsInYear","CalendarInLeapYear","calendarLike","ObjectImplementsTemporalCalendarProtocol","object","identifier","slotValue","ToTemporalCalendarObject","CalendarEquals","one","two","ThrowIfCalendarsNotEqual","errorMessageAction","cal1","cal2","ConsolidateCalendars","sOne","sTwo","dateFromFieldsParam","temporalTimeZoneLike","ObjectImplementsTemporalTimeZoneProtocol","ToTemporalTimeZoneIdentifier","ToTemporalTimeZoneObject","TimeZoneEquals","dateTime","TemporalDateTimeToTime","getOffsetNanosecondsForParam","timeZoneObject","GetOffsetStringFor","GetISOPartsFromEpoch","Instant","numInstants","utcns","dayBefore","dayAfter","add","offsetBefore","PlainDateTime","earlier","AddDateTime","later","possible","getPossibleInstantsForParam","ISOYearString","ISODateTimePartString","part","FormatSecondsStringPart","secs","fractionNumber","padStart","TemporalInstantToString","outputTimeZone","FormatISOTimeZoneOffsetString","TemporalDurationToString","formatNumber","num","DurationSign","roundingMode","RoundDuration","dateParts","timeParts","secondParts","nsBigInt","msBigInt","secondsBigInt","total","TotalDurationNanoseconds","decimalPart","unshift","TemporalDateToString","TemporalDateTimeToString","RoundISODateTime","TemporalMonthDayToString","monthDay","resultString","calendarID","calendarString","TemporalYearMonthToString","yearMonth","TemporalZonedDateTimeToString","zdt","showTimeZone","showOffset","RoundInstant","tz","IsTimeZoneOffsetString","string","OFFSET","resolvedOptions","GetNamedTimeZoneOffsetNanoseconds","GetNamedTimeZoneDateTimeParts","reducedYear","yearCycles","nsIn400YearCycle","reducedUTC","utc","offsetNanosecondsParam","offsetNanoseconds","hourString","minuteString","secondString","post","legacyDate","Date","setUTCHours","setUTCFullYear","getTime","greaterThan","epochMilliseconds","nanos","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","GetFormatterParts","datetime","format","parseFromEnUsFormat","parts","split","toUpperCase","maxJSBI","afterLatestPossibleTzdbRuleChange","SystemUTCEpochNanoSeconds","GetNamedTimeZoneNextTransition","oneYearLater","uppercap","leftNanos","leftOffsetNs","rightNanos","rightOffsetNs","bisect","GetNamedTimeZonePreviousTransition","afterLatestRule","isFarFuture","lowercap","lastPrecomputed","newTimeToCheck","LeapYear","ISODaysInMonth","standard","leapyear","DayOfWeek","m","Y","c","dow","DayOfYear","WeekOfYear","doy","doj","week","mon","w","d","BalanceISOYearMonth","BalanceISODate","daysIn400YearCycle","nCycles","daysInYear","testYear","deltaDays","BalanceTime","NonNegativeBigIntDivmod","daysParam","hoursParam","minutesParam","secondsParam","millisecondsParam","microsecondsParam","nanosecondsParam","offsetShift","NanosecondsToDays","TemporalInstant","dayLengthNs","startNs","start","endNs","end","dtStart","dtEnd","daysNumber","DifferenceISODateTime","intermediateNs","AddZonedDateTime","daysBigInt","isOverflow","relativeInstant","oneDayFartherNs","relativeNs","greaterThanOrEqual","BalanceDuration","largestUnit","BalancePossiblyInfiniteDuration","nanosecondsBigInt","microsecondsBigInt","millisecondsBigInt","minutesBigInt","hoursBigInt","UnbalanceDurationRelative","yearsParam","monthsParam","weeksParam","relativeToParam","TemporalDuration","signBI","oneYear","oneMonth","oneWeek","newRelativeTo","untilOptions","untilResult","oneYearMonths","oneYearDays","MoveRelativeDate","oneMonthDays","oneWeekDays","CalculateOffsetShift","after","CreateNegatedTemporalDuration","propSign","DifferenceISODate","y1","m1","d1","y2","m2","d2","CompareISODate","mid","AddISODate","midSign","larger","smaller","DifferenceTime","h1","min1","s1","ms1","ns1","h2","min2","s2","ms2","ns2","DifferenceInstant","diff","y1Param","mon1Param","d1Param","mon2","mon1","timeSign","date1","date2","dateLargestUnit","CopyOptions","DifferenceZonedDateTime","nsDiff","timeRemainderNs","intermediate","GetDifferenceSettings","op","group","disallowed","fallbackSmallest","smallestLargestDefaultUnit","ALLOWED_UNITS","reduce","allowed","unitInfo","NegateTemporalRoundingMode","defaultLargestUnit","DifferenceTemporalInstant","operation","otherParam","other","settings","onens","twons","DifferenceTemporalPlainDate","plainDate","DifferenceTemporalPlainDateTime","plainDateTime","DifferenceTemporalPlainTime","plainTime","DifferenceTemporalPlainYearMonth","thisFields","thisDate","otherFields","DifferenceTemporalZonedDateTime","zonedDateTime","AdjustRoundedDurationDays","AddTime","AddDuration","w1","w2","dateDuration1","dateDuration2","differenceOptions","AddInstant","sum","addedDate","dtIntermediate","AddDurationToOrSubtractDurationFromDuration","optionsParam","GetOptionsObject","AddDurationToOrSubtractDurationFromInstant","durationLike","ToLimitedTemporalDuration","disallowedProperties","record","AddDurationToOrSubtractDurationFromPlainDateTime","AddDurationToOrSubtractDurationFromPlainTime","temporalTime","AddDurationToOrSubtractDurationFromPlainYearMonth","fieldsCopy","startDate","Duration","nextMonth","endOfMonth","durationToAdd","optionsCopy","AddDurationToOrSubtractDurationFromZonedDateTime","quantity","mode","tiebreaker","tie","expandIsNearer","wholeDays","roundedRemainder","nsPerTimeUnit","RoundTime","nsPerUnit","rounded","DaysUntil","MoveRelativeZonedDateTime","direction","dayStart","dayEnd","zdtRelative","dayLength","yearsDuration","yearsLater","yearsMonthsWeeksLater","wholeDaysLater","yearsPassed","oldRelativeTo","divisor","BigIntDivideToNumber","yearsMonths","yearsMonthsLater","allNanoseconds","ComparisonResult","BigIntFloorDiv","left","right","ToBigIntExternal","arg","jsbiBI","ToBigInt","prim","toPrimFn","toPrimitive","now","DefaultTimeZone","CreateOnePropObject","propName","o","str","replace","l","code","charCodeAt","fromCharCode","PARSE.offset","getState","leftParam","rightParam","lstateParam","rstateParam","lstate","rstate","middle","mstate","DATE","YM","MD","TIME","DATETIME","INST","ORIGINAL","TZ_RESOLVED","CAL_ID","LOCALE","OPTIONS","descriptor","ObjectAssign","assign","ObjectHasOwnProperty","hasOwnProperty","getPropLazy","val","DateTimeFormatImpl","locale","this","hasOptions","original","ro","clonedResolved","dateAmend","yearMonthAmend","monthDayAmend","timeAmend","datetimeAmend","instantAmend","supportedLocalesOf","locales","propertyDescriptors","rest","formatter","extractOverrides","formatRange","a","b","isTemporalObject","sameTemporalType","aa","aformatter","bb","bformatter","formatToParts","formatRangeToParts","amend","amended","opt","weekday","timeZoneName","dateStyle","hasTimeOptions","dayPeriod","timeStyle","hasDateOptions","ES.IsTemporalDate","ES.IsTemporalTime","ES.IsTemporalDateTime","ES.IsTemporalZonedDateTime","ES.IsTemporalYearMonth","ES.IsTemporalMonthDay","ES.IsTemporalInstant","temporalObj","main","DateTime","ES.GetInstantFor","ES.ToTemporalCalendarIdentifier","constructor","ES.ToBigInt","ES.ValidateEpochNanoseconds","epochSeconds","ES.BigIntFloorDiv","epochMicroseconds","ES.ToBigIntExternal","ES.AddDurationToOrSubtractDurationFromInstant","until","ES.DifferenceTemporalInstant","since","round","roundToParam","roundTo","ES.CreateOnePropObject","ES.GetOptionsObject","ES.ToTemporalRoundingIncrement","ES.ToTemporalRoundingMode","ES.GetTemporalUnit","ES.REQUIRED","ES.ValidateTemporalRoundingIncrement","roundedNs","ES.RoundInstant","equals","ES.ToTemporalInstant","digits","ES.ToFractionalSecondDigits","ES.ToTemporalTimeZoneSlotValue","ES.ToSecondsStringPrecisionRecord","ES.TemporalInstantToString","toJSON","toLocaleString","valueOf","toZonedDateTime","ES.IsObject","ES.ToTemporalCalendarSlotValue","ES.CreateTemporalZonedDateTime","toZonedDateTimeISO","timeZoneParam","static","epochSecondsParam","ES.ToNumber","epochMillisecondsParam","epochMicrosecondsParam","epochNanosecondsParam","oneParam","twoParam","oneNs","twoNs","ArraySort","ObjectEntries","entries","OriginalSet","Set","SetPrototypeAdd","SetPrototypeValues","values","impl","Calendar","idParam","ES.ToString","ES.IsBuiltinCalendar","ES.ASCIILowercase","ES.IsTemporalCalendar","dateFromFields","yearMonthFromFields","monthDayFromFields","fieldsArray","delete","mergeFields","fieldsParam","additionalFieldsParam","ES.ToObject","ES.CopyDataProperties","additionalFieldsCopy","additionalKeys","overriddenKeys","fieldKeysToIgnore","merged","fieldsKeys","ES.Call","dateParam","durationParam","ES.ToTemporalDate","ES.ToTemporalDuration","ES.ToTemporalOverflow","ES.BalanceDuration","eraYear","dayOfWeek","dayOfYear","weekOfYear","yearOfWeek","daysInWeek","daysInMonth","monthsInYear","inLeapYear","ES.ToTemporalCalendarObject","monthCodeNumberPart","startsWith","buildMonthCode","leap","resolveNonLunisolarMonth","calendarDate","monthsPerYear","ES.RejectToRange","ES.ConstrainToRange","numberPart","calendarSlotValue","ES.PrepareTemporalFields","ES.RegulateISODate","ES.CreateTemporalDate","RegulateISOYearMonth","ES.RegulateISOYearMonth","ES.CreateTemporalYearMonth","useYear","ES.CreateTemporalMonthDay","ix","ES.AddISODate","ES.DifferenceISODate","ES.DayOfWeek","ES.DayOfYear","ES.WeekOfYear","ES.ISODaysInMonth","ES.LeapYear","OneObjectCache","cacheToClone","calls","hits","misses","performance","i","entry","MAX_CACHE_ENTRIES","report","setObject","objectMap","cache","toUtcIsoDateString","ES.ISOYearString","ES.ISODateTimePartString","simpleDateDiff","HelperBase","eraLength","hasEra","erasBeginMidYear","getFormatter","isoToCalendarDate","isoDate","JSON","stringify","func","cached","dateTimeFormat","type","matches","monthExtra","normalize","toLowerCase","reviseIntlEra","checkIcuBugs","adjustCalendarDate","forEach","keyReverse","validateCalendarDate","constantEra","calendarDateParam","fromLegacyDate","calendarType","largestMonth","regulateMonthDayNaive","maximumMonthLength","calendarToIsoDate","originalDate","keyOriginal","isoEstimate","estimateIsoDate","calculateSameMonthResult","diffDays","testIsoEstimate","addDaysIso","minimumMonthLength","testCalendarDate","roundtripEstimate","diffTotalDaysEstimate","compareCalendarDates","oldRoundtripEstimate","oldSign","temporalToCalendarDate","date1Param","date2Param","ES.ComparisonResult","regulateDate","addDaysCalendar","addedIso","addMonthsCalendar","absMonths","oldCalendarDate","daysInPreviousMonth","monthsInOldYear","addCalendar","addedYears","addedMonths","initialDays","untilCalendar","calendarOne","calendarTwo","calendarDaysUntil","totalDays","diffYears","diffInYearSign","current","next","addedIsoDate","addedCalendarDate","endOfMonthIso","previousMonthDate","previousMonth","lastDayOfPreviousMonthIso","startOfCalendarYear","startOfCalendarMonth","oneIso","twoIso","isoDaysUntil","closestCalendar","closestIso","calendarOfStartDateIso","calendarYear","roundTripCalendarDate","HebrewHelper","Tishri","regular","Heshvan","Kislev","Tevet","Shevat","Adar","Nisan","Iyar","Sivan","Tamuz","Av","Elul","minMaxMonthLength","minOrMax","getMonthCode","monthInfo","find","IslamicBaseHelper","DAYS_PER_ISLAMIC_YEAR","DAYS_PER_ISO_YEAR","IslamicHelper","IslamicUmalquraHelper","IslamicTblaHelper","IslamicCivilHelper","IslamicRgsaHelper","IslamicCcHelper","PersianHelper","IndianHelper","nextYear","vulnerableToBceBug","toLocaleDateString","isGregorianLeapYear","getMonthInfo","GregorianBaseHelper","originalEras","super","v8IsVulnerableToJulianBug","calendarIsVulnerableToJulianBug","eras","anchorEra","adjustEras","erasParam","reverseOf","filter","isAnchor","anchorEpoch","hasYearZero","reversedEra","isoEpoch","e1","e2","lastEraReversed","genericName","completeEraYear","checkField","currentValue","eraFromYear","adjustedCalendarDate","matchingEra","ES.CompareISODate","OrthodoxBaseHelper","EthioaaHelper","CopticHelper","EthiopicHelper","RocHelper","BuddhistHelper","GregoryHelper","JapaneseHelper","ChineseBaseHelper","getMonthList","getCalendarDate","daysPastFeb1","isoStringFeb1","setUTCDate","newYearGuess","calendarMonthString","tv","calendarDay","calendarYearToVerify","isoDaysDelta","oldCalendarDay","oldMonthString","monthIndex","done","monthString","withoutML","monthEntries","matchingMonthEntry","ChineseHelper","DangiHelper","NonIsoCalendar","helper","getCacheForObject","added","isoAdded","newTemporalObject","cacheOne","cacheTwo","startOfYear","startOfMonthCalendar","startOfNextMonthCalendar","startOfYearCalendar","startOfNextYearCalendar","Helper","PlainDate","isoYearParam","isoMonthParam","isoDayParam","calendarParam","ES.CreateTemporalDateSlots","ES.ToIntegerWithTruncation","calendarId","ES.CalendarEra","ES.CalendarEraYear","ES.CalendarYear","ES.CalendarMonth","ES.CalendarMonthCode","ES.CalendarDay","ES.CalendarDayOfWeek","ES.CalendarDayOfYear","ES.CalendarWeekOfYear","ES.CalendarYearOfWeek","ES.CalendarDaysInWeek","ES.CalendarDaysInMonth","ES.CalendarDaysInYear","ES.CalendarMonthsInYear","ES.CalendarInLeapYear","with","temporalDateLike","ES.RejectTemporalLikeObject","ES.CalendarFields","ES.CalendarMergeFields","ES.CalendarDateFromFields","withCalendar","ES.CalendarDateAdd","ES.CreateNegatedTemporalDuration","ES.DifferenceTemporalPlainDate","slot","ES.CalendarEquals","ES.TemporalDateToString","ES.ToCalendarNameOption","toPlainDateTime","temporalTimeParam","ES.CreateTemporalDateTime","ES.ToTemporalTime","ES.IsTemporalTimeZone","timeZoneLike","toPlainYearMonth","ES.CalendarYearMonthFromFields","toPlainMonthDay","ES.CalendarMonthDayFromFields","getISOFields","getCalendar","ES.CreateTemporalDateTimeSlots","temporalDateTimeLike","ES.InterpretTemporalDateTimeFields","withPlainTime","withPlainDate","temporalDateParam","temporalDate","ES.ConsolidateCalendars","ES.AddDurationToOrSubtractDurationFromPlainDateTime","ES.DifferenceTemporalPlainDateTime","ES.RoundISODateTime","ES.ToTemporalDateTime","ES.TemporalDateTimeToString","ES.ToTemporalDisambiguation","toPlainDate","ES.TemporalDateTimeToDate","toPlainTime","ES.TemporalDateTimeToTime","isoHour","isoMicrosecond","isoMillisecond","isoMinute","isoNanosecond","isoSecond","val1","val2","ES.ToIntegerIfIntegral","ES.RejectDuration","ES.IsTemporalDuration","ES.DurationSign","blank","partialDuration","negated","ES.AddDurationToOrSubtractDurationFromDuration","ES.DefaultTemporalLargestUnit","ES.ToRelativeTemporalObject","smallestUnitPresent","ES.LargerOfTwoTemporalUnits","largestUnitPresent","ES.UnbalanceDurationRelative","ES.RoundDuration","ES.AdjustRoundedDurationDays","BalanceDurationRelative","ES.BalanceDurationRelative","ES.MoveRelativeZonedDateTime","balanceResult","ES.BalancePossiblyInfiniteDuration","Infinity","ES.TemporalDurationToString","DurationFormat","console","warn","shift1","ES.CalculateOffsetShift","shift2","totalNs1","ES.TotalDurationNanoseconds","totalNs2","PlainMonthDay","referenceISOYearParam","ES.CreateTemporalMonthDaySlots","temporalMonthDayLike","ES.ToTemporalMonthDay","ES.TemporalMonthDayToString","receiverFieldNames","inputFieldNames","mergedFields","ES.SystemUTCEpochNanoSeconds","ES.DefaultTimeZone","tZ","ES.GetPlainDateTimeFor","plainDateTimeISO","Now","plainDateISO","plainTimeISO","timeZoneId","zonedDateTimeISO","TemporalTimeToString","ES.RoundTime","ES.FormatSecondsStringPart","PlainTime","isoHourParam","isoMinuteParam","isoSecondParam","isoMillisecondParam","isoMicrosecondParam","isoNanosecondParam","ES.RejectTime","temporalTimeLike","partialTime","ES.ToTemporalTimeRecord","ES.RegulateTime","ES.AddDurationToOrSubtractDurationFromPlainTime","ES.DifferenceTemporalPlainTime","TimeZone","timeZoneIdentifierParam","ES.GetCanonicalTimeZoneIdentifier","getOffsetNanosecondsFor","instantParam","ES.IsTimeZoneOffsetString","ES.ParseTimeZoneOffsetString","ES.GetNamedTimeZoneOffsetNanoseconds","getOffsetStringFor","ES.GetOffsetStringFor","getPlainDateTimeFor","getInstantFor","dateTimeParam","getPossibleInstantsFor","ES.GetUTCEpochNanoseconds","possibleEpochNs","GetNamedTimeZoneEpochNanoseconds","nsEarlier","nsLater","earliest","latest","ES.GetNamedTimeZoneEpochNanoseconds","getNextTransition","startingPointParam","startingPoint","ES.GetNamedTimeZoneNextTransition","getPreviousTransition","ES.GetNamedTimeZonePreviousTransition","ES.ToTemporalTimeZoneObject","PlainYearMonth","referenceISODayParam","ES.CreateTemporalYearMonthSlots","temporalYearMonthLike","ES.AddDurationToOrSubtractDurationFromPlainYearMonth","ES.DifferenceTemporalPlainYearMonth","ES.ToTemporalYearMonth","ES.TemporalYearMonthToString","customResolvedOptions","ZonedDateTime","ES.CreateTemporalZonedDateTimeSlots","ES.ToTemporalTimeZoneIdentifier","hoursInDay","today","tomorrowFields","tomorrow","todayNs","tomorrowNs","ES.BigIntDivideToNumber","ES.GetOffsetNanosecondsFor","temporalZonedDateTimeLike","ES.ToTemporalOffset","ES.InterpretISODateTimeOffset","thisDt","withTimeZone","ES.AddDurationToOrSubtractDurationFromZonedDateTime","ES.DifferenceTemporalZonedDateTime","instantStart","ES.AddZonedDateTime","lessThanOrEqual","ES.ToTemporalZonedDateTime","ES.TimeZoneEquals","ToShowOffsetOption","ES.ToShowOffsetOption","ToTimeZoneNameOption","ES.ToTimeZoneNameOption","ES.TemporalZonedDateTimeToString","localeCalendarIdentifier","calendarIdentifier","startOfDay","toInstant","getTimeZone","types","Temporal.Instant","Temporal.Calendar","Temporal.PlainDate","Temporal.PlainDateTime","Temporal.Duration","Temporal.PlainMonthDay","Temporal.PlainTime","Temporal.TimeZone","Temporal.PlainYearMonth","Temporal.ZonedDateTime","toTemporalInstant"],"mappings":"mCAsDA,MAAMA,EAAa,CAAA,EA0CH,SAAAC,mBACdC,EACAC,GAEAC,OAAOC,eAAeH,EAAMI,UAAWC,OAAOC,YAAa,CACzDC,MAAON,EACPO,UAAU,EACVC,YAAY,EACZC,cAAc,IAUhB,IAAK,MAAMC,KAAQT,OAAOU,oBAAoBZ,GAAQ,CAGpD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