@fedify/vocab 2.4.0-dev.1581 → 2.4.0-dev.1599
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/deno.json +3 -2
- package/dist/mod.cjs +3570 -10
- package/dist/mod.js +2 -2
- package/dist-tests/{actor-Cxls_bxz.mjs → actor-NhcklZK0.mjs} +4 -4
- package/dist-tests/actor.test.mjs +3 -3
- package/dist-tests/cjs.test.mjs +28 -0
- package/dist-tests/lookup.test.mjs +5 -5
- package/dist-tests/{type-Cf-vxmre.mjs → type-_BlsfT3S.mjs} +1 -1
- package/dist-tests/type.test.mjs +3 -3
- package/dist-tests/{utils-CE8Dk5hm.mjs → utils-CQjrpUkt.mjs} +1 -1
- package/dist-tests/{vocab-DOHLQ4UQ.mjs → vocab-BQ8y6QS7.mjs} +2 -1
- package/dist-tests/vocab.test.mjs +3 -3
- package/package.json +5 -5
- package/src/cjs.test.ts +31 -0
- package/tsdown.config.ts +22 -12
package/dist/mod.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __create = Object.create;
|
|
@@ -34,7 +34,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
|
|
|
34
34
|
let es_toolkit = require("es-toolkit");
|
|
35
35
|
//#region deno.json
|
|
36
36
|
var name = "@fedify/vocab";
|
|
37
|
-
var version = "2.4.0-dev.
|
|
37
|
+
var version = "2.4.0-dev.1599+7b19967f";
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/type.ts
|
|
40
40
|
function getTypeId(object) {
|
|
@@ -42,6 +42,3564 @@ function getTypeId(object) {
|
|
|
42
42
|
return object.constructor.typeId;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
|
+
//#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/chunks/root.js
|
|
46
|
+
const NativeTemporal = globalThis.Temporal;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../node_modules/.pnpm/temporal-utils@1.0.1/node_modules/temporal-utils/dist/errorMessages.js
|
|
49
|
+
const expectedPositive = (entityName, num) => `Non-positive ${entityName}: ${num}`;
|
|
50
|
+
const expectedFinite = (entityName, num) => `Non-finite ${entityName}: ${num}`;
|
|
51
|
+
const forbiddenBigIntToNumber = (entityName) => `Cannot convert bigint to ${entityName}`;
|
|
52
|
+
const invalidObject = "Invalid object";
|
|
53
|
+
const numberOutOfRange = (entityName, val, min, max) => invalidEntity$1(entityName, val) + `; must be between ${min}-${max}`;
|
|
54
|
+
const invalidEntity$1 = (fieldName, val) => `Invalid ${fieldName}: ${val}`;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region ../../node_modules/.pnpm/temporal-utils@1.0.1/node_modules/temporal-utils/dist/utils.js
|
|
57
|
+
const nanoInMicro$1 = 1e3;
|
|
58
|
+
const nanoInMilli$1 = 1e6;
|
|
59
|
+
const nanoInSec$1 = 1e9;
|
|
60
|
+
const nanoInMinute$1 = 6e10;
|
|
61
|
+
const nanoInHour$1 = 36e11;
|
|
62
|
+
function normalizeOptions(options) {
|
|
63
|
+
if (options === void 0) return Object.create(null);
|
|
64
|
+
return requireObjectLike(options);
|
|
65
|
+
}
|
|
66
|
+
function toFiniteNumber(arg, entityName = "number") {
|
|
67
|
+
if (typeof arg === "bigint") throw new TypeError(forbiddenBigIntToNumber(entityName));
|
|
68
|
+
arg = Number(arg);
|
|
69
|
+
if (!Number.isFinite(arg)) throw new RangeError(expectedFinite(entityName, arg));
|
|
70
|
+
return arg;
|
|
71
|
+
}
|
|
72
|
+
function toIntegerWithTrunc(arg, entityName) {
|
|
73
|
+
return Math.trunc(toFiniteNumber(arg, entityName)) || 0;
|
|
74
|
+
}
|
|
75
|
+
function toPositiveIntegerWithTruncation(arg, entityName) {
|
|
76
|
+
return requireNumberIsPositive(toIntegerWithTrunc(arg, entityName), entityName);
|
|
77
|
+
}
|
|
78
|
+
function requireNumberIsPositive(num, entityName = "number") {
|
|
79
|
+
if (num <= 0) throw new RangeError(expectedPositive(entityName, num));
|
|
80
|
+
return num;
|
|
81
|
+
}
|
|
82
|
+
function constrainToRange$1(num, min, max) {
|
|
83
|
+
return Math.min(Math.max(num, min), max);
|
|
84
|
+
}
|
|
85
|
+
function isObjectLike$1(arg) {
|
|
86
|
+
return arg !== null && (typeof arg === "object" || typeof arg === "function");
|
|
87
|
+
}
|
|
88
|
+
function requireObjectLike(arg) {
|
|
89
|
+
if (!isObjectLike$1(arg)) throw new TypeError(invalidObject);
|
|
90
|
+
return arg;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/chunks/internal.js
|
|
94
|
+
const invalidEntity = invalidEntity$1;
|
|
95
|
+
const missingField = (fieldName) => `Missing ${fieldName}`;
|
|
96
|
+
const noValidFields = (validFields) => "No valid fields: " + validFields.join();
|
|
97
|
+
const invalidChoice = (fieldName, val, choiceMap) => invalidEntity$1(fieldName, val) + "; must be " + Object.keys(choiceMap).join();
|
|
98
|
+
const forbiddenValueOf$1 = "Cannot use valueOf";
|
|
99
|
+
const invalidCallingContext = "Invalid calling context";
|
|
100
|
+
const missingYear = (allowEra) => "Missing year" + (allowEra ? "/era/eraYear" : "");
|
|
101
|
+
const invalidLeapMonth = "Invalid leap month";
|
|
102
|
+
const invalidCalendar = (calendarId) => invalidEntity$1("Calendar", calendarId);
|
|
103
|
+
const exoticCalendarRequired = (calendarId, remedy) => `Unknown calendar ${calendarId}; might need ${remedy}`;
|
|
104
|
+
const invalidTimeZone = (calendarId) => invalidEntity$1("TimeZone", calendarId);
|
|
105
|
+
const failedParse = (s) => `Cannot parse: ${s}`;
|
|
106
|
+
const invalidSubstring = (substring) => `Invalid substring: ${substring}`;
|
|
107
|
+
const constrainToRange = constrainToRange$1;
|
|
108
|
+
const isObjectLike = isObjectLike$1;
|
|
109
|
+
function throwRangeError(message) {
|
|
110
|
+
throw new RangeError(message);
|
|
111
|
+
}
|
|
112
|
+
function throwTypeError(message) {
|
|
113
|
+
throw new TypeError(message);
|
|
114
|
+
}
|
|
115
|
+
function clampProp(props, propName, min, max, overflow) {
|
|
116
|
+
return clampEntity(propName, ((props, propName) => {
|
|
117
|
+
const propVal = props[propName];
|
|
118
|
+
return void 0 === propVal && throwTypeError(missingField(propName)), propVal;
|
|
119
|
+
})(props, propName), min, max, overflow);
|
|
120
|
+
}
|
|
121
|
+
function clampEntity(entityName, num, min, max, overflow, choices) {
|
|
122
|
+
const clamped = constrainToRange(num, min, max);
|
|
123
|
+
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;
|
|
124
|
+
}
|
|
125
|
+
function memoize(generator, MapClass = Map) {
|
|
126
|
+
const map = new MapClass();
|
|
127
|
+
return (key, ...otherArgs) => {
|
|
128
|
+
if (map.has(key)) return map.get(key);
|
|
129
|
+
const val = generator(key, ...otherArgs);
|
|
130
|
+
return map.set(key, val), val;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const createNameDescriptors = (name) => createPropDescriptors({ name }, 1);
|
|
134
|
+
const createPropDescriptors = (propVals, readonly) => mapProps((value) => ({
|
|
135
|
+
value,
|
|
136
|
+
configurable: 1,
|
|
137
|
+
writable: !readonly
|
|
138
|
+
}), propVals);
|
|
139
|
+
const createStringTagDescriptors = (value) => ({ [Symbol.toStringTag]: {
|
|
140
|
+
value,
|
|
141
|
+
configurable: 1
|
|
142
|
+
} });
|
|
143
|
+
function mapProps(transformer, props) {
|
|
144
|
+
const res = {};
|
|
145
|
+
for (const propName in props) res[propName] = transformer(props[propName], propName);
|
|
146
|
+
return res;
|
|
147
|
+
}
|
|
148
|
+
function zipPropsConst(propNames, propVal) {
|
|
149
|
+
const res = {};
|
|
150
|
+
for (const propName of propNames) res[propName] = propVal;
|
|
151
|
+
return res;
|
|
152
|
+
}
|
|
153
|
+
function createPropGetters(propNames) {
|
|
154
|
+
const getters = {};
|
|
155
|
+
for (const propName of propNames) getters[propName] = (slots) => slots[propName];
|
|
156
|
+
return getters;
|
|
157
|
+
}
|
|
158
|
+
function pluckProps(propNames, props, dest = Object.create(null)) {
|
|
159
|
+
for (const propName of propNames) dest[propName] = props[propName];
|
|
160
|
+
return dest;
|
|
161
|
+
}
|
|
162
|
+
function allPropsEqual(propNames, props0, props1) {
|
|
163
|
+
for (const propName of propNames) if (props0[propName] !== props1[propName]) return 0;
|
|
164
|
+
return 1;
|
|
165
|
+
}
|
|
166
|
+
function zeroOutProps(propNames, clearUntilI, props) {
|
|
167
|
+
const copy = { ...props };
|
|
168
|
+
for (let i = 0; i < clearUntilI; i++) copy[propNames[i]] = 0;
|
|
169
|
+
return copy;
|
|
170
|
+
}
|
|
171
|
+
function bindArgs(f, ...boundArgs) {
|
|
172
|
+
return (...dynamicArgs) => f(...boundArgs, ...dynamicArgs);
|
|
173
|
+
}
|
|
174
|
+
function noop() {}
|
|
175
|
+
function capitalize(s) {
|
|
176
|
+
return s[0].toUpperCase() + s.substring(1);
|
|
177
|
+
}
|
|
178
|
+
function sortStrings(...strss) {
|
|
179
|
+
return [].concat(...strss).sort();
|
|
180
|
+
}
|
|
181
|
+
function createRegExp(meat) {
|
|
182
|
+
return new RegExp(`^${meat}$`, "i");
|
|
183
|
+
}
|
|
184
|
+
function parseSubsecNano(fracStr) {
|
|
185
|
+
return parseInt(fracStr.padEnd(9, "0"));
|
|
186
|
+
}
|
|
187
|
+
function parseSign(s) {
|
|
188
|
+
return s && "+" !== s ? -1 : 1;
|
|
189
|
+
}
|
|
190
|
+
function parseInt0(s) {
|
|
191
|
+
return void 0 === s ? 0 : parseInt(s);
|
|
192
|
+
}
|
|
193
|
+
function padNumber(digits, num) {
|
|
194
|
+
return String(num).padStart(digits, "0");
|
|
195
|
+
}
|
|
196
|
+
const padNumber2 = /* @__PURE__ */ bindArgs(padNumber, 2);
|
|
197
|
+
function compareNumbers(a, b) {
|
|
198
|
+
return Math.sign(a - b);
|
|
199
|
+
}
|
|
200
|
+
function compareBigInts(a, b) {
|
|
201
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
202
|
+
}
|
|
203
|
+
function divFloorBigInt(num, denom) {
|
|
204
|
+
const whole = num / denom;
|
|
205
|
+
return num % denom < 0n ? whole - 1n : whole;
|
|
206
|
+
}
|
|
207
|
+
function divModFloorBigInt(num, divisor) {
|
|
208
|
+
const quotient = divFloorBigInt(num, divisor);
|
|
209
|
+
return [quotient, num - quotient * divisor];
|
|
210
|
+
}
|
|
211
|
+
function divModFloor(num, divisor) {
|
|
212
|
+
return [Math.floor(num / divisor), modFloor(num, divisor)];
|
|
213
|
+
}
|
|
214
|
+
function modFloor(num, divisor) {
|
|
215
|
+
return (num % divisor + divisor) % divisor;
|
|
216
|
+
}
|
|
217
|
+
function divTrunc(num, divisor) {
|
|
218
|
+
return Math.trunc(num / divisor) || 0;
|
|
219
|
+
}
|
|
220
|
+
function modTrunc(num, divisor) {
|
|
221
|
+
return num % divisor || 0;
|
|
222
|
+
}
|
|
223
|
+
function fabricateNearHalfFraction(halfCompare, sign = 1) {
|
|
224
|
+
return sign * (.5 + halfCompare / 5);
|
|
225
|
+
}
|
|
226
|
+
function hasHalf(num) {
|
|
227
|
+
return .5 === Math.abs(num % 1);
|
|
228
|
+
}
|
|
229
|
+
const isoCalendarId = "iso8601";
|
|
230
|
+
const gregoryEraOrigins = {
|
|
231
|
+
"bce": -1,
|
|
232
|
+
"ce": 0
|
|
233
|
+
};
|
|
234
|
+
function normalizeEraName(era) {
|
|
235
|
+
const normalized = era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
236
|
+
return "bc" === normalized || "b" === normalized ? "bce" : "ad" === normalized || "a" === normalized ? "ce" : normalized;
|
|
237
|
+
}
|
|
238
|
+
function getCalendarSlotId(calendar) {
|
|
239
|
+
return calendar === void 0 ? "iso8601" : 0 === calendar ? "gregory" : calendar.id;
|
|
240
|
+
}
|
|
241
|
+
const monthCodeRegExp = /^M(\d{2})(L?)$/;
|
|
242
|
+
function parseMonthCode(monthCode) {
|
|
243
|
+
const m = monthCodeRegExp.exec(monthCode);
|
|
244
|
+
return m || throwRangeError(((monthCode) => `Invalid monthCode: ${monthCode}`)(monthCode)), [parseInt(m[1]), Boolean(m[2])];
|
|
245
|
+
}
|
|
246
|
+
function formatMonthCode(monthCodeNumber, isLeapMonth) {
|
|
247
|
+
return "M" + padNumber2(monthCodeNumber) + (isLeapMonth ? "L" : "");
|
|
248
|
+
}
|
|
249
|
+
function monthCodeNumberToMonth(monthCodeNumber, isLeapMonth, leapMonth) {
|
|
250
|
+
return monthCodeNumber + (isLeapMonth || leapMonth && monthCodeNumber >= leapMonth ? 1 : 0);
|
|
251
|
+
}
|
|
252
|
+
const unitNameMap = {
|
|
253
|
+
nanosecond: 0,
|
|
254
|
+
microsecond: 1,
|
|
255
|
+
millisecond: 2,
|
|
256
|
+
second: 3,
|
|
257
|
+
minute: 4,
|
|
258
|
+
hour: 5,
|
|
259
|
+
day: 6,
|
|
260
|
+
week: 7,
|
|
261
|
+
month: 8,
|
|
262
|
+
year: 9
|
|
263
|
+
};
|
|
264
|
+
const unitNamesAsc = /* @__PURE__ */ Object.keys(unitNameMap);
|
|
265
|
+
const nanoInMicro = nanoInMicro$1;
|
|
266
|
+
const nanoInMilli = nanoInMilli$1;
|
|
267
|
+
const nanoInSec = nanoInSec$1;
|
|
268
|
+
const nanoInMinute = nanoInMinute$1;
|
|
269
|
+
const nanoInHour = nanoInHour$1;
|
|
270
|
+
const nanoInUtcDay = 864e11;
|
|
271
|
+
const unitNanoMap = [
|
|
272
|
+
1,
|
|
273
|
+
nanoInMicro,
|
|
274
|
+
nanoInMilli,
|
|
275
|
+
nanoInSec,
|
|
276
|
+
nanoInMinute,
|
|
277
|
+
nanoInHour,
|
|
278
|
+
nanoInUtcDay
|
|
279
|
+
];
|
|
280
|
+
const bigNanoInMicro = /* @__PURE__ */ BigInt(nanoInMicro);
|
|
281
|
+
const bigNanoInMilli = /* @__PURE__ */ BigInt(nanoInMilli);
|
|
282
|
+
const bigNanoInSec = /* @__PURE__ */ BigInt(nanoInSec);
|
|
283
|
+
const bigNanoInMinute = /* @__PURE__ */ BigInt(nanoInMinute);
|
|
284
|
+
const bigNanoInHour = /* @__PURE__ */ BigInt(nanoInHour);
|
|
285
|
+
const bigNanoInUtcDay = /* @__PURE__ */ BigInt(nanoInUtcDay);
|
|
286
|
+
function divideBigNanoToExactNumber(bigNano, divisorNano) {
|
|
287
|
+
const days = Number(bigNano / bigNanoInUtcDay);
|
|
288
|
+
const timeNano = Number(bigNano % bigNanoInUtcDay);
|
|
289
|
+
return days * (nanoInUtcDay / divisorNano) + (Math.trunc(timeNano / divisorNano) + timeNano % divisorNano / divisorNano);
|
|
290
|
+
}
|
|
291
|
+
const timeFieldNamesAsc = /* @__PURE__ */ unitNamesAsc.slice(0, 6);
|
|
292
|
+
const timeGetters = /* @__PURE__ */ createPropGetters(timeFieldNamesAsc);
|
|
293
|
+
const yearFieldNamesAsc = ["year"];
|
|
294
|
+
const dayFieldNamesAsc = ["day"];
|
|
295
|
+
const calendarDateFieldNamesAsc = [
|
|
296
|
+
"day",
|
|
297
|
+
"month",
|
|
298
|
+
"year"
|
|
299
|
+
];
|
|
300
|
+
const offsetFieldNames = ["offset"];
|
|
301
|
+
const timeZoneFieldNames = ["timeZone"];
|
|
302
|
+
const eraYearFieldNames = ["era", "eraYear"];
|
|
303
|
+
const allYearFieldNames = [
|
|
304
|
+
"era",
|
|
305
|
+
"eraYear",
|
|
306
|
+
"year"
|
|
307
|
+
];
|
|
308
|
+
const monthFieldNames = ["month", "monthCode"];
|
|
309
|
+
const monthDayFieldNames = [
|
|
310
|
+
"day",
|
|
311
|
+
"month",
|
|
312
|
+
"monthCode"
|
|
313
|
+
];
|
|
314
|
+
const timeFieldNamesAlpha = /* @__PURE__ */ sortStrings(timeFieldNamesAsc);
|
|
315
|
+
const yearFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(eraYearFieldNames, yearFieldNamesAsc);
|
|
316
|
+
const yearMonthFieldNamesAlpha = /* @__PURE__ */ sortStrings(monthFieldNames, yearFieldNamesAsc);
|
|
317
|
+
const yearMonthFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(eraYearFieldNames, yearMonthFieldNamesAlpha);
|
|
318
|
+
const yearMonthCodeFieldNamesAlpha = /* @__PURE__ */ sortStrings(["monthCode"], yearFieldNamesAsc);
|
|
319
|
+
const yearMonthCodeFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
|
|
320
|
+
const monthCodeDayFieldNamesAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, ["monthCode"]);
|
|
321
|
+
const dateFieldNamesAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, yearMonthFieldNamesAlpha);
|
|
322
|
+
const dateFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthFieldNamesAlpha);
|
|
323
|
+
const dateTimeFieldNamesAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc);
|
|
324
|
+
const dateTimeFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc);
|
|
325
|
+
const dateTimeAndOffsetFieldNamesAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc, offsetFieldNames);
|
|
326
|
+
const dateTimeAndOffsetFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc, offsetFieldNames);
|
|
327
|
+
const dateTimeAndZoneFieldNamesAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc, offsetFieldNames, timeZoneFieldNames);
|
|
328
|
+
const dateTimeAndZoneFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc, offsetFieldNames, timeZoneFieldNames);
|
|
329
|
+
const yearMonthCodeDayFieldNamesAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, yearMonthCodeFieldNamesAlpha);
|
|
330
|
+
const yearMonthCodeDayFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
|
|
331
|
+
const timeFieldDefaults = /* @__PURE__ */ zipPropsConst(timeFieldNamesAsc, 0);
|
|
332
|
+
function validateTimeFields(timeFields) {
|
|
333
|
+
return constrainTimeFields(timeFields, 1), timeFields;
|
|
334
|
+
}
|
|
335
|
+
const maxValues = {
|
|
336
|
+
hour: 23,
|
|
337
|
+
minute: 59,
|
|
338
|
+
second: 59
|
|
339
|
+
};
|
|
340
|
+
function constrainTimeFields(timeFields, overflow) {
|
|
341
|
+
const constrainedFields = {};
|
|
342
|
+
for (const fieldName of timeFieldNamesAsc) constrainedFields[fieldName] = clampEntity(fieldName, timeFields[fieldName], 0, maxValues[fieldName] || 999, overflow);
|
|
343
|
+
return constrainedFields;
|
|
344
|
+
}
|
|
345
|
+
function timeFieldsToNano(timeFields) {
|
|
346
|
+
return timeFieldsToSec(timeFields) * nanoInSec + timeFieldsToSubsecNano(timeFields);
|
|
347
|
+
}
|
|
348
|
+
function timeFieldsToMilli(timeFields) {
|
|
349
|
+
return 1e3 * timeFieldsToSec(timeFields) + timeFields.millisecond;
|
|
350
|
+
}
|
|
351
|
+
function timeFieldsToSec(timeFields) {
|
|
352
|
+
return 3600 * timeFields.hour + 60 * timeFields.minute + timeFields.second;
|
|
353
|
+
}
|
|
354
|
+
function timeFieldsToSubsecNano(timeFields) {
|
|
355
|
+
return timeFields.millisecond * nanoInMilli + timeFields.microsecond * nanoInMicro + timeFields.nanosecond;
|
|
356
|
+
}
|
|
357
|
+
function nanoToTimeAndDay(nano) {
|
|
358
|
+
const [dayDelta, timeNano] = divModFloor(nano, nanoInUtcDay);
|
|
359
|
+
return [nanoToTimeFields(timeNano), dayDelta];
|
|
360
|
+
}
|
|
361
|
+
function nanoToTimeFields(timeNano) {
|
|
362
|
+
const [timeMilli, nanoAfterMilli] = divModFloor(timeNano, nanoInMilli);
|
|
363
|
+
const [microsecond, nanosecond] = divModFloor(nanoAfterMilli, nanoInMicro);
|
|
364
|
+
return milliToTimeFields(timeMilli, microsecond, nanosecond);
|
|
365
|
+
}
|
|
366
|
+
function milliToTimeFields(timeMilli, microsecond = 0, nanosecond = 0) {
|
|
367
|
+
const [hour, milliAfterHour] = divModFloor(timeMilli, 36e5);
|
|
368
|
+
const [minute, milliAfterMinute] = divModFloor(milliAfterHour, 6e4);
|
|
369
|
+
const [second, millisecond] = divModFloor(milliAfterMinute, 1e3);
|
|
370
|
+
return {
|
|
371
|
+
hour,
|
|
372
|
+
minute,
|
|
373
|
+
second,
|
|
374
|
+
millisecond,
|
|
375
|
+
microsecond,
|
|
376
|
+
nanosecond
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function epochNanoToSecMod(epochNano) {
|
|
380
|
+
const [epochSec, nano] = divModFloorBigInt(epochNano, bigNanoInSec);
|
|
381
|
+
return [Number(epochSec), Number(nano)];
|
|
382
|
+
}
|
|
383
|
+
function isoDateTimeToEpochNano(isoDateTime) {
|
|
384
|
+
return isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime));
|
|
385
|
+
}
|
|
386
|
+
function isoDateTimeToEpochMilli(isoDateTime) {
|
|
387
|
+
return isoDateToEpochMilli(isoDateTime) + timeFieldsToMilli(isoDateTime);
|
|
388
|
+
}
|
|
389
|
+
function isoDateToEpochNano(isoDate) {
|
|
390
|
+
return BigInt(isoDateToEpochDays(isoDate)) * bigNanoInUtcDay;
|
|
391
|
+
}
|
|
392
|
+
function isoDateToEpochMilli(isoDate) {
|
|
393
|
+
return 864e5 * isoDateToEpochDays(isoDate);
|
|
394
|
+
}
|
|
395
|
+
function isoDateToEpochDays(isoDate) {
|
|
396
|
+
return isoArgsToEpochDays(isoDate.year, isoDate.month, isoDate.day);
|
|
397
|
+
}
|
|
398
|
+
function isoArgsToEpochDays(isoYear, isoMonth = 1, isoDay = 1) {
|
|
399
|
+
const monthIndex = isoMonth - 1;
|
|
400
|
+
return isoYear += Math.floor(monthIndex / 12), isoMonth = modFloor(monthIndex, 12), Date.UTC(isoYear % 400 - 400, isoMonth, 0) / 864e5 + 146097 * (divTrunc(isoYear, 400) + 1) + isoDay;
|
|
401
|
+
}
|
|
402
|
+
function epochNanoToIsoDateTime(epochNano) {
|
|
403
|
+
const [epochDays, nanoAfterDay] = divModFloorBigInt(epochNano, bigNanoInUtcDay);
|
|
404
|
+
return {
|
|
405
|
+
...epochDaysToIsoDate(Number(epochDays)),
|
|
406
|
+
...nanoToTimeFields(Number(nanoAfterDay))
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function epochDaysToIsoDate(epochDays) {
|
|
410
|
+
const legacyDate = /* @__PURE__ */ new Date(864e5 * modFloor(epochDays, 146097));
|
|
411
|
+
return {
|
|
412
|
+
year: legacyDate.getUTCFullYear() + 400 * Math.floor(epochDays / 146097),
|
|
413
|
+
month: legacyDate.getUTCMonth() + 1,
|
|
414
|
+
day: legacyDate.getUTCDate()
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function computeIsoMonthCodeParts(month) {
|
|
418
|
+
return [month, 0];
|
|
419
|
+
}
|
|
420
|
+
function computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, isLeapMonth) {
|
|
421
|
+
if (!isLeapMonth) return {
|
|
422
|
+
year: 1972,
|
|
423
|
+
month: monthCodeNumber
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function computeIsoFieldsFromParts(year, month, day) {
|
|
427
|
+
return {
|
|
428
|
+
year,
|
|
429
|
+
month,
|
|
430
|
+
day
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function computeIsoDaysInMonth(year, month) {
|
|
434
|
+
switch (month) {
|
|
435
|
+
case 2: return computeIsoInLeapYear(year) ? 29 : 28;
|
|
436
|
+
case 4:
|
|
437
|
+
case 6:
|
|
438
|
+
case 9:
|
|
439
|
+
case 11: return 30;
|
|
440
|
+
}
|
|
441
|
+
return 31;
|
|
442
|
+
}
|
|
443
|
+
function computeIsoDaysInYear(year) {
|
|
444
|
+
return computeIsoInLeapYear(year) ? 366 : 365;
|
|
445
|
+
}
|
|
446
|
+
function computeIsoInLeapYear(year) {
|
|
447
|
+
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
|
|
448
|
+
}
|
|
449
|
+
function addIsoMonths(year, month, monthDelta) {
|
|
450
|
+
return year += divTrunc(monthDelta, 12), (month += modTrunc(monthDelta, 12)) < 1 ? (year--, month += 12) : month > 12 && (year++, month -= 12), {
|
|
451
|
+
year,
|
|
452
|
+
month
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function diffIsoMonthSlots(year0, month0, year1, month1) {
|
|
456
|
+
return 12 * (year1 - year0) + month1 - month0;
|
|
457
|
+
}
|
|
458
|
+
function computeIsoDayOfWeek(isoDateFields) {
|
|
459
|
+
return modFloor(isoArgsToEpochDays(isoDateFields.year, isoDateFields.month, isoDateFields.day) + 4, 7) || 7;
|
|
460
|
+
}
|
|
461
|
+
function computeIsoDayOfYear(isoDateFields) {
|
|
462
|
+
return isoArgsToEpochDays(isoDateFields.year, isoDateFields.month, isoDateFields.day) - isoArgsToEpochDays(isoDateFields.year) + 1;
|
|
463
|
+
}
|
|
464
|
+
function computeIsoWeekFields(isoDateFields) {
|
|
465
|
+
let yearOfWeek = isoDateFields.year;
|
|
466
|
+
let weekOfYear = Math.floor((computeIsoDayOfYear(isoDateFields) - computeIsoDayOfWeek(isoDateFields) + 10) / 7);
|
|
467
|
+
let weeksInYear = computeIsoWeeksInYear(yearOfWeek);
|
|
468
|
+
return weekOfYear < 1 ? weekOfYear = weeksInYear = computeIsoWeeksInYear(--yearOfWeek) : weekOfYear > weeksInYear && (weekOfYear = 1, weeksInYear = computeIsoWeeksInYear(++yearOfWeek)), {
|
|
469
|
+
weekOfYear,
|
|
470
|
+
yearOfWeek,
|
|
471
|
+
Ie: weeksInYear
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function computeIsoWeeksInYear(year) {
|
|
475
|
+
const y0DayOfWeek = computeIsoDayOfWeek({
|
|
476
|
+
year,
|
|
477
|
+
month: 1,
|
|
478
|
+
day: 1
|
|
479
|
+
});
|
|
480
|
+
return 4 === y0DayOfWeek || 3 === y0DayOfWeek && computeIsoInLeapYear(year) ? 53 : 52;
|
|
481
|
+
}
|
|
482
|
+
function computeGregoryEraFields({ year }) {
|
|
483
|
+
return year < 1 ? {
|
|
484
|
+
era: "bce",
|
|
485
|
+
eraYear: 1 - year
|
|
486
|
+
} : {
|
|
487
|
+
era: "ce",
|
|
488
|
+
eraYear: year
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function validateIsoDateTimeFields(isoDateTime) {
|
|
492
|
+
return validateIsoDateFields(isoDateTime), validateTimeFields(isoDateTime);
|
|
493
|
+
}
|
|
494
|
+
function validateIsoDateFields(isoInternals) {
|
|
495
|
+
return constrainIsoDateFields(isoInternals, 1), isoInternals;
|
|
496
|
+
}
|
|
497
|
+
function isIsoDateFieldsValid(isoDate) {
|
|
498
|
+
return allPropsEqual(calendarDateFieldNamesAsc, isoDate, constrainIsoDateFields(isoDate));
|
|
499
|
+
}
|
|
500
|
+
function constrainIsoDateFields(isoDate, overflow) {
|
|
501
|
+
const { year } = isoDate;
|
|
502
|
+
const month = clampProp(isoDate, "month", 1, 12, overflow);
|
|
503
|
+
return {
|
|
504
|
+
year,
|
|
505
|
+
month,
|
|
506
|
+
day: clampProp(isoDate, "day", 1, computeIsoDaysInMonth(year, month), overflow)
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function computeCalendarDateFields(calendar, isoDate) {
|
|
510
|
+
return calendar ? calendar.ie(isoDate) : isoDate;
|
|
511
|
+
}
|
|
512
|
+
function computeCalendarMonthCodeParts(calendar, year, month) {
|
|
513
|
+
return calendar ? calendar.O(year, month) : computeIsoMonthCodeParts(month);
|
|
514
|
+
}
|
|
515
|
+
function computeCalendarEraFields(calendar, isoDate) {
|
|
516
|
+
return 0 === calendar ? computeGregoryEraFields(isoDate) : calendar ? calendar.h(isoDate) : {};
|
|
517
|
+
}
|
|
518
|
+
function computeCalendarIsoFieldsFromParts(calendar, year, month, day) {
|
|
519
|
+
return calendar ? calendar.je(year, month, day) : computeIsoFieldsFromParts(year, month, day);
|
|
520
|
+
}
|
|
521
|
+
function computeCalendarMonthsInYearForYear(calendar, year) {
|
|
522
|
+
return calendar ? calendar.k(year) : 12;
|
|
523
|
+
}
|
|
524
|
+
function computeCalendarDaysInMonthForYearMonth(calendar, year, month) {
|
|
525
|
+
return calendar ? calendar.p(year, month) : computeIsoDaysInMonth(year, month);
|
|
526
|
+
}
|
|
527
|
+
function computeCalendarMonthCode(calendar, isoDate) {
|
|
528
|
+
const { year, month } = computeCalendarDateFields(calendar, isoDate);
|
|
529
|
+
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
|
|
530
|
+
return formatMonthCode(monthCodeNumber, isLeapMonth);
|
|
531
|
+
}
|
|
532
|
+
function computeCalendarInLeapYear(calendar, isoDate) {
|
|
533
|
+
const { year } = computeCalendarDateFields(calendar, isoDate);
|
|
534
|
+
return calendar ? calendar.u(year) : computeIsoInLeapYear(year);
|
|
535
|
+
}
|
|
536
|
+
function computeCalendarMonthsInYear(calendar, isoDate) {
|
|
537
|
+
const { year } = computeCalendarDateFields(calendar, isoDate);
|
|
538
|
+
return computeCalendarMonthsInYearForYear(calendar, year);
|
|
539
|
+
}
|
|
540
|
+
function computeCalendarDaysInMonth(calendar, isoDate) {
|
|
541
|
+
const { year, month } = computeCalendarDateFields(calendar, isoDate);
|
|
542
|
+
return computeCalendarDaysInMonthForYearMonth(calendar, year, month);
|
|
543
|
+
}
|
|
544
|
+
function computeCalendarDaysInYear(calendar, isoDate) {
|
|
545
|
+
const { year } = computeCalendarDateFields(calendar, isoDate);
|
|
546
|
+
return calendar ? calendar.j(year) : computeIsoDaysInYear(year);
|
|
547
|
+
}
|
|
548
|
+
function computeCalendarDayOfYear(calendar, isoDate) {
|
|
549
|
+
if (!calendar) return computeIsoDayOfYear(isoDate);
|
|
550
|
+
const { year } = computeCalendarDateFields(calendar, isoDate);
|
|
551
|
+
const yearStartIsoDate = computeCalendarIsoFieldsFromParts(calendar, year, 1, 1);
|
|
552
|
+
return isoDateToEpochDays(isoDate) - isoDateToEpochDays(yearStartIsoDate) + 1;
|
|
553
|
+
}
|
|
554
|
+
function computeCalendarWeekOfYear(calendar, isoDate) {
|
|
555
|
+
return calendar === void 0 ? computeIsoWeekFields(isoDate).weekOfYear : void 0;
|
|
556
|
+
}
|
|
557
|
+
function computeCalendarYearOfWeek(calendar, isoDate) {
|
|
558
|
+
return calendar === void 0 ? computeIsoWeekFields(isoDate).yearOfWeek : void 0;
|
|
559
|
+
}
|
|
560
|
+
const durationFieldNamesAsc = /* @__PURE__ */ unitNamesAsc.map((unitName) => unitName + "s");
|
|
561
|
+
const durationGetters = /* @__PURE__ */ createPropGetters(durationFieldNamesAsc);
|
|
562
|
+
const durationFieldNamesAlpha = /* @__PURE__ */ sortStrings(durationFieldNamesAsc);
|
|
563
|
+
const durationTimeFieldNamesAsc = /* @__PURE__ */ durationFieldNamesAsc.slice(0, 6);
|
|
564
|
+
const durationDateFieldNamesAsc = /* @__PURE__ */ durationFieldNamesAsc.slice(6);
|
|
565
|
+
const durationCalendarFieldNamesAsc = /* @__PURE__ */ durationDateFieldNamesAsc.slice(1);
|
|
566
|
+
const durationFieldIndexes = /* @__PURE__ */ durationFieldNamesAsc.reduce((indexes, fieldName, i) => (indexes[fieldName] = i, indexes), {});
|
|
567
|
+
const durationFieldDefaults = /* @__PURE__ */ zipPropsConst(durationFieldNamesAsc, 0);
|
|
568
|
+
const durationTimeFieldDefaults = /* @__PURE__ */ zipPropsConst(durationTimeFieldNamesAsc, 0);
|
|
569
|
+
const clearDurationFields = /* @__PURE__ */ bindArgs(zeroOutProps, durationFieldNamesAsc);
|
|
570
|
+
function requirePropDefined(optionName, optionVal) {
|
|
571
|
+
return optionVal ?? throwRangeError(missingField(optionName)), optionVal;
|
|
572
|
+
}
|
|
573
|
+
const requireString = /* @__PURE__ */ bindArgs(requireType, "string");
|
|
574
|
+
function requireType(typeName, arg, entityName = typeName) {
|
|
575
|
+
return typeof arg !== typeName && throwTypeError(invalidEntity(entityName, arg)), arg;
|
|
576
|
+
}
|
|
577
|
+
function requireNumberIsInteger(num, entityName = "number") {
|
|
578
|
+
return Number.isInteger(num) || throwRangeError(((entityName, num) => `Non-integer ${entityName}: ${num}`)(entityName, num)), num || 0;
|
|
579
|
+
}
|
|
580
|
+
function toString(arg) {
|
|
581
|
+
return "symbol" == typeof arg && throwTypeError("Cannot convert Symbol to string"), String(arg);
|
|
582
|
+
}
|
|
583
|
+
function toStringViaPrimitive(arg, entityName) {
|
|
584
|
+
return isObjectLike$1(arg) ? String(arg) : requireString(arg, entityName);
|
|
585
|
+
}
|
|
586
|
+
function toBigInt(bi) {
|
|
587
|
+
return "boolean" == typeof bi ? BigInt(bi ? 1 : 0) : "string" == typeof bi ? BigInt(bi) : ("bigint" != typeof bi && throwTypeError(`Invalid bigint: ${bi}`), bi);
|
|
588
|
+
}
|
|
589
|
+
function toStrictInteger(arg, entityName) {
|
|
590
|
+
return requireNumberIsInteger(toFiniteNumber(arg, entityName), entityName);
|
|
591
|
+
}
|
|
592
|
+
function normalizeOptionsOrString(options, optionName) {
|
|
593
|
+
return "string" == typeof options ? ((optionName, optionVal) => {
|
|
594
|
+
const res = Object.create(null);
|
|
595
|
+
return res[optionName] = optionVal, res;
|
|
596
|
+
})(optionName, options) : requireObjectLike(options);
|
|
597
|
+
}
|
|
598
|
+
const smallestUnitStr = "smallestUnit";
|
|
599
|
+
const overflowMap = {
|
|
600
|
+
constrain: 0,
|
|
601
|
+
reject: 1
|
|
602
|
+
};
|
|
603
|
+
const epochDisambigMap = {
|
|
604
|
+
compatible: 0,
|
|
605
|
+
reject: 1,
|
|
606
|
+
earlier: 2,
|
|
607
|
+
later: 3
|
|
608
|
+
};
|
|
609
|
+
const offsetDisambigMap = {
|
|
610
|
+
reject: 0,
|
|
611
|
+
use: 1,
|
|
612
|
+
prefer: 2,
|
|
613
|
+
ignore: 3
|
|
614
|
+
};
|
|
615
|
+
const calendarDisplayMap = {
|
|
616
|
+
auto: 0,
|
|
617
|
+
never: 1,
|
|
618
|
+
critical: 2,
|
|
619
|
+
always: 3
|
|
620
|
+
};
|
|
621
|
+
const timeZoneDisplayMap = {
|
|
622
|
+
auto: 0,
|
|
623
|
+
never: 1,
|
|
624
|
+
critical: 2
|
|
625
|
+
};
|
|
626
|
+
const offsetDisplayMap = {
|
|
627
|
+
auto: 0,
|
|
628
|
+
never: 1
|
|
629
|
+
};
|
|
630
|
+
const roundingModeMap = {
|
|
631
|
+
floor: 0,
|
|
632
|
+
halfFloor: 1,
|
|
633
|
+
ceil: 2,
|
|
634
|
+
halfCeil: 3,
|
|
635
|
+
trunc: 4,
|
|
636
|
+
halfTrunc: 5,
|
|
637
|
+
expand: 6,
|
|
638
|
+
halfExpand: 7,
|
|
639
|
+
halfEven: 8
|
|
640
|
+
};
|
|
641
|
+
const roundingModeFuncs = [
|
|
642
|
+
Math.floor,
|
|
643
|
+
(num) => hasHalf(num) ? Math.floor(num) : Math.round(num),
|
|
644
|
+
Math.ceil,
|
|
645
|
+
(num) => hasHalf(num) ? Math.ceil(num) : Math.round(num),
|
|
646
|
+
Math.trunc,
|
|
647
|
+
(num) => hasHalf(num) ? Math.trunc(num) || 0 : Math.round(num),
|
|
648
|
+
(num) => num < 0 ? Math.floor(num) : Math.ceil(num),
|
|
649
|
+
(num) => Math.sign(num) * Math.round(Math.abs(num)) || 0,
|
|
650
|
+
(num) => hasHalf(num) ? (num = Math.trunc(num) || 0) + num % 2 : Math.round(num)
|
|
651
|
+
];
|
|
652
|
+
const directionMap = {
|
|
653
|
+
previous: -1,
|
|
654
|
+
next: 1
|
|
655
|
+
};
|
|
656
|
+
function coerceRoundingIncInteger(options) {
|
|
657
|
+
const roundingInc = options.roundingIncrement;
|
|
658
|
+
return void 0 === roundingInc ? 1 : toIntegerWithTrunc(roundingInc, "roundingIncrement");
|
|
659
|
+
}
|
|
660
|
+
function coerceFractionalSecondDigits(options) {
|
|
661
|
+
let subsecDigits = options.fractionalSecondDigits;
|
|
662
|
+
if (void 0 !== subsecDigits) {
|
|
663
|
+
if ("number" != typeof subsecDigits) {
|
|
664
|
+
if ("auto" === toString(subsecDigits)) return;
|
|
665
|
+
throwRangeError(invalidEntity("fractionalSecondDigits", subsecDigits));
|
|
666
|
+
}
|
|
667
|
+
subsecDigits = clampEntity("fractionalSecondDigits", Math.floor(subsecDigits), 0, 9, 1);
|
|
668
|
+
}
|
|
669
|
+
return subsecDigits;
|
|
670
|
+
}
|
|
671
|
+
function coerceUnitOption(optionName, options, minUnit = 0, ensureDefined) {
|
|
672
|
+
let unitStr = options[optionName];
|
|
673
|
+
if (void 0 === unitStr) return ensureDefined ? minUnit : void 0;
|
|
674
|
+
if (unitStr = toString(unitStr), "auto" === unitStr) return ensureDefined ? minUnit : null;
|
|
675
|
+
let unit = unitNameMap[unitStr];
|
|
676
|
+
return void 0 === unit && (unit = durationFieldIndexes[unitStr]), void 0 === unit && throwRangeError(invalidChoice(optionName, unitStr, unitNameMap)), unit;
|
|
677
|
+
}
|
|
678
|
+
function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) {
|
|
679
|
+
const enumArg = options[optionName];
|
|
680
|
+
if (void 0 === enumArg) return defaultChoice;
|
|
681
|
+
const enumStr = toString(enumArg);
|
|
682
|
+
const enumNum = enumNameMap[enumStr];
|
|
683
|
+
return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)), enumNum;
|
|
684
|
+
}
|
|
685
|
+
const coerceSmallestUnit = /* @__PURE__ */ bindArgs(coerceUnitOption, smallestUnitStr);
|
|
686
|
+
const coerceLargestUnit = /* @__PURE__ */ bindArgs(coerceUnitOption, "largestUnit");
|
|
687
|
+
const coerceTotalUnit = /* @__PURE__ */ bindArgs(coerceUnitOption, "unit");
|
|
688
|
+
const coerceOverflow = /* @__PURE__ */ bindArgs(coerceChoiceOption, "overflow", overflowMap);
|
|
689
|
+
const coerceEpochDisambig = /* @__PURE__ */ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
|
|
690
|
+
const coerceOffsetDisambig = /* @__PURE__ */ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
|
|
691
|
+
const coerceCalendarDisplay = /* @__PURE__ */ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
|
|
692
|
+
const coerceTimeZoneDisplay = /* @__PURE__ */ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
|
|
693
|
+
const coerceOffsetDisplay = /* @__PURE__ */ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
|
|
694
|
+
const coerceRoundingMode = /* @__PURE__ */ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
|
|
695
|
+
const coerceDirection = /* @__PURE__ */ bindArgs(coerceChoiceOption, "direction", directionMap);
|
|
696
|
+
function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
|
|
697
|
+
const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
|
|
698
|
+
if (upUnitNano) {
|
|
699
|
+
const unitNano = unitNanoMap[smallestUnit];
|
|
700
|
+
upUnitNano % ((roundingInc = clampEntity("roundingIncrement", roundingInc, 1, upUnitNano / unitNano - (solarMode ? 0 : 1), 1)) * unitNano) && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
701
|
+
} else roundingInc = clampEntity("roundingIncrement", roundingInc, 1, allowManyLargeUnits ? 10 ** 9 : 1, 1);
|
|
702
|
+
return roundingInc;
|
|
703
|
+
}
|
|
704
|
+
function validateUnitRange(optionName, unit, minUnit, maxUnit) {
|
|
705
|
+
return null != unit && clampEntity(optionName, unit, minUnit, maxUnit, 1, unitNamesAsc), unit;
|
|
706
|
+
}
|
|
707
|
+
function checkLargestSmallestUnit(largestUnit, smallestUnit) {
|
|
708
|
+
smallestUnit > largestUnit && throwRangeError("smallestUnit > largestUnit");
|
|
709
|
+
}
|
|
710
|
+
function refineDiffOptions(roundingModeInvert, options, defaultLargestUnit, maxUnit = 9, minUnit = 0, defaultRoundingMode = 4) {
|
|
711
|
+
options = normalizeOptions(options);
|
|
712
|
+
let largestUnit = coerceLargestUnit(options, minUnit);
|
|
713
|
+
let roundingInc = coerceRoundingIncInteger(options);
|
|
714
|
+
let roundingMode = coerceRoundingMode(options, defaultRoundingMode);
|
|
715
|
+
let smallestUnit = coerceSmallestUnit(options, minUnit, 1);
|
|
716
|
+
return largestUnit = validateUnitRange("largestUnit", largestUnit, minUnit, maxUnit), smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, minUnit, maxUnit), null == largestUnit ? largestUnit = Math.max(defaultLargestUnit, smallestUnit) : checkLargestSmallestUnit(largestUnit, smallestUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1), roundingModeInvert && (roundingMode = ((roundingMode) => roundingMode < 4 ? (roundingMode + 2) % 4 : roundingMode)(roundingMode)), [
|
|
717
|
+
largestUnit,
|
|
718
|
+
smallestUnit,
|
|
719
|
+
roundingInc,
|
|
720
|
+
roundingMode
|
|
721
|
+
];
|
|
722
|
+
}
|
|
723
|
+
function refineRoundingOptions(options, maxUnit = 6, solarMode) {
|
|
724
|
+
let roundingInc = coerceRoundingIncInteger(options = normalizeOptionsOrString(options, smallestUnitStr));
|
|
725
|
+
const roundingMode = coerceRoundingMode(options, 7);
|
|
726
|
+
let smallestUnit = coerceSmallestUnit(options);
|
|
727
|
+
return smallestUnit = requirePropDefined(smallestUnitStr, smallestUnit), smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, 0, maxUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, void 0, solarMode), [
|
|
728
|
+
smallestUnit,
|
|
729
|
+
roundingInc,
|
|
730
|
+
roundingMode
|
|
731
|
+
];
|
|
732
|
+
}
|
|
733
|
+
function combineDateAndTime(isoDate, time) {
|
|
734
|
+
return pluckProps(calendarDateFieldNamesAsc, isoDate, pluckProps(timeFieldNamesAsc, time));
|
|
735
|
+
}
|
|
736
|
+
function refineOverflowOptions(options) {
|
|
737
|
+
return void 0 === options ? 0 : coerceOverflow(requireObjectLike(options));
|
|
738
|
+
}
|
|
739
|
+
function refineZonedFieldOptions(options, defaultOffsetDisambig = 0) {
|
|
740
|
+
options = normalizeOptions(options);
|
|
741
|
+
const epochDisambig = coerceEpochDisambig(options);
|
|
742
|
+
const offsetDisambig = coerceOffsetDisambig(options, defaultOffsetDisambig);
|
|
743
|
+
return [
|
|
744
|
+
coerceOverflow(options),
|
|
745
|
+
offsetDisambig,
|
|
746
|
+
epochDisambig
|
|
747
|
+
];
|
|
748
|
+
}
|
|
749
|
+
const epochNanoMax = /* @__PURE__ */ BigInt(1e8) * bigNanoInUtcDay;
|
|
750
|
+
const epochNanoMin = /* @__PURE__ */ BigInt(-1e8) * bigNanoInUtcDay;
|
|
751
|
+
const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay;
|
|
752
|
+
const isoYearMonthIndexMin = -3261848;
|
|
753
|
+
function checkIsoYearMonthInBounds(isoDate) {
|
|
754
|
+
const isoYearMonthIndex = 12 * isoDate.year + isoDate.month;
|
|
755
|
+
return (isoYearMonthIndex < isoYearMonthIndexMin || isoYearMonthIndex > 3309129) && throwRangeError("Out-of-bounds date"), isoDate;
|
|
756
|
+
}
|
|
757
|
+
function checkIsoDateInBounds(isoDate, allowPlainDateLowerEdge = 1) {
|
|
758
|
+
return checkIsoDateEpochNanoInBounds(isoDateToEpochNano(isoDate), allowPlainDateLowerEdge), isoDate;
|
|
759
|
+
}
|
|
760
|
+
function checkIsoDateTimeInBounds(isoDateTime) {
|
|
761
|
+
const epochNano = isoDateToEpochNano(isoDateTime);
|
|
762
|
+
return checkIsoDateEpochNanoInBounds(epochNano), epochNano !== plainDateEpochNanoMin || timeFieldsToNano(isoDateTime) || throwRangeError("Out-of-bounds date"), isoDateTime;
|
|
763
|
+
}
|
|
764
|
+
function checkIsoDateEpochNanoInBounds(epochNano, allowPlainDateLowerEdge = 1) {
|
|
765
|
+
(epochNano < (allowPlainDateLowerEdge ? plainDateEpochNanoMin : epochNanoMin) || epochNano > epochNanoMax) && throwRangeError("Out-of-bounds date");
|
|
766
|
+
}
|
|
767
|
+
function checkEpochNanoInBounds(epochNano) {
|
|
768
|
+
return (epochNano < epochNanoMin || epochNano > epochNanoMax) && throwRangeError("Out-of-bounds date"), epochNano;
|
|
769
|
+
}
|
|
770
|
+
function isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano) {
|
|
771
|
+
return checkEpochNanoInBounds(isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime) - offsetNano));
|
|
772
|
+
}
|
|
773
|
+
function createEpochNanoSlots(epochNano) {
|
|
774
|
+
return { epochNanoseconds: epochNano };
|
|
775
|
+
}
|
|
776
|
+
function createZonedEpochNanoSlots(epochNano, timeZone, calendar) {
|
|
777
|
+
return {
|
|
778
|
+
calendar,
|
|
779
|
+
timeZone,
|
|
780
|
+
epochNanoseconds: epochNano
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function createDateTimeSlots(isoDateTime, calendar) {
|
|
784
|
+
return pluckProps(timeFieldNamesAsc, isoDateTime, createDateSlots(isoDateTime, calendar));
|
|
785
|
+
}
|
|
786
|
+
function createDateSlots(isoDate, calendar) {
|
|
787
|
+
return pluckProps(calendarDateFieldNamesAsc, isoDate, { calendar });
|
|
788
|
+
}
|
|
789
|
+
function createTimeSlots(time) {
|
|
790
|
+
return pluckProps(timeFieldNamesAsc, time);
|
|
791
|
+
}
|
|
792
|
+
function createDurationSlots(durationFields) {
|
|
793
|
+
return pluckProps(durationFieldNamesAsc, durationFields, { sign: computeDurationSign(durationFields) });
|
|
794
|
+
}
|
|
795
|
+
function getEpochMilli(slots) {
|
|
796
|
+
return epochNano = slots.epochNanoseconds, Number(divFloorBigInt(epochNano, bigNanoInMilli));
|
|
797
|
+
var epochNano;
|
|
798
|
+
}
|
|
799
|
+
function getEpochNano(slots) {
|
|
800
|
+
return slots.epochNanoseconds;
|
|
801
|
+
}
|
|
802
|
+
function totalDuration(refineRelativeTo, slots, options) {
|
|
803
|
+
const maxDurationUnit = getMaxDurationUnit(slots);
|
|
804
|
+
const [totalUnit, relativeToSlots] = ((options, refineRelativeTo) => {
|
|
805
|
+
const relativeToInternals = refineRelativeTo((options = normalizeOptionsOrString(options, "unit")).relativeTo);
|
|
806
|
+
let totalUnit = coerceTotalUnit(options);
|
|
807
|
+
return totalUnit = requirePropDefined("unit", totalUnit), [totalUnit, relativeToInternals];
|
|
808
|
+
})(options, refineRelativeTo);
|
|
809
|
+
if (!relativeToSlots && isUniformUnit(Math.max(totalUnit, maxDurationUnit), relativeToSlots)) return totalDayTimeDuration(slots, totalUnit);
|
|
810
|
+
if (relativeToSlots || throwRangeError("Missing relativeTo"), !slots.sign && isUniformUnit(totalUnit, relativeToSlots)) return 0;
|
|
811
|
+
const markerSpanOps = createMarkerSpanOps(relativeToSlots);
|
|
812
|
+
const endMarker = markerSpanOps.G(markerSpanOps.i, slots);
|
|
813
|
+
checkMarkerSpanInBounds(markerSpanOps, endMarker);
|
|
814
|
+
const balancedDuration = markerSpanOps.re(markerSpanOps.i, endMarker, totalUnit);
|
|
815
|
+
return isUniformUnit(totalUnit, relativeToSlots) ? totalDayTimeDuration(balancedDuration, totalUnit) : totalRelativeDuration(balancedDuration, markerSpanOps.V(endMarker), totalUnit, markerSpanOps);
|
|
816
|
+
}
|
|
817
|
+
function totalRelativeDuration(durationFields, endEpochNano, totalUnit, markerMoveOps) {
|
|
818
|
+
const sign = computeDurationSign(durationFields) || 1;
|
|
819
|
+
const nudgeWindow = clampRelativeDuration(clearDurationFields(totalUnit, durationFields), totalUnit, sign, markerMoveOps, endEpochNano);
|
|
820
|
+
const epochNano0 = nudgeWindow.ae;
|
|
821
|
+
const epochNano1 = nudgeWindow.de;
|
|
822
|
+
const denom = Number(epochNano1 - epochNano0);
|
|
823
|
+
const numerator = Number(endEpochNano - epochNano0);
|
|
824
|
+
return nudgeWindow.ye[durationFieldNamesAsc[totalUnit]] + numerator / denom * sign;
|
|
825
|
+
}
|
|
826
|
+
function totalDayTimeDuration(durationFields, totalUnit) {
|
|
827
|
+
return divideBigNanoToExactNumber(durationDayTimeToBigNano(durationFields), unitNanoMap[totalUnit]);
|
|
828
|
+
}
|
|
829
|
+
function clampRelativeDuration(durationFields, clampUnit, clampDistance, markerMoveOps, epochNanoProgress) {
|
|
830
|
+
const unitName = durationFieldNamesAsc[clampUnit];
|
|
831
|
+
let startDurationFields = durationFields;
|
|
832
|
+
let shifted = 0;
|
|
833
|
+
let window = computeRelativeDurationWindow(startDurationFields, unitName, clampDistance, markerMoveOps);
|
|
834
|
+
return epochNanoProgress && !((epochNanoProgress, epochNano0, epochNano1, sign) => sign > 0 ? compareBigInts(epochNano0, epochNanoProgress) <= 0 && compareBigInts(epochNanoProgress, epochNano1) <= 0 : compareBigInts(epochNano1, epochNanoProgress) <= 0 && compareBigInts(epochNanoProgress, epochNano0) <= 0)(epochNanoProgress, window.ae, window.de, Math.sign(clampDistance)) && (startDurationFields = {
|
|
835
|
+
...durationFields,
|
|
836
|
+
[unitName]: durationFields[unitName] + clampDistance
|
|
837
|
+
}, shifted = 1, window = computeRelativeDurationWindow(startDurationFields, unitName, clampDistance, markerMoveOps)), {
|
|
838
|
+
...window,
|
|
839
|
+
ye: startDurationFields,
|
|
840
|
+
He: shifted
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
function computeRelativeDurationWindow(startDurationFields, unitName, clampDistance, markerMoveOps) {
|
|
844
|
+
const endDurationFields = {
|
|
845
|
+
...startDurationFields,
|
|
846
|
+
[unitName]: startDurationFields[unitName] + clampDistance
|
|
847
|
+
};
|
|
848
|
+
return {
|
|
849
|
+
ae: moveMarkerToEpochNano(markerMoveOps, startDurationFields),
|
|
850
|
+
de: moveMarkerToEpochNano(markerMoveOps, endDurationFields),
|
|
851
|
+
Ae: endDurationFields
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
function computeEpochNanoFrac(epochNanoProgress, epochNano0, epochNano1) {
|
|
855
|
+
const denomBig = epochNano1 - epochNano0;
|
|
856
|
+
const numeratorBig = epochNanoProgress - epochNano0;
|
|
857
|
+
if (!numeratorBig) return 0;
|
|
858
|
+
const absNumerator = numeratorBig < 0n ? -numeratorBig : numeratorBig;
|
|
859
|
+
const absDenom = denomBig < 0n ? -denomBig : denomBig;
|
|
860
|
+
const fracSign = compareBigInts(numeratorBig, 0n) === compareBigInts(denomBig, 0n) ? 1 : -1;
|
|
861
|
+
return compareBigInts(absNumerator, absDenom) <= 0 ? absNumerator === absDenom ? fracSign : fabricateNearHalfFraction(compareBigInts(2n * absNumerator, absDenom), fracSign) : Number(numeratorBig) / Number(denomBig);
|
|
862
|
+
}
|
|
863
|
+
function roundZonedEpochSlotsToUnit(slots, smallestUnit, roundingInc, roundingMode) {
|
|
864
|
+
let { epochNanoseconds } = slots;
|
|
865
|
+
const { timeZone, calendar } = slots;
|
|
866
|
+
if (0 === smallestUnit && 1 === roundingInc) return {
|
|
867
|
+
epochNanoseconds,
|
|
868
|
+
timeZone,
|
|
869
|
+
calendar
|
|
870
|
+
};
|
|
871
|
+
if (6 === smallestUnit) {
|
|
872
|
+
const isoFields0 = combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults);
|
|
873
|
+
const isoFields1 = combineDateAndTime(moveByDays(isoFields0, 1), timeFieldDefaults);
|
|
874
|
+
const epochNano0 = getStartOfDayInstantFor(timeZone, isoFields0);
|
|
875
|
+
const epochNano1 = getStartOfDayInstantFor(timeZone, isoFields1);
|
|
876
|
+
epochNanoseconds = roundWithMode(computeEpochNanoFrac(epochNanoseconds, epochNano0, epochNano1), roundingMode) ? epochNano1 : epochNano0;
|
|
877
|
+
} else {
|
|
878
|
+
const isoDateTime = zonedEpochSlotsToIso(slots);
|
|
879
|
+
const offsetNano = isoDateTime.offsetNanoseconds;
|
|
880
|
+
epochNanoseconds = getMatchingInstantFor(timeZone, roundDateTimeToNano(isoDateTime, computeNanoInc(smallestUnit, roundingInc), roundingMode), offsetNano, 2, 0, 1);
|
|
881
|
+
}
|
|
882
|
+
return {
|
|
883
|
+
epochNanoseconds,
|
|
884
|
+
timeZone,
|
|
885
|
+
calendar
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
function computeZonedHoursInDay(slots) {
|
|
889
|
+
const { timeZone } = slots;
|
|
890
|
+
const isoFields0 = combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults);
|
|
891
|
+
const isoFields1 = combineDateAndTime(moveByDays(isoFields0, 1), timeFieldDefaults);
|
|
892
|
+
const epochNano0 = getStartOfDayInstantFor(timeZone, isoFields0);
|
|
893
|
+
return divideBigNanoToExactNumber(getStartOfDayInstantFor(timeZone, isoFields1) - epochNano0, nanoInHour);
|
|
894
|
+
}
|
|
895
|
+
function computeZonedStartOfDay(slots) {
|
|
896
|
+
const { timeZone, calendar } = slots;
|
|
897
|
+
return createZonedEpochNanoSlots(getStartOfDayInstantFor(timeZone, combineDateAndTime(zonedEpochSlotsToIso(slots), timeFieldDefaults)), timeZone, calendar);
|
|
898
|
+
}
|
|
899
|
+
function roundDateTimeToNano(isoDateTime, nanoInc, roundingMode) {
|
|
900
|
+
const [roundedTimeFields, dayDelta] = roundTimeToNano(isoDateTime, nanoInc, roundingMode);
|
|
901
|
+
const roundedIsoDateTime = combineDateAndTime(moveByDays(isoDateTime, dayDelta), roundedTimeFields);
|
|
902
|
+
return checkIsoDateTimeInBounds(roundedIsoDateTime), roundedIsoDateTime;
|
|
903
|
+
}
|
|
904
|
+
function roundTimeToNano(timeFields, nanoInc, roundingMode) {
|
|
905
|
+
return nanoToTimeAndDay(roundNumberToInc(timeFieldsToNano(timeFields), nanoInc, roundingMode));
|
|
906
|
+
}
|
|
907
|
+
function roundToMinute(offsetNano) {
|
|
908
|
+
return roundNumberToInc(offsetNano, nanoInMinute, 7);
|
|
909
|
+
}
|
|
910
|
+
function computeNanoInc(smallestUnit, roundingInc) {
|
|
911
|
+
return unitNanoMap[smallestUnit] * roundingInc;
|
|
912
|
+
}
|
|
913
|
+
function computeBigNanoInc(smallestUnit, roundingInc) {
|
|
914
|
+
return BigInt(unitNanoMap[smallestUnit]) * BigInt(roundingInc);
|
|
915
|
+
}
|
|
916
|
+
function roundDayTimeDurationByInc(durationFields, nanoInc, roundingMode) {
|
|
917
|
+
const maxUnit = Math.min(getMaxDurationUnit(durationFields), 6);
|
|
918
|
+
return nanoToDurationDayTimeFields(roundBigNanoToInc(durationDayTimeToBigNano(durationFields), BigInt(nanoInc), roundingMode), maxUnit);
|
|
919
|
+
}
|
|
920
|
+
function roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, markerMoveOps) {
|
|
921
|
+
if (0 === smallestUnit && 1 === roundingInc) return durationFields;
|
|
922
|
+
const sign = computeDurationSign(durationFields) || 1;
|
|
923
|
+
let [roundedDurationFields, roundedEpochNano, grewBigUnit] = (isUniformUnit(smallestUnit, markerMoveOps.i) ? isZonedEpochSlots(markerMoveOps.i) && smallestUnit < 6 && largestUnit >= 6 ? nudgeZonedTimeDuration : nudgeDayTimeDuration : nudgeRelativeDuration)(sign, durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, markerMoveOps);
|
|
924
|
+
return grewBigUnit && 7 !== smallestUnit && (roundedDurationFields = ((durationFields, endEpochNano, largestUnit, smallestUnit, sign, markerMoveOps) => {
|
|
925
|
+
for (let currentUnit = smallestUnit + 1; currentUnit <= largestUnit; currentUnit++) {
|
|
926
|
+
if (7 === currentUnit && 7 !== largestUnit) continue;
|
|
927
|
+
const baseDurationFields = clearDurationFields(currentUnit, durationFields);
|
|
928
|
+
baseDurationFields[durationFieldNamesAsc[currentUnit]] += sign;
|
|
929
|
+
const thresholdCompare = compareBigInts(endEpochNano, moveMarkerToEpochNano(markerMoveOps, baseDurationFields));
|
|
930
|
+
if (thresholdCompare && thresholdCompare !== sign) break;
|
|
931
|
+
durationFields = baseDurationFields;
|
|
932
|
+
}
|
|
933
|
+
return durationFields;
|
|
934
|
+
})(roundedDurationFields, roundedEpochNano, largestUnit, Math.max(6, smallestUnit), sign, markerMoveOps)), roundedDurationFields;
|
|
935
|
+
}
|
|
936
|
+
function roundBigNanoToInc(bigNano, bigNanoInc, roundingMode) {
|
|
937
|
+
return roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, bigNano / bigNanoInc % 2n);
|
|
938
|
+
}
|
|
939
|
+
function roundBigNanoToDayOriginInc(bigNano, bigNanoInc, roundingMode) {
|
|
940
|
+
const [day, timeNano] = divModFloorBigInt(bigNano, bigNanoInUtcDay);
|
|
941
|
+
const dayOriginNano = day * bigNanoInUtcDay;
|
|
942
|
+
return dayOriginNano + roundBigNanoToIncWithTail(timeNano, bigNanoInc, roundingMode, (dayOriginNano / bigNanoInc + timeNano / bigNanoInc) % 2n);
|
|
943
|
+
}
|
|
944
|
+
function roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, quotientTail) {
|
|
945
|
+
const quotient = bigNano / bigNanoInc;
|
|
946
|
+
const remainder = bigNano % bigNanoInc;
|
|
947
|
+
let fraction = 0;
|
|
948
|
+
remainder && (fraction = fabricateNearHalfFraction(compareBigInts(2n * (remainder < 0n ? -remainder : remainder), bigNanoInc), Math.sign(Number(remainder))));
|
|
949
|
+
const roundedTail = roundWithMode(Number(quotientTail) + fraction, roundingMode);
|
|
950
|
+
return (quotient - quotientTail + BigInt(roundedTail)) * bigNanoInc;
|
|
951
|
+
}
|
|
952
|
+
function roundNumberToInc(num, roundingInc, roundingMode) {
|
|
953
|
+
return roundWithMode(num / roundingInc, roundingMode) * roundingInc;
|
|
954
|
+
}
|
|
955
|
+
function roundWithMode(num, roundingMode) {
|
|
956
|
+
return roundingModeFuncs[roundingMode](num);
|
|
957
|
+
}
|
|
958
|
+
function nudgeDayTimeDuration(sign, durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
959
|
+
const bigNano = durationDayTimeToBigNano(durationFields);
|
|
960
|
+
const roundedBigNano = roundBigNanoToInc(bigNano, computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
961
|
+
const nanoDiff = roundedBigNano - bigNano;
|
|
962
|
+
const expandedBigUnit = Math.sign(Number(roundedBigNano / bigNanoInUtcDay) - Number(bigNano / bigNanoInUtcDay)) === sign;
|
|
963
|
+
const roundedDayTimeFields = nanoToDurationDayTimeFields(roundedBigNano, Math.min(largestUnit, 6));
|
|
964
|
+
return [
|
|
965
|
+
{
|
|
966
|
+
...durationFields,
|
|
967
|
+
...roundedDayTimeFields
|
|
968
|
+
},
|
|
969
|
+
endEpochNano + nanoDiff,
|
|
970
|
+
expandedBigUnit
|
|
971
|
+
];
|
|
972
|
+
}
|
|
973
|
+
function nudgeZonedTimeDuration(sign, durationFields, endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, markerMoveOps) {
|
|
974
|
+
const timeNano = Number(durationTimeToBigNano(durationFields));
|
|
975
|
+
const nanoInc = computeNanoInc(smallestUnit, roundingInc);
|
|
976
|
+
let roundedTimeNano = roundNumberToInc(timeNano, nanoInc, roundingMode);
|
|
977
|
+
const dayWindow = clampRelativeDuration({
|
|
978
|
+
...durationFields,
|
|
979
|
+
...durationTimeFieldDefaults
|
|
980
|
+
}, 6, sign, markerMoveOps, endEpochNano);
|
|
981
|
+
const dayEpochNano0 = dayWindow.ae;
|
|
982
|
+
const dayEpochNano1 = dayWindow.de;
|
|
983
|
+
const beyondDayNano = roundedTimeNano - Number(dayEpochNano1 - dayEpochNano0);
|
|
984
|
+
let dayDelta = 0;
|
|
985
|
+
beyondDayNano && Math.sign(beyondDayNano) !== sign ? endEpochNano = dayEpochNano0 + BigInt(roundedTimeNano) : (dayDelta += sign, roundedTimeNano = roundNumberToInc(beyondDayNano, nanoInc, roundingMode), endEpochNano = dayEpochNano1 + BigInt(roundedTimeNano));
|
|
986
|
+
const durationTimeFields = nanoToDurationTimeFields(roundedTimeNano);
|
|
987
|
+
return [
|
|
988
|
+
{
|
|
989
|
+
...durationFields,
|
|
990
|
+
...durationTimeFields,
|
|
991
|
+
days: durationFields.days + dayDelta
|
|
992
|
+
},
|
|
993
|
+
endEpochNano,
|
|
994
|
+
Boolean(dayDelta)
|
|
995
|
+
];
|
|
996
|
+
}
|
|
997
|
+
function nudgeRelativeDuration(sign, durationFields, endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, markerMoveOps) {
|
|
998
|
+
const smallestUnitFieldName = durationFieldNamesAsc[smallestUnit];
|
|
999
|
+
const baseDurationFields = clearDurationFields(smallestUnit, durationFields);
|
|
1000
|
+
7 === smallestUnit && (durationFields = {
|
|
1001
|
+
...durationFields,
|
|
1002
|
+
weeks: durationFields.weeks + Math.trunc(durationFields.days / 7)
|
|
1003
|
+
});
|
|
1004
|
+
baseDurationFields[smallestUnitFieldName] = divTrunc(durationFields[smallestUnitFieldName], roundingInc) * roundingInc;
|
|
1005
|
+
const nudgeWindow = clampRelativeDuration(baseDurationFields, smallestUnit, roundingInc * sign, markerMoveOps, endEpochNano);
|
|
1006
|
+
const epochNano0 = nudgeWindow.ae;
|
|
1007
|
+
const epochNano1 = nudgeWindow.de;
|
|
1008
|
+
const frac = computeEpochNanoFrac(endEpochNano, epochNano0, epochNano1);
|
|
1009
|
+
const windowStartVal = nudgeWindow.ye[smallestUnitFieldName];
|
|
1010
|
+
const windowEndVal = nudgeWindow.Ae[smallestUnitFieldName];
|
|
1011
|
+
const roundedVal = roundNumberToInc(windowStartVal + frac * sign * roundingInc, roundingInc, roundingMode);
|
|
1012
|
+
const roundedToEnd = roundedVal === windowEndVal;
|
|
1013
|
+
return baseDurationFields[smallestUnitFieldName] = roundedVal, [
|
|
1014
|
+
baseDurationFields,
|
|
1015
|
+
roundedToEnd ? epochNano1 : epochNano0,
|
|
1016
|
+
nudgeWindow.He || roundedToEnd
|
|
1017
|
+
];
|
|
1018
|
+
}
|
|
1019
|
+
function getTimeZoneTransitionEpochNanoseconds(slots, options) {
|
|
1020
|
+
return slots.timeZone.U(slots.epochNanoseconds, ((options) => {
|
|
1021
|
+
const res = coerceDirection(normalizeOptionsOrString(options, "direction"), 0);
|
|
1022
|
+
return res || throwRangeError(invalidEntity("direction", res)), res;
|
|
1023
|
+
})(options));
|
|
1024
|
+
}
|
|
1025
|
+
const zonedEpochSlotsToIso = /* @__PURE__ */ memoize(_zonedEpochSlotsToIso, WeakMap);
|
|
1026
|
+
function _zonedEpochSlotsToIso(slots) {
|
|
1027
|
+
const { epochNanoseconds, timeZone } = slots;
|
|
1028
|
+
const offsetNanoseconds = timeZone.C(epochNanoseconds);
|
|
1029
|
+
return {
|
|
1030
|
+
...epochNanoToIsoDateTime(epochNanoseconds + BigInt(offsetNanoseconds)),
|
|
1031
|
+
offsetNanoseconds
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig = 0, epochDisambig = 0, epochFuzzy, hasZ) {
|
|
1035
|
+
if (void 0 !== offsetNano && 1 === offsetDisambig && (1 === offsetDisambig || hasZ)) return isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano);
|
|
1036
|
+
2 !== offsetDisambig && 0 !== offsetDisambig || checkIsoDateInBounds(isoDateTime, 0);
|
|
1037
|
+
const possibleEpochNanos = timeZone.R(isoDateTime);
|
|
1038
|
+
if (void 0 !== offsetNano && 3 !== offsetDisambig) {
|
|
1039
|
+
const matchingEpochNano = ((possibleEpochNanos, isoDateTime, offsetNano, fuzzy) => {
|
|
1040
|
+
const zonedEpochNano = isoDateTimeToEpochNano(isoDateTime);
|
|
1041
|
+
fuzzy && (offsetNano = roundToMinute(offsetNano));
|
|
1042
|
+
for (const possibleEpochNano of possibleEpochNanos) {
|
|
1043
|
+
let possibleOffsetNano = Number(zonedEpochNano - possibleEpochNano);
|
|
1044
|
+
if (fuzzy && (possibleOffsetNano = roundToMinute(possibleOffsetNano)), possibleOffsetNano === offsetNano) return possibleEpochNano;
|
|
1045
|
+
}
|
|
1046
|
+
})(possibleEpochNanos, isoDateTime, offsetNano, epochFuzzy);
|
|
1047
|
+
if (void 0 !== matchingEpochNano) return matchingEpochNano;
|
|
1048
|
+
0 === offsetDisambig && throwRangeError("Invalid TimeZone offset");
|
|
1049
|
+
}
|
|
1050
|
+
return hasZ ? isoDateTimeToEpochNano(isoDateTime) : getSingleInstantFor(timeZone, isoDateTime, epochDisambig, possibleEpochNanos);
|
|
1051
|
+
}
|
|
1052
|
+
function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.R(isoDateTime)) {
|
|
1053
|
+
if (1 === possibleEpochNanos.length) return possibleEpochNanos[0];
|
|
1054
|
+
if (1 === disambig && throwRangeError("Ambiguous offset"), possibleEpochNanos.length) return possibleEpochNanos[3 === disambig ? 1 : 0];
|
|
1055
|
+
const zonedEpochNano = isoDateTimeToEpochNano(isoDateTime);
|
|
1056
|
+
const gapNano = ((timeZone, zonedEpochNano) => {
|
|
1057
|
+
const startOffsetNano = timeZone.C(zonedEpochNano - bigNanoInUtcDay);
|
|
1058
|
+
return ((gapNano) => (gapNano > 864e11 && throwRangeError("Out-of-bounds TimeZone gap"), gapNano))(timeZone.C(zonedEpochNano + bigNanoInUtcDay) - startOffsetNano);
|
|
1059
|
+
})(timeZone, zonedEpochNano);
|
|
1060
|
+
const shiftedIsoDateTime = epochNanoToIsoDateTime(zonedEpochNano + BigInt(gapNano * (2 === disambig ? -1 : 1)));
|
|
1061
|
+
return (possibleEpochNanos = timeZone.R(shiftedIsoDateTime))[2 === disambig ? 0 : possibleEpochNanos.length - 1];
|
|
1062
|
+
}
|
|
1063
|
+
function getStartOfDayInstantFor(timeZone, isoDateTime) {
|
|
1064
|
+
const possibleEpochNanos = timeZone.R(isoDateTime);
|
|
1065
|
+
if (possibleEpochNanos.length) return possibleEpochNanos[0];
|
|
1066
|
+
const zonedEpochNanoDayBefore = isoDateTimeToEpochNano(isoDateTime) - bigNanoInUtcDay;
|
|
1067
|
+
return timeZone.U(zonedEpochNanoDayBefore, 1);
|
|
1068
|
+
}
|
|
1069
|
+
function moveYearMonth(doSubtract, calendar, isoDateFields, durationSlots, options) {
|
|
1070
|
+
const overflow = refineOverflowOptions(options);
|
|
1071
|
+
durationSlots.sign && getMaxDurationUnit(durationSlots) < 8 && throwRangeError("Cannot use small units");
|
|
1072
|
+
return moveToStartOfMonth(calendar, dateAddWithOverflow(calendar, checkIsoDateInBounds(moveToStartOfMonth(calendar, isoDateFields)), doSubtract ? negateDurationFields(durationSlots) : durationSlots, overflow));
|
|
1073
|
+
}
|
|
1074
|
+
function moveEpochNano(epochNano, durationFields) {
|
|
1075
|
+
return checkEpochNanoInBounds(epochNano + (durationHasDateParts(fields = durationFields) && throwRangeError("Cannot use large units"), durationTimeToBigNano(fields)));
|
|
1076
|
+
var fields;
|
|
1077
|
+
}
|
|
1078
|
+
function moveZonedEpochSlots(slots, durationFields, options) {
|
|
1079
|
+
const { calendar, epochNanoseconds: epochNano, timeZone } = slots;
|
|
1080
|
+
const timeOnlyNano = durationTimeToBigNano(durationFields);
|
|
1081
|
+
let movedEpochNano = epochNano;
|
|
1082
|
+
if (durationHasDateParts(durationFields)) {
|
|
1083
|
+
const isoDateTime = zonedEpochSlotsToIso(slots);
|
|
1084
|
+
movedEpochNano = getSingleInstantFor(timeZone, combineDateAndTime(moveDate(calendar, isoDateTime, {
|
|
1085
|
+
...durationFields,
|
|
1086
|
+
...durationTimeFieldDefaults
|
|
1087
|
+
}, options), isoDateTime)) + timeOnlyNano;
|
|
1088
|
+
} else movedEpochNano += timeOnlyNano, refineOverflowOptions(options);
|
|
1089
|
+
return {
|
|
1090
|
+
...slots,
|
|
1091
|
+
epochNanoseconds: checkEpochNanoInBounds(movedEpochNano)
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
function moveDateTime(calendar, isoDateTimeFields, durationFields, options) {
|
|
1095
|
+
const [movedTimeFields, dayDelta] = moveTime(isoDateTimeFields, durationFields);
|
|
1096
|
+
const movedIsoDateTimeFields = combineDateAndTime(moveDate(calendar, isoDateTimeFields, {
|
|
1097
|
+
...durationFields,
|
|
1098
|
+
...durationTimeFieldDefaults,
|
|
1099
|
+
days: durationFields.days + dayDelta
|
|
1100
|
+
}, options), movedTimeFields);
|
|
1101
|
+
return checkIsoDateTimeInBounds(movedIsoDateTimeFields), movedIsoDateTimeFields;
|
|
1102
|
+
}
|
|
1103
|
+
function moveDate(calendar, isoDateFields, durationFields, options) {
|
|
1104
|
+
if (durationFields.years || durationFields.months || durationFields.weeks) return dateAddWithOverflow(calendar, isoDateFields, durationFields, refineOverflowOptions(options));
|
|
1105
|
+
refineOverflowOptions(options);
|
|
1106
|
+
const days = durationFields.days + Number(durationTimeToBigNano(durationFields) / bigNanoInUtcDay);
|
|
1107
|
+
return days ? checkIsoDateInBounds(moveByDays(isoDateFields, days)) : isoDateFields;
|
|
1108
|
+
}
|
|
1109
|
+
function moveToStartOfMonth(calendar, isoDateFields) {
|
|
1110
|
+
return moveByDays(isoDateFields, 1 - computeCalendarDateFields(calendar, isoDateFields).day);
|
|
1111
|
+
}
|
|
1112
|
+
function moveTime(timeFields, durationFields) {
|
|
1113
|
+
const durationBigNano = durationTimeToBigNano(durationFields);
|
|
1114
|
+
const durDays = Number(durationBigNano / bigNanoInUtcDay);
|
|
1115
|
+
const durTimeNano = Number(durationBigNano % bigNanoInUtcDay);
|
|
1116
|
+
const [newTimeFields, overflowDays] = nanoToTimeAndDay(timeFieldsToNano(timeFields) + durTimeNano);
|
|
1117
|
+
return [newTimeFields, durDays + overflowDays];
|
|
1118
|
+
}
|
|
1119
|
+
function moveByDays(isoDate, days) {
|
|
1120
|
+
return days ? epochDaysToIsoDate(isoDateToEpochDays(isoDate) + days) : isoDate;
|
|
1121
|
+
}
|
|
1122
|
+
function dateAddWithOverflow(calendar, isoDateFields, durationFields, overflow) {
|
|
1123
|
+
let { years, months, weeks, days } = durationFields;
|
|
1124
|
+
let isoDate;
|
|
1125
|
+
if (days += Number(durationTimeToBigNano(durationFields) / bigNanoInUtcDay), years || months) isoDate = addDateMonths(calendar, isoDateFields, years, months, overflow);
|
|
1126
|
+
else {
|
|
1127
|
+
if (!weeks && !days) return isoDateFields;
|
|
1128
|
+
isoDate = isoDateFields;
|
|
1129
|
+
}
|
|
1130
|
+
return (weeks || days) && (isoDate = moveByDays(isoDate, 7 * weeks + days)), checkIsoDateInBounds(isoDate);
|
|
1131
|
+
}
|
|
1132
|
+
function addDateMonths(calendar, isoDateFields, years, months, overflow) {
|
|
1133
|
+
let { year, month, day } = computeCalendarDateFields(calendar, isoDateFields);
|
|
1134
|
+
if (years) {
|
|
1135
|
+
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
|
|
1136
|
+
year += years, month = computeYearMovedMonth(calendar, monthCodeNumber, isLeapMonth, calendar ? calendar.q(year) : void 0, overflow), month = clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
|
|
1137
|
+
}
|
|
1138
|
+
if (months) {
|
|
1139
|
+
const yearMonthParts = calendar ? calendar.N(year, month, months) : addIsoMonths(year, month, months);
|
|
1140
|
+
({year: year, month: month} = yearMonthParts);
|
|
1141
|
+
}
|
|
1142
|
+
return day = clampEntity("day", day, 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow), computeCalendarIsoFieldsFromParts(calendar, year, month, day);
|
|
1143
|
+
}
|
|
1144
|
+
function computeYearMovedMonth(calendar, monthCodeNumber, isLeapMonth, targetLeapMonth, overflow) {
|
|
1145
|
+
if (isLeapMonth) {
|
|
1146
|
+
const leapMonthMeta = calendar ? calendar.m : void 0;
|
|
1147
|
+
return void 0 !== targetLeapMonth && (leapMonthMeta < 0 || targetLeapMonth === monthCodeNumber + 1) ? targetLeapMonth : (1 === overflow && throwRangeError(invalidLeapMonth), leapMonthMeta < 0 ? -leapMonthMeta : monthCodeNumber);
|
|
1148
|
+
}
|
|
1149
|
+
return monthCodeNumberToMonth(monthCodeNumber, 0, targetLeapMonth);
|
|
1150
|
+
}
|
|
1151
|
+
function getCommonCalendar(a, b) {
|
|
1152
|
+
return getCalendarSlotId(a) !== getCalendarSlotId(b) && throwRangeError("Mismatching Calendars"), a;
|
|
1153
|
+
}
|
|
1154
|
+
function getCommonTimeZone(a, b) {
|
|
1155
|
+
return a.o !== b.o && throwRangeError("Mismatching TimeZones"), a;
|
|
1156
|
+
}
|
|
1157
|
+
function getZonedTimeZoneId(slots) {
|
|
1158
|
+
return slots.timeZone.id;
|
|
1159
|
+
}
|
|
1160
|
+
function diffInstants(invert, instantSlots0, instantSlots1, options) {
|
|
1161
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 3, 5);
|
|
1162
|
+
const durationFields = diffEpochNanos(instantSlots0.epochNanoseconds, instantSlots1.epochNanoseconds, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
1163
|
+
return createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
1164
|
+
}
|
|
1165
|
+
function diffZonedDateTimes(invert, calendar, slots0, slots1, options) {
|
|
1166
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 5);
|
|
1167
|
+
const epochNano0 = slots0.epochNanoseconds;
|
|
1168
|
+
const epochNano1 = slots1.epochNanoseconds;
|
|
1169
|
+
let durationFields;
|
|
1170
|
+
return compareBigInts(epochNano1, epochNano0) ? largestUnit < 6 ? durationFields = diffEpochNanos(epochNano0, epochNano1, largestUnit, smallestUnit, roundingInc, roundingMode) : (durationFields = diffZonedEpochsExact(getCommonTimeZone(slots0.timeZone, slots1.timeZone), calendar, slots0, slots1, largestUnit), durationFields = roundRelativeDuration(durationFields, epochNano1, largestUnit, smallestUnit, roundingInc, roundingMode, createMarkerMoveOps(slots0, getEpochNano, moveZonedEpochSlots))) : durationFields = durationFieldDefaults, createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
1171
|
+
}
|
|
1172
|
+
function diffPlainDateTimes(invert, calendar, plainDateTimeSlots0, plainDateTimeSlots1, options) {
|
|
1173
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 6);
|
|
1174
|
+
const startEpochNano = isoDateTimeToEpochNano(plainDateTimeSlots0);
|
|
1175
|
+
const endEpochNano = isoDateTimeToEpochNano(plainDateTimeSlots1);
|
|
1176
|
+
const sign = compareBigInts(endEpochNano, startEpochNano);
|
|
1177
|
+
let durationFields;
|
|
1178
|
+
return sign ? largestUnit <= 6 ? durationFields = diffEpochNanos(startEpochNano, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) : (durationFields = diffDateTimesBig(calendar, plainDateTimeSlots0, plainDateTimeSlots1, sign, largestUnit), durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createMarkerMoveOps(plainDateTimeSlots0, isoDateTimeToEpochNano, bindArgs(moveDateTime, calendar)))) : durationFields = durationFieldDefaults, createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
1179
|
+
}
|
|
1180
|
+
function diffPlainDates(invert, calendar, plainDateSlots0, plainDateSlots1, options) {
|
|
1181
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 6, 9, 6);
|
|
1182
|
+
return diffDateLike(invert, calendar, plainDateSlots0, plainDateSlots1, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
1183
|
+
}
|
|
1184
|
+
function diffPlainYearMonth(invert, calendar, plainYearMonthSlots0, plainYearMonthSlots1, options) {
|
|
1185
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 9, 9, 8);
|
|
1186
|
+
const firstOfMonth0 = moveToStartOfMonth(calendar, plainYearMonthSlots0);
|
|
1187
|
+
const firstOfMonth1 = moveToStartOfMonth(calendar, plainYearMonthSlots1);
|
|
1188
|
+
return compareIsoDate(firstOfMonth0, firstOfMonth1) ? diffDateLike(invert, calendar, checkIsoDateInBounds(firstOfMonth0), checkIsoDateInBounds(firstOfMonth1), largestUnit, smallestUnit, roundingInc, roundingMode, 8) : createDurationSlots(durationFieldDefaults);
|
|
1189
|
+
}
|
|
1190
|
+
function diffDateLike(invert, calendar, startIsoDate, endIsoDate, largestUnit, smallestUnit, roundingInc, roundingMode, smallestPrecision = 6) {
|
|
1191
|
+
const startEpochNano = isoDateToEpochNano(startIsoDate);
|
|
1192
|
+
const endEpochNano = isoDateToEpochNano(endIsoDate);
|
|
1193
|
+
let durationFields;
|
|
1194
|
+
return compareBigInts(endEpochNano, startEpochNano) ? 6 === largestUnit ? durationFields = diffEpochNanos(startEpochNano, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) : (durationFields = diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit), smallestUnit === smallestPrecision && 1 === roundingInc || (durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createMarkerMoveOps(startIsoDate, isoDateToEpochNano, bindArgs(moveDate, calendar))))) : durationFields = durationFieldDefaults, createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
1195
|
+
}
|
|
1196
|
+
function diffPlainTimes(invert, plainTimeSlots0, plainTimeSlots1, options) {
|
|
1197
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode] = refineDiffOptions(invert, options, 5, 5);
|
|
1198
|
+
const timeDiffNano = roundNumberToInc(timeFieldsToNano(plainTimeSlots1) - timeFieldsToNano(plainTimeSlots0), computeNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
1199
|
+
const durationFields = {
|
|
1200
|
+
...durationFieldDefaults,
|
|
1201
|
+
...nanoToDurationTimeFields(timeDiffNano, largestUnit)
|
|
1202
|
+
};
|
|
1203
|
+
return createDurationSlots(invert ? negateDurationFields(durationFields) : durationFields);
|
|
1204
|
+
}
|
|
1205
|
+
function diffZonedEpochsExact(timeZone, calendar, slots0, slots1, largestUnit) {
|
|
1206
|
+
const sign = compareBigInts(slots1.epochNanoseconds, slots0.epochNanoseconds);
|
|
1207
|
+
if (!sign) return durationFieldDefaults;
|
|
1208
|
+
if (largestUnit < 6) return {
|
|
1209
|
+
...durationFieldDefaults,
|
|
1210
|
+
...nanoToDurationDayTimeFields(slots1.epochNanoseconds - slots0.epochNanoseconds, largestUnit)
|
|
1211
|
+
};
|
|
1212
|
+
if (!compareIsoDate(zonedEpochSlotsToIso(slots0), zonedEpochSlotsToIso(slots1))) return {
|
|
1213
|
+
...durationFieldDefaults,
|
|
1214
|
+
...nanoToDurationDayTimeFields(slots1.epochNanoseconds - slots0.epochNanoseconds, 5)
|
|
1215
|
+
};
|
|
1216
|
+
const [isoFields0, isoFields1, remainderNano] = prepareZonedEpochDiff(timeZone, slots0, slots1, sign);
|
|
1217
|
+
return {
|
|
1218
|
+
...6 === largestUnit ? {
|
|
1219
|
+
...durationFieldDefaults,
|
|
1220
|
+
days: diffDays(isoFields0, isoFields1)
|
|
1221
|
+
} : diffCalendarDates(calendar, isoFields0, isoFields1, largestUnit),
|
|
1222
|
+
...nanoToDurationTimeFields(remainderNano)
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
function diffDateTimesExact(calendar, startIsoDateTime, endIsoDateTime, largestUnit) {
|
|
1226
|
+
const startEpochNano = isoDateTimeToEpochNano(startIsoDateTime);
|
|
1227
|
+
const endEpochNano = isoDateTimeToEpochNano(endIsoDateTime);
|
|
1228
|
+
const sign = compareBigInts(endEpochNano, startEpochNano);
|
|
1229
|
+
return sign ? largestUnit <= 6 ? {
|
|
1230
|
+
...durationFieldDefaults,
|
|
1231
|
+
...nanoToDurationDayTimeFields(endEpochNano - startEpochNano, largestUnit)
|
|
1232
|
+
} : diffDateTimesBig(calendar, startIsoDateTime, endIsoDateTime, sign, largestUnit) : durationFieldDefaults;
|
|
1233
|
+
}
|
|
1234
|
+
function diffDateTimesBig(calendar, startIsoDateTime, endIsoDateTime, sign, largestUnit) {
|
|
1235
|
+
let diffEndDate = endIsoDateTime;
|
|
1236
|
+
let timeNano = timeFieldsToNano(endIsoDateTime) - timeFieldsToNano(startIsoDateTime);
|
|
1237
|
+
return Math.sign(timeNano) === -sign && (diffEndDate = moveByDays(endIsoDateTime, -sign), timeNano += 864e11 * sign), {
|
|
1238
|
+
...diffCalendarDates(calendar, startIsoDateTime, diffEndDate, largestUnit),
|
|
1239
|
+
...nanoToDurationTimeFields(timeNano)
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
function diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit) {
|
|
1243
|
+
if (largestUnit <= 7) {
|
|
1244
|
+
const days = diffDays(startIsoDate, endIsoDate);
|
|
1245
|
+
return 7 === largestUnit ? {
|
|
1246
|
+
...durationFieldDefaults,
|
|
1247
|
+
weeks: divTrunc(days, 7),
|
|
1248
|
+
days: modTrunc(days, 7)
|
|
1249
|
+
} : {
|
|
1250
|
+
...durationFieldDefaults,
|
|
1251
|
+
days
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
const yearMonthDayStart = computeCalendarDateFields(calendar, startIsoDate);
|
|
1255
|
+
const yearMonthDayEnd = computeCalendarDateFields(calendar, endIsoDate);
|
|
1256
|
+
if (8 === largestUnit) {
|
|
1257
|
+
const { year: year0, month: month0, day: day0 } = yearMonthDayStart;
|
|
1258
|
+
const { year: year1, month: month1, day: day1 } = yearMonthDayEnd;
|
|
1259
|
+
const sign = Math.sign(compareNumbers(year1, year0) || compareNumbers(month1, month0) || diffDays(startIsoDate, endIsoDate));
|
|
1260
|
+
let months = 0;
|
|
1261
|
+
let days = 0;
|
|
1262
|
+
if (sign) {
|
|
1263
|
+
months = calendar ? calendar.ne(year0, month0, year1, month1) : diffIsoMonthSlots(year0, month0, year1, month1);
|
|
1264
|
+
let anchorIsoDate = addDateMonths(calendar, startIsoDate, 0, months, 0);
|
|
1265
|
+
sign * compareNumbers(day0, day1) > 0 && (months -= sign, anchorIsoDate = addDateMonths(calendar, startIsoDate, 0, months, 0)), days = diffDays(anchorIsoDate, endIsoDate);
|
|
1266
|
+
}
|
|
1267
|
+
return {
|
|
1268
|
+
...durationFieldDefaults,
|
|
1269
|
+
months,
|
|
1270
|
+
days
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
const { year: year0, month: month0, day: day0 } = yearMonthDayStart;
|
|
1274
|
+
let { year: year1, month: month1, day: day1 } = yearMonthDayEnd;
|
|
1275
|
+
let yearDiff = year1 - year0;
|
|
1276
|
+
let monthDiff = month1 - month0;
|
|
1277
|
+
let dayDiff = day1 - day0;
|
|
1278
|
+
if (yearDiff || monthDiff) {
|
|
1279
|
+
const sign = Math.sign(yearDiff || monthDiff);
|
|
1280
|
+
let daysInMonth1 = computeCalendarDaysInMonthForYearMonth(calendar, year1, month1);
|
|
1281
|
+
let dayCorrect = 0;
|
|
1282
|
+
if (Math.sign(day1 - day0) === -sign) {
|
|
1283
|
+
const origDaysInMonth1 = daysInMonth1;
|
|
1284
|
+
const yearMonthParts = calendar ? calendar.N(year1, month1, -sign) : addIsoMonths(year1, month1, -sign);
|
|
1285
|
+
({year: year1, month: month1} = yearMonthParts), yearDiff = year1 - year0, monthDiff = month1 - month0, daysInMonth1 = computeCalendarDaysInMonthForYearMonth(calendar, year1, month1), dayCorrect = sign < 0 ? -origDaysInMonth1 : daysInMonth1;
|
|
1286
|
+
}
|
|
1287
|
+
if (dayDiff = day1 - Math.min(day0, daysInMonth1) + dayCorrect, yearDiff) {
|
|
1288
|
+
const [monthCodeNumber0, isLeapMonth0] = computeCalendarMonthCodeParts(calendar, year0, month0);
|
|
1289
|
+
const [monthCodeNumber1, isLeapMonth1] = computeCalendarMonthCodeParts(calendar, year1, month1);
|
|
1290
|
+
const leapMonthMeta = calendar ? calendar.m : void 0;
|
|
1291
|
+
if (monthDiff = void 0 !== leapMonthMeta && isLeapMonth0 && !isLeapMonth1 && (leapMonthMeta < 0 ? sign > 0 && monthCodeNumber1 === -leapMonthMeta : sign < 0 && monthCodeNumber1 === monthCodeNumber0) ? 0 : monthCodeNumber1 - monthCodeNumber0 || Number(isLeapMonth1) - Number(isLeapMonth0), Math.sign(monthDiff) === -sign) {
|
|
1292
|
+
const monthCorrect = sign < 0 && -computeCalendarMonthsInYearForYear(calendar, year1);
|
|
1293
|
+
year1 -= sign, yearDiff = year1 - year0, monthDiff = month1 - computeYearMovedMonth(calendar, monthCodeNumber0, isLeapMonth0, calendar ? calendar.q(year1) : void 0, 0) + (monthCorrect || computeCalendarMonthsInYearForYear(calendar, year1));
|
|
1294
|
+
} else if (calendar) {
|
|
1295
|
+
const month0Projected = computeYearMovedMonth(calendar, monthCodeNumber0, isLeapMonth0, calendar.q(year1), 0);
|
|
1296
|
+
monthDiff = calendar.ne(year1, month0Projected, year1, month1);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
return {
|
|
1301
|
+
...durationFieldDefaults,
|
|
1302
|
+
years: yearDiff,
|
|
1303
|
+
months: monthDiff,
|
|
1304
|
+
days: dayDiff
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
function compareIsoDate(isoDate0, isoDate1) {
|
|
1308
|
+
return compareNumbers(isoDate0.year, isoDate1.year) || compareNumbers(isoDate0.month, isoDate1.month) || compareNumbers(isoDate0.day, isoDate1.day);
|
|
1309
|
+
}
|
|
1310
|
+
function prepareZonedEpochDiff(timeZone, slots0, slots1, sign) {
|
|
1311
|
+
const startIsoDate = zonedEpochSlotsToIso(slots0);
|
|
1312
|
+
const endIsoDate = zonedEpochSlotsToIso(slots1);
|
|
1313
|
+
const endEpochNano = slots1.epochNanoseconds;
|
|
1314
|
+
let dayCorrection = 0;
|
|
1315
|
+
const timeDiffNano = timeFieldsToNano(endIsoDate) - timeFieldsToNano(startIsoDate);
|
|
1316
|
+
Math.sign(timeDiffNano) === -sign && dayCorrection++;
|
|
1317
|
+
const maxDayCorrection = dayCorrection + (sign > 0 ? 1 : 0);
|
|
1318
|
+
for (; dayCorrection <= maxDayCorrection; dayCorrection++) {
|
|
1319
|
+
const midIsoDate = moveByDays(endIsoDate, dayCorrection * -sign);
|
|
1320
|
+
const midEpochNano = getSingleInstantFor(timeZone, combineDateAndTime(midIsoDate, startIsoDate));
|
|
1321
|
+
if (compareBigInts(endEpochNano, midEpochNano) !== -sign) return [
|
|
1322
|
+
startIsoDate,
|
|
1323
|
+
midIsoDate,
|
|
1324
|
+
Number(endEpochNano - midEpochNano)
|
|
1325
|
+
];
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
function diffEpochNanos(startEpochNano, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
1329
|
+
return {
|
|
1330
|
+
...durationFieldDefaults,
|
|
1331
|
+
...nanoToDurationDayTimeFields(roundBigNanoToInc(endEpochNano - startEpochNano, computeBigNanoInc(smallestUnit, roundingInc), roundingMode), largestUnit)
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
function diffDays(startIsoDate, endIsoDate) {
|
|
1335
|
+
return isoDateToEpochDays(endIsoDate) - isoDateToEpochDays(startIsoDate);
|
|
1336
|
+
}
|
|
1337
|
+
function createMarkerMoveOps(marker, markerToEpochNano, moveMarker) {
|
|
1338
|
+
return {
|
|
1339
|
+
i: marker,
|
|
1340
|
+
V: markerToEpochNano,
|
|
1341
|
+
G: moveMarker
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
function createMarkerSpanOps(relativeToSlots) {
|
|
1345
|
+
const { calendar } = relativeToSlots;
|
|
1346
|
+
if (isZonedEpochSlots(relativeToSlots)) {
|
|
1347
|
+
const { timeZone } = relativeToSlots;
|
|
1348
|
+
return {
|
|
1349
|
+
i: relativeToSlots,
|
|
1350
|
+
V: getEpochNano,
|
|
1351
|
+
G: moveZonedEpochSlots,
|
|
1352
|
+
re: bindArgs(diffZonedEpochsExact, timeZone, calendar)
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
return {
|
|
1356
|
+
i: normalizeDateTimeMarker(relativeToSlots),
|
|
1357
|
+
V: isoDateTimeToEpochNano,
|
|
1358
|
+
G: bindArgs(moveDateTime, calendar),
|
|
1359
|
+
re: bindArgs(diffDateTimesExact, calendar)
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
function moveMarkerToEpochNano(markerMoveOps, durationFields) {
|
|
1363
|
+
return markerMoveOps.V(markerMoveOps.G(markerMoveOps.i, durationFields));
|
|
1364
|
+
}
|
|
1365
|
+
function isZonedEpochSlots(marker) {
|
|
1366
|
+
return "timeZone" in marker;
|
|
1367
|
+
}
|
|
1368
|
+
function checkMarkerSpanInBounds(markerSpanOps, endMarker) {
|
|
1369
|
+
isZonedEpochSlots(markerSpanOps.i) || (checkMarkerInBounds(markerSpanOps.i), checkMarkerInBounds(endMarker));
|
|
1370
|
+
}
|
|
1371
|
+
function normalizeDateTimeMarker(marker) {
|
|
1372
|
+
return combineDateAndTime(marker, "hour" in marker ? marker : timeFieldDefaults);
|
|
1373
|
+
}
|
|
1374
|
+
function checkMarkerInBounds(marker) {
|
|
1375
|
+
checkIsoDateTimeInBounds(normalizeDateTimeMarker(marker));
|
|
1376
|
+
}
|
|
1377
|
+
function isUniformUnit(unit, marker) {
|
|
1378
|
+
return unit <= 6 - (marker && isZonedEpochSlots(marker) ? 1 : 0);
|
|
1379
|
+
}
|
|
1380
|
+
function nanoToGivenFields(nano, largestUnit, fieldNames) {
|
|
1381
|
+
const fields = {};
|
|
1382
|
+
for (let unit = largestUnit; unit >= 0; unit--) {
|
|
1383
|
+
const divisor = unitNanoMap[unit];
|
|
1384
|
+
fields[fieldNames[unit]] = divTrunc(nano, divisor), nano = modTrunc(nano, divisor);
|
|
1385
|
+
}
|
|
1386
|
+
return fields;
|
|
1387
|
+
}
|
|
1388
|
+
const maxDurationSeconds = 2 ** 53;
|
|
1389
|
+
function addDurations(refineRelativeTo, doSubtract, slots, otherSlots, options) {
|
|
1390
|
+
const relativeToSlots = refineRelativeTo(normalizeOptions(options).relativeTo);
|
|
1391
|
+
const maxUnit = Math.max(getMaxDurationUnit(slots), getMaxDurationUnit(otherSlots));
|
|
1392
|
+
if (isUniformUnit(maxUnit, relativeToSlots)) return addDayTimeDurationsChecked(doSubtract, slots, otherSlots, maxUnit);
|
|
1393
|
+
relativeToSlots || throwRangeError("Missing relativeTo"), doSubtract && (otherSlots = negateDurationFields(otherSlots));
|
|
1394
|
+
const markerSpanOps = createMarkerSpanOps(relativeToSlots);
|
|
1395
|
+
const midMarker = markerSpanOps.G(markerSpanOps.i, slots);
|
|
1396
|
+
const endMarker = markerSpanOps.G(midMarker, otherSlots);
|
|
1397
|
+
return createDurationSlots(markerSpanOps.re(markerSpanOps.i, endMarker, maxUnit));
|
|
1398
|
+
}
|
|
1399
|
+
function addDayTimeDurationsChecked(doSubtract, slots, otherSlots, maxUnit) {
|
|
1400
|
+
return createDurationSlots(validateDurationFields(((a, b, largestUnit, doSubtract) => {
|
|
1401
|
+
const combined = durationDayTimeToBigNano(a) + durationDayTimeToBigNano(b) * BigInt(doSubtract ? -1 : 1);
|
|
1402
|
+
return Number.isFinite(Number(combined / bigNanoInUtcDay)) || throwRangeError("Out-of-bounds date"), {
|
|
1403
|
+
...durationFieldDefaults,
|
|
1404
|
+
...nanoToDurationDayTimeFields(combined, largestUnit)
|
|
1405
|
+
};
|
|
1406
|
+
})(slots, otherSlots, maxUnit, doSubtract)));
|
|
1407
|
+
}
|
|
1408
|
+
function roundDuration(refineRelativeTo, slots, options) {
|
|
1409
|
+
const durationLargestUnit = getMaxDurationUnit(slots);
|
|
1410
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode, relativeToSlots] = ((options, defaultLargestUnit, refineRelativeTo) => {
|
|
1411
|
+
options = normalizeOptionsOrString(options, smallestUnitStr);
|
|
1412
|
+
let largestUnit = coerceLargestUnit(options);
|
|
1413
|
+
const relativeToInternals = refineRelativeTo(options.relativeTo);
|
|
1414
|
+
let roundingInc = coerceRoundingIncInteger(options);
|
|
1415
|
+
const roundingMode = coerceRoundingMode(options, 7);
|
|
1416
|
+
let smallestUnit = coerceSmallestUnit(options);
|
|
1417
|
+
return void 0 === largestUnit && void 0 === smallestUnit && throwRangeError("Required smallestUnit or largestUnit"), smallestUnit ??= 0, largestUnit ??= Math.max(smallestUnit, defaultLargestUnit), checkLargestSmallestUnit(largestUnit, smallestUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1), roundingInc > 1 && smallestUnit > 5 && largestUnit !== smallestUnit && throwRangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit"), [
|
|
1418
|
+
largestUnit,
|
|
1419
|
+
smallestUnit,
|
|
1420
|
+
roundingInc,
|
|
1421
|
+
roundingMode,
|
|
1422
|
+
relativeToInternals
|
|
1423
|
+
];
|
|
1424
|
+
})(options, durationLargestUnit, refineRelativeTo);
|
|
1425
|
+
if (!relativeToSlots && Math.max(durationLargestUnit, largestUnit) <= 6) return createDurationSlots(validateDurationFields(((durationFields, largestUnit, smallestUnit, roundingInc, roundingMode) => {
|
|
1426
|
+
const roundedBigNano = roundBigNanoToInc(durationDayTimeToBigNano(durationFields), computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
1427
|
+
return {
|
|
1428
|
+
...durationFieldDefaults,
|
|
1429
|
+
...nanoToDurationDayTimeFields(roundedBigNano, largestUnit)
|
|
1430
|
+
};
|
|
1431
|
+
})(slots, largestUnit, smallestUnit, roundingInc, roundingMode)));
|
|
1432
|
+
const needsZonedDayLength = relativeToSlots && isZonedEpochSlots(relativeToSlots) && largestUnit >= 6 && smallestUnit < 6;
|
|
1433
|
+
if (!slots.sign && !needsZonedDayLength) return slots;
|
|
1434
|
+
relativeToSlots || throwRangeError("Missing relativeTo");
|
|
1435
|
+
const markerSpanOps = createMarkerSpanOps(relativeToSlots);
|
|
1436
|
+
const endMarker = markerSpanOps.G(markerSpanOps.i, slots);
|
|
1437
|
+
checkMarkerSpanInBounds(markerSpanOps, endMarker);
|
|
1438
|
+
let balancedDuration = markerSpanOps.re(markerSpanOps.i, endMarker, largestUnit);
|
|
1439
|
+
return balancedDuration = roundRelativeDuration(balancedDuration, markerSpanOps.V(endMarker), largestUnit, smallestUnit, roundingInc, roundingMode, markerSpanOps), createDurationSlots(balancedDuration);
|
|
1440
|
+
}
|
|
1441
|
+
function absDuration(slots) {
|
|
1442
|
+
return -1 === slots.sign ? negateDuration(slots) : slots;
|
|
1443
|
+
}
|
|
1444
|
+
function negateDuration(slots) {
|
|
1445
|
+
return createDurationSlots(negateDurationFields(slots));
|
|
1446
|
+
}
|
|
1447
|
+
function negateDurationFields(fields) {
|
|
1448
|
+
const res = {};
|
|
1449
|
+
for (const fieldName of durationFieldNamesAsc) res[fieldName] = -1 * fields[fieldName] || 0;
|
|
1450
|
+
return res;
|
|
1451
|
+
}
|
|
1452
|
+
function computeDurationSign(fields, fieldNames = durationFieldNamesAsc) {
|
|
1453
|
+
let sign = 0;
|
|
1454
|
+
for (const fieldName of fieldNames) {
|
|
1455
|
+
const fieldSign = Math.sign(fields[fieldName]);
|
|
1456
|
+
fieldSign && (sign && sign !== fieldSign && throwRangeError("Cannot mix duration signs"), sign = fieldSign);
|
|
1457
|
+
}
|
|
1458
|
+
return sign;
|
|
1459
|
+
}
|
|
1460
|
+
function validateDurationFields(fields) {
|
|
1461
|
+
for (const calendarUnit of durationCalendarFieldNamesAsc) clampEntity(calendarUnit, fields[calendarUnit], -4294967295, 4294967295, 1);
|
|
1462
|
+
const bigNano = durationDayTimeToBigNano(fields);
|
|
1463
|
+
return validateDurationTimeUnit(Number(bigNano / bigNanoInSec)), fields;
|
|
1464
|
+
}
|
|
1465
|
+
function validateDurationTimeUnit(n) {
|
|
1466
|
+
Number.isSafeInteger(n) || throwRangeError("Out-of-bounds duration");
|
|
1467
|
+
}
|
|
1468
|
+
function durationDayTimeToBigNano(fields) {
|
|
1469
|
+
return BigInt(fields.days) * bigNanoInUtcDay + durationTimeToBigNano(fields);
|
|
1470
|
+
}
|
|
1471
|
+
function durationTimeToBigNano(fields) {
|
|
1472
|
+
return BigInt(fields.hours) * bigNanoInHour + BigInt(fields.minutes) * bigNanoInMinute + durationSubMinuteToBigNano(fields);
|
|
1473
|
+
}
|
|
1474
|
+
function durationSubMinuteToBigNano(fields) {
|
|
1475
|
+
return BigInt(fields.seconds) * bigNanoInSec + BigInt(fields.milliseconds) * bigNanoInMilli + BigInt(fields.microseconds) * bigNanoInMicro + BigInt(fields.nanoseconds);
|
|
1476
|
+
}
|
|
1477
|
+
function nanoToDurationDayTimeFields(bigNano, largestUnit = 6) {
|
|
1478
|
+
const days = Number(bigNano / bigNanoInUtcDay);
|
|
1479
|
+
const timeNano = Number(bigNano % bigNanoInUtcDay);
|
|
1480
|
+
const unitNano = unitNanoMap[largestUnit];
|
|
1481
|
+
const largestUnitVal = largestUnit <= 3 ? Number(bigNano / BigInt(unitNano)) : days * (nanoInUtcDay / unitNano) + divTrunc(timeNano, unitNano);
|
|
1482
|
+
Number.isFinite(largestUnitVal) || throwRangeError("Out-of-bounds date"), largestUnit <= 3 && Math.abs(largestUnitVal) / (nanoInSec / unitNanoMap[largestUnit]) >= maxDurationSeconds && throwRangeError("Out-of-bounds date");
|
|
1483
|
+
const dayTimeFields = nanoToGivenFields(timeNano, largestUnit, durationFieldNamesAsc);
|
|
1484
|
+
return dayTimeFields[durationFieldNamesAsc[largestUnit]] = largestUnitVal, dayTimeFields;
|
|
1485
|
+
}
|
|
1486
|
+
function nanoToDurationTimeFields(nano, largestUnit = 5) {
|
|
1487
|
+
return nanoToGivenFields(nano, largestUnit, durationFieldNamesAsc);
|
|
1488
|
+
}
|
|
1489
|
+
function durationHasDateParts(fields) {
|
|
1490
|
+
return Boolean(computeDurationSign(fields, durationDateFieldNamesAsc));
|
|
1491
|
+
}
|
|
1492
|
+
function getMaxDurationUnit(fields) {
|
|
1493
|
+
let unit = 9;
|
|
1494
|
+
for (; unit > 0 && !fields[durationFieldNamesAsc[unit]]; unit--);
|
|
1495
|
+
return unit;
|
|
1496
|
+
}
|
|
1497
|
+
function compareInstants(instantSlots0, instantSlots1) {
|
|
1498
|
+
return compareBigInts(instantSlots0.epochNanoseconds, instantSlots1.epochNanoseconds);
|
|
1499
|
+
}
|
|
1500
|
+
function compareZonedDateTimes(zonedDateTimeSlots0, zonedDateTimeSlots1) {
|
|
1501
|
+
return compareBigInts(zonedDateTimeSlots0.epochNanoseconds, zonedDateTimeSlots1.epochNanoseconds);
|
|
1502
|
+
}
|
|
1503
|
+
function compareDurations(refineRelativeTo, durationSlots0, durationSlots1, options) {
|
|
1504
|
+
const relativeToSlots = refineRelativeTo(normalizeOptions(options).relativeTo);
|
|
1505
|
+
const maxUnit = Math.max(getMaxDurationUnit(durationSlots0), getMaxDurationUnit(durationSlots1));
|
|
1506
|
+
if (allPropsEqual(durationFieldNamesAsc, durationSlots0, durationSlots1)) return 0;
|
|
1507
|
+
if (isUniformUnit(maxUnit, relativeToSlots)) return compareBigInts(durationDayTimeToBigNano(durationSlots0), durationDayTimeToBigNano(durationSlots1));
|
|
1508
|
+
relativeToSlots || throwRangeError("Missing relativeTo");
|
|
1509
|
+
const markerSpanOps = createMarkerSpanOps(relativeToSlots);
|
|
1510
|
+
return compareBigInts(moveMarkerToEpochNano(markerSpanOps, durationSlots0), moveMarkerToEpochNano(markerSpanOps, durationSlots1));
|
|
1511
|
+
}
|
|
1512
|
+
function compareIsoDateTimeFields(isoDateTime0, isoDateTime1) {
|
|
1513
|
+
return compareIsoDateFields(isoDateTime0, isoDateTime1) || compareTimeFields(isoDateTime0, isoDateTime1);
|
|
1514
|
+
}
|
|
1515
|
+
function compareIsoDateFields(isoFields0, isoFields1) {
|
|
1516
|
+
return compareNumbers(isoDateToEpochDays(isoFields0), isoDateToEpochDays(isoFields1));
|
|
1517
|
+
}
|
|
1518
|
+
function compareTimeFields(isoFields0, isoFields1) {
|
|
1519
|
+
return compareNumbers(timeFieldsToNano(isoFields0), timeFieldsToNano(isoFields1));
|
|
1520
|
+
}
|
|
1521
|
+
function instantsEqual(instantSlots0, instantSlots1) {
|
|
1522
|
+
return !compareInstants(instantSlots0, instantSlots1);
|
|
1523
|
+
}
|
|
1524
|
+
function zonedDateTimesEqual(zonedDateTimeSlots0, zonedDateTimeSlots1) {
|
|
1525
|
+
return !compareZonedDateTimes(zonedDateTimeSlots0, zonedDateTimeSlots1) && zonedDateTimeSlots0.timeZone.o === zonedDateTimeSlots1.timeZone.o && zonedDateTimeSlots0.calendar === zonedDateTimeSlots1.calendar;
|
|
1526
|
+
}
|
|
1527
|
+
function plainDateTimesEqual(plainDateTimeSlots0, plainDateTimeSlots1) {
|
|
1528
|
+
return !compareIsoDateTimeFields(plainDateTimeSlots0, plainDateTimeSlots1) && plainDateTimeSlots0.calendar === plainDateTimeSlots1.calendar;
|
|
1529
|
+
}
|
|
1530
|
+
function plainDatesEqual(plainDateSlots0, plainDateSlots1) {
|
|
1531
|
+
return !compareIsoDateFields(plainDateSlots0, plainDateSlots1) && plainDateSlots0.calendar === plainDateSlots1.calendar;
|
|
1532
|
+
}
|
|
1533
|
+
function plainYearMonthsEqual(plainYearMonthSlots0, plainYearMonthSlots1) {
|
|
1534
|
+
return !compareIsoDateFields(plainYearMonthSlots0, plainYearMonthSlots1) && plainYearMonthSlots0.calendar === plainYearMonthSlots1.calendar;
|
|
1535
|
+
}
|
|
1536
|
+
function plainMonthDaysEqual(plainMonthDaySlots0, plainMonthDaySlots1) {
|
|
1537
|
+
return !compareIsoDateFields(plainMonthDaySlots0, plainMonthDaySlots1) && plainMonthDaySlots0.calendar === plainMonthDaySlots1.calendar;
|
|
1538
|
+
}
|
|
1539
|
+
function plainTimesEqual(plainTimeSlots0, plainTimeSlots1) {
|
|
1540
|
+
return !compareTimeFields(plainTimeSlots0, plainTimeSlots1);
|
|
1541
|
+
}
|
|
1542
|
+
function getCalendarEraOrigins(calendar) {
|
|
1543
|
+
return 0 === calendar ? gregoryEraOrigins : calendar ? calendar.l : void 0;
|
|
1544
|
+
}
|
|
1545
|
+
function getCalendarFieldNames(calendar, fieldNames, fieldNamesWithEra = fieldNames) {
|
|
1546
|
+
return getCalendarEraOrigins(calendar) ? fieldNamesWithEra : fieldNames;
|
|
1547
|
+
}
|
|
1548
|
+
function resolveCalendarYear(calendar, fields) {
|
|
1549
|
+
const exoticCalendar = calendar || void 0;
|
|
1550
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
1551
|
+
let { era, eraYear, year } = fields;
|
|
1552
|
+
if (void 0 !== year && (year = toIntegerWithTrunc(year, "year")), void 0 !== eraYear && (eraYear = toIntegerWithTrunc(eraYear, "eraYear")), void 0 !== era || void 0 !== eraYear) {
|
|
1553
|
+
void 0 !== era && void 0 !== eraYear || throwTypeError("Mismatching era/eraYear"), eraOrigins || throwRangeError("Forbidden era/eraYear");
|
|
1554
|
+
const normalizedEra = normalizeEraName(era);
|
|
1555
|
+
const eraOrigin = eraOrigins[normalizedEra];
|
|
1556
|
+
void 0 === eraOrigin && throwRangeError(((era) => `Invalid era: ${era}`)(era));
|
|
1557
|
+
const yearByEra = exoticCalendar?.te ? exoticCalendar.te(eraYear, normalizedEra, eraOrigin) : eraYearToYear(eraYear, eraOrigin);
|
|
1558
|
+
void 0 !== year && year !== yearByEra && throwRangeError("Mismatching year/eraYear"), year = yearByEra;
|
|
1559
|
+
} else void 0 === year && throwTypeError(missingYear(eraOrigins));
|
|
1560
|
+
return year;
|
|
1561
|
+
}
|
|
1562
|
+
function resolveCalendarMonth(calendar, fields, year, overflow, monthCodeParts) {
|
|
1563
|
+
let { month, monthCode } = fields;
|
|
1564
|
+
if (void 0 !== monthCode) {
|
|
1565
|
+
const monthByCode = ((calendar, monthCode, year, overflow, monthCodeParts = parseMonthCode(monthCode)) => {
|
|
1566
|
+
const leapMonth = calendar ? calendar.q(year) : void 0;
|
|
1567
|
+
const [monthCodeNumber, wantsLeapMonth] = monthCodeParts;
|
|
1568
|
+
let month = monthCodeNumberToMonth(monthCodeNumber, wantsLeapMonth, leapMonth);
|
|
1569
|
+
if (wantsLeapMonth) {
|
|
1570
|
+
const leapMonthMeta = calendar ? calendar.m : void 0;
|
|
1571
|
+
void 0 === leapMonthMeta && throwRangeError(invalidLeapMonth), leapMonthMeta > 0 ? (month > leapMonthMeta && throwRangeError(invalidLeapMonth), leapMonth !== month && (1 === overflow && throwRangeError(invalidLeapMonth), month = monthCodeNumberToMonth(monthCodeNumber, 0, leapMonth))) : (month !== -leapMonthMeta && throwRangeError(invalidLeapMonth), void 0 === leapMonth && 1 === overflow && throwRangeError(invalidLeapMonth));
|
|
1572
|
+
}
|
|
1573
|
+
return month;
|
|
1574
|
+
})(calendar, monthCode, year, overflow, monthCodeParts);
|
|
1575
|
+
void 0 !== month && month !== monthByCode && throwRangeError("Mismatching month/monthCode"), month = monthByCode, overflow = 1;
|
|
1576
|
+
} else void 0 === month && throwTypeError("Missing month/monthCode");
|
|
1577
|
+
return clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
|
|
1578
|
+
}
|
|
1579
|
+
function resolveCalendarDay(calendar, fields, month, year, overflow) {
|
|
1580
|
+
return clampProp(fields, "day", 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow);
|
|
1581
|
+
}
|
|
1582
|
+
function eraYearToYear(eraYear, eraOrigin) {
|
|
1583
|
+
return (eraOrigin + eraYear) * (Math.sign(eraOrigin) || 1) || 0;
|
|
1584
|
+
}
|
|
1585
|
+
function resolveTimeFields(fields, overflow) {
|
|
1586
|
+
return constrainTimeFields(pluckProps(timeFieldNamesAsc, {
|
|
1587
|
+
...timeFieldDefaults,
|
|
1588
|
+
...fields
|
|
1589
|
+
}), overflow);
|
|
1590
|
+
}
|
|
1591
|
+
const offsetRegExp = /* @__PURE__ */ createRegExp("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?");
|
|
1592
|
+
function parseOffsetNano(s) {
|
|
1593
|
+
const offsetNano = parseOffsetNanoMaybe(s);
|
|
1594
|
+
return void 0 === offsetNano && throwRangeError(failedParse(s)), offsetNano;
|
|
1595
|
+
}
|
|
1596
|
+
function parseOffsetNanoMaybe(s, onlyHourMinute) {
|
|
1597
|
+
const parts = offsetRegExp.exec(s);
|
|
1598
|
+
if (parts && ((s) => ((s) => {
|
|
1599
|
+
"T" !== s[0] && "t" !== s[0] || (s = s.slice(1));
|
|
1600
|
+
const fractionIndex = s.search(/[.,]/);
|
|
1601
|
+
const main = fractionIndex < 0 ? s : s.slice(0, fractionIndex);
|
|
1602
|
+
const parts = main.split(":");
|
|
1603
|
+
return 1 === parts.length ? /^(?:\d{2}|\d{4}|\d{6})$/i.test(main) : (2 === parts.length || 3 === parts.length) && parts.every((part) => 2 === part.length && /^\d{2}$/i.test(part));
|
|
1604
|
+
})(s.slice(1)))(parts[0])) return ((parts, onlyHourMinute) => {
|
|
1605
|
+
const firstSubMinutePart = parts[4] || parts[5];
|
|
1606
|
+
onlyHourMinute && firstSubMinutePart && throwRangeError(invalidSubstring(firstSubMinutePart));
|
|
1607
|
+
return offsetNano = (parseInt0(parts[2]) * nanoInHour + parseInt0(parts[3]) * nanoInMinute + parseInt0(parts[4]) * nanoInSec + parseSubsecNano(parts[5] || "")) * parseSign(parts[1]), Math.abs(offsetNano) >= 864e11 && throwRangeError("Out-of-bounds offset"), offsetNano;
|
|
1608
|
+
var offsetNano;
|
|
1609
|
+
})(parts, onlyHourMinute);
|
|
1610
|
+
}
|
|
1611
|
+
const dateFieldRefiners = {
|
|
1612
|
+
era: toStringViaPrimitive,
|
|
1613
|
+
month: toPositiveIntegerWithTruncation,
|
|
1614
|
+
monthCode(monthCode, entityName = "monthCode") {
|
|
1615
|
+
return ((monthCode, entityName) => {
|
|
1616
|
+
if ("string" == typeof monthCode) return monthCode;
|
|
1617
|
+
if (monthCode && "object" == typeof monthCode) {
|
|
1618
|
+
const monthCodeToString = monthCode.toString;
|
|
1619
|
+
if ("function" == typeof monthCodeToString) return requireString(monthCodeToString.call(monthCode), entityName);
|
|
1620
|
+
}
|
|
1621
|
+
return requireString(monthCode, entityName);
|
|
1622
|
+
})(monthCode, entityName);
|
|
1623
|
+
},
|
|
1624
|
+
day: toPositiveIntegerWithTruncation
|
|
1625
|
+
};
|
|
1626
|
+
const timeFieldRefiners = /* @__PURE__ */ zipPropsConst(timeFieldNamesAsc, toIntegerWithTrunc);
|
|
1627
|
+
const durationFieldRefiners = /* @__PURE__ */ zipPropsConst(durationFieldNamesAsc, toStrictInteger);
|
|
1628
|
+
const offsetFieldRefiners = { offset(offsetString) {
|
|
1629
|
+
return parseOffsetNano(toStringViaPrimitive(offsetString));
|
|
1630
|
+
} };
|
|
1631
|
+
const dateTimeFieldRefiners = /* @__PURE__ */ Object.assign({}, dateFieldRefiners, timeFieldRefiners);
|
|
1632
|
+
const zonedDateTimeFieldRefiners = /* @__PURE__ */ Object.assign({}, dateTimeFieldRefiners, offsetFieldRefiners);
|
|
1633
|
+
function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFieldNames, disallowEmpty = !requiredFieldNames) {
|
|
1634
|
+
const res = {};
|
|
1635
|
+
let anyMatching = 0;
|
|
1636
|
+
for (const fieldName of validFieldNames) {
|
|
1637
|
+
let fieldVal = bag[fieldName];
|
|
1638
|
+
if (void 0 !== fieldVal) {
|
|
1639
|
+
anyMatching = 1;
|
|
1640
|
+
const refiner = fieldRefiners[fieldName];
|
|
1641
|
+
refiner && (fieldVal = refiner(fieldVal, fieldName)), res[fieldName] = fieldVal;
|
|
1642
|
+
} else requiredFieldNames && requiredFieldNames.includes(fieldName) && throwTypeError(missingField(fieldName));
|
|
1643
|
+
}
|
|
1644
|
+
return disallowEmpty && !anyMatching && throwTypeError(noValidFields(validFieldNames)), res;
|
|
1645
|
+
}
|
|
1646
|
+
function createPlainDateTimeFromRefinedFields(isoDate, time = timeFieldDefaults, calendar) {
|
|
1647
|
+
const isoDateTime = combineDateAndTime(isoDate, time);
|
|
1648
|
+
return checkIsoDateTimeInBounds(isoDateTime), createDateTimeSlots(isoDateTime, calendar);
|
|
1649
|
+
}
|
|
1650
|
+
function createPlainDateFromFields(calendar, fields, options) {
|
|
1651
|
+
return createPlainDateFromPreparedFields(calendar, fields, prepareDateFields(calendar, fields), refineOverflowOptions(options));
|
|
1652
|
+
}
|
|
1653
|
+
function createPlainDateFromFieldsWithOptionsRefiner(calendar, fields, refineOptions) {
|
|
1654
|
+
const prepared = prepareDateFields(calendar, fields);
|
|
1655
|
+
const refinedOptions = refineOptions();
|
|
1656
|
+
return [createPlainDateFromPreparedFields(calendar, fields, prepared, refinedOptions[0]), ...refinedOptions];
|
|
1657
|
+
}
|
|
1658
|
+
function createPlainDateFromPreparedFields(calendar, fields, prepared, overflow) {
|
|
1659
|
+
const year = prepared[1];
|
|
1660
|
+
const month = resolveCalendarMonth(calendar, fields, year, overflow, prepared[0]);
|
|
1661
|
+
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, resolveCalendarDay(calendar, fields, month, year, overflow))), calendar);
|
|
1662
|
+
}
|
|
1663
|
+
function parseMonthCodeField(fields) {
|
|
1664
|
+
if (void 0 !== fields.monthCode) return parseMonthCode(fields.monthCode);
|
|
1665
|
+
}
|
|
1666
|
+
function prepareDateFields(calendar, fields) {
|
|
1667
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
1668
|
+
return void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)), void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode"), void 0 === fields.day && throwTypeError(missingField("day")), [parseMonthCodeField(fields), resolveCalendarYear(calendar, fields)];
|
|
1669
|
+
}
|
|
1670
|
+
function createPlainYearMonthFromFields(calendar, fields, options) {
|
|
1671
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
1672
|
+
void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)), void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode");
|
|
1673
|
+
const monthCodeParts = parseMonthCodeField(fields);
|
|
1674
|
+
const year = resolveCalendarYear(calendar, fields);
|
|
1675
|
+
return createDateSlots(checkIsoYearMonthInBounds(computeCalendarIsoFieldsFromParts(calendar, year, resolveCalendarMonth(calendar, fields, year, refineOverflowOptions(options), monthCodeParts), 1)), calendar);
|
|
1676
|
+
}
|
|
1677
|
+
function createPlainMonthDayFromFields(calendar, fields, options) {
|
|
1678
|
+
const isIso = calendar === void 0;
|
|
1679
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
1680
|
+
void 0 === fields.day && throwTypeError(missingField("day")), isIso || void 0 === fields.month || void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins));
|
|
1681
|
+
const monthCodeParts = parseMonthCodeField(fields);
|
|
1682
|
+
let yearMaybe = void 0 !== fields.eraYear || void 0 !== fields.year ? resolveCalendarYear(calendar, fields) : void 0;
|
|
1683
|
+
const overflow = refineOverflowOptions(options);
|
|
1684
|
+
let day;
|
|
1685
|
+
let monthCodeNumber;
|
|
1686
|
+
let isLeapMonth;
|
|
1687
|
+
if (void 0 === yearMaybe && isIso && (yearMaybe = 1972), void 0 !== yearMaybe) {
|
|
1688
|
+
isIso || checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, yearMaybe, 1, 1));
|
|
1689
|
+
const month = resolveCalendarMonth(calendar, fields, yearMaybe, overflow, monthCodeParts);
|
|
1690
|
+
day = resolveCalendarDay(calendar, fields, month, yearMaybe, overflow), [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, yearMaybe, month);
|
|
1691
|
+
} else {
|
|
1692
|
+
void 0 === fields.monthCode && throwTypeError("Missing month/monthCode"), [monthCodeNumber, isLeapMonth] = monthCodeParts;
|
|
1693
|
+
const referenceYear = calendar ? calendar.ge : 1972;
|
|
1694
|
+
if (void 0 !== referenceYear) day = resolveCalendarDay(calendar, fields, resolveCalendarMonth(calendar, fields, referenceYear, overflow, monthCodeParts), referenceYear, overflow);
|
|
1695
|
+
else {
|
|
1696
|
+
const constrainedDay = 0 === overflow && calendar ? calendar.ke?.(monthCodeNumber, isLeapMonth, fields.day) : void 0;
|
|
1697
|
+
day = void 0 !== constrainedDay ? constrainedDay : fields.day;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
isLeapMonth && ((calendar && calendar.Z?.[monthCodeNumber]) ?? Infinity) < fields.day && (1 === overflow && throwRangeError(invalidLeapMonth), isLeapMonth = 0, day = constrainToRange(fields.day, 1, (calendar && calendar.X) ?? Infinity));
|
|
1701
|
+
let res = calendar ? calendar.v(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
|
|
1702
|
+
for (; !res && 0 === overflow && day > 1;) day--, res = calendar ? calendar.v(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
|
|
1703
|
+
res || throwRangeError("Cannot guess year");
|
|
1704
|
+
const { year: finalYear, month: finalMonth } = res;
|
|
1705
|
+
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, finalYear, finalMonth, day)), calendar);
|
|
1706
|
+
}
|
|
1707
|
+
const RawDateTimeFormat = Intl.DateTimeFormat;
|
|
1708
|
+
function formatEpochMilliToPartsRecord(intlFormat, epochMilli) {
|
|
1709
|
+
epochMilli < -864e13 && throwRangeError("Out-of-bounds date");
|
|
1710
|
+
const parts = intlFormat.formatToParts(epochMilli);
|
|
1711
|
+
const hash = {};
|
|
1712
|
+
for (const part of parts) hash[part.type] = part.value;
|
|
1713
|
+
return hash;
|
|
1714
|
+
}
|
|
1715
|
+
const timeZonePeriodDaysByName = {
|
|
1716
|
+
"El_Aaiun": 17,
|
|
1717
|
+
"Tucuman": 12,
|
|
1718
|
+
"Tirane": 11,
|
|
1719
|
+
"Riga": 10,
|
|
1720
|
+
"Simferopol": 9,
|
|
1721
|
+
"Vienna": 9,
|
|
1722
|
+
"Tunis": 8,
|
|
1723
|
+
"Boa_Vista": 6,
|
|
1724
|
+
"Fortaleza": 6,
|
|
1725
|
+
"Maceio": 6,
|
|
1726
|
+
"Noronha": 6,
|
|
1727
|
+
"Recife": 6,
|
|
1728
|
+
"Gaza": 6,
|
|
1729
|
+
"Hebron": 6,
|
|
1730
|
+
"DeNoronha": 6
|
|
1731
|
+
};
|
|
1732
|
+
const minPossibleTransitionSec = -388152e4;
|
|
1733
|
+
function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
|
|
1734
|
+
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
1735
|
+
return [coerceRoundingMode(options, 4), ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, coerceSmallestUnit(options), 0, maxSmallestUnit), subsecDigits)];
|
|
1736
|
+
}
|
|
1737
|
+
function refineDateDisplayOptions(options) {
|
|
1738
|
+
return coerceCalendarDisplay(normalizeOptions(options));
|
|
1739
|
+
}
|
|
1740
|
+
function refineTimeDisplayOptions(options, maxSmallestUnit) {
|
|
1741
|
+
return refineTimeDisplayTuple(normalizeOptions(options), maxSmallestUnit);
|
|
1742
|
+
}
|
|
1743
|
+
function resolveSmallestUnitAndSubsecDigits(smallestUnit, subsecDigits) {
|
|
1744
|
+
return null != smallestUnit ? [unitNanoMap[smallestUnit], smallestUnit < 4 ? 9 - 3 * smallestUnit : -1] : [void 0 === subsecDigits ? 1 : 10 ** (9 - subsecDigits), subsecDigits];
|
|
1745
|
+
}
|
|
1746
|
+
function formatInstantIso(refineTimeZoneString, instantSlots, options) {
|
|
1747
|
+
const [timeZoneArg, roundingMode, nanoInc, subsecDigits] = ((options) => {
|
|
1748
|
+
const subsecDigits = coerceFractionalSecondDigits(options = normalizeOptions(options));
|
|
1749
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
1750
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
1751
|
+
return [
|
|
1752
|
+
options.timeZone,
|
|
1753
|
+
roundingMode,
|
|
1754
|
+
...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits)
|
|
1755
|
+
];
|
|
1756
|
+
})(options);
|
|
1757
|
+
const providedTimeZone = void 0 !== timeZoneArg;
|
|
1758
|
+
return ((providedTimeZone, timeZone, epochNano, roundingMode, nanoInc, subsecDigits) => {
|
|
1759
|
+
epochNano = roundBigNanoToDayOriginInc(epochNano, BigInt(nanoInc), roundingMode);
|
|
1760
|
+
const offsetNano = timeZone.C(epochNano);
|
|
1761
|
+
return formatIsoDateTimeFields(epochNanoToIsoDateTime(epochNano + BigInt(offsetNano)), subsecDigits) + (providedTimeZone ? formatOffsetNano(roundToMinute(offsetNano)) : "Z");
|
|
1762
|
+
})(providedTimeZone, queryTimeZone(providedTimeZone ? refineTimeZoneString(timeZoneArg) : "UTC"), instantSlots.epochNanoseconds, roundingMode, nanoInc, subsecDigits);
|
|
1763
|
+
}
|
|
1764
|
+
function formatZonedDateTimeIso(zonedDateTimeSlots0, options) {
|
|
1765
|
+
const displayOptions = ((options) => {
|
|
1766
|
+
options = normalizeOptions(options);
|
|
1767
|
+
const calendarDisplay = coerceCalendarDisplay(options);
|
|
1768
|
+
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
1769
|
+
const offsetDisplay = coerceOffsetDisplay(options);
|
|
1770
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
1771
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
1772
|
+
return [
|
|
1773
|
+
calendarDisplay,
|
|
1774
|
+
coerceTimeZoneDisplay(options),
|
|
1775
|
+
offsetDisplay,
|
|
1776
|
+
roundingMode,
|
|
1777
|
+
...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits)
|
|
1778
|
+
];
|
|
1779
|
+
})(options);
|
|
1780
|
+
return ((calendar, timeZoneId, timeZone, epochNano, calendarDisplay, timeZoneDisplay, offsetDisplay, roundingMode, nanoInc, subsecDigits) => {
|
|
1781
|
+
epochNano = roundBigNanoToDayOriginInc(epochNano, BigInt(nanoInc), roundingMode);
|
|
1782
|
+
const offsetNano = timeZone.C(epochNano);
|
|
1783
|
+
return formatIsoDateTimeFields(epochNanoToIsoDateTime(epochNano + BigInt(offsetNano)), subsecDigits) + formatOffsetNano(roundToMinute(offsetNano), offsetDisplay) + formatTimeZone(timeZoneId, timeZoneDisplay) + formatCalendar(calendar, calendarDisplay);
|
|
1784
|
+
})(zonedDateTimeSlots0.calendar, zonedDateTimeSlots0.timeZone.id, zonedDateTimeSlots0.timeZone, zonedDateTimeSlots0.epochNanoseconds, ...displayOptions);
|
|
1785
|
+
}
|
|
1786
|
+
function formatPlainDateTimeIso(plainDateTimeSlots0, options) {
|
|
1787
|
+
const displayOptions = ((options) => (options = normalizeOptions(options), [coerceCalendarDisplay(options), ...refineTimeDisplayTuple(options)]))(options);
|
|
1788
|
+
return ((calendar, isoDateTime, calendarDisplay, roundingMode, nanoInc, subsecDigits) => formatIsoDateTimeFields(roundDateTimeToNano(isoDateTime, nanoInc, roundingMode), subsecDigits) + formatCalendar(calendar, calendarDisplay))(plainDateTimeSlots0.calendar, plainDateTimeSlots0, ...displayOptions);
|
|
1789
|
+
}
|
|
1790
|
+
function formatPlainDateIso(plainDateSlots, options) {
|
|
1791
|
+
return calendar = plainDateSlots.calendar, isoDate = plainDateSlots, calendarDisplay = refineDateDisplayOptions(options), formatIsoDateFields(isoDate) + formatCalendar(calendar, calendarDisplay);
|
|
1792
|
+
var calendar, isoDate, calendarDisplay;
|
|
1793
|
+
}
|
|
1794
|
+
function formatPlainYearMonthIso(plainYearMonthSlots, options) {
|
|
1795
|
+
return formatDateLikeIso(plainYearMonthSlots.calendar, formatIsoYearMonthFields, plainYearMonthSlots, refineDateDisplayOptions(options));
|
|
1796
|
+
}
|
|
1797
|
+
function formatPlainMonthDayIso(plainMonthDaySlots, options) {
|
|
1798
|
+
return formatDateLikeIso(plainMonthDaySlots.calendar, formatIsoMonthDayFields, plainMonthDaySlots, refineDateDisplayOptions(options));
|
|
1799
|
+
}
|
|
1800
|
+
function formatDateLikeIso(calendar, formatSimple, isoDate, calendarDisplay) {
|
|
1801
|
+
return 1 === calendarDisplay ? calendar === void 0 ? formatSimple(isoDate) : formatIsoDateFields(isoDate) : calendarDisplay > 1 || 0 === calendarDisplay && calendar !== void 0 ? formatIsoDateFields(isoDate) + formatCalendarId(getCalendarSlotId(calendar), 2 === calendarDisplay) : formatSimple(isoDate);
|
|
1802
|
+
}
|
|
1803
|
+
function formatPlainTimeIso(slots, options) {
|
|
1804
|
+
return ((fields, roundingMode, nanoInc, subsecDigits) => formatTimeFields(roundTimeToNano(fields, nanoInc, roundingMode)[0], subsecDigits))(slots, ...refineTimeDisplayOptions(options));
|
|
1805
|
+
}
|
|
1806
|
+
function formatDurationIso(slots, options) {
|
|
1807
|
+
const [roundingMode, nanoInc, subsecDigits] = refineTimeDisplayOptions(options, 3);
|
|
1808
|
+
return nanoInc > 1 && validateDurationFields(slots = {
|
|
1809
|
+
...slots,
|
|
1810
|
+
...roundDayTimeDurationByInc(slots, nanoInc, roundingMode)
|
|
1811
|
+
}), formatDurationSlots(slots, subsecDigits);
|
|
1812
|
+
}
|
|
1813
|
+
function formatDurationSlots(durationSlots, subsecDigits) {
|
|
1814
|
+
const { sign } = durationSlots;
|
|
1815
|
+
const abs = -1 === sign ? negateDurationFields(durationSlots) : durationSlots;
|
|
1816
|
+
const { hours, minutes } = abs;
|
|
1817
|
+
const bigNano = durationSubMinuteToBigNano(abs);
|
|
1818
|
+
const wholeSec = Number(bigNano / bigNanoInSec);
|
|
1819
|
+
const subsecNano = Number(bigNano % bigNanoInSec);
|
|
1820
|
+
validateDurationTimeUnit(wholeSec);
|
|
1821
|
+
const subsecNanoString = formatSubsecNano(subsecNano, subsecDigits);
|
|
1822
|
+
const forceSec = subsecDigits >= 0 || !sign || subsecNanoString;
|
|
1823
|
+
return (sign < 0 ? "-" : "") + "P" + formatDurationFragments({
|
|
1824
|
+
"Y": formatDurationNumber(abs.years),
|
|
1825
|
+
"M": formatDurationNumber(abs.months),
|
|
1826
|
+
"W": formatDurationNumber(abs.weeks),
|
|
1827
|
+
"D": formatDurationNumber(abs.days)
|
|
1828
|
+
}) + (hours || minutes || wholeSec || forceSec ? "T" + formatDurationFragments({
|
|
1829
|
+
"H": formatDurationNumber(hours),
|
|
1830
|
+
"M": formatDurationNumber(minutes),
|
|
1831
|
+
"S": formatDurationNumber(wholeSec, forceSec) + subsecNanoString
|
|
1832
|
+
}) : "");
|
|
1833
|
+
}
|
|
1834
|
+
function formatDurationFragments(fragObj) {
|
|
1835
|
+
const parts = [];
|
|
1836
|
+
for (const fragName in fragObj) {
|
|
1837
|
+
const fragVal = fragObj[fragName];
|
|
1838
|
+
fragVal && parts.push(fragVal, fragName);
|
|
1839
|
+
}
|
|
1840
|
+
return parts.join("");
|
|
1841
|
+
}
|
|
1842
|
+
function formatDurationNumber(n, force) {
|
|
1843
|
+
if (!n && !force) return "";
|
|
1844
|
+
const options = Object.create(null);
|
|
1845
|
+
return options.useGrouping = 0, n.toLocaleString("fullwide", options);
|
|
1846
|
+
}
|
|
1847
|
+
function formatIsoDateTimeFields(isoDateTime, subsecDigits) {
|
|
1848
|
+
return formatIsoDateFields(isoDateTime) + "T" + formatTimeFields(isoDateTime, subsecDigits);
|
|
1849
|
+
}
|
|
1850
|
+
function formatIsoDateFields(isoDateFields) {
|
|
1851
|
+
return formatIsoYearMonthFields(isoDateFields) + "-" + padNumber2(isoDateFields.day);
|
|
1852
|
+
}
|
|
1853
|
+
function formatIsoYearMonthFields(isoDateFields) {
|
|
1854
|
+
const { year } = isoDateFields;
|
|
1855
|
+
return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(isoDateFields.month);
|
|
1856
|
+
}
|
|
1857
|
+
function formatIsoMonthDayFields(isoDateFields) {
|
|
1858
|
+
return padNumber2(isoDateFields.month) + "-" + padNumber2(isoDateFields.day);
|
|
1859
|
+
}
|
|
1860
|
+
function formatTimeFields(timeFields, subsecDigits) {
|
|
1861
|
+
const parts = [padNumber2(timeFields.hour), padNumber2(timeFields.minute)];
|
|
1862
|
+
return -1 !== subsecDigits && parts.push(padNumber2(timeFields.second) + ((millisecond, microsecond, nanosecond, subsecDigits) => formatSubsecNano(millisecond * nanoInMilli + microsecond * nanoInMicro + nanosecond, subsecDigits))(timeFields.millisecond, timeFields.microsecond, timeFields.nanosecond, subsecDigits)), parts.join(":");
|
|
1863
|
+
}
|
|
1864
|
+
function formatOffsetNano(offsetNano, offsetDisplay = 0) {
|
|
1865
|
+
if (1 === offsetDisplay) return "";
|
|
1866
|
+
const [hour, nanoRemainder0] = divModFloor(Math.abs(offsetNano), nanoInHour);
|
|
1867
|
+
const [minute, nanoRemainder1] = divModFloor(nanoRemainder0, nanoInMinute);
|
|
1868
|
+
const [second, nanoRemainder2] = divModFloor(nanoRemainder1, nanoInSec);
|
|
1869
|
+
return getSignStr(offsetNano) + padNumber2(hour) + ":" + padNumber2(minute) + (second || nanoRemainder2 ? ":" + padNumber2(second) + formatSubsecNano(nanoRemainder2) : "");
|
|
1870
|
+
}
|
|
1871
|
+
function formatTimeZone(timeZoneId, timeZoneDisplay) {
|
|
1872
|
+
return 1 !== timeZoneDisplay ? "[" + (2 === timeZoneDisplay ? "!" : "") + timeZoneId + "]" : "";
|
|
1873
|
+
}
|
|
1874
|
+
function formatCalendar(calendar, calendarDisplay) {
|
|
1875
|
+
return calendarDisplay > 1 || 0 === calendarDisplay && calendar !== void 0 ? formatCalendarId(getCalendarSlotId(calendar), 2 === calendarDisplay) : "";
|
|
1876
|
+
}
|
|
1877
|
+
function formatCalendarId(calendarId, isCritical) {
|
|
1878
|
+
return "[" + (isCritical ? "!" : "") + "u-ca=" + calendarId + "]";
|
|
1879
|
+
}
|
|
1880
|
+
const trailingZerosRE = /0+$/;
|
|
1881
|
+
function formatSubsecNano(totalNano, subsecDigits) {
|
|
1882
|
+
let s = padNumber(9, totalNano);
|
|
1883
|
+
return s = void 0 === subsecDigits ? s.replace(trailingZerosRE, "") : s.slice(0, subsecDigits), s ? "." + s : "";
|
|
1884
|
+
}
|
|
1885
|
+
function getSignStr(num) {
|
|
1886
|
+
return num < 0 ? "-" : "+";
|
|
1887
|
+
}
|
|
1888
|
+
const icuRegExp = /^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/;
|
|
1889
|
+
const badCharactersRegExp = /[^\w\/:+-]+/;
|
|
1890
|
+
function refineTimeZoneId(rawId) {
|
|
1891
|
+
return resolveTimeZoneId(requireString(rawId));
|
|
1892
|
+
}
|
|
1893
|
+
function resolveTimeZoneId(rawId) {
|
|
1894
|
+
return resolveTimeZoneRecord(rawId).id;
|
|
1895
|
+
}
|
|
1896
|
+
function resolveTimeZoneRecord(rawId) {
|
|
1897
|
+
const upperRawId = rawId.toUpperCase();
|
|
1898
|
+
const offsetRecord = ((upperRawId) => {
|
|
1899
|
+
const offsetNano = parseOffsetNanoMaybe(upperRawId, 1);
|
|
1900
|
+
if (void 0 !== offsetNano) return {
|
|
1901
|
+
id: formatOffsetNano(offsetNano),
|
|
1902
|
+
_: offsetNano,
|
|
1903
|
+
o: offsetNano
|
|
1904
|
+
};
|
|
1905
|
+
})(upperRawId);
|
|
1906
|
+
if (offsetRecord) return {
|
|
1907
|
+
kind: "fixed",
|
|
1908
|
+
...offsetRecord
|
|
1909
|
+
};
|
|
1910
|
+
return queryNamedTimeZoneRecord("UTC" === upperRawId ? "UTC" : ((rawId) => (badCharactersRegExp.test(rawId) && throwRangeError(invalidTimeZone(rawId)), icuRegExp.test(rawId) && throwRangeError("Forbidden ICU TimeZone"), rawId.toLowerCase().split("/").map((part, partI) => (part.length <= 3 || /\d/.test(part)) && !/etc|yap/.test(part) ? part.toUpperCase() : part.replace(/baja|dumont|[a-z]+/g, (a, i) => a.length <= 2 && !partI || "in" === a || "chat" === a ? a.toUpperCase() : a.length > 2 || !i ? capitalize(a).replace(/island|noronha|murdo|rivadavia|urville/, capitalize) : a)).join("/")))(rawId));
|
|
1911
|
+
}
|
|
1912
|
+
const queryNamedTimeZoneRecord = /* @__PURE__ */ memoize((normId) => {
|
|
1913
|
+
if ("UTC" === normId) return {
|
|
1914
|
+
kind: "utc",
|
|
1915
|
+
id: normId,
|
|
1916
|
+
o: normId
|
|
1917
|
+
};
|
|
1918
|
+
const format = queryTimeZoneIntlFormat(normId.toUpperCase());
|
|
1919
|
+
return {
|
|
1920
|
+
kind: "named",
|
|
1921
|
+
id: normId,
|
|
1922
|
+
format,
|
|
1923
|
+
o: format.resolvedOptions().timeZone
|
|
1924
|
+
};
|
|
1925
|
+
});
|
|
1926
|
+
const queryTimeZoneIntlFormat = /* @__PURE__ */ memoize((upperNormId) => new RawDateTimeFormat("en-u-hc-h23", {
|
|
1927
|
+
calendar: "iso8601",
|
|
1928
|
+
timeZone: upperNormId,
|
|
1929
|
+
era: "short",
|
|
1930
|
+
year: "numeric",
|
|
1931
|
+
month: "numeric",
|
|
1932
|
+
day: "numeric",
|
|
1933
|
+
hour: "numeric",
|
|
1934
|
+
minute: "numeric",
|
|
1935
|
+
second: "numeric"
|
|
1936
|
+
}));
|
|
1937
|
+
function queryTimeZone(rawTimeZoneId) {
|
|
1938
|
+
const record = resolveTimeZoneRecord(rawTimeZoneId);
|
|
1939
|
+
return queryTimeZoneRecord(record.id, record);
|
|
1940
|
+
}
|
|
1941
|
+
const queryTimeZoneRecord = /* @__PURE__ */ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.o, record.format) : new FixedTimeZone(normTimeZoneId, record.o, "fixed" === record.kind ? record._ : 0));
|
|
1942
|
+
var FixedTimeZone = class {
|
|
1943
|
+
constructor(id, compareKey, offsetNano) {
|
|
1944
|
+
this.id = id, this.o = compareKey, this._ = offsetNano;
|
|
1945
|
+
}
|
|
1946
|
+
C() {
|
|
1947
|
+
return this._;
|
|
1948
|
+
}
|
|
1949
|
+
R(isoDateTime) {
|
|
1950
|
+
return [isoDateTimeAndOffsetToEpochNano(isoDateTime, this._)];
|
|
1951
|
+
}
|
|
1952
|
+
U() {}
|
|
1953
|
+
};
|
|
1954
|
+
var IntlTimeZone = class {
|
|
1955
|
+
constructor(id, compareKey, format) {
|
|
1956
|
+
this.id = id, this.o = compareKey, this.qe = ((computeOffsetSec, periodDays) => {
|
|
1957
|
+
const getSample = memoize(computeOffsetSec);
|
|
1958
|
+
const getSplit = memoize(createSplitTuple);
|
|
1959
|
+
const periodSec = 86400 * periodDays;
|
|
1960
|
+
function getOffsetSec(epochSec) {
|
|
1961
|
+
const [startEpochSec, endEpochSec] = computePeriod(epochSec, periodSec);
|
|
1962
|
+
const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec);
|
|
1963
|
+
const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec);
|
|
1964
|
+
const startOffsetSec = getSample(clampedStartEpochSec);
|
|
1965
|
+
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
1966
|
+
return startOffsetSec === endOffsetSec ? startOffsetSec : pinch(getSplit(clampedStartEpochSec, clampedEndEpochSec), startOffsetSec, endOffsetSec, epochSec);
|
|
1967
|
+
}
|
|
1968
|
+
function pinch(split, startOffsetSec, endOffsetSec, forEpochSec) {
|
|
1969
|
+
let offsetSec;
|
|
1970
|
+
let splitDurSec;
|
|
1971
|
+
for (; (void 0 === forEpochSec || void 0 === (offsetSec = forEpochSec < split[0] ? startOffsetSec : forEpochSec >= split[1] ? endOffsetSec : void 0)) && (splitDurSec = split[1] - split[0]);) {
|
|
1972
|
+
const middleEpochSec = split[0] + Math.floor(splitDurSec / 2);
|
|
1973
|
+
computeOffsetSec(middleEpochSec) === endOffsetSec ? split[1] = middleEpochSec : split[0] = middleEpochSec + 1;
|
|
1974
|
+
}
|
|
1975
|
+
return offsetSec;
|
|
1976
|
+
}
|
|
1977
|
+
return {
|
|
1978
|
+
Ee(zonedEpochSec) {
|
|
1979
|
+
const wideOffsetSec0 = getOffsetSec(zonedEpochSec - 86400);
|
|
1980
|
+
const wideOffsetSec1 = getOffsetSec(zonedEpochSec + 86400);
|
|
1981
|
+
const wideUtcEpochSec0 = zonedEpochSec - wideOffsetSec0;
|
|
1982
|
+
const wideUtcEpochSec1 = zonedEpochSec - wideOffsetSec1;
|
|
1983
|
+
if (wideOffsetSec0 === wideOffsetSec1) return [wideUtcEpochSec0];
|
|
1984
|
+
const narrowOffsetSec0 = getOffsetSec(wideUtcEpochSec0);
|
|
1985
|
+
return narrowOffsetSec0 === getOffsetSec(wideUtcEpochSec1) ? [zonedEpochSec - narrowOffsetSec0] : wideOffsetSec0 > wideOffsetSec1 ? [wideUtcEpochSec0, wideUtcEpochSec1] : [];
|
|
1986
|
+
},
|
|
1987
|
+
De: getOffsetSec,
|
|
1988
|
+
U: function getTransition(epochSec, direction) {
|
|
1989
|
+
if (direction > 0 && epochSec >= 864e10) return;
|
|
1990
|
+
if (direction < 0) {
|
|
1991
|
+
if (epochSec <= minPossibleTransitionSec) return;
|
|
1992
|
+
const lookaheadEpochSec = getCurrentEpochSec() + 94867200;
|
|
1993
|
+
if (epochSec > lookaheadEpochSec) return getTransition(lookaheadEpochSec, -1);
|
|
1994
|
+
}
|
|
1995
|
+
let [startEpochSec, endEpochSec] = computePeriod(direction > 0 ? Math.max(epochSec, minPossibleTransitionSec) : epochSec, periodSec);
|
|
1996
|
+
const inc = periodSec * direction;
|
|
1997
|
+
const searchLimit = direction > 0 ? Math.max(epochSec, getCurrentEpochSec()) + 94867200 : minPossibleTransitionSec;
|
|
1998
|
+
const inBounds = () => direction < 0 ? endEpochSec > searchLimit : startEpochSec < searchLimit;
|
|
1999
|
+
for (; inBounds();) {
|
|
2000
|
+
const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec);
|
|
2001
|
+
const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec);
|
|
2002
|
+
const startOffsetSec = getSample(clampedStartEpochSec);
|
|
2003
|
+
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
2004
|
+
if (startOffsetSec !== endOffsetSec) {
|
|
2005
|
+
const split = getSplit(clampedStartEpochSec, clampedEndEpochSec);
|
|
2006
|
+
pinch(split, startOffsetSec, endOffsetSec);
|
|
2007
|
+
const transitionEpochSec = split[0];
|
|
2008
|
+
if ((compareNumbers(transitionEpochSec, epochSec) || 1) === direction) return transitionEpochSec;
|
|
2009
|
+
}
|
|
2010
|
+
startEpochSec += inc, endEpochSec += inc;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
})(((format) => (epochSec) => {
|
|
2015
|
+
const intlParts = formatEpochMilliToPartsRecord(format, 1e3 * epochSec);
|
|
2016
|
+
return 86400 * isoArgsToEpochDays(((intlParts) => {
|
|
2017
|
+
const relatedYear = intlParts.relatedYear;
|
|
2018
|
+
if (void 0 !== relatedYear) return parseInt(relatedYear);
|
|
2019
|
+
const year = parseInt(intlParts.year);
|
|
2020
|
+
return void 0 !== intlParts.era && "bce" === normalizeEraName(intlParts.era) ? 1 - year : year;
|
|
2021
|
+
})(intlParts), parseInt(intlParts.month), parseInt(intlParts.day)) + 3600 * parseInt(intlParts.hour) + 60 * parseInt(intlParts.minute) + parseInt(intlParts.second) - epochSec;
|
|
2022
|
+
})(format), ((timeZoneId) => {
|
|
2023
|
+
return timeZonePeriodDaysByName[timeZoneId.split("/").pop()] || 60;
|
|
2024
|
+
})(id));
|
|
2025
|
+
}
|
|
2026
|
+
C(epochNano) {
|
|
2027
|
+
return this.qe.De(((epochNano) => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
|
|
2028
|
+
}
|
|
2029
|
+
R(isoDateTime) {
|
|
2030
|
+
const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime);
|
|
2031
|
+
const subsecNano = timeFieldsToSubsecNano(isoDateTime);
|
|
2032
|
+
return this.qe.Ee(zonedEpochSec).map((epochSec) => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano)));
|
|
2033
|
+
}
|
|
2034
|
+
U(epochNano, direction) {
|
|
2035
|
+
const [epochSec, subsecNano] = epochNanoToSecMod(epochNano);
|
|
2036
|
+
const resEpochSec = this.qe.U(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction);
|
|
2037
|
+
if (void 0 !== resEpochSec) return BigInt(resEpochSec) * bigNanoInSec;
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
function getCurrentEpochSec() {
|
|
2041
|
+
return Math.floor(Date.now() / 1e3);
|
|
2042
|
+
}
|
|
2043
|
+
function createSplitTuple(startEpochSec, endEpochSec) {
|
|
2044
|
+
return [startEpochSec, endEpochSec];
|
|
2045
|
+
}
|
|
2046
|
+
function computePeriod(epochSec, periodSec) {
|
|
2047
|
+
const startEpochSec = Math.floor(epochSec / periodSec) * periodSec;
|
|
2048
|
+
return [startEpochSec, startEpochSec + periodSec];
|
|
2049
|
+
}
|
|
2050
|
+
function clampIntlSampleEpochSec(epochSec) {
|
|
2051
|
+
return constrainToRange(epochSec, -1e10, 864e10);
|
|
2052
|
+
}
|
|
2053
|
+
function refineMaybeZonedDateTimeObjectLike(refineTimeZoneString, calendar, bag) {
|
|
2054
|
+
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateTimeAndZoneFieldNamesAlpha, dateTimeAndZoneFieldNamesWithEraAlpha), zonedDateTimeFieldRefiners, [], 0);
|
|
2055
|
+
if (void 0 !== fields.timeZone) {
|
|
2056
|
+
const isoDateFields = createPlainDateFromFields(calendar, fields);
|
|
2057
|
+
const timeFields = resolveTimeFields(fields);
|
|
2058
|
+
const timeZone = queryTimeZone(refineTimeZoneString(fields.timeZone));
|
|
2059
|
+
return {
|
|
2060
|
+
epochNanoseconds: getMatchingInstantFor(timeZone, combineDateAndTime(isoDateFields, timeFields), fields.offset),
|
|
2061
|
+
timeZone,
|
|
2062
|
+
calendar
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
return createPlainDateFromFields(calendar, fields);
|
|
2066
|
+
}
|
|
2067
|
+
function refineZonedDateTimeObjectLike(refineTimeZoneString, calendar, bag, options) {
|
|
2068
|
+
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateTimeAndZoneFieldNamesAlpha, dateTimeAndZoneFieldNamesWithEraAlpha), zonedDateTimeFieldRefiners, timeZoneFieldNames, 0);
|
|
2069
|
+
const timeZoneId = refineTimeZoneString(fields.timeZone);
|
|
2070
|
+
const [isoDateFields, overflow, offsetDisambig, epochDisambig] = createPlainDateFromFieldsWithOptionsRefiner(calendar, fields, () => refineZonedFieldOptions(options));
|
|
2071
|
+
const timeFields = resolveTimeFields(fields, overflow);
|
|
2072
|
+
const timeZone = queryTimeZone(timeZoneId);
|
|
2073
|
+
return createZonedEpochNanoSlots(getMatchingInstantFor(timeZone, combineDateAndTime(isoDateFields, timeFields), fields.offset, offsetDisambig, epochDisambig), timeZone, calendar);
|
|
2074
|
+
}
|
|
2075
|
+
function refinePlainDateTimeObjectLike(calendar, bag, options) {
|
|
2076
|
+
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateTimeFieldNamesAlpha, dateTimeFieldNamesWithEraAlpha), dateTimeFieldRefiners, [], 0);
|
|
2077
|
+
const [isoDateInternals, overflow] = createPlainDateFromFieldsWithOptionsRefiner(calendar, fields, () => [refineOverflowOptions(options)]);
|
|
2078
|
+
return createPlainDateTimeFromRefinedFields(isoDateInternals, resolveTimeFields(fields, overflow), calendar);
|
|
2079
|
+
}
|
|
2080
|
+
function refinePlainDateObjectLike(calendar, bag, options, requireFields = []) {
|
|
2081
|
+
return createPlainDateFromFields(calendar, readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha), dateFieldRefiners, requireFields), options);
|
|
2082
|
+
}
|
|
2083
|
+
function refinePlainYearMonthObjectLike(calendar, bag, options, requireFields) {
|
|
2084
|
+
return createPlainYearMonthFromFields(calendar, readAndRefineBagFields(bag, getCalendarFieldNames(calendar, yearMonthFieldNamesAlpha, yearMonthFieldNamesWithEraAlpha), dateFieldRefiners, requireFields), options);
|
|
2085
|
+
}
|
|
2086
|
+
function refinePlainMonthDayObjectLike(calendar, calendarAbsent, bag, options) {
|
|
2087
|
+
const fields = readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha), dateFieldRefiners, dayFieldNamesAsc, 0);
|
|
2088
|
+
return calendarAbsent && void 0 !== fields.month && void 0 === fields.monthCode && void 0 === fields.year && (fields.year = 1972), createPlainMonthDayFromFields(calendar, fields, options);
|
|
2089
|
+
}
|
|
2090
|
+
function refinePlainTimeObjectLike(bag, options) {
|
|
2091
|
+
return resolveTimeFields(readAndRefineBagFields(bag, timeFieldNamesAlpha, timeFieldRefiners, [], 1), refineOverflowOptions(options));
|
|
2092
|
+
}
|
|
2093
|
+
function refineDurationObjectLike(bag) {
|
|
2094
|
+
const durationFields = readAndRefineBagFields(bag, durationFieldNamesAlpha, durationFieldRefiners);
|
|
2095
|
+
return createDurationSlots(validateDurationFields({
|
|
2096
|
+
...durationFieldDefaults,
|
|
2097
|
+
...durationFields
|
|
2098
|
+
}));
|
|
2099
|
+
}
|
|
2100
|
+
function throwFailedParse(s) {
|
|
2101
|
+
throwRangeError(failedParse(s));
|
|
2102
|
+
}
|
|
2103
|
+
function parseInstant(s) {
|
|
2104
|
+
const organized = parseDateTimeLike(s = toStringViaPrimitive(s));
|
|
2105
|
+
let offsetNano;
|
|
2106
|
+
return organized || throwFailedParse(s), organized.F ? offsetNano = 0 : organized.offset ? offsetNano = parseOffsetNano(organized.offset) : throwFailedParse(s), organized.timeZoneId && parseOffsetNanoMaybe(organized.timeZoneId, 1), validateIsoDateTimeFields(organized), createEpochNanoSlots(isoDateTimeAndOffsetToEpochNano(organized, offsetNano));
|
|
2107
|
+
}
|
|
2108
|
+
function parseRelativeToSlots(s, resolveCalendar) {
|
|
2109
|
+
const organized = parseDateTimeLike(requireString(s));
|
|
2110
|
+
return organized || throwFailedParse(s), organized.timeZoneId ? finalizeZonedDateTime(organized, resolveCalendar, void 0) : (organized.F && throwFailedParse(s), finalizeDate(organized, resolveCalendar));
|
|
2111
|
+
}
|
|
2112
|
+
function parseZonedDateTime(s, resolveCalendar, options) {
|
|
2113
|
+
const organized = parseDateTimeLike(requireString(s));
|
|
2114
|
+
return organized && organized.timeZoneId || throwFailedParse(s), finalizeZonedDateTime(organized, resolveCalendar, options);
|
|
2115
|
+
}
|
|
2116
|
+
function parsePlainDateTime(s, resolveCalendar) {
|
|
2117
|
+
const organized = parseDateTimeLike(requireString(s));
|
|
2118
|
+
return organized && !organized.F || throwFailedParse(s), finalizeDateTime(organized, resolveCalendar);
|
|
2119
|
+
}
|
|
2120
|
+
function parsePlainDate(s, resolveCalendar) {
|
|
2121
|
+
const slots = finalizeDateLike(parsePlainDateLike(requireString(s)), void 0, resolveCalendar);
|
|
2122
|
+
return createDateSlots(slots, slots.calendar);
|
|
2123
|
+
}
|
|
2124
|
+
function parsePlainYearMonth(s, resolveCalendar) {
|
|
2125
|
+
const organized = parseYearMonthOnly(requireString(s));
|
|
2126
|
+
if (organized) return requireIsoCalendar(organized), createDateSlots(checkIsoYearMonthInBounds(validateIsoDateFields(organized)), resolveCalendar(organized.calendarId));
|
|
2127
|
+
const dateSlots = finalizeDateLike(parsePlainDateLike(s), projectIsoYearMonthDate, resolveCalendar);
|
|
2128
|
+
const { calendar } = dateSlots;
|
|
2129
|
+
return createDateSlots(moveToStartOfMonth(calendar, dateSlots), calendar);
|
|
2130
|
+
}
|
|
2131
|
+
function requireIsoCalendar(organized) {
|
|
2132
|
+
"iso8601" !== organized.calendarId && throwRangeError(invalidSubstring(organized.calendarId));
|
|
2133
|
+
}
|
|
2134
|
+
function parsePlainMonthDay(s, resolveCalendar) {
|
|
2135
|
+
const organized = parseMonthDayOnly(requireString(s));
|
|
2136
|
+
if (organized) return requireIsoCalendar(organized), createDateSlots(validateIsoDateFields(organized), resolveCalendar(organized.calendarId));
|
|
2137
|
+
const dateSlots = finalizeDateLike(parsePlainDateLike(s), projectIsoMonthDayDate, resolveCalendar);
|
|
2138
|
+
const { calendar } = dateSlots;
|
|
2139
|
+
const { year: origYear, month: origMonth, day } = computeCalendarDateFields(calendar, dateSlots);
|
|
2140
|
+
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, origYear, origMonth);
|
|
2141
|
+
const { year, month } = ((calendar, monthCodeNumber, isLeapMonth, day) => {
|
|
2142
|
+
const yearMonthFields = calendar ? calendar.v(monthCodeNumber, isLeapMonth, day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, isLeapMonth);
|
|
2143
|
+
return yearMonthFields || throwRangeError("Cannot guess year"), yearMonthFields;
|
|
2144
|
+
})(calendar, monthCodeNumber, isLeapMonth, day);
|
|
2145
|
+
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, day)), calendar);
|
|
2146
|
+
}
|
|
2147
|
+
function parsePlainTime(s) {
|
|
2148
|
+
let organized = ((s) => {
|
|
2149
|
+
const parts = parseTimeOnlyParts(s);
|
|
2150
|
+
return parts ? (organizeAnnotationParts(parts[13]), organizeTimeParts(parts, 1)) : void 0;
|
|
2151
|
+
})(s = requireString(s));
|
|
2152
|
+
let altParsed;
|
|
2153
|
+
return organized || (organized = parseDateTimeLike(s), organized ? (organized.fe || throwFailedParse(s), organized.F && throwRangeError(invalidSubstring("Z")), requireIsoCalendar(organized)) : throwFailedParse(s)), (altParsed = parseYearMonthOnly(s)) && isIsoDateFieldsValid(altParsed) && throwFailedParse(s), (altParsed = parseMonthDayOnly(s)) && isIsoDateFieldsValid(altParsed) && throwFailedParse(s), createTimeSlots(validateTimeFields(organized));
|
|
2154
|
+
}
|
|
2155
|
+
function parseDuration(s) {
|
|
2156
|
+
const parsed = ((s) => {
|
|
2157
|
+
const parts = durationRegExp.exec(s);
|
|
2158
|
+
return parts ? ((parts) => {
|
|
2159
|
+
let hasAny = 0;
|
|
2160
|
+
let hasAnyFrac = 0;
|
|
2161
|
+
let leftoverNano = 0;
|
|
2162
|
+
let durationFields = {
|
|
2163
|
+
years: parseUnit(parts[2]),
|
|
2164
|
+
months: parseUnit(parts[3]),
|
|
2165
|
+
weeks: parseUnit(parts[4]),
|
|
2166
|
+
days: parseUnit(parts[5]),
|
|
2167
|
+
hours: parseUnit(parts[6], parts[7], 5),
|
|
2168
|
+
minutes: parseUnit(parts[8], parts[9], 4),
|
|
2169
|
+
seconds: parseUnit(parts[10], parts[11], 3),
|
|
2170
|
+
...nanoToGivenFields(leftoverNano, 2, durationFieldNamesAsc)
|
|
2171
|
+
};
|
|
2172
|
+
return hasAny || throwRangeError(noValidFields(durationFieldNamesAsc)), parseSign(parts[1]) < 0 && (durationFields = negateDurationFields(durationFields)), durationFields;
|
|
2173
|
+
function parseUnit(wholeStr, fracStr, timeUnit) {
|
|
2174
|
+
let leftoverUnits = 0;
|
|
2175
|
+
let wholeUnits = 0;
|
|
2176
|
+
return timeUnit && ([leftoverUnits, leftoverNano] = divModFloor(leftoverNano, unitNanoMap[timeUnit])), void 0 !== wholeStr && (hasAnyFrac && throwRangeError(invalidSubstring(wholeStr)), wholeUnits = ((s) => {
|
|
2177
|
+
const n = parseInt(s);
|
|
2178
|
+
return Number.isFinite(n) || throwRangeError(invalidSubstring(s)), n;
|
|
2179
|
+
})(wholeStr), hasAny = 1, fracStr && (leftoverNano = parseSubsecNano(fracStr) * (unitNanoMap[timeUnit] / nanoInSec), hasAnyFrac = 1)), leftoverUnits + wholeUnits;
|
|
2180
|
+
}
|
|
2181
|
+
})(parts) : void 0;
|
|
2182
|
+
})(requireString(s));
|
|
2183
|
+
return parsed || throwFailedParse(s), createDurationSlots(validateDurationFields(parsed));
|
|
2184
|
+
}
|
|
2185
|
+
function parseCalendarId(s) {
|
|
2186
|
+
const res = parseDateTimeLike(s) || parseYearMonthOnly(s) || parseMonthDayOnly(s);
|
|
2187
|
+
if (res) return res.calendarId;
|
|
2188
|
+
const timeParts = parseTimeOnlyParts(s);
|
|
2189
|
+
return timeParts ? organizeAnnotationParts(timeParts[13]).calendarId : s;
|
|
2190
|
+
}
|
|
2191
|
+
function parseTimeZoneId(s) {
|
|
2192
|
+
const parsed = parseDateTimeLike(s);
|
|
2193
|
+
return parsed && (parsed.timeZoneId || parsed.F && "UTC" || parsed.offset) || s;
|
|
2194
|
+
}
|
|
2195
|
+
function parsePlainDateLike(s) {
|
|
2196
|
+
const organized = parseDateTimeLike(s);
|
|
2197
|
+
return organized && !organized.F || throwFailedParse(s), organized;
|
|
2198
|
+
}
|
|
2199
|
+
function finalizeDateLike(organized, isoDateProjector, resolveCalendar) {
|
|
2200
|
+
return isoDateProjector && "iso8601" === organized.calendarId ? (validateIsoDateFields(organized), organized.fe && validateTimeFields(organized), finalizeDate(isoDateProjector(organized), resolveCalendar)) : organized.fe ? finalizeDateTime(organized, resolveCalendar) : finalizeDate(organized, resolveCalendar);
|
|
2201
|
+
}
|
|
2202
|
+
function projectIsoYearMonthDate(organized) {
|
|
2203
|
+
const day = 12 * organized.year + organized.month === isoYearMonthIndexMin ? 20 : 1;
|
|
2204
|
+
return {
|
|
2205
|
+
...organized,
|
|
2206
|
+
day
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
function projectIsoMonthDayDate(organized) {
|
|
2210
|
+
return {
|
|
2211
|
+
...organized,
|
|
2212
|
+
year: 1972
|
|
2213
|
+
};
|
|
2214
|
+
}
|
|
2215
|
+
function finalizeZonedDateTime(organized, resolveCalendar, options) {
|
|
2216
|
+
const timeZone = queryTimeZone(resolveTimeZoneId(organized.timeZoneId));
|
|
2217
|
+
let epochNano;
|
|
2218
|
+
if (validateIsoDateTimeFields(organized), organized.fe) {
|
|
2219
|
+
const offsetNano = organized.offset ? parseOffsetNano(organized.offset) : void 0;
|
|
2220
|
+
const [, offsetDisambig, epochDisambig] = refineZonedFieldOptions(options);
|
|
2221
|
+
epochNano = getMatchingInstantFor(timeZone, organized, offsetNano, offsetDisambig, epochDisambig, !(timeZone._ || void 0 === organized.offset || (offset = organized.offset, offset.replace(/\D/g, "").length > 4)), organized.F);
|
|
2222
|
+
} else refineZonedFieldOptions(options), epochNano = getStartOfDayInstantFor(timeZone, organized);
|
|
2223
|
+
var offset;
|
|
2224
|
+
return checkEpochNanoInBounds(epochNano), createZonedEpochNanoSlots(epochNano, timeZone, resolveCalendar(organized.calendarId));
|
|
2225
|
+
}
|
|
2226
|
+
function finalizeDateTime(organized, resolveCalendar) {
|
|
2227
|
+
return validateIsoDateTimeFields(organized), checkIsoDateTimeInBounds(organized), {
|
|
2228
|
+
...combineDateAndTime(organized, organized),
|
|
2229
|
+
calendar: resolveCalendar(organized.calendarId)
|
|
2230
|
+
};
|
|
2231
|
+
}
|
|
2232
|
+
function finalizeDate(organized, resolveCalendar) {
|
|
2233
|
+
return validateIsoDateFields(organized), checkIsoDateInBounds(organized), {
|
|
2234
|
+
calendar: resolveCalendar(organized.calendarId),
|
|
2235
|
+
year: organized.year,
|
|
2236
|
+
month: organized.month,
|
|
2237
|
+
day: organized.day
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
function timeRegExpStr(separatorIndex) {
|
|
2241
|
+
return `(\\d{2})(?:(:?)(\\d{2})(?:\\${separatorIndex}(\\d{2})(?:[.,](\\d{1,9}))?)?)?`;
|
|
2242
|
+
}
|
|
2243
|
+
function offsetRegExpStr(separatorIndex) {
|
|
2244
|
+
return "([+-])" + timeRegExpStr(separatorIndex);
|
|
2245
|
+
}
|
|
2246
|
+
const dateTimeRegExpStr = "(?:(?:([+-])(\\d{6}))|(\\d{4}))(-?)(\\d{2})\\4(\\d{2})(?:[T ]" + timeRegExpStr(8) + "(Z|" + offsetRegExpStr(15) + ")?)?";
|
|
2247
|
+
const yearMonthRegExp = /* @__PURE__ */ createRegExp("(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
|
|
2248
|
+
const monthDayRegExp = /* @__PURE__ */ createRegExp("(?:--)?(\\d{2})-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
|
|
2249
|
+
const dateTimeRegExp = /* @__PURE__ */ createRegExp(dateTimeRegExpStr + "((?:\\[(!?)([^\\]]*)\\]){0,9})");
|
|
2250
|
+
const timeRegExp = /* @__PURE__ */ createRegExp("T?" + timeRegExpStr(2) + `(${offsetRegExpStr(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`);
|
|
2251
|
+
const annotationRegExp = /* @__PURE__ */ new RegExp("\\[(!?)([^\\]]*)\\]", "g");
|
|
2252
|
+
const durationRegExp = /* @__PURE__ */ createRegExp("([+-])?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)(?:[.,](\\d{1,9}))?H)?(?:(\\d+)(?:[.,](\\d{1,9}))?M)?(?:(\\d+)(?:[.,](\\d{1,9}))?S)?)?");
|
|
2253
|
+
function parseDateTimeLike(s) {
|
|
2254
|
+
const parts = dateTimeRegExp.exec(s);
|
|
2255
|
+
return parts ? ((parts) => {
|
|
2256
|
+
const zOrOffset = parts[12];
|
|
2257
|
+
const hasZ = "Z" === (zOrOffset || "").toUpperCase();
|
|
2258
|
+
return {
|
|
2259
|
+
year: organizeIsoYearParts(parts),
|
|
2260
|
+
month: parseInt(parts[5]),
|
|
2261
|
+
day: parseInt(parts[6]),
|
|
2262
|
+
...organizeTimeParts(parts, 7),
|
|
2263
|
+
...organizeAnnotationParts(parts[19]),
|
|
2264
|
+
fe: Boolean(parts[7]),
|
|
2265
|
+
F: hasZ,
|
|
2266
|
+
offset: hasZ ? void 0 : zOrOffset
|
|
2267
|
+
};
|
|
2268
|
+
})(parts) : void 0;
|
|
2269
|
+
}
|
|
2270
|
+
function parseYearMonthOnly(s) {
|
|
2271
|
+
const parts = yearMonthRegExp.exec(s);
|
|
2272
|
+
if (parts) return ((parts) => ({
|
|
2273
|
+
year: organizeIsoYearParts(parts),
|
|
2274
|
+
month: parseInt(parts[4]),
|
|
2275
|
+
day: 1,
|
|
2276
|
+
...organizeAnnotationParts(parts[5])
|
|
2277
|
+
}))(parts);
|
|
2278
|
+
}
|
|
2279
|
+
function parseMonthDayOnly(s) {
|
|
2280
|
+
const parts = monthDayRegExp.exec(s);
|
|
2281
|
+
return parts ? ((parts) => ({
|
|
2282
|
+
year: 1972,
|
|
2283
|
+
month: parseInt(parts[1]),
|
|
2284
|
+
day: parseInt(parts[2]),
|
|
2285
|
+
...organizeAnnotationParts(parts[3])
|
|
2286
|
+
}))(parts) : void 0;
|
|
2287
|
+
}
|
|
2288
|
+
function parseTimeOnlyParts(s) {
|
|
2289
|
+
const parts = timeRegExp.exec(s);
|
|
2290
|
+
if (parts) return parts[6] && parseOffsetNano(parts[6]), parts;
|
|
2291
|
+
}
|
|
2292
|
+
function organizeTimeParts(parts, hourIndex) {
|
|
2293
|
+
const second = parseInt0(parts[hourIndex + 3]);
|
|
2294
|
+
return {
|
|
2295
|
+
...nanoToTimeAndDay(parseSubsecNano(parts[hourIndex + 4] || ""))[0],
|
|
2296
|
+
hour: parseInt0(parts[hourIndex]),
|
|
2297
|
+
minute: parseInt0(parts[hourIndex + 2]),
|
|
2298
|
+
second: 60 === second ? 59 : second
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2301
|
+
function organizeIsoYearParts(parts) {
|
|
2302
|
+
const yearSign = parseSign(parts[1]);
|
|
2303
|
+
const year = parseInt(parts[2] || parts[3]);
|
|
2304
|
+
return yearSign < 0 && !year && throwRangeError(invalidSubstring(-0)), yearSign * year;
|
|
2305
|
+
}
|
|
2306
|
+
function organizeAnnotationParts(s) {
|
|
2307
|
+
let calendarIsCritical;
|
|
2308
|
+
let timeZoneId;
|
|
2309
|
+
const calendarIds = [];
|
|
2310
|
+
return s.replace(annotationRegExp, (whole, criticalStr, mainStr) => {
|
|
2311
|
+
const isCritical = Boolean(criticalStr);
|
|
2312
|
+
const [val, name] = mainStr.split("=").reverse();
|
|
2313
|
+
return name ? "u-ca" === name ? (calendarIds.push(val.toLowerCase()), calendarIsCritical || (calendarIsCritical = isCritical)) : (isCritical || /[A-Z]/.test(name)) && throwRangeError(invalidSubstring(whole)) : (timeZoneId && throwRangeError(invalidSubstring(whole)), timeZoneId = val), "";
|
|
2314
|
+
}), calendarIds.length > 1 && calendarIsCritical && throwRangeError(invalidSubstring(s)), {
|
|
2315
|
+
timeZoneId,
|
|
2316
|
+
calendarId: calendarIds[0] || "iso8601"
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
function mergeCalendarFields(calendar, baseFields, additionalFields) {
|
|
2320
|
+
const merged = Object.assign(Object.create(null), baseFields);
|
|
2321
|
+
return spliceFields(merged, additionalFields, monthFieldNames), getCalendarEraOrigins(calendar) && (spliceFields(merged, additionalFields, allYearFieldNames), calendar && calendar.le && spliceFields(merged, additionalFields, monthDayFieldNames, eraYearFieldNames)), merged;
|
|
2322
|
+
}
|
|
2323
|
+
function spliceFields(dest, additional, allPropNames, deletablePropNames) {
|
|
2324
|
+
let anyMatching = 0;
|
|
2325
|
+
const nonMatchingPropNames = [];
|
|
2326
|
+
for (const propName of allPropNames) void 0 !== additional[propName] ? anyMatching = 1 : nonMatchingPropNames.push(propName);
|
|
2327
|
+
if (Object.assign(dest, additional), anyMatching) for (const deletablePropName of deletablePropNames || nonMatchingPropNames) delete dest[deletablePropName];
|
|
2328
|
+
}
|
|
2329
|
+
function mergeZonedDateTimeFields(zonedDateTimeSlots, modFields, options) {
|
|
2330
|
+
const { calendar, timeZone } = zonedDateTimeSlots;
|
|
2331
|
+
const validFieldNames = getCalendarFieldNames(calendar, dateTimeAndOffsetFieldNamesAlpha, dateTimeAndOffsetFieldNamesWithEraAlpha);
|
|
2332
|
+
const zonedSlots = zonedEpochSlotsToIso(zonedDateTimeSlots);
|
|
2333
|
+
const { year, month, day } = computeCalendarDateFields(calendar, zonedSlots);
|
|
2334
|
+
const origFields = {
|
|
2335
|
+
year,
|
|
2336
|
+
monthCode: computeMonthCode(calendar, year, month),
|
|
2337
|
+
day,
|
|
2338
|
+
hour: zonedSlots.hour,
|
|
2339
|
+
minute: zonedSlots.minute,
|
|
2340
|
+
second: zonedSlots.second,
|
|
2341
|
+
millisecond: zonedSlots.millisecond,
|
|
2342
|
+
microsecond: zonedSlots.microsecond,
|
|
2343
|
+
nanosecond: zonedSlots.nanosecond,
|
|
2344
|
+
offset: zonedSlots.offsetNanoseconds
|
|
2345
|
+
};
|
|
2346
|
+
const partialFields = readAndRefineBagFields(modFields, validFieldNames, zonedDateTimeFieldRefiners);
|
|
2347
|
+
const mergedCalendarFields = mergeCalendarFields(calendar, origFields, partialFields);
|
|
2348
|
+
const mergedAllFields = {
|
|
2349
|
+
...origFields,
|
|
2350
|
+
...partialFields
|
|
2351
|
+
};
|
|
2352
|
+
const [isoDateFields, overflow, offsetDisambig, epochDisambig] = createPlainDateFromFieldsWithOptionsRefiner(calendar, mergedCalendarFields, () => refineZonedFieldOptions(options, 2));
|
|
2353
|
+
return createZonedEpochNanoSlots(getMatchingInstantFor(timeZone, combineDateAndTime(isoDateFields, constrainTimeFields(mergedAllFields, overflow)), mergedAllFields.offset, offsetDisambig, epochDisambig), timeZone, calendar);
|
|
2354
|
+
}
|
|
2355
|
+
function mergePlainDateTimeFields(plainDateTimeSlots, modFields, options) {
|
|
2356
|
+
const { calendar } = plainDateTimeSlots;
|
|
2357
|
+
const validFieldNames = getCalendarFieldNames(calendar, dateTimeFieldNamesAlpha, dateTimeFieldNamesWithEraAlpha);
|
|
2358
|
+
const { year, month, day } = computeCalendarDateFields(calendar, plainDateTimeSlots);
|
|
2359
|
+
const origFields = {
|
|
2360
|
+
year,
|
|
2361
|
+
monthCode: computeMonthCode(calendar, year, month),
|
|
2362
|
+
day,
|
|
2363
|
+
hour: plainDateTimeSlots.hour,
|
|
2364
|
+
minute: plainDateTimeSlots.minute,
|
|
2365
|
+
second: plainDateTimeSlots.second,
|
|
2366
|
+
millisecond: plainDateTimeSlots.millisecond,
|
|
2367
|
+
microsecond: plainDateTimeSlots.microsecond,
|
|
2368
|
+
nanosecond: plainDateTimeSlots.nanosecond
|
|
2369
|
+
};
|
|
2370
|
+
const partialFields = readAndRefineBagFields(modFields, validFieldNames, dateTimeFieldRefiners);
|
|
2371
|
+
const mergedCalendarFields = mergeCalendarFields(calendar, origFields, partialFields);
|
|
2372
|
+
const mergedAllFields = {
|
|
2373
|
+
...origFields,
|
|
2374
|
+
...partialFields
|
|
2375
|
+
};
|
|
2376
|
+
const [plainDateSlots, overflow] = createPlainDateFromFieldsWithOptionsRefiner(calendar, mergedCalendarFields, () => [refineOverflowOptions(options)]);
|
|
2377
|
+
return createPlainDateTimeFromRefinedFields(plainDateSlots, constrainTimeFields(mergedAllFields, overflow), calendar);
|
|
2378
|
+
}
|
|
2379
|
+
function mergePlainDateFields(plainDateSlots, modFields, options) {
|
|
2380
|
+
const { calendar } = plainDateSlots;
|
|
2381
|
+
const validFieldNames = getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha);
|
|
2382
|
+
const { year, month, day } = computeCalendarDateFields(calendar, plainDateSlots);
|
|
2383
|
+
return createPlainDateFromFields(calendar, mergeCalendarFields(calendar, {
|
|
2384
|
+
year,
|
|
2385
|
+
monthCode: computeMonthCode(calendar, year, month),
|
|
2386
|
+
day
|
|
2387
|
+
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners)), options);
|
|
2388
|
+
}
|
|
2389
|
+
function mergePlainYearMonthFields(plainYearMonthSlots, modFields, options) {
|
|
2390
|
+
const { calendar } = plainYearMonthSlots;
|
|
2391
|
+
const validFieldNames = getCalendarFieldNames(calendar, yearMonthFieldNamesAlpha, yearMonthFieldNamesWithEraAlpha);
|
|
2392
|
+
const { year, month } = computeCalendarDateFields(calendar, plainYearMonthSlots);
|
|
2393
|
+
return createPlainYearMonthFromFields(calendar, mergeCalendarFields(calendar, {
|
|
2394
|
+
year,
|
|
2395
|
+
monthCode: computeMonthCode(calendar, year, month)
|
|
2396
|
+
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners)), options);
|
|
2397
|
+
}
|
|
2398
|
+
function mergePlainMonthDayFields(plainMonthDaySlots, modFields, options) {
|
|
2399
|
+
const { calendar } = plainMonthDaySlots;
|
|
2400
|
+
const validFieldNames = getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha);
|
|
2401
|
+
const { year, month, day } = computeCalendarDateFields(calendar, plainMonthDaySlots);
|
|
2402
|
+
return createPlainMonthDayFromFields(calendar, mergeCalendarFields(calendar, {
|
|
2403
|
+
monthCode: computeMonthCode(calendar, year, month),
|
|
2404
|
+
day
|
|
2405
|
+
}, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners)), options);
|
|
2406
|
+
}
|
|
2407
|
+
function mergePlainTimeFields(initialFields, mod, options) {
|
|
2408
|
+
return ((initialFields, modFields, options) => resolveTimeFields({
|
|
2409
|
+
...pluckProps(timeFieldNamesAlpha, initialFields),
|
|
2410
|
+
...readAndRefineBagFields(modFields, timeFieldNamesAlpha, timeFieldRefiners)
|
|
2411
|
+
}, refineOverflowOptions(options)))(initialFields, mod, options);
|
|
2412
|
+
}
|
|
2413
|
+
function mergeDurationFields(slots, fields) {
|
|
2414
|
+
return createDurationSlots((initialFields = slots, modFields = fields, validateDurationFields({
|
|
2415
|
+
...initialFields,
|
|
2416
|
+
...readAndRefineBagFields(modFields, durationFieldNamesAlpha, durationFieldRefiners)
|
|
2417
|
+
})));
|
|
2418
|
+
var initialFields, modFields;
|
|
2419
|
+
}
|
|
2420
|
+
function computeMonthCode(calendar, year, month) {
|
|
2421
|
+
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
|
|
2422
|
+
return formatMonthCode(monthCodeNumber, isLeapMonth);
|
|
2423
|
+
}
|
|
2424
|
+
function instantToZonedDateTime(instantSlots, timeZone, calendar) {
|
|
2425
|
+
return createZonedEpochNanoSlots(instantSlots.epochNanoseconds, timeZone, calendar);
|
|
2426
|
+
}
|
|
2427
|
+
function zonedDateTimeToInstant(zonedDateTimeSlots0) {
|
|
2428
|
+
return createEpochNanoSlots(zonedDateTimeSlots0.epochNanoseconds);
|
|
2429
|
+
}
|
|
2430
|
+
function zonedDateTimeToPlainDateTime(zonedDateTimeSlots0) {
|
|
2431
|
+
return createDateTimeSlots(zonedEpochSlotsToIso(zonedDateTimeSlots0), zonedDateTimeSlots0.calendar);
|
|
2432
|
+
}
|
|
2433
|
+
function zonedDateTimeToPlainDate(zonedDateTimeSlots0) {
|
|
2434
|
+
return createDateSlots(zonedEpochSlotsToIso(zonedDateTimeSlots0), zonedDateTimeSlots0.calendar);
|
|
2435
|
+
}
|
|
2436
|
+
function zonedDateTimeToPlainTime(zonedDateTimeSlots0) {
|
|
2437
|
+
return createTimeSlots(zonedEpochSlotsToIso(zonedDateTimeSlots0));
|
|
2438
|
+
}
|
|
2439
|
+
function plainDateTimeToZonedDateTime(plainDateTimeSlots, timeZone, options) {
|
|
2440
|
+
return createZonedEpochNanoSlots(checkEpochNanoInBounds(((timeZone, isoDateTime, options) => {
|
|
2441
|
+
return getSingleInstantFor(timeZone, isoDateTime, ((options) => coerceEpochDisambig(normalizeOptions(options)))(options));
|
|
2442
|
+
})(timeZone, plainDateTimeSlots, options)), timeZone, plainDateTimeSlots.calendar);
|
|
2443
|
+
}
|
|
2444
|
+
function plainDateToZonedDateTime(refineTimeZoneString, refinePlainTimeArg, plainDateSlots, options) {
|
|
2445
|
+
const timeZoneId = refineTimeZoneString(options.timeZone);
|
|
2446
|
+
const plainTimeArg = options.plainTime;
|
|
2447
|
+
const timeFields = void 0 !== plainTimeArg ? refinePlainTimeArg(plainTimeArg) : void 0;
|
|
2448
|
+
const timeZone = queryTimeZone(timeZoneId);
|
|
2449
|
+
let epochNano;
|
|
2450
|
+
return epochNano = timeFields ? getSingleInstantFor(timeZone, combineDateAndTime(plainDateSlots, timeFields)) : getStartOfDayInstantFor(timeZone, combineDateAndTime(plainDateSlots, timeFieldDefaults)), createZonedEpochNanoSlots(epochNano, timeZone, plainDateSlots.calendar);
|
|
2451
|
+
}
|
|
2452
|
+
function convertPlainYearMonthToDate(calendar, input, bag) {
|
|
2453
|
+
return createPlainDateFromMergedFields(calendar, pluckProps(getCalendarFieldNames(calendar, yearMonthCodeFieldNamesAlpha, yearMonthCodeFieldNamesWithEraAlpha), input), readAndRefineBagFields(requireObjectLike(bag), dayFieldNamesAsc, dateFieldRefiners, []));
|
|
2454
|
+
}
|
|
2455
|
+
function convertPlainMonthDayToDate(calendar, input, bag) {
|
|
2456
|
+
const extraFieldNames = getCalendarFieldNames(calendar, yearFieldNamesAsc, yearFieldNamesWithEraAlpha);
|
|
2457
|
+
return createPlainDateFromMergedFields(calendar, pluckProps(monthCodeDayFieldNamesAlpha, input), readAndRefineBagFields(requireObjectLike(bag), extraFieldNames, dateFieldRefiners, []));
|
|
2458
|
+
}
|
|
2459
|
+
function convertToPlainMonthDay(calendar, input) {
|
|
2460
|
+
return createPlainMonthDayFromFields(calendar, readAndRefineBagFields(input, monthCodeDayFieldNamesAlpha, dateFieldRefiners));
|
|
2461
|
+
}
|
|
2462
|
+
function convertToPlainYearMonth(calendar, input, options) {
|
|
2463
|
+
return createPlainYearMonthFromFields(calendar, readAndRefineBagFields(input, getCalendarFieldNames(calendar, yearMonthCodeFieldNamesAlpha, yearMonthCodeFieldNamesWithEraAlpha), dateFieldRefiners), options);
|
|
2464
|
+
}
|
|
2465
|
+
function createPlainDateFromMergedFields(calendar, inputFields, extraFields) {
|
|
2466
|
+
const mergedFieldNames = getCalendarFieldNames(calendar, yearMonthCodeDayFieldNamesAlpha, yearMonthCodeDayFieldNamesWithEraAlpha);
|
|
2467
|
+
let mergedFields = mergeCalendarFields(calendar, inputFields, extraFields);
|
|
2468
|
+
return mergedFields = readAndRefineBagFields(mergedFields, mergedFieldNames, dateFieldRefiners, []), createPlainDateFromFields(calendar, mergedFields);
|
|
2469
|
+
}
|
|
2470
|
+
function epochMilliToInstant(epochMilli) {
|
|
2471
|
+
return createEpochNanoSlots(checkEpochNanoInBounds(BigInt(toStrictInteger(epochMilli)) * bigNanoInMilli));
|
|
2472
|
+
}
|
|
2473
|
+
function epochNanoToInstant(epochNano) {
|
|
2474
|
+
return createEpochNanoSlots(checkEpochNanoInBounds(toBigInt(epochNano)));
|
|
2475
|
+
}
|
|
2476
|
+
function applyPlainFormatTimeZone(options) {
|
|
2477
|
+
return options.timeZone = "UTC", ["full", "long"].includes(options.timeStyle) && (options.timeStyle = "medium"), options;
|
|
2478
|
+
}
|
|
2479
|
+
function applyZonedFormatTimeZone(options, timeZoneId) {
|
|
2480
|
+
return void 0 !== options.timeZone && throwTypeError("Cannot specify TimeZone"), options.timeZone = timeZoneId, options;
|
|
2481
|
+
}
|
|
2482
|
+
function checkResolvedCalendarCompatible(format, slots, strictCalendarCheck) {
|
|
2483
|
+
const resolvedCalendarId = format.resolvedOptions().calendar;
|
|
2484
|
+
!strictCalendarCheck && slots.calendar === void 0 || getCalendarSlotId(slots.calendar) === resolvedCalendarId || throwRangeError("Mismatching Calendars");
|
|
2485
|
+
}
|
|
2486
|
+
function createOptionsTransformer(shapeFieldNames, invalidShapeFieldNames, ignoredFieldNames, defaultShapeFields, dateStyleReplacementFields) {
|
|
2487
|
+
const shapeFieldNameSet = new Set(shapeFieldNames);
|
|
2488
|
+
const invalidShapeFieldNameSet = new Set(invalidShapeFieldNames);
|
|
2489
|
+
const ignoredFieldNameSet = new Set(ignoredFieldNames);
|
|
2490
|
+
return (options, allowPartialOverlap) => {
|
|
2491
|
+
const analysis = ((options, shapeFieldNameSet, invalidShapeFieldNameSet, ignoredFieldNameSet) => {
|
|
2492
|
+
const analysis = {
|
|
2493
|
+
dateStyle: void 0,
|
|
2494
|
+
timeStyle: void 0,
|
|
2495
|
+
me: {},
|
|
2496
|
+
pe: {},
|
|
2497
|
+
xe: {},
|
|
2498
|
+
oe: 0,
|
|
2499
|
+
ue: 0
|
|
2500
|
+
};
|
|
2501
|
+
for (const name of Object.keys(options)) {
|
|
2502
|
+
const value = options[name];
|
|
2503
|
+
void 0 === value || ignoredFieldNameSet.has(name) || (shapeFieldNameSet.has(name) ? "dateStyle" === name ? analysis.dateStyle = value : "timeStyle" === name ? analysis.timeStyle = value : analysis.me[name] = value : "era" === name ? analysis.pe[name] = value : invalidShapeFieldNameSet.has(name) ? "dateStyle" === name || "timeStyle" === name ? analysis.ue = 1 : analysis.oe = 1 : analysis.xe[name] = value);
|
|
2504
|
+
}
|
|
2505
|
+
return analysis;
|
|
2506
|
+
})(options, shapeFieldNameSet, invalidShapeFieldNameSet, ignoredFieldNameSet);
|
|
2507
|
+
const hasDateStyle = void 0 !== analysis.dateStyle;
|
|
2508
|
+
const hasTimeStyle = void 0 !== analysis.timeStyle;
|
|
2509
|
+
const hasAnyStyle = hasDateStyle || hasTimeStyle;
|
|
2510
|
+
const hasGranularShapeFields = Object.keys(analysis.me).length > 0;
|
|
2511
|
+
const hasInvalids = analysis.oe || analysis.ue;
|
|
2512
|
+
const hasShapeFields = hasGranularShapeFields || hasDateStyle || hasTimeStyle;
|
|
2513
|
+
const hasModifierFields = Object.keys(analysis.pe).length > 0;
|
|
2514
|
+
const hasStyleConflictFields = hasGranularShapeFields || hasModifierFields || analysis.oe;
|
|
2515
|
+
(!allowPartialOverlap && hasInvalids || allowPartialOverlap && hasInvalids && !hasShapeFields || hasAnyStyle && hasStyleConflictFields) && throwTypeError("Invalid formatting options");
|
|
2516
|
+
const transformedOptions = {};
|
|
2517
|
+
return hasAnyStyle || hasShapeFields || Object.assign(transformedOptions, defaultShapeFields), Object.assign(transformedOptions, analysis.me, analysis.pe, analysis.xe), hasDateStyle && (dateStyleReplacementFields ? Object.assign(transformedOptions, dateStyleReplacementFields[analysis.dateStyle]) : transformedOptions.dateStyle = analysis.dateStyle), hasTimeStyle && (transformedOptions.timeStyle = analysis.timeStyle), transformedOptions;
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
const dateDefaultShapeFields = {
|
|
2521
|
+
year: "numeric",
|
|
2522
|
+
month: "numeric",
|
|
2523
|
+
day: "numeric"
|
|
2524
|
+
};
|
|
2525
|
+
const timeDefaultShapeFields = {
|
|
2526
|
+
hour: "numeric",
|
|
2527
|
+
minute: "numeric",
|
|
2528
|
+
second: "numeric"
|
|
2529
|
+
};
|
|
2530
|
+
const dateTimeDefaultShapeFields = /* @__PURE__ */ Object.assign({}, dateDefaultShapeFields, timeDefaultShapeFields);
|
|
2531
|
+
const zonedDateTimeDefaultShapeFields = /* @__PURE__ */ Object.assign({}, dateTimeDefaultShapeFields, { timeZoneName: "short" });
|
|
2532
|
+
const yearMonthDefaultShapeFields = {
|
|
2533
|
+
year: "numeric",
|
|
2534
|
+
month: "numeric"
|
|
2535
|
+
};
|
|
2536
|
+
const monthDayDefaultShapeFields = {
|
|
2537
|
+
month: "numeric",
|
|
2538
|
+
day: "numeric"
|
|
2539
|
+
};
|
|
2540
|
+
const dateShapeFieldNames = [
|
|
2541
|
+
"weekday",
|
|
2542
|
+
"year",
|
|
2543
|
+
"month",
|
|
2544
|
+
"day",
|
|
2545
|
+
"dateStyle"
|
|
2546
|
+
];
|
|
2547
|
+
const timeShapeFieldNames = [
|
|
2548
|
+
"dayPeriod",
|
|
2549
|
+
"hour",
|
|
2550
|
+
"minute",
|
|
2551
|
+
"second",
|
|
2552
|
+
"fractionalSecondDigits",
|
|
2553
|
+
"timeStyle"
|
|
2554
|
+
];
|
|
2555
|
+
const dateTimeShapeFieldNames = /* @__PURE__ */ dateShapeFieldNames.concat(timeShapeFieldNames);
|
|
2556
|
+
const yearMonthIgnoredFieldNames = /* @__PURE__ */ ["weekday", "day"].concat(timeShapeFieldNames);
|
|
2557
|
+
const monthDayIgnoredFieldNames = /* @__PURE__ */ ["weekday", "year"].concat(timeShapeFieldNames);
|
|
2558
|
+
const transformInstantOptions = /* @__PURE__ */ createOptionsTransformer(dateTimeShapeFieldNames, [], [], dateTimeDefaultShapeFields);
|
|
2559
|
+
const transformZonedOptions = /* @__PURE__ */ createOptionsTransformer(dateTimeShapeFieldNames, [], [], zonedDateTimeDefaultShapeFields);
|
|
2560
|
+
const transformDateTimeOptions = /* @__PURE__ */ createOptionsTransformer(dateTimeShapeFieldNames, [], ["timeZoneName"], dateTimeDefaultShapeFields);
|
|
2561
|
+
const transformDateOptions = /* @__PURE__ */ createOptionsTransformer(dateShapeFieldNames, timeShapeFieldNames, ["timeZoneName"], dateDefaultShapeFields);
|
|
2562
|
+
const transformTimeOptions = /* @__PURE__ */ createOptionsTransformer(timeShapeFieldNames, dateShapeFieldNames, ["timeZoneName", "era"], timeDefaultShapeFields);
|
|
2563
|
+
const transformYearMonthOptions = /* @__PURE__ */ createOptionsTransformer([
|
|
2564
|
+
"year",
|
|
2565
|
+
"month",
|
|
2566
|
+
"dateStyle"
|
|
2567
|
+
], yearMonthIgnoredFieldNames, ["timeZoneName"], yearMonthDefaultShapeFields, {
|
|
2568
|
+
full: {
|
|
2569
|
+
year: "numeric",
|
|
2570
|
+
month: "long"
|
|
2571
|
+
},
|
|
2572
|
+
long: {
|
|
2573
|
+
year: "numeric",
|
|
2574
|
+
month: "long"
|
|
2575
|
+
},
|
|
2576
|
+
medium: {
|
|
2577
|
+
year: "numeric",
|
|
2578
|
+
month: "short"
|
|
2579
|
+
},
|
|
2580
|
+
short: {
|
|
2581
|
+
year: "2-digit",
|
|
2582
|
+
month: "numeric"
|
|
2583
|
+
}
|
|
2584
|
+
});
|
|
2585
|
+
const transformMonthDayOptions = /* @__PURE__ */ createOptionsTransformer([
|
|
2586
|
+
"month",
|
|
2587
|
+
"day",
|
|
2588
|
+
"dateStyle"
|
|
2589
|
+
], monthDayIgnoredFieldNames, ["timeZoneName", "era"], monthDayDefaultShapeFields, {
|
|
2590
|
+
full: {
|
|
2591
|
+
month: "long",
|
|
2592
|
+
day: "numeric"
|
|
2593
|
+
},
|
|
2594
|
+
long: {
|
|
2595
|
+
month: "long",
|
|
2596
|
+
day: "numeric"
|
|
2597
|
+
},
|
|
2598
|
+
medium: {
|
|
2599
|
+
month: "short",
|
|
2600
|
+
day: "numeric"
|
|
2601
|
+
},
|
|
2602
|
+
short: {
|
|
2603
|
+
month: "numeric",
|
|
2604
|
+
day: "numeric"
|
|
2605
|
+
}
|
|
2606
|
+
});
|
|
2607
|
+
function zonedDateTimeWithPlainTime(zonedDateTimeSlots, plainTimeFields) {
|
|
2608
|
+
const { timeZone } = zonedDateTimeSlots;
|
|
2609
|
+
const isoDateTime = zonedEpochSlotsToIso(zonedDateTimeSlots);
|
|
2610
|
+
const { offsetNanoseconds } = isoDateTime;
|
|
2611
|
+
const time = plainTimeFields || timeFieldDefaults;
|
|
2612
|
+
let epochNano;
|
|
2613
|
+
return epochNano = plainTimeFields ? getMatchingInstantFor(timeZone, combineDateAndTime(isoDateTime, time), offsetNanoseconds, 2) : getStartOfDayInstantFor(timeZone, combineDateAndTime(isoDateTime, time)), createZonedEpochNanoSlots(epochNano, timeZone, zonedDateTimeSlots.calendar);
|
|
2614
|
+
}
|
|
2615
|
+
function getCurrentIsoDateTime(timeZone) {
|
|
2616
|
+
const epochNano = getCurrentEpochNano();
|
|
2617
|
+
const offsetNano = timeZone.C(epochNano);
|
|
2618
|
+
return epochNanoToIsoDateTime(epochNano + BigInt(offsetNano));
|
|
2619
|
+
}
|
|
2620
|
+
function getCurrentEpochNano() {
|
|
2621
|
+
return BigInt(Date.now()) * bigNanoInMilli;
|
|
2622
|
+
}
|
|
2623
|
+
function getCurrentTimeZoneId() {
|
|
2624
|
+
return new RawDateTimeFormat().resolvedOptions().timeZone;
|
|
2625
|
+
}
|
|
2626
|
+
//#endregion
|
|
2627
|
+
//#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/chunks/apiHelpers.js
|
|
2628
|
+
const PlainYearMonthBranding = "PlainYearMonth";
|
|
2629
|
+
const PlainMonthDayBranding = "PlainMonthDay";
|
|
2630
|
+
const PlainDateBranding = "PlainDate";
|
|
2631
|
+
const PlainDateTimeBranding = "PlainDateTime";
|
|
2632
|
+
const PlainTimeBranding = "PlainTime";
|
|
2633
|
+
const ZonedDateTimeBranding = "ZonedDateTime";
|
|
2634
|
+
const InstantBranding = "Instant";
|
|
2635
|
+
const DurationBranding = "Duration";
|
|
2636
|
+
function defineTemporalClass(branding, cls, getSlots, ...getterMaps) {
|
|
2637
|
+
Object.defineProperties(cls, createNameDescriptors(branding)), Object.defineProperties(cls.prototype, createStringTagDescriptors("Temporal." + branding));
|
|
2638
|
+
for (const getterMap of getterMaps) defineSlotGetters(cls.prototype, getSlots, getterMap);
|
|
2639
|
+
return cls;
|
|
2640
|
+
}
|
|
2641
|
+
function defineSlotGetters(destPrototype, getSlots, getterMap) {
|
|
2642
|
+
Object.defineProperties(destPrototype, mapProps((getter) => ({
|
|
2643
|
+
get() {
|
|
2644
|
+
return getter(getSlots(this));
|
|
2645
|
+
},
|
|
2646
|
+
configurable: 1
|
|
2647
|
+
}), getterMap));
|
|
2648
|
+
}
|
|
2649
|
+
const attachDebugString = "noop" === noop.name ? (instance) => {
|
|
2650
|
+
Object.defineProperty(instance, "_str_", { value: instance.toJSON() });
|
|
2651
|
+
} : noop;
|
|
2652
|
+
function invalidRecordType() {
|
|
2653
|
+
throwTypeError(invalidCallingContext);
|
|
2654
|
+
}
|
|
2655
|
+
function forbiddenValueOf() {
|
|
2656
|
+
throwTypeError(forbiddenValueOf$1);
|
|
2657
|
+
}
|
|
2658
|
+
const yearMonthFieldGetters$1 = {
|
|
2659
|
+
era(slots) {
|
|
2660
|
+
return computeCalendarEraFields(slots.calendar, slots).era;
|
|
2661
|
+
},
|
|
2662
|
+
eraYear(slots) {
|
|
2663
|
+
return computeCalendarEraFields(slots.calendar, slots).eraYear;
|
|
2664
|
+
},
|
|
2665
|
+
year(slots) {
|
|
2666
|
+
return computeCalendarDateFields(slots.calendar, slots).year;
|
|
2667
|
+
},
|
|
2668
|
+
month(slots) {
|
|
2669
|
+
return computeCalendarDateFields(slots.calendar, slots).month;
|
|
2670
|
+
},
|
|
2671
|
+
monthCode(slots) {
|
|
2672
|
+
return computeCalendarMonthCode(slots.calendar, slots);
|
|
2673
|
+
}
|
|
2674
|
+
};
|
|
2675
|
+
const dateFieldGetters$1 = {
|
|
2676
|
+
era(slots) {
|
|
2677
|
+
return computeCalendarEraFields(slots.calendar, slots).era;
|
|
2678
|
+
},
|
|
2679
|
+
eraYear(slots) {
|
|
2680
|
+
return computeCalendarEraFields(slots.calendar, slots).eraYear;
|
|
2681
|
+
},
|
|
2682
|
+
year(slots) {
|
|
2683
|
+
return computeCalendarDateFields(slots.calendar, slots).year;
|
|
2684
|
+
},
|
|
2685
|
+
month(slots) {
|
|
2686
|
+
return computeCalendarDateFields(slots.calendar, slots).month;
|
|
2687
|
+
},
|
|
2688
|
+
monthCode(slots) {
|
|
2689
|
+
return computeCalendarMonthCode(slots.calendar, slots);
|
|
2690
|
+
},
|
|
2691
|
+
day(slots) {
|
|
2692
|
+
return computeCalendarDateFields(slots.calendar, slots).day;
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2695
|
+
const monthDayFieldGetters$1 = {
|
|
2696
|
+
monthCode(slots) {
|
|
2697
|
+
return computeCalendarMonthCode(slots.calendar, slots);
|
|
2698
|
+
},
|
|
2699
|
+
day(slots) {
|
|
2700
|
+
return computeCalendarDateFields(slots.calendar, slots).day;
|
|
2701
|
+
}
|
|
2702
|
+
};
|
|
2703
|
+
const yearMonthDerivedGetters = {
|
|
2704
|
+
daysInMonth(slots) {
|
|
2705
|
+
return computeCalendarDaysInMonth(slots.calendar, slots);
|
|
2706
|
+
},
|
|
2707
|
+
daysInYear(slots) {
|
|
2708
|
+
return computeCalendarDaysInYear(slots.calendar, slots);
|
|
2709
|
+
},
|
|
2710
|
+
monthsInYear(slots) {
|
|
2711
|
+
return computeCalendarMonthsInYear(slots.calendar, slots);
|
|
2712
|
+
},
|
|
2713
|
+
inLeapYear(slots) {
|
|
2714
|
+
return computeCalendarInLeapYear(slots.calendar, slots);
|
|
2715
|
+
}
|
|
2716
|
+
};
|
|
2717
|
+
const dateDerivedGetters = {
|
|
2718
|
+
dayOfWeek(slots) {
|
|
2719
|
+
return computeIsoDayOfWeek(slots);
|
|
2720
|
+
},
|
|
2721
|
+
dayOfYear(slots) {
|
|
2722
|
+
return computeCalendarDayOfYear(slots.calendar, slots);
|
|
2723
|
+
},
|
|
2724
|
+
weekOfYear(slots) {
|
|
2725
|
+
return computeCalendarWeekOfYear(slots.calendar, slots);
|
|
2726
|
+
},
|
|
2727
|
+
yearOfWeek(slots) {
|
|
2728
|
+
return computeCalendarYearOfWeek(slots.calendar, slots);
|
|
2729
|
+
},
|
|
2730
|
+
daysInWeek() {
|
|
2731
|
+
return 7;
|
|
2732
|
+
},
|
|
2733
|
+
daysInMonth(slots) {
|
|
2734
|
+
return computeCalendarDaysInMonth(slots.calendar, slots);
|
|
2735
|
+
},
|
|
2736
|
+
daysInYear(slots) {
|
|
2737
|
+
return computeCalendarDaysInYear(slots.calendar, slots);
|
|
2738
|
+
},
|
|
2739
|
+
monthsInYear(slots) {
|
|
2740
|
+
return computeCalendarMonthsInYear(slots.calendar, slots);
|
|
2741
|
+
},
|
|
2742
|
+
inLeapYear(slots) {
|
|
2743
|
+
return computeCalendarInLeapYear(slots.calendar, slots);
|
|
2744
|
+
}
|
|
2745
|
+
};
|
|
2746
|
+
function createNativeGetters(shimGetters) {
|
|
2747
|
+
return createPropGetters(Object.keys(shimGetters));
|
|
2748
|
+
}
|
|
2749
|
+
createNativeGetters(yearMonthDerivedGetters), createNativeGetters(dateDerivedGetters);
|
|
2750
|
+
//#endregion
|
|
2751
|
+
//#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/chunks/classApi-basic.js
|
|
2752
|
+
function resolveBasicCalendarId(rawCalendarId) {
|
|
2753
|
+
const lowerRawCalendarId = requireString(rawCalendarId).toLowerCase();
|
|
2754
|
+
return lowerRawCalendarId === "iso8601" ? void 0 : lowerRawCalendarId === "gregory" ? 0 : void throwRangeError(exoticCalendarRequired(rawCalendarId, "temporal-polyfill/full"));
|
|
2755
|
+
}
|
|
2756
|
+
function resolveBasicCalendarArg(rawCalendarId = isoCalendarId) {
|
|
2757
|
+
return resolveBasicCalendarId(rawCalendarId);
|
|
2758
|
+
}
|
|
2759
|
+
const zonedDateTimeSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
2760
|
+
const ZonedDateTime = /* @__PURE__ */ defineTemporalClass(ZonedDateTimeBranding, class {
|
|
2761
|
+
constructor(epochNanoseconds, timeZoneId, calendar = void 0) {
|
|
2762
|
+
const epochNano = checkEpochNanoInBounds(toBigInt(epochNanoseconds));
|
|
2763
|
+
const timeZone = queryTimeZone(refineTimeZoneId(timeZoneId));
|
|
2764
|
+
const calendarImpl = resolveBasicCalendarArg(calendar);
|
|
2765
|
+
initZonedDateTime(this, createZonedEpochNanoSlots(epochNano, timeZone, calendarImpl));
|
|
2766
|
+
}
|
|
2767
|
+
static from(arg, options = void 0) {
|
|
2768
|
+
return createZonedDateTime(toZonedDateTimeSlots(arg, options));
|
|
2769
|
+
}
|
|
2770
|
+
static compare(arg0, arg1) {
|
|
2771
|
+
return compareZonedDateTimes(toZonedDateTimeSlots(arg0), toZonedDateTimeSlots(arg1));
|
|
2772
|
+
}
|
|
2773
|
+
get calendarId() {
|
|
2774
|
+
return getCalendarSlotId(getZonedDateTimeSlots(this).calendar);
|
|
2775
|
+
}
|
|
2776
|
+
get timeZoneId() {
|
|
2777
|
+
return getZonedDateTimeSlots(this).timeZone.id;
|
|
2778
|
+
}
|
|
2779
|
+
get epochMilliseconds() {
|
|
2780
|
+
return getEpochMilli(getZonedDateTimeSlots(this));
|
|
2781
|
+
}
|
|
2782
|
+
get epochNanoseconds() {
|
|
2783
|
+
return getEpochNano(getZonedDateTimeSlots(this));
|
|
2784
|
+
}
|
|
2785
|
+
get offset() {
|
|
2786
|
+
return formatOffsetNano(zonedEpochSlotsToIso(getZonedDateTimeSlots(this)).offsetNanoseconds);
|
|
2787
|
+
}
|
|
2788
|
+
get offsetNanoseconds() {
|
|
2789
|
+
return zonedEpochSlotsToIso(getZonedDateTimeSlots(this)).offsetNanoseconds;
|
|
2790
|
+
}
|
|
2791
|
+
get hoursInDay() {
|
|
2792
|
+
return computeZonedHoursInDay(getZonedDateTimeSlots(this));
|
|
2793
|
+
}
|
|
2794
|
+
with(mod, options = void 0) {
|
|
2795
|
+
return createZonedDateTime(mergeZonedDateTimeFields(getZonedDateTimeSlots(this), validateBag(mod), options));
|
|
2796
|
+
}
|
|
2797
|
+
withCalendar(calendarArg) {
|
|
2798
|
+
return createZonedDateTime({
|
|
2799
|
+
...getZonedDateTimeSlots(this),
|
|
2800
|
+
calendar: refineCalendarArg(calendarArg)
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
withTimeZone(timeZoneArg) {
|
|
2804
|
+
return createZonedDateTime({
|
|
2805
|
+
...getZonedDateTimeSlots(this),
|
|
2806
|
+
timeZone: queryTimeZone(refineTimeZoneArg(timeZoneArg))
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
withPlainTime(plainTimeArg = void 0) {
|
|
2810
|
+
return createZonedDateTime(zonedDateTimeWithPlainTime(getZonedDateTimeSlots(this), optionalToPlainTimeFields(plainTimeArg)));
|
|
2811
|
+
}
|
|
2812
|
+
add(durationArg, options = void 0) {
|
|
2813
|
+
return createZonedDateTime(moveZonedEpochSlots(getZonedDateTimeSlots(this), toDurationSlots(durationArg), options));
|
|
2814
|
+
}
|
|
2815
|
+
subtract(durationArg, options = void 0) {
|
|
2816
|
+
return createZonedDateTime(moveZonedEpochSlots(getZonedDateTimeSlots(this), negateDurationFields(toDurationSlots(durationArg)), options));
|
|
2817
|
+
}
|
|
2818
|
+
until(otherArg, options = void 0) {
|
|
2819
|
+
const slots = getZonedDateTimeSlots(this);
|
|
2820
|
+
const other = toZonedDateTimeSlots(otherArg);
|
|
2821
|
+
return createDuration(createDurationSlots(diffZonedDateTimes(0, getCommonCalendar(slots.calendar, other.calendar), slots, other, options)));
|
|
2822
|
+
}
|
|
2823
|
+
since(otherArg, options = void 0) {
|
|
2824
|
+
const slots = getZonedDateTimeSlots(this);
|
|
2825
|
+
const other = toZonedDateTimeSlots(otherArg);
|
|
2826
|
+
return createDuration(createDurationSlots(diffZonedDateTimes(1, getCommonCalendar(slots.calendar, other.calendar), slots, other, options)));
|
|
2827
|
+
}
|
|
2828
|
+
round(options) {
|
|
2829
|
+
const slots = getZonedDateTimeSlots(this);
|
|
2830
|
+
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options);
|
|
2831
|
+
return createZonedDateTime(roundZonedEpochSlotsToUnit(slots, smallestUnit, roundingInc, roundingMode));
|
|
2832
|
+
}
|
|
2833
|
+
startOfDay() {
|
|
2834
|
+
return createZonedDateTime(computeZonedStartOfDay(getZonedDateTimeSlots(this)));
|
|
2835
|
+
}
|
|
2836
|
+
equals(otherArg) {
|
|
2837
|
+
return zonedDateTimesEqual(getZonedDateTimeSlots(this), toZonedDateTimeSlots(otherArg));
|
|
2838
|
+
}
|
|
2839
|
+
toInstant() {
|
|
2840
|
+
return createInstant(zonedDateTimeToInstant(getZonedDateTimeSlots(this)));
|
|
2841
|
+
}
|
|
2842
|
+
toPlainDateTime() {
|
|
2843
|
+
return createPlainDateTime(zonedDateTimeToPlainDateTime(getZonedDateTimeSlots(this)));
|
|
2844
|
+
}
|
|
2845
|
+
toPlainDate() {
|
|
2846
|
+
return createPlainDate(zonedDateTimeToPlainDate(getZonedDateTimeSlots(this)));
|
|
2847
|
+
}
|
|
2848
|
+
toPlainTime() {
|
|
2849
|
+
return createPlainTime(zonedDateTimeToPlainTime(getZonedDateTimeSlots(this)));
|
|
2850
|
+
}
|
|
2851
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
2852
|
+
const slots = getZonedDateTimeSlots(this);
|
|
2853
|
+
const format = new RawDateTimeFormat(locales, applyZonedFormatTimeZone(transformZonedOptions(options), getZonedTimeZoneId(slots)));
|
|
2854
|
+
return checkResolvedCalendarCompatible(format, slots), format.format(getEpochMilli(slots));
|
|
2855
|
+
}
|
|
2856
|
+
toString(options = void 0) {
|
|
2857
|
+
return formatZonedDateTimeIso(getZonedDateTimeSlots(this), options);
|
|
2858
|
+
}
|
|
2859
|
+
toJSON() {
|
|
2860
|
+
return formatZonedDateTimeIso(getZonedDateTimeSlots(this));
|
|
2861
|
+
}
|
|
2862
|
+
getTimeZoneTransition(options) {
|
|
2863
|
+
const slots = getZonedDateTimeSlots(this);
|
|
2864
|
+
const newEpochNano = getTimeZoneTransitionEpochNanoseconds(slots, options);
|
|
2865
|
+
return newEpochNano ? createZonedDateTime({
|
|
2866
|
+
...slots,
|
|
2867
|
+
epochNanoseconds: newEpochNano
|
|
2868
|
+
}) : null;
|
|
2869
|
+
}
|
|
2870
|
+
valueOf() {
|
|
2871
|
+
return forbiddenValueOf();
|
|
2872
|
+
}
|
|
2873
|
+
}, getZonedDateTimeIsoSlots, dateFieldGetters$1, dateDerivedGetters, timeGetters);
|
|
2874
|
+
function createZonedDateTime(slots) {
|
|
2875
|
+
return initZonedDateTime(Object.create(ZonedDateTime.prototype), slots);
|
|
2876
|
+
}
|
|
2877
|
+
function getZonedDateTimeSlots(obj) {
|
|
2878
|
+
return getZonedDateTimeSlotsIfPresent(obj) || invalidRecordType();
|
|
2879
|
+
}
|
|
2880
|
+
function getZonedDateTimeIsoSlots(obj) {
|
|
2881
|
+
const slots = getZonedDateTimeSlots(obj);
|
|
2882
|
+
return {
|
|
2883
|
+
...zonedEpochSlotsToIso(slots),
|
|
2884
|
+
calendar: slots.calendar
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
function getZonedDateTimeSlotsIfPresent(obj) {
|
|
2888
|
+
return zonedDateTimeSlotsMap.get(obj);
|
|
2889
|
+
}
|
|
2890
|
+
function toZonedDateTimeSlots(arg, options) {
|
|
2891
|
+
if (isObjectLike(arg)) {
|
|
2892
|
+
const ownSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
2893
|
+
if (ownSlots) return refineZonedFieldOptions(options), ownSlots;
|
|
2894
|
+
return refineZonedDateTimeObjectLike(refineTimeZoneArg, getCalendarFromBag(arg), arg, options);
|
|
2895
|
+
}
|
|
2896
|
+
return parseZonedDateTime(arg, resolveBasicCalendarId, options);
|
|
2897
|
+
}
|
|
2898
|
+
function initZonedDateTime(instance, slots) {
|
|
2899
|
+
return zonedDateTimeSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
2900
|
+
}
|
|
2901
|
+
function refineTimeZoneArg(arg) {
|
|
2902
|
+
if (isObjectLike(arg)) {
|
|
2903
|
+
const slots = getZonedDateTimeSlotsIfPresent(arg);
|
|
2904
|
+
return slots || throwTypeError(invalidTimeZone(arg)), slots.timeZone.id;
|
|
2905
|
+
}
|
|
2906
|
+
return ((arg) => resolveTimeZoneId(parseTimeZoneId(requireString(arg))))(arg);
|
|
2907
|
+
}
|
|
2908
|
+
const instantSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
2909
|
+
const Instant = /* @__PURE__ */ defineTemporalClass(InstantBranding, class {
|
|
2910
|
+
constructor(epochNanoseconds) {
|
|
2911
|
+
const epochNano = checkEpochNanoInBounds(toBigInt(epochNanoseconds));
|
|
2912
|
+
initInstant(this, createEpochNanoSlots(epochNano));
|
|
2913
|
+
}
|
|
2914
|
+
static from(arg) {
|
|
2915
|
+
return createInstant(toInstantSlots(arg));
|
|
2916
|
+
}
|
|
2917
|
+
static fromEpochMilliseconds(epochMilli) {
|
|
2918
|
+
return createInstant(epochMilliToInstant(epochMilli));
|
|
2919
|
+
}
|
|
2920
|
+
static fromEpochNanoseconds(epochNano) {
|
|
2921
|
+
return createInstant(epochNanoToInstant(epochNano));
|
|
2922
|
+
}
|
|
2923
|
+
static compare(a, b) {
|
|
2924
|
+
return compareInstants(toInstantSlots(a), toInstantSlots(b));
|
|
2925
|
+
}
|
|
2926
|
+
get epochMilliseconds() {
|
|
2927
|
+
return getEpochMilli(getInstantSlots(this));
|
|
2928
|
+
}
|
|
2929
|
+
get epochNanoseconds() {
|
|
2930
|
+
return getEpochNano(getInstantSlots(this));
|
|
2931
|
+
}
|
|
2932
|
+
add(durationArg) {
|
|
2933
|
+
return createInstant(createEpochNanoSlots(moveEpochNano(getInstantSlots(this).epochNanoseconds, toDurationSlots(durationArg))));
|
|
2934
|
+
}
|
|
2935
|
+
subtract(durationArg) {
|
|
2936
|
+
return createInstant(createEpochNanoSlots(moveEpochNano(getInstantSlots(this).epochNanoseconds, negateDurationFields(toDurationSlots(durationArg)))));
|
|
2937
|
+
}
|
|
2938
|
+
until(otherArg, options = void 0) {
|
|
2939
|
+
return createDuration(diffInstants(0, getInstantSlots(this), toInstantSlots(otherArg), options));
|
|
2940
|
+
}
|
|
2941
|
+
since(otherArg, options = void 0) {
|
|
2942
|
+
return createDuration(diffInstants(1, getInstantSlots(this), toInstantSlots(otherArg), options));
|
|
2943
|
+
}
|
|
2944
|
+
round(options) {
|
|
2945
|
+
const slots = getInstantSlots(this);
|
|
2946
|
+
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options, 5, 1);
|
|
2947
|
+
return createInstant(createEpochNanoSlots(roundBigNanoToDayOriginInc(slots.epochNanoseconds, computeBigNanoInc(smallestUnit, roundingInc), roundingMode)));
|
|
2948
|
+
}
|
|
2949
|
+
equals(otherArg) {
|
|
2950
|
+
return instantsEqual(getInstantSlots(this), toInstantSlots(otherArg));
|
|
2951
|
+
}
|
|
2952
|
+
toZonedDateTimeISO(timeZoneArg) {
|
|
2953
|
+
return createZonedDateTime(instantToZonedDateTime(getInstantSlots(this), queryTimeZone(refineTimeZoneArg(timeZoneArg))));
|
|
2954
|
+
}
|
|
2955
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
2956
|
+
const slots = getInstantSlots(this);
|
|
2957
|
+
return new RawDateTimeFormat(locales, transformInstantOptions(options)).format(getEpochMilli(slots));
|
|
2958
|
+
}
|
|
2959
|
+
toString(options = void 0) {
|
|
2960
|
+
return formatInstantIso(refineTimeZoneArg, getInstantSlots(this), options);
|
|
2961
|
+
}
|
|
2962
|
+
toJSON() {
|
|
2963
|
+
return formatInstantIso(refineTimeZoneArg, getInstantSlots(this));
|
|
2964
|
+
}
|
|
2965
|
+
valueOf() {
|
|
2966
|
+
return forbiddenValueOf();
|
|
2967
|
+
}
|
|
2968
|
+
});
|
|
2969
|
+
function createInstant(slots) {
|
|
2970
|
+
return initInstant(Object.create(Instant.prototype), slots);
|
|
2971
|
+
}
|
|
2972
|
+
function getInstantSlots(obj) {
|
|
2973
|
+
return getInstantSlotsIfPresent(obj) || invalidRecordType();
|
|
2974
|
+
}
|
|
2975
|
+
function getInstantSlotsIfPresent(obj) {
|
|
2976
|
+
return instantSlotsMap.get(obj);
|
|
2977
|
+
}
|
|
2978
|
+
function toInstantSlots(arg) {
|
|
2979
|
+
if (isObjectLike(arg)) {
|
|
2980
|
+
const ownSlots = getInstantSlotsIfPresent(arg);
|
|
2981
|
+
if (ownSlots) return ownSlots;
|
|
2982
|
+
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
2983
|
+
if (zonedDateTimeSlots) return createEpochNanoSlots(zonedDateTimeSlots.epochNanoseconds);
|
|
2984
|
+
}
|
|
2985
|
+
return parseInstant(arg);
|
|
2986
|
+
}
|
|
2987
|
+
const { toTemporalInstant: toTemporalInstant$1 } = { toTemporalInstant() {
|
|
2988
|
+
const epochMilli = Date.prototype.valueOf.call(this);
|
|
2989
|
+
return createInstant(createEpochNanoSlots(BigInt(requireNumberIsInteger(epochMilli)) * bigNanoInMilli));
|
|
2990
|
+
} };
|
|
2991
|
+
function initInstant(instance, slots) {
|
|
2992
|
+
return instantSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
2993
|
+
}
|
|
2994
|
+
const plainMonthDaySlotsMap = /* @__PURE__ */ new WeakMap();
|
|
2995
|
+
const PlainMonthDay = /* @__PURE__ */ defineTemporalClass(PlainMonthDayBranding, class {
|
|
2996
|
+
constructor(isoMonth, isoDay, calendar = void 0, referenceIsoYear) {
|
|
2997
|
+
const isoMonthInt = toIntegerWithTrunc(isoMonth);
|
|
2998
|
+
const isoDayInt = toIntegerWithTrunc(isoDay);
|
|
2999
|
+
const calendarImpl = resolveBasicCalendarArg(calendar);
|
|
3000
|
+
const fields = checkIsoDateInBounds(validateIsoDateFields({
|
|
3001
|
+
year: toIntegerWithTrunc(referenceIsoYear ?? 1972),
|
|
3002
|
+
month: isoMonthInt,
|
|
3003
|
+
day: isoDayInt
|
|
3004
|
+
}));
|
|
3005
|
+
initPlainMonthDay(this, createDateSlots(fields, calendarImpl));
|
|
3006
|
+
}
|
|
3007
|
+
static from(arg, options = void 0) {
|
|
3008
|
+
return createPlainMonthDay(toPlainMonthDaySlots(arg, options));
|
|
3009
|
+
}
|
|
3010
|
+
get calendarId() {
|
|
3011
|
+
return getCalendarSlotId(getPlainMonthDaySlots(this).calendar);
|
|
3012
|
+
}
|
|
3013
|
+
with(mod, options = void 0) {
|
|
3014
|
+
return createPlainMonthDay(mergePlainMonthDayFields(getPlainMonthDaySlots(this), validateBag(mod), options));
|
|
3015
|
+
}
|
|
3016
|
+
equals(otherArg) {
|
|
3017
|
+
return plainMonthDaysEqual(getPlainMonthDaySlots(this), toPlainMonthDaySlots(otherArg));
|
|
3018
|
+
}
|
|
3019
|
+
toPlainDate(bag) {
|
|
3020
|
+
return createPlainDate(convertPlainMonthDayToDate(getPlainMonthDaySlots(this).calendar, this, bag));
|
|
3021
|
+
}
|
|
3022
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
3023
|
+
const slots = getPlainMonthDaySlots(this);
|
|
3024
|
+
const format = new RawDateTimeFormat(locales, applyPlainFormatTimeZone(transformMonthDayOptions(options)));
|
|
3025
|
+
return checkResolvedCalendarCompatible(format, slots, 1), format.format(isoDateToEpochMilli(slots));
|
|
3026
|
+
}
|
|
3027
|
+
toString(options = void 0) {
|
|
3028
|
+
return formatPlainMonthDayIso(getPlainMonthDaySlots(this), options);
|
|
3029
|
+
}
|
|
3030
|
+
toJSON() {
|
|
3031
|
+
return formatPlainMonthDayIso(getPlainMonthDaySlots(this));
|
|
3032
|
+
}
|
|
3033
|
+
valueOf() {
|
|
3034
|
+
return forbiddenValueOf();
|
|
3035
|
+
}
|
|
3036
|
+
}, getPlainMonthDaySlots, monthDayFieldGetters$1);
|
|
3037
|
+
function createPlainMonthDay(slots) {
|
|
3038
|
+
return initPlainMonthDay(Object.create(PlainMonthDay.prototype), slots);
|
|
3039
|
+
}
|
|
3040
|
+
function getPlainMonthDaySlots(obj) {
|
|
3041
|
+
return getPlainMonthDaySlotsIfPresent(obj) || invalidRecordType();
|
|
3042
|
+
}
|
|
3043
|
+
function getPlainMonthDaySlotsIfPresent(obj) {
|
|
3044
|
+
return plainMonthDaySlotsMap.get(obj);
|
|
3045
|
+
}
|
|
3046
|
+
function toPlainMonthDaySlots(arg, options) {
|
|
3047
|
+
if (isObjectLike(arg)) {
|
|
3048
|
+
const ownSlots = getPlainMonthDaySlotsIfPresent(arg);
|
|
3049
|
+
if (ownSlots) return refineOverflowOptions(options), ownSlots;
|
|
3050
|
+
const calendarMaybe = extractCalendarFromBag(arg);
|
|
3051
|
+
return refinePlainMonthDayObjectLike(void 0 === calendarMaybe ? void 0 : calendarMaybe, void 0 === calendarMaybe, arg, options);
|
|
3052
|
+
}
|
|
3053
|
+
const res = parsePlainMonthDay(arg, resolveBasicCalendarId);
|
|
3054
|
+
return refineOverflowOptions(options), res;
|
|
3055
|
+
}
|
|
3056
|
+
function initPlainMonthDay(instance, slots) {
|
|
3057
|
+
return plainMonthDaySlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
3058
|
+
}
|
|
3059
|
+
const plainYearMonthSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
3060
|
+
const PlainYearMonth = /* @__PURE__ */ defineTemporalClass(PlainYearMonthBranding, class {
|
|
3061
|
+
constructor(isoYear, isoMonth, calendar = void 0, referenceIsoDay) {
|
|
3062
|
+
const isoYearInt = toIntegerWithTrunc(isoYear);
|
|
3063
|
+
const isoMonthInt = toIntegerWithTrunc(isoMonth);
|
|
3064
|
+
const calendarImpl = resolveBasicCalendarArg(calendar);
|
|
3065
|
+
const fields = checkIsoYearMonthInBounds(validateIsoDateFields({
|
|
3066
|
+
year: isoYearInt,
|
|
3067
|
+
month: isoMonthInt,
|
|
3068
|
+
day: toIntegerWithTrunc(referenceIsoDay ?? 1)
|
|
3069
|
+
}));
|
|
3070
|
+
initPlainYearMonth(this, createDateSlots(fields, calendarImpl));
|
|
3071
|
+
}
|
|
3072
|
+
static from(arg, options = void 0) {
|
|
3073
|
+
return createPlainYearMonth(toPlainYearMonthSlots(arg, options));
|
|
3074
|
+
}
|
|
3075
|
+
static compare(arg0, arg1) {
|
|
3076
|
+
return compareIsoDateFields(toPlainYearMonthSlots(arg0), toPlainYearMonthSlots(arg1));
|
|
3077
|
+
}
|
|
3078
|
+
get calendarId() {
|
|
3079
|
+
return getCalendarSlotId(getPlainYearMonthSlots(this).calendar);
|
|
3080
|
+
}
|
|
3081
|
+
with(mod, options = void 0) {
|
|
3082
|
+
return createPlainYearMonth(mergePlainYearMonthFields(getPlainYearMonthSlots(this), validateBag(mod), options));
|
|
3083
|
+
}
|
|
3084
|
+
add(durationArg, options = void 0) {
|
|
3085
|
+
const slots = getPlainYearMonthSlots(this);
|
|
3086
|
+
return createPlainYearMonth(createDateSlots(moveYearMonth(0, slots.calendar, slots, toDurationSlots(durationArg), options), slots.calendar));
|
|
3087
|
+
}
|
|
3088
|
+
subtract(durationArg, options = void 0) {
|
|
3089
|
+
const slots = getPlainYearMonthSlots(this);
|
|
3090
|
+
return createPlainYearMonth(createDateSlots(moveYearMonth(1, slots.calendar, slots, toDurationSlots(durationArg), options), slots.calendar));
|
|
3091
|
+
}
|
|
3092
|
+
until(otherArg, options = void 0) {
|
|
3093
|
+
const slots = getPlainYearMonthSlots(this);
|
|
3094
|
+
const other = toPlainYearMonthSlots(otherArg);
|
|
3095
|
+
return createDuration(diffPlainYearMonth(0, getCommonCalendar(slots.calendar, other.calendar), slots, other, options));
|
|
3096
|
+
}
|
|
3097
|
+
since(otherArg, options = void 0) {
|
|
3098
|
+
const slots = getPlainYearMonthSlots(this);
|
|
3099
|
+
const other = toPlainYearMonthSlots(otherArg);
|
|
3100
|
+
return createDuration(diffPlainYearMonth(1, getCommonCalendar(slots.calendar, other.calendar), slots, other, options));
|
|
3101
|
+
}
|
|
3102
|
+
equals(otherArg) {
|
|
3103
|
+
return plainYearMonthsEqual(getPlainYearMonthSlots(this), toPlainYearMonthSlots(otherArg));
|
|
3104
|
+
}
|
|
3105
|
+
toPlainDate(bag) {
|
|
3106
|
+
return createPlainDate(convertPlainYearMonthToDate(getPlainYearMonthSlots(this).calendar, this, bag));
|
|
3107
|
+
}
|
|
3108
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
3109
|
+
const slots = getPlainYearMonthSlots(this);
|
|
3110
|
+
const format = new RawDateTimeFormat(locales, applyPlainFormatTimeZone(transformYearMonthOptions(options)));
|
|
3111
|
+
return checkResolvedCalendarCompatible(format, slots, 1), format.format(isoDateToEpochMilli(slots));
|
|
3112
|
+
}
|
|
3113
|
+
toString(options = void 0) {
|
|
3114
|
+
return formatPlainYearMonthIso(getPlainYearMonthSlots(this), options);
|
|
3115
|
+
}
|
|
3116
|
+
toJSON() {
|
|
3117
|
+
return formatPlainYearMonthIso(getPlainYearMonthSlots(this));
|
|
3118
|
+
}
|
|
3119
|
+
valueOf() {
|
|
3120
|
+
return forbiddenValueOf();
|
|
3121
|
+
}
|
|
3122
|
+
}, getPlainYearMonthSlots, yearMonthFieldGetters$1, yearMonthDerivedGetters);
|
|
3123
|
+
function createPlainYearMonth(slots) {
|
|
3124
|
+
return initPlainYearMonth(Object.create(PlainYearMonth.prototype), slots);
|
|
3125
|
+
}
|
|
3126
|
+
function getPlainYearMonthSlots(obj) {
|
|
3127
|
+
return getPlainYearMonthSlotsIfPresent(obj) || invalidRecordType();
|
|
3128
|
+
}
|
|
3129
|
+
function getPlainYearMonthSlotsIfPresent(obj) {
|
|
3130
|
+
return plainYearMonthSlotsMap.get(obj);
|
|
3131
|
+
}
|
|
3132
|
+
function toPlainYearMonthSlots(arg, options) {
|
|
3133
|
+
if (isObjectLike(arg)) {
|
|
3134
|
+
const ownSlots = getPlainYearMonthSlotsIfPresent(arg);
|
|
3135
|
+
if (ownSlots) return refineOverflowOptions(options), ownSlots;
|
|
3136
|
+
return refinePlainYearMonthObjectLike(getCalendarFromBag(arg), arg, options);
|
|
3137
|
+
}
|
|
3138
|
+
const res = parsePlainYearMonth(arg, resolveBasicCalendarId);
|
|
3139
|
+
return refineOverflowOptions(options), res;
|
|
3140
|
+
}
|
|
3141
|
+
function initPlainYearMonth(instance, slots) {
|
|
3142
|
+
return plainYearMonthSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
3143
|
+
}
|
|
3144
|
+
function getTemporalBrandingAndSlots(obj) {
|
|
3145
|
+
if (!isObjectLike(obj)) return;
|
|
3146
|
+
let slots = getInstantSlotsIfPresent(obj);
|
|
3147
|
+
return slots ? [InstantBranding, slots] : (slots = getZonedDateTimeSlotsIfPresent(obj), slots ? [ZonedDateTimeBranding, slots] : (slots = getPlainDateTimeSlotsIfPresent(obj), slots ? [PlainDateTimeBranding, slots] : (slots = getPlainDateSlotsIfPresent(obj), slots ? [PlainDateBranding, slots] : (slots = getPlainTimeSlotsIfPresent(obj), slots ? [PlainTimeBranding, slots] : (slots = getPlainYearMonthSlotsIfPresent(obj), slots ? [PlainYearMonthBranding, slots] : (slots = getPlainMonthDaySlotsIfPresent(obj), slots ? [PlainMonthDayBranding, slots] : (slots = getDurationSlotsIfPresent(obj), slots ? [DurationBranding, slots] : void 0)))))));
|
|
3148
|
+
}
|
|
3149
|
+
function validateBag(bag) {
|
|
3150
|
+
return (getTemporalBrandingAndSlots(bag) || void 0 !== bag.calendar || void 0 !== bag.timeZone) && throwTypeError("Invalid bag"), bag;
|
|
3151
|
+
}
|
|
3152
|
+
const plainTimeSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
3153
|
+
const PlainTime = /* @__PURE__ */ defineTemporalClass(PlainTimeBranding, class {
|
|
3154
|
+
constructor(hour = 0, minute = 0, second = 0, millisecond = 0, microsecond = 0, nanosecond = 0) {
|
|
3155
|
+
const fields = validateTimeFields(mapProps(toIntegerWithTrunc, {
|
|
3156
|
+
hour,
|
|
3157
|
+
minute,
|
|
3158
|
+
second,
|
|
3159
|
+
millisecond,
|
|
3160
|
+
microsecond,
|
|
3161
|
+
nanosecond
|
|
3162
|
+
}));
|
|
3163
|
+
initPlainTime(this, createTimeSlots(fields));
|
|
3164
|
+
}
|
|
3165
|
+
static from(arg, options = void 0) {
|
|
3166
|
+
return createPlainTime(toPlainTimeSlots(arg, options));
|
|
3167
|
+
}
|
|
3168
|
+
static compare(arg0, arg1) {
|
|
3169
|
+
return compareTimeFields(toPlainTimeSlots(arg0), toPlainTimeSlots(arg1));
|
|
3170
|
+
}
|
|
3171
|
+
with(mod, options = void 0) {
|
|
3172
|
+
return createPlainTime(mergePlainTimeFields(getPlainTimeSlots(this), validateBag(mod), options));
|
|
3173
|
+
}
|
|
3174
|
+
add(durationArg) {
|
|
3175
|
+
return createPlainTime(moveTime(getPlainTimeSlots(this), toDurationSlots(durationArg))[0]);
|
|
3176
|
+
}
|
|
3177
|
+
subtract(durationArg) {
|
|
3178
|
+
return createPlainTime(moveTime(getPlainTimeSlots(this), negateDurationFields(toDurationSlots(durationArg)))[0]);
|
|
3179
|
+
}
|
|
3180
|
+
until(otherArg, options = void 0) {
|
|
3181
|
+
return createDuration(diffPlainTimes(0, getPlainTimeSlots(this), toPlainTimeSlots(otherArg), options));
|
|
3182
|
+
}
|
|
3183
|
+
since(otherArg, options = void 0) {
|
|
3184
|
+
return createDuration(diffPlainTimes(1, getPlainTimeSlots(this), toPlainTimeSlots(otherArg), options));
|
|
3185
|
+
}
|
|
3186
|
+
round(options) {
|
|
3187
|
+
const slots = getPlainTimeSlots(this);
|
|
3188
|
+
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options, 5);
|
|
3189
|
+
return createPlainTime(roundTimeToNano(slots, computeNanoInc(smallestUnit, roundingInc), roundingMode)[0]);
|
|
3190
|
+
}
|
|
3191
|
+
equals(other) {
|
|
3192
|
+
return plainTimesEqual(getPlainTimeSlots(this), toPlainTimeSlots(other));
|
|
3193
|
+
}
|
|
3194
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
3195
|
+
const slots = getPlainTimeSlots(this);
|
|
3196
|
+
return new RawDateTimeFormat(locales, applyPlainFormatTimeZone(transformTimeOptions(options))).format(timeFieldsToMilli(slots));
|
|
3197
|
+
}
|
|
3198
|
+
toString(options = void 0) {
|
|
3199
|
+
return formatPlainTimeIso(getPlainTimeSlots(this), options);
|
|
3200
|
+
}
|
|
3201
|
+
toJSON() {
|
|
3202
|
+
return formatPlainTimeIso(getPlainTimeSlots(this));
|
|
3203
|
+
}
|
|
3204
|
+
valueOf() {
|
|
3205
|
+
return forbiddenValueOf();
|
|
3206
|
+
}
|
|
3207
|
+
}, getPlainTimeSlots, timeGetters);
|
|
3208
|
+
function createPlainTime(slots) {
|
|
3209
|
+
return initPlainTime(Object.create(PlainTime.prototype), slots);
|
|
3210
|
+
}
|
|
3211
|
+
function getPlainTimeSlots(obj) {
|
|
3212
|
+
return getPlainTimeSlotsIfPresent(obj) || invalidRecordType();
|
|
3213
|
+
}
|
|
3214
|
+
function getPlainTimeSlotsIfPresent(obj) {
|
|
3215
|
+
return plainTimeSlotsMap.get(obj);
|
|
3216
|
+
}
|
|
3217
|
+
function toPlainTimeSlots(arg, options) {
|
|
3218
|
+
if (isObjectLike(arg)) {
|
|
3219
|
+
const ownSlots = getPlainTimeSlotsIfPresent(arg);
|
|
3220
|
+
if (ownSlots) return refineOverflowOptions(options), ownSlots;
|
|
3221
|
+
const dateTimeSlots = getPlainDateTimeSlotsIfPresent(arg);
|
|
3222
|
+
if (dateTimeSlots) return refineOverflowOptions(options), createTimeSlots(dateTimeSlots);
|
|
3223
|
+
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
3224
|
+
return zonedDateTimeSlots ? (refineOverflowOptions(options), zonedDateTimeToPlainTime(zonedDateTimeSlots)) : refinePlainTimeObjectLike(arg, options);
|
|
3225
|
+
}
|
|
3226
|
+
const timeSlots = parsePlainTime(arg);
|
|
3227
|
+
return refineOverflowOptions(options), timeSlots;
|
|
3228
|
+
}
|
|
3229
|
+
function optionalToPlainTimeFields(timeArg) {
|
|
3230
|
+
return void 0 === timeArg ? void 0 : toPlainTimeSlots(timeArg);
|
|
3231
|
+
}
|
|
3232
|
+
function initPlainTime(instance, slots) {
|
|
3233
|
+
return plainTimeSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
3234
|
+
}
|
|
3235
|
+
const plainDateTimeSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
3236
|
+
const PlainDateTime = /* @__PURE__ */ defineTemporalClass(PlainDateTimeBranding, class {
|
|
3237
|
+
constructor(isoYear, isoMonth, isoDay, hour = 0, minute = 0, second = 0, millisecond = 0, microsecond = 0, nanosecond = 0, calendar = void 0) {
|
|
3238
|
+
const fields = checkIsoDateTimeInBounds(validateIsoDateTimeFields(mapProps(toIntegerWithTrunc, {
|
|
3239
|
+
year: isoYear,
|
|
3240
|
+
month: isoMonth,
|
|
3241
|
+
day: isoDay,
|
|
3242
|
+
hour,
|
|
3243
|
+
minute,
|
|
3244
|
+
second,
|
|
3245
|
+
millisecond,
|
|
3246
|
+
microsecond,
|
|
3247
|
+
nanosecond
|
|
3248
|
+
})));
|
|
3249
|
+
const calendarImpl = resolveBasicCalendarArg(calendar);
|
|
3250
|
+
initPlainDateTime(this, createDateTimeSlots(fields, calendarImpl));
|
|
3251
|
+
}
|
|
3252
|
+
static from(arg, options = void 0) {
|
|
3253
|
+
return createPlainDateTime(toPlainDateTimeSlots(arg, options));
|
|
3254
|
+
}
|
|
3255
|
+
static compare(arg0, arg1) {
|
|
3256
|
+
return compareIsoDateTimeFields(toPlainDateTimeSlots(arg0), toPlainDateTimeSlots(arg1));
|
|
3257
|
+
}
|
|
3258
|
+
get calendarId() {
|
|
3259
|
+
return getCalendarSlotId(getPlainDateTimeSlots(this).calendar);
|
|
3260
|
+
}
|
|
3261
|
+
with(mod, options = void 0) {
|
|
3262
|
+
return createPlainDateTime(mergePlainDateTimeFields(getPlainDateTimeSlots(this), validateBag(mod), options));
|
|
3263
|
+
}
|
|
3264
|
+
withCalendar(calendarArg) {
|
|
3265
|
+
return createPlainDateTime(createDateTimeSlots(getPlainDateTimeSlots(this), refineCalendarArg(calendarArg)));
|
|
3266
|
+
}
|
|
3267
|
+
withPlainTime(plainTimeArg = void 0) {
|
|
3268
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3269
|
+
return createPlainDateTime(createPlainDateTimeFromRefinedFields(slots, optionalToPlainTimeFields(plainTimeArg), slots.calendar));
|
|
3270
|
+
}
|
|
3271
|
+
add(durationArg, options = void 0) {
|
|
3272
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3273
|
+
return createPlainDateTime(createDateTimeSlots(moveDateTime(slots.calendar, slots, toDurationSlots(durationArg), options), slots.calendar));
|
|
3274
|
+
}
|
|
3275
|
+
subtract(durationArg, options = void 0) {
|
|
3276
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3277
|
+
return createPlainDateTime(createDateTimeSlots(moveDateTime(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), options), slots.calendar));
|
|
3278
|
+
}
|
|
3279
|
+
until(otherArg, options = void 0) {
|
|
3280
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3281
|
+
const other = toPlainDateTimeSlots(otherArg);
|
|
3282
|
+
return createDuration(diffPlainDateTimes(0, getCommonCalendar(slots.calendar, other.calendar), slots, other, options));
|
|
3283
|
+
}
|
|
3284
|
+
since(otherArg, options = void 0) {
|
|
3285
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3286
|
+
const other = toPlainDateTimeSlots(otherArg);
|
|
3287
|
+
return createDuration(diffPlainDateTimes(1, getCommonCalendar(slots.calendar, other.calendar), slots, other, options));
|
|
3288
|
+
}
|
|
3289
|
+
round(options) {
|
|
3290
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3291
|
+
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options);
|
|
3292
|
+
return createPlainDateTime(createDateTimeSlots(roundDateTimeToNano(slots, computeNanoInc(smallestUnit, roundingInc), roundingMode), slots.calendar));
|
|
3293
|
+
}
|
|
3294
|
+
equals(otherArg) {
|
|
3295
|
+
return plainDateTimesEqual(getPlainDateTimeSlots(this), toPlainDateTimeSlots(otherArg));
|
|
3296
|
+
}
|
|
3297
|
+
toZonedDateTime(timeZoneArg, options = void 0) {
|
|
3298
|
+
return createZonedDateTime(plainDateTimeToZonedDateTime(getPlainDateTimeSlots(this), queryTimeZone(refineTimeZoneArg(timeZoneArg)), options));
|
|
3299
|
+
}
|
|
3300
|
+
toPlainDate() {
|
|
3301
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3302
|
+
return createPlainDate(createDateSlots(slots, slots.calendar));
|
|
3303
|
+
}
|
|
3304
|
+
toPlainTime() {
|
|
3305
|
+
return createPlainTime(createTimeSlots(getPlainDateTimeSlots(this)));
|
|
3306
|
+
}
|
|
3307
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
3308
|
+
const slots = getPlainDateTimeSlots(this);
|
|
3309
|
+
const format = new RawDateTimeFormat(locales, applyPlainFormatTimeZone(transformDateTimeOptions(options)));
|
|
3310
|
+
return checkResolvedCalendarCompatible(format, slots), format.format(isoDateTimeToEpochMilli(slots));
|
|
3311
|
+
}
|
|
3312
|
+
toString(options = void 0) {
|
|
3313
|
+
return formatPlainDateTimeIso(getPlainDateTimeSlots(this), options);
|
|
3314
|
+
}
|
|
3315
|
+
toJSON() {
|
|
3316
|
+
return formatPlainDateTimeIso(getPlainDateTimeSlots(this));
|
|
3317
|
+
}
|
|
3318
|
+
valueOf() {
|
|
3319
|
+
return forbiddenValueOf();
|
|
3320
|
+
}
|
|
3321
|
+
}, getPlainDateTimeSlots, dateFieldGetters$1, dateDerivedGetters, timeGetters);
|
|
3322
|
+
function createPlainDateTime(slots) {
|
|
3323
|
+
return initPlainDateTime(Object.create(PlainDateTime.prototype), slots);
|
|
3324
|
+
}
|
|
3325
|
+
function getPlainDateTimeSlots(obj) {
|
|
3326
|
+
return getPlainDateTimeSlotsIfPresent(obj) || invalidRecordType();
|
|
3327
|
+
}
|
|
3328
|
+
function getPlainDateTimeSlotsIfPresent(obj) {
|
|
3329
|
+
return plainDateTimeSlotsMap.get(obj);
|
|
3330
|
+
}
|
|
3331
|
+
function toPlainDateTimeSlots(arg, options) {
|
|
3332
|
+
if (isObjectLike(arg)) {
|
|
3333
|
+
const ownSlots = getPlainDateTimeSlotsIfPresent(arg);
|
|
3334
|
+
if (ownSlots) return refineOverflowOptions(options), ownSlots;
|
|
3335
|
+
const dateSlots = getPlainDateSlotsIfPresent(arg);
|
|
3336
|
+
if (dateSlots) return refineOverflowOptions(options), createDateTimeSlots(combineDateAndTime(dateSlots, timeFieldDefaults), dateSlots.calendar);
|
|
3337
|
+
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
3338
|
+
if (zonedDateTimeSlots) return refineOverflowOptions(options), zonedDateTimeToPlainDateTime(zonedDateTimeSlots);
|
|
3339
|
+
return refinePlainDateTimeObjectLike(getCalendarFromBag(arg), arg, options);
|
|
3340
|
+
}
|
|
3341
|
+
const res = parsePlainDateTime(arg, resolveBasicCalendarId);
|
|
3342
|
+
return refineOverflowOptions(options), res;
|
|
3343
|
+
}
|
|
3344
|
+
function initPlainDateTime(instance, slots) {
|
|
3345
|
+
return plainDateTimeSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
3346
|
+
}
|
|
3347
|
+
const plainDateSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
3348
|
+
const PlainDate = /* @__PURE__ */ defineTemporalClass(PlainDateBranding, class {
|
|
3349
|
+
constructor(isoYear, isoMonth, isoDay, calendar = void 0) {
|
|
3350
|
+
const fields = checkIsoDateInBounds(validateIsoDateFields(mapProps(toIntegerWithTrunc, {
|
|
3351
|
+
year: isoYear,
|
|
3352
|
+
month: isoMonth,
|
|
3353
|
+
day: isoDay
|
|
3354
|
+
})));
|
|
3355
|
+
const calendarImpl = resolveBasicCalendarArg(calendar);
|
|
3356
|
+
initPlainDate(this, createDateSlots(fields, calendarImpl));
|
|
3357
|
+
}
|
|
3358
|
+
static from(arg, options = void 0) {
|
|
3359
|
+
return createPlainDate(toPlainDateSlots(arg, options));
|
|
3360
|
+
}
|
|
3361
|
+
static compare(arg0, arg1) {
|
|
3362
|
+
return compareIsoDateFields(toPlainDateSlots(arg0), toPlainDateSlots(arg1));
|
|
3363
|
+
}
|
|
3364
|
+
get calendarId() {
|
|
3365
|
+
return getCalendarSlotId(getPlainDateSlots(this).calendar);
|
|
3366
|
+
}
|
|
3367
|
+
with(mod, options = void 0) {
|
|
3368
|
+
return createPlainDate(mergePlainDateFields(getPlainDateSlots(this), validateBag(mod), options));
|
|
3369
|
+
}
|
|
3370
|
+
withCalendar(calendarArg) {
|
|
3371
|
+
return createPlainDate(createDateSlots(getPlainDateSlots(this), refineCalendarArg(calendarArg)));
|
|
3372
|
+
}
|
|
3373
|
+
add(durationArg, options = void 0) {
|
|
3374
|
+
const slots = getPlainDateSlots(this);
|
|
3375
|
+
return createPlainDate(createDateSlots(moveDate(slots.calendar, slots, toDurationSlots(durationArg), options), slots.calendar));
|
|
3376
|
+
}
|
|
3377
|
+
subtract(durationArg, options = void 0) {
|
|
3378
|
+
const slots = getPlainDateSlots(this);
|
|
3379
|
+
return createPlainDate(createDateSlots(moveDate(slots.calendar, slots, negateDurationFields(toDurationSlots(durationArg)), options), slots.calendar));
|
|
3380
|
+
}
|
|
3381
|
+
until(otherArg, options = void 0) {
|
|
3382
|
+
const slots = getPlainDateSlots(this);
|
|
3383
|
+
const other = toPlainDateSlots(otherArg);
|
|
3384
|
+
return createDuration(diffPlainDates(0, getCommonCalendar(slots.calendar, other.calendar), slots, other, options));
|
|
3385
|
+
}
|
|
3386
|
+
since(otherArg, options = void 0) {
|
|
3387
|
+
const slots = getPlainDateSlots(this);
|
|
3388
|
+
const other = toPlainDateSlots(otherArg);
|
|
3389
|
+
return createDuration(diffPlainDates(1, getCommonCalendar(slots.calendar, other.calendar), slots, other, options));
|
|
3390
|
+
}
|
|
3391
|
+
equals(otherArg) {
|
|
3392
|
+
return plainDatesEqual(getPlainDateSlots(this), toPlainDateSlots(otherArg));
|
|
3393
|
+
}
|
|
3394
|
+
toZonedDateTime(options) {
|
|
3395
|
+
const optionsObj = isObjectLike(options) ? {
|
|
3396
|
+
timeZone: options.timeZone,
|
|
3397
|
+
plainTime: options.plainTime
|
|
3398
|
+
} : { timeZone: options };
|
|
3399
|
+
return createZonedDateTime(plainDateToZonedDateTime(refineTimeZoneArg, toPlainTimeSlots, getPlainDateSlots(this), optionsObj));
|
|
3400
|
+
}
|
|
3401
|
+
toPlainDateTime(plainTimeArg = void 0) {
|
|
3402
|
+
const slots = getPlainDateSlots(this);
|
|
3403
|
+
return createPlainDateTime(createPlainDateTimeFromRefinedFields(slots, optionalToPlainTimeFields(plainTimeArg), slots.calendar));
|
|
3404
|
+
}
|
|
3405
|
+
toPlainYearMonth() {
|
|
3406
|
+
return createPlainYearMonth(convertToPlainYearMonth(getPlainDateSlots(this).calendar, this));
|
|
3407
|
+
}
|
|
3408
|
+
toPlainMonthDay() {
|
|
3409
|
+
return createPlainMonthDay(convertToPlainMonthDay(getPlainDateSlots(this).calendar, this));
|
|
3410
|
+
}
|
|
3411
|
+
toLocaleString(locales = void 0, options = {}) {
|
|
3412
|
+
const slots = getPlainDateSlots(this);
|
|
3413
|
+
const format = new RawDateTimeFormat(locales, applyPlainFormatTimeZone(transformDateOptions(options)));
|
|
3414
|
+
return checkResolvedCalendarCompatible(format, slots), format.format(isoDateToEpochMilli(slots));
|
|
3415
|
+
}
|
|
3416
|
+
toString(options = void 0) {
|
|
3417
|
+
return formatPlainDateIso(getPlainDateSlots(this), options);
|
|
3418
|
+
}
|
|
3419
|
+
toJSON() {
|
|
3420
|
+
return formatPlainDateIso(getPlainDateSlots(this));
|
|
3421
|
+
}
|
|
3422
|
+
valueOf() {
|
|
3423
|
+
return forbiddenValueOf();
|
|
3424
|
+
}
|
|
3425
|
+
}, getPlainDateSlots, dateFieldGetters$1, dateDerivedGetters);
|
|
3426
|
+
function createPlainDate(slots) {
|
|
3427
|
+
return initPlainDate(Object.create(PlainDate.prototype), slots);
|
|
3428
|
+
}
|
|
3429
|
+
function getPlainDateSlots(obj) {
|
|
3430
|
+
return getPlainDateSlotsIfPresent(obj) || invalidRecordType();
|
|
3431
|
+
}
|
|
3432
|
+
function getPlainDateSlotsIfPresent(obj) {
|
|
3433
|
+
return plainDateSlotsMap.get(obj);
|
|
3434
|
+
}
|
|
3435
|
+
function toPlainDateSlots(arg, options) {
|
|
3436
|
+
if (isObjectLike(arg)) {
|
|
3437
|
+
const ownSlots = getPlainDateSlotsIfPresent(arg);
|
|
3438
|
+
if (ownSlots) return refineOverflowOptions(options), ownSlots;
|
|
3439
|
+
const dateTimeSlots = getPlainDateTimeSlotsIfPresent(arg);
|
|
3440
|
+
if (dateTimeSlots) return refineOverflowOptions(options), createDateSlots(dateTimeSlots, dateTimeSlots.calendar);
|
|
3441
|
+
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(arg);
|
|
3442
|
+
if (zonedDateTimeSlots) return refineOverflowOptions(options), zonedDateTimeToPlainDate(zonedDateTimeSlots);
|
|
3443
|
+
return refinePlainDateObjectLike(getCalendarFromBag(arg), arg, options);
|
|
3444
|
+
}
|
|
3445
|
+
const res = parsePlainDate(arg, resolveBasicCalendarId);
|
|
3446
|
+
return refineOverflowOptions(options), res;
|
|
3447
|
+
}
|
|
3448
|
+
function initPlainDate(instance, slots) {
|
|
3449
|
+
return plainDateSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
3450
|
+
}
|
|
3451
|
+
function getCalendarFromBag(bag) {
|
|
3452
|
+
const calendar = extractCalendarFromBag(bag);
|
|
3453
|
+
return void 0 === calendar ? void 0 : calendar;
|
|
3454
|
+
}
|
|
3455
|
+
function extractCalendarFromBag(bag) {
|
|
3456
|
+
const { calendar: calendarArg } = bag;
|
|
3457
|
+
if (void 0 !== calendarArg) return refineCalendarArg(calendarArg);
|
|
3458
|
+
}
|
|
3459
|
+
function refineCalendarArg(arg) {
|
|
3460
|
+
if (isObjectLike(arg)) {
|
|
3461
|
+
const slots = getPlainDateSlotsIfPresent(arg) || getPlainDateTimeSlotsIfPresent(arg) || getZonedDateTimeSlotsIfPresent(arg) || getPlainMonthDaySlotsIfPresent(arg) || getPlainYearMonthSlotsIfPresent(arg);
|
|
3462
|
+
return slots || throwTypeError(invalidCalendar(arg)), slots.calendar;
|
|
3463
|
+
}
|
|
3464
|
+
return ((arg) => resolveBasicCalendarId(parseCalendarId(requireString(arg))))(arg);
|
|
3465
|
+
}
|
|
3466
|
+
const durationSlotsMap = /* @__PURE__ */ new WeakMap();
|
|
3467
|
+
const Duration = /* @__PURE__ */ defineTemporalClass(DurationBranding, class {
|
|
3468
|
+
constructor(years = 0, months = 0, weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0, milliseconds = 0, microseconds = 0, nanoseconds = 0) {
|
|
3469
|
+
const fields = validateDurationFields(mapProps(toStrictInteger, {
|
|
3470
|
+
years,
|
|
3471
|
+
months,
|
|
3472
|
+
weeks,
|
|
3473
|
+
days,
|
|
3474
|
+
hours,
|
|
3475
|
+
minutes,
|
|
3476
|
+
seconds,
|
|
3477
|
+
milliseconds,
|
|
3478
|
+
microseconds,
|
|
3479
|
+
nanoseconds
|
|
3480
|
+
}));
|
|
3481
|
+
initDuration(this, createDurationSlots(fields));
|
|
3482
|
+
}
|
|
3483
|
+
static from(arg) {
|
|
3484
|
+
return createDuration(toDurationSlots(arg));
|
|
3485
|
+
}
|
|
3486
|
+
static compare(durationArg0, durationArg1, options = void 0) {
|
|
3487
|
+
return compareDurations(refinePublicRelativeTo, toDurationSlots(durationArg0), toDurationSlots(durationArg1), options);
|
|
3488
|
+
}
|
|
3489
|
+
get sign() {
|
|
3490
|
+
return getDurationSlots(this).sign;
|
|
3491
|
+
}
|
|
3492
|
+
get blank() {
|
|
3493
|
+
return !getDurationSlots(this).sign;
|
|
3494
|
+
}
|
|
3495
|
+
with(mod) {
|
|
3496
|
+
return createDuration(mergeDurationFields(getDurationSlots(this), mod));
|
|
3497
|
+
}
|
|
3498
|
+
negated() {
|
|
3499
|
+
return createDuration(negateDuration(getDurationSlots(this)));
|
|
3500
|
+
}
|
|
3501
|
+
abs() {
|
|
3502
|
+
return createDuration(absDuration(getDurationSlots(this)));
|
|
3503
|
+
}
|
|
3504
|
+
add(otherArg, options = void 0) {
|
|
3505
|
+
return createDuration(addDurations(refinePublicRelativeTo, 0, getDurationSlots(this), toDurationSlots(otherArg), options));
|
|
3506
|
+
}
|
|
3507
|
+
subtract(otherArg, options = void 0) {
|
|
3508
|
+
return createDuration(addDurations(refinePublicRelativeTo, 1, getDurationSlots(this), toDurationSlots(otherArg), options));
|
|
3509
|
+
}
|
|
3510
|
+
round(roundTo) {
|
|
3511
|
+
return createDuration(roundDuration(refinePublicRelativeTo, getDurationSlots(this), roundTo));
|
|
3512
|
+
}
|
|
3513
|
+
total(totalOf) {
|
|
3514
|
+
return totalDuration(refinePublicRelativeTo, getDurationSlots(this), totalOf);
|
|
3515
|
+
}
|
|
3516
|
+
toLocaleString(locales = void 0, options) {
|
|
3517
|
+
const slots = getDurationSlots(this);
|
|
3518
|
+
return Intl.DurationFormat ? new Intl.DurationFormat(locales, options).format(slots) : formatDurationIso(slots, options);
|
|
3519
|
+
}
|
|
3520
|
+
toString(options = void 0) {
|
|
3521
|
+
return formatDurationIso(getDurationSlots(this), options);
|
|
3522
|
+
}
|
|
3523
|
+
toJSON() {
|
|
3524
|
+
return formatDurationIso(getDurationSlots(this));
|
|
3525
|
+
}
|
|
3526
|
+
valueOf() {
|
|
3527
|
+
return forbiddenValueOf();
|
|
3528
|
+
}
|
|
3529
|
+
}, getDurationSlots, durationGetters);
|
|
3530
|
+
function createDuration(slots) {
|
|
3531
|
+
return initDuration(Object.create(Duration.prototype), slots);
|
|
3532
|
+
}
|
|
3533
|
+
function getDurationSlots(obj) {
|
|
3534
|
+
return getDurationSlotsIfPresent(obj) || invalidRecordType();
|
|
3535
|
+
}
|
|
3536
|
+
function getDurationSlotsIfPresent(obj) {
|
|
3537
|
+
return durationSlotsMap.get(obj);
|
|
3538
|
+
}
|
|
3539
|
+
function toDurationSlots(arg) {
|
|
3540
|
+
if (isObjectLike(arg)) return getDurationSlotsIfPresent(arg) || refineDurationObjectLike(arg);
|
|
3541
|
+
return parseDuration(arg);
|
|
3542
|
+
}
|
|
3543
|
+
function refinePublicRelativeTo(relativeTo) {
|
|
3544
|
+
if (void 0 !== relativeTo) {
|
|
3545
|
+
if (isObjectLike(relativeTo)) {
|
|
3546
|
+
const zonedDateTimeSlots = getZonedDateTimeSlotsIfPresent(relativeTo);
|
|
3547
|
+
if (zonedDateTimeSlots) return zonedDateTimeSlots;
|
|
3548
|
+
const dateSlots = getPlainDateSlotsIfPresent(relativeTo);
|
|
3549
|
+
if (dateSlots) return dateSlots;
|
|
3550
|
+
const dateTimeSlots = getPlainDateTimeSlotsIfPresent(relativeTo);
|
|
3551
|
+
if (dateTimeSlots) return createDateSlots(dateTimeSlots, dateTimeSlots.calendar);
|
|
3552
|
+
return refineMaybeZonedDateTimeObjectLike(refineTimeZoneArg, getCalendarFromBag(relativeTo), relativeTo);
|
|
3553
|
+
}
|
|
3554
|
+
return parseRelativeToSlots(relativeTo, resolveBasicCalendarId);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
function initDuration(instance, slots) {
|
|
3558
|
+
return durationSlotsMap.set(instance, slots), attachDebugString(instance), instance;
|
|
3559
|
+
}
|
|
3560
|
+
const Now = /* @__PURE__ */ Object.defineProperties({}, {
|
|
3561
|
+
...createStringTagDescriptors("Temporal.Now"),
|
|
3562
|
+
...createPropDescriptors({
|
|
3563
|
+
timeZoneId() {
|
|
3564
|
+
return getCurrentTimeZoneId();
|
|
3565
|
+
},
|
|
3566
|
+
instant() {
|
|
3567
|
+
return createInstant(createEpochNanoSlots(getCurrentEpochNano()));
|
|
3568
|
+
},
|
|
3569
|
+
zonedDateTimeISO(timeZoneArg = getCurrentTimeZoneId()) {
|
|
3570
|
+
const timeZone = queryTimeZone(refineTimeZoneArg(timeZoneArg));
|
|
3571
|
+
return createZonedDateTime(createZonedEpochNanoSlots(getCurrentEpochNano(), timeZone));
|
|
3572
|
+
},
|
|
3573
|
+
plainDateTimeISO(timeZoneArg = getCurrentTimeZoneId()) {
|
|
3574
|
+
return createPlainDateTime(createDateTimeSlots(getCurrentIsoDateTime(queryTimeZone(refineTimeZoneArg(timeZoneArg)))));
|
|
3575
|
+
},
|
|
3576
|
+
plainDateISO(timeZoneArg = getCurrentTimeZoneId()) {
|
|
3577
|
+
return createPlainDate(createDateSlots(getCurrentIsoDateTime(queryTimeZone(refineTimeZoneArg(timeZoneArg)))));
|
|
3578
|
+
},
|
|
3579
|
+
plainTimeISO(timeZoneArg = getCurrentTimeZoneId()) {
|
|
3580
|
+
return createPlainTime(createTimeSlots(getCurrentIsoDateTime(queryTimeZone(refineTimeZoneArg(timeZoneArg)))));
|
|
3581
|
+
}
|
|
3582
|
+
})
|
|
3583
|
+
});
|
|
3584
|
+
const Temporal$3 = /* @__PURE__ */ Object.defineProperties({}, {
|
|
3585
|
+
...createStringTagDescriptors("Temporal"),
|
|
3586
|
+
...createPropDescriptors({
|
|
3587
|
+
PlainYearMonth,
|
|
3588
|
+
PlainMonthDay,
|
|
3589
|
+
PlainDate,
|
|
3590
|
+
PlainTime,
|
|
3591
|
+
PlainDateTime,
|
|
3592
|
+
ZonedDateTime,
|
|
3593
|
+
Instant,
|
|
3594
|
+
Duration,
|
|
3595
|
+
Now
|
|
3596
|
+
})
|
|
3597
|
+
});
|
|
3598
|
+
//#endregion
|
|
3599
|
+
//#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/index.js
|
|
3600
|
+
const Temporal$2 = NativeTemporal || Temporal$3;
|
|
3601
|
+
NativeTemporal && Date.prototype.toTemporalInstant;
|
|
3602
|
+
//#endregion
|
|
45
3603
|
//#region src/preprocessors.ts
|
|
46
3604
|
/**
|
|
47
3605
|
* A property preprocessor that normalizes Link values to Image objects.
|
|
@@ -75,6 +3633,7 @@ const normalizeLinkToImage = async (value, context) => {
|
|
|
75
3633
|
};
|
|
76
3634
|
//#endregion
|
|
77
3635
|
//#region src/vocab.ts
|
|
3636
|
+
const Temporal$1 = Temporal$2;
|
|
78
3637
|
const PORTABLE_IRI_PATTERN = /^ap(?:\+ef61)?:\/\//i;
|
|
79
3638
|
const PORTABLE_IRI_KEYS = new Set([
|
|
80
3639
|
"@id",
|
|
@@ -5770,7 +9329,7 @@ var Object$1 = class Object$1 {
|
|
|
5770
9329
|
let _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array = values["https://www.w3.org/ns/activitystreams#endTime"];
|
|
5771
9330
|
for (const v of _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array == null ? [] : _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array.length === 1 && "@list" in _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array[0] ? _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array[0]["@list"] : _219RwDanjScTv5tYCjwGZVCM7KZ9_endTime__array) {
|
|
5772
9331
|
if (v == null) continue;
|
|
5773
|
-
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
9332
|
+
const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
5774
9333
|
if (typeof decoded === "undefined") continue;
|
|
5775
9334
|
_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime.push(decoded);
|
|
5776
9335
|
}
|
|
@@ -6223,7 +9782,7 @@ var Object$1 = class Object$1 {
|
|
|
6223
9782
|
let _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array = values["https://www.w3.org/ns/activitystreams#published"];
|
|
6224
9783
|
for (const v of _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array == null ? [] : _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array.length === 1 && "@list" in _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array[0] ? _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array[0]["@list"] : _5e258TDXtuhaFRPZiGoDfEpjdMr_published__array) {
|
|
6225
9784
|
if (v == null) continue;
|
|
6226
|
-
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
9785
|
+
const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
6227
9786
|
if (typeof decoded === "undefined") continue;
|
|
6228
9787
|
_5e258TDXtuhaFRPZiGoDfEpjdMr_published.push(decoded);
|
|
6229
9788
|
}
|
|
@@ -6300,7 +9859,7 @@ var Object$1 = class Object$1 {
|
|
|
6300
9859
|
let _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array = values["https://www.w3.org/ns/activitystreams#startTime"];
|
|
6301
9860
|
for (const v of _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array == null ? [] : _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array.length === 1 && "@list" in _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array[0] ? _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array[0]["@list"] : _2w3Jmue4up8iVDUA51WZqomEF438_startTime__array) {
|
|
6302
9861
|
if (v == null) continue;
|
|
6303
|
-
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
9862
|
+
const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
6304
9863
|
if (typeof decoded === "undefined") continue;
|
|
6305
9864
|
_2w3Jmue4up8iVDUA51WZqomEF438_startTime.push(decoded);
|
|
6306
9865
|
}
|
|
@@ -6412,7 +9971,7 @@ var Object$1 = class Object$1 {
|
|
|
6412
9971
|
let _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array = values["https://www.w3.org/ns/activitystreams#updated"];
|
|
6413
9972
|
for (const v of _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array == null ? [] : _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array.length === 1 && "@list" in _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array[0] ? _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array[0]["@list"] : _385aB7ySixcf5Un6z3VsWmThgCzQ_updated__array) {
|
|
6414
9973
|
if (v == null) continue;
|
|
6415
|
-
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
9974
|
+
const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
6416
9975
|
if (typeof decoded === "undefined") continue;
|
|
6417
9976
|
_385aB7ySixcf5Un6z3VsWmThgCzQ_updated.push(decoded);
|
|
6418
9977
|
}
|
|
@@ -6514,7 +10073,7 @@ var Object$1 = class Object$1 {
|
|
|
6514
10073
|
let _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array = values["https://www.w3.org/ns/activitystreams#duration"];
|
|
6515
10074
|
for (const v of _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array == null ? [] : _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array.length === 1 && "@list" in _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array[0] ? _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array[0]["@list"] : _3bNvLMBN1bCJETiTihM3wvi1B2JX_duration__array) {
|
|
6516
10075
|
if (v == null) continue;
|
|
6517
|
-
const decoded = Temporal.Duration.from(v["@value"]);
|
|
10076
|
+
const decoded = Temporal$1.Duration.from(v["@value"]);
|
|
6518
10077
|
if (typeof decoded === "undefined") continue;
|
|
6519
10078
|
_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration.push(decoded);
|
|
6520
10079
|
}
|
|
@@ -18934,7 +22493,7 @@ var DataIntegrityProof = class {
|
|
|
18934
22493
|
let _3qzP3ukEZoUziK5FEiA1RhU4aqac__array = values["http://purl.org/dc/terms/created"];
|
|
18935
22494
|
for (const v of _3qzP3ukEZoUziK5FEiA1RhU4aqac__array == null ? [] : _3qzP3ukEZoUziK5FEiA1RhU4aqac__array.length === 1 && "@list" in _3qzP3ukEZoUziK5FEiA1RhU4aqac__array[0] ? _3qzP3ukEZoUziK5FEiA1RhU4aqac__array[0]["@list"] : _3qzP3ukEZoUziK5FEiA1RhU4aqac__array) {
|
|
18936
22495
|
if (v == null) continue;
|
|
18937
|
-
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
22496
|
+
const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
18938
22497
|
if (typeof decoded === "undefined") continue;
|
|
18939
22498
|
_3qzP3ukEZoUziK5FEiA1RhU4aqac.push(decoded);
|
|
18940
22499
|
}
|
|
@@ -45790,7 +49349,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
45790
49349
|
let _3KronwL8DiiKBRcJFKQPiEHm8xb6_closed__array = values["https://www.w3.org/ns/activitystreams#closed"];
|
|
45791
49350
|
for (const v of _3KronwL8DiiKBRcJFKQPiEHm8xb6_closed__array == null ? [] : _3KronwL8DiiKBRcJFKQPiEHm8xb6_closed__array.length === 1 && "@list" in _3KronwL8DiiKBRcJFKQPiEHm8xb6_closed__array[0] ? _3KronwL8DiiKBRcJFKQPiEHm8xb6_closed__array[0]["@list"] : _3KronwL8DiiKBRcJFKQPiEHm8xb6_closed__array) {
|
|
45792
49351
|
if (v == null) continue;
|
|
45793
|
-
const decoded = typeof v === "object" && "@type" in v && "@value" in v && typeof v["@value"] === "string" && v["@type"] === "http://www.w3.org/2001/XMLSchema#dateTime" && new Date(v["@value"]).toString() !== "Invalid Date" ? Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z") : typeof v === "object" && "@value" in v && typeof v["@value"] === "boolean" ? v["@value"] : void 0;
|
|
49352
|
+
const decoded = typeof v === "object" && "@type" in v && "@value" in v && typeof v["@value"] === "string" && v["@type"] === "http://www.w3.org/2001/XMLSchema#dateTime" && new Date(v["@value"]).toString() !== "Invalid Date" ? Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z") : typeof v === "object" && "@value" in v && typeof v["@value"] === "boolean" ? v["@value"] : void 0;
|
|
45794
49353
|
if (typeof decoded === "undefined") continue;
|
|
45795
49354
|
_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed.push(decoded);
|
|
45796
49355
|
}
|
|
@@ -51679,7 +55238,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
51679
55238
|
let _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted__array = values["https://www.w3.org/ns/activitystreams#deleted"];
|
|
51680
55239
|
for (const v of _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted__array == null ? [] : _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted__array.length === 1 && "@list" in _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted__array[0] ? _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted__array[0]["@list"] : _8g8g4LiVMhFTXskuDEqx4ascxUr_deleted__array) {
|
|
51681
55240
|
if (v == null) continue;
|
|
51682
|
-
const decoded = Temporal.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
55241
|
+
const decoded = Temporal$1.Instant.from(v["@value"].substring(19).match(/[Z+-]/) ? v["@value"] : v["@value"] + "Z");
|
|
51683
55242
|
if (typeof decoded === "undefined") continue;
|
|
51684
55243
|
_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted.push(decoded);
|
|
51685
55244
|
}
|
|
@@ -53071,6 +56630,7 @@ function toAcctUrl(handle) {
|
|
|
53071
56630
|
}
|
|
53072
56631
|
//#endregion
|
|
53073
56632
|
//#region src/lookup.ts
|
|
56633
|
+
const Temporal = Temporal$2;
|
|
53074
56634
|
const objectLookupCounters = /* @__PURE__ */ new WeakMap();
|
|
53075
56635
|
function getObjectLookupCounter(meterProvider) {
|
|
53076
56636
|
let counter = objectLookupCounters.get(meterProvider);
|