@formatjs/intl-datetimeformat-calendar-persian 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,517 +1,3 @@
1
- // node_modules/.aspect_rules_js/temporal-utils@1.0.3/node_modules/temporal-utils/dist/errorMessages.js
2
- const expectedPositive = (entityName, num) => `Non-positive ${entityName}: ${num}`;
3
- const expectedFinite = (entityName, num) => `Non-finite ${entityName}: ${num}`;
4
- const forbiddenBigIntToNumber = (entityName) => `Cannot convert bigint to ${entityName}`;
5
- const numberOutOfRange = (entityName, val, min, max) => invalidEntity$1(entityName, val) + `; must be between ${min}-${max}`;
6
- const invalidEntity$1 = (fieldName, val) => `Invalid ${fieldName}: ${val}`;
7
- function toFiniteNumber(arg, entityName = "number") {
8
- if (typeof arg === "bigint") throw new TypeError(forbiddenBigIntToNumber(entityName));
9
- arg = Number(arg);
10
- if (!Number.isFinite(arg)) throw new RangeError(expectedFinite(entityName, arg));
11
- return arg;
12
- }
13
- function toIntegerWithTrunc(arg, entityName) {
14
- return Math.trunc(toFiniteNumber(arg, entityName)) || 0;
15
- }
16
- function toPositiveIntegerWithTruncation(arg, entityName) {
17
- return requireNumberIsPositive(toIntegerWithTrunc(arg, entityName), entityName);
18
- }
19
- function requireNumberIsPositive(num, entityName = "number") {
20
- if (num <= 0) throw new RangeError(expectedPositive(entityName, num));
21
- return num;
22
- }
23
- function constrainToRange$1(num, min, max) {
24
- return Math.min(Math.max(num, min), max);
25
- }
26
- function isObjectLike(arg) {
27
- return arg !== null && (typeof arg === "object" || typeof arg === "function");
28
- }
29
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/internal.js
30
- const invalidEntity = invalidEntity$1;
31
- const missingField = (fieldName) => `Missing ${fieldName}`;
32
- const forbiddenValueOf$1 = "Cannot use valueOf";
33
- const invalidCallingContext = "Invalid calling context";
34
- const exoticCalendarRequired = (calendarId, remedy) => `Unknown calendar ${calendarId}; might need ${remedy}`;
35
- const constrainToRange = constrainToRange$1;
36
- function throwRangeError(message) {
37
- throw new RangeError(message);
38
- }
39
- function throwTypeError(message) {
40
- throw new TypeError(message);
41
- }
42
- function clampProp(props, propName, min, max, overflow) {
43
- return clampEntity(propName, ((props, propName) => {
44
- const propVal = props[propName];
45
- return void 0 === propVal && throwTypeError(missingField(propName)), propVal;
46
- })(props, propName), min, max, overflow);
47
- }
48
- function clampEntity(entityName, num, min, max, overflow, choices) {
49
- const clamped = constrainToRange(num, min, max);
50
- return overflow && num !== clamped && throwRangeError(((entityName, val, min, max, choices) => choices ? numberOutOfRange(entityName, choices[val], choices[min], choices[max]) : numberOutOfRange(entityName, val, min, max))(entityName, num, min, max, choices)), clamped;
51
- }
52
- function memoize(generator, MapClass = Map) {
53
- const map = new MapClass();
54
- return (key, ...otherArgs) => {
55
- if (map.has(key)) return map.get(key);
56
- const val = generator(key, ...otherArgs);
57
- return map.set(key, val), val;
58
- };
59
- }
60
- const createNameDescriptors = (name) => createPropDescriptors({ name }, 1);
61
- const createPropDescriptors = (propVals, readonly) => mapProps((value) => ({
62
- value,
63
- configurable: 1,
64
- writable: !readonly
65
- }), propVals);
66
- const createStringTagDescriptors = (value) => ({ [Symbol.toStringTag]: {
67
- value,
68
- configurable: 1
69
- } });
70
- function mapProps(transformer, props) {
71
- const res = {};
72
- for (const propName in props) res[propName] = transformer(props[propName], propName);
73
- return res;
74
- }
75
- function zipPropsConst(propNames, propVal) {
76
- const res = {};
77
- for (const propName of propNames) res[propName] = propVal;
78
- return res;
79
- }
80
- function createPropGetters(propNames) {
81
- const getters = {};
82
- for (const propName of propNames) getters[propName] = (slots) => slots[propName];
83
- return getters;
84
- }
85
- function pluckProps(propNames, props, dest = Object.create(null)) {
86
- for (const propName of propNames) dest[propName] = props[propName];
87
- return dest;
88
- }
89
- function bindArgs(f, ...boundArgs) {
90
- return (...dynamicArgs) => f(...boundArgs, ...dynamicArgs);
91
- }
92
- function noop() {}
93
- function padNumber(digits, num) {
94
- return String(num).padStart(digits, "0");
95
- }
96
- const padNumber2 = /*@__PURE__*/ bindArgs(padNumber, 2);
97
- function compareNumbers(a, b) {
98
- return Math.sign(a - b);
99
- }
100
- function modFloor(num, divisor) {
101
- return (num % divisor + divisor) % divisor;
102
- }
103
- function divTrunc(num, divisor) {
104
- return Math.trunc(num / divisor) || 0;
105
- }
106
- function getCalendarSlotId(calendar) {
107
- return calendar === void 0 ? "iso8601" : 0 === calendar ? "gregory" : calendar.id;
108
- }
109
- function formatMonthCode(monthCodeNumber, isLeapMonth) {
110
- return "M" + padNumber2(monthCodeNumber) + (isLeapMonth ? "L" : "");
111
- }
112
- function monthCodeNumberToMonth(monthCodeNumber, isLeapMonth, leapMonth) {
113
- return monthCodeNumber + (isLeapMonth || leapMonth && monthCodeNumber >= leapMonth ? 1 : 0);
114
- }
115
- function monthToMonthCodeNumber(month, leapMonth) {
116
- return month - (leapMonth && month >= leapMonth ? 1 : 0);
117
- }
118
- const unitNamesAsc = /*@__PURE__*/ Object.keys({
119
- nanosecond: 0,
120
- microsecond: 1,
121
- millisecond: 2,
122
- second: 3,
123
- minute: 4,
124
- hour: 5,
125
- day: 6,
126
- week: 7,
127
- month: 8,
128
- year: 9
129
- });
130
- const milliInUtcDay = 864e5;
131
- const bigNanoInUtcDay = /*@__PURE__*/ BigInt(864e11);
132
- const timeFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.slice(0, 6);
133
- const calendarDateFieldNamesAsc = [
134
- "day",
135
- "month",
136
- "year"
137
- ];
138
- function isoDateToEpochNano(isoDate) {
139
- return BigInt(isoDateToEpochDays(isoDate)) * bigNanoInUtcDay;
140
- }
141
- function isoDateToEpochDays(isoDate) {
142
- return isoPartsToEpochDays(isoDate.year, isoDate.month, isoDate.day);
143
- }
144
- function isoPartsToEpochDays(isoYear, isoMonth = 1, isoDay = 1) {
145
- const monthIndex = isoMonth - 1;
146
- return isoYear += Math.floor(monthIndex / 12), isoMonth = modFloor(monthIndex, 12), Date.UTC(isoYear % 400 - 400, isoMonth, 0) / 864e5 + 146097 * (divTrunc(isoYear, 400) + 1) + isoDay;
147
- }
148
- function epochDaysToIsoDate(epochDays) {
149
- const legacyDate = /* @__PURE__ */ new Date(864e5 * modFloor(epochDays, 146097));
150
- return {
151
- year: legacyDate.getUTCFullYear() + 400 * Math.floor(epochDays / 146097),
152
- month: legacyDate.getUTCMonth() + 1,
153
- day: legacyDate.getUTCDate()
154
- };
155
- }
156
- function computeIsoMonthCodeParts(month) {
157
- return [month, 0];
158
- }
159
- function computeIsoDaysInMonth(year, month) {
160
- switch (month) {
161
- case 2: return computeIsoInLeapYear(year) ? 29 : 28;
162
- case 4:
163
- case 6:
164
- case 9:
165
- case 11: return 30;
166
- }
167
- return 31;
168
- }
169
- function computeIsoInLeapYear(year) {
170
- return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
171
- }
172
- function computeGregoryEraFields({ year }) {
173
- return year < 1 ? {
174
- era: "bce",
175
- eraYear: 1 - year
176
- } : {
177
- era: "ce",
178
- eraYear: year
179
- };
180
- }
181
- function validateIsoDateFields(isoInternals) {
182
- return constrainIsoDateFields(isoInternals, 1), isoInternals;
183
- }
184
- function constrainIsoDateFields(isoDate, overflow) {
185
- const { year } = isoDate;
186
- const month = clampProp(isoDate, "month", 1, 12, overflow);
187
- return {
188
- year,
189
- month,
190
- day: clampProp(isoDate, "day", 1, computeIsoDaysInMonth(year, month), overflow)
191
- };
192
- }
193
- function computeCalendarDateFields(calendar, isoDate) {
194
- return calendar ? calendar.de(isoDate) : isoDate;
195
- }
196
- function computeCalendarMonthCodeParts(calendar, year, month) {
197
- return calendar ? calendar.N(year, month) : computeIsoMonthCodeParts(month);
198
- }
199
- function computeCalendarEraFields(calendar, isoDate) {
200
- return 0 === calendar ? computeGregoryEraFields(isoDate) : calendar && calendar.h?.(isoDate) || {};
201
- }
202
- function computeCalendarMonthCode(calendar, isoDate) {
203
- const { year, month } = computeCalendarDateFields(calendar, isoDate);
204
- const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
205
- return formatMonthCode(monthCodeNumber, isLeapMonth);
206
- }
207
- function computeCalendarInLeapYear(calendar, isoDate) {
208
- const { year } = computeCalendarDateFields(calendar, isoDate);
209
- return calendar ? calendar.q(year) : computeIsoInLeapYear(year);
210
- }
211
- const requireString = /*@__PURE__*/ bindArgs(requireType, "string");
212
- function requireType(typeName, arg, entityName = typeName) {
213
- return typeof arg !== typeName && throwTypeError(invalidEntity(entityName, arg)), arg;
214
- }
215
- function toString(arg) {
216
- return "symbol" == typeof arg && throwTypeError("Cannot convert Symbol to string"), String(arg);
217
- }
218
- function toPrimitiveWithStringHint(arg) {
219
- if (!isObjectLike(arg)) return arg;
220
- const exoticToPrimitive = arg[Symbol.toPrimitive];
221
- if (null != exoticToPrimitive) {
222
- "function" != typeof exoticToPrimitive && throwTypeError();
223
- const primitive = Reflect.apply(exoticToPrimitive, arg, ["string"]);
224
- return isObjectLike(primitive) && throwTypeError(), primitive;
225
- }
226
- return Date.prototype[Symbol.toPrimitive].call(arg, "string");
227
- }
228
- const epochNanoMax = /*@__PURE__*/ BigInt(1e8) * bigNanoInUtcDay;
229
- const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay;
230
- const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay;
231
- function checkIsoDateInBounds(isoDate, allowPlainDateLowerEdge = 1) {
232
- const epochNano = isoDateToEpochNano(isoDate);
233
- return (epochNano < (allowPlainDateLowerEdge ? plainDateEpochNanoMin : epochNanoMin) || epochNano > epochNanoMax) && throwRangeError("Out-of-bounds date"), isoDate;
234
- }
235
- function createDateSlots(isoDate, calendar) {
236
- return pluckProps(calendarDateFieldNamesAsc, isoDate, { calendar });
237
- }
238
- ({ .../* @__PURE__ */ Object.assign({}, {
239
- era: toString,
240
- month: toPositiveIntegerWithTruncation,
241
- monthCode(monthCode, fieldName) {
242
- return requireString(toPrimitiveWithStringHint(monthCode), fieldName);
243
- },
244
- day: toPositiveIntegerWithTruncation
245
- }, /* @__PURE__ */ zipPropsConst(timeFieldNamesAsc, toIntegerWithTrunc)) });
246
- Intl.DateTimeFormat;
247
- function formatDateIsoAuto(plainDateSlots) {
248
- return formatIsoDateFields(plainDateSlots) + (plainDateSlots.calendar === void 0 ? "" : formatCalendarId(getCalendarSlotId(plainDateSlots.calendar), 0));
249
- }
250
- function formatIsoDateFields(isoDate) {
251
- return formatIsoYearMonthFields(isoDate) + "-" + padNumber2(isoDate.day);
252
- }
253
- function formatIsoYearMonthFields(isoDate) {
254
- const { year } = isoDate;
255
- return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(isoDate.month);
256
- }
257
- function formatCalendarId(calendarId, isCritical) {
258
- return "[" + (isCritical ? "!" : "") + "u-ca=" + calendarId + "]";
259
- }
260
- function getSignStr(num) {
261
- return num < 0 ? "-" : "+";
262
- }
263
- function timeRegExpStr(separatorIndex) {
264
- return `(\\d{2})(?:(:?)(\\d{2})(?:\\${separatorIndex}(\\d{2})(?:[.,](\\d{1,9}))?)?)?`;
265
- }
266
- "" + timeRegExpStr(8) + timeRegExpStr(15);
267
- "" + timeRegExpStr(2) + `(([+-])${timeRegExpStr(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`;
268
- ({ .../* @__PURE__ */ Object.assign({}, {
269
- year: "numeric",
270
- month: "numeric",
271
- day: "numeric"
272
- }, {
273
- hour: "numeric",
274
- minute: "numeric",
275
- second: "numeric"
276
- }) });
277
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/exoticCalendars-utils.js
278
- function createArithmeticCalendar(ops) {
279
- const monthDayReferenceDate = ops.J(2441683);
280
- const fromIsoDate = memoize((isoDate) => ops.J(isoDateToEpochDays(isoDate) + 2440588), WeakMap);
281
- function computeDefaultMonthCodeParts(year, month) {
282
- const leapMonth = ops.p?.(year);
283
- return [monthToMonthCodeNumber(month, leapMonth), month === leapMonth];
284
- }
285
- return {
286
- k: ops.k,
287
- l: ops.l,
288
- V: ops.V,
289
- U: ops.U,
290
- re: ops.re,
291
- _: ops._,
292
- ge: ops.ge,
293
- de: fromIsoDate,
294
- fe(year, month, day) {
295
- return epochDaysToIsoDate(ops.L(year, month, day) - 2440588);
296
- },
297
- pe(year, month = 1, day = 1) {
298
- return (ops.L(year, month, day) - 2440588) * milliInUtcDay;
299
- },
300
- N(year, month) {
301
- return (ops.N || computeDefaultMonthCodeParts)(year, month);
302
- },
303
- u(monthCodeNumber, isLeapMonth, day) {
304
- return ops.u?.(monthCodeNumber, isLeapMonth, day) || ((monthCodeNumber, isLeapMonth, day) => {
305
- isLeapMonth = Boolean(isLeapMonth);
306
- let referenceYear = ops.re || monthDayReferenceDate.year;
307
- const [referenceMonthCodeNumber, referenceIsLeapMonth] = computeDefaultMonthCodeParts(monthDayReferenceDate.year, monthDayReferenceDate.month);
308
- 1 === (compareNumbers(monthCodeNumber, referenceMonthCodeNumber) || compareNumbers(Number(isLeapMonth), Number(referenceIsLeapMonth)) || compareNumbers(day, monthDayReferenceDate.day)) && referenceYear--;
309
- for (let yearDelta = 0; yearDelta < 100; yearDelta++) for (const year of [referenceYear - yearDelta, referenceYear + yearDelta]) {
310
- const leapMonth = ops.p?.(year);
311
- const month = monthCodeNumberToMonth(monthCodeNumber, isLeapMonth, leapMonth);
312
- if (month <= ops.j(year) && isLeapMonth === (month === leapMonth) && day <= ops.o(year, month)) return {
313
- year,
314
- month
315
- };
316
- }
317
- })(monthCodeNumber, isLeapMonth, day);
318
- },
319
- q: ops.q,
320
- j: ops.j,
321
- o: ops.o,
322
- i: ops.i,
323
- p: ops.p || noop,
324
- h(isoDate) {
325
- const parts = fromIsoDate(isoDate);
326
- return ops.h ? ops.h(parts) : {
327
- era: parts.era,
328
- eraYear: parts.eraYear
329
- };
330
- },
331
- ae(year, month, monthDelta) {
332
- return ((computeMonthsInYear, year, month, monthDelta) => {
333
- if (monthDelta) {
334
- if (Number.isSafeInteger(month += monthDelta) || throwRangeError("Out-of-bounds date"), monthDelta < 0) for (; month < 1;) month += computeMonthsInYear(--year);
335
- else {
336
- let monthsInYear;
337
- for (; month > (monthsInYear = computeMonthsInYear(year));) month -= monthsInYear, year++;
338
- }
339
- }
340
- return {
341
- year,
342
- month
343
- };
344
- })(ops.j, year, month, monthDelta);
345
- },
346
- ee(year0, month0, year1, month1) {
347
- return diffArithmeticMonthSlots(ops.j, year0, month0, year1, month1);
348
- }
349
- };
350
- }
351
- function diffArithmeticMonthSlots(computeMonthsInYear, year0, month0, year1, month1) {
352
- const cmp = compareNumbers(year0, year1) || compareNumbers(month0, month1);
353
- if (!cmp) return 0;
354
- if (year0 === year1) return month1 - month0;
355
- if (cmp < 0) {
356
- let months = computeMonthsInYear(year0) - month0 + month1;
357
- for (let year = year0 + 1; year < year1; year++) months += computeMonthsInYear(year);
358
- return months;
359
- }
360
- return -diffArithmeticMonthSlots(computeMonthsInYear, year1, month1, year0, month0);
361
- }
362
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/exoticCalendars.js
363
- const persianEraOrigins = { "ap": 0 };
364
- const persianMonthStarts = [
365
- 0,
366
- 31,
367
- 62,
368
- 93,
369
- 124,
370
- 155,
371
- 186,
372
- 216,
373
- 246,
374
- 276,
375
- 306,
376
- 336
377
- ];
378
- function persianIsLeapYear(year) {
379
- return modFloor(25 * year + 11, 33) < 8;
380
- }
381
- const persianMeta = ["persian", () => createArithmeticCalendar({
382
- k: persianEraOrigins,
383
- J(julianDay) {
384
- const daysSinceEpoch = julianDay - 1948320;
385
- const year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
386
- const dayOfYear = daysSinceEpoch - (365 * (year - 1) + Math.floor((8 * year + 21) / 33));
387
- const month = Math.floor(dayOfYear < 216 ? dayOfYear / 31 : (dayOfYear - 6) / 30);
388
- return {
389
- year,
390
- month: month + 1,
391
- day: dayOfYear - persianMonthStarts[month] + 1
392
- };
393
- },
394
- L(year, month, day) {
395
- return 1948319 + 365 * (year - 1) + Math.floor((8 * year + 21) / 33) + persianMonthStarts[month - 1] + day;
396
- },
397
- o(year, month) {
398
- return month <= 6 ? 31 : month <= 11 || persianIsLeapYear(year) ? 30 : 29;
399
- },
400
- i(year) {
401
- return persianIsLeapYear(year) ? 366 : 365;
402
- },
403
- j() {
404
- return 12;
405
- },
406
- q: persianIsLeapYear,
407
- h({ year }) {
408
- return {
409
- era: "ap",
410
- eraYear: year
411
- };
412
- }
413
- })];
414
- const getOrCreateExoticCalendar = /*@__PURE__*/ memoize((canonicalId, createExoticCalendar) => {
415
- const calendar = createExoticCalendar(canonicalId);
416
- return calendar.id = canonicalId, calendar;
417
- });
418
- function createExoticCalendarGetter(meta) {
419
- return () => getOrCreateExoticCalendar(...meta);
420
- }
421
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/apiHelpers.js
422
- const PlainDateBranding = "PlainDate";
423
- const CalendarBranding = "Calendar";
424
- function defineTemporalClass(branding, cls, getSlots, ...getterMaps) {
425
- return Object.defineProperties(cls, createNameDescriptors(branding)), Object.defineProperties(cls.prototype, createStringTagDescriptors("Temporal." + branding)), Object.defineProperties(cls.prototype, mapProps((getter) => ({
426
- get() {
427
- return getter(getSlots(this));
428
- },
429
- configurable: 1
430
- }), Object.assign({}, ...getterMaps))), cls;
431
- }
432
- const attachDebugString = "noop" === noop.name ? (instance) => {
433
- Object.defineProperty(instance, "_str_", { value: instance.toJSON() });
434
- } : noop;
435
- function invalidRecordType() {
436
- throwTypeError(invalidCallingContext);
437
- }
438
- function forbiddenValueOf() {
439
- throwTypeError(forbiddenValueOf$1);
440
- }
441
- const dateFieldGetters$1 = {
442
- era(slots) {
443
- return computeCalendarEraFields(slots.calendar, slots).era;
444
- },
445
- eraYear(slots) {
446
- return computeCalendarEraFields(slots.calendar, slots).eraYear;
447
- },
448
- year(slots) {
449
- return computeCalendarDateFields(slots.calendar, slots).year;
450
- },
451
- month(slots) {
452
- return computeCalendarDateFields(slots.calendar, slots).month;
453
- },
454
- monthCode(slots) {
455
- return computeCalendarMonthCode(slots.calendar, slots);
456
- },
457
- day(slots) {
458
- return computeCalendarDateFields(slots.calendar, slots).day;
459
- }
460
- };
461
- function createNativeGetters(shimGetters) {
462
- return createPropGetters(Object.keys(shimGetters));
463
- }
464
- const dateFieldGetters = /*@__PURE__*/ createNativeGetters(dateFieldGetters$1);
465
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/funcApi.js
466
- const PlainDateRecordBranding = `${PlainDateBranding}Record`;
467
- const CalendarRecordBranding = `${CalendarBranding}Record`;
468
- const calendarMap = /*@__PURE__*/ new WeakMap();
469
- const plainDateMap = /*@__PURE__*/ new WeakMap();
470
- function getCalendarSlots(record) {
471
- return getCalendarSlotsIfPresent(record) || invalidRecordType();
472
- }
473
- function getCalendarSlotsIfPresent(record) {
474
- return calendarMap.get(record);
475
- }
476
- function getPlainDateSlots(record) {
477
- return getPlainDateSlotsIfPresent(record) || invalidRecordType();
478
- }
479
- function getPlainDateSlotsIfPresent(record) {
480
- return plainDateMap.get(record);
481
- }
482
- function setPlainDateSlots(instance, slots) {
483
- plainDateMap.set(instance, slots);
484
- }
485
- const CalendarRecord = /*@__PURE__*/ defineTemporalClass(CalendarRecordBranding, class {
486
- toJSON() {
487
- return getCalendarRecordId(this);
488
- }
489
- valueOf() {
490
- return getCalendarRecordId(this);
491
- }
492
- });
493
- function createCalendarRecord(id, getImpl) {
494
- const instance = Object.create(CalendarRecord.prototype);
495
- return ((instance, slots) => {
496
- calendarMap.set(instance, slots);
497
- })(instance, {
498
- id,
499
- xe: getImpl
500
- }), attachDebugString(instance), instance;
501
- }
502
- function getCalendarRecordId(record) {
503
- return getCalendarSlots(record).id;
504
- }
505
- function getCalendarRecordImplCreator(record) {
506
- const getImpl = getCalendarSlots(record).xe;
507
- return getImpl || throwRangeError(exoticCalendarRequired(getCalendarRecordId(record), "getExotic or getAny")), getImpl;
508
- }
509
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/fns/Calendar.js
510
- const getPersian = /*@__PURE__*/ createCanonicalGetter(persianMeta);
511
- const getOrCreateFoundRecord = /*@__PURE__*/ memoize((rawCalendarId, meta) => createCalendarRecord(rawCalendarId, createExoticCalendarGetter(meta)));
512
- function createCanonicalGetter(meta) {
513
- return () => getOrCreateFoundRecord(meta[0], meta);
514
- }
515
1
  // packages/ecma262-abstract/DateOperations.js
516
2
  const MS_PER_DAY = 864e5;
517
3
  function Day(t) {
@@ -575,75 +61,223 @@ function DateFromTime(t) {
575
61
  if (mft === 11) return dwy - 333 - leap;
576
62
  throw new Error("Invalid time");
577
63
  }
578
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/root.js
579
- const NativeTemporal = globalThis.Temporal;
580
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/funcApi-native.js
581
- function refineNativeCalendarArgMaybe(calendarRecord) {
582
- if (void 0 !== calendarRecord) return getValidatedCalendarId(calendarRecord);
583
- }
584
- function getValidatedCalendarId(record) {
585
- return getCalendarRecordImplCreator(record), getCalendarRecordId(record);
586
- }
587
- const getNativePlainDate = getPlainDateSlots;
588
- const NativePlainDateRecord = /*@__PURE__*/ defineTemporalClass(PlainDateRecordBranding, class {
589
- get calendarId() {
590
- return getNativePlainDate(this).calendarId;
64
+ // packages/ecma402-abstract/Calendar/Arithmetic.js
65
+ const monthStarts = [
66
+ 0,
67
+ 31,
68
+ 59,
69
+ 90,
70
+ 120,
71
+ 151,
72
+ 181,
73
+ 212,
74
+ 243,
75
+ 273,
76
+ 304,
77
+ 334
78
+ ];
79
+ const mod = (value, divisor) => value - Math.floor(value / divisor) * divisor;
80
+ function integer(value) {
81
+ if (!Number.isSafeInteger(value)) throw new RangeError("Expected safe integer");
82
+ return value;
83
+ }
84
+ function HebrewLeapYear(year) {
85
+ return mod(7 * year + 1, 19) < 7;
86
+ }
87
+ function HebrewElapsedMonths(year) {
88
+ return Math.floor((235 * year - 234) / 19);
89
+ }
90
+ function hebrewDelay(year) {
91
+ const months = HebrewElapsedMonths(year);
92
+ const day = 29 * months + Math.floor((12084 + 13753 * months) / 25920);
93
+ return day + Number(mod(3 * (day + 1), 7) < 3);
94
+ }
95
+ function IsISOCalendar(calendar) {
96
+ return [
97
+ "iso8601",
98
+ "gregory",
99
+ "buddhist",
100
+ "japanese",
101
+ "roc"
102
+ ].includes(calendar);
103
+ }
104
+ function CalendarISOYear(calendar, year) {
105
+ return year + (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0);
106
+ }
107
+ function ArithmeticCalendarStartOfYear(calendar, year) {
108
+ if (IsISOCalendar(calendar)) return DayFromYear(CalendarISOYear(calendar, year));
109
+ switch (calendar) {
110
+ case "coptic": return -615923 + 365 * year + Math.floor(year / 4);
111
+ case "ethiopic": return -716732 + 365 * year + Math.floor(year / 4);
112
+ case "ethioaa": {
113
+ const value = year - 5500;
114
+ return -716732 + 365 * value + Math.floor(value / 4);
115
+ }
116
+ case "indian": return DayFromYear(year + 78) + 80;
117
+ case "islamic-civil":
118
+ case "islamic-tbla": return -492148 - Number(calendar === "islamic-tbla") + 354 * (year - 1) + Math.floor((3 + 11 * year) / 30);
119
+ case "persian": return -492268 + 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
591
120
  }
592
- toJSON() {
593
- return getNativePlainDate(this).toJSON();
121
+ const present = hebrewDelay(year);
122
+ return -2092590 + present + (hebrewDelay(year + 1) - present === 356 ? 2 : present - hebrewDelay(year - 1) === 382 ? 1 : 0);
123
+ }
124
+ function ArithmeticCalendarMonthsInYear(calendar, year) {
125
+ return [
126
+ "coptic",
127
+ "ethiopic",
128
+ "ethioaa"
129
+ ].includes(calendar) || calendar === "hebrew" && HebrewLeapYear(year) ? 13 : 12;
130
+ }
131
+ function ArithmeticCalendarDaysInMonth(calendar, year, month) {
132
+ const count = ArithmeticCalendarMonthsInYear(calendar, year);
133
+ if (integer(month) < 1 || month > count) throw new RangeError("Invalid calendar month");
134
+ if (IsISOCalendar(calendar)) return month === 12 ? 31 : monthStarts[month] - monthStarts[month - 1] + Number(month === 2 && DaysInYear(CalendarISOYear(calendar, year)) === 366);
135
+ const length = ArithmeticCalendarStartOfYear(calendar, year + 1) - ArithmeticCalendarStartOfYear(calendar, year);
136
+ if ([
137
+ "coptic",
138
+ "ethiopic",
139
+ "ethioaa"
140
+ ].includes(calendar)) return month === 13 ? length - 360 : 30;
141
+ if (calendar === "indian") return month === 1 ? 30 + Number(DaysInYear(year + 78) === 366) : month <= 6 ? 31 : 30;
142
+ if (calendar === "islamic-civil" || calendar === "islamic-tbla") return month % 2 === 1 || month === 12 && length === 355 ? 30 : 29;
143
+ if (calendar === "persian") return month <= 6 ? 31 : month < 12 ? 30 : length - 336;
144
+ const code = month + Number(!HebrewLeapYear(year) && month >= 6);
145
+ if ([
146
+ 4,
147
+ 7,
148
+ 9,
149
+ 11,
150
+ 13
151
+ ].includes(code)) return 29;
152
+ if (code === 2) return length % 10 === 5 ? 30 : 29;
153
+ if (code === 3) return length % 10 === 3 ? 29 : 30;
154
+ return 30;
155
+ }
156
+ function ArithmeticCalendarMonthCode(calendar, year, month) {
157
+ const leap = calendar === "hebrew" && HebrewLeapYear(year);
158
+ if (leap && month === 6) return "M05L";
159
+ const code = month - Number(leap && month > 6);
160
+ return "M" + (code < 10 ? "0" : "") + code;
161
+ }
162
+ function ArithmeticCalendarFromEpochDay(calendar, epoch) {
163
+ const t = epoch * 864e5, civilYear = YearFromTime(t);
164
+ if (IsISOCalendar(calendar)) {
165
+ const year = civilYear - (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0), month = MonthFromTime(t) + 1;
166
+ return {
167
+ year,
168
+ month,
169
+ monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
170
+ day: DateFromTime(t)
171
+ };
594
172
  }
595
- valueOf() {
596
- return getNativePlainDate(this).valueOf();
173
+ const jd = epoch + 2440588;
174
+ let year;
175
+ switch (calendar) {
176
+ case "coptic":
177
+ year = Math.floor((4 * (jd - 1824665) + 3) / 1461);
178
+ break;
179
+ case "ethiopic":
180
+ case "ethioaa":
181
+ year = Math.floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === "ethioaa" ? 5500 : 0);
182
+ break;
183
+ case "islamic-civil":
184
+ case "islamic-tbla":
185
+ year = Math.floor((30 * (jd - 1948440 + Number(calendar === "islamic-tbla")) + 10646) / 10631);
186
+ break;
187
+ case "persian":
188
+ year = 1 + Math.floor((33 * (jd - 1948320) + 3) / 12053);
189
+ break;
190
+ case "indian":
191
+ year = civilYear - 78;
192
+ break;
193
+ default: year = Math.floor((epoch + 2092590) * 492480 / 179876755) + 1;
597
194
  }
598
- }, getNativePlainDate, dateFieldGetters);
599
- function createNativePlainDateRecord(native) {
600
- const instance = Object.create(NativePlainDateRecord.prototype);
601
- return setPlainDateSlots(instance, native), attachDebugString(instance), instance;
602
- }
603
- function create$2$1(isoYear, isoMonth, isoDay, calendar) {
604
- return createNativePlainDateRecord(new NativeTemporal.PlainDate(isoYear, isoMonth, isoDay, refineNativeCalendarArgMaybe(calendar)));
605
- }
606
- function inLeapYear$1$1(record) {
607
- return getNativePlainDate(record).inLeapYear;
608
- }
609
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/funcApi-shim.js
610
- function refineShimCalendarArgMaybe(calendarRecord) {
611
- return void 0 === calendarRecord ? void 0 : getCalendarRecordImpl(calendarRecord);
612
- }
613
- function getCalendarRecordImpl(record) {
614
- return getCalendarRecordImplCreator(record)();
195
+ while (ArithmeticCalendarStartOfYear(calendar, year) > epoch) year--;
196
+ while (ArithmeticCalendarStartOfYear(calendar, year + 1) <= epoch) year++;
197
+ let month = 1, remaining = epoch - ArithmeticCalendarStartOfYear(calendar, year);
198
+ while (remaining >= ArithmeticCalendarDaysInMonth(calendar, year, month)) remaining -= ArithmeticCalendarDaysInMonth(calendar, year, month++);
199
+ return {
200
+ year,
201
+ month,
202
+ monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
203
+ day: remaining + 1
204
+ };
615
205
  }
616
- const getShimPlainDateSlots = getPlainDateSlots;
617
- const ShimPlainDateRecord = /*@__PURE__*/ defineTemporalClass(PlainDateRecordBranding, class {
618
- get calendarId() {
619
- return getCalendarSlotId(getShimPlainDateSlots(this).calendar);
620
- }
621
- toJSON() {
622
- return formatDateIsoAuto(getShimPlainDateSlots(this));
623
- }
624
- valueOf() {
625
- return forbiddenValueOf();
206
+ const JapaneseEras = [
207
+ [
208
+ 18017,
209
+ "reiwa",
210
+ 2018
211
+ ],
212
+ [
213
+ 6947,
214
+ "heisei",
215
+ 1988
216
+ ],
217
+ [
218
+ -15713,
219
+ "showa",
220
+ 1925
221
+ ],
222
+ [
223
+ -20974,
224
+ "taisho",
225
+ 1911
226
+ ],
227
+ [
228
+ -35428,
229
+ "meiji",
230
+ 1867
231
+ ]
232
+ ];
233
+ function ArithmeticCalendarEra(calendar, epoch, year) {
234
+ switch (calendar) {
235
+ case "iso8601": return;
236
+ case "buddhist": return {
237
+ era: "be",
238
+ eraYear: year
239
+ };
240
+ case "coptic":
241
+ case "hebrew": return {
242
+ era: "am",
243
+ eraYear: year
244
+ };
245
+ case "ethiopic": return {
246
+ era: year > 0 ? "am" : "aa",
247
+ eraYear: year > 0 ? year : year + 5500
248
+ };
249
+ case "ethioaa": return {
250
+ era: "aa",
251
+ eraYear: year
252
+ };
253
+ case "indian": return {
254
+ era: "shaka",
255
+ eraYear: year
256
+ };
257
+ case "persian": return {
258
+ era: "ap",
259
+ eraYear: year
260
+ };
261
+ case "roc": return {
262
+ era: year > 0 ? "roc" : "broc",
263
+ eraYear: year > 0 ? year : 1 - year
264
+ };
265
+ case "islamic-civil":
266
+ case "islamic-tbla": return {
267
+ era: year > 0 ? "ah" : "bh",
268
+ eraYear: year > 0 ? year : 1 - year
269
+ };
270
+ case "japanese": for (const [start, era, offset] of JapaneseEras) if (epoch >= start) return {
271
+ era,
272
+ eraYear: year - offset
273
+ };
626
274
  }
627
- }, getShimPlainDateSlots, dateFieldGetters$1);
628
- function createShimPlainDateRecord(slots) {
629
- const instance = Object.create(ShimPlainDateRecord.prototype);
630
- return setPlainDateSlots(instance, slots), attachDebugString(instance), instance;
631
- }
632
- function create$2(isoYear, isoMonth, isoDay, calendar) {
633
- return createShimPlainDateRecord(createDateSlots(checkIsoDateInBounds(validateIsoDateFields(mapProps(toIntegerWithTrunc, {
634
- year: isoYear,
635
- month: isoMonth,
636
- day: isoDay
637
- }))), refineShimCalendarArgMaybe(calendar)));
638
- }
639
- function inLeapYear$1(record) {
640
- const slots = getShimPlainDateSlots(record);
641
- return computeCalendarInLeapYear(slots.calendar, slots);
275
+ return {
276
+ era: year > 0 ? "ce" : "bce",
277
+ eraYear: year > 0 ? year : 1 - year
278
+ };
642
279
  }
643
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/fns/PlainDate.js
644
- const create = NativeTemporal ? create$2$1 : create$2;
645
- const inLeapYear = NativeTemporal ? inLeapYear$1$1 : inLeapYear$1;
646
- // packages/intl-datetimeformat/calendars/temporal.js
280
+ // packages/intl-datetimeformat/calendars/arithmetic.js
647
281
  const eras = {
648
282
  be: "0",
649
283
  am: "1",
@@ -663,19 +297,21 @@ const eras = {
663
297
  ap: "0"
664
298
  };
665
299
  /**
666
- * Adapt Temporal calendar fields to CLDR era keys and month-name indices.
300
+ * Adapt shared calendar fields to CLDR era keys and month-name indices.
667
301
  * This is an implementation helper for ECMA-402 ToLocalTime, not a spec AO.
668
302
  * https://tc39.es/ecma402/#sec-tolocaltime
669
303
  * https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Elements
670
304
  */
671
- function temporalCalendar(calendar, getCalendar, hebrew = false) {
305
+ function arithmeticCalendar(calendar, hebrew = false) {
672
306
  return {
673
307
  calendar,
674
308
  dateFromTime(t) {
675
- const date = create(YearFromTime(t), MonthFromTime(t) + 1, DateFromTime(t), getCalendar());
309
+ const epochDay = Math.floor(t / 864e5);
310
+ if (!Number.isFinite(t) || epochDay < -100000001 || epochDay > 1e8) throw new RangeError("Calendar date out of range");
311
+ const date = ArithmeticCalendarFromEpochDay(calendar, epochDay);
676
312
  if (hebrew) {
677
313
  const monthCode = Number(date.monthCode.slice(1, 3));
678
- const monthNameIndex = date.monthCode === "M05L" ? 5 : monthCode === 6 && inLeapYear(date) ? 13 : monthCode >= 6 ? monthCode : monthCode - 1;
314
+ const monthNameIndex = date.monthCode === "M05L" ? 5 : monthCode === 6 && ArithmeticCalendarMonthsInYear(calendar, date.year) === 13 ? 13 : monthCode >= 6 ? monthCode : monthCode - 1;
679
315
  return {
680
316
  era: "0",
681
317
  year: date.year,
@@ -684,9 +320,10 @@ function temporalCalendar(calendar, getCalendar, hebrew = false) {
684
320
  day: date.day
685
321
  };
686
322
  }
323
+ const era = ArithmeticCalendarEra(calendar, epochDay, date.year);
687
324
  return {
688
- era: eras[date.era],
689
- year: date.eraYear ?? date.year,
325
+ era: eras[era.era],
326
+ year: era?.eraYear ?? date.year,
690
327
  month: date.month - 1,
691
328
  day: date.day
692
329
  };
@@ -694,7 +331,7 @@ function temporalCalendar(calendar, getCalendar, hebrew = false) {
694
331
  };
695
332
  }
696
333
  // packages/intl-datetimeformat/calendars/implementations/persian.js
697
- const data = temporalCalendar("persian", getPersian);
334
+ const data = arithmeticCalendar("persian");
698
335
  // packages/intl-datetimeformat/register-calendar-data.ts
699
336
  /** Register after installation, or queue until the polyfill is installed. */
700
337
  function registerCalendarData(...data) {