UNPKG

257 kBJavaScriptView Raw
1var __create = Object.create;
2var __defProp = Object.defineProperty;
3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4var __getOwnPropNames = Object.getOwnPropertyNames;
5var __getProtoOf = Object.getPrototypeOf;
6var __hasOwnProp = Object.prototype.hasOwnProperty;
7var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8var __commonJS = (cb, mod2) => function __require() {
9 return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
10};
11var __copyProps = (to, from, except, desc) => {
12 if (from && typeof from === "object" || typeof from === "function") {
13 for (let key of __getOwnPropNames(from))
14 if (!__hasOwnProp.call(to, key) && key !== except)
15 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16 }
17 return to;
18};
19var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
20 isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
21 mod2
22));
23var __publicField = (obj, key, value) => {
24 __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
25 return value;
26};
27
28// ../../node_modules/.pnpm/@stablelib+base64@1.0.1/node_modules/@stablelib/base64/lib/base64.js
29var require_base64 = __commonJS({
30 "../../node_modules/.pnpm/@stablelib+base64@1.0.1/node_modules/@stablelib/base64/lib/base64.js"(exports) {
31 "use strict";
32 var __extends = exports && exports.__extends || function() {
33 var extendStatics = function(d, b) {
34 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
35 d2.__proto__ = b2;
36 } || function(d2, b2) {
37 for (var p in b2)
38 if (b2.hasOwnProperty(p))
39 d2[p] = b2[p];
40 };
41 return extendStatics(d, b);
42 };
43 return function(d, b) {
44 extendStatics(d, b);
45 function __() {
46 this.constructor = d;
47 }
48 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49 };
50 }();
51 Object.defineProperty(exports, "__esModule", { value: true });
52 var INVALID_BYTE = 256;
53 var Coder = function() {
54 function Coder2(_paddingCharacter) {
55 if (_paddingCharacter === void 0) {
56 _paddingCharacter = "=";
57 }
58 this._paddingCharacter = _paddingCharacter;
59 }
60 Coder2.prototype.encodedLength = function(length) {
61 if (!this._paddingCharacter) {
62 return (length * 8 + 5) / 6 | 0;
63 }
64 return (length + 2) / 3 * 4 | 0;
65 };
66 Coder2.prototype.encode = function(data) {
67 var out = "";
68 var i = 0;
69 for (; i < data.length - 2; i += 3) {
70 var c = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
71 out += this._encodeByte(c >>> 3 * 6 & 63);
72 out += this._encodeByte(c >>> 2 * 6 & 63);
73 out += this._encodeByte(c >>> 1 * 6 & 63);
74 out += this._encodeByte(c >>> 0 * 6 & 63);
75 }
76 var left = data.length - i;
77 if (left > 0) {
78 var c = data[i] << 16 | (left === 2 ? data[i + 1] << 8 : 0);
79 out += this._encodeByte(c >>> 3 * 6 & 63);
80 out += this._encodeByte(c >>> 2 * 6 & 63);
81 if (left === 2) {
82 out += this._encodeByte(c >>> 1 * 6 & 63);
83 } else {
84 out += this._paddingCharacter || "";
85 }
86 out += this._paddingCharacter || "";
87 }
88 return out;
89 };
90 Coder2.prototype.maxDecodedLength = function(length) {
91 if (!this._paddingCharacter) {
92 return (length * 6 + 7) / 8 | 0;
93 }
94 return length / 4 * 3 | 0;
95 };
96 Coder2.prototype.decodedLength = function(s2) {
97 return this.maxDecodedLength(s2.length - this._getPaddingLength(s2));
98 };
99 Coder2.prototype.decode = function(s2) {
100 if (s2.length === 0) {
101 return new Uint8Array(0);
102 }
103 var paddingLength = this._getPaddingLength(s2);
104 var length = s2.length - paddingLength;
105 var out = new Uint8Array(this.maxDecodedLength(length));
106 var op = 0;
107 var i = 0;
108 var haveBad = 0;
109 var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
110 for (; i < length - 4; i += 4) {
111 v0 = this._decodeChar(s2.charCodeAt(i + 0));
112 v1 = this._decodeChar(s2.charCodeAt(i + 1));
113 v2 = this._decodeChar(s2.charCodeAt(i + 2));
114 v3 = this._decodeChar(s2.charCodeAt(i + 3));
115 out[op++] = v0 << 2 | v1 >>> 4;
116 out[op++] = v1 << 4 | v2 >>> 2;
117 out[op++] = v2 << 6 | v3;
118 haveBad |= v0 & INVALID_BYTE;
119 haveBad |= v1 & INVALID_BYTE;
120 haveBad |= v2 & INVALID_BYTE;
121 haveBad |= v3 & INVALID_BYTE;
122 }
123 if (i < length - 1) {
124 v0 = this._decodeChar(s2.charCodeAt(i));
125 v1 = this._decodeChar(s2.charCodeAt(i + 1));
126 out[op++] = v0 << 2 | v1 >>> 4;
127 haveBad |= v0 & INVALID_BYTE;
128 haveBad |= v1 & INVALID_BYTE;
129 }
130 if (i < length - 2) {
131 v2 = this._decodeChar(s2.charCodeAt(i + 2));
132 out[op++] = v1 << 4 | v2 >>> 2;
133 haveBad |= v2 & INVALID_BYTE;
134 }
135 if (i < length - 3) {
136 v3 = this._decodeChar(s2.charCodeAt(i + 3));
137 out[op++] = v2 << 6 | v3;
138 haveBad |= v3 & INVALID_BYTE;
139 }
140 if (haveBad !== 0) {
141 throw new Error("Base64Coder: incorrect characters for decoding");
142 }
143 return out;
144 };
145 Coder2.prototype._encodeByte = function(b) {
146 var result = b;
147 result += 65;
148 result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
149 result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
150 result += 61 - b >>> 8 & 52 - 48 - 62 + 43;
151 result += 62 - b >>> 8 & 62 - 43 - 63 + 47;
152 return String.fromCharCode(result);
153 };
154 Coder2.prototype._decodeChar = function(c) {
155 var result = INVALID_BYTE;
156 result += (42 - c & c - 44) >>> 8 & -INVALID_BYTE + c - 43 + 62;
157 result += (46 - c & c - 48) >>> 8 & -INVALID_BYTE + c - 47 + 63;
158 result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
159 result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
160 result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
161 return result;
162 };
163 Coder2.prototype._getPaddingLength = function(s2) {
164 var paddingLength = 0;
165 if (this._paddingCharacter) {
166 for (var i = s2.length - 1; i >= 0; i--) {
167 if (s2[i] !== this._paddingCharacter) {
168 break;
169 }
170 paddingLength++;
171 }
172 if (s2.length < 4 || paddingLength > 2) {
173 throw new Error("Base64Coder: incorrect padding");
174 }
175 }
176 return paddingLength;
177 };
178 return Coder2;
179 }();
180 exports.Coder = Coder;
181 var stdCoder = new Coder();
182 function encode(data) {
183 return stdCoder.encode(data);
184 }
185 exports.encode = encode;
186 function decode(s2) {
187 return stdCoder.decode(s2);
188 }
189 exports.decode = decode;
190 var URLSafeCoder = function(_super) {
191 __extends(URLSafeCoder2, _super);
192 function URLSafeCoder2() {
193 return _super !== null && _super.apply(this, arguments) || this;
194 }
195 URLSafeCoder2.prototype._encodeByte = function(b) {
196 var result = b;
197 result += 65;
198 result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
199 result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
200 result += 61 - b >>> 8 & 52 - 48 - 62 + 45;
201 result += 62 - b >>> 8 & 62 - 45 - 63 + 95;
202 return String.fromCharCode(result);
203 };
204 URLSafeCoder2.prototype._decodeChar = function(c) {
205 var result = INVALID_BYTE;
206 result += (44 - c & c - 46) >>> 8 & -INVALID_BYTE + c - 45 + 62;
207 result += (94 - c & c - 96) >>> 8 & -INVALID_BYTE + c - 95 + 63;
208 result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
209 result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
210 result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
211 return result;
212 };
213 return URLSafeCoder2;
214 }(Coder);
215 exports.URLSafeCoder = URLSafeCoder;
216 var urlSafeCoder = new URLSafeCoder();
217 function encodeURLSafe(data) {
218 return urlSafeCoder.encode(data);
219 }
220 exports.encodeURLSafe = encodeURLSafe;
221 function decodeURLSafe(s2) {
222 return urlSafeCoder.decode(s2);
223 }
224 exports.decodeURLSafe = decodeURLSafe;
225 exports.encodedLength = function(length) {
226 return stdCoder.encodedLength(length);
227 };
228 exports.maxDecodedLength = function(length) {
229 return stdCoder.maxDecodedLength(length);
230 };
231 exports.decodedLength = function(s2) {
232 return stdCoder.decodedLength(s2);
233 };
234 }
235});
236
237// ../../node_modules/.pnpm/iso-3166-ts@2.2.0/node_modules/iso-3166-ts/dist/index.js
238var require_dist = __commonJS({
239 "../../node_modules/.pnpm/iso-3166-ts@2.2.0/node_modules/iso-3166-ts/dist/index.js"(exports) {
240 "use strict";
241 Object.defineProperty(exports, "__esModule", { value: true });
242 exports.getIso3166CountryName = exports.isIso3166Alpha2Code = exports.ISO_3166_ALPHA_2 = exports.ISO_3166_ALPHA_2_MAPPINGS = void 0;
243 exports.ISO_3166_ALPHA_2_MAPPINGS = {
244 "AD": "Andorra",
245 "AE": "United Arab Emirates",
246 "AF": "Afghanistan",
247 "AG": "Antigua and Barbuda",
248 "AI": "Anguilla",
249 "AL": "Albania",
250 "AM": "Armenia",
251 "AO": "Angola",
252 "AQ": "Antarctica",
253 "AR": "Argentina",
254 "AS": "American Samoa",
255 "AT": "Austria",
256 "AU": "Australia",
257 "AW": "Aruba",
258 "AX": "\xC5land Islands",
259 "AZ": "Azerbaijan",
260 "BA": "Bosnia and Herzegovina",
261 "BB": "Barbados",
262 "BD": "Bangladesh",
263 "BE": "Belgium",
264 "BF": "Burkina Faso",
265 "BG": "Bulgaria",
266 "BH": "Bahrain",
267 "BI": "Burundi",
268 "BJ": "Benin",
269 "BL": "Saint Barth\xC3\xA9lemy",
270 "BM": "Bermuda",
271 "BN": "Brunei Darussalam",
272 "BO": "Bolivia (Plurinational State of)",
273 "BQ": "Bonaire, Sint Eustatius and Saba",
274 "BR": "Brazil",
275 "BS": "Bahamas",
276 "BT": "Bhutan",
277 "BV": "Bouvet Island",
278 "BW": "Botswana",
279 "BY": "Belarus",
280 "BZ": "Belize",
281 "CA": "Canada",
282 "CC": "Cocos (Keeling) Islands",
283 "CD": "Congo, Democratic Republic of the",
284 "CF": "Central African Republic",
285 "CG": "Congo",
286 "CH": "Switzerland",
287 "CI": "C\xF3te d'Ivoire",
288 "CK": "Cook Islands",
289 "CL": "Chile",
290 "CM": "Cameroon",
291 "CN": "China",
292 "CO": "Colombia",
293 "CR": "Costa Rica",
294 "CU": "Cuba",
295 "CV": "Cabo Verde",
296 "CW": "Cura\xC3\xA7ao",
297 "CX": "Christmas Island",
298 "CY": "Cyprus",
299 "CZ": "Czechia",
300 "DE": "Germany",
301 "DJ": "Djibouti",
302 "DK": "Denmark",
303 "DM": "Dominica",
304 "DO": "Dominican Republic",
305 "DZ": "Algeria",
306 "EC": "Ecuador",
307 "EE": "Estonia",
308 "EG": "Egypt",
309 "EH": "Western Sahara",
310 "ER": "Eritrea",
311 "ES": "Spain",
312 "ET": "Ethiopia",
313 "FI": "Finland",
314 "FJ": "Fiji",
315 "FK": "Falkland Islands (Malvinas)",
316 "FM": "Micronesia (Federated States of)",
317 "FO": "Faroe Islands",
318 "FR": "France",
319 "GA": "Gabon",
320 "GB": "United Kingdom of Great Britain and Northern Ireland",
321 "GD": "Grenada",
322 "GE": "Georgia",
323 "GF": "French Guiana",
324 "GG": "Guernsey",
325 "GH": "Ghana",
326 "GI": "Gibraltar",
327 "GL": "Greenland",
328 "GM": "Gambia",
329 "GN": "Guinea",
330 "GP": "Guadeloupe",
331 "GQ": "Equatorial Guinea",
332 "GR": "Greece",
333 "GS": "South Georgia and the South Sandwich Islands",
334 "GT": "Guatemala",
335 "GU": "Guam",
336 "GW": "Guinea-Bissau",
337 "GY": "Guyana",
338 "HK": "Hong Kong",
339 "HM": "Heard Island and McDonald Islands",
340 "HN": "Honduras",
341 "HR": "Croatia",
342 "HT": "Haiti",
343 "HU": "Hungary",
344 "ID": "Indonesia",
345 "IE": "Ireland",
346 "IL": "Israel",
347 "IM": "Isle of Man",
348 "IN": "India",
349 "IO": "British Indian Ocean Territory",
350 "IQ": "Iraq",
351 "IR": "Iran (Islamic Republic of)",
352 "IS": "Iceland",
353 "IT": "Italy",
354 "JE": "Jersey",
355 "JM": "Jamaica",
356 "JO": "Jordan",
357 "JP": "Japan",
358 "KE": "Kenya",
359 "KG": "Kyrgyzstan",
360 "KH": "Cambodia",
361 "KI": "Kiribati",
362 "KM": "Comoros",
363 "KN": "Saint Kitts and Nevis",
364 "KP": "Korea (Democratic People's Republic of) ",
365 "KR": "Korea, Republic of",
366 "KW": "Kuwait",
367 "KY": "Cayman Islands",
368 "KZ": "Kazakhstan",
369 "LA": "Lao People's Democratic Republic",
370 "LB": "Lebanon",
371 "LC": "Saint Lucia",
372 "LI": "Liechtenstein",
373 "LK": "Sri Lanka",
374 "LR": "Liberia",
375 "LS": "Lesotho",
376 "LT": "Lithuania",
377 "LU": "Luxembourg",
378 "LV": "Latvia",
379 "LY": "Libya",
380 "MA": "Morocco",
381 "MC": "Monaco",
382 "MD": "Moldova, Republic of",
383 "ME": "Montenegro",
384 "MF": "Saint Martin (French part)",
385 "MG": "Madagascar",
386 "MH": "Marshall Islands",
387 "MK": "North Macedonia",
388 "ML": "Mali",
389 "MM": "Myanmar",
390 "MN": "Mongolia",
391 "MO": "Macao",
392 "MP": "Northern Mariana Islands",
393 "MQ": "Martinique",
394 "MR": "Mauritania",
395 "MS": "Montserrat",
396 "MT": "Malta",
397 "MU": "Mauritius",
398 "MV": "Maldives",
399 "MW": "Malawi",
400 "MX": "Mexico",
401 "MY": "Malaysia",
402 "MZ": "Mozambique",
403 "NA": "Namibia",
404 "NC": "New Caledonia",
405 "NE": "Niger",
406 "NF": "Norfolk Island",
407 "NG": "Nigeria",
408 "NI": "Nicaragua",
409 "NL": "Netherlands",
410 "NO": "Norway",
411 "NP": "Nepal",
412 "NR": "Nauru",
413 "NU": "Niue",
414 "NZ": "New Zealand",
415 "OM": "Oman",
416 "PA": "Panama",
417 "PE": "Peru",
418 "PF": "French Polynesia",
419 "PG": "Papua New Guinea",
420 "PH": "Philippines",
421 "PK": "Pakistan",
422 "PL": "Poland",
423 "PM": "Saint Pierre and Miquelon",
424 "PN": "Pitcairn",
425 "PR": "Puerto Rico",
426 "PS": "Palestine, State of",
427 "PT": "Portugal",
428 "PW": "Palau",
429 "PY": "Paraguay",
430 "QA": "Qatar",
431 "RE": "R\xE9union",
432 "RO": "Romania",
433 "RS": "Serbia",
434 "RU": "Russian Federation",
435 "RW": "Rwanda",
436 "SA": "Saudi Arabia",
437 "SB": "Solomon Islands",
438 "SC": "Seychelles",
439 "SD": "Sudan",
440 "SE": "Sweden",
441 "SG": "Singapore",
442 "SH": "Saint Helena, Ascension and Tristan da Cunha",
443 "SI": "Slovenia",
444 "SJ": "Svalbard and Jan Mayen",
445 "SK": "Slovakia",
446 "SL": "Sierra Leone",
447 "SM": "San Marino",
448 "SN": "Senegal",
449 "SO": "Somalia",
450 "SR": "Suriname",
451 "SS": "South Sudan",
452 "ST": "Sao Tome and Principe",
453 "SV": "El Salvador",
454 "SX": "Sint Maarten (Dutch part)",
455 "SY": "Syrian Arab Republic",
456 "SZ": "Eswatini",
457 "TC": "Turks and Caicos Islands",
458 "TD": "Chad",
459 "TF": "French Southern Territories",
460 "TG": "Togo",
461 "TH": "Thailand",
462 "TJ": "Tajikistan",
463 "TK": "Tokelau",
464 "TL": "Timor-Leste",
465 "TM": "Turkmenistan",
466 "TN": "Tunisia",
467 "TO": "Tonga",
468 "TR": "Turkey",
469 "TT": "Trinidad and Tobago",
470 "TV": "Tuvalu",
471 "TW": "Taiwan, Province of China",
472 "TZ": "Tanzania, United Republic of",
473 "UA": "Ukraine",
474 "UG": "Uganda",
475 "UM": "United States Minor Outlying Islands",
476 "US": "United States of America",
477 "UY": "Uruguay",
478 "UZ": "Uzbekistan",
479 "VA": "Holy See",
480 "VC": "Saint Vincent and the Grenadines",
481 "VE": "Venezuela (Bolivarian Republic of)",
482 "VG": "Virgin Islands (British)",
483 "VI": "Virgin Islands (U.S.)",
484 "VN": "Viet Nam",
485 "VU": "Vanuatu",
486 "WF": "Wallis and Futuna",
487 "WS": "Samoa",
488 "XK": "Kosovo",
489 "YE": "Yemen",
490 "YT": "Mayotte",
491 "ZA": "South Africa",
492 "ZM": "Zambia",
493 "ZW": "Zimbabwe"
494 };
495 exports.ISO_3166_ALPHA_2 = Object.keys(exports.ISO_3166_ALPHA_2_MAPPINGS);
496 function isIso3166Alpha2Code2(iso3166Alpha2CountryCode) {
497 return exports.ISO_3166_ALPHA_2.indexOf(iso3166Alpha2CountryCode) != -1;
498 }
499 exports.isIso3166Alpha2Code = isIso3166Alpha2Code2;
500 function getIso3166CountryName(iso3166Alpha2CountryCode) {
501 if (isIso3166Alpha2Code2(iso3166Alpha2CountryCode)) {
502 return exports.ISO_3166_ALPHA_2_MAPPINGS[iso3166Alpha2CountryCode];
503 }
504 return void 0;
505 }
506 exports.getIso3166CountryName = getIso3166CountryName;
507 }
508});
509
510// ../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
511var util;
512(function(util2) {
513 util2.assertEqual = (val) => val;
514 function assertIs(_arg) {
515 }
516 util2.assertIs = assertIs;
517 function assertNever(_x) {
518 throw new Error();
519 }
520 util2.assertNever = assertNever;
521 util2.arrayToEnum = (items) => {
522 const obj = {};
523 for (const item of items) {
524 obj[item] = item;
525 }
526 return obj;
527 };
528 util2.getValidEnumValues = (obj) => {
529 const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
530 const filtered = {};
531 for (const k of validKeys) {
532 filtered[k] = obj[k];
533 }
534 return util2.objectValues(filtered);
535 };
536 util2.objectValues = (obj) => {
537 return util2.objectKeys(obj).map(function(e) {
538 return obj[e];
539 });
540 };
541 util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
542 const keys = [];
543 for (const key in object) {
544 if (Object.prototype.hasOwnProperty.call(object, key)) {
545 keys.push(key);
546 }
547 }
548 return keys;
549 };
550 util2.find = (arr, checker) => {
551 for (const item of arr) {
552 if (checker(item))
553 return item;
554 }
555 return void 0;
556 };
557 util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
558 function joinValues(array, separator = " | ") {
559 return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
560 }
561 util2.joinValues = joinValues;
562 util2.jsonStringifyReplacer = (_, value) => {
563 if (typeof value === "bigint") {
564 return value.toString();
565 }
566 return value;
567 };
568})(util || (util = {}));
569var ZodParsedType = util.arrayToEnum([
570 "string",
571 "nan",
572 "number",
573 "integer",
574 "float",
575 "boolean",
576 "date",
577 "bigint",
578 "symbol",
579 "function",
580 "undefined",
581 "null",
582 "array",
583 "object",
584 "unknown",
585 "promise",
586 "void",
587 "never",
588 "map",
589 "set"
590]);
591var getParsedType = (data) => {
592 const t = typeof data;
593 switch (t) {
594 case "undefined":
595 return ZodParsedType.undefined;
596 case "string":
597 return ZodParsedType.string;
598 case "number":
599 return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
600 case "boolean":
601 return ZodParsedType.boolean;
602 case "function":
603 return ZodParsedType.function;
604 case "bigint":
605 return ZodParsedType.bigint;
606 case "symbol":
607 return ZodParsedType.symbol;
608 case "object":
609 if (Array.isArray(data)) {
610 return ZodParsedType.array;
611 }
612 if (data === null) {
613 return ZodParsedType.null;
614 }
615 if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
616 return ZodParsedType.promise;
617 }
618 if (typeof Map !== "undefined" && data instanceof Map) {
619 return ZodParsedType.map;
620 }
621 if (typeof Set !== "undefined" && data instanceof Set) {
622 return ZodParsedType.set;
623 }
624 if (typeof Date !== "undefined" && data instanceof Date) {
625 return ZodParsedType.date;
626 }
627 return ZodParsedType.object;
628 default:
629 return ZodParsedType.unknown;
630 }
631};
632var ZodIssueCode = util.arrayToEnum([
633 "invalid_type",
634 "invalid_literal",
635 "custom",
636 "invalid_union",
637 "invalid_union_discriminator",
638 "invalid_enum_value",
639 "unrecognized_keys",
640 "invalid_arguments",
641 "invalid_return_type",
642 "invalid_date",
643 "invalid_string",
644 "too_small",
645 "too_big",
646 "invalid_intersection_types",
647 "not_multiple_of",
648 "not_finite"
649]);
650var quotelessJson = (obj) => {
651 const json = JSON.stringify(obj, null, 2);
652 return json.replace(/"([^"]+)":/g, "$1:");
653};
654var ZodError = class extends Error {
655 constructor(issues) {
656 super();
657 this.issues = [];
658 this.addIssue = (sub) => {
659 this.issues = [...this.issues, sub];
660 };
661 this.addIssues = (subs = []) => {
662 this.issues = [...this.issues, ...subs];
663 };
664 const actualProto = new.target.prototype;
665 if (Object.setPrototypeOf) {
666 Object.setPrototypeOf(this, actualProto);
667 } else {
668 this.__proto__ = actualProto;
669 }
670 this.name = "ZodError";
671 this.issues = issues;
672 }
673 get errors() {
674 return this.issues;
675 }
676 format(_mapper) {
677 const mapper = _mapper || function(issue) {
678 return issue.message;
679 };
680 const fieldErrors = { _errors: [] };
681 const processError = (error) => {
682 for (const issue of error.issues) {
683 if (issue.code === "invalid_union") {
684 issue.unionErrors.map(processError);
685 } else if (issue.code === "invalid_return_type") {
686 processError(issue.returnTypeError);
687 } else if (issue.code === "invalid_arguments") {
688 processError(issue.argumentsError);
689 } else if (issue.path.length === 0) {
690 fieldErrors._errors.push(mapper(issue));
691 } else {
692 let curr = fieldErrors;
693 let i = 0;
694 while (i < issue.path.length) {
695 const el = issue.path[i];
696 const terminal = i === issue.path.length - 1;
697 if (!terminal) {
698 curr[el] = curr[el] || { _errors: [] };
699 } else {
700 curr[el] = curr[el] || { _errors: [] };
701 curr[el]._errors.push(mapper(issue));
702 }
703 curr = curr[el];
704 i++;
705 }
706 }
707 }
708 };
709 processError(this);
710 return fieldErrors;
711 }
712 toString() {
713 return this.message;
714 }
715 get message() {
716 return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
717 }
718 get isEmpty() {
719 return this.issues.length === 0;
720 }
721 flatten(mapper = (issue) => issue.message) {
722 const fieldErrors = {};
723 const formErrors = [];
724 for (const sub of this.issues) {
725 if (sub.path.length > 0) {
726 fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
727 fieldErrors[sub.path[0]].push(mapper(sub));
728 } else {
729 formErrors.push(mapper(sub));
730 }
731 }
732 return { formErrors, fieldErrors };
733 }
734 get formErrors() {
735 return this.flatten();
736 }
737};
738ZodError.create = (issues) => {
739 const error = new ZodError(issues);
740 return error;
741};
742var errorMap = (issue, _ctx) => {
743 let message;
744 switch (issue.code) {
745 case ZodIssueCode.invalid_type:
746 if (issue.received === ZodParsedType.undefined) {
747 message = "Required";
748 } else {
749 message = `Expected ${issue.expected}, received ${issue.received}`;
750 }
751 break;
752 case ZodIssueCode.invalid_literal:
753 message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
754 break;
755 case ZodIssueCode.unrecognized_keys:
756 message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
757 break;
758 case ZodIssueCode.invalid_union:
759 message = `Invalid input`;
760 break;
761 case ZodIssueCode.invalid_union_discriminator:
762 message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
763 break;
764 case ZodIssueCode.invalid_enum_value:
765 message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
766 break;
767 case ZodIssueCode.invalid_arguments:
768 message = `Invalid function arguments`;
769 break;
770 case ZodIssueCode.invalid_return_type:
771 message = `Invalid function return type`;
772 break;
773 case ZodIssueCode.invalid_date:
774 message = `Invalid date`;
775 break;
776 case ZodIssueCode.invalid_string:
777 if (typeof issue.validation === "object") {
778 if ("startsWith" in issue.validation) {
779 message = `Invalid input: must start with "${issue.validation.startsWith}"`;
780 } else if ("endsWith" in issue.validation) {
781 message = `Invalid input: must end with "${issue.validation.endsWith}"`;
782 } else {
783 util.assertNever(issue.validation);
784 }
785 } else if (issue.validation !== "regex") {
786 message = `Invalid ${issue.validation}`;
787 } else {
788 message = "Invalid";
789 }
790 break;
791 case ZodIssueCode.too_small:
792 if (issue.type === "array")
793 message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
794 else if (issue.type === "string")
795 message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
796 else if (issue.type === "number")
797 message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
798 else if (issue.type === "date")
799 message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
800 else
801 message = "Invalid input";
802 break;
803 case ZodIssueCode.too_big:
804 if (issue.type === "array")
805 message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
806 else if (issue.type === "string")
807 message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
808 else if (issue.type === "number")
809 message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
810 else if (issue.type === "date")
811 message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
812 else
813 message = "Invalid input";
814 break;
815 case ZodIssueCode.custom:
816 message = `Invalid input`;
817 break;
818 case ZodIssueCode.invalid_intersection_types:
819 message = `Intersection results could not be merged`;
820 break;
821 case ZodIssueCode.not_multiple_of:
822 message = `Number must be a multiple of ${issue.multipleOf}`;
823 break;
824 case ZodIssueCode.not_finite:
825 message = "Number must be finite";
826 break;
827 default:
828 message = _ctx.defaultError;
829 util.assertNever(issue);
830 }
831 return { message };
832};
833var overrideErrorMap = errorMap;
834function setErrorMap(map) {
835 overrideErrorMap = map;
836}
837function getErrorMap() {
838 return overrideErrorMap;
839}
840var makeIssue = (params) => {
841 const { data, path, errorMaps, issueData } = params;
842 const fullPath = [...path, ...issueData.path || []];
843 const fullIssue = {
844 ...issueData,
845 path: fullPath
846 };
847 let errorMessage = "";
848 const maps = errorMaps.filter((m) => !!m).slice().reverse();
849 for (const map of maps) {
850 errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
851 }
852 return {
853 ...issueData,
854 path: fullPath,
855 message: issueData.message || errorMessage
856 };
857};
858var EMPTY_PATH = [];
859function addIssueToContext(ctx, issueData) {
860 const issue = makeIssue({
861 issueData,
862 data: ctx.data,
863 path: ctx.path,
864 errorMaps: [
865 ctx.common.contextualErrorMap,
866 ctx.schemaErrorMap,
867 getErrorMap(),
868 errorMap
869 ].filter((x) => !!x)
870 });
871 ctx.common.issues.push(issue);
872}
873var ParseStatus = class {
874 constructor() {
875 this.value = "valid";
876 }
877 dirty() {
878 if (this.value === "valid")
879 this.value = "dirty";
880 }
881 abort() {
882 if (this.value !== "aborted")
883 this.value = "aborted";
884 }
885 static mergeArray(status, results) {
886 const arrayValue = [];
887 for (const s2 of results) {
888 if (s2.status === "aborted")
889 return INVALID;
890 if (s2.status === "dirty")
891 status.dirty();
892 arrayValue.push(s2.value);
893 }
894 return { status: status.value, value: arrayValue };
895 }
896 static async mergeObjectAsync(status, pairs) {
897 const syncPairs = [];
898 for (const pair of pairs) {
899 syncPairs.push({
900 key: await pair.key,
901 value: await pair.value
902 });
903 }
904 return ParseStatus.mergeObjectSync(status, syncPairs);
905 }
906 static mergeObjectSync(status, pairs) {
907 const finalObject = {};
908 for (const pair of pairs) {
909 const { key, value } = pair;
910 if (key.status === "aborted")
911 return INVALID;
912 if (value.status === "aborted")
913 return INVALID;
914 if (key.status === "dirty")
915 status.dirty();
916 if (value.status === "dirty")
917 status.dirty();
918 if (typeof value.value !== "undefined" || pair.alwaysSet) {
919 finalObject[key.value] = value.value;
920 }
921 }
922 return { status: status.value, value: finalObject };
923 }
924};
925var INVALID = Object.freeze({
926 status: "aborted"
927});
928var DIRTY = (value) => ({ status: "dirty", value });
929var OK = (value) => ({ status: "valid", value });
930var isAborted = (x) => x.status === "aborted";
931var isDirty = (x) => x.status === "dirty";
932var isValid = (x) => x.status === "valid";
933var isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
934var errorUtil;
935(function(errorUtil2) {
936 errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
937 errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
938})(errorUtil || (errorUtil = {}));
939var ParseInputLazyPath = class {
940 constructor(parent, value, path, key) {
941 this.parent = parent;
942 this.data = value;
943 this._path = path;
944 this._key = key;
945 }
946 get path() {
947 return this._path.concat(this._key);
948 }
949};
950var handleResult = (ctx, result) => {
951 if (isValid(result)) {
952 return { success: true, data: result.value };
953 } else {
954 if (!ctx.common.issues.length) {
955 throw new Error("Validation failed but no issues detected.");
956 }
957 const error = new ZodError(ctx.common.issues);
958 return { success: false, error };
959 }
960};
961function processCreateParams(params) {
962 if (!params)
963 return {};
964 const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
965 if (errorMap2 && (invalid_type_error || required_error)) {
966 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
967 }
968 if (errorMap2)
969 return { errorMap: errorMap2, description };
970 const customMap = (iss, ctx) => {
971 if (iss.code !== "invalid_type")
972 return { message: ctx.defaultError };
973 if (typeof ctx.data === "undefined") {
974 return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
975 }
976 return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
977 };
978 return { errorMap: customMap, description };
979}
980var ZodType = class {
981 constructor(def) {
982 this.spa = this.safeParseAsync;
983 this._def = def;
984 this.parse = this.parse.bind(this);
985 this.safeParse = this.safeParse.bind(this);
986 this.parseAsync = this.parseAsync.bind(this);
987 this.safeParseAsync = this.safeParseAsync.bind(this);
988 this.spa = this.spa.bind(this);
989 this.refine = this.refine.bind(this);
990 this.refinement = this.refinement.bind(this);
991 this.superRefine = this.superRefine.bind(this);
992 this.optional = this.optional.bind(this);
993 this.nullable = this.nullable.bind(this);
994 this.nullish = this.nullish.bind(this);
995 this.array = this.array.bind(this);
996 this.promise = this.promise.bind(this);
997 this.or = this.or.bind(this);
998 this.and = this.and.bind(this);
999 this.transform = this.transform.bind(this);
1000 this.brand = this.brand.bind(this);
1001 this.default = this.default.bind(this);
1002 this.catch = this.catch.bind(this);
1003 this.describe = this.describe.bind(this);
1004 this.pipe = this.pipe.bind(this);
1005 this.isNullable = this.isNullable.bind(this);
1006 this.isOptional = this.isOptional.bind(this);
1007 }
1008 get description() {
1009 return this._def.description;
1010 }
1011 _getType(input) {
1012 return getParsedType(input.data);
1013 }
1014 _getOrReturnCtx(input, ctx) {
1015 return ctx || {
1016 common: input.parent.common,
1017 data: input.data,
1018 parsedType: getParsedType(input.data),
1019 schemaErrorMap: this._def.errorMap,
1020 path: input.path,
1021 parent: input.parent
1022 };
1023 }
1024 _processInputParams(input) {
1025 return {
1026 status: new ParseStatus(),
1027 ctx: {
1028 common: input.parent.common,
1029 data: input.data,
1030 parsedType: getParsedType(input.data),
1031 schemaErrorMap: this._def.errorMap,
1032 path: input.path,
1033 parent: input.parent
1034 }
1035 };
1036 }
1037 _parseSync(input) {
1038 const result = this._parse(input);
1039 if (isAsync(result)) {
1040 throw new Error("Synchronous parse encountered promise.");
1041 }
1042 return result;
1043 }
1044 _parseAsync(input) {
1045 const result = this._parse(input);
1046 return Promise.resolve(result);
1047 }
1048 parse(data, params) {
1049 const result = this.safeParse(data, params);
1050 if (result.success)
1051 return result.data;
1052 throw result.error;
1053 }
1054 safeParse(data, params) {
1055 var _a;
1056 const ctx = {
1057 common: {
1058 issues: [],
1059 async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1060 contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
1061 },
1062 path: (params === null || params === void 0 ? void 0 : params.path) || [],
1063 schemaErrorMap: this._def.errorMap,
1064 parent: null,
1065 data,
1066 parsedType: getParsedType(data)
1067 };
1068 const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1069 return handleResult(ctx, result);
1070 }
1071 async parseAsync(data, params) {
1072 const result = await this.safeParseAsync(data, params);
1073 if (result.success)
1074 return result.data;
1075 throw result.error;
1076 }
1077 async safeParseAsync(data, params) {
1078 const ctx = {
1079 common: {
1080 issues: [],
1081 contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1082 async: true
1083 },
1084 path: (params === null || params === void 0 ? void 0 : params.path) || [],
1085 schemaErrorMap: this._def.errorMap,
1086 parent: null,
1087 data,
1088 parsedType: getParsedType(data)
1089 };
1090 const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
1091 const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
1092 return handleResult(ctx, result);
1093 }
1094 refine(check, message) {
1095 const getIssueProperties = (val) => {
1096 if (typeof message === "string" || typeof message === "undefined") {
1097 return { message };
1098 } else if (typeof message === "function") {
1099 return message(val);
1100 } else {
1101 return message;
1102 }
1103 };
1104 return this._refinement((val, ctx) => {
1105 const result = check(val);
1106 const setError = () => ctx.addIssue({
1107 code: ZodIssueCode.custom,
1108 ...getIssueProperties(val)
1109 });
1110 if (typeof Promise !== "undefined" && result instanceof Promise) {
1111 return result.then((data) => {
1112 if (!data) {
1113 setError();
1114 return false;
1115 } else {
1116 return true;
1117 }
1118 });
1119 }
1120 if (!result) {
1121 setError();
1122 return false;
1123 } else {
1124 return true;
1125 }
1126 });
1127 }
1128 refinement(check, refinementData) {
1129 return this._refinement((val, ctx) => {
1130 if (!check(val)) {
1131 ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
1132 return false;
1133 } else {
1134 return true;
1135 }
1136 });
1137 }
1138 _refinement(refinement) {
1139 return new ZodEffects({
1140 schema: this,
1141 typeName: ZodFirstPartyTypeKind.ZodEffects,
1142 effect: { type: "refinement", refinement }
1143 });
1144 }
1145 superRefine(refinement) {
1146 return this._refinement(refinement);
1147 }
1148 optional() {
1149 return ZodOptional.create(this);
1150 }
1151 nullable() {
1152 return ZodNullable.create(this);
1153 }
1154 nullish() {
1155 return this.optional().nullable();
1156 }
1157 array() {
1158 return ZodArray.create(this);
1159 }
1160 promise() {
1161 return ZodPromise.create(this);
1162 }
1163 or(option) {
1164 return ZodUnion.create([this, option]);
1165 }
1166 and(incoming) {
1167 return ZodIntersection.create(this, incoming);
1168 }
1169 transform(transform) {
1170 return new ZodEffects({
1171 schema: this,
1172 typeName: ZodFirstPartyTypeKind.ZodEffects,
1173 effect: { type: "transform", transform }
1174 });
1175 }
1176 default(def) {
1177 const defaultValueFunc = typeof def === "function" ? def : () => def;
1178 return new ZodDefault({
1179 innerType: this,
1180 defaultValue: defaultValueFunc,
1181 typeName: ZodFirstPartyTypeKind.ZodDefault
1182 });
1183 }
1184 brand() {
1185 return new ZodBranded({
1186 typeName: ZodFirstPartyTypeKind.ZodBranded,
1187 type: this,
1188 ...processCreateParams(void 0)
1189 });
1190 }
1191 catch(def) {
1192 const defaultValueFunc = typeof def === "function" ? def : () => def;
1193 return new ZodCatch({
1194 innerType: this,
1195 defaultValue: defaultValueFunc,
1196 typeName: ZodFirstPartyTypeKind.ZodCatch
1197 });
1198 }
1199 describe(description) {
1200 const This = this.constructor;
1201 return new This({
1202 ...this._def,
1203 description
1204 });
1205 }
1206 pipe(target) {
1207 return ZodPipeline.create(this, target);
1208 }
1209 isOptional() {
1210 return this.safeParse(void 0).success;
1211 }
1212 isNullable() {
1213 return this.safeParse(null).success;
1214 }
1215};
1216var cuidRegex = /^c[^\s-]{8,}$/i;
1217var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
1218var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
1219var datetimeRegex = (args) => {
1220 if (args.precision) {
1221 if (args.offset) {
1222 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
1223 } else {
1224 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
1225 }
1226 } else if (args.precision === 0) {
1227 if (args.offset) {
1228 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
1229 } else {
1230 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
1231 }
1232 } else {
1233 if (args.offset) {
1234 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
1235 } else {
1236 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
1237 }
1238 }
1239};
1240var ZodString = class extends ZodType {
1241 constructor() {
1242 super(...arguments);
1243 this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
1244 validation,
1245 code: ZodIssueCode.invalid_string,
1246 ...errorUtil.errToObj(message)
1247 });
1248 this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
1249 this.trim = () => new ZodString({
1250 ...this._def,
1251 checks: [...this._def.checks, { kind: "trim" }]
1252 });
1253 }
1254 _parse(input) {
1255 if (this._def.coerce) {
1256 input.data = String(input.data);
1257 }
1258 const parsedType = this._getType(input);
1259 if (parsedType !== ZodParsedType.string) {
1260 const ctx2 = this._getOrReturnCtx(input);
1261 addIssueToContext(
1262 ctx2,
1263 {
1264 code: ZodIssueCode.invalid_type,
1265 expected: ZodParsedType.string,
1266 received: ctx2.parsedType
1267 }
1268 );
1269 return INVALID;
1270 }
1271 const status = new ParseStatus();
1272 let ctx = void 0;
1273 for (const check of this._def.checks) {
1274 if (check.kind === "min") {
1275 if (input.data.length < check.value) {
1276 ctx = this._getOrReturnCtx(input, ctx);
1277 addIssueToContext(ctx, {
1278 code: ZodIssueCode.too_small,
1279 minimum: check.value,
1280 type: "string",
1281 inclusive: true,
1282 exact: false,
1283 message: check.message
1284 });
1285 status.dirty();
1286 }
1287 } else if (check.kind === "max") {
1288 if (input.data.length > check.value) {
1289 ctx = this._getOrReturnCtx(input, ctx);
1290 addIssueToContext(ctx, {
1291 code: ZodIssueCode.too_big,
1292 maximum: check.value,
1293 type: "string",
1294 inclusive: true,
1295 exact: false,
1296 message: check.message
1297 });
1298 status.dirty();
1299 }
1300 } else if (check.kind === "length") {
1301 const tooBig = input.data.length > check.value;
1302 const tooSmall = input.data.length < check.value;
1303 if (tooBig || tooSmall) {
1304 ctx = this._getOrReturnCtx(input, ctx);
1305 if (tooBig) {
1306 addIssueToContext(ctx, {
1307 code: ZodIssueCode.too_big,
1308 maximum: check.value,
1309 type: "string",
1310 inclusive: true,
1311 exact: true,
1312 message: check.message
1313 });
1314 } else if (tooSmall) {
1315 addIssueToContext(ctx, {
1316 code: ZodIssueCode.too_small,
1317 minimum: check.value,
1318 type: "string",
1319 inclusive: true,
1320 exact: true,
1321 message: check.message
1322 });
1323 }
1324 status.dirty();
1325 }
1326 } else if (check.kind === "email") {
1327 if (!emailRegex.test(input.data)) {
1328 ctx = this._getOrReturnCtx(input, ctx);
1329 addIssueToContext(ctx, {
1330 validation: "email",
1331 code: ZodIssueCode.invalid_string,
1332 message: check.message
1333 });
1334 status.dirty();
1335 }
1336 } else if (check.kind === "uuid") {
1337 if (!uuidRegex.test(input.data)) {
1338 ctx = this._getOrReturnCtx(input, ctx);
1339 addIssueToContext(ctx, {
1340 validation: "uuid",
1341 code: ZodIssueCode.invalid_string,
1342 message: check.message
1343 });
1344 status.dirty();
1345 }
1346 } else if (check.kind === "cuid") {
1347 if (!cuidRegex.test(input.data)) {
1348 ctx = this._getOrReturnCtx(input, ctx);
1349 addIssueToContext(ctx, {
1350 validation: "cuid",
1351 code: ZodIssueCode.invalid_string,
1352 message: check.message
1353 });
1354 status.dirty();
1355 }
1356 } else if (check.kind === "url") {
1357 try {
1358 new URL(input.data);
1359 } catch (_a) {
1360 ctx = this._getOrReturnCtx(input, ctx);
1361 addIssueToContext(ctx, {
1362 validation: "url",
1363 code: ZodIssueCode.invalid_string,
1364 message: check.message
1365 });
1366 status.dirty();
1367 }
1368 } else if (check.kind === "regex") {
1369 check.regex.lastIndex = 0;
1370 const testResult = check.regex.test(input.data);
1371 if (!testResult) {
1372 ctx = this._getOrReturnCtx(input, ctx);
1373 addIssueToContext(ctx, {
1374 validation: "regex",
1375 code: ZodIssueCode.invalid_string,
1376 message: check.message
1377 });
1378 status.dirty();
1379 }
1380 } else if (check.kind === "trim") {
1381 input.data = input.data.trim();
1382 } else if (check.kind === "startsWith") {
1383 if (!input.data.startsWith(check.value)) {
1384 ctx = this._getOrReturnCtx(input, ctx);
1385 addIssueToContext(ctx, {
1386 code: ZodIssueCode.invalid_string,
1387 validation: { startsWith: check.value },
1388 message: check.message
1389 });
1390 status.dirty();
1391 }
1392 } else if (check.kind === "endsWith") {
1393 if (!input.data.endsWith(check.value)) {
1394 ctx = this._getOrReturnCtx(input, ctx);
1395 addIssueToContext(ctx, {
1396 code: ZodIssueCode.invalid_string,
1397 validation: { endsWith: check.value },
1398 message: check.message
1399 });
1400 status.dirty();
1401 }
1402 } else if (check.kind === "datetime") {
1403 const regex = datetimeRegex(check);
1404 if (!regex.test(input.data)) {
1405 ctx = this._getOrReturnCtx(input, ctx);
1406 addIssueToContext(ctx, {
1407 code: ZodIssueCode.invalid_string,
1408 validation: "datetime",
1409 message: check.message
1410 });
1411 status.dirty();
1412 }
1413 } else {
1414 util.assertNever(check);
1415 }
1416 }
1417 return { status: status.value, value: input.data };
1418 }
1419 _addCheck(check) {
1420 return new ZodString({
1421 ...this._def,
1422 checks: [...this._def.checks, check]
1423 });
1424 }
1425 email(message) {
1426 return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
1427 }
1428 url(message) {
1429 return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1430 }
1431 uuid(message) {
1432 return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1433 }
1434 cuid(message) {
1435 return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1436 }
1437 datetime(options) {
1438 var _a;
1439 if (typeof options === "string") {
1440 return this._addCheck({
1441 kind: "datetime",
1442 precision: null,
1443 offset: false,
1444 message: options
1445 });
1446 }
1447 return this._addCheck({
1448 kind: "datetime",
1449 precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1450 offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1451 ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1452 });
1453 }
1454 regex(regex, message) {
1455 return this._addCheck({
1456 kind: "regex",
1457 regex,
1458 ...errorUtil.errToObj(message)
1459 });
1460 }
1461 startsWith(value, message) {
1462 return this._addCheck({
1463 kind: "startsWith",
1464 value,
1465 ...errorUtil.errToObj(message)
1466 });
1467 }
1468 endsWith(value, message) {
1469 return this._addCheck({
1470 kind: "endsWith",
1471 value,
1472 ...errorUtil.errToObj(message)
1473 });
1474 }
1475 min(minLength, message) {
1476 return this._addCheck({
1477 kind: "min",
1478 value: minLength,
1479 ...errorUtil.errToObj(message)
1480 });
1481 }
1482 max(maxLength, message) {
1483 return this._addCheck({
1484 kind: "max",
1485 value: maxLength,
1486 ...errorUtil.errToObj(message)
1487 });
1488 }
1489 length(len, message) {
1490 return this._addCheck({
1491 kind: "length",
1492 value: len,
1493 ...errorUtil.errToObj(message)
1494 });
1495 }
1496 get isDatetime() {
1497 return !!this._def.checks.find((ch) => ch.kind === "datetime");
1498 }
1499 get isEmail() {
1500 return !!this._def.checks.find((ch) => ch.kind === "email");
1501 }
1502 get isURL() {
1503 return !!this._def.checks.find((ch) => ch.kind === "url");
1504 }
1505 get isUUID() {
1506 return !!this._def.checks.find((ch) => ch.kind === "uuid");
1507 }
1508 get isCUID() {
1509 return !!this._def.checks.find((ch) => ch.kind === "cuid");
1510 }
1511 get minLength() {
1512 let min = null;
1513 for (const ch of this._def.checks) {
1514 if (ch.kind === "min") {
1515 if (min === null || ch.value > min)
1516 min = ch.value;
1517 }
1518 }
1519 return min;
1520 }
1521 get maxLength() {
1522 let max = null;
1523 for (const ch of this._def.checks) {
1524 if (ch.kind === "max") {
1525 if (max === null || ch.value < max)
1526 max = ch.value;
1527 }
1528 }
1529 return max;
1530 }
1531};
1532ZodString.create = (params) => {
1533 var _a;
1534 return new ZodString({
1535 checks: [],
1536 typeName: ZodFirstPartyTypeKind.ZodString,
1537 coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1538 ...processCreateParams(params)
1539 });
1540};
1541function floatSafeRemainder(val, step) {
1542 const valDecCount = (val.toString().split(".")[1] || "").length;
1543 const stepDecCount = (step.toString().split(".")[1] || "").length;
1544 const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1545 const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1546 const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1547 return valInt % stepInt / Math.pow(10, decCount);
1548}
1549var ZodNumber = class extends ZodType {
1550 constructor() {
1551 super(...arguments);
1552 this.min = this.gte;
1553 this.max = this.lte;
1554 this.step = this.multipleOf;
1555 }
1556 _parse(input) {
1557 if (this._def.coerce) {
1558 input.data = Number(input.data);
1559 }
1560 const parsedType = this._getType(input);
1561 if (parsedType !== ZodParsedType.number) {
1562 const ctx2 = this._getOrReturnCtx(input);
1563 addIssueToContext(ctx2, {
1564 code: ZodIssueCode.invalid_type,
1565 expected: ZodParsedType.number,
1566 received: ctx2.parsedType
1567 });
1568 return INVALID;
1569 }
1570 let ctx = void 0;
1571 const status = new ParseStatus();
1572 for (const check of this._def.checks) {
1573 if (check.kind === "int") {
1574 if (!util.isInteger(input.data)) {
1575 ctx = this._getOrReturnCtx(input, ctx);
1576 addIssueToContext(ctx, {
1577 code: ZodIssueCode.invalid_type,
1578 expected: "integer",
1579 received: "float",
1580 message: check.message
1581 });
1582 status.dirty();
1583 }
1584 } else if (check.kind === "min") {
1585 const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1586 if (tooSmall) {
1587 ctx = this._getOrReturnCtx(input, ctx);
1588 addIssueToContext(ctx, {
1589 code: ZodIssueCode.too_small,
1590 minimum: check.value,
1591 type: "number",
1592 inclusive: check.inclusive,
1593 exact: false,
1594 message: check.message
1595 });
1596 status.dirty();
1597 }
1598 } else if (check.kind === "max") {
1599 const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1600 if (tooBig) {
1601 ctx = this._getOrReturnCtx(input, ctx);
1602 addIssueToContext(ctx, {
1603 code: ZodIssueCode.too_big,
1604 maximum: check.value,
1605 type: "number",
1606 inclusive: check.inclusive,
1607 exact: false,
1608 message: check.message
1609 });
1610 status.dirty();
1611 }
1612 } else if (check.kind === "multipleOf") {
1613 if (floatSafeRemainder(input.data, check.value) !== 0) {
1614 ctx = this._getOrReturnCtx(input, ctx);
1615 addIssueToContext(ctx, {
1616 code: ZodIssueCode.not_multiple_of,
1617 multipleOf: check.value,
1618 message: check.message
1619 });
1620 status.dirty();
1621 }
1622 } else if (check.kind === "finite") {
1623 if (!Number.isFinite(input.data)) {
1624 ctx = this._getOrReturnCtx(input, ctx);
1625 addIssueToContext(ctx, {
1626 code: ZodIssueCode.not_finite,
1627 message: check.message
1628 });
1629 status.dirty();
1630 }
1631 } else {
1632 util.assertNever(check);
1633 }
1634 }
1635 return { status: status.value, value: input.data };
1636 }
1637 gte(value, message) {
1638 return this.setLimit("min", value, true, errorUtil.toString(message));
1639 }
1640 gt(value, message) {
1641 return this.setLimit("min", value, false, errorUtil.toString(message));
1642 }
1643 lte(value, message) {
1644 return this.setLimit("max", value, true, errorUtil.toString(message));
1645 }
1646 lt(value, message) {
1647 return this.setLimit("max", value, false, errorUtil.toString(message));
1648 }
1649 setLimit(kind, value, inclusive, message) {
1650 return new ZodNumber({
1651 ...this._def,
1652 checks: [
1653 ...this._def.checks,
1654 {
1655 kind,
1656 value,
1657 inclusive,
1658 message: errorUtil.toString(message)
1659 }
1660 ]
1661 });
1662 }
1663 _addCheck(check) {
1664 return new ZodNumber({
1665 ...this._def,
1666 checks: [...this._def.checks, check]
1667 });
1668 }
1669 int(message) {
1670 return this._addCheck({
1671 kind: "int",
1672 message: errorUtil.toString(message)
1673 });
1674 }
1675 positive(message) {
1676 return this._addCheck({
1677 kind: "min",
1678 value: 0,
1679 inclusive: false,
1680 message: errorUtil.toString(message)
1681 });
1682 }
1683 negative(message) {
1684 return this._addCheck({
1685 kind: "max",
1686 value: 0,
1687 inclusive: false,
1688 message: errorUtil.toString(message)
1689 });
1690 }
1691 nonpositive(message) {
1692 return this._addCheck({
1693 kind: "max",
1694 value: 0,
1695 inclusive: true,
1696 message: errorUtil.toString(message)
1697 });
1698 }
1699 nonnegative(message) {
1700 return this._addCheck({
1701 kind: "min",
1702 value: 0,
1703 inclusive: true,
1704 message: errorUtil.toString(message)
1705 });
1706 }
1707 multipleOf(value, message) {
1708 return this._addCheck({
1709 kind: "multipleOf",
1710 value,
1711 message: errorUtil.toString(message)
1712 });
1713 }
1714 finite(message) {
1715 return this._addCheck({
1716 kind: "finite",
1717 message: errorUtil.toString(message)
1718 });
1719 }
1720 get minValue() {
1721 let min = null;
1722 for (const ch of this._def.checks) {
1723 if (ch.kind === "min") {
1724 if (min === null || ch.value > min)
1725 min = ch.value;
1726 }
1727 }
1728 return min;
1729 }
1730 get maxValue() {
1731 let max = null;
1732 for (const ch of this._def.checks) {
1733 if (ch.kind === "max") {
1734 if (max === null || ch.value < max)
1735 max = ch.value;
1736 }
1737 }
1738 return max;
1739 }
1740 get isInt() {
1741 return !!this._def.checks.find((ch) => ch.kind === "int");
1742 }
1743};
1744ZodNumber.create = (params) => {
1745 return new ZodNumber({
1746 checks: [],
1747 typeName: ZodFirstPartyTypeKind.ZodNumber,
1748 coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1749 ...processCreateParams(params)
1750 });
1751};
1752var ZodBigInt = class extends ZodType {
1753 _parse(input) {
1754 if (this._def.coerce) {
1755 input.data = BigInt(input.data);
1756 }
1757 const parsedType = this._getType(input);
1758 if (parsedType !== ZodParsedType.bigint) {
1759 const ctx = this._getOrReturnCtx(input);
1760 addIssueToContext(ctx, {
1761 code: ZodIssueCode.invalid_type,
1762 expected: ZodParsedType.bigint,
1763 received: ctx.parsedType
1764 });
1765 return INVALID;
1766 }
1767 return OK(input.data);
1768 }
1769};
1770ZodBigInt.create = (params) => {
1771 var _a;
1772 return new ZodBigInt({
1773 typeName: ZodFirstPartyTypeKind.ZodBigInt,
1774 coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1775 ...processCreateParams(params)
1776 });
1777};
1778var ZodBoolean = class extends ZodType {
1779 _parse(input) {
1780 if (this._def.coerce) {
1781 input.data = Boolean(input.data);
1782 }
1783 const parsedType = this._getType(input);
1784 if (parsedType !== ZodParsedType.boolean) {
1785 const ctx = this._getOrReturnCtx(input);
1786 addIssueToContext(ctx, {
1787 code: ZodIssueCode.invalid_type,
1788 expected: ZodParsedType.boolean,
1789 received: ctx.parsedType
1790 });
1791 return INVALID;
1792 }
1793 return OK(input.data);
1794 }
1795};
1796ZodBoolean.create = (params) => {
1797 return new ZodBoolean({
1798 typeName: ZodFirstPartyTypeKind.ZodBoolean,
1799 coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1800 ...processCreateParams(params)
1801 });
1802};
1803var ZodDate = class extends ZodType {
1804 _parse(input) {
1805 if (this._def.coerce) {
1806 input.data = new Date(input.data);
1807 }
1808 const parsedType = this._getType(input);
1809 if (parsedType !== ZodParsedType.date) {
1810 const ctx2 = this._getOrReturnCtx(input);
1811 addIssueToContext(ctx2, {
1812 code: ZodIssueCode.invalid_type,
1813 expected: ZodParsedType.date,
1814 received: ctx2.parsedType
1815 });
1816 return INVALID;
1817 }
1818 if (isNaN(input.data.getTime())) {
1819 const ctx2 = this._getOrReturnCtx(input);
1820 addIssueToContext(ctx2, {
1821 code: ZodIssueCode.invalid_date
1822 });
1823 return INVALID;
1824 }
1825 const status = new ParseStatus();
1826 let ctx = void 0;
1827 for (const check of this._def.checks) {
1828 if (check.kind === "min") {
1829 if (input.data.getTime() < check.value) {
1830 ctx = this._getOrReturnCtx(input, ctx);
1831 addIssueToContext(ctx, {
1832 code: ZodIssueCode.too_small,
1833 message: check.message,
1834 inclusive: true,
1835 exact: false,
1836 minimum: check.value,
1837 type: "date"
1838 });
1839 status.dirty();
1840 }
1841 } else if (check.kind === "max") {
1842 if (input.data.getTime() > check.value) {
1843 ctx = this._getOrReturnCtx(input, ctx);
1844 addIssueToContext(ctx, {
1845 code: ZodIssueCode.too_big,
1846 message: check.message,
1847 inclusive: true,
1848 exact: false,
1849 maximum: check.value,
1850 type: "date"
1851 });
1852 status.dirty();
1853 }
1854 } else {
1855 util.assertNever(check);
1856 }
1857 }
1858 return {
1859 status: status.value,
1860 value: new Date(input.data.getTime())
1861 };
1862 }
1863 _addCheck(check) {
1864 return new ZodDate({
1865 ...this._def,
1866 checks: [...this._def.checks, check]
1867 });
1868 }
1869 min(minDate, message) {
1870 return this._addCheck({
1871 kind: "min",
1872 value: minDate.getTime(),
1873 message: errorUtil.toString(message)
1874 });
1875 }
1876 max(maxDate, message) {
1877 return this._addCheck({
1878 kind: "max",
1879 value: maxDate.getTime(),
1880 message: errorUtil.toString(message)
1881 });
1882 }
1883 get minDate() {
1884 let min = null;
1885 for (const ch of this._def.checks) {
1886 if (ch.kind === "min") {
1887 if (min === null || ch.value > min)
1888 min = ch.value;
1889 }
1890 }
1891 return min != null ? new Date(min) : null;
1892 }
1893 get maxDate() {
1894 let max = null;
1895 for (const ch of this._def.checks) {
1896 if (ch.kind === "max") {
1897 if (max === null || ch.value < max)
1898 max = ch.value;
1899 }
1900 }
1901 return max != null ? new Date(max) : null;
1902 }
1903};
1904ZodDate.create = (params) => {
1905 return new ZodDate({
1906 checks: [],
1907 coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1908 typeName: ZodFirstPartyTypeKind.ZodDate,
1909 ...processCreateParams(params)
1910 });
1911};
1912var ZodSymbol = class extends ZodType {
1913 _parse(input) {
1914 const parsedType = this._getType(input);
1915 if (parsedType !== ZodParsedType.symbol) {
1916 const ctx = this._getOrReturnCtx(input);
1917 addIssueToContext(ctx, {
1918 code: ZodIssueCode.invalid_type,
1919 expected: ZodParsedType.symbol,
1920 received: ctx.parsedType
1921 });
1922 return INVALID;
1923 }
1924 return OK(input.data);
1925 }
1926};
1927ZodSymbol.create = (params) => {
1928 return new ZodSymbol({
1929 typeName: ZodFirstPartyTypeKind.ZodSymbol,
1930 ...processCreateParams(params)
1931 });
1932};
1933var ZodUndefined = class extends ZodType {
1934 _parse(input) {
1935 const parsedType = this._getType(input);
1936 if (parsedType !== ZodParsedType.undefined) {
1937 const ctx = this._getOrReturnCtx(input);
1938 addIssueToContext(ctx, {
1939 code: ZodIssueCode.invalid_type,
1940 expected: ZodParsedType.undefined,
1941 received: ctx.parsedType
1942 });
1943 return INVALID;
1944 }
1945 return OK(input.data);
1946 }
1947};
1948ZodUndefined.create = (params) => {
1949 return new ZodUndefined({
1950 typeName: ZodFirstPartyTypeKind.ZodUndefined,
1951 ...processCreateParams(params)
1952 });
1953};
1954var ZodNull = class extends ZodType {
1955 _parse(input) {
1956 const parsedType = this._getType(input);
1957 if (parsedType !== ZodParsedType.null) {
1958 const ctx = this._getOrReturnCtx(input);
1959 addIssueToContext(ctx, {
1960 code: ZodIssueCode.invalid_type,
1961 expected: ZodParsedType.null,
1962 received: ctx.parsedType
1963 });
1964 return INVALID;
1965 }
1966 return OK(input.data);
1967 }
1968};
1969ZodNull.create = (params) => {
1970 return new ZodNull({
1971 typeName: ZodFirstPartyTypeKind.ZodNull,
1972 ...processCreateParams(params)
1973 });
1974};
1975var ZodAny = class extends ZodType {
1976 constructor() {
1977 super(...arguments);
1978 this._any = true;
1979 }
1980 _parse(input) {
1981 return OK(input.data);
1982 }
1983};
1984ZodAny.create = (params) => {
1985 return new ZodAny({
1986 typeName: ZodFirstPartyTypeKind.ZodAny,
1987 ...processCreateParams(params)
1988 });
1989};
1990var ZodUnknown = class extends ZodType {
1991 constructor() {
1992 super(...arguments);
1993 this._unknown = true;
1994 }
1995 _parse(input) {
1996 return OK(input.data);
1997 }
1998};
1999ZodUnknown.create = (params) => {
2000 return new ZodUnknown({
2001 typeName: ZodFirstPartyTypeKind.ZodUnknown,
2002 ...processCreateParams(params)
2003 });
2004};
2005var ZodNever = class extends ZodType {
2006 _parse(input) {
2007 const ctx = this._getOrReturnCtx(input);
2008 addIssueToContext(ctx, {
2009 code: ZodIssueCode.invalid_type,
2010 expected: ZodParsedType.never,
2011 received: ctx.parsedType
2012 });
2013 return INVALID;
2014 }
2015};
2016ZodNever.create = (params) => {
2017 return new ZodNever({
2018 typeName: ZodFirstPartyTypeKind.ZodNever,
2019 ...processCreateParams(params)
2020 });
2021};
2022var ZodVoid = class extends ZodType {
2023 _parse(input) {
2024 const parsedType = this._getType(input);
2025 if (parsedType !== ZodParsedType.undefined) {
2026 const ctx = this._getOrReturnCtx(input);
2027 addIssueToContext(ctx, {
2028 code: ZodIssueCode.invalid_type,
2029 expected: ZodParsedType.void,
2030 received: ctx.parsedType
2031 });
2032 return INVALID;
2033 }
2034 return OK(input.data);
2035 }
2036};
2037ZodVoid.create = (params) => {
2038 return new ZodVoid({
2039 typeName: ZodFirstPartyTypeKind.ZodVoid,
2040 ...processCreateParams(params)
2041 });
2042};
2043var ZodArray = class extends ZodType {
2044 _parse(input) {
2045 const { ctx, status } = this._processInputParams(input);
2046 const def = this._def;
2047 if (ctx.parsedType !== ZodParsedType.array) {
2048 addIssueToContext(ctx, {
2049 code: ZodIssueCode.invalid_type,
2050 expected: ZodParsedType.array,
2051 received: ctx.parsedType
2052 });
2053 return INVALID;
2054 }
2055 if (def.exactLength !== null) {
2056 const tooBig = ctx.data.length > def.exactLength.value;
2057 const tooSmall = ctx.data.length < def.exactLength.value;
2058 if (tooBig || tooSmall) {
2059 addIssueToContext(ctx, {
2060 code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2061 minimum: tooSmall ? def.exactLength.value : void 0,
2062 maximum: tooBig ? def.exactLength.value : void 0,
2063 type: "array",
2064 inclusive: true,
2065 exact: true,
2066 message: def.exactLength.message
2067 });
2068 status.dirty();
2069 }
2070 }
2071 if (def.minLength !== null) {
2072 if (ctx.data.length < def.minLength.value) {
2073 addIssueToContext(ctx, {
2074 code: ZodIssueCode.too_small,
2075 minimum: def.minLength.value,
2076 type: "array",
2077 inclusive: true,
2078 exact: false,
2079 message: def.minLength.message
2080 });
2081 status.dirty();
2082 }
2083 }
2084 if (def.maxLength !== null) {
2085 if (ctx.data.length > def.maxLength.value) {
2086 addIssueToContext(ctx, {
2087 code: ZodIssueCode.too_big,
2088 maximum: def.maxLength.value,
2089 type: "array",
2090 inclusive: true,
2091 exact: false,
2092 message: def.maxLength.message
2093 });
2094 status.dirty();
2095 }
2096 }
2097 if (ctx.common.async) {
2098 return Promise.all(ctx.data.map((item, i) => {
2099 return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2100 })).then((result2) => {
2101 return ParseStatus.mergeArray(status, result2);
2102 });
2103 }
2104 const result = ctx.data.map((item, i) => {
2105 return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2106 });
2107 return ParseStatus.mergeArray(status, result);
2108 }
2109 get element() {
2110 return this._def.type;
2111 }
2112 min(minLength, message) {
2113 return new ZodArray({
2114 ...this._def,
2115 minLength: { value: minLength, message: errorUtil.toString(message) }
2116 });
2117 }
2118 max(maxLength, message) {
2119 return new ZodArray({
2120 ...this._def,
2121 maxLength: { value: maxLength, message: errorUtil.toString(message) }
2122 });
2123 }
2124 length(len, message) {
2125 return new ZodArray({
2126 ...this._def,
2127 exactLength: { value: len, message: errorUtil.toString(message) }
2128 });
2129 }
2130 nonempty(message) {
2131 return this.min(1, message);
2132 }
2133};
2134ZodArray.create = (schema, params) => {
2135 return new ZodArray({
2136 type: schema,
2137 minLength: null,
2138 maxLength: null,
2139 exactLength: null,
2140 typeName: ZodFirstPartyTypeKind.ZodArray,
2141 ...processCreateParams(params)
2142 });
2143};
2144var objectUtil;
2145(function(objectUtil2) {
2146 objectUtil2.mergeShapes = (first, second) => {
2147 return {
2148 ...first,
2149 ...second
2150 };
2151 };
2152})(objectUtil || (objectUtil = {}));
2153var AugmentFactory = (def) => (augmentation) => {
2154 return new ZodObject({
2155 ...def,
2156 shape: () => ({
2157 ...def.shape(),
2158 ...augmentation
2159 })
2160 });
2161};
2162function deepPartialify(schema) {
2163 if (schema instanceof ZodObject) {
2164 const newShape = {};
2165 for (const key in schema.shape) {
2166 const fieldSchema = schema.shape[key];
2167 newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
2168 }
2169 return new ZodObject({
2170 ...schema._def,
2171 shape: () => newShape
2172 });
2173 } else if (schema instanceof ZodArray) {
2174 return ZodArray.create(deepPartialify(schema.element));
2175 } else if (schema instanceof ZodOptional) {
2176 return ZodOptional.create(deepPartialify(schema.unwrap()));
2177 } else if (schema instanceof ZodNullable) {
2178 return ZodNullable.create(deepPartialify(schema.unwrap()));
2179 } else if (schema instanceof ZodTuple) {
2180 return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
2181 } else {
2182 return schema;
2183 }
2184}
2185var ZodObject = class extends ZodType {
2186 constructor() {
2187 super(...arguments);
2188 this._cached = null;
2189 this.nonstrict = this.passthrough;
2190 this.augment = AugmentFactory(this._def);
2191 this.extend = AugmentFactory(this._def);
2192 }
2193 _getCached() {
2194 if (this._cached !== null)
2195 return this._cached;
2196 const shape = this._def.shape();
2197 const keys = util.objectKeys(shape);
2198 return this._cached = { shape, keys };
2199 }
2200 _parse(input) {
2201 const parsedType = this._getType(input);
2202 if (parsedType !== ZodParsedType.object) {
2203 const ctx2 = this._getOrReturnCtx(input);
2204 addIssueToContext(ctx2, {
2205 code: ZodIssueCode.invalid_type,
2206 expected: ZodParsedType.object,
2207 received: ctx2.parsedType
2208 });
2209 return INVALID;
2210 }
2211 const { status, ctx } = this._processInputParams(input);
2212 const { shape, keys: shapeKeys } = this._getCached();
2213 const extraKeys = [];
2214 if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2215 for (const key in ctx.data) {
2216 if (!shapeKeys.includes(key)) {
2217 extraKeys.push(key);
2218 }
2219 }
2220 }
2221 const pairs = [];
2222 for (const key of shapeKeys) {
2223 const keyValidator = shape[key];
2224 const value = ctx.data[key];
2225 pairs.push({
2226 key: { status: "valid", value: key },
2227 value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2228 alwaysSet: key in ctx.data
2229 });
2230 }
2231 if (this._def.catchall instanceof ZodNever) {
2232 const unknownKeys = this._def.unknownKeys;
2233 if (unknownKeys === "passthrough") {
2234 for (const key of extraKeys) {
2235 pairs.push({
2236 key: { status: "valid", value: key },
2237 value: { status: "valid", value: ctx.data[key] }
2238 });
2239 }
2240 } else if (unknownKeys === "strict") {
2241 if (extraKeys.length > 0) {
2242 addIssueToContext(ctx, {
2243 code: ZodIssueCode.unrecognized_keys,
2244 keys: extraKeys
2245 });
2246 status.dirty();
2247 }
2248 } else if (unknownKeys === "strip")
2249 ;
2250 else {
2251 throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2252 }
2253 } else {
2254 const catchall = this._def.catchall;
2255 for (const key of extraKeys) {
2256 const value = ctx.data[key];
2257 pairs.push({
2258 key: { status: "valid", value: key },
2259 value: catchall._parse(
2260 new ParseInputLazyPath(ctx, value, ctx.path, key)
2261 ),
2262 alwaysSet: key in ctx.data
2263 });
2264 }
2265 }
2266 if (ctx.common.async) {
2267 return Promise.resolve().then(async () => {
2268 const syncPairs = [];
2269 for (const pair of pairs) {
2270 const key = await pair.key;
2271 syncPairs.push({
2272 key,
2273 value: await pair.value,
2274 alwaysSet: pair.alwaysSet
2275 });
2276 }
2277 return syncPairs;
2278 }).then((syncPairs) => {
2279 return ParseStatus.mergeObjectSync(status, syncPairs);
2280 });
2281 } else {
2282 return ParseStatus.mergeObjectSync(status, pairs);
2283 }
2284 }
2285 get shape() {
2286 return this._def.shape();
2287 }
2288 strict(message) {
2289 errorUtil.errToObj;
2290 return new ZodObject({
2291 ...this._def,
2292 unknownKeys: "strict",
2293 ...message !== void 0 ? {
2294 errorMap: (issue, ctx) => {
2295 var _a, _b, _c, _d;
2296 const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2297 if (issue.code === "unrecognized_keys")
2298 return {
2299 message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
2300 };
2301 return {
2302 message: defaultError
2303 };
2304 }
2305 } : {}
2306 });
2307 }
2308 strip() {
2309 return new ZodObject({
2310 ...this._def,
2311 unknownKeys: "strip"
2312 });
2313 }
2314 passthrough() {
2315 return new ZodObject({
2316 ...this._def,
2317 unknownKeys: "passthrough"
2318 });
2319 }
2320 setKey(key, schema) {
2321 return this.augment({ [key]: schema });
2322 }
2323 merge(merging) {
2324 const merged = new ZodObject({
2325 unknownKeys: merging._def.unknownKeys,
2326 catchall: merging._def.catchall,
2327 shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2328 typeName: ZodFirstPartyTypeKind.ZodObject
2329 });
2330 return merged;
2331 }
2332 catchall(index) {
2333 return new ZodObject({
2334 ...this._def,
2335 catchall: index
2336 });
2337 }
2338 pick(mask) {
2339 const shape = {};
2340 util.objectKeys(mask).map((key) => {
2341 if (this.shape[key])
2342 shape[key] = this.shape[key];
2343 });
2344 return new ZodObject({
2345 ...this._def,
2346 shape: () => shape
2347 });
2348 }
2349 omit(mask) {
2350 const shape = {};
2351 util.objectKeys(this.shape).map((key) => {
2352 if (util.objectKeys(mask).indexOf(key) === -1) {
2353 shape[key] = this.shape[key];
2354 }
2355 });
2356 return new ZodObject({
2357 ...this._def,
2358 shape: () => shape
2359 });
2360 }
2361 deepPartial() {
2362 return deepPartialify(this);
2363 }
2364 partial(mask) {
2365 const newShape = {};
2366 if (mask) {
2367 util.objectKeys(this.shape).map((key) => {
2368 if (util.objectKeys(mask).indexOf(key) === -1) {
2369 newShape[key] = this.shape[key];
2370 } else {
2371 newShape[key] = this.shape[key].optional();
2372 }
2373 });
2374 return new ZodObject({
2375 ...this._def,
2376 shape: () => newShape
2377 });
2378 } else {
2379 for (const key in this.shape) {
2380 const fieldSchema = this.shape[key];
2381 newShape[key] = fieldSchema.optional();
2382 }
2383 }
2384 return new ZodObject({
2385 ...this._def,
2386 shape: () => newShape
2387 });
2388 }
2389 required(mask) {
2390 const newShape = {};
2391 if (mask) {
2392 util.objectKeys(this.shape).map((key) => {
2393 if (util.objectKeys(mask).indexOf(key) === -1) {
2394 newShape[key] = this.shape[key];
2395 } else {
2396 const fieldSchema = this.shape[key];
2397 let newField = fieldSchema;
2398 while (newField instanceof ZodOptional) {
2399 newField = newField._def.innerType;
2400 }
2401 newShape[key] = newField;
2402 }
2403 });
2404 } else {
2405 for (const key in this.shape) {
2406 const fieldSchema = this.shape[key];
2407 let newField = fieldSchema;
2408 while (newField instanceof ZodOptional) {
2409 newField = newField._def.innerType;
2410 }
2411 newShape[key] = newField;
2412 }
2413 }
2414 return new ZodObject({
2415 ...this._def,
2416 shape: () => newShape
2417 });
2418 }
2419 keyof() {
2420 return createZodEnum(util.objectKeys(this.shape));
2421 }
2422};
2423ZodObject.create = (shape, params) => {
2424 return new ZodObject({
2425 shape: () => shape,
2426 unknownKeys: "strip",
2427 catchall: ZodNever.create(),
2428 typeName: ZodFirstPartyTypeKind.ZodObject,
2429 ...processCreateParams(params)
2430 });
2431};
2432ZodObject.strictCreate = (shape, params) => {
2433 return new ZodObject({
2434 shape: () => shape,
2435 unknownKeys: "strict",
2436 catchall: ZodNever.create(),
2437 typeName: ZodFirstPartyTypeKind.ZodObject,
2438 ...processCreateParams(params)
2439 });
2440};
2441ZodObject.lazycreate = (shape, params) => {
2442 return new ZodObject({
2443 shape,
2444 unknownKeys: "strip",
2445 catchall: ZodNever.create(),
2446 typeName: ZodFirstPartyTypeKind.ZodObject,
2447 ...processCreateParams(params)
2448 });
2449};
2450var ZodUnion = class extends ZodType {
2451 _parse(input) {
2452 const { ctx } = this._processInputParams(input);
2453 const options = this._def.options;
2454 function handleResults(results) {
2455 for (const result of results) {
2456 if (result.result.status === "valid") {
2457 return result.result;
2458 }
2459 }
2460 for (const result of results) {
2461 if (result.result.status === "dirty") {
2462 ctx.common.issues.push(...result.ctx.common.issues);
2463 return result.result;
2464 }
2465 }
2466 const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2467 addIssueToContext(ctx, {
2468 code: ZodIssueCode.invalid_union,
2469 unionErrors
2470 });
2471 return INVALID;
2472 }
2473 if (ctx.common.async) {
2474 return Promise.all(options.map(async (option) => {
2475 const childCtx = {
2476 ...ctx,
2477 common: {
2478 ...ctx.common,
2479 issues: []
2480 },
2481 parent: null
2482 };
2483 return {
2484 result: await option._parseAsync({
2485 data: ctx.data,
2486 path: ctx.path,
2487 parent: childCtx
2488 }),
2489 ctx: childCtx
2490 };
2491 })).then(handleResults);
2492 } else {
2493 let dirty = void 0;
2494 const issues = [];
2495 for (const option of options) {
2496 const childCtx = {
2497 ...ctx,
2498 common: {
2499 ...ctx.common,
2500 issues: []
2501 },
2502 parent: null
2503 };
2504 const result = option._parseSync({
2505 data: ctx.data,
2506 path: ctx.path,
2507 parent: childCtx
2508 });
2509 if (result.status === "valid") {
2510 return result;
2511 } else if (result.status === "dirty" && !dirty) {
2512 dirty = { result, ctx: childCtx };
2513 }
2514 if (childCtx.common.issues.length) {
2515 issues.push(childCtx.common.issues);
2516 }
2517 }
2518 if (dirty) {
2519 ctx.common.issues.push(...dirty.ctx.common.issues);
2520 return dirty.result;
2521 }
2522 const unionErrors = issues.map((issues2) => new ZodError(issues2));
2523 addIssueToContext(ctx, {
2524 code: ZodIssueCode.invalid_union,
2525 unionErrors
2526 });
2527 return INVALID;
2528 }
2529 }
2530 get options() {
2531 return this._def.options;
2532 }
2533};
2534ZodUnion.create = (types, params) => {
2535 return new ZodUnion({
2536 options: types,
2537 typeName: ZodFirstPartyTypeKind.ZodUnion,
2538 ...processCreateParams(params)
2539 });
2540};
2541var getDiscriminator = (type) => {
2542 if (type instanceof ZodLazy) {
2543 return getDiscriminator(type.schema);
2544 } else if (type instanceof ZodEffects) {
2545 return getDiscriminator(type.innerType());
2546 } else if (type instanceof ZodLiteral) {
2547 return [type.value];
2548 } else if (type instanceof ZodEnum) {
2549 return type.options;
2550 } else if (type instanceof ZodNativeEnum) {
2551 return Object.keys(type.enum);
2552 } else if (type instanceof ZodDefault) {
2553 return getDiscriminator(type._def.innerType);
2554 } else if (type instanceof ZodUndefined) {
2555 return [void 0];
2556 } else if (type instanceof ZodNull) {
2557 return [null];
2558 } else {
2559 return null;
2560 }
2561};
2562var ZodDiscriminatedUnion = class extends ZodType {
2563 _parse(input) {
2564 const { ctx } = this._processInputParams(input);
2565 if (ctx.parsedType !== ZodParsedType.object) {
2566 addIssueToContext(ctx, {
2567 code: ZodIssueCode.invalid_type,
2568 expected: ZodParsedType.object,
2569 received: ctx.parsedType
2570 });
2571 return INVALID;
2572 }
2573 const discriminator = this.discriminator;
2574 const discriminatorValue = ctx.data[discriminator];
2575 const option = this.optionsMap.get(discriminatorValue);
2576 if (!option) {
2577 addIssueToContext(ctx, {
2578 code: ZodIssueCode.invalid_union_discriminator,
2579 options: Array.from(this.optionsMap.keys()),
2580 path: [discriminator]
2581 });
2582 return INVALID;
2583 }
2584 if (ctx.common.async) {
2585 return option._parseAsync({
2586 data: ctx.data,
2587 path: ctx.path,
2588 parent: ctx
2589 });
2590 } else {
2591 return option._parseSync({
2592 data: ctx.data,
2593 path: ctx.path,
2594 parent: ctx
2595 });
2596 }
2597 }
2598 get discriminator() {
2599 return this._def.discriminator;
2600 }
2601 get options() {
2602 return this._def.options;
2603 }
2604 get optionsMap() {
2605 return this._def.optionsMap;
2606 }
2607 static create(discriminator, options, params) {
2608 const optionsMap = /* @__PURE__ */ new Map();
2609 for (const type of options) {
2610 const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2611 if (!discriminatorValues) {
2612 throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2613 }
2614 for (const value of discriminatorValues) {
2615 if (optionsMap.has(value)) {
2616 throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2617 }
2618 optionsMap.set(value, type);
2619 }
2620 }
2621 return new ZodDiscriminatedUnion({
2622 typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2623 discriminator,
2624 options,
2625 optionsMap,
2626 ...processCreateParams(params)
2627 });
2628 }
2629};
2630function mergeValues(a, b) {
2631 const aType = getParsedType(a);
2632 const bType = getParsedType(b);
2633 if (a === b) {
2634 return { valid: true, data: a };
2635 } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2636 const bKeys = util.objectKeys(b);
2637 const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2638 const newObj = { ...a, ...b };
2639 for (const key of sharedKeys) {
2640 const sharedValue = mergeValues(a[key], b[key]);
2641 if (!sharedValue.valid) {
2642 return { valid: false };
2643 }
2644 newObj[key] = sharedValue.data;
2645 }
2646 return { valid: true, data: newObj };
2647 } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2648 if (a.length !== b.length) {
2649 return { valid: false };
2650 }
2651 const newArray = [];
2652 for (let index = 0; index < a.length; index++) {
2653 const itemA = a[index];
2654 const itemB = b[index];
2655 const sharedValue = mergeValues(itemA, itemB);
2656 if (!sharedValue.valid) {
2657 return { valid: false };
2658 }
2659 newArray.push(sharedValue.data);
2660 }
2661 return { valid: true, data: newArray };
2662 } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
2663 return { valid: true, data: a };
2664 } else {
2665 return { valid: false };
2666 }
2667}
2668var ZodIntersection = class extends ZodType {
2669 _parse(input) {
2670 const { status, ctx } = this._processInputParams(input);
2671 const handleParsed = (parsedLeft, parsedRight) => {
2672 if (isAborted(parsedLeft) || isAborted(parsedRight)) {
2673 return INVALID;
2674 }
2675 const merged = mergeValues(parsedLeft.value, parsedRight.value);
2676 if (!merged.valid) {
2677 addIssueToContext(ctx, {
2678 code: ZodIssueCode.invalid_intersection_types
2679 });
2680 return INVALID;
2681 }
2682 if (isDirty(parsedLeft) || isDirty(parsedRight)) {
2683 status.dirty();
2684 }
2685 return { status: status.value, value: merged.data };
2686 };
2687 if (ctx.common.async) {
2688 return Promise.all([
2689 this._def.left._parseAsync({
2690 data: ctx.data,
2691 path: ctx.path,
2692 parent: ctx
2693 }),
2694 this._def.right._parseAsync({
2695 data: ctx.data,
2696 path: ctx.path,
2697 parent: ctx
2698 })
2699 ]).then(([left, right]) => handleParsed(left, right));
2700 } else {
2701 return handleParsed(this._def.left._parseSync({
2702 data: ctx.data,
2703 path: ctx.path,
2704 parent: ctx
2705 }), this._def.right._parseSync({
2706 data: ctx.data,
2707 path: ctx.path,
2708 parent: ctx
2709 }));
2710 }
2711 }
2712};
2713ZodIntersection.create = (left, right, params) => {
2714 return new ZodIntersection({
2715 left,
2716 right,
2717 typeName: ZodFirstPartyTypeKind.ZodIntersection,
2718 ...processCreateParams(params)
2719 });
2720};
2721var ZodTuple = class extends ZodType {
2722 _parse(input) {
2723 const { status, ctx } = this._processInputParams(input);
2724 if (ctx.parsedType !== ZodParsedType.array) {
2725 addIssueToContext(ctx, {
2726 code: ZodIssueCode.invalid_type,
2727 expected: ZodParsedType.array,
2728 received: ctx.parsedType
2729 });
2730 return INVALID;
2731 }
2732 if (ctx.data.length < this._def.items.length) {
2733 addIssueToContext(ctx, {
2734 code: ZodIssueCode.too_small,
2735 minimum: this._def.items.length,
2736 inclusive: true,
2737 exact: false,
2738 type: "array"
2739 });
2740 return INVALID;
2741 }
2742 const rest = this._def.rest;
2743 if (!rest && ctx.data.length > this._def.items.length) {
2744 addIssueToContext(ctx, {
2745 code: ZodIssueCode.too_big,
2746 maximum: this._def.items.length,
2747 inclusive: true,
2748 exact: false,
2749 type: "array"
2750 });
2751 status.dirty();
2752 }
2753 const items = ctx.data.map((item, itemIndex) => {
2754 const schema = this._def.items[itemIndex] || this._def.rest;
2755 if (!schema)
2756 return null;
2757 return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2758 }).filter((x) => !!x);
2759 if (ctx.common.async) {
2760 return Promise.all(items).then((results) => {
2761 return ParseStatus.mergeArray(status, results);
2762 });
2763 } else {
2764 return ParseStatus.mergeArray(status, items);
2765 }
2766 }
2767 get items() {
2768 return this._def.items;
2769 }
2770 rest(rest) {
2771 return new ZodTuple({
2772 ...this._def,
2773 rest
2774 });
2775 }
2776};
2777ZodTuple.create = (schemas, params) => {
2778 if (!Array.isArray(schemas)) {
2779 throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2780 }
2781 return new ZodTuple({
2782 items: schemas,
2783 typeName: ZodFirstPartyTypeKind.ZodTuple,
2784 rest: null,
2785 ...processCreateParams(params)
2786 });
2787};
2788var ZodRecord = class extends ZodType {
2789 get keySchema() {
2790 return this._def.keyType;
2791 }
2792 get valueSchema() {
2793 return this._def.valueType;
2794 }
2795 _parse(input) {
2796 const { status, ctx } = this._processInputParams(input);
2797 if (ctx.parsedType !== ZodParsedType.object) {
2798 addIssueToContext(ctx, {
2799 code: ZodIssueCode.invalid_type,
2800 expected: ZodParsedType.object,
2801 received: ctx.parsedType
2802 });
2803 return INVALID;
2804 }
2805 const pairs = [];
2806 const keyType = this._def.keyType;
2807 const valueType = this._def.valueType;
2808 for (const key in ctx.data) {
2809 pairs.push({
2810 key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2811 value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
2812 });
2813 }
2814 if (ctx.common.async) {
2815 return ParseStatus.mergeObjectAsync(status, pairs);
2816 } else {
2817 return ParseStatus.mergeObjectSync(status, pairs);
2818 }
2819 }
2820 get element() {
2821 return this._def.valueType;
2822 }
2823 static create(first, second, third) {
2824 if (second instanceof ZodType) {
2825 return new ZodRecord({
2826 keyType: first,
2827 valueType: second,
2828 typeName: ZodFirstPartyTypeKind.ZodRecord,
2829 ...processCreateParams(third)
2830 });
2831 }
2832 return new ZodRecord({
2833 keyType: ZodString.create(),
2834 valueType: first,
2835 typeName: ZodFirstPartyTypeKind.ZodRecord,
2836 ...processCreateParams(second)
2837 });
2838 }
2839};
2840var ZodMap = class extends ZodType {
2841 _parse(input) {
2842 const { status, ctx } = this._processInputParams(input);
2843 if (ctx.parsedType !== ZodParsedType.map) {
2844 addIssueToContext(ctx, {
2845 code: ZodIssueCode.invalid_type,
2846 expected: ZodParsedType.map,
2847 received: ctx.parsedType
2848 });
2849 return INVALID;
2850 }
2851 const keyType = this._def.keyType;
2852 const valueType = this._def.valueType;
2853 const pairs = [...ctx.data.entries()].map(([key, value], index) => {
2854 return {
2855 key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2856 value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
2857 };
2858 });
2859 if (ctx.common.async) {
2860 const finalMap = /* @__PURE__ */ new Map();
2861 return Promise.resolve().then(async () => {
2862 for (const pair of pairs) {
2863 const key = await pair.key;
2864 const value = await pair.value;
2865 if (key.status === "aborted" || value.status === "aborted") {
2866 return INVALID;
2867 }
2868 if (key.status === "dirty" || value.status === "dirty") {
2869 status.dirty();
2870 }
2871 finalMap.set(key.value, value.value);
2872 }
2873 return { status: status.value, value: finalMap };
2874 });
2875 } else {
2876 const finalMap = /* @__PURE__ */ new Map();
2877 for (const pair of pairs) {
2878 const key = pair.key;
2879 const value = pair.value;
2880 if (key.status === "aborted" || value.status === "aborted") {
2881 return INVALID;
2882 }
2883 if (key.status === "dirty" || value.status === "dirty") {
2884 status.dirty();
2885 }
2886 finalMap.set(key.value, value.value);
2887 }
2888 return { status: status.value, value: finalMap };
2889 }
2890 }
2891};
2892ZodMap.create = (keyType, valueType, params) => {
2893 return new ZodMap({
2894 valueType,
2895 keyType,
2896 typeName: ZodFirstPartyTypeKind.ZodMap,
2897 ...processCreateParams(params)
2898 });
2899};
2900var ZodSet = class extends ZodType {
2901 _parse(input) {
2902 const { status, ctx } = this._processInputParams(input);
2903 if (ctx.parsedType !== ZodParsedType.set) {
2904 addIssueToContext(ctx, {
2905 code: ZodIssueCode.invalid_type,
2906 expected: ZodParsedType.set,
2907 received: ctx.parsedType
2908 });
2909 return INVALID;
2910 }
2911 const def = this._def;
2912 if (def.minSize !== null) {
2913 if (ctx.data.size < def.minSize.value) {
2914 addIssueToContext(ctx, {
2915 code: ZodIssueCode.too_small,
2916 minimum: def.minSize.value,
2917 type: "set",
2918 inclusive: true,
2919 exact: false,
2920 message: def.minSize.message
2921 });
2922 status.dirty();
2923 }
2924 }
2925 if (def.maxSize !== null) {
2926 if (ctx.data.size > def.maxSize.value) {
2927 addIssueToContext(ctx, {
2928 code: ZodIssueCode.too_big,
2929 maximum: def.maxSize.value,
2930 type: "set",
2931 inclusive: true,
2932 exact: false,
2933 message: def.maxSize.message
2934 });
2935 status.dirty();
2936 }
2937 }
2938 const valueType = this._def.valueType;
2939 function finalizeSet(elements2) {
2940 const parsedSet = /* @__PURE__ */ new Set();
2941 for (const element of elements2) {
2942 if (element.status === "aborted")
2943 return INVALID;
2944 if (element.status === "dirty")
2945 status.dirty();
2946 parsedSet.add(element.value);
2947 }
2948 return { status: status.value, value: parsedSet };
2949 }
2950 const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2951 if (ctx.common.async) {
2952 return Promise.all(elements).then((elements2) => finalizeSet(elements2));
2953 } else {
2954 return finalizeSet(elements);
2955 }
2956 }
2957 min(minSize, message) {
2958 return new ZodSet({
2959 ...this._def,
2960 minSize: { value: minSize, message: errorUtil.toString(message) }
2961 });
2962 }
2963 max(maxSize, message) {
2964 return new ZodSet({
2965 ...this._def,
2966 maxSize: { value: maxSize, message: errorUtil.toString(message) }
2967 });
2968 }
2969 size(size, message) {
2970 return this.min(size, message).max(size, message);
2971 }
2972 nonempty(message) {
2973 return this.min(1, message);
2974 }
2975};
2976ZodSet.create = (valueType, params) => {
2977 return new ZodSet({
2978 valueType,
2979 minSize: null,
2980 maxSize: null,
2981 typeName: ZodFirstPartyTypeKind.ZodSet,
2982 ...processCreateParams(params)
2983 });
2984};
2985var ZodFunction = class extends ZodType {
2986 constructor() {
2987 super(...arguments);
2988 this.validate = this.implement;
2989 }
2990 _parse(input) {
2991 const { ctx } = this._processInputParams(input);
2992 if (ctx.parsedType !== ZodParsedType.function) {
2993 addIssueToContext(ctx, {
2994 code: ZodIssueCode.invalid_type,
2995 expected: ZodParsedType.function,
2996 received: ctx.parsedType
2997 });
2998 return INVALID;
2999 }
3000 function makeArgsIssue(args, error) {
3001 return makeIssue({
3002 data: args,
3003 path: ctx.path,
3004 errorMaps: [
3005 ctx.common.contextualErrorMap,
3006 ctx.schemaErrorMap,
3007 getErrorMap(),
3008 errorMap
3009 ].filter((x) => !!x),
3010 issueData: {
3011 code: ZodIssueCode.invalid_arguments,
3012 argumentsError: error
3013 }
3014 });
3015 }
3016 function makeReturnsIssue(returns, error) {
3017 return makeIssue({
3018 data: returns,
3019 path: ctx.path,
3020 errorMaps: [
3021 ctx.common.contextualErrorMap,
3022 ctx.schemaErrorMap,
3023 getErrorMap(),
3024 errorMap
3025 ].filter((x) => !!x),
3026 issueData: {
3027 code: ZodIssueCode.invalid_return_type,
3028 returnTypeError: error
3029 }
3030 });
3031 }
3032 const params = { errorMap: ctx.common.contextualErrorMap };
3033 const fn = ctx.data;
3034 if (this._def.returns instanceof ZodPromise) {
3035 return OK(async (...args) => {
3036 const error = new ZodError([]);
3037 const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3038 error.addIssue(makeArgsIssue(args, e));
3039 throw error;
3040 });
3041 const result = await fn(...parsedArgs);
3042 const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3043 error.addIssue(makeReturnsIssue(result, e));
3044 throw error;
3045 });
3046 return parsedReturns;
3047 });
3048 } else {
3049 return OK((...args) => {
3050 const parsedArgs = this._def.args.safeParse(args, params);
3051 if (!parsedArgs.success) {
3052 throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3053 }
3054 const result = fn(...parsedArgs.data);
3055 const parsedReturns = this._def.returns.safeParse(result, params);
3056 if (!parsedReturns.success) {
3057 throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3058 }
3059 return parsedReturns.data;
3060 });
3061 }
3062 }
3063 parameters() {
3064 return this._def.args;
3065 }
3066 returnType() {
3067 return this._def.returns;
3068 }
3069 args(...items) {
3070 return new ZodFunction({
3071 ...this._def,
3072 args: ZodTuple.create(items).rest(ZodUnknown.create())
3073 });
3074 }
3075 returns(returnType) {
3076 return new ZodFunction({
3077 ...this._def,
3078 returns: returnType
3079 });
3080 }
3081 implement(func) {
3082 const validatedFunc = this.parse(func);
3083 return validatedFunc;
3084 }
3085 strictImplement(func) {
3086 const validatedFunc = this.parse(func);
3087 return validatedFunc;
3088 }
3089 static create(args, returns, params) {
3090 return new ZodFunction({
3091 args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
3092 returns: returns || ZodUnknown.create(),
3093 typeName: ZodFirstPartyTypeKind.ZodFunction,
3094 ...processCreateParams(params)
3095 });
3096 }
3097};
3098var ZodLazy = class extends ZodType {
3099 get schema() {
3100 return this._def.getter();
3101 }
3102 _parse(input) {
3103 const { ctx } = this._processInputParams(input);
3104 const lazySchema = this._def.getter();
3105 return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3106 }
3107};
3108ZodLazy.create = (getter, params) => {
3109 return new ZodLazy({
3110 getter,
3111 typeName: ZodFirstPartyTypeKind.ZodLazy,
3112 ...processCreateParams(params)
3113 });
3114};
3115var ZodLiteral = class extends ZodType {
3116 _parse(input) {
3117 if (input.data !== this._def.value) {
3118 const ctx = this._getOrReturnCtx(input);
3119 addIssueToContext(ctx, {
3120 code: ZodIssueCode.invalid_literal,
3121 expected: this._def.value
3122 });
3123 return INVALID;
3124 }
3125 return { status: "valid", value: input.data };
3126 }
3127 get value() {
3128 return this._def.value;
3129 }
3130};
3131ZodLiteral.create = (value, params) => {
3132 return new ZodLiteral({
3133 value,
3134 typeName: ZodFirstPartyTypeKind.ZodLiteral,
3135 ...processCreateParams(params)
3136 });
3137};
3138function createZodEnum(values, params) {
3139 return new ZodEnum({
3140 values,
3141 typeName: ZodFirstPartyTypeKind.ZodEnum,
3142 ...processCreateParams(params)
3143 });
3144}
3145var ZodEnum = class extends ZodType {
3146 _parse(input) {
3147 if (typeof input.data !== "string") {
3148 const ctx = this._getOrReturnCtx(input);
3149 const expectedValues = this._def.values;
3150 addIssueToContext(ctx, {
3151 expected: util.joinValues(expectedValues),
3152 received: ctx.parsedType,
3153 code: ZodIssueCode.invalid_type
3154 });
3155 return INVALID;
3156 }
3157 if (this._def.values.indexOf(input.data) === -1) {
3158 const ctx = this._getOrReturnCtx(input);
3159 const expectedValues = this._def.values;
3160 addIssueToContext(ctx, {
3161 received: ctx.data,
3162 code: ZodIssueCode.invalid_enum_value,
3163 options: expectedValues
3164 });
3165 return INVALID;
3166 }
3167 return OK(input.data);
3168 }
3169 get options() {
3170 return this._def.values;
3171 }
3172 get enum() {
3173 const enumValues = {};
3174 for (const val of this._def.values) {
3175 enumValues[val] = val;
3176 }
3177 return enumValues;
3178 }
3179 get Values() {
3180 const enumValues = {};
3181 for (const val of this._def.values) {
3182 enumValues[val] = val;
3183 }
3184 return enumValues;
3185 }
3186 get Enum() {
3187 const enumValues = {};
3188 for (const val of this._def.values) {
3189 enumValues[val] = val;
3190 }
3191 return enumValues;
3192 }
3193};
3194ZodEnum.create = createZodEnum;
3195var ZodNativeEnum = class extends ZodType {
3196 _parse(input) {
3197 const nativeEnumValues = util.getValidEnumValues(this._def.values);
3198 const ctx = this._getOrReturnCtx(input);
3199 if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3200 const expectedValues = util.objectValues(nativeEnumValues);
3201 addIssueToContext(ctx, {
3202 expected: util.joinValues(expectedValues),
3203 received: ctx.parsedType,
3204 code: ZodIssueCode.invalid_type
3205 });
3206 return INVALID;
3207 }
3208 if (nativeEnumValues.indexOf(input.data) === -1) {
3209 const expectedValues = util.objectValues(nativeEnumValues);
3210 addIssueToContext(ctx, {
3211 received: ctx.data,
3212 code: ZodIssueCode.invalid_enum_value,
3213 options: expectedValues
3214 });
3215 return INVALID;
3216 }
3217 return OK(input.data);
3218 }
3219 get enum() {
3220 return this._def.values;
3221 }
3222};
3223ZodNativeEnum.create = (values, params) => {
3224 return new ZodNativeEnum({
3225 values,
3226 typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3227 ...processCreateParams(params)
3228 });
3229};
3230var ZodPromise = class extends ZodType {
3231 _parse(input) {
3232 const { ctx } = this._processInputParams(input);
3233 if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3234 addIssueToContext(ctx, {
3235 code: ZodIssueCode.invalid_type,
3236 expected: ZodParsedType.promise,
3237 received: ctx.parsedType
3238 });
3239 return INVALID;
3240 }
3241 const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3242 return OK(promisified.then((data) => {
3243 return this._def.type.parseAsync(data, {
3244 path: ctx.path,
3245 errorMap: ctx.common.contextualErrorMap
3246 });
3247 }));
3248 }
3249};
3250ZodPromise.create = (schema, params) => {
3251 return new ZodPromise({
3252 type: schema,
3253 typeName: ZodFirstPartyTypeKind.ZodPromise,
3254 ...processCreateParams(params)
3255 });
3256};
3257var ZodEffects = class extends ZodType {
3258 innerType() {
3259 return this._def.schema;
3260 }
3261 sourceType() {
3262 return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3263 }
3264 _parse(input) {
3265 const { status, ctx } = this._processInputParams(input);
3266 const effect = this._def.effect || null;
3267 if (effect.type === "preprocess") {
3268 const processed = effect.transform(ctx.data);
3269 if (ctx.common.async) {
3270 return Promise.resolve(processed).then((processed2) => {
3271 return this._def.schema._parseAsync({
3272 data: processed2,
3273 path: ctx.path,
3274 parent: ctx
3275 });
3276 });
3277 } else {
3278 return this._def.schema._parseSync({
3279 data: processed,
3280 path: ctx.path,
3281 parent: ctx
3282 });
3283 }
3284 }
3285 const checkCtx = {
3286 addIssue: (arg) => {
3287 addIssueToContext(ctx, arg);
3288 if (arg.fatal) {
3289 status.abort();
3290 } else {
3291 status.dirty();
3292 }
3293 },
3294 get path() {
3295 return ctx.path;
3296 }
3297 };
3298 checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3299 if (effect.type === "refinement") {
3300 const executeRefinement = (acc) => {
3301 const result = effect.refinement(acc, checkCtx);
3302 if (ctx.common.async) {
3303 return Promise.resolve(result);
3304 }
3305 if (result instanceof Promise) {
3306 throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3307 }
3308 return acc;
3309 };
3310 if (ctx.common.async === false) {
3311 const inner = this._def.schema._parseSync({
3312 data: ctx.data,
3313 path: ctx.path,
3314 parent: ctx
3315 });
3316 if (inner.status === "aborted")
3317 return INVALID;
3318 if (inner.status === "dirty")
3319 status.dirty();
3320 executeRefinement(inner.value);
3321 return { status: status.value, value: inner.value };
3322 } else {
3323 return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3324 if (inner.status === "aborted")
3325 return INVALID;
3326 if (inner.status === "dirty")
3327 status.dirty();
3328 return executeRefinement(inner.value).then(() => {
3329 return { status: status.value, value: inner.value };
3330 });
3331 });
3332 }
3333 }
3334 if (effect.type === "transform") {
3335 if (ctx.common.async === false) {
3336 const base = this._def.schema._parseSync({
3337 data: ctx.data,
3338 path: ctx.path,
3339 parent: ctx
3340 });
3341 if (!isValid(base))
3342 return base;
3343 const result = effect.transform(base.value, checkCtx);
3344 if (result instanceof Promise) {
3345 throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3346 }
3347 return { status: status.value, value: result };
3348 } else {
3349 return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3350 if (!isValid(base))
3351 return base;
3352 return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3353 });
3354 }
3355 }
3356 util.assertNever(effect);
3357 }
3358};
3359ZodEffects.create = (schema, effect, params) => {
3360 return new ZodEffects({
3361 schema,
3362 typeName: ZodFirstPartyTypeKind.ZodEffects,
3363 effect,
3364 ...processCreateParams(params)
3365 });
3366};
3367ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3368 return new ZodEffects({
3369 schema,
3370 effect: { type: "preprocess", transform: preprocess },
3371 typeName: ZodFirstPartyTypeKind.ZodEffects,
3372 ...processCreateParams(params)
3373 });
3374};
3375var ZodOptional = class extends ZodType {
3376 _parse(input) {
3377 const parsedType = this._getType(input);
3378 if (parsedType === ZodParsedType.undefined) {
3379 return OK(void 0);
3380 }
3381 return this._def.innerType._parse(input);
3382 }
3383 unwrap() {
3384 return this._def.innerType;
3385 }
3386};
3387ZodOptional.create = (type, params) => {
3388 return new ZodOptional({
3389 innerType: type,
3390 typeName: ZodFirstPartyTypeKind.ZodOptional,
3391 ...processCreateParams(params)
3392 });
3393};
3394var ZodNullable = class extends ZodType {
3395 _parse(input) {
3396 const parsedType = this._getType(input);
3397 if (parsedType === ZodParsedType.null) {
3398 return OK(null);
3399 }
3400 return this._def.innerType._parse(input);
3401 }
3402 unwrap() {
3403 return this._def.innerType;
3404 }
3405};
3406ZodNullable.create = (type, params) => {
3407 return new ZodNullable({
3408 innerType: type,
3409 typeName: ZodFirstPartyTypeKind.ZodNullable,
3410 ...processCreateParams(params)
3411 });
3412};
3413var ZodDefault = class extends ZodType {
3414 _parse(input) {
3415 const { ctx } = this._processInputParams(input);
3416 let data = ctx.data;
3417 if (ctx.parsedType === ZodParsedType.undefined) {
3418 data = this._def.defaultValue();
3419 }
3420 return this._def.innerType._parse({
3421 data,
3422 path: ctx.path,
3423 parent: ctx
3424 });
3425 }
3426 removeDefault() {
3427 return this._def.innerType;
3428 }
3429};
3430ZodDefault.create = (type, params) => {
3431 return new ZodDefault({
3432 innerType: type,
3433 typeName: ZodFirstPartyTypeKind.ZodDefault,
3434 defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3435 ...processCreateParams(params)
3436 });
3437};
3438var ZodCatch = class extends ZodType {
3439 _parse(input) {
3440 const { ctx } = this._processInputParams(input);
3441 const result = this._def.innerType._parse({
3442 data: ctx.data,
3443 path: ctx.path,
3444 parent: ctx
3445 });
3446 if (isAsync(result)) {
3447 return result.then((result2) => {
3448 return {
3449 status: "valid",
3450 value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3451 };
3452 });
3453 } else {
3454 return {
3455 status: "valid",
3456 value: result.status === "valid" ? result.value : this._def.defaultValue()
3457 };
3458 }
3459 }
3460 removeDefault() {
3461 return this._def.innerType;
3462 }
3463};
3464ZodCatch.create = (type, params) => {
3465 return new ZodCatch({
3466 innerType: type,
3467 typeName: ZodFirstPartyTypeKind.ZodCatch,
3468 defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3469 ...processCreateParams(params)
3470 });
3471};
3472var ZodNaN = class extends ZodType {
3473 _parse(input) {
3474 const parsedType = this._getType(input);
3475 if (parsedType !== ZodParsedType.nan) {
3476 const ctx = this._getOrReturnCtx(input);
3477 addIssueToContext(ctx, {
3478 code: ZodIssueCode.invalid_type,
3479 expected: ZodParsedType.nan,
3480 received: ctx.parsedType
3481 });
3482 return INVALID;
3483 }
3484 return { status: "valid", value: input.data };
3485 }
3486};
3487ZodNaN.create = (params) => {
3488 return new ZodNaN({
3489 typeName: ZodFirstPartyTypeKind.ZodNaN,
3490 ...processCreateParams(params)
3491 });
3492};
3493var BRAND = Symbol("zod_brand");
3494var ZodBranded = class extends ZodType {
3495 _parse(input) {
3496 const { ctx } = this._processInputParams(input);
3497 const data = ctx.data;
3498 return this._def.type._parse({
3499 data,
3500 path: ctx.path,
3501 parent: ctx
3502 });
3503 }
3504 unwrap() {
3505 return this._def.type;
3506 }
3507};
3508var ZodPipeline = class extends ZodType {
3509 _parse(input) {
3510 const { status, ctx } = this._processInputParams(input);
3511 if (ctx.common.async) {
3512 const handleAsync = async () => {
3513 const inResult = await this._def.in._parseAsync({
3514 data: ctx.data,
3515 path: ctx.path,
3516 parent: ctx
3517 });
3518 if (inResult.status === "aborted")
3519 return INVALID;
3520 if (inResult.status === "dirty") {
3521 status.dirty();
3522 return DIRTY(inResult.value);
3523 } else {
3524 return this._def.out._parseAsync({
3525 data: inResult.value,
3526 path: ctx.path,
3527 parent: ctx
3528 });
3529 }
3530 };
3531 return handleAsync();
3532 } else {
3533 const inResult = this._def.in._parseSync({
3534 data: ctx.data,
3535 path: ctx.path,
3536 parent: ctx
3537 });
3538 if (inResult.status === "aborted")
3539 return INVALID;
3540 if (inResult.status === "dirty") {
3541 status.dirty();
3542 return {
3543 status: "dirty",
3544 value: inResult.value
3545 };
3546 } else {
3547 return this._def.out._parseSync({
3548 data: inResult.value,
3549 path: ctx.path,
3550 parent: ctx
3551 });
3552 }
3553 }
3554 }
3555 static create(a, b) {
3556 return new ZodPipeline({
3557 in: a,
3558 out: b,
3559 typeName: ZodFirstPartyTypeKind.ZodPipeline
3560 });
3561 }
3562};
3563var custom = (check, params = {}, fatal) => {
3564 if (check)
3565 return ZodAny.create().superRefine((data, ctx) => {
3566 if (!check(data)) {
3567 const p = typeof params === "function" ? params(data) : params;
3568 const p2 = typeof p === "string" ? { message: p } : p;
3569 ctx.addIssue({ code: "custom", ...p2, fatal });
3570 }
3571 });
3572 return ZodAny.create();
3573};
3574var late = {
3575 object: ZodObject.lazycreate
3576};
3577var ZodFirstPartyTypeKind;
3578(function(ZodFirstPartyTypeKind2) {
3579 ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
3580 ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
3581 ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
3582 ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
3583 ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
3584 ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
3585 ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
3586 ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
3587 ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
3588 ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
3589 ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
3590 ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
3591 ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
3592 ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
3593 ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
3594 ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
3595 ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3596 ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
3597 ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
3598 ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
3599 ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
3600 ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
3601 ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
3602 ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
3603 ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
3604 ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
3605 ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
3606 ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
3607 ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
3608 ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
3609 ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
3610 ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
3611 ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3612 ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3613 ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3614})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3615var instanceOfType = (cls, params = {
3616 message: `Input not instance of ${cls.name}`
3617}) => custom((data) => data instanceof cls, params, true);
3618var stringType = ZodString.create;
3619var numberType = ZodNumber.create;
3620var nanType = ZodNaN.create;
3621var bigIntType = ZodBigInt.create;
3622var booleanType = ZodBoolean.create;
3623var dateType = ZodDate.create;
3624var symbolType = ZodSymbol.create;
3625var undefinedType = ZodUndefined.create;
3626var nullType = ZodNull.create;
3627var anyType = ZodAny.create;
3628var unknownType = ZodUnknown.create;
3629var neverType = ZodNever.create;
3630var voidType = ZodVoid.create;
3631var arrayType = ZodArray.create;
3632var objectType = ZodObject.create;
3633var strictObjectType = ZodObject.strictCreate;
3634var unionType = ZodUnion.create;
3635var discriminatedUnionType = ZodDiscriminatedUnion.create;
3636var intersectionType = ZodIntersection.create;
3637var tupleType = ZodTuple.create;
3638var recordType = ZodRecord.create;
3639var mapType = ZodMap.create;
3640var setType = ZodSet.create;
3641var functionType = ZodFunction.create;
3642var lazyType = ZodLazy.create;
3643var literalType = ZodLiteral.create;
3644var enumType = ZodEnum.create;
3645var nativeEnumType = ZodNativeEnum.create;
3646var promiseType = ZodPromise.create;
3647var effectsType = ZodEffects.create;
3648var optionalType = ZodOptional.create;
3649var nullableType = ZodNullable.create;
3650var preprocessType = ZodEffects.createWithPreprocess;
3651var pipelineType = ZodPipeline.create;
3652var ostring = () => stringType().optional();
3653var onumber = () => numberType().optional();
3654var oboolean = () => booleanType().optional();
3655var coerce = {
3656 string: (arg) => ZodString.create({ ...arg, coerce: true }),
3657 number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3658 boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
3659 bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3660 date: (arg) => ZodDate.create({ ...arg, coerce: true })
3661};
3662var NEVER = INVALID;
3663var mod = /* @__PURE__ */ Object.freeze({
3664 __proto__: null,
3665 defaultErrorMap: errorMap,
3666 setErrorMap,
3667 getErrorMap,
3668 makeIssue,
3669 EMPTY_PATH,
3670 addIssueToContext,
3671 ParseStatus,
3672 INVALID,
3673 DIRTY,
3674 OK,
3675 isAborted,
3676 isDirty,
3677 isValid,
3678 isAsync,
3679 get util() {
3680 return util;
3681 },
3682 ZodParsedType,
3683 getParsedType,
3684 ZodType,
3685 ZodString,
3686 ZodNumber,
3687 ZodBigInt,
3688 ZodBoolean,
3689 ZodDate,
3690 ZodSymbol,
3691 ZodUndefined,
3692 ZodNull,
3693 ZodAny,
3694 ZodUnknown,
3695 ZodNever,
3696 ZodVoid,
3697 ZodArray,
3698 get objectUtil() {
3699 return objectUtil;
3700 },
3701 ZodObject,
3702 ZodUnion,
3703 ZodDiscriminatedUnion,
3704 ZodIntersection,
3705 ZodTuple,
3706 ZodRecord,
3707 ZodMap,
3708 ZodSet,
3709 ZodFunction,
3710 ZodLazy,
3711 ZodLiteral,
3712 ZodEnum,
3713 ZodNativeEnum,
3714 ZodPromise,
3715 ZodEffects,
3716 ZodTransformer: ZodEffects,
3717 ZodOptional,
3718 ZodNullable,
3719 ZodDefault,
3720 ZodCatch,
3721 ZodNaN,
3722 BRAND,
3723 ZodBranded,
3724 ZodPipeline,
3725 custom,
3726 Schema: ZodType,
3727 ZodSchema: ZodType,
3728 late,
3729 get ZodFirstPartyTypeKind() {
3730 return ZodFirstPartyTypeKind;
3731 },
3732 coerce,
3733 any: anyType,
3734 array: arrayType,
3735 bigint: bigIntType,
3736 boolean: booleanType,
3737 date: dateType,
3738 discriminatedUnion: discriminatedUnionType,
3739 effect: effectsType,
3740 "enum": enumType,
3741 "function": functionType,
3742 "instanceof": instanceOfType,
3743 intersection: intersectionType,
3744 lazy: lazyType,
3745 literal: literalType,
3746 map: mapType,
3747 nan: nanType,
3748 nativeEnum: nativeEnumType,
3749 never: neverType,
3750 "null": nullType,
3751 nullable: nullableType,
3752 number: numberType,
3753 object: objectType,
3754 oboolean,
3755 onumber,
3756 optional: optionalType,
3757 ostring,
3758 pipeline: pipelineType,
3759 preprocess: preprocessType,
3760 promise: promiseType,
3761 record: recordType,
3762 set: setType,
3763 strictObject: strictObjectType,
3764 string: stringType,
3765 symbol: symbolType,
3766 transformer: effectsType,
3767 tuple: tupleType,
3768 "undefined": undefinedType,
3769 union: unionType,
3770 unknown: unknownType,
3771 "void": voidType,
3772 NEVER,
3773 ZodIssueCode,
3774 quotelessJson,
3775 ZodError
3776});
3777
3778// ../../node_modules/.pnpm/zod-validation-error@0.3.0_zod@3.20.2/node_modules/zod-validation-error/dist/esm/utils/joinPath.js
3779function joinPath(arr) {
3780 return arr.reduce((acc, value) => {
3781 if (typeof value === "number") {
3782 return acc + "[" + value + "]";
3783 }
3784 const separator = acc === "" ? "" : ".";
3785 return acc + separator + value;
3786 }, "");
3787}
3788
3789// ../../node_modules/.pnpm/zod-validation-error@0.3.0_zod@3.20.2/node_modules/zod-validation-error/dist/esm/ValidationError.js
3790var ValidationError = class extends Error {
3791 constructor(message, options) {
3792 super(message);
3793 __publicField(this, "details");
3794 __publicField(this, "type");
3795 this.details = options.details;
3796 this.type = "ZodValidationError";
3797 }
3798};
3799function fromZodError(zodError, options = {}) {
3800 const { maxIssuesInMessage = 99, issueSeparator = "; ", prefixSeparator = ": ", prefix = "Validation error" } = options;
3801 const reason = zodError.errors.slice(0, maxIssuesInMessage).map((issue) => {
3802 const { message: message2, path } = issue;
3803 if (path.length > 0) {
3804 return `${message2} at "${joinPath(path)}"`;
3805 }
3806 return message2;
3807 }).join(issueSeparator);
3808 const message = reason ? [prefix, reason].join(prefixSeparator) : prefix;
3809 return new ValidationError(message, {
3810 details: zodError.errors
3811 });
3812}
3813
3814// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/errors.js
3815var LuxonError = class extends Error {
3816};
3817var InvalidDateTimeError = class extends LuxonError {
3818 constructor(reason) {
3819 super(`Invalid DateTime: ${reason.toMessage()}`);
3820 }
3821};
3822var InvalidIntervalError = class extends LuxonError {
3823 constructor(reason) {
3824 super(`Invalid Interval: ${reason.toMessage()}`);
3825 }
3826};
3827var InvalidDurationError = class extends LuxonError {
3828 constructor(reason) {
3829 super(`Invalid Duration: ${reason.toMessage()}`);
3830 }
3831};
3832var ConflictingSpecificationError = class extends LuxonError {
3833};
3834var InvalidUnitError = class extends LuxonError {
3835 constructor(unit) {
3836 super(`Invalid unit ${unit}`);
3837 }
3838};
3839var InvalidArgumentError = class extends LuxonError {
3840};
3841var ZoneIsAbstractError = class extends LuxonError {
3842 constructor() {
3843 super("Zone is an abstract class");
3844 }
3845};
3846
3847// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/formats.js
3848var n = "numeric";
3849var s = "short";
3850var l = "long";
3851var DATE_SHORT = {
3852 year: n,
3853 month: n,
3854 day: n
3855};
3856var DATE_MED = {
3857 year: n,
3858 month: s,
3859 day: n
3860};
3861var DATE_MED_WITH_WEEKDAY = {
3862 year: n,
3863 month: s,
3864 day: n,
3865 weekday: s
3866};
3867var DATE_FULL = {
3868 year: n,
3869 month: l,
3870 day: n
3871};
3872var DATE_HUGE = {
3873 year: n,
3874 month: l,
3875 day: n,
3876 weekday: l
3877};
3878var TIME_SIMPLE = {
3879 hour: n,
3880 minute: n
3881};
3882var TIME_WITH_SECONDS = {
3883 hour: n,
3884 minute: n,
3885 second: n
3886};
3887var TIME_WITH_SHORT_OFFSET = {
3888 hour: n,
3889 minute: n,
3890 second: n,
3891 timeZoneName: s
3892};
3893var TIME_WITH_LONG_OFFSET = {
3894 hour: n,
3895 minute: n,
3896 second: n,
3897 timeZoneName: l
3898};
3899var TIME_24_SIMPLE = {
3900 hour: n,
3901 minute: n,
3902 hourCycle: "h23"
3903};
3904var TIME_24_WITH_SECONDS = {
3905 hour: n,
3906 minute: n,
3907 second: n,
3908 hourCycle: "h23"
3909};
3910var TIME_24_WITH_SHORT_OFFSET = {
3911 hour: n,
3912 minute: n,
3913 second: n,
3914 hourCycle: "h23",
3915 timeZoneName: s
3916};
3917var TIME_24_WITH_LONG_OFFSET = {
3918 hour: n,
3919 minute: n,
3920 second: n,
3921 hourCycle: "h23",
3922 timeZoneName: l
3923};
3924var DATETIME_SHORT = {
3925 year: n,
3926 month: n,
3927 day: n,
3928 hour: n,
3929 minute: n
3930};
3931var DATETIME_SHORT_WITH_SECONDS = {
3932 year: n,
3933 month: n,
3934 day: n,
3935 hour: n,
3936 minute: n,
3937 second: n
3938};
3939var DATETIME_MED = {
3940 year: n,
3941 month: s,
3942 day: n,
3943 hour: n,
3944 minute: n
3945};
3946var DATETIME_MED_WITH_SECONDS = {
3947 year: n,
3948 month: s,
3949 day: n,
3950 hour: n,
3951 minute: n,
3952 second: n
3953};
3954var DATETIME_MED_WITH_WEEKDAY = {
3955 year: n,
3956 month: s,
3957 day: n,
3958 weekday: s,
3959 hour: n,
3960 minute: n
3961};
3962var DATETIME_FULL = {
3963 year: n,
3964 month: l,
3965 day: n,
3966 hour: n,
3967 minute: n,
3968 timeZoneName: s
3969};
3970var DATETIME_FULL_WITH_SECONDS = {
3971 year: n,
3972 month: l,
3973 day: n,
3974 hour: n,
3975 minute: n,
3976 second: n,
3977 timeZoneName: s
3978};
3979var DATETIME_HUGE = {
3980 year: n,
3981 month: l,
3982 day: n,
3983 weekday: l,
3984 hour: n,
3985 minute: n,
3986 timeZoneName: l
3987};
3988var DATETIME_HUGE_WITH_SECONDS = {
3989 year: n,
3990 month: l,
3991 day: n,
3992 weekday: l,
3993 hour: n,
3994 minute: n,
3995 second: n,
3996 timeZoneName: l
3997};
3998
3999// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zone.js
4000var Zone = class {
4001 get type() {
4002 throw new ZoneIsAbstractError();
4003 }
4004 get name() {
4005 throw new ZoneIsAbstractError();
4006 }
4007 get ianaName() {
4008 return this.name;
4009 }
4010 get isUniversal() {
4011 throw new ZoneIsAbstractError();
4012 }
4013 offsetName(ts, opts) {
4014 throw new ZoneIsAbstractError();
4015 }
4016 formatOffset(ts, format) {
4017 throw new ZoneIsAbstractError();
4018 }
4019 offset(ts) {
4020 throw new ZoneIsAbstractError();
4021 }
4022 equals(otherZone) {
4023 throw new ZoneIsAbstractError();
4024 }
4025 get isValid() {
4026 throw new ZoneIsAbstractError();
4027 }
4028};
4029
4030// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/systemZone.js
4031var singleton = null;
4032var SystemZone = class extends Zone {
4033 static get instance() {
4034 if (singleton === null) {
4035 singleton = new SystemZone();
4036 }
4037 return singleton;
4038 }
4039 get type() {
4040 return "system";
4041 }
4042 get name() {
4043 return new Intl.DateTimeFormat().resolvedOptions().timeZone;
4044 }
4045 get isUniversal() {
4046 return false;
4047 }
4048 offsetName(ts, { format, locale }) {
4049 return parseZoneInfo(ts, format, locale);
4050 }
4051 formatOffset(ts, format) {
4052 return formatOffset(this.offset(ts), format);
4053 }
4054 offset(ts) {
4055 return -new Date(ts).getTimezoneOffset();
4056 }
4057 equals(otherZone) {
4058 return otherZone.type === "system";
4059 }
4060 get isValid() {
4061 return true;
4062 }
4063};
4064
4065// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/IANAZone.js
4066var dtfCache = {};
4067function makeDTF(zone) {
4068 if (!dtfCache[zone]) {
4069 dtfCache[zone] = new Intl.DateTimeFormat("en-US", {
4070 hour12: false,
4071 timeZone: zone,
4072 year: "numeric",
4073 month: "2-digit",
4074 day: "2-digit",
4075 hour: "2-digit",
4076 minute: "2-digit",
4077 second: "2-digit",
4078 era: "short"
4079 });
4080 }
4081 return dtfCache[zone];
4082}
4083var typeToPos = {
4084 year: 0,
4085 month: 1,
4086 day: 2,
4087 era: 3,
4088 hour: 4,
4089 minute: 5,
4090 second: 6
4091};
4092function hackyOffset(dtf, date) {
4093 const formatted = dtf.format(date).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
4094 return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
4095}
4096function partsOffset(dtf, date) {
4097 const formatted = dtf.formatToParts(date);
4098 const filled = [];
4099 for (let i = 0; i < formatted.length; i++) {
4100 const { type, value } = formatted[i];
4101 const pos = typeToPos[type];
4102 if (type === "era") {
4103 filled[pos] = value;
4104 } else if (!isUndefined(pos)) {
4105 filled[pos] = parseInt(value, 10);
4106 }
4107 }
4108 return filled;
4109}
4110var ianaZoneCache = {};
4111var IANAZone = class extends Zone {
4112 static create(name) {
4113 if (!ianaZoneCache[name]) {
4114 ianaZoneCache[name] = new IANAZone(name);
4115 }
4116 return ianaZoneCache[name];
4117 }
4118 static resetCache() {
4119 ianaZoneCache = {};
4120 dtfCache = {};
4121 }
4122 static isValidSpecifier(s2) {
4123 return this.isValidZone(s2);
4124 }
4125 static isValidZone(zone) {
4126 if (!zone) {
4127 return false;
4128 }
4129 try {
4130 new Intl.DateTimeFormat("en-US", { timeZone: zone }).format();
4131 return true;
4132 } catch (e) {
4133 return false;
4134 }
4135 }
4136 constructor(name) {
4137 super();
4138 this.zoneName = name;
4139 this.valid = IANAZone.isValidZone(name);
4140 }
4141 get type() {
4142 return "iana";
4143 }
4144 get name() {
4145 return this.zoneName;
4146 }
4147 get isUniversal() {
4148 return false;
4149 }
4150 offsetName(ts, { format, locale }) {
4151 return parseZoneInfo(ts, format, locale, this.name);
4152 }
4153 formatOffset(ts, format) {
4154 return formatOffset(this.offset(ts), format);
4155 }
4156 offset(ts) {
4157 const date = new Date(ts);
4158 if (isNaN(date))
4159 return NaN;
4160 const dtf = makeDTF(this.name);
4161 let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date);
4162 if (adOrBc === "BC") {
4163 year = -Math.abs(year) + 1;
4164 }
4165 const adjustedHour = hour === 24 ? 0 : hour;
4166 const asUTC = objToLocalTS({
4167 year,
4168 month,
4169 day,
4170 hour: adjustedHour,
4171 minute,
4172 second,
4173 millisecond: 0
4174 });
4175 let asTS = +date;
4176 const over = asTS % 1e3;
4177 asTS -= over >= 0 ? over : 1e3 + over;
4178 return (asUTC - asTS) / (60 * 1e3);
4179 }
4180 equals(otherZone) {
4181 return otherZone.type === "iana" && otherZone.name === this.name;
4182 }
4183 get isValid() {
4184 return this.valid;
4185 }
4186};
4187
4188// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/locale.js
4189var intlLFCache = {};
4190function getCachedLF(locString, opts = {}) {
4191 const key = JSON.stringify([locString, opts]);
4192 let dtf = intlLFCache[key];
4193 if (!dtf) {
4194 dtf = new Intl.ListFormat(locString, opts);
4195 intlLFCache[key] = dtf;
4196 }
4197 return dtf;
4198}
4199var intlDTCache = {};
4200function getCachedDTF(locString, opts = {}) {
4201 const key = JSON.stringify([locString, opts]);
4202 let dtf = intlDTCache[key];
4203 if (!dtf) {
4204 dtf = new Intl.DateTimeFormat(locString, opts);
4205 intlDTCache[key] = dtf;
4206 }
4207 return dtf;
4208}
4209var intlNumCache = {};
4210function getCachedINF(locString, opts = {}) {
4211 const key = JSON.stringify([locString, opts]);
4212 let inf = intlNumCache[key];
4213 if (!inf) {
4214 inf = new Intl.NumberFormat(locString, opts);
4215 intlNumCache[key] = inf;
4216 }
4217 return inf;
4218}
4219var intlRelCache = {};
4220function getCachedRTF(locString, opts = {}) {
4221 const { base, ...cacheKeyOpts } = opts;
4222 const key = JSON.stringify([locString, cacheKeyOpts]);
4223 let inf = intlRelCache[key];
4224 if (!inf) {
4225 inf = new Intl.RelativeTimeFormat(locString, opts);
4226 intlRelCache[key] = inf;
4227 }
4228 return inf;
4229}
4230var sysLocaleCache = null;
4231function systemLocale() {
4232 if (sysLocaleCache) {
4233 return sysLocaleCache;
4234 } else {
4235 sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
4236 return sysLocaleCache;
4237 }
4238}
4239function parseLocaleString(localeStr) {
4240 const xIndex = localeStr.indexOf("-x-");
4241 if (xIndex !== -1) {
4242 localeStr = localeStr.substring(0, xIndex);
4243 }
4244 const uIndex = localeStr.indexOf("-u-");
4245 if (uIndex === -1) {
4246 return [localeStr];
4247 } else {
4248 let options;
4249 let selectedStr;
4250 try {
4251 options = getCachedDTF(localeStr).resolvedOptions();
4252 selectedStr = localeStr;
4253 } catch (e) {
4254 const smaller = localeStr.substring(0, uIndex);
4255 options = getCachedDTF(smaller).resolvedOptions();
4256 selectedStr = smaller;
4257 }
4258 const { numberingSystem, calendar } = options;
4259 return [selectedStr, numberingSystem, calendar];
4260 }
4261}
4262function intlConfigString(localeStr, numberingSystem, outputCalendar) {
4263 if (outputCalendar || numberingSystem) {
4264 if (!localeStr.includes("-u-")) {
4265 localeStr += "-u";
4266 }
4267 if (outputCalendar) {
4268 localeStr += `-ca-${outputCalendar}`;
4269 }
4270 if (numberingSystem) {
4271 localeStr += `-nu-${numberingSystem}`;
4272 }
4273 return localeStr;
4274 } else {
4275 return localeStr;
4276 }
4277}
4278function mapMonths(f) {
4279 const ms = [];
4280 for (let i = 1; i <= 12; i++) {
4281 const dt = DateTime.utc(2016, i, 1);
4282 ms.push(f(dt));
4283 }
4284 return ms;
4285}
4286function mapWeekdays(f) {
4287 const ms = [];
4288 for (let i = 1; i <= 7; i++) {
4289 const dt = DateTime.utc(2016, 11, 13 + i);
4290 ms.push(f(dt));
4291 }
4292 return ms;
4293}
4294function listStuff(loc, length, defaultOK, englishFn, intlFn) {
4295 const mode = loc.listingMode(defaultOK);
4296 if (mode === "error") {
4297 return null;
4298 } else if (mode === "en") {
4299 return englishFn(length);
4300 } else {
4301 return intlFn(length);
4302 }
4303}
4304function supportsFastNumbers(loc) {
4305 if (loc.numberingSystem && loc.numberingSystem !== "latn") {
4306 return false;
4307 } else {
4308 return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn";
4309 }
4310}
4311var PolyNumberFormatter = class {
4312 constructor(intl, forceSimple, opts) {
4313 this.padTo = opts.padTo || 0;
4314 this.floor = opts.floor || false;
4315 const { padTo, floor, ...otherOpts } = opts;
4316 if (!forceSimple || Object.keys(otherOpts).length > 0) {
4317 const intlOpts = { useGrouping: false, ...opts };
4318 if (opts.padTo > 0)
4319 intlOpts.minimumIntegerDigits = opts.padTo;
4320 this.inf = getCachedINF(intl, intlOpts);
4321 }
4322 }
4323 format(i) {
4324 if (this.inf) {
4325 const fixed = this.floor ? Math.floor(i) : i;
4326 return this.inf.format(fixed);
4327 } else {
4328 const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);
4329 return padStart(fixed, this.padTo);
4330 }
4331 }
4332};
4333var PolyDateFormatter = class {
4334 constructor(dt, intl, opts) {
4335 this.opts = opts;
4336 let z = void 0;
4337 if (dt.zone.isUniversal) {
4338 const gmtOffset = -1 * (dt.offset / 60);
4339 const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
4340 if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
4341 z = offsetZ;
4342 this.dt = dt;
4343 } else {
4344 z = "UTC";
4345 if (opts.timeZoneName) {
4346 this.dt = dt;
4347 } else {
4348 this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1e3);
4349 }
4350 }
4351 } else if (dt.zone.type === "system") {
4352 this.dt = dt;
4353 } else {
4354 this.dt = dt;
4355 z = dt.zone.name;
4356 }
4357 const intlOpts = { ...this.opts };
4358 intlOpts.timeZone = intlOpts.timeZone || z;
4359 this.dtf = getCachedDTF(intl, intlOpts);
4360 }
4361 format() {
4362 return this.dtf.format(this.dt.toJSDate());
4363 }
4364 formatToParts() {
4365 return this.dtf.formatToParts(this.dt.toJSDate());
4366 }
4367 resolvedOptions() {
4368 return this.dtf.resolvedOptions();
4369 }
4370};
4371var PolyRelFormatter = class {
4372 constructor(intl, isEnglish, opts) {
4373 this.opts = { style: "long", ...opts };
4374 if (!isEnglish && hasRelative()) {
4375 this.rtf = getCachedRTF(intl, opts);
4376 }
4377 }
4378 format(count, unit) {
4379 if (this.rtf) {
4380 return this.rtf.format(count, unit);
4381 } else {
4382 return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long");
4383 }
4384 }
4385 formatToParts(count, unit) {
4386 if (this.rtf) {
4387 return this.rtf.formatToParts(count, unit);
4388 } else {
4389 return [];
4390 }
4391 }
4392};
4393var Locale = class {
4394 static fromOpts(opts) {
4395 return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
4396 }
4397 static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {
4398 const specifiedLocale = locale || Settings.defaultLocale;
4399 const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
4400 const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
4401 const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
4402 return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
4403 }
4404 static resetCache() {
4405 sysLocaleCache = null;
4406 intlDTCache = {};
4407 intlNumCache = {};
4408 intlRelCache = {};
4409 }
4410 static fromObject({ locale, numberingSystem, outputCalendar } = {}) {
4411 return Locale.create(locale, numberingSystem, outputCalendar);
4412 }
4413 constructor(locale, numbering, outputCalendar, specifiedLocale) {
4414 const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
4415 this.locale = parsedLocale;
4416 this.numberingSystem = numbering || parsedNumberingSystem || null;
4417 this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
4418 this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
4419 this.weekdaysCache = { format: {}, standalone: {} };
4420 this.monthsCache = { format: {}, standalone: {} };
4421 this.meridiemCache = null;
4422 this.eraCache = {};
4423 this.specifiedLocale = specifiedLocale;
4424 this.fastNumbersCached = null;
4425 }
4426 get fastNumbers() {
4427 if (this.fastNumbersCached == null) {
4428 this.fastNumbersCached = supportsFastNumbers(this);
4429 }
4430 return this.fastNumbersCached;
4431 }
4432 listingMode() {
4433 const isActuallyEn = this.isEnglish();
4434 const hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
4435 return isActuallyEn && hasNoWeirdness ? "en" : "intl";
4436 }
4437 clone(alts) {
4438 if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
4439 return this;
4440 } else {
4441 return Locale.create(
4442 alts.locale || this.specifiedLocale,
4443 alts.numberingSystem || this.numberingSystem,
4444 alts.outputCalendar || this.outputCalendar,
4445 alts.defaultToEN || false
4446 );
4447 }
4448 }
4449 redefaultToEN(alts = {}) {
4450 return this.clone({ ...alts, defaultToEN: true });
4451 }
4452 redefaultToSystem(alts = {}) {
4453 return this.clone({ ...alts, defaultToEN: false });
4454 }
4455 months(length, format = false, defaultOK = true) {
4456 return listStuff(this, length, defaultOK, months, () => {
4457 const intl = format ? { month: length, day: "numeric" } : { month: length }, formatStr = format ? "format" : "standalone";
4458 if (!this.monthsCache[formatStr][length]) {
4459 this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
4460 }
4461 return this.monthsCache[formatStr][length];
4462 });
4463 }
4464 weekdays(length, format = false, defaultOK = true) {
4465 return listStuff(this, length, defaultOK, weekdays, () => {
4466 const intl = format ? { weekday: length, year: "numeric", month: "long", day: "numeric" } : { weekday: length }, formatStr = format ? "format" : "standalone";
4467 if (!this.weekdaysCache[formatStr][length]) {
4468 this.weekdaysCache[formatStr][length] = mapWeekdays(
4469 (dt) => this.extract(dt, intl, "weekday")
4470 );
4471 }
4472 return this.weekdaysCache[formatStr][length];
4473 });
4474 }
4475 meridiems(defaultOK = true) {
4476 return listStuff(
4477 this,
4478 void 0,
4479 defaultOK,
4480 () => meridiems,
4481 () => {
4482 if (!this.meridiemCache) {
4483 const intl = { hour: "numeric", hourCycle: "h12" };
4484 this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(
4485 (dt) => this.extract(dt, intl, "dayperiod")
4486 );
4487 }
4488 return this.meridiemCache;
4489 }
4490 );
4491 }
4492 eras(length, defaultOK = true) {
4493 return listStuff(this, length, defaultOK, eras, () => {
4494 const intl = { era: length };
4495 if (!this.eraCache[length]) {
4496 this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(
4497 (dt) => this.extract(dt, intl, "era")
4498 );
4499 }
4500 return this.eraCache[length];
4501 });
4502 }
4503 extract(dt, intlOpts, field) {
4504 const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m) => m.type.toLowerCase() === field);
4505 return matching ? matching.value : null;
4506 }
4507 numberFormatter(opts = {}) {
4508 return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);
4509 }
4510 dtFormatter(dt, intlOpts = {}) {
4511 return new PolyDateFormatter(dt, this.intl, intlOpts);
4512 }
4513 relFormatter(opts = {}) {
4514 return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
4515 }
4516 listFormatter(opts = {}) {
4517 return getCachedLF(this.intl, opts);
4518 }
4519 isEnglish() {
4520 return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
4521 }
4522 equals(other) {
4523 return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
4524 }
4525};
4526
4527// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/fixedOffsetZone.js
4528var singleton2 = null;
4529var FixedOffsetZone = class extends Zone {
4530 static get utcInstance() {
4531 if (singleton2 === null) {
4532 singleton2 = new FixedOffsetZone(0);
4533 }
4534 return singleton2;
4535 }
4536 static instance(offset2) {
4537 return offset2 === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset2);
4538 }
4539 static parseSpecifier(s2) {
4540 if (s2) {
4541 const r = s2.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
4542 if (r) {
4543 return new FixedOffsetZone(signedOffset(r[1], r[2]));
4544 }
4545 }
4546 return null;
4547 }
4548 constructor(offset2) {
4549 super();
4550 this.fixed = offset2;
4551 }
4552 get type() {
4553 return "fixed";
4554 }
4555 get name() {
4556 return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`;
4557 }
4558 get ianaName() {
4559 if (this.fixed === 0) {
4560 return "Etc/UTC";
4561 } else {
4562 return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`;
4563 }
4564 }
4565 offsetName() {
4566 return this.name;
4567 }
4568 formatOffset(ts, format) {
4569 return formatOffset(this.fixed, format);
4570 }
4571 get isUniversal() {
4572 return true;
4573 }
4574 offset() {
4575 return this.fixed;
4576 }
4577 equals(otherZone) {
4578 return otherZone.type === "fixed" && otherZone.fixed === this.fixed;
4579 }
4580 get isValid() {
4581 return true;
4582 }
4583};
4584
4585// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/invalidZone.js
4586var InvalidZone = class extends Zone {
4587 constructor(zoneName) {
4588 super();
4589 this.zoneName = zoneName;
4590 }
4591 get type() {
4592 return "invalid";
4593 }
4594 get name() {
4595 return this.zoneName;
4596 }
4597 get isUniversal() {
4598 return false;
4599 }
4600 offsetName() {
4601 return null;
4602 }
4603 formatOffset() {
4604 return "";
4605 }
4606 offset() {
4607 return NaN;
4608 }
4609 equals() {
4610 return false;
4611 }
4612 get isValid() {
4613 return false;
4614 }
4615};
4616
4617// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/zoneUtil.js
4618function normalizeZone(input, defaultZone2) {
4619 let offset2;
4620 if (isUndefined(input) || input === null) {
4621 return defaultZone2;
4622 } else if (input instanceof Zone) {
4623 return input;
4624 } else if (isString(input)) {
4625 const lowered = input.toLowerCase();
4626 if (lowered === "default")
4627 return defaultZone2;
4628 else if (lowered === "local" || lowered === "system")
4629 return SystemZone.instance;
4630 else if (lowered === "utc" || lowered === "gmt")
4631 return FixedOffsetZone.utcInstance;
4632 else
4633 return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
4634 } else if (isNumber(input)) {
4635 return FixedOffsetZone.instance(input);
4636 } else if (typeof input === "object" && input.offset && typeof input.offset === "number") {
4637 return input;
4638 } else {
4639 return new InvalidZone(input);
4640 }
4641}
4642
4643// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/settings.js
4644var now = () => Date.now();
4645var defaultZone = "system";
4646var defaultLocale = null;
4647var defaultNumberingSystem = null;
4648var defaultOutputCalendar = null;
4649var twoDigitCutoffYear = 60;
4650var throwOnInvalid;
4651var Settings = class {
4652 static get now() {
4653 return now;
4654 }
4655 static set now(n2) {
4656 now = n2;
4657 }
4658 static set defaultZone(zone) {
4659 defaultZone = zone;
4660 }
4661 static get defaultZone() {
4662 return normalizeZone(defaultZone, SystemZone.instance);
4663 }
4664 static get defaultLocale() {
4665 return defaultLocale;
4666 }
4667 static set defaultLocale(locale) {
4668 defaultLocale = locale;
4669 }
4670 static get defaultNumberingSystem() {
4671 return defaultNumberingSystem;
4672 }
4673 static set defaultNumberingSystem(numberingSystem) {
4674 defaultNumberingSystem = numberingSystem;
4675 }
4676 static get defaultOutputCalendar() {
4677 return defaultOutputCalendar;
4678 }
4679 static set defaultOutputCalendar(outputCalendar) {
4680 defaultOutputCalendar = outputCalendar;
4681 }
4682 static get twoDigitCutoffYear() {
4683 return twoDigitCutoffYear;
4684 }
4685 static set twoDigitCutoffYear(cutoffYear) {
4686 twoDigitCutoffYear = cutoffYear % 100;
4687 }
4688 static get throwOnInvalid() {
4689 return throwOnInvalid;
4690 }
4691 static set throwOnInvalid(t) {
4692 throwOnInvalid = t;
4693 }
4694 static resetCaches() {
4695 Locale.resetCache();
4696 IANAZone.resetCache();
4697 }
4698};
4699
4700// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/util.js
4701function isUndefined(o) {
4702 return typeof o === "undefined";
4703}
4704function isNumber(o) {
4705 return typeof o === "number";
4706}
4707function isInteger(o) {
4708 return typeof o === "number" && o % 1 === 0;
4709}
4710function isString(o) {
4711 return typeof o === "string";
4712}
4713function isDate(o) {
4714 return Object.prototype.toString.call(o) === "[object Date]";
4715}
4716function hasRelative() {
4717 try {
4718 return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat;
4719 } catch (e) {
4720 return false;
4721 }
4722}
4723function maybeArray(thing) {
4724 return Array.isArray(thing) ? thing : [thing];
4725}
4726function bestBy(arr, by, compare) {
4727 if (arr.length === 0) {
4728 return void 0;
4729 }
4730 return arr.reduce((best, next) => {
4731 const pair = [by(next), next];
4732 if (!best) {
4733 return pair;
4734 } else if (compare(best[0], pair[0]) === best[0]) {
4735 return best;
4736 } else {
4737 return pair;
4738 }
4739 }, null)[1];
4740}
4741function pick(obj, keys) {
4742 return keys.reduce((a, k) => {
4743 a[k] = obj[k];
4744 return a;
4745 }, {});
4746}
4747function hasOwnProperty(obj, prop) {
4748 return Object.prototype.hasOwnProperty.call(obj, prop);
4749}
4750function integerBetween(thing, bottom, top) {
4751 return isInteger(thing) && thing >= bottom && thing <= top;
4752}
4753function floorMod(x, n2) {
4754 return x - n2 * Math.floor(x / n2);
4755}
4756function padStart(input, n2 = 2) {
4757 const isNeg = input < 0;
4758 let padded;
4759 if (isNeg) {
4760 padded = "-" + ("" + -input).padStart(n2, "0");
4761 } else {
4762 padded = ("" + input).padStart(n2, "0");
4763 }
4764 return padded;
4765}
4766function parseInteger(string) {
4767 if (isUndefined(string) || string === null || string === "") {
4768 return void 0;
4769 } else {
4770 return parseInt(string, 10);
4771 }
4772}
4773function parseFloating(string) {
4774 if (isUndefined(string) || string === null || string === "") {
4775 return void 0;
4776 } else {
4777 return parseFloat(string);
4778 }
4779}
4780function parseMillis(fraction) {
4781 if (isUndefined(fraction) || fraction === null || fraction === "") {
4782 return void 0;
4783 } else {
4784 const f = parseFloat("0." + fraction) * 1e3;
4785 return Math.floor(f);
4786 }
4787}
4788function roundTo(number, digits, towardZero = false) {
4789 const factor = 10 ** digits, rounder = towardZero ? Math.trunc : Math.round;
4790 return rounder(number * factor) / factor;
4791}
4792function isLeapYear(year) {
4793 return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
4794}
4795function daysInYear(year) {
4796 return isLeapYear(year) ? 366 : 365;
4797}
4798function daysInMonth(year, month) {
4799 const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12;
4800 if (modMonth === 2) {
4801 return isLeapYear(modYear) ? 29 : 28;
4802 } else {
4803 return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];
4804 }
4805}
4806function objToLocalTS(obj) {
4807 let d = Date.UTC(
4808 obj.year,
4809 obj.month - 1,
4810 obj.day,
4811 obj.hour,
4812 obj.minute,
4813 obj.second,
4814 obj.millisecond
4815 );
4816 if (obj.year < 100 && obj.year >= 0) {
4817 d = new Date(d);
4818 d.setUTCFullYear(d.getUTCFullYear() - 1900);
4819 }
4820 return +d;
4821}
4822function weeksInWeekYear(weekYear) {
4823 const p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, last = weekYear - 1, p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
4824 return p1 === 4 || p2 === 3 ? 53 : 52;
4825}
4826function untruncateYear(year) {
4827 if (year > 99) {
4828 return year;
4829 } else
4830 return year > Settings.twoDigitCutoffYear ? 1900 + year : 2e3 + year;
4831}
4832function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {
4833 const date = new Date(ts), intlOpts = {
4834 hourCycle: "h23",
4835 year: "numeric",
4836 month: "2-digit",
4837 day: "2-digit",
4838 hour: "2-digit",
4839 minute: "2-digit"
4840 };
4841 if (timeZone) {
4842 intlOpts.timeZone = timeZone;
4843 }
4844 const modified = { timeZoneName: offsetFormat, ...intlOpts };
4845 const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find((m) => m.type.toLowerCase() === "timezonename");
4846 return parsed ? parsed.value : null;
4847}
4848function signedOffset(offHourStr, offMinuteStr) {
4849 let offHour = parseInt(offHourStr, 10);
4850 if (Number.isNaN(offHour)) {
4851 offHour = 0;
4852 }
4853 const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;
4854 return offHour * 60 + offMinSigned;
4855}
4856function asNumber(value) {
4857 const numericValue = Number(value);
4858 if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
4859 throw new InvalidArgumentError(`Invalid unit value ${value}`);
4860 return numericValue;
4861}
4862function normalizeObject(obj, normalizer) {
4863 const normalized = {};
4864 for (const u in obj) {
4865 if (hasOwnProperty(obj, u)) {
4866 const v = obj[u];
4867 if (v === void 0 || v === null)
4868 continue;
4869 normalized[normalizer(u)] = asNumber(v);
4870 }
4871 }
4872 return normalized;
4873}
4874function formatOffset(offset2, format) {
4875 const hours = Math.trunc(Math.abs(offset2 / 60)), minutes = Math.trunc(Math.abs(offset2 % 60)), sign = offset2 >= 0 ? "+" : "-";
4876 switch (format) {
4877 case "short":
4878 return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;
4879 case "narrow":
4880 return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`;
4881 case "techie":
4882 return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;
4883 default:
4884 throw new RangeError(`Value format ${format} is out of range for property format`);
4885 }
4886}
4887function timeObject(obj) {
4888 return pick(obj, ["hour", "minute", "second", "millisecond"]);
4889}
4890
4891// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/english.js
4892var monthsLong = [
4893 "January",
4894 "February",
4895 "March",
4896 "April",
4897 "May",
4898 "June",
4899 "July",
4900 "August",
4901 "September",
4902 "October",
4903 "November",
4904 "December"
4905];
4906var monthsShort = [
4907 "Jan",
4908 "Feb",
4909 "Mar",
4910 "Apr",
4911 "May",
4912 "Jun",
4913 "Jul",
4914 "Aug",
4915 "Sep",
4916 "Oct",
4917 "Nov",
4918 "Dec"
4919];
4920var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
4921function months(length) {
4922 switch (length) {
4923 case "narrow":
4924 return [...monthsNarrow];
4925 case "short":
4926 return [...monthsShort];
4927 case "long":
4928 return [...monthsLong];
4929 case "numeric":
4930 return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
4931 case "2-digit":
4932 return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
4933 default:
4934 return null;
4935 }
4936}
4937var weekdaysLong = [
4938 "Monday",
4939 "Tuesday",
4940 "Wednesday",
4941 "Thursday",
4942 "Friday",
4943 "Saturday",
4944 "Sunday"
4945];
4946var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
4947var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"];
4948function weekdays(length) {
4949 switch (length) {
4950 case "narrow":
4951 return [...weekdaysNarrow];
4952 case "short":
4953 return [...weekdaysShort];
4954 case "long":
4955 return [...weekdaysLong];
4956 case "numeric":
4957 return ["1", "2", "3", "4", "5", "6", "7"];
4958 default:
4959 return null;
4960 }
4961}
4962var meridiems = ["AM", "PM"];
4963var erasLong = ["Before Christ", "Anno Domini"];
4964var erasShort = ["BC", "AD"];
4965var erasNarrow = ["B", "A"];
4966function eras(length) {
4967 switch (length) {
4968 case "narrow":
4969 return [...erasNarrow];
4970 case "short":
4971 return [...erasShort];
4972 case "long":
4973 return [...erasLong];
4974 default:
4975 return null;
4976 }
4977}
4978function meridiemForDateTime(dt) {
4979 return meridiems[dt.hour < 12 ? 0 : 1];
4980}
4981function weekdayForDateTime(dt, length) {
4982 return weekdays(length)[dt.weekday - 1];
4983}
4984function monthForDateTime(dt, length) {
4985 return months(length)[dt.month - 1];
4986}
4987function eraForDateTime(dt, length) {
4988 return eras(length)[dt.year < 0 ? 0 : 1];
4989}
4990function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
4991 const units = {
4992 years: ["year", "yr."],
4993 quarters: ["quarter", "qtr."],
4994 months: ["month", "mo."],
4995 weeks: ["week", "wk."],
4996 days: ["day", "day", "days"],
4997 hours: ["hour", "hr."],
4998 minutes: ["minute", "min."],
4999 seconds: ["second", "sec."]
5000 };
5001 const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1;
5002 if (numeric === "auto" && lastable) {
5003 const isDay = unit === "days";
5004 switch (count) {
5005 case 1:
5006 return isDay ? "tomorrow" : `next ${units[unit][0]}`;
5007 case -1:
5008 return isDay ? "yesterday" : `last ${units[unit][0]}`;
5009 case 0:
5010 return isDay ? "today" : `this ${units[unit][0]}`;
5011 default:
5012 }
5013 }
5014 const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = fmtValue === 1, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit;
5015 return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
5016}
5017
5018// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/formatter.js
5019function stringifyTokens(splits, tokenToString) {
5020 let s2 = "";
5021 for (const token of splits) {
5022 if (token.literal) {
5023 s2 += token.val;
5024 } else {
5025 s2 += tokenToString(token.val);
5026 }
5027 }
5028 return s2;
5029}
5030var macroTokenToFormatOpts = {
5031 D: DATE_SHORT,
5032 DD: DATE_MED,
5033 DDD: DATE_FULL,
5034 DDDD: DATE_HUGE,
5035 t: TIME_SIMPLE,
5036 tt: TIME_WITH_SECONDS,
5037 ttt: TIME_WITH_SHORT_OFFSET,
5038 tttt: TIME_WITH_LONG_OFFSET,
5039 T: TIME_24_SIMPLE,
5040 TT: TIME_24_WITH_SECONDS,
5041 TTT: TIME_24_WITH_SHORT_OFFSET,
5042 TTTT: TIME_24_WITH_LONG_OFFSET,
5043 f: DATETIME_SHORT,
5044 ff: DATETIME_MED,
5045 fff: DATETIME_FULL,
5046 ffff: DATETIME_HUGE,
5047 F: DATETIME_SHORT_WITH_SECONDS,
5048 FF: DATETIME_MED_WITH_SECONDS,
5049 FFF: DATETIME_FULL_WITH_SECONDS,
5050 FFFF: DATETIME_HUGE_WITH_SECONDS
5051};
5052var Formatter = class {
5053 static create(locale, opts = {}) {
5054 return new Formatter(locale, opts);
5055 }
5056 static parseFormat(fmt) {
5057 let current = null, currentFull = "", bracketed = false;
5058 const splits = [];
5059 for (let i = 0; i < fmt.length; i++) {
5060 const c = fmt.charAt(i);
5061 if (c === "'") {
5062 if (currentFull.length > 0) {
5063 splits.push({ literal: bracketed, val: currentFull });
5064 }
5065 current = null;
5066 currentFull = "";
5067 bracketed = !bracketed;
5068 } else if (bracketed) {
5069 currentFull += c;
5070 } else if (c === current) {
5071 currentFull += c;
5072 } else {
5073 if (currentFull.length > 0) {
5074 splits.push({ literal: false, val: currentFull });
5075 }
5076 currentFull = c;
5077 current = c;
5078 }
5079 }
5080 if (currentFull.length > 0) {
5081 splits.push({ literal: bracketed, val: currentFull });
5082 }
5083 return splits;
5084 }
5085 static macroTokenToFormatOpts(token) {
5086 return macroTokenToFormatOpts[token];
5087 }
5088 constructor(locale, formatOpts) {
5089 this.opts = formatOpts;
5090 this.loc = locale;
5091 this.systemLoc = null;
5092 }
5093 formatWithSystemDefault(dt, opts) {
5094 if (this.systemLoc === null) {
5095 this.systemLoc = this.loc.redefaultToSystem();
5096 }
5097 const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });
5098 return df.format();
5099 }
5100 formatDateTime(dt, opts = {}) {
5101 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });
5102 return df.format();
5103 }
5104 formatDateTimeParts(dt, opts = {}) {
5105 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });
5106 return df.formatToParts();
5107 }
5108 formatInterval(interval, opts = {}) {
5109 const df = this.loc.dtFormatter(interval.start, { ...this.opts, ...opts });
5110 return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
5111 }
5112 resolvedOptions(dt, opts = {}) {
5113 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });
5114 return df.resolvedOptions();
5115 }
5116 num(n2, p = 0) {
5117 if (this.opts.forceSimple) {
5118 return padStart(n2, p);
5119 }
5120 const opts = { ...this.opts };
5121 if (p > 0) {
5122 opts.padTo = p;
5123 }
5124 return this.loc.numberFormatter(opts).format(n2);
5125 }
5126 formatDateTimeFromString(dt, fmt) {
5127 const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string = (opts, extract) => this.loc.extract(dt, opts, extract), formatOffset2 = (opts) => {
5128 if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
5129 return "Z";
5130 }
5131 return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : "";
5132 }, meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { month: length } : { month: length, day: "numeric" }, "month"), weekday = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string(
5133 standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" },
5134 "weekday"
5135 ), maybeMacro = (token) => {
5136 const formatOpts = Formatter.macroTokenToFormatOpts(token);
5137 if (formatOpts) {
5138 return this.formatWithSystemDefault(dt, formatOpts);
5139 } else {
5140 return token;
5141 }
5142 }, era = (length) => knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, "era"), tokenToString = (token) => {
5143 switch (token) {
5144 case "S":
5145 return this.num(dt.millisecond);
5146 case "u":
5147 case "SSS":
5148 return this.num(dt.millisecond, 3);
5149 case "s":
5150 return this.num(dt.second);
5151 case "ss":
5152 return this.num(dt.second, 2);
5153 case "uu":
5154 return this.num(Math.floor(dt.millisecond / 10), 2);
5155 case "uuu":
5156 return this.num(Math.floor(dt.millisecond / 100));
5157 case "m":
5158 return this.num(dt.minute);
5159 case "mm":
5160 return this.num(dt.minute, 2);
5161 case "h":
5162 return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
5163 case "hh":
5164 return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
5165 case "H":
5166 return this.num(dt.hour);
5167 case "HH":
5168 return this.num(dt.hour, 2);
5169 case "Z":
5170 return formatOffset2({ format: "narrow", allowZ: this.opts.allowZ });
5171 case "ZZ":
5172 return formatOffset2({ format: "short", allowZ: this.opts.allowZ });
5173 case "ZZZ":
5174 return formatOffset2({ format: "techie", allowZ: this.opts.allowZ });
5175 case "ZZZZ":
5176 return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale });
5177 case "ZZZZZ":
5178 return dt.zone.offsetName(dt.ts, { format: "long", locale: this.loc.locale });
5179 case "z":
5180 return dt.zoneName;
5181 case "a":
5182 return meridiem();
5183 case "d":
5184 return useDateTimeFormatter ? string({ day: "numeric" }, "day") : this.num(dt.day);
5185 case "dd":
5186 return useDateTimeFormatter ? string({ day: "2-digit" }, "day") : this.num(dt.day, 2);
5187 case "c":
5188 return this.num(dt.weekday);
5189 case "ccc":
5190 return weekday("short", true);
5191 case "cccc":
5192 return weekday("long", true);
5193 case "ccccc":
5194 return weekday("narrow", true);
5195 case "E":
5196 return this.num(dt.weekday);
5197 case "EEE":
5198 return weekday("short", false);
5199 case "EEEE":
5200 return weekday("long", false);
5201 case "EEEEE":
5202 return weekday("narrow", false);
5203 case "L":
5204 return useDateTimeFormatter ? string({ month: "numeric", day: "numeric" }, "month") : this.num(dt.month);
5205 case "LL":
5206 return useDateTimeFormatter ? string({ month: "2-digit", day: "numeric" }, "month") : this.num(dt.month, 2);
5207 case "LLL":
5208 return month("short", true);
5209 case "LLLL":
5210 return month("long", true);
5211 case "LLLLL":
5212 return month("narrow", true);
5213 case "M":
5214 return useDateTimeFormatter ? string({ month: "numeric" }, "month") : this.num(dt.month);
5215 case "MM":
5216 return useDateTimeFormatter ? string({ month: "2-digit" }, "month") : this.num(dt.month, 2);
5217 case "MMM":
5218 return month("short", false);
5219 case "MMMM":
5220 return month("long", false);
5221 case "MMMMM":
5222 return month("narrow", false);
5223 case "y":
5224 return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year);
5225 case "yy":
5226 return useDateTimeFormatter ? string({ year: "2-digit" }, "year") : this.num(dt.year.toString().slice(-2), 2);
5227 case "yyyy":
5228 return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year, 4);
5229 case "yyyyyy":
5230 return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year, 6);
5231 case "G":
5232 return era("short");
5233 case "GG":
5234 return era("long");
5235 case "GGGGG":
5236 return era("narrow");
5237 case "kk":
5238 return this.num(dt.weekYear.toString().slice(-2), 2);
5239 case "kkkk":
5240 return this.num(dt.weekYear, 4);
5241 case "W":
5242 return this.num(dt.weekNumber);
5243 case "WW":
5244 return this.num(dt.weekNumber, 2);
5245 case "o":
5246 return this.num(dt.ordinal);
5247 case "ooo":
5248 return this.num(dt.ordinal, 3);
5249 case "q":
5250 return this.num(dt.quarter);
5251 case "qq":
5252 return this.num(dt.quarter, 2);
5253 case "X":
5254 return this.num(Math.floor(dt.ts / 1e3));
5255 case "x":
5256 return this.num(dt.ts);
5257 default:
5258 return maybeMacro(token);
5259 }
5260 };
5261 return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
5262 }
5263 formatDurationFromString(dur, fmt) {
5264 const tokenToField = (token) => {
5265 switch (token[0]) {
5266 case "S":
5267 return "millisecond";
5268 case "s":
5269 return "second";
5270 case "m":
5271 return "minute";
5272 case "h":
5273 return "hour";
5274 case "d":
5275 return "day";
5276 case "w":
5277 return "week";
5278 case "M":
5279 return "month";
5280 case "y":
5281 return "year";
5282 default:
5283 return null;
5284 }
5285 }, tokenToString = (lildur) => (token) => {
5286 const mapped = tokenToField(token);
5287 if (mapped) {
5288 return this.num(lildur.get(mapped), token.length);
5289 } else {
5290 return token;
5291 }
5292 }, tokens = Formatter.parseFormat(fmt), realTokens = tokens.reduce(
5293 (found, { literal, val }) => literal ? found : found.concat(val),
5294 []
5295 ), collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
5296 return stringifyTokens(tokens, tokenToString(collapsed));
5297 }
5298};
5299
5300// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/invalid.js
5301var Invalid = class {
5302 constructor(reason, explanation) {
5303 this.reason = reason;
5304 this.explanation = explanation;
5305 }
5306 toMessage() {
5307 if (this.explanation) {
5308 return `${this.reason}: ${this.explanation}`;
5309 } else {
5310 return this.reason;
5311 }
5312 }
5313};
5314
5315// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/regexParser.js
5316var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
5317function combineRegexes(...regexes) {
5318 const full = regexes.reduce((f, r) => f + r.source, "");
5319 return RegExp(`^${full}$`);
5320}
5321function combineExtractors(...extractors) {
5322 return (m) => extractors.reduce(
5323 ([mergedVals, mergedZone, cursor], ex) => {
5324 const [val, zone, next] = ex(m, cursor);
5325 return [{ ...mergedVals, ...val }, zone || mergedZone, next];
5326 },
5327 [{}, null, 1]
5328 ).slice(0, 2);
5329}
5330function parse(s2, ...patterns) {
5331 if (s2 == null) {
5332 return [null, null];
5333 }
5334 for (const [regex, extractor] of patterns) {
5335 const m = regex.exec(s2);
5336 if (m) {
5337 return extractor(m);
5338 }
5339 }
5340 return [null, null];
5341}
5342function simpleParse(...keys) {
5343 return (match2, cursor) => {
5344 const ret = {};
5345 let i;
5346 for (i = 0; i < keys.length; i++) {
5347 ret[keys[i]] = parseInteger(match2[cursor + i]);
5348 }
5349 return [ret, null, cursor + i];
5350 };
5351}
5352var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
5353var isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
5354var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
5355var isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
5356var isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
5357var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
5358var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
5359var isoOrdinalRegex = /(\d{4})-?(\d{3})/;
5360var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
5361var extractISOOrdinalData = simpleParse("year", "ordinal");
5362var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
5363var sqlTimeRegex = RegExp(
5364 `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`
5365);
5366var sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
5367function int(match2, pos, fallback) {
5368 const m = match2[pos];
5369 return isUndefined(m) ? fallback : parseInteger(m);
5370}
5371function extractISOYmd(match2, cursor) {
5372 const item = {
5373 year: int(match2, cursor),
5374 month: int(match2, cursor + 1, 1),
5375 day: int(match2, cursor + 2, 1)
5376 };
5377 return [item, null, cursor + 3];
5378}
5379function extractISOTime(match2, cursor) {
5380 const item = {
5381 hours: int(match2, cursor, 0),
5382 minutes: int(match2, cursor + 1, 0),
5383 seconds: int(match2, cursor + 2, 0),
5384 milliseconds: parseMillis(match2[cursor + 3])
5385 };
5386 return [item, null, cursor + 4];
5387}
5388function extractISOOffset(match2, cursor) {
5389 const local = !match2[cursor] && !match2[cursor + 1], fullOffset = signedOffset(match2[cursor + 1], match2[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset);
5390 return [{}, zone, cursor + 3];
5391}
5392function extractIANAZone(match2, cursor) {
5393 const zone = match2[cursor] ? IANAZone.create(match2[cursor]) : null;
5394 return [{}, zone, cursor + 1];
5395}
5396var isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
5397var isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
5398function extractISODuration(match2) {
5399 const [s2, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match2;
5400 const hasNegativePrefix = s2[0] === "-";
5401 const negativeSeconds = secondStr && secondStr[0] === "-";
5402 const maybeNegate = (num, force = false) => num !== void 0 && (force || num && hasNegativePrefix) ? -num : num;
5403 return [
5404 {
5405 years: maybeNegate(parseFloating(yearStr)),
5406 months: maybeNegate(parseFloating(monthStr)),
5407 weeks: maybeNegate(parseFloating(weekStr)),
5408 days: maybeNegate(parseFloating(dayStr)),
5409 hours: maybeNegate(parseFloating(hourStr)),
5410 minutes: maybeNegate(parseFloating(minuteStr)),
5411 seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"),
5412 milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
5413 }
5414 ];
5415}
5416var obsOffsets = {
5417 GMT: 0,
5418 EDT: -4 * 60,
5419 EST: -5 * 60,
5420 CDT: -5 * 60,
5421 CST: -6 * 60,
5422 MDT: -6 * 60,
5423 MST: -7 * 60,
5424 PDT: -7 * 60,
5425 PST: -8 * 60
5426};
5427function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
5428 const result = {
5429 year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
5430 month: monthsShort.indexOf(monthStr) + 1,
5431 day: parseInteger(dayStr),
5432 hour: parseInteger(hourStr),
5433 minute: parseInteger(minuteStr)
5434 };
5435 if (secondStr)
5436 result.second = parseInteger(secondStr);
5437 if (weekdayStr) {
5438 result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
5439 }
5440 return result;
5441}
5442var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
5443function extractRFC2822(match2) {
5444 const [
5445 ,
5446 weekdayStr,
5447 dayStr,
5448 monthStr,
5449 yearStr,
5450 hourStr,
5451 minuteStr,
5452 secondStr,
5453 obsOffset,
5454 milOffset,
5455 offHourStr,
5456 offMinuteStr
5457 ] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
5458 let offset2;
5459 if (obsOffset) {
5460 offset2 = obsOffsets[obsOffset];
5461 } else if (milOffset) {
5462 offset2 = 0;
5463 } else {
5464 offset2 = signedOffset(offHourStr, offMinuteStr);
5465 }
5466 return [result, new FixedOffsetZone(offset2)];
5467}
5468function preprocessRFC2822(s2) {
5469 return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
5470}
5471var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/;
5472var rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/;
5473var ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
5474function extractRFC1123Or850(match2) {
5475 const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
5476 return [result, FixedOffsetZone.utcInstance];
5477}
5478function extractASCII(match2) {
5479 const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
5480 return [result, FixedOffsetZone.utcInstance];
5481}
5482var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
5483var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
5484var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
5485var isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
5486var extractISOYmdTimeAndOffset = combineExtractors(
5487 extractISOYmd,
5488 extractISOTime,
5489 extractISOOffset,
5490 extractIANAZone
5491);
5492var extractISOWeekTimeAndOffset = combineExtractors(
5493 extractISOWeekData,
5494 extractISOTime,
5495 extractISOOffset,
5496 extractIANAZone
5497);
5498var extractISOOrdinalDateAndTime = combineExtractors(
5499 extractISOOrdinalData,
5500 extractISOTime,
5501 extractISOOffset,
5502 extractIANAZone
5503);
5504var extractISOTimeAndOffset = combineExtractors(
5505 extractISOTime,
5506 extractISOOffset,
5507 extractIANAZone
5508);
5509function parseISODate(s2) {
5510 return parse(
5511 s2,
5512 [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
5513 [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],
5514 [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],
5515 [isoTimeCombinedRegex, extractISOTimeAndOffset]
5516 );
5517}
5518function parseRFC2822Date(s2) {
5519 return parse(preprocessRFC2822(s2), [rfc2822, extractRFC2822]);
5520}
5521function parseHTTPDate(s2) {
5522 return parse(
5523 s2,
5524 [rfc1123, extractRFC1123Or850],
5525 [rfc850, extractRFC1123Or850],
5526 [ascii, extractASCII]
5527 );
5528}
5529function parseISODuration(s2) {
5530 return parse(s2, [isoDuration, extractISODuration]);
5531}
5532var extractISOTimeOnly = combineExtractors(extractISOTime);
5533function parseISOTimeOnly(s2) {
5534 return parse(s2, [isoTimeOnly, extractISOTimeOnly]);
5535}
5536var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
5537var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
5538var extractISOTimeOffsetAndIANAZone = combineExtractors(
5539 extractISOTime,
5540 extractISOOffset,
5541 extractIANAZone
5542);
5543function parseSQL(s2) {
5544 return parse(
5545 s2,
5546 [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
5547 [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]
5548 );
5549}
5550
5551// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/duration.js
5552var INVALID2 = "Invalid Duration";
5553var lowOrderMatrix = {
5554 weeks: {
5555 days: 7,
5556 hours: 7 * 24,
5557 minutes: 7 * 24 * 60,
5558 seconds: 7 * 24 * 60 * 60,
5559 milliseconds: 7 * 24 * 60 * 60 * 1e3
5560 },
5561 days: {
5562 hours: 24,
5563 minutes: 24 * 60,
5564 seconds: 24 * 60 * 60,
5565 milliseconds: 24 * 60 * 60 * 1e3
5566 },
5567 hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1e3 },
5568 minutes: { seconds: 60, milliseconds: 60 * 1e3 },
5569 seconds: { milliseconds: 1e3 }
5570};
5571var casualMatrix = {
5572 years: {
5573 quarters: 4,
5574 months: 12,
5575 weeks: 52,
5576 days: 365,
5577 hours: 365 * 24,
5578 minutes: 365 * 24 * 60,
5579 seconds: 365 * 24 * 60 * 60,
5580 milliseconds: 365 * 24 * 60 * 60 * 1e3
5581 },
5582 quarters: {
5583 months: 3,
5584 weeks: 13,
5585 days: 91,
5586 hours: 91 * 24,
5587 minutes: 91 * 24 * 60,
5588 seconds: 91 * 24 * 60 * 60,
5589 milliseconds: 91 * 24 * 60 * 60 * 1e3
5590 },
5591 months: {
5592 weeks: 4,
5593 days: 30,
5594 hours: 30 * 24,
5595 minutes: 30 * 24 * 60,
5596 seconds: 30 * 24 * 60 * 60,
5597 milliseconds: 30 * 24 * 60 * 60 * 1e3
5598 },
5599 ...lowOrderMatrix
5600};
5601var daysInYearAccurate = 146097 / 400;
5602var daysInMonthAccurate = 146097 / 4800;
5603var accurateMatrix = {
5604 years: {
5605 quarters: 4,
5606 months: 12,
5607 weeks: daysInYearAccurate / 7,
5608 days: daysInYearAccurate,
5609 hours: daysInYearAccurate * 24,
5610 minutes: daysInYearAccurate * 24 * 60,
5611 seconds: daysInYearAccurate * 24 * 60 * 60,
5612 milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3
5613 },
5614 quarters: {
5615 months: 3,
5616 weeks: daysInYearAccurate / 28,
5617 days: daysInYearAccurate / 4,
5618 hours: daysInYearAccurate * 24 / 4,
5619 minutes: daysInYearAccurate * 24 * 60 / 4,
5620 seconds: daysInYearAccurate * 24 * 60 * 60 / 4,
5621 milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 / 4
5622 },
5623 months: {
5624 weeks: daysInMonthAccurate / 7,
5625 days: daysInMonthAccurate,
5626 hours: daysInMonthAccurate * 24,
5627 minutes: daysInMonthAccurate * 24 * 60,
5628 seconds: daysInMonthAccurate * 24 * 60 * 60,
5629 milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1e3
5630 },
5631 ...lowOrderMatrix
5632};
5633var orderedUnits = [
5634 "years",
5635 "quarters",
5636 "months",
5637 "weeks",
5638 "days",
5639 "hours",
5640 "minutes",
5641 "seconds",
5642 "milliseconds"
5643];
5644var reverseUnits = orderedUnits.slice(0).reverse();
5645function clone(dur, alts, clear = false) {
5646 const conf = {
5647 values: clear ? alts.values : { ...dur.values, ...alts.values || {} },
5648 loc: dur.loc.clone(alts.loc),
5649 conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
5650 matrix: alts.matrix || dur.matrix
5651 };
5652 return new Duration(conf);
5653}
5654function antiTrunc(n2) {
5655 return n2 < 0 ? Math.floor(n2) : Math.ceil(n2);
5656}
5657function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
5658 const conv = matrix[toUnit][fromUnit], raw = fromMap[fromUnit] / conv, sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
5659 toMap[toUnit] += added;
5660 fromMap[fromUnit] -= added * conv;
5661}
5662function normalizeValues(matrix, vals) {
5663 reverseUnits.reduce((previous, current) => {
5664 if (!isUndefined(vals[current])) {
5665 if (previous) {
5666 convert(matrix, vals, previous, vals, current);
5667 }
5668 return current;
5669 } else {
5670 return previous;
5671 }
5672 }, null);
5673}
5674function removeZeroes(vals) {
5675 const newVals = {};
5676 for (const [key, value] of Object.entries(vals)) {
5677 if (value !== 0) {
5678 newVals[key] = value;
5679 }
5680 }
5681 return newVals;
5682}
5683var Duration = class {
5684 constructor(config) {
5685 const accurate = config.conversionAccuracy === "longterm" || false;
5686 let matrix = accurate ? accurateMatrix : casualMatrix;
5687 if (config.matrix) {
5688 matrix = config.matrix;
5689 }
5690 this.values = config.values;
5691 this.loc = config.loc || Locale.create();
5692 this.conversionAccuracy = accurate ? "longterm" : "casual";
5693 this.invalid = config.invalid || null;
5694 this.matrix = matrix;
5695 this.isLuxonDuration = true;
5696 }
5697 static fromMillis(count, opts) {
5698 return Duration.fromObject({ milliseconds: count }, opts);
5699 }
5700 static fromObject(obj, opts = {}) {
5701 if (obj == null || typeof obj !== "object") {
5702 throw new InvalidArgumentError(
5703 `Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}`
5704 );
5705 }
5706 return new Duration({
5707 values: normalizeObject(obj, Duration.normalizeUnit),
5708 loc: Locale.fromObject(opts),
5709 conversionAccuracy: opts.conversionAccuracy,
5710 matrix: opts.matrix
5711 });
5712 }
5713 static fromDurationLike(durationLike) {
5714 if (isNumber(durationLike)) {
5715 return Duration.fromMillis(durationLike);
5716 } else if (Duration.isDuration(durationLike)) {
5717 return durationLike;
5718 } else if (typeof durationLike === "object") {
5719 return Duration.fromObject(durationLike);
5720 } else {
5721 throw new InvalidArgumentError(
5722 `Unknown duration argument ${durationLike} of type ${typeof durationLike}`
5723 );
5724 }
5725 }
5726 static fromISO(text, opts) {
5727 const [parsed] = parseISODuration(text);
5728 if (parsed) {
5729 return Duration.fromObject(parsed, opts);
5730 } else {
5731 return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
5732 }
5733 }
5734 static fromISOTime(text, opts) {
5735 const [parsed] = parseISOTimeOnly(text);
5736 if (parsed) {
5737 return Duration.fromObject(parsed, opts);
5738 } else {
5739 return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
5740 }
5741 }
5742 static invalid(reason, explanation = null) {
5743 if (!reason) {
5744 throw new InvalidArgumentError("need to specify a reason the Duration is invalid");
5745 }
5746 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
5747 if (Settings.throwOnInvalid) {
5748 throw new InvalidDurationError(invalid);
5749 } else {
5750 return new Duration({ invalid });
5751 }
5752 }
5753 static normalizeUnit(unit) {
5754 const normalized = {
5755 year: "years",
5756 years: "years",
5757 quarter: "quarters",
5758 quarters: "quarters",
5759 month: "months",
5760 months: "months",
5761 week: "weeks",
5762 weeks: "weeks",
5763 day: "days",
5764 days: "days",
5765 hour: "hours",
5766 hours: "hours",
5767 minute: "minutes",
5768 minutes: "minutes",
5769 second: "seconds",
5770 seconds: "seconds",
5771 millisecond: "milliseconds",
5772 milliseconds: "milliseconds"
5773 }[unit ? unit.toLowerCase() : unit];
5774 if (!normalized)
5775 throw new InvalidUnitError(unit);
5776 return normalized;
5777 }
5778 static isDuration(o) {
5779 return o && o.isLuxonDuration || false;
5780 }
5781 get locale() {
5782 return this.isValid ? this.loc.locale : null;
5783 }
5784 get numberingSystem() {
5785 return this.isValid ? this.loc.numberingSystem : null;
5786 }
5787 toFormat(fmt, opts = {}) {
5788 const fmtOpts = {
5789 ...opts,
5790 floor: opts.round !== false && opts.floor !== false
5791 };
5792 return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID2;
5793 }
5794 toHuman(opts = {}) {
5795 const l2 = orderedUnits.map((unit) => {
5796 const val = this.values[unit];
5797 if (isUndefined(val)) {
5798 return null;
5799 }
5800 return this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...opts, unit: unit.slice(0, -1) }).format(val);
5801 }).filter((n2) => n2);
5802 return this.loc.listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }).format(l2);
5803 }
5804 toObject() {
5805 if (!this.isValid)
5806 return {};
5807 return { ...this.values };
5808 }
5809 toISO() {
5810 if (!this.isValid)
5811 return null;
5812 let s2 = "P";
5813 if (this.years !== 0)
5814 s2 += this.years + "Y";
5815 if (this.months !== 0 || this.quarters !== 0)
5816 s2 += this.months + this.quarters * 3 + "M";
5817 if (this.weeks !== 0)
5818 s2 += this.weeks + "W";
5819 if (this.days !== 0)
5820 s2 += this.days + "D";
5821 if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)
5822 s2 += "T";
5823 if (this.hours !== 0)
5824 s2 += this.hours + "H";
5825 if (this.minutes !== 0)
5826 s2 += this.minutes + "M";
5827 if (this.seconds !== 0 || this.milliseconds !== 0)
5828 s2 += roundTo(this.seconds + this.milliseconds / 1e3, 3) + "S";
5829 if (s2 === "P")
5830 s2 += "T0S";
5831 return s2;
5832 }
5833 toISOTime(opts = {}) {
5834 if (!this.isValid)
5835 return null;
5836 const millis = this.toMillis();
5837 if (millis < 0 || millis >= 864e5)
5838 return null;
5839 opts = {
5840 suppressMilliseconds: false,
5841 suppressSeconds: false,
5842 includePrefix: false,
5843 format: "extended",
5844 ...opts
5845 };
5846 const value = this.shiftTo("hours", "minutes", "seconds", "milliseconds");
5847 let fmt = opts.format === "basic" ? "hhmm" : "hh:mm";
5848 if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) {
5849 fmt += opts.format === "basic" ? "ss" : ":ss";
5850 if (!opts.suppressMilliseconds || value.milliseconds !== 0) {
5851 fmt += ".SSS";
5852 }
5853 }
5854 let str = value.toFormat(fmt);
5855 if (opts.includePrefix) {
5856 str = "T" + str;
5857 }
5858 return str;
5859 }
5860 toJSON() {
5861 return this.toISO();
5862 }
5863 toString() {
5864 return this.toISO();
5865 }
5866 toMillis() {
5867 return this.as("milliseconds");
5868 }
5869 valueOf() {
5870 return this.toMillis();
5871 }
5872 plus(duration) {
5873 if (!this.isValid)
5874 return this;
5875 const dur = Duration.fromDurationLike(duration), result = {};
5876 for (const k of orderedUnits) {
5877 if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {
5878 result[k] = dur.get(k) + this.get(k);
5879 }
5880 }
5881 return clone(this, { values: result }, true);
5882 }
5883 minus(duration) {
5884 if (!this.isValid)
5885 return this;
5886 const dur = Duration.fromDurationLike(duration);
5887 return this.plus(dur.negate());
5888 }
5889 mapUnits(fn) {
5890 if (!this.isValid)
5891 return this;
5892 const result = {};
5893 for (const k of Object.keys(this.values)) {
5894 result[k] = asNumber(fn(this.values[k], k));
5895 }
5896 return clone(this, { values: result }, true);
5897 }
5898 get(unit) {
5899 return this[Duration.normalizeUnit(unit)];
5900 }
5901 set(values) {
5902 if (!this.isValid)
5903 return this;
5904 const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };
5905 return clone(this, { values: mixed });
5906 }
5907 reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {
5908 const loc = this.loc.clone({ locale, numberingSystem });
5909 const opts = { loc, matrix, conversionAccuracy };
5910 return clone(this, opts);
5911 }
5912 as(unit) {
5913 return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
5914 }
5915 normalize() {
5916 if (!this.isValid)
5917 return this;
5918 const vals = this.toObject();
5919 normalizeValues(this.matrix, vals);
5920 return clone(this, { values: vals }, true);
5921 }
5922 rescale() {
5923 if (!this.isValid)
5924 return this;
5925 const vals = removeZeroes(this.normalize().shiftToAll().toObject());
5926 return clone(this, { values: vals }, true);
5927 }
5928 shiftTo(...units) {
5929 if (!this.isValid)
5930 return this;
5931 if (units.length === 0) {
5932 return this;
5933 }
5934 units = units.map((u) => Duration.normalizeUnit(u));
5935 const built = {}, accumulated = {}, vals = this.toObject();
5936 let lastUnit;
5937 for (const k of orderedUnits) {
5938 if (units.indexOf(k) >= 0) {
5939 lastUnit = k;
5940 let own = 0;
5941 for (const ak in accumulated) {
5942 own += this.matrix[ak][k] * accumulated[ak];
5943 accumulated[ak] = 0;
5944 }
5945 if (isNumber(vals[k])) {
5946 own += vals[k];
5947 }
5948 const i = Math.trunc(own);
5949 built[k] = i;
5950 accumulated[k] = (own * 1e3 - i * 1e3) / 1e3;
5951 for (const down in vals) {
5952 if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {
5953 convert(this.matrix, vals, down, built, k);
5954 }
5955 }
5956 } else if (isNumber(vals[k])) {
5957 accumulated[k] = vals[k];
5958 }
5959 }
5960 for (const key in accumulated) {
5961 if (accumulated[key] !== 0) {
5962 built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
5963 }
5964 }
5965 return clone(this, { values: built }, true).normalize();
5966 }
5967 shiftToAll() {
5968 if (!this.isValid)
5969 return this;
5970 return this.shiftTo(
5971 "years",
5972 "months",
5973 "weeks",
5974 "days",
5975 "hours",
5976 "minutes",
5977 "seconds",
5978 "milliseconds"
5979 );
5980 }
5981 negate() {
5982 if (!this.isValid)
5983 return this;
5984 const negated = {};
5985 for (const k of Object.keys(this.values)) {
5986 negated[k] = this.values[k] === 0 ? 0 : -this.values[k];
5987 }
5988 return clone(this, { values: negated }, true);
5989 }
5990 get years() {
5991 return this.isValid ? this.values.years || 0 : NaN;
5992 }
5993 get quarters() {
5994 return this.isValid ? this.values.quarters || 0 : NaN;
5995 }
5996 get months() {
5997 return this.isValid ? this.values.months || 0 : NaN;
5998 }
5999 get weeks() {
6000 return this.isValid ? this.values.weeks || 0 : NaN;
6001 }
6002 get days() {
6003 return this.isValid ? this.values.days || 0 : NaN;
6004 }
6005 get hours() {
6006 return this.isValid ? this.values.hours || 0 : NaN;
6007 }
6008 get minutes() {
6009 return this.isValid ? this.values.minutes || 0 : NaN;
6010 }
6011 get seconds() {
6012 return this.isValid ? this.values.seconds || 0 : NaN;
6013 }
6014 get milliseconds() {
6015 return this.isValid ? this.values.milliseconds || 0 : NaN;
6016 }
6017 get isValid() {
6018 return this.invalid === null;
6019 }
6020 get invalidReason() {
6021 return this.invalid ? this.invalid.reason : null;
6022 }
6023 get invalidExplanation() {
6024 return this.invalid ? this.invalid.explanation : null;
6025 }
6026 equals(other) {
6027 if (!this.isValid || !other.isValid) {
6028 return false;
6029 }
6030 if (!this.loc.equals(other.loc)) {
6031 return false;
6032 }
6033 function eq(v1, v2) {
6034 if (v1 === void 0 || v1 === 0)
6035 return v2 === void 0 || v2 === 0;
6036 return v1 === v2;
6037 }
6038 for (const u of orderedUnits) {
6039 if (!eq(this.values[u], other.values[u])) {
6040 return false;
6041 }
6042 }
6043 return true;
6044 }
6045};
6046
6047// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/interval.js
6048var INVALID3 = "Invalid Interval";
6049function validateStartEnd(start, end) {
6050 if (!start || !start.isValid) {
6051 return Interval.invalid("missing or invalid start");
6052 } else if (!end || !end.isValid) {
6053 return Interval.invalid("missing or invalid end");
6054 } else if (end < start) {
6055 return Interval.invalid(
6056 "end before start",
6057 `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`
6058 );
6059 } else {
6060 return null;
6061 }
6062}
6063var Interval = class {
6064 constructor(config) {
6065 this.s = config.start;
6066 this.e = config.end;
6067 this.invalid = config.invalid || null;
6068 this.isLuxonInterval = true;
6069 }
6070 static invalid(reason, explanation = null) {
6071 if (!reason) {
6072 throw new InvalidArgumentError("need to specify a reason the Interval is invalid");
6073 }
6074 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
6075 if (Settings.throwOnInvalid) {
6076 throw new InvalidIntervalError(invalid);
6077 } else {
6078 return new Interval({ invalid });
6079 }
6080 }
6081 static fromDateTimes(start, end) {
6082 const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end);
6083 const validateError = validateStartEnd(builtStart, builtEnd);
6084 if (validateError == null) {
6085 return new Interval({
6086 start: builtStart,
6087 end: builtEnd
6088 });
6089 } else {
6090 return validateError;
6091 }
6092 }
6093 static after(start, duration) {
6094 const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(start);
6095 return Interval.fromDateTimes(dt, dt.plus(dur));
6096 }
6097 static before(end, duration) {
6098 const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(end);
6099 return Interval.fromDateTimes(dt.minus(dur), dt);
6100 }
6101 static fromISO(text, opts) {
6102 const [s2, e] = (text || "").split("/", 2);
6103 if (s2 && e) {
6104 let start, startIsValid;
6105 try {
6106 start = DateTime.fromISO(s2, opts);
6107 startIsValid = start.isValid;
6108 } catch (e2) {
6109 startIsValid = false;
6110 }
6111 let end, endIsValid;
6112 try {
6113 end = DateTime.fromISO(e, opts);
6114 endIsValid = end.isValid;
6115 } catch (e2) {
6116 endIsValid = false;
6117 }
6118 if (startIsValid && endIsValid) {
6119 return Interval.fromDateTimes(start, end);
6120 }
6121 if (startIsValid) {
6122 const dur = Duration.fromISO(e, opts);
6123 if (dur.isValid) {
6124 return Interval.after(start, dur);
6125 }
6126 } else if (endIsValid) {
6127 const dur = Duration.fromISO(s2, opts);
6128 if (dur.isValid) {
6129 return Interval.before(end, dur);
6130 }
6131 }
6132 }
6133 return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
6134 }
6135 static isInterval(o) {
6136 return o && o.isLuxonInterval || false;
6137 }
6138 get start() {
6139 return this.isValid ? this.s : null;
6140 }
6141 get end() {
6142 return this.isValid ? this.e : null;
6143 }
6144 get isValid() {
6145 return this.invalidReason === null;
6146 }
6147 get invalidReason() {
6148 return this.invalid ? this.invalid.reason : null;
6149 }
6150 get invalidExplanation() {
6151 return this.invalid ? this.invalid.explanation : null;
6152 }
6153 length(unit = "milliseconds") {
6154 return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;
6155 }
6156 count(unit = "milliseconds") {
6157 if (!this.isValid)
6158 return NaN;
6159 const start = this.start.startOf(unit), end = this.end.startOf(unit);
6160 return Math.floor(end.diff(start, unit).get(unit)) + 1;
6161 }
6162 hasSame(unit) {
6163 return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
6164 }
6165 isEmpty() {
6166 return this.s.valueOf() === this.e.valueOf();
6167 }
6168 isAfter(dateTime) {
6169 if (!this.isValid)
6170 return false;
6171 return this.s > dateTime;
6172 }
6173 isBefore(dateTime) {
6174 if (!this.isValid)
6175 return false;
6176 return this.e <= dateTime;
6177 }
6178 contains(dateTime) {
6179 if (!this.isValid)
6180 return false;
6181 return this.s <= dateTime && this.e > dateTime;
6182 }
6183 set({ start, end } = {}) {
6184 if (!this.isValid)
6185 return this;
6186 return Interval.fromDateTimes(start || this.s, end || this.e);
6187 }
6188 splitAt(...dateTimes) {
6189 if (!this.isValid)
6190 return [];
6191 const sorted = dateTimes.map(friendlyDateTime).filter((d) => this.contains(d)).sort(), results = [];
6192 let { s: s2 } = this, i = 0;
6193 while (s2 < this.e) {
6194 const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added;
6195 results.push(Interval.fromDateTimes(s2, next));
6196 s2 = next;
6197 i += 1;
6198 }
6199 return results;
6200 }
6201 splitBy(duration) {
6202 const dur = Duration.fromDurationLike(duration);
6203 if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) {
6204 return [];
6205 }
6206 let { s: s2 } = this, idx = 1, next;
6207 const results = [];
6208 while (s2 < this.e) {
6209 const added = this.start.plus(dur.mapUnits((x) => x * idx));
6210 next = +added > +this.e ? this.e : added;
6211 results.push(Interval.fromDateTimes(s2, next));
6212 s2 = next;
6213 idx += 1;
6214 }
6215 return results;
6216 }
6217 divideEqually(numberOfParts) {
6218 if (!this.isValid)
6219 return [];
6220 return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
6221 }
6222 overlaps(other) {
6223 return this.e > other.s && this.s < other.e;
6224 }
6225 abutsStart(other) {
6226 if (!this.isValid)
6227 return false;
6228 return +this.e === +other.s;
6229 }
6230 abutsEnd(other) {
6231 if (!this.isValid)
6232 return false;
6233 return +other.e === +this.s;
6234 }
6235 engulfs(other) {
6236 if (!this.isValid)
6237 return false;
6238 return this.s <= other.s && this.e >= other.e;
6239 }
6240 equals(other) {
6241 if (!this.isValid || !other.isValid) {
6242 return false;
6243 }
6244 return this.s.equals(other.s) && this.e.equals(other.e);
6245 }
6246 intersection(other) {
6247 if (!this.isValid)
6248 return this;
6249 const s2 = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e;
6250 if (s2 >= e) {
6251 return null;
6252 } else {
6253 return Interval.fromDateTimes(s2, e);
6254 }
6255 }
6256 union(other) {
6257 if (!this.isValid)
6258 return this;
6259 const s2 = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e;
6260 return Interval.fromDateTimes(s2, e);
6261 }
6262 static merge(intervals) {
6263 const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(
6264 ([sofar, current], item) => {
6265 if (!current) {
6266 return [sofar, item];
6267 } else if (current.overlaps(item) || current.abutsStart(item)) {
6268 return [sofar, current.union(item)];
6269 } else {
6270 return [sofar.concat([current]), item];
6271 }
6272 },
6273 [[], null]
6274 );
6275 if (final) {
6276 found.push(final);
6277 }
6278 return found;
6279 }
6280 static xor(intervals) {
6281 let start = null, currentCount = 0;
6282 const results = [], ends = intervals.map((i) => [
6283 { time: i.s, type: "s" },
6284 { time: i.e, type: "e" }
6285 ]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a, b) => a.time - b.time);
6286 for (const i of arr) {
6287 currentCount += i.type === "s" ? 1 : -1;
6288 if (currentCount === 1) {
6289 start = i.time;
6290 } else {
6291 if (start && +start !== +i.time) {
6292 results.push(Interval.fromDateTimes(start, i.time));
6293 }
6294 start = null;
6295 }
6296 }
6297 return Interval.merge(results);
6298 }
6299 difference(...intervals) {
6300 return Interval.xor([this].concat(intervals)).map((i) => this.intersection(i)).filter((i) => i && !i.isEmpty());
6301 }
6302 toString() {
6303 if (!this.isValid)
6304 return INVALID3;
6305 return `[${this.s.toISO()} \u2013 ${this.e.toISO()})`;
6306 }
6307 toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
6308 return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID3;
6309 }
6310 toISO(opts) {
6311 if (!this.isValid)
6312 return INVALID3;
6313 return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;
6314 }
6315 toISODate() {
6316 if (!this.isValid)
6317 return INVALID3;
6318 return `${this.s.toISODate()}/${this.e.toISODate()}`;
6319 }
6320 toISOTime(opts) {
6321 if (!this.isValid)
6322 return INVALID3;
6323 return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;
6324 }
6325 toFormat(dateFormat, { separator = " \u2013 " } = {}) {
6326 if (!this.isValid)
6327 return INVALID3;
6328 return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;
6329 }
6330 toDuration(unit, opts) {
6331 if (!this.isValid) {
6332 return Duration.invalid(this.invalidReason);
6333 }
6334 return this.e.diff(this.s, unit, opts);
6335 }
6336 mapEndpoints(mapFn) {
6337 return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
6338 }
6339};
6340
6341// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/info.js
6342var Info = class {
6343 static hasDST(zone = Settings.defaultZone) {
6344 const proto = DateTime.now().setZone(zone).set({ month: 12 });
6345 return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;
6346 }
6347 static isValidIANAZone(zone) {
6348 return IANAZone.isValidZone(zone);
6349 }
6350 static normalizeZone(input) {
6351 return normalizeZone(input, Settings.defaultZone);
6352 }
6353 static months(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
6354 return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
6355 }
6356 static monthsFormat(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
6357 return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
6358 }
6359 static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
6360 return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
6361 }
6362 static weekdaysFormat(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
6363 return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
6364 }
6365 static meridiems({ locale = null } = {}) {
6366 return Locale.create(locale).meridiems();
6367 }
6368 static eras(length = "short", { locale = null } = {}) {
6369 return Locale.create(locale, null, "gregory").eras(length);
6370 }
6371 static features() {
6372 return { relative: hasRelative() };
6373 }
6374};
6375
6376// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/diff.js
6377function dayDiff(earlier, later) {
6378 const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
6379 return Math.floor(Duration.fromMillis(ms).as("days"));
6380}
6381function highOrderDiffs(cursor, later, units) {
6382 const differs = [
6383 ["years", (a, b) => b.year - a.year],
6384 ["quarters", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],
6385 ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12],
6386 [
6387 "weeks",
6388 (a, b) => {
6389 const days = dayDiff(a, b);
6390 return (days - days % 7) / 7;
6391 }
6392 ],
6393 ["days", dayDiff]
6394 ];
6395 const results = {};
6396 const earlier = cursor;
6397 let lowestOrder, highWater;
6398 for (const [unit, differ] of differs) {
6399 if (units.indexOf(unit) >= 0) {
6400 lowestOrder = unit;
6401 results[unit] = differ(cursor, later);
6402 highWater = earlier.plus(results);
6403 if (highWater > later) {
6404 results[unit]--;
6405 cursor = earlier.plus(results);
6406 } else {
6407 cursor = highWater;
6408 }
6409 }
6410 }
6411 return [cursor, results, highWater, lowestOrder];
6412}
6413function diff_default(earlier, later, units, opts) {
6414 let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);
6415 const remainingMillis = later - cursor;
6416 const lowerOrderUnits = units.filter(
6417 (u) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0
6418 );
6419 if (lowerOrderUnits.length === 0) {
6420 if (highWater < later) {
6421 highWater = cursor.plus({ [lowestOrder]: 1 });
6422 }
6423 if (highWater !== cursor) {
6424 results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
6425 }
6426 }
6427 const duration = Duration.fromObject(results, opts);
6428 if (lowerOrderUnits.length > 0) {
6429 return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration);
6430 } else {
6431 return duration;
6432 }
6433}
6434
6435// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/digits.js
6436var numberingSystems = {
6437 arab: "[\u0660-\u0669]",
6438 arabext: "[\u06F0-\u06F9]",
6439 bali: "[\u1B50-\u1B59]",
6440 beng: "[\u09E6-\u09EF]",
6441 deva: "[\u0966-\u096F]",
6442 fullwide: "[\uFF10-\uFF19]",
6443 gujr: "[\u0AE6-\u0AEF]",
6444 hanidec: "[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",
6445 khmr: "[\u17E0-\u17E9]",
6446 knda: "[\u0CE6-\u0CEF]",
6447 laoo: "[\u0ED0-\u0ED9]",
6448 limb: "[\u1946-\u194F]",
6449 mlym: "[\u0D66-\u0D6F]",
6450 mong: "[\u1810-\u1819]",
6451 mymr: "[\u1040-\u1049]",
6452 orya: "[\u0B66-\u0B6F]",
6453 tamldec: "[\u0BE6-\u0BEF]",
6454 telu: "[\u0C66-\u0C6F]",
6455 thai: "[\u0E50-\u0E59]",
6456 tibt: "[\u0F20-\u0F29]",
6457 latn: "\\d"
6458};
6459var numberingSystemsUTF16 = {
6460 arab: [1632, 1641],
6461 arabext: [1776, 1785],
6462 bali: [6992, 7001],
6463 beng: [2534, 2543],
6464 deva: [2406, 2415],
6465 fullwide: [65296, 65303],
6466 gujr: [2790, 2799],
6467 khmr: [6112, 6121],
6468 knda: [3302, 3311],
6469 laoo: [3792, 3801],
6470 limb: [6470, 6479],
6471 mlym: [3430, 3439],
6472 mong: [6160, 6169],
6473 mymr: [4160, 4169],
6474 orya: [2918, 2927],
6475 tamldec: [3046, 3055],
6476 telu: [3174, 3183],
6477 thai: [3664, 3673],
6478 tibt: [3872, 3881]
6479};
6480var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
6481function parseDigits(str) {
6482 let value = parseInt(str, 10);
6483 if (isNaN(value)) {
6484 value = "";
6485 for (let i = 0; i < str.length; i++) {
6486 const code = str.charCodeAt(i);
6487 if (str[i].search(numberingSystems.hanidec) !== -1) {
6488 value += hanidecChars.indexOf(str[i]);
6489 } else {
6490 for (const key in numberingSystemsUTF16) {
6491 const [min, max] = numberingSystemsUTF16[key];
6492 if (code >= min && code <= max) {
6493 value += code - min;
6494 }
6495 }
6496 }
6497 }
6498 return parseInt(value, 10);
6499 } else {
6500 return value;
6501 }
6502}
6503function digitRegex({ numberingSystem }, append = "") {
6504 return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`);
6505}
6506
6507// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/tokenParser.js
6508var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
6509function intUnit(regex, post = (i) => i) {
6510 return { regex, deser: ([s2]) => post(parseDigits(s2)) };
6511}
6512var NBSP = String.fromCharCode(160);
6513var spaceOrNBSP = `[ ${NBSP}]`;
6514var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
6515function fixListRegex(s2) {
6516 return s2.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
6517}
6518function stripInsensitivities(s2) {
6519 return s2.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
6520}
6521function oneOf(strings, startIndex) {
6522 if (strings === null) {
6523 return null;
6524 } else {
6525 return {
6526 regex: RegExp(strings.map(fixListRegex).join("|")),
6527 deser: ([s2]) => strings.findIndex((i) => stripInsensitivities(s2) === stripInsensitivities(i)) + startIndex
6528 };
6529 }
6530}
6531function offset(regex, groups) {
6532 return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };
6533}
6534function simple(regex) {
6535 return { regex, deser: ([s2]) => s2 };
6536}
6537function escapeToken(value) {
6538 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
6539}
6540function unitForToken(token, loc) {
6541 const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s2]) => s2, literal: true }), unitate = (t) => {
6542 if (token.literal) {
6543 return literal(t);
6544 }
6545 switch (t.val) {
6546 case "G":
6547 return oneOf(loc.eras("short", false), 0);
6548 case "GG":
6549 return oneOf(loc.eras("long", false), 0);
6550 case "y":
6551 return intUnit(oneToSix);
6552 case "yy":
6553 return intUnit(twoToFour, untruncateYear);
6554 case "yyyy":
6555 return intUnit(four);
6556 case "yyyyy":
6557 return intUnit(fourToSix);
6558 case "yyyyyy":
6559 return intUnit(six);
6560 case "M":
6561 return intUnit(oneOrTwo);
6562 case "MM":
6563 return intUnit(two);
6564 case "MMM":
6565 return oneOf(loc.months("short", true, false), 1);
6566 case "MMMM":
6567 return oneOf(loc.months("long", true, false), 1);
6568 case "L":
6569 return intUnit(oneOrTwo);
6570 case "LL":
6571 return intUnit(two);
6572 case "LLL":
6573 return oneOf(loc.months("short", false, false), 1);
6574 case "LLLL":
6575 return oneOf(loc.months("long", false, false), 1);
6576 case "d":
6577 return intUnit(oneOrTwo);
6578 case "dd":
6579 return intUnit(two);
6580 case "o":
6581 return intUnit(oneToThree);
6582 case "ooo":
6583 return intUnit(three);
6584 case "HH":
6585 return intUnit(two);
6586 case "H":
6587 return intUnit(oneOrTwo);
6588 case "hh":
6589 return intUnit(two);
6590 case "h":
6591 return intUnit(oneOrTwo);
6592 case "mm":
6593 return intUnit(two);
6594 case "m":
6595 return intUnit(oneOrTwo);
6596 case "q":
6597 return intUnit(oneOrTwo);
6598 case "qq":
6599 return intUnit(two);
6600 case "s":
6601 return intUnit(oneOrTwo);
6602 case "ss":
6603 return intUnit(two);
6604 case "S":
6605 return intUnit(oneToThree);
6606 case "SSS":
6607 return intUnit(three);
6608 case "u":
6609 return simple(oneToNine);
6610 case "uu":
6611 return simple(oneOrTwo);
6612 case "uuu":
6613 return intUnit(one);
6614 case "a":
6615 return oneOf(loc.meridiems(), 0);
6616 case "kkkk":
6617 return intUnit(four);
6618 case "kk":
6619 return intUnit(twoToFour, untruncateYear);
6620 case "W":
6621 return intUnit(oneOrTwo);
6622 case "WW":
6623 return intUnit(two);
6624 case "E":
6625 case "c":
6626 return intUnit(one);
6627 case "EEE":
6628 return oneOf(loc.weekdays("short", false, false), 1);
6629 case "EEEE":
6630 return oneOf(loc.weekdays("long", false, false), 1);
6631 case "ccc":
6632 return oneOf(loc.weekdays("short", true, false), 1);
6633 case "cccc":
6634 return oneOf(loc.weekdays("long", true, false), 1);
6635 case "Z":
6636 case "ZZ":
6637 return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);
6638 case "ZZZ":
6639 return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);
6640 case "z":
6641 return simple(/[a-z_+-/]{1,256}?/i);
6642 default:
6643 return literal(t);
6644 }
6645 };
6646 const unit = unitate(token) || {
6647 invalidReason: MISSING_FTP
6648 };
6649 unit.token = token;
6650 return unit;
6651}
6652var partTypeStyleToTokenVal = {
6653 year: {
6654 "2-digit": "yy",
6655 numeric: "yyyyy"
6656 },
6657 month: {
6658 numeric: "M",
6659 "2-digit": "MM",
6660 short: "MMM",
6661 long: "MMMM"
6662 },
6663 day: {
6664 numeric: "d",
6665 "2-digit": "dd"
6666 },
6667 weekday: {
6668 short: "EEE",
6669 long: "EEEE"
6670 },
6671 dayperiod: "a",
6672 dayPeriod: "a",
6673 hour: {
6674 numeric: "h",
6675 "2-digit": "hh"
6676 },
6677 minute: {
6678 numeric: "m",
6679 "2-digit": "mm"
6680 },
6681 second: {
6682 numeric: "s",
6683 "2-digit": "ss"
6684 },
6685 timeZoneName: {
6686 long: "ZZZZZ",
6687 short: "ZZZ"
6688 }
6689};
6690function tokenForPart(part, formatOpts) {
6691 const { type, value } = part;
6692 if (type === "literal") {
6693 return {
6694 literal: true,
6695 val: value
6696 };
6697 }
6698 const style = formatOpts[type];
6699 let val = partTypeStyleToTokenVal[type];
6700 if (typeof val === "object") {
6701 val = val[style];
6702 }
6703 if (val) {
6704 return {
6705 literal: false,
6706 val
6707 };
6708 }
6709 return void 0;
6710}
6711function buildRegex(units) {
6712 const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, "");
6713 return [`^${re}$`, units];
6714}
6715function match(input, regex, handlers) {
6716 const matches = input.match(regex);
6717 if (matches) {
6718 const all = {};
6719 let matchIndex = 1;
6720 for (const i in handlers) {
6721 if (hasOwnProperty(handlers, i)) {
6722 const h = handlers[i], groups = h.groups ? h.groups + 1 : 1;
6723 if (!h.literal && h.token) {
6724 all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));
6725 }
6726 matchIndex += groups;
6727 }
6728 }
6729 return [matches, all];
6730 } else {
6731 return [matches, {}];
6732 }
6733}
6734function dateTimeFromMatches(matches) {
6735 const toField = (token) => {
6736 switch (token) {
6737 case "S":
6738 return "millisecond";
6739 case "s":
6740 return "second";
6741 case "m":
6742 return "minute";
6743 case "h":
6744 case "H":
6745 return "hour";
6746 case "d":
6747 return "day";
6748 case "o":
6749 return "ordinal";
6750 case "L":
6751 case "M":
6752 return "month";
6753 case "y":
6754 return "year";
6755 case "E":
6756 case "c":
6757 return "weekday";
6758 case "W":
6759 return "weekNumber";
6760 case "k":
6761 return "weekYear";
6762 case "q":
6763 return "quarter";
6764 default:
6765 return null;
6766 }
6767 };
6768 let zone = null;
6769 let specificOffset;
6770 if (!isUndefined(matches.z)) {
6771 zone = IANAZone.create(matches.z);
6772 }
6773 if (!isUndefined(matches.Z)) {
6774 if (!zone) {
6775 zone = new FixedOffsetZone(matches.Z);
6776 }
6777 specificOffset = matches.Z;
6778 }
6779 if (!isUndefined(matches.q)) {
6780 matches.M = (matches.q - 1) * 3 + 1;
6781 }
6782 if (!isUndefined(matches.h)) {
6783 if (matches.h < 12 && matches.a === 1) {
6784 matches.h += 12;
6785 } else if (matches.h === 12 && matches.a === 0) {
6786 matches.h = 0;
6787 }
6788 }
6789 if (matches.G === 0 && matches.y) {
6790 matches.y = -matches.y;
6791 }
6792 if (!isUndefined(matches.u)) {
6793 matches.S = parseMillis(matches.u);
6794 }
6795 const vals = Object.keys(matches).reduce((r, k) => {
6796 const f = toField(k);
6797 if (f) {
6798 r[f] = matches[k];
6799 }
6800 return r;
6801 }, {});
6802 return [vals, zone, specificOffset];
6803}
6804var dummyDateTimeCache = null;
6805function getDummyDateTime() {
6806 if (!dummyDateTimeCache) {
6807 dummyDateTimeCache = DateTime.fromMillis(1555555555555);
6808 }
6809 return dummyDateTimeCache;
6810}
6811function maybeExpandMacroToken(token, locale) {
6812 if (token.literal) {
6813 return token;
6814 }
6815 const formatOpts = Formatter.macroTokenToFormatOpts(token.val);
6816 const tokens = formatOptsToTokens(formatOpts, locale);
6817 if (tokens == null || tokens.includes(void 0)) {
6818 return token;
6819 }
6820 return tokens;
6821}
6822function expandMacroTokens(tokens, locale) {
6823 return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));
6824}
6825function explainFromTokens(locale, input, format) {
6826 const tokens = expandMacroTokens(Formatter.parseFormat(format), locale), units = tokens.map((t) => unitForToken(t, locale)), disqualifyingUnit = units.find((t) => t.invalidReason);
6827 if (disqualifyingUnit) {
6828 return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };
6829 } else {
6830 const [regexString, handlers] = buildRegex(units), regex = RegExp(regexString, "i"), [rawMatches, matches] = match(input, regex, handlers), [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [null, null, void 0];
6831 if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) {
6832 throw new ConflictingSpecificationError(
6833 "Can't include meridiem when specifying 24-hour format"
6834 );
6835 }
6836 return { input, tokens, regex, rawMatches, matches, result, zone, specificOffset };
6837 }
6838}
6839function parseFromTokens(locale, input, format) {
6840 const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);
6841 return [result, zone, specificOffset, invalidReason];
6842}
6843function formatOptsToTokens(formatOpts, locale) {
6844 if (!formatOpts) {
6845 return null;
6846 }
6847 const formatter = Formatter.create(locale, formatOpts);
6848 const parts = formatter.formatDateTimeParts(getDummyDateTime());
6849 return parts.map((p) => tokenForPart(p, formatOpts));
6850}
6851
6852// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/conversions.js
6853var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
6854var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
6855function unitOutOfRange(unit, value) {
6856 return new Invalid(
6857 "unit out of range",
6858 `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`
6859 );
6860}
6861function dayOfWeek(year, month, day) {
6862 const d = new Date(Date.UTC(year, month - 1, day));
6863 if (year < 100 && year >= 0) {
6864 d.setUTCFullYear(d.getUTCFullYear() - 1900);
6865 }
6866 const js = d.getUTCDay();
6867 return js === 0 ? 7 : js;
6868}
6869function computeOrdinal(year, month, day) {
6870 return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
6871}
6872function uncomputeOrdinal(year, ordinal) {
6873 const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i) => i < ordinal), day = ordinal - table[month0];
6874 return { month: month0 + 1, day };
6875}
6876function gregorianToWeek(gregObj) {
6877 const { year, month, day } = gregObj, ordinal = computeOrdinal(year, month, day), weekday = dayOfWeek(year, month, day);
6878 let weekNumber = Math.floor((ordinal - weekday + 10) / 7), weekYear;
6879 if (weekNumber < 1) {
6880 weekYear = year - 1;
6881 weekNumber = weeksInWeekYear(weekYear);
6882 } else if (weekNumber > weeksInWeekYear(year)) {
6883 weekYear = year + 1;
6884 weekNumber = 1;
6885 } else {
6886 weekYear = year;
6887 }
6888 return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };
6889}
6890function weekToGregorian(weekData) {
6891 const { weekYear, weekNumber, weekday } = weekData, weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), yearInDays = daysInYear(weekYear);
6892 let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, year;
6893 if (ordinal < 1) {
6894 year = weekYear - 1;
6895 ordinal += daysInYear(year);
6896 } else if (ordinal > yearInDays) {
6897 year = weekYear + 1;
6898 ordinal -= daysInYear(weekYear);
6899 } else {
6900 year = weekYear;
6901 }
6902 const { month, day } = uncomputeOrdinal(year, ordinal);
6903 return { year, month, day, ...timeObject(weekData) };
6904}
6905function gregorianToOrdinal(gregData) {
6906 const { year, month, day } = gregData;
6907 const ordinal = computeOrdinal(year, month, day);
6908 return { year, ordinal, ...timeObject(gregData) };
6909}
6910function ordinalToGregorian(ordinalData) {
6911 const { year, ordinal } = ordinalData;
6912 const { month, day } = uncomputeOrdinal(year, ordinal);
6913 return { year, month, day, ...timeObject(ordinalData) };
6914}
6915function hasInvalidWeekData(obj) {
6916 const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), validWeekday = integerBetween(obj.weekday, 1, 7);
6917 if (!validYear) {
6918 return unitOutOfRange("weekYear", obj.weekYear);
6919 } else if (!validWeek) {
6920 return unitOutOfRange("week", obj.week);
6921 } else if (!validWeekday) {
6922 return unitOutOfRange("weekday", obj.weekday);
6923 } else
6924 return false;
6925}
6926function hasInvalidOrdinalData(obj) {
6927 const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
6928 if (!validYear) {
6929 return unitOutOfRange("year", obj.year);
6930 } else if (!validOrdinal) {
6931 return unitOutOfRange("ordinal", obj.ordinal);
6932 } else
6933 return false;
6934}
6935function hasInvalidGregorianData(obj) {
6936 const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
6937 if (!validYear) {
6938 return unitOutOfRange("year", obj.year);
6939 } else if (!validMonth) {
6940 return unitOutOfRange("month", obj.month);
6941 } else if (!validDay) {
6942 return unitOutOfRange("day", obj.day);
6943 } else
6944 return false;
6945}
6946function hasInvalidTimeData(obj) {
6947 const { hour, minute, second, millisecond } = obj;
6948 const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999);
6949 if (!validHour) {
6950 return unitOutOfRange("hour", hour);
6951 } else if (!validMinute) {
6952 return unitOutOfRange("minute", minute);
6953 } else if (!validSecond) {
6954 return unitOutOfRange("second", second);
6955 } else if (!validMillisecond) {
6956 return unitOutOfRange("millisecond", millisecond);
6957 } else
6958 return false;
6959}
6960
6961// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/datetime.js
6962var INVALID4 = "Invalid DateTime";
6963var MAX_DATE = 864e13;
6964function unsupportedZone(zone) {
6965 return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
6966}
6967function possiblyCachedWeekData(dt) {
6968 if (dt.weekData === null) {
6969 dt.weekData = gregorianToWeek(dt.c);
6970 }
6971 return dt.weekData;
6972}
6973function clone2(inst, alts) {
6974 const current = {
6975 ts: inst.ts,
6976 zone: inst.zone,
6977 c: inst.c,
6978 o: inst.o,
6979 loc: inst.loc,
6980 invalid: inst.invalid
6981 };
6982 return new DateTime({ ...current, ...alts, old: current });
6983}
6984function fixOffset(localTS, o, tz) {
6985 let utcGuess = localTS - o * 60 * 1e3;
6986 const o2 = tz.offset(utcGuess);
6987 if (o === o2) {
6988 return [utcGuess, o];
6989 }
6990 utcGuess -= (o2 - o) * 60 * 1e3;
6991 const o3 = tz.offset(utcGuess);
6992 if (o2 === o3) {
6993 return [utcGuess, o2];
6994 }
6995 return [localTS - Math.min(o2, o3) * 60 * 1e3, Math.max(o2, o3)];
6996}
6997function tsToObj(ts, offset2) {
6998 ts += offset2 * 60 * 1e3;
6999 const d = new Date(ts);
7000 return {
7001 year: d.getUTCFullYear(),
7002 month: d.getUTCMonth() + 1,
7003 day: d.getUTCDate(),
7004 hour: d.getUTCHours(),
7005 minute: d.getUTCMinutes(),
7006 second: d.getUTCSeconds(),
7007 millisecond: d.getUTCMilliseconds()
7008 };
7009}
7010function objToTS(obj, offset2, zone) {
7011 return fixOffset(objToLocalTS(obj), offset2, zone);
7012}
7013function adjustTime(inst, dur) {
7014 const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c = {
7015 ...inst.c,
7016 year,
7017 month,
7018 day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7
7019 }, millisToAdd = Duration.fromObject({
7020 years: dur.years - Math.trunc(dur.years),
7021 quarters: dur.quarters - Math.trunc(dur.quarters),
7022 months: dur.months - Math.trunc(dur.months),
7023 weeks: dur.weeks - Math.trunc(dur.weeks),
7024 days: dur.days - Math.trunc(dur.days),
7025 hours: dur.hours,
7026 minutes: dur.minutes,
7027 seconds: dur.seconds,
7028 milliseconds: dur.milliseconds
7029 }).as("milliseconds"), localTS = objToLocalTS(c);
7030 let [ts, o] = fixOffset(localTS, oPre, inst.zone);
7031 if (millisToAdd !== 0) {
7032 ts += millisToAdd;
7033 o = inst.zone.offset(ts);
7034 }
7035 return { ts, o };
7036}
7037function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {
7038 const { setZone, zone } = opts;
7039 if (parsed && Object.keys(parsed).length !== 0) {
7040 const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, {
7041 ...opts,
7042 zone: interpretationZone,
7043 specificOffset
7044 });
7045 return setZone ? inst : inst.setZone(zone);
7046 } else {
7047 return DateTime.invalid(
7048 new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
7049 );
7050 }
7051}
7052function toTechFormat(dt, format, allowZ = true) {
7053 return dt.isValid ? Formatter.create(Locale.create("en-US"), {
7054 allowZ,
7055 forceSimple: true
7056 }).formatDateTimeFromString(dt, format) : null;
7057}
7058function toISODate(o, extended) {
7059 const longFormat = o.c.year > 9999 || o.c.year < 0;
7060 let c = "";
7061 if (longFormat && o.c.year >= 0)
7062 c += "+";
7063 c += padStart(o.c.year, longFormat ? 6 : 4);
7064 if (extended) {
7065 c += "-";
7066 c += padStart(o.c.month);
7067 c += "-";
7068 c += padStart(o.c.day);
7069 } else {
7070 c += padStart(o.c.month);
7071 c += padStart(o.c.day);
7072 }
7073 return c;
7074}
7075function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone) {
7076 let c = padStart(o.c.hour);
7077 if (extended) {
7078 c += ":";
7079 c += padStart(o.c.minute);
7080 if (o.c.second !== 0 || !suppressSeconds) {
7081 c += ":";
7082 }
7083 } else {
7084 c += padStart(o.c.minute);
7085 }
7086 if (o.c.second !== 0 || !suppressSeconds) {
7087 c += padStart(o.c.second);
7088 if (o.c.millisecond !== 0 || !suppressMilliseconds) {
7089 c += ".";
7090 c += padStart(o.c.millisecond, 3);
7091 }
7092 }
7093 if (includeOffset) {
7094 if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {
7095 c += "Z";
7096 } else if (o.o < 0) {
7097 c += "-";
7098 c += padStart(Math.trunc(-o.o / 60));
7099 c += ":";
7100 c += padStart(Math.trunc(-o.o % 60));
7101 } else {
7102 c += "+";
7103 c += padStart(Math.trunc(o.o / 60));
7104 c += ":";
7105 c += padStart(Math.trunc(o.o % 60));
7106 }
7107 }
7108 if (extendedZone) {
7109 c += "[" + o.zone.ianaName + "]";
7110 }
7111 return c;
7112}
7113var defaultUnitValues = {
7114 month: 1,
7115 day: 1,
7116 hour: 0,
7117 minute: 0,
7118 second: 0,
7119 millisecond: 0
7120};
7121var defaultWeekUnitValues = {
7122 weekNumber: 1,
7123 weekday: 1,
7124 hour: 0,
7125 minute: 0,
7126 second: 0,
7127 millisecond: 0
7128};
7129var defaultOrdinalUnitValues = {
7130 ordinal: 1,
7131 hour: 0,
7132 minute: 0,
7133 second: 0,
7134 millisecond: 0
7135};
7136var orderedUnits2 = ["year", "month", "day", "hour", "minute", "second", "millisecond"];
7137var orderedWeekUnits = [
7138 "weekYear",
7139 "weekNumber",
7140 "weekday",
7141 "hour",
7142 "minute",
7143 "second",
7144 "millisecond"
7145];
7146var orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
7147function normalizeUnit(unit) {
7148 const normalized = {
7149 year: "year",
7150 years: "year",
7151 month: "month",
7152 months: "month",
7153 day: "day",
7154 days: "day",
7155 hour: "hour",
7156 hours: "hour",
7157 minute: "minute",
7158 minutes: "minute",
7159 quarter: "quarter",
7160 quarters: "quarter",
7161 second: "second",
7162 seconds: "second",
7163 millisecond: "millisecond",
7164 milliseconds: "millisecond",
7165 weekday: "weekday",
7166 weekdays: "weekday",
7167 weeknumber: "weekNumber",
7168 weeksnumber: "weekNumber",
7169 weeknumbers: "weekNumber",
7170 weekyear: "weekYear",
7171 weekyears: "weekYear",
7172 ordinal: "ordinal"
7173 }[unit.toLowerCase()];
7174 if (!normalized)
7175 throw new InvalidUnitError(unit);
7176 return normalized;
7177}
7178function quickDT(obj, opts) {
7179 const zone = normalizeZone(opts.zone, Settings.defaultZone), loc = Locale.fromObject(opts), tsNow = Settings.now();
7180 let ts, o;
7181 if (!isUndefined(obj.year)) {
7182 for (const u of orderedUnits2) {
7183 if (isUndefined(obj[u])) {
7184 obj[u] = defaultUnitValues[u];
7185 }
7186 }
7187 const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
7188 if (invalid) {
7189 return DateTime.invalid(invalid);
7190 }
7191 const offsetProvis = zone.offset(tsNow);
7192 [ts, o] = objToTS(obj, offsetProvis, zone);
7193 } else {
7194 ts = tsNow;
7195 }
7196 return new DateTime({ ts, zone, loc, o });
7197}
7198function diffRelative(start, end, opts) {
7199 const round = isUndefined(opts.round) ? true : opts.round, format = (c, unit) => {
7200 c = roundTo(c, round || opts.calendary ? 0 : 2, true);
7201 const formatter = end.loc.clone(opts).relFormatter(opts);
7202 return formatter.format(c, unit);
7203 }, differ = (unit) => {
7204 if (opts.calendary) {
7205 if (!end.hasSame(start, unit)) {
7206 return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);
7207 } else
7208 return 0;
7209 } else {
7210 return end.diff(start, unit).get(unit);
7211 }
7212 };
7213 if (opts.unit) {
7214 return format(differ(opts.unit), opts.unit);
7215 }
7216 for (const unit of opts.units) {
7217 const count = differ(unit);
7218 if (Math.abs(count) >= 1) {
7219 return format(count, unit);
7220 }
7221 }
7222 return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
7223}
7224function lastOpts(argList) {
7225 let opts = {}, args;
7226 if (argList.length > 0 && typeof argList[argList.length - 1] === "object") {
7227 opts = argList[argList.length - 1];
7228 args = Array.from(argList).slice(0, argList.length - 1);
7229 } else {
7230 args = Array.from(argList);
7231 }
7232 return [opts, args];
7233}
7234var DateTime = class {
7235 constructor(config) {
7236 const zone = config.zone || Settings.defaultZone;
7237 let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
7238 this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
7239 let c = null, o = null;
7240 if (!invalid) {
7241 const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
7242 if (unchanged) {
7243 [c, o] = [config.old.c, config.old.o];
7244 } else {
7245 const ot = zone.offset(this.ts);
7246 c = tsToObj(this.ts, ot);
7247 invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null;
7248 c = invalid ? null : c;
7249 o = invalid ? null : ot;
7250 }
7251 }
7252 this._zone = zone;
7253 this.loc = config.loc || Locale.create();
7254 this.invalid = invalid;
7255 this.weekData = null;
7256 this.c = c;
7257 this.o = o;
7258 this.isLuxonDateTime = true;
7259 }
7260 static now() {
7261 return new DateTime({});
7262 }
7263 static local() {
7264 const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
7265 return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);
7266 }
7267 static utc() {
7268 const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
7269 opts.zone = FixedOffsetZone.utcInstance;
7270 return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);
7271 }
7272 static fromJSDate(date, options = {}) {
7273 const ts = isDate(date) ? date.valueOf() : NaN;
7274 if (Number.isNaN(ts)) {
7275 return DateTime.invalid("invalid input");
7276 }
7277 const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
7278 if (!zoneToUse.isValid) {
7279 return DateTime.invalid(unsupportedZone(zoneToUse));
7280 }
7281 return new DateTime({
7282 ts,
7283 zone: zoneToUse,
7284 loc: Locale.fromObject(options)
7285 });
7286 }
7287 static fromMillis(milliseconds, options = {}) {
7288 if (!isNumber(milliseconds)) {
7289 throw new InvalidArgumentError(
7290 `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`
7291 );
7292 } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {
7293 return DateTime.invalid("Timestamp out of range");
7294 } else {
7295 return new DateTime({
7296 ts: milliseconds,
7297 zone: normalizeZone(options.zone, Settings.defaultZone),
7298 loc: Locale.fromObject(options)
7299 });
7300 }
7301 }
7302 static fromSeconds(seconds, options = {}) {
7303 if (!isNumber(seconds)) {
7304 throw new InvalidArgumentError("fromSeconds requires a numerical input");
7305 } else {
7306 return new DateTime({
7307 ts: seconds * 1e3,
7308 zone: normalizeZone(options.zone, Settings.defaultZone),
7309 loc: Locale.fromObject(options)
7310 });
7311 }
7312 }
7313 static fromObject(obj, opts = {}) {
7314 obj = obj || {};
7315 const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);
7316 if (!zoneToUse.isValid) {
7317 return DateTime.invalid(unsupportedZone(zoneToUse));
7318 }
7319 const tsNow = Settings.now(), offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), normalized = normalizeObject(obj, normalizeUnit), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber, loc = Locale.fromObject(opts);
7320 if ((containsGregor || containsOrdinal) && definiteWeekDef) {
7321 throw new ConflictingSpecificationError(
7322 "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
7323 );
7324 }
7325 if (containsGregorMD && containsOrdinal) {
7326 throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
7327 }
7328 const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
7329 let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis);
7330 if (useWeekData) {
7331 units = orderedWeekUnits;
7332 defaultValues = defaultWeekUnitValues;
7333 objNow = gregorianToWeek(objNow);
7334 } else if (containsOrdinal) {
7335 units = orderedOrdinalUnits;
7336 defaultValues = defaultOrdinalUnitValues;
7337 objNow = gregorianToOrdinal(objNow);
7338 } else {
7339 units = orderedUnits2;
7340 defaultValues = defaultUnitValues;
7341 }
7342 let foundFirst = false;
7343 for (const u of units) {
7344 const v = normalized[u];
7345 if (!isUndefined(v)) {
7346 foundFirst = true;
7347 } else if (foundFirst) {
7348 normalized[u] = defaultValues[u];
7349 } else {
7350 normalized[u] = objNow[u];
7351 }
7352 }
7353 const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
7354 if (invalid) {
7355 return DateTime.invalid(invalid);
7356 }
7357 const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({
7358 ts: tsFinal,
7359 zone: zoneToUse,
7360 o: offsetFinal,
7361 loc
7362 });
7363 if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {
7364 return DateTime.invalid(
7365 "mismatched weekday",
7366 `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`
7367 );
7368 }
7369 return inst;
7370 }
7371 static fromISO(text, opts = {}) {
7372 const [vals, parsedZone] = parseISODate(text);
7373 return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text);
7374 }
7375 static fromRFC2822(text, opts = {}) {
7376 const [vals, parsedZone] = parseRFC2822Date(text);
7377 return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text);
7378 }
7379 static fromHTTP(text, opts = {}) {
7380 const [vals, parsedZone] = parseHTTPDate(text);
7381 return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
7382 }
7383 static fromFormat(text, fmt, opts = {}) {
7384 if (isUndefined(text) || isUndefined(fmt)) {
7385 throw new InvalidArgumentError("fromFormat requires an input string and a format");
7386 }
7387 const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
7388 locale,
7389 numberingSystem,
7390 defaultToEN: true
7391 }), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);
7392 if (invalid) {
7393 return DateTime.invalid(invalid);
7394 } else {
7395 return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);
7396 }
7397 }
7398 static fromString(text, fmt, opts = {}) {
7399 return DateTime.fromFormat(text, fmt, opts);
7400 }
7401 static fromSQL(text, opts = {}) {
7402 const [vals, parsedZone] = parseSQL(text);
7403 return parseDataToDateTime(vals, parsedZone, opts, "SQL", text);
7404 }
7405 static invalid(reason, explanation = null) {
7406 if (!reason) {
7407 throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");
7408 }
7409 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
7410 if (Settings.throwOnInvalid) {
7411 throw new InvalidDateTimeError(invalid);
7412 } else {
7413 return new DateTime({ invalid });
7414 }
7415 }
7416 static isDateTime(o) {
7417 return o && o.isLuxonDateTime || false;
7418 }
7419 static parseFormatForOpts(formatOpts, localeOpts = {}) {
7420 const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
7421 return !tokenList ? null : tokenList.map((t) => t ? t.val : null).join("");
7422 }
7423 static expandFormat(fmt, localeOpts = {}) {
7424 const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
7425 return expanded.map((t) => t.val).join("");
7426 }
7427 get(unit) {
7428 return this[unit];
7429 }
7430 get isValid() {
7431 return this.invalid === null;
7432 }
7433 get invalidReason() {
7434 return this.invalid ? this.invalid.reason : null;
7435 }
7436 get invalidExplanation() {
7437 return this.invalid ? this.invalid.explanation : null;
7438 }
7439 get locale() {
7440 return this.isValid ? this.loc.locale : null;
7441 }
7442 get numberingSystem() {
7443 return this.isValid ? this.loc.numberingSystem : null;
7444 }
7445 get outputCalendar() {
7446 return this.isValid ? this.loc.outputCalendar : null;
7447 }
7448 get zone() {
7449 return this._zone;
7450 }
7451 get zoneName() {
7452 return this.isValid ? this.zone.name : null;
7453 }
7454 get year() {
7455 return this.isValid ? this.c.year : NaN;
7456 }
7457 get quarter() {
7458 return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
7459 }
7460 get month() {
7461 return this.isValid ? this.c.month : NaN;
7462 }
7463 get day() {
7464 return this.isValid ? this.c.day : NaN;
7465 }
7466 get hour() {
7467 return this.isValid ? this.c.hour : NaN;
7468 }
7469 get minute() {
7470 return this.isValid ? this.c.minute : NaN;
7471 }
7472 get second() {
7473 return this.isValid ? this.c.second : NaN;
7474 }
7475 get millisecond() {
7476 return this.isValid ? this.c.millisecond : NaN;
7477 }
7478 get weekYear() {
7479 return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
7480 }
7481 get weekNumber() {
7482 return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
7483 }
7484 get weekday() {
7485 return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
7486 }
7487 get ordinal() {
7488 return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
7489 }
7490 get monthShort() {
7491 return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null;
7492 }
7493 get monthLong() {
7494 return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null;
7495 }
7496 get weekdayShort() {
7497 return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null;
7498 }
7499 get weekdayLong() {
7500 return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null;
7501 }
7502 get offset() {
7503 return this.isValid ? +this.o : NaN;
7504 }
7505 get offsetNameShort() {
7506 if (this.isValid) {
7507 return this.zone.offsetName(this.ts, {
7508 format: "short",
7509 locale: this.locale
7510 });
7511 } else {
7512 return null;
7513 }
7514 }
7515 get offsetNameLong() {
7516 if (this.isValid) {
7517 return this.zone.offsetName(this.ts, {
7518 format: "long",
7519 locale: this.locale
7520 });
7521 } else {
7522 return null;
7523 }
7524 }
7525 get isOffsetFixed() {
7526 return this.isValid ? this.zone.isUniversal : null;
7527 }
7528 get isInDST() {
7529 if (this.isOffsetFixed) {
7530 return false;
7531 } else {
7532 return this.offset > this.set({ month: 1, day: 1 }).offset || this.offset > this.set({ month: 5 }).offset;
7533 }
7534 }
7535 get isInLeapYear() {
7536 return isLeapYear(this.year);
7537 }
7538 get daysInMonth() {
7539 return daysInMonth(this.year, this.month);
7540 }
7541 get daysInYear() {
7542 return this.isValid ? daysInYear(this.year) : NaN;
7543 }
7544 get weeksInWeekYear() {
7545 return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
7546 }
7547 resolvedLocaleOptions(opts = {}) {
7548 const { locale, numberingSystem, calendar } = Formatter.create(
7549 this.loc.clone(opts),
7550 opts
7551 ).resolvedOptions(this);
7552 return { locale, numberingSystem, outputCalendar: calendar };
7553 }
7554 toUTC(offset2 = 0, opts = {}) {
7555 return this.setZone(FixedOffsetZone.instance(offset2), opts);
7556 }
7557 toLocal() {
7558 return this.setZone(Settings.defaultZone);
7559 }
7560 setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {
7561 zone = normalizeZone(zone, Settings.defaultZone);
7562 if (zone.equals(this.zone)) {
7563 return this;
7564 } else if (!zone.isValid) {
7565 return DateTime.invalid(unsupportedZone(zone));
7566 } else {
7567 let newTS = this.ts;
7568 if (keepLocalTime || keepCalendarTime) {
7569 const offsetGuess = zone.offset(this.ts);
7570 const asObj = this.toObject();
7571 [newTS] = objToTS(asObj, offsetGuess, zone);
7572 }
7573 return clone2(this, { ts: newTS, zone });
7574 }
7575 }
7576 reconfigure({ locale, numberingSystem, outputCalendar } = {}) {
7577 const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });
7578 return clone2(this, { loc });
7579 }
7580 setLocale(locale) {
7581 return this.reconfigure({ locale });
7582 }
7583 set(values) {
7584 if (!this.isValid)
7585 return this;
7586 const normalized = normalizeObject(values, normalizeUnit), settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
7587 if ((containsGregor || containsOrdinal) && definiteWeekDef) {
7588 throw new ConflictingSpecificationError(
7589 "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
7590 );
7591 }
7592 if (containsGregorMD && containsOrdinal) {
7593 throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
7594 }
7595 let mixed;
7596 if (settingWeekStuff) {
7597 mixed = weekToGregorian({ ...gregorianToWeek(this.c), ...normalized });
7598 } else if (!isUndefined(normalized.ordinal)) {
7599 mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });
7600 } else {
7601 mixed = { ...this.toObject(), ...normalized };
7602 if (isUndefined(normalized.day)) {
7603 mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
7604 }
7605 }
7606 const [ts, o] = objToTS(mixed, this.o, this.zone);
7607 return clone2(this, { ts, o });
7608 }
7609 plus(duration) {
7610 if (!this.isValid)
7611 return this;
7612 const dur = Duration.fromDurationLike(duration);
7613 return clone2(this, adjustTime(this, dur));
7614 }
7615 minus(duration) {
7616 if (!this.isValid)
7617 return this;
7618 const dur = Duration.fromDurationLike(duration).negate();
7619 return clone2(this, adjustTime(this, dur));
7620 }
7621 startOf(unit) {
7622 if (!this.isValid)
7623 return this;
7624 const o = {}, normalizedUnit = Duration.normalizeUnit(unit);
7625 switch (normalizedUnit) {
7626 case "years":
7627 o.month = 1;
7628 case "quarters":
7629 case "months":
7630 o.day = 1;
7631 case "weeks":
7632 case "days":
7633 o.hour = 0;
7634 case "hours":
7635 o.minute = 0;
7636 case "minutes":
7637 o.second = 0;
7638 case "seconds":
7639 o.millisecond = 0;
7640 break;
7641 case "milliseconds":
7642 break;
7643 }
7644 if (normalizedUnit === "weeks") {
7645 o.weekday = 1;
7646 }
7647 if (normalizedUnit === "quarters") {
7648 const q = Math.ceil(this.month / 3);
7649 o.month = (q - 1) * 3 + 1;
7650 }
7651 return this.set(o);
7652 }
7653 endOf(unit) {
7654 return this.isValid ? this.plus({ [unit]: 1 }).startOf(unit).minus(1) : this;
7655 }
7656 toFormat(fmt, opts = {}) {
7657 return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID4;
7658 }
7659 toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
7660 return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID4;
7661 }
7662 toLocaleParts(opts = {}) {
7663 return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
7664 }
7665 toISO({
7666 format = "extended",
7667 suppressSeconds = false,
7668 suppressMilliseconds = false,
7669 includeOffset = true,
7670 extendedZone = false
7671 } = {}) {
7672 if (!this.isValid) {
7673 return null;
7674 }
7675 const ext = format === "extended";
7676 let c = toISODate(this, ext);
7677 c += "T";
7678 c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
7679 return c;
7680 }
7681 toISODate({ format = "extended" } = {}) {
7682 if (!this.isValid) {
7683 return null;
7684 }
7685 return toISODate(this, format === "extended");
7686 }
7687 toISOWeekDate() {
7688 return toTechFormat(this, "kkkk-'W'WW-c");
7689 }
7690 toISOTime({
7691 suppressMilliseconds = false,
7692 suppressSeconds = false,
7693 includeOffset = true,
7694 includePrefix = false,
7695 extendedZone = false,
7696 format = "extended"
7697 } = {}) {
7698 if (!this.isValid) {
7699 return null;
7700 }
7701 let c = includePrefix ? "T" : "";
7702 return c + toISOTime(
7703 this,
7704 format === "extended",
7705 suppressSeconds,
7706 suppressMilliseconds,
7707 includeOffset,
7708 extendedZone
7709 );
7710 }
7711 toRFC2822() {
7712 return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
7713 }
7714 toHTTP() {
7715 return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
7716 }
7717 toSQLDate() {
7718 if (!this.isValid) {
7719 return null;
7720 }
7721 return toISODate(this, true);
7722 }
7723 toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {
7724 let fmt = "HH:mm:ss.SSS";
7725 if (includeZone || includeOffset) {
7726 if (includeOffsetSpace) {
7727 fmt += " ";
7728 }
7729 if (includeZone) {
7730 fmt += "z";
7731 } else if (includeOffset) {
7732 fmt += "ZZ";
7733 }
7734 }
7735 return toTechFormat(this, fmt, true);
7736 }
7737 toSQL(opts = {}) {
7738 if (!this.isValid) {
7739 return null;
7740 }
7741 return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;
7742 }
7743 toString() {
7744 return this.isValid ? this.toISO() : INVALID4;
7745 }
7746 valueOf() {
7747 return this.toMillis();
7748 }
7749 toMillis() {
7750 return this.isValid ? this.ts : NaN;
7751 }
7752 toSeconds() {
7753 return this.isValid ? this.ts / 1e3 : NaN;
7754 }
7755 toUnixInteger() {
7756 return this.isValid ? Math.floor(this.ts / 1e3) : NaN;
7757 }
7758 toJSON() {
7759 return this.toISO();
7760 }
7761 toBSON() {
7762 return this.toJSDate();
7763 }
7764 toObject(opts = {}) {
7765 if (!this.isValid)
7766 return {};
7767 const base = { ...this.c };
7768 if (opts.includeConfig) {
7769 base.outputCalendar = this.outputCalendar;
7770 base.numberingSystem = this.loc.numberingSystem;
7771 base.locale = this.loc.locale;
7772 }
7773 return base;
7774 }
7775 toJSDate() {
7776 return new Date(this.isValid ? this.ts : NaN);
7777 }
7778 diff(otherDateTime, unit = "milliseconds", opts = {}) {
7779 if (!this.isValid || !otherDateTime.isValid) {
7780 return Duration.invalid("created by diffing an invalid DateTime");
7781 }
7782 const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };
7783 const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = diff_default(earlier, later, units, durOpts);
7784 return otherIsLater ? diffed.negate() : diffed;
7785 }
7786 diffNow(unit = "milliseconds", opts = {}) {
7787 return this.diff(DateTime.now(), unit, opts);
7788 }
7789 until(otherDateTime) {
7790 return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
7791 }
7792 hasSame(otherDateTime, unit) {
7793 if (!this.isValid)
7794 return false;
7795 const inputMs = otherDateTime.valueOf();
7796 const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });
7797 return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
7798 }
7799 equals(other) {
7800 return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
7801 }
7802 toRelative(options = {}) {
7803 if (!this.isValid)
7804 return null;
7805 const base = options.base || DateTime.fromObject({}, { zone: this.zone }), padding = options.padding ? this < base ? -options.padding : options.padding : 0;
7806 let units = ["years", "months", "days", "hours", "minutes", "seconds"];
7807 let unit = options.unit;
7808 if (Array.isArray(options.unit)) {
7809 units = options.unit;
7810 unit = void 0;
7811 }
7812 return diffRelative(base, this.plus(padding), {
7813 ...options,
7814 numeric: "always",
7815 units,
7816 unit
7817 });
7818 }
7819 toRelativeCalendar(options = {}) {
7820 if (!this.isValid)
7821 return null;
7822 return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {
7823 ...options,
7824 numeric: "auto",
7825 units: ["years", "months", "days"],
7826 calendary: true
7827 });
7828 }
7829 static min(...dateTimes) {
7830 if (!dateTimes.every(DateTime.isDateTime)) {
7831 throw new InvalidArgumentError("min requires all arguments be DateTimes");
7832 }
7833 return bestBy(dateTimes, (i) => i.valueOf(), Math.min);
7834 }
7835 static max(...dateTimes) {
7836 if (!dateTimes.every(DateTime.isDateTime)) {
7837 throw new InvalidArgumentError("max requires all arguments be DateTimes");
7838 }
7839 return bestBy(dateTimes, (i) => i.valueOf(), Math.max);
7840 }
7841 static fromFormatExplain(text, fmt, options = {}) {
7842 const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
7843 locale,
7844 numberingSystem,
7845 defaultToEN: true
7846 });
7847 return explainFromTokens(localeToUse, text, fmt);
7848 }
7849 static fromStringExplain(text, fmt, options = {}) {
7850 return DateTime.fromFormatExplain(text, fmt, options);
7851 }
7852 static get DATE_SHORT() {
7853 return DATE_SHORT;
7854 }
7855 static get DATE_MED() {
7856 return DATE_MED;
7857 }
7858 static get DATE_MED_WITH_WEEKDAY() {
7859 return DATE_MED_WITH_WEEKDAY;
7860 }
7861 static get DATE_FULL() {
7862 return DATE_FULL;
7863 }
7864 static get DATE_HUGE() {
7865 return DATE_HUGE;
7866 }
7867 static get TIME_SIMPLE() {
7868 return TIME_SIMPLE;
7869 }
7870 static get TIME_WITH_SECONDS() {
7871 return TIME_WITH_SECONDS;
7872 }
7873 static get TIME_WITH_SHORT_OFFSET() {
7874 return TIME_WITH_SHORT_OFFSET;
7875 }
7876 static get TIME_WITH_LONG_OFFSET() {
7877 return TIME_WITH_LONG_OFFSET;
7878 }
7879 static get TIME_24_SIMPLE() {
7880 return TIME_24_SIMPLE;
7881 }
7882 static get TIME_24_WITH_SECONDS() {
7883 return TIME_24_WITH_SECONDS;
7884 }
7885 static get TIME_24_WITH_SHORT_OFFSET() {
7886 return TIME_24_WITH_SHORT_OFFSET;
7887 }
7888 static get TIME_24_WITH_LONG_OFFSET() {
7889 return TIME_24_WITH_LONG_OFFSET;
7890 }
7891 static get DATETIME_SHORT() {
7892 return DATETIME_SHORT;
7893 }
7894 static get DATETIME_SHORT_WITH_SECONDS() {
7895 return DATETIME_SHORT_WITH_SECONDS;
7896 }
7897 static get DATETIME_MED() {
7898 return DATETIME_MED;
7899 }
7900 static get DATETIME_MED_WITH_SECONDS() {
7901 return DATETIME_MED_WITH_SECONDS;
7902 }
7903 static get DATETIME_MED_WITH_WEEKDAY() {
7904 return DATETIME_MED_WITH_WEEKDAY;
7905 }
7906 static get DATETIME_FULL() {
7907 return DATETIME_FULL;
7908 }
7909 static get DATETIME_FULL_WITH_SECONDS() {
7910 return DATETIME_FULL_WITH_SECONDS;
7911 }
7912 static get DATETIME_HUGE() {
7913 return DATETIME_HUGE;
7914 }
7915 static get DATETIME_HUGE_WITH_SECONDS() {
7916 return DATETIME_HUGE_WITH_SECONDS;
7917 }
7918};
7919function friendlyDateTime(dateTimeish) {
7920 if (DateTime.isDateTime(dateTimeish)) {
7921 return dateTimeish;
7922 } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {
7923 return DateTime.fromJSDate(dateTimeish);
7924 } else if (dateTimeish && typeof dateTimeish === "object") {
7925 return DateTime.fromObject(dateTimeish);
7926 } else {
7927 throw new InvalidArgumentError(
7928 `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`
7929 );
7930 }
7931}
7932
7933// ../types/src/index.ts
7934var import_base64 = __toESM(require_base64());
7935var import_iso_3166_ts = __toESM(require_dist());
7936var REGEX_HASH_HEX = /^(([a-fA-F0-9]{2})+)$/i;
7937var HashHex = mod.string().regex(REGEX_HASH_HEX);
7938var REGEX_HASH_HEX_32 = /^(([a-f0-9]{2}){32})$/i;
7939var HashHex32 = mod.string().regex(REGEX_HASH_HEX_32);
7940var REGEX_HASH_HEX_20_64 = /^(([a-f0-9]{2}){20,64})$/i;
7941var HashHex20to64 = mod.string().regex(REGEX_HASH_HEX_20_64);
7942var DEFAULT_REFRESH_TOKEN_EXPIRATION_TTL = 60 * 60 * 24 * 365 * 5;
7943var REGEX_ULID = /^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/;
7944var ULID = mod.string().regex(REGEX_ULID);
7945var UnionHashTypes = mod.union([
7946 mod.literal("sha1"),
7947 mod.literal("sha-256"),
7948 mod.literal("sha-384"),
7949 mod.literal("sha-512")
7950]);
7951var UnionProofHashTypes = mod.union([
7952 mod.literal("sha224"),
7953 mod.literal("sha256"),
7954 mod.literal("sha384"),
7955 mod.literal("sha512"),
7956 mod.literal("sha512_256"),
7957 mod.literal("sha3_224"),
7958 mod.literal("sha3_256"),
7959 mod.literal("sha3_384"),
7960 mod.literal("sha3_512")
7961]);
7962var UnionIntentTypes = mod.union([
7963 mod.literal("bitcoin"),
7964 mod.literal("ethereum"),
7965 mod.literal("stellar")
7966]);
7967var UnionEnvironmentTypes = mod.union([
7968 mod.literal("development"),
7969 mod.literal("staging"),
7970 mod.literal("production")
7971]);
7972var HashType = mod.object({
7973 minBytes: mod.number().min(20).max(64),
7974 maxBytes: mod.number().min(20).max(64)
7975});
7976var HashTypes = mod.record(mod.string(), HashType);
7977var TruestampId = mod.string().refine(
7978 (val) => {
7979 const base58CheckPlusUnderscoreEncoding = /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz_]+$/;
7980 try {
7981 return base58CheckPlusUnderscoreEncoding.test(val);
7982 } catch (error) {
7983 return false;
7984 }
7985 },
7986 {
7987 message: `is not a valid Truestamp Id string`
7988 }
7989);
7990var Base64 = mod.string().refine(
7991 (val) => {
7992 try {
7993 (0, import_base64.decode)(val);
7994 return true;
7995 } catch (error) {
7996 return false;
7997 }
7998 },
7999 {
8000 message: `is not a valid Base64 encoded string`
8001 }
8002);
8003var ISO8601 = mod.string().refine(
8004 (val) => {
8005 try {
8006 return DateTime.fromISO(val).isValid;
8007 } catch (error) {
8008 return false;
8009 }
8010 },
8011 {
8012 message: `is not a valid ISO8601 timestamp`
8013 }
8014);
8015var ISO8601UTC = mod.string().refine(
8016 (val) => {
8017 try {
8018 if (!val.endsWith("Z") && !val.endsWith("+00:00")) {
8019 return false;
8020 }
8021 const d = DateTime.fromISO(val, { zone: "utc" });
8022 return d.isValid && d.offsetNameShort === "UTC";
8023 } catch (error) {
8024 return false;
8025 }
8026 },
8027 {
8028 message: `is not a valid ISO8601 UTC timestamp`
8029 }
8030);
8031var ISO3166Alpha2 = mod.string().length(2).refine(
8032 (val) => {
8033 try {
8034 return (0, import_iso_3166_ts.isIso3166Alpha2Code)(val);
8035 } catch (error) {
8036 return false;
8037 }
8038 },
8039 {
8040 message: `is not an ISO3166 Alpha 2 country code`
8041 }
8042);
8043var Address = mod.object({
8044 streetNo: mod.optional(mod.string().min(1).max(8)),
8045 streetName: mod.optional(mod.string().min(1).max(64)),
8046 streetType: mod.optional(mod.string().min(1).max(16)),
8047 floor: mod.optional(mod.string().min(1).max(8)),
8048 town: mod.optional(mod.string().min(1).max(64)),
8049 region: mod.optional(mod.string().min(1).max(64)),
8050 postcode: mod.optional(mod.string().min(1).max(16)),
8051 countryCode: mod.optional(ISO3166Alpha2)
8052});
8053var Latitude = mod.string().refine(
8054 (val) => {
8055 try {
8056 const decimalLatLongValueString = /^[-+]?[0-9]*\.?[0-9]+$/;
8057 if (!decimalLatLongValueString.test(val)) {
8058 return false;
8059 }
8060 const valFloat = parseFloat(val);
8061 return valFloat >= -90 && valFloat <= 90 ? true : false;
8062 } catch (error) {
8063 return false;
8064 }
8065 },
8066 {
8067 message: `is not a valid Latitude`
8068 }
8069);
8070var Longitude = mod.string().refine(
8071 (val) => {
8072 try {
8073 const decimalLatLongValueString = /^[-+]?[0-9]*\.?[0-9]+$/;
8074 if (!decimalLatLongValueString.test(val)) {
8075 return false;
8076 }
8077 const valFloat = parseFloat(val);
8078 return valFloat >= -180 && valFloat <= 180 ? true : false;
8079 } catch (error) {
8080 return false;
8081 }
8082 },
8083 {
8084 message: `is not a valid Longitude`
8085 }
8086);
8087var LatLong = mod.object({
8088 latitude: Latitude,
8089 longitude: Longitude
8090});
8091var Location = mod.object({
8092 coordinate: LatLong,
8093 altitude: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8094 ellipsoidalAltitude: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8095 floor: mod.optional(mod.number().int().min(0).max(200)),
8096 horizontalAccuracy: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8097 verticalAccuracy: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8098 timestamp: mod.optional(ISO8601),
8099 speed: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8100 speedAccuracy: mod.optional(mod.number().int().min(-1e4).max(1e4)),
8101 course: mod.optional(mod.number().int().min(-360).max(360)),
8102 courseAccuracy: mod.optional(mod.number().int().min(-360).max(360)),
8103 magneticHeading: mod.optional(mod.number().int().min(0).max(359)),
8104 headingAccuracy: mod.optional(mod.number().int().min(-180).max(180)),
8105 trueHeading: mod.optional(mod.number().int().min(0).max(359))
8106});
8107var Person = mod.object({
8108 givenName: mod.optional(mod.string().min(1).max(32)),
8109 surname: mod.optional(mod.string().min(1).max(32)),
8110 organizationName: mod.optional(mod.string().min(1).max(64)),
8111 roles: mod.optional(mod.array(mod.string()).min(1).max(32)),
8112 email: mod.optional(mod.string().email()),
8113 uri: mod.optional(mod.string().url()),
8114 address: mod.optional(Address)
8115});
8116var Signature = mod.object({
8117 publicKey: Base64,
8118 signature: Base64,
8119 signatureType: mod.literal("ed25519"),
8120 signer: mod.optional(Person)
8121});
8122var ItemRequestProps = mod.object({
8123 asn: mod.optional(mod.nullable(mod.union([mod.number().int(), mod.string()]))),
8124 colo: mod.optional(mod.nullable(mod.string().min(1))),
8125 country: mod.optional(mod.nullable(mod.string().min(1))),
8126 city: mod.optional(mod.nullable(mod.string().min(1))),
8127 continent: mod.optional(mod.nullable(mod.string().min(1))),
8128 latitude: mod.optional(mod.nullable(mod.string().min(1))),
8129 longitude: mod.optional(mod.nullable(mod.string().min(1))),
8130 postalCode: mod.optional(mod.nullable(mod.string().min(1))),
8131 metroCode: mod.optional(mod.nullable(mod.string().min(1))),
8132 region: mod.optional(mod.nullable(mod.string().min(1))),
8133 regionCode: mod.optional(mod.nullable(mod.string().min(1))),
8134 timezone: mod.optional(mod.nullable(mod.string().min(1)))
8135});
8136var literalSchema = mod.union([mod.string(), mod.number(), mod.boolean(), mod.null()]);
8137var jsonSchema = mod.lazy(
8138 () => mod.union([literalSchema, mod.array(jsonSchema), mod.record(jsonSchema)])
8139);
8140var ItemData = mod.object({
8141 hash: HashHex20to64,
8142 hashType: UnionHashTypes,
8143 people: mod.optional(mod.array(Person).min(1)),
8144 description: mod.optional(mod.string().min(1).max(256)),
8145 address: mod.optional(Address),
8146 location: mod.optional(Location),
8147 timestamp: mod.optional(ISO8601),
8148 extra: mod.optional(jsonSchema)
8149});
8150var ItemSignals = mod.object({
8151 cf: mod.optional(ItemRequestProps),
8152 observableEntropy: mod.optional(HashHex32),
8153 submittedAt: ISO8601UTC
8154});
8155var Item = mod.object({
8156 itemData: mod.array(ItemData).min(1),
8157 itemSignals: mod.optional(ItemSignals),
8158 itemDataSignatures: mod.optional(mod.array(Signature).min(1))
8159});
8160var ItemRequestSchema = Item.pick({
8161 itemData: true,
8162 itemDataSignatures: true
8163});
8164var ItemResponseSchema = mod.object({ id: TruestampId });
8165var ItemEnvelope = mod.object({
8166 owner: mod.string().min(1).max(255),
8167 ulid: ULID,
8168 item: Item
8169});
8170var HealthResponseSchema = mod.object({
8171 status: mod.union([mod.literal("pass"), mod.literal("fail")]),
8172 description: mod.string().optional(),
8173 checks: mod.object({
8174 uptime: mod.array(
8175 mod.object({
8176 status: mod.literal("pass"),
8177 componentType: mod.string(),
8178 time: mod.string()
8179 })
8180 ).optional()
8181 }).optional(),
8182 links: mod.array(mod.string().url()).optional()
8183});
8184var ApiKeyBodySchema = mod.object({
8185 refreshToken: mod.string(),
8186 description: mod.string().max(256).optional(),
8187 ttl: mod.number().min(0).max(DEFAULT_REFRESH_TOKEN_EXPIRATION_TTL).optional()
8188});
8189var ApiKeyResponseSchema = mod.object({
8190 apiKey: mod.string(),
8191 expiration: mod.string().max(256),
8192 description: mod.string().max(256)
8193});
8194var SNSTopicMessage = mod.object({
8195 owner: mod.optional(mod.string().min(1)),
8196 inputHash: HashHex32
8197});
8198var ProofObjectLayer = mod.tuple([
8199 mod.number().int().min(0).max(1),
8200 HashHex20to64
8201]);
8202var ProofObject = mod.object({
8203 v: mod.number().int().min(1).max(1),
8204 h: UnionProofHashTypes,
8205 p: mod.array(ProofObjectLayer)
8206});
8207var CommitProof = mod.object({
8208 inputHash: HashHex32,
8209 inclusionProof: ProofObject,
8210 merkleRoot: HashHex32
8211});
8212var CommitTransactionBase = mod.object({
8213 inputHash: HashHex32
8214});
8215var CommitTransactionBitcoin = CommitTransactionBase.extend({
8216 intent: mod.literal("bitcoin"),
8217 hash: mod.string().regex(/(0x)?[0-9a-f]+/i)
8218}).strict();
8219var CommitTransactionEthereum = CommitTransactionBase.extend({
8220 intent: mod.literal("ethereum"),
8221 hash: mod.string().regex(/(0x)?[0-9a-f]+/i)
8222}).strict();
8223var CommitTransactionStellar = CommitTransactionBase.extend({
8224 intent: mod.literal("stellar"),
8225 hash: HashHex32,
8226 ledger: mod.number().int().min(11111)
8227}).strict();
8228var CommitTransaction = mod.discriminatedUnion("intent", [
8229 CommitTransactionBitcoin,
8230 CommitTransactionEthereum,
8231 CommitTransactionStellar
8232]);
8233var CommitmentData = mod.object({
8234 id: TruestampId,
8235 itemData: mod.array(ItemData).min(1),
8236 itemDataSignatures: mod.optional(mod.array(Signature).min(1)),
8237 itemSignals: mod.optional(ItemSignals),
8238 proofs: mod.array(CommitProof),
8239 transactions: mod.record(mod.string(), mod.array(CommitTransaction).min(1))
8240});
8241var Commitment = mod.object({
8242 commitmentData: CommitmentData,
8243 commitmentDataSignatures: mod.array(Signature).min(1)
8244});
8245var ULIDResponse = mod.object({
8246 t: mod.number(),
8247 ts: ISO8601UTC,
8248 ulid: ULID
8249});
8250var ULIDResponseCollection = mod.array(ULIDResponse);
8251var VerificationProof = mod.object({
8252 inputHash: HashHex32,
8253 merkleRoot: HashHex32
8254}).strict();
8255var VerificationTransaction = mod.object({
8256 intent: UnionIntentTypes,
8257 verified: mod.boolean(),
8258 transaction: CommitTransaction,
8259 timestamp: mod.optional(ISO8601UTC),
8260 urls: mod.optional(
8261 mod.object({
8262 machine: mod.optional(mod.array(mod.string().url())),
8263 human: mod.optional(mod.array(mod.string().url()))
8264 })
8265 ),
8266 error: mod.optional(mod.string())
8267}).strict();
8268var CommitmentVerification = mod.object({
8269 verified: mod.boolean(),
8270 id: mod.optional(TruestampId),
8271 idData: mod.optional(
8272 mod.object({
8273 test: mod.boolean(),
8274 timestamp: mod.string(),
8275 ulid: ULID
8276 })
8277 ),
8278 itemData: mod.optional(
8279 mod.object({
8280 hash: HashHex32,
8281 hashType: UnionHashTypes,
8282 signaturesCount: mod.optional(mod.number().int())
8283 })
8284 ),
8285 item: mod.optional(
8286 mod.object({
8287 hash: HashHex32,
8288 hashType: mod.literal("sha-256")
8289 })
8290 ),
8291 commitmentData: mod.optional(
8292 mod.object({
8293 hash: HashHex32,
8294 hashType: mod.literal("sha-256"),
8295 signaturesCount: mod.optional(mod.number().int())
8296 })
8297 ),
8298 proofs: mod.optional(mod.array(VerificationProof).min(1)),
8299 transactions: mod.optional(mod.array(VerificationTransaction).min(1)),
8300 commitsTo: mod.optional(
8301 mod.object({
8302 hashes: mod.array(
8303 mod.object({
8304 hash: HashHex20to64,
8305 hashType: mod.string()
8306 })
8307 ).min(1),
8308 observableEntropy: mod.optional(HashHex32),
8309 timestamps: mod.object({
8310 submittedAfter: mod.optional(ISO8601UTC),
8311 submittedAt: ISO8601UTC,
8312 submittedBefore: mod.optional(mod.array(mod.string())),
8313 submitWindowMilliseconds: mod.optional(
8314 mod.number().int().min(0).max(3600 * 24 * 365 * 1e3)
8315 )
8316 })
8317 })
8318 ),
8319 error: mod.optional(mod.string())
8320}).strict();
8321var SignedKey = mod.object({
8322 environment: UnionEnvironmentTypes,
8323 expired: mod.boolean(),
8324 handle: mod.string().min(1),
8325 publicKey: Base64,
8326 type: mod.literal("ed25519"),
8327 selfSignature: Base64
8328});
8329var SignedKeys = mod.array(SignedKey).min(1);
8330var UnsignedKey = SignedKey.omit({ selfSignature: true });
8331var CanonicalHash = mod.object({
8332 hash: mod.instanceof(Uint8Array),
8333 hashHex: HashHex32,
8334 hashType: UnionHashTypes,
8335 canonicalData: mod.optional(mod.string())
8336});
8337var EntropyBitcoin = mod.object({
8338 block_index: mod.number().int(),
8339 hash: HashHex,
8340 height: mod.number().int(),
8341 time: mod.number().int()
8342});
8343var EntropyDrandBeaconChainInfo = mod.object({
8344 genesis_time: mod.number().int(),
8345 groupHash: HashHex,
8346 hash: HashHex,
8347 metadata: mod.object({
8348 beaconID: mod.string()
8349 }).optional(),
8350 period: mod.number().int(),
8351 public_key: HashHex,
8352 schemeID: mod.string().optional()
8353});
8354var EntropyDrandBeaconRandomness = mod.object({
8355 previous_signature: HashHex,
8356 randomness: HashHex,
8357 round: mod.number().int(),
8358 signature: HashHex
8359});
8360var EntropyDrandBeacon = mod.object({
8361 chainInfo: EntropyDrandBeaconChainInfo,
8362 randomness: EntropyDrandBeaconRandomness
8363});
8364var EntropyEthereum = mod.object({
8365 hash: HashHex,
8366 height: mod.number().int(),
8367 time: ISO8601UTC
8368});
8369var EntropyHackerNewsStory = mod.object({
8370 by: mod.string(),
8371 id: mod.number().int(),
8372 time: mod.number().int(),
8373 title: mod.string(),
8374 url: mod.string().url().optional()
8375});
8376var EntropyHackerNews = mod.object({
8377 stories: mod.array(EntropyHackerNewsStory)
8378});
8379var EntropyNistBeacon = mod.object({
8380 chainIndex: mod.number().int(),
8381 outputValue: HashHex,
8382 pulseIndex: mod.number().int(),
8383 timeStamp: ISO8601UTC,
8384 uri: mod.string().url()
8385});
8386var EntropyPrevious = mod.object({
8387 hash: HashHex,
8388 uri: mod.string().url()
8389});
8390var EntropyStellar = mod.object({
8391 closed_at: ISO8601UTC,
8392 hash: HashHex,
8393 sequence: mod.number().int()
8394});
8395var EntropyTimestamp = mod.object({
8396 capturedAt: ISO8601UTC
8397});
8398var EntropyResponse = mod.object({
8399 data: mod.object({
8400 bitcoin: EntropyBitcoin.strict().optional(),
8401 "drand-beacon": EntropyDrandBeacon.strict().optional(),
8402 ethereum: EntropyEthereum.strict().optional(),
8403 "hacker-news": EntropyHackerNews.strict().optional(),
8404 "nist-beacon": EntropyNistBeacon.strict().optional(),
8405 previous: EntropyPrevious.strict().optional(),
8406 stellar: EntropyStellar.strict().optional(),
8407 timestamp: EntropyTimestamp.strict()
8408 }),
8409 hash: HashHex32,
8410 hashType: mod.literal("sha-256"),
8411 publicKey: Base64,
8412 signature: Base64,
8413 signatureType: mod.literal("ed25519")
8414}).strict();
8415var RFC7807ErrorSchema = mod.object({
8416 status: mod.number(),
8417 type: mod.optional(mod.string().url()),
8418 title: mod.optional(mod.string()),
8419 detail: mod.optional(mod.string()),
8420 instance: mod.optional(mod.string().url())
8421});
8422var BetterUptimeResponseDataSchema = mod.object({
8423 id: mod.string(),
8424 type: mod.string(),
8425 attributes: mod.object({
8426 announcement: mod.string().nullable().optional(),
8427 aggregate_state: mod.string()
8428 })
8429});
8430var BetterUptimeResponseSchema = mod.object({
8431 data: mod.array(BetterUptimeResponseDataSchema)
8432});
8433
8434// ../utils/src/http/index.ts
8435async function http(input, init) {
8436 const REQUEST_TIMEOUT = 1e4;
8437 try {
8438 const req = new Request(input, init);
8439 const c = new AbortController();
8440 const id = setTimeout(() => c.abort(), REQUEST_TIMEOUT);
8441 const res = await fetch(req, { signal: c.signal });
8442 clearTimeout(id);
8443 if (!res.ok) {
8444 const errorResponse = await res.json();
8445 const parsedErrorResponse = RFC7807ErrorSchema.safeParse(errorResponse);
8446 if (parsedErrorResponse.success) {
8447 throw new Error(
8448 `${res.status} ${res.statusText} : ${parsedErrorResponse.data.title} : ${parsedErrorResponse.data.detail}`
8449 );
8450 }
8451 throw new Error(`${res.status} ${res.statusText}`);
8452 }
8453 return res.json();
8454 } catch (err) {
8455 if (err instanceof DOMException && err.name === "AbortError") {
8456 throw new Error(`HTTP fetch timeout : ${err.message}`);
8457 } else if (err instanceof Error) {
8458 throw new Error(`HTTP fetch error : ${err.message}`);
8459 } else {
8460 throw new Error(`HTTP fetch error : ${err}`);
8461 }
8462 }
8463}
8464async function httpGet(input, config) {
8465 const init = {
8466 ...config,
8467 method: "GET",
8468 headers: {
8469 "Content-Type": "application/json",
8470 Accept: "application/json",
8471 ...config?.headers
8472 }
8473 };
8474 return await http(input, init);
8475}
8476async function httpPost(input, body, config) {
8477 const init = {
8478 ...config,
8479 method: "POST",
8480 body: JSON.stringify(body),
8481 headers: {
8482 "Content-Type": "application/json",
8483 Accept: "application/json",
8484 ...config?.headers
8485 }
8486 };
8487 return await http(input, init);
8488}
8489async function httpPut(input, body, config) {
8490 const init = {
8491 ...config,
8492 method: "PUT",
8493 body: JSON.stringify(body),
8494 headers: {
8495 "Content-Type": "application/json",
8496 Accept: "application/json",
8497 ...config?.headers
8498 }
8499 };
8500 return await http(input, init);
8501}
8502
8503// src/index.ts
8504var ClientConfigSchema = mod.object({
8505 apiBaseUrl: mod.string().url().regex(/https:\/\/(api|staging-api|dev-api)\.truestamp\.com/).optional(),
8506 apiKey: mod.string().min(1)
8507});
8508var TruestampClient = class {
8509 constructor(config) {
8510 try {
8511 ClientConfigSchema.parse(config);
8512 } catch (err) {
8513 if (err instanceof mod.ZodError) {
8514 const validationError = fromZodError(err);
8515 throw new Error(validationError.message);
8516 } else {
8517 throw err;
8518 }
8519 }
8520 const { apiBaseUrl, apiKey } = config;
8521 this.API_KEY = apiKey;
8522 this.API_VERSION = "v1";
8523 this.BASE_URL = apiBaseUrl ?? "https://api.truestamp.com";
8524 this.BASE_URL_W_VERSION = `${this.BASE_URL}/${this.API_VERSION}`;
8525 this.COMMON_HEADERS = {
8526 Authorization: `Bearer ${this.API_KEY}`,
8527 Accept: "application/json",
8528 "Content-Type": "application/json"
8529 };
8530 }
8531 async getHealth() {
8532 return await httpGet(`${this.BASE_URL_W_VERSION}/health`, {
8533 headers: this.COMMON_HEADERS
8534 });
8535 }
8536 async createApiKey(body) {
8537 try {
8538 ApiKeyBodySchema.parse(body);
8539 } catch (err) {
8540 if (err instanceof mod.ZodError) {
8541 const validationError = fromZodError(err);
8542 throw new Error(validationError.message);
8543 } else {
8544 throw err;
8545 }
8546 }
8547 return await httpPost(
8548 `${this.BASE_URL_W_VERSION}/apikeys`,
8549 body,
8550 {
8551 headers: this.COMMON_HEADERS
8552 }
8553 );
8554 }
8555 async getCommitment(id) {
8556 return await httpGet(
8557 `${this.BASE_URL_W_VERSION}/commitments/${id}`,
8558 {
8559 headers: this.COMMON_HEADERS
8560 }
8561 );
8562 }
8563 async getCommitmentVerification(id) {
8564 return await httpGet(
8565 `${this.BASE_URL_W_VERSION}/commitments/${id}/verify`,
8566 {
8567 headers: this.COMMON_HEADERS
8568 }
8569 );
8570 }
8571 async createItem(body, args) {
8572 try {
8573 ItemRequestSchema.parse(body);
8574 } catch (err) {
8575 if (err instanceof mod.ZodError) {
8576 const validationError = fromZodError(err);
8577 throw new Error(validationError.message);
8578 } else {
8579 throw err;
8580 }
8581 }
8582 const newHeaders = {};
8583 if (args?.skipCF) {
8584 newHeaders["skip-cf"] = "true";
8585 }
8586 if (args?.skipOE) {
8587 newHeaders["skip-oe"] = "true";
8588 }
8589 return await httpPost(
8590 `${this.BASE_URL_W_VERSION}/items`,
8591 body,
8592 {
8593 headers: { ...this.COMMON_HEADERS, ...newHeaders }
8594 }
8595 );
8596 }
8597 async updateItem(id, body, args) {
8598 try {
8599 ItemRequestSchema.parse(body);
8600 } catch (err) {
8601 if (err instanceof mod.ZodError) {
8602 const validationError = fromZodError(err);
8603 throw new Error(validationError.message);
8604 } else {
8605 throw err;
8606 }
8607 }
8608 const newHeaders = {};
8609 if (args?.skipCF) {
8610 newHeaders["skip-cf"] = "true";
8611 }
8612 if (args?.skipOE) {
8613 newHeaders["skip-oe"] = "true";
8614 }
8615 return await httpPut(
8616 `${this.BASE_URL_W_VERSION}/items/${id}`,
8617 body,
8618 {
8619 headers: { ...this.COMMON_HEADERS, ...newHeaders }
8620 }
8621 );
8622 }
8623};
8624export {
8625 TruestampClient
8626};