@learncard/network-plugin 2.1.7 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1160,8 +1160,4297 @@ var experimental_formDataLink = httpLinkFactory({
1160
1160
  });
1161
1161
 
1162
1162
  // ../../learn-card-network/brain-client/dist/brain-client.esm.js
1163
+ var __create = Object.create;
1163
1164
  var __defProp2 = Object.defineProperty;
1165
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1166
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
1167
+ var __getProtoOf = Object.getPrototypeOf;
1168
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1164
1169
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
1170
+ var __commonJS = /* @__PURE__ */ __name((cb, mod2) => /* @__PURE__ */ __name(function __require() {
1171
+ return mod2 || (0, cb[__getOwnPropNames2(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
1172
+ }, "__require"), "__commonJS");
1173
+ var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
1174
+ if (from && typeof from === "object" || typeof from === "function") {
1175
+ for (let key of __getOwnPropNames2(from))
1176
+ if (!__hasOwnProp2.call(to, key) && key !== except)
1177
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1178
+ }
1179
+ return to;
1180
+ }, "__copyProps");
1181
+ var __toESM = /* @__PURE__ */ __name((mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps2(
1182
+ isNodeMode || !mod2 || !mod2.__esModule ? __defProp2(target, "default", { value: mod2, enumerable: true }) : target,
1183
+ mod2
1184
+ )), "__toESM");
1185
+ var require_helpers_cjs_development = __commonJS({
1186
+ "../../learn-card-helpers/dist/helpers.cjs.development.js"(exports, module2) {
1187
+ var __create2 = Object.create;
1188
+ var __defProp22 = Object.defineProperty;
1189
+ var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
1190
+ var __getOwnPropNames22 = Object.getOwnPropertyNames;
1191
+ var __getProtoOf2 = Object.getPrototypeOf;
1192
+ var __hasOwnProp22 = Object.prototype.hasOwnProperty;
1193
+ var __name22 = /* @__PURE__ */ __name2((target, value) => __defProp22(target, "name", { value, configurable: true }), "__name");
1194
+ var __commonJS2 = /* @__PURE__ */ __name2((cb, mod2) => /* @__PURE__ */ __name2(/* @__PURE__ */ __name(function __require() {
1195
+ return mod2 || (0, cb[__getOwnPropNames22(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
1196
+ }, "__require"), "__require"), "__commonJS");
1197
+ var __export2 = /* @__PURE__ */ __name2((target, all) => {
1198
+ for (var name in all)
1199
+ __defProp22(target, name, { get: all[name], enumerable: true });
1200
+ }, "__export");
1201
+ var __copyProps22 = /* @__PURE__ */ __name2((to, from, except, desc) => {
1202
+ if (from && typeof from === "object" || typeof from === "function") {
1203
+ for (let key of __getOwnPropNames22(from))
1204
+ if (!__hasOwnProp22.call(to, key) && key !== except)
1205
+ __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
1206
+ }
1207
+ return to;
1208
+ }, "__copyProps");
1209
+ var __toESM2 = /* @__PURE__ */ __name2((mod2, isNodeMode, target) => (target = mod2 != null ? __create2(__getProtoOf2(mod2)) : {}, __copyProps22(
1210
+ isNodeMode || !mod2 || !mod2.__esModule ? __defProp22(target, "default", { value: mod2, enumerable: true }) : target,
1211
+ mod2
1212
+ )), "__toESM");
1213
+ var __toCommonJS2 = /* @__PURE__ */ __name2((mod2) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod2), "__toCommonJS");
1214
+ var require_types_cjs_development = __commonJS2({
1215
+ "../learn-card-types/dist/types.cjs.development.js"(exports2, module22) {
1216
+ "use strict";
1217
+ var __defProp222 = Object.defineProperty;
1218
+ var __getOwnPropDesc222 = Object.getOwnPropertyDescriptor;
1219
+ var __getOwnPropNames222 = Object.getOwnPropertyNames;
1220
+ var __hasOwnProp222 = Object.prototype.hasOwnProperty;
1221
+ var __name222 = /* @__PURE__ */ __name22((target, value) => __defProp222(target, "name", { value, configurable: true }), "__name");
1222
+ var __export22 = /* @__PURE__ */ __name22((target, all) => {
1223
+ for (var name in all)
1224
+ __defProp222(target, name, { get: all[name], enumerable: true });
1225
+ }, "__export");
1226
+ var __copyProps222 = /* @__PURE__ */ __name22((to, from, except, desc) => {
1227
+ if (from && typeof from === "object" || typeof from === "function") {
1228
+ for (let key of __getOwnPropNames222(from))
1229
+ if (!__hasOwnProp222.call(to, key) && key !== except)
1230
+ __defProp222(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc222(from, key)) || desc.enumerable });
1231
+ }
1232
+ return to;
1233
+ }, "__copyProps");
1234
+ var __toCommonJS22 = /* @__PURE__ */ __name22((mod22) => __copyProps222(__defProp222({}, "__esModule", { value: true }), mod22), "__toCommonJS");
1235
+ var src_exports22 = {};
1236
+ __export22(src_exports22, {
1237
+ AchievementCredentialValidator: () => AchievementCredentialValidator2,
1238
+ AchievementCriteriaValidator: () => AchievementCriteriaValidator2,
1239
+ AchievementSubjectValidator: () => AchievementSubjectValidator2,
1240
+ AchievementTypeValidator: () => AchievementTypeValidator2,
1241
+ AchievementValidator: () => AchievementValidator2,
1242
+ AddressValidator: () => AddressValidator2,
1243
+ AlignmentTargetTypeValidator: () => AlignmentTargetTypeValidator2,
1244
+ AlignmentValidator: () => AlignmentValidator2,
1245
+ BoostPermissionsValidator: () => BoostPermissionsValidator2,
1246
+ BoostQueryValidator: () => BoostQueryValidator2,
1247
+ BoostRecipientValidator: () => BoostRecipientValidator2,
1248
+ BoostValidator: () => BoostValidator2,
1249
+ ConsentFlowContractDataValidator: () => ConsentFlowContractDataValidator2,
1250
+ ConsentFlowContractDetailsValidator: () => ConsentFlowContractDetailsValidator2,
1251
+ ConsentFlowContractQueryValidator: () => ConsentFlowContractQueryValidator2,
1252
+ ConsentFlowContractValidator: () => ConsentFlowContractValidator2,
1253
+ ConsentFlowDataQueryValidator: () => ConsentFlowDataQueryValidator2,
1254
+ ConsentFlowTermValidator: () => ConsentFlowTermValidator2,
1255
+ ConsentFlowTermsQueryValidator: () => ConsentFlowTermsQueryValidator2,
1256
+ ConsentFlowTermsStatusValidator: () => ConsentFlowTermsStatusValidator2,
1257
+ ConsentFlowTermsValidator: () => ConsentFlowTermsValidator2,
1258
+ ConsentFlowTransactionActionValidator: () => ConsentFlowTransactionActionValidator2,
1259
+ ConsentFlowTransactionValidator: () => ConsentFlowTransactionValidator2,
1260
+ ConsentFlowTransactionsQueryValidator: () => ConsentFlowTransactionsQueryValidator2,
1261
+ ContextValidator: () => ContextValidator2,
1262
+ CredentialInfoValidator: () => CredentialInfoValidator2,
1263
+ CredentialRecordValidator: () => CredentialRecordValidator2,
1264
+ CredentialSchemaValidator: () => CredentialSchemaValidator2,
1265
+ CredentialStatusValidator: () => CredentialStatusValidator2,
1266
+ CredentialSubjectValidator: () => CredentialSubjectValidator2,
1267
+ CriteriaValidator: () => CriteriaValidator2,
1268
+ DidDocumentValidator: () => DidDocumentValidator2,
1269
+ EncryptedCredentialRecordValidator: () => EncryptedCredentialRecordValidator2,
1270
+ EncryptedRecordValidator: () => EncryptedRecordValidator2,
1271
+ EndorsementCredentialValidator: () => EndorsementCredentialValidator2,
1272
+ EndorsementSubjectValidator: () => EndorsementSubjectValidator2,
1273
+ EvidenceValidator: () => EvidenceValidator2,
1274
+ GeoCoordinatesValidator: () => GeoCoordinatesValidator2,
1275
+ IdentifierEntryValidator: () => IdentifierEntryValidator2,
1276
+ IdentifierTypeValidator: () => IdentifierTypeValidator2,
1277
+ IdentityObjectValidator: () => IdentityObjectValidator2,
1278
+ ImageValidator: () => ImageValidator2,
1279
+ JWERecipientHeaderValidator: () => JWERecipientHeaderValidator2,
1280
+ JWERecipientValidator: () => JWERecipientValidator2,
1281
+ JWEValidator: () => JWEValidator2,
1282
+ JWKValidator: () => JWKValidator2,
1283
+ KnownAchievementTypeValidator: () => KnownAchievementTypeValidator2,
1284
+ LCNBoostClaimLinkOptionsValidator: () => LCNBoostClaimLinkOptionsValidator2,
1285
+ LCNBoostClaimLinkSigningAuthorityValidator: () => LCNBoostClaimLinkSigningAuthorityValidator2,
1286
+ LCNBoostStatus: () => LCNBoostStatus2,
1287
+ LCNNotificationDataValidator: () => LCNNotificationDataValidator2,
1288
+ LCNNotificationMessageValidator: () => LCNNotificationMessageValidator2,
1289
+ LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator2,
1290
+ LCNNotificationValidator: () => LCNNotificationValidator2,
1291
+ LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum2,
1292
+ LCNProfileQueryValidator: () => LCNProfileQueryValidator2,
1293
+ LCNProfileValidator: () => LCNProfileValidator2,
1294
+ LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator2,
1295
+ LCNSigningAuthorityValidator: () => LCNSigningAuthorityValidator2,
1296
+ PaginatedBoostRecipientsValidator: () => PaginatedBoostRecipientsValidator2,
1297
+ PaginatedBoostsValidator: () => PaginatedBoostsValidator2,
1298
+ PaginatedConsentFlowContractsValidator: () => PaginatedConsentFlowContractsValidator2,
1299
+ PaginatedConsentFlowDataValidator: () => PaginatedConsentFlowDataValidator2,
1300
+ PaginatedConsentFlowTermsValidator: () => PaginatedConsentFlowTermsValidator2,
1301
+ PaginatedConsentFlowTransactionsValidator: () => PaginatedConsentFlowTransactionsValidator2,
1302
+ PaginatedEncryptedCredentialRecordsValidator: () => PaginatedEncryptedCredentialRecordsValidator2,
1303
+ PaginatedEncryptedRecordsValidator: () => PaginatedEncryptedRecordsValidator2,
1304
+ PaginatedLCNProfilesValidator: () => PaginatedLCNProfilesValidator2,
1305
+ PaginationOptionsValidator: () => PaginationOptionsValidator2,
1306
+ PaginationResponseValidator: () => PaginationResponseValidator2,
1307
+ ProfileValidator: () => ProfileValidator2,
1308
+ ProofValidator: () => ProofValidator2,
1309
+ RefreshServiceValidator: () => RefreshServiceValidator2,
1310
+ RelatedValidator: () => RelatedValidator2,
1311
+ ResultDescriptionValidator: () => ResultDescriptionValidator2,
1312
+ ResultStatusTypeValidator: () => ResultStatusTypeValidator2,
1313
+ ResultTypeValidator: () => ResultTypeValidator2,
1314
+ ResultValidator: () => ResultValidator2,
1315
+ RubricCriterionValidator: () => RubricCriterionValidator2,
1316
+ SentCredentialInfoValidator: () => SentCredentialInfoValidator2,
1317
+ ServiceValidator: () => ServiceValidator2,
1318
+ UnsignedAchievementCredentialValidator: () => UnsignedAchievementCredentialValidator2,
1319
+ UnsignedVCValidator: () => UnsignedVCValidator2,
1320
+ UnsignedVPValidator: () => UnsignedVPValidator2,
1321
+ VCValidator: () => VCValidator2,
1322
+ VPValidator: () => VPValidator2,
1323
+ VerificationCheckValidator: () => VerificationCheckValidator2,
1324
+ VerificationItemValidator: () => VerificationItemValidator2,
1325
+ VerificationMethodValidator: () => VerificationMethodValidator2,
1326
+ VerificationStatusEnum: () => VerificationStatusEnum2,
1327
+ VerificationStatusValidator: () => VerificationStatusValidator2
1328
+ });
1329
+ module22.exports = __toCommonJS22(src_exports22);
1330
+ var util2;
1331
+ (function(util22) {
1332
+ util22.assertEqual = (val) => val;
1333
+ function assertIs(_arg) {
1334
+ }
1335
+ __name(assertIs, "assertIs");
1336
+ __name2(assertIs, "assertIs");
1337
+ __name22(assertIs, "assertIs");
1338
+ __name222(assertIs, "assertIs");
1339
+ util22.assertIs = assertIs;
1340
+ function assertNever(_x) {
1341
+ throw new Error();
1342
+ }
1343
+ __name(assertNever, "assertNever");
1344
+ __name2(assertNever, "assertNever");
1345
+ __name22(assertNever, "assertNever");
1346
+ __name222(assertNever, "assertNever");
1347
+ util22.assertNever = assertNever;
1348
+ util22.arrayToEnum = (items) => {
1349
+ const obj = {};
1350
+ for (const item of items) {
1351
+ obj[item] = item;
1352
+ }
1353
+ return obj;
1354
+ };
1355
+ util22.getValidEnumValues = (obj) => {
1356
+ const validKeys = util22.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
1357
+ const filtered = {};
1358
+ for (const k of validKeys) {
1359
+ filtered[k] = obj[k];
1360
+ }
1361
+ return util22.objectValues(filtered);
1362
+ };
1363
+ util22.objectValues = (obj) => {
1364
+ return util22.objectKeys(obj).map(function(e) {
1365
+ return obj[e];
1366
+ });
1367
+ };
1368
+ util22.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
1369
+ const keys = [];
1370
+ for (const key in object) {
1371
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
1372
+ keys.push(key);
1373
+ }
1374
+ }
1375
+ return keys;
1376
+ };
1377
+ util22.find = (arr, checker) => {
1378
+ for (const item of arr) {
1379
+ if (checker(item))
1380
+ return item;
1381
+ }
1382
+ return void 0;
1383
+ };
1384
+ util22.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
1385
+ function joinValues(array, separator = " | ") {
1386
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
1387
+ }
1388
+ __name(joinValues, "joinValues");
1389
+ __name2(joinValues, "joinValues");
1390
+ __name22(joinValues, "joinValues");
1391
+ __name222(joinValues, "joinValues");
1392
+ util22.joinValues = joinValues;
1393
+ util22.jsonStringifyReplacer = (_, value) => {
1394
+ if (typeof value === "bigint") {
1395
+ return value.toString();
1396
+ }
1397
+ return value;
1398
+ };
1399
+ })(util2 || (util2 = {}));
1400
+ var ZodParsedType2 = util2.arrayToEnum([
1401
+ "string",
1402
+ "nan",
1403
+ "number",
1404
+ "integer",
1405
+ "float",
1406
+ "boolean",
1407
+ "date",
1408
+ "bigint",
1409
+ "symbol",
1410
+ "function",
1411
+ "undefined",
1412
+ "null",
1413
+ "array",
1414
+ "object",
1415
+ "unknown",
1416
+ "promise",
1417
+ "void",
1418
+ "never",
1419
+ "map",
1420
+ "set"
1421
+ ]);
1422
+ var getParsedType2 = /* @__PURE__ */ __name222((data) => {
1423
+ const t = typeof data;
1424
+ switch (t) {
1425
+ case "undefined":
1426
+ return ZodParsedType2.undefined;
1427
+ case "string":
1428
+ return ZodParsedType2.string;
1429
+ case "number":
1430
+ return isNaN(data) ? ZodParsedType2.nan : ZodParsedType2.number;
1431
+ case "boolean":
1432
+ return ZodParsedType2.boolean;
1433
+ case "function":
1434
+ return ZodParsedType2.function;
1435
+ case "bigint":
1436
+ return ZodParsedType2.bigint;
1437
+ case "symbol":
1438
+ return ZodParsedType2.symbol;
1439
+ case "object":
1440
+ if (Array.isArray(data)) {
1441
+ return ZodParsedType2.array;
1442
+ }
1443
+ if (data === null) {
1444
+ return ZodParsedType2.null;
1445
+ }
1446
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
1447
+ return ZodParsedType2.promise;
1448
+ }
1449
+ if (typeof Map !== "undefined" && data instanceof Map) {
1450
+ return ZodParsedType2.map;
1451
+ }
1452
+ if (typeof Set !== "undefined" && data instanceof Set) {
1453
+ return ZodParsedType2.set;
1454
+ }
1455
+ if (typeof Date !== "undefined" && data instanceof Date) {
1456
+ return ZodParsedType2.date;
1457
+ }
1458
+ return ZodParsedType2.object;
1459
+ default:
1460
+ return ZodParsedType2.unknown;
1461
+ }
1462
+ }, "getParsedType");
1463
+ var ZodIssueCode2 = util2.arrayToEnum([
1464
+ "invalid_type",
1465
+ "invalid_literal",
1466
+ "custom",
1467
+ "invalid_union",
1468
+ "invalid_union_discriminator",
1469
+ "invalid_enum_value",
1470
+ "unrecognized_keys",
1471
+ "invalid_arguments",
1472
+ "invalid_return_type",
1473
+ "invalid_date",
1474
+ "invalid_string",
1475
+ "too_small",
1476
+ "too_big",
1477
+ "invalid_intersection_types",
1478
+ "not_multiple_of",
1479
+ "not_finite"
1480
+ ]);
1481
+ var quotelessJson2 = /* @__PURE__ */ __name222((obj) => {
1482
+ const json = JSON.stringify(obj, null, 2);
1483
+ return json.replace(/"([^"]+)":/g, "$1:");
1484
+ }, "quotelessJson");
1485
+ var ZodError2 = /* @__PURE__ */ __name22(class extends Error {
1486
+ constructor(issues) {
1487
+ super();
1488
+ this.issues = [];
1489
+ this.addIssue = (sub) => {
1490
+ this.issues = [...this.issues, sub];
1491
+ };
1492
+ this.addIssues = (subs = []) => {
1493
+ this.issues = [...this.issues, ...subs];
1494
+ };
1495
+ const actualProto = new.target.prototype;
1496
+ if (Object.setPrototypeOf) {
1497
+ Object.setPrototypeOf(this, actualProto);
1498
+ } else {
1499
+ this.__proto__ = actualProto;
1500
+ }
1501
+ this.name = "ZodError";
1502
+ this.issues = issues;
1503
+ }
1504
+ get errors() {
1505
+ return this.issues;
1506
+ }
1507
+ format(_mapper) {
1508
+ const mapper = _mapper || function(issue) {
1509
+ return issue.message;
1510
+ };
1511
+ const fieldErrors = { _errors: [] };
1512
+ const processError = /* @__PURE__ */ __name222((error) => {
1513
+ for (const issue of error.issues) {
1514
+ if (issue.code === "invalid_union") {
1515
+ issue.unionErrors.map(processError);
1516
+ } else if (issue.code === "invalid_return_type") {
1517
+ processError(issue.returnTypeError);
1518
+ } else if (issue.code === "invalid_arguments") {
1519
+ processError(issue.argumentsError);
1520
+ } else if (issue.path.length === 0) {
1521
+ fieldErrors._errors.push(mapper(issue));
1522
+ } else {
1523
+ let curr = fieldErrors;
1524
+ let i = 0;
1525
+ while (i < issue.path.length) {
1526
+ const el = issue.path[i];
1527
+ const terminal = i === issue.path.length - 1;
1528
+ if (!terminal) {
1529
+ curr[el] = curr[el] || { _errors: [] };
1530
+ } else {
1531
+ curr[el] = curr[el] || { _errors: [] };
1532
+ curr[el]._errors.push(mapper(issue));
1533
+ }
1534
+ curr = curr[el];
1535
+ i++;
1536
+ }
1537
+ }
1538
+ }
1539
+ }, "processError");
1540
+ processError(this);
1541
+ return fieldErrors;
1542
+ }
1543
+ toString() {
1544
+ return this.message;
1545
+ }
1546
+ get message() {
1547
+ return JSON.stringify(this.issues, util2.jsonStringifyReplacer, 2);
1548
+ }
1549
+ get isEmpty() {
1550
+ return this.issues.length === 0;
1551
+ }
1552
+ flatten(mapper = (issue) => issue.message) {
1553
+ const fieldErrors = {};
1554
+ const formErrors = [];
1555
+ for (const sub of this.issues) {
1556
+ if (sub.path.length > 0) {
1557
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
1558
+ fieldErrors[sub.path[0]].push(mapper(sub));
1559
+ } else {
1560
+ formErrors.push(mapper(sub));
1561
+ }
1562
+ }
1563
+ return { formErrors, fieldErrors };
1564
+ }
1565
+ get formErrors() {
1566
+ return this.flatten();
1567
+ }
1568
+ }, "ZodError");
1569
+ __name222(ZodError2, "ZodError");
1570
+ ZodError2.create = (issues) => {
1571
+ const error = new ZodError2(issues);
1572
+ return error;
1573
+ };
1574
+ var errorMap2 = /* @__PURE__ */ __name222((issue, _ctx) => {
1575
+ let message;
1576
+ switch (issue.code) {
1577
+ case ZodIssueCode2.invalid_type:
1578
+ if (issue.received === ZodParsedType2.undefined) {
1579
+ message = "Required";
1580
+ } else {
1581
+ message = `Expected ${issue.expected}, received ${issue.received}`;
1582
+ }
1583
+ break;
1584
+ case ZodIssueCode2.invalid_literal:
1585
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util2.jsonStringifyReplacer)}`;
1586
+ break;
1587
+ case ZodIssueCode2.unrecognized_keys:
1588
+ message = `Unrecognized key(s) in object: ${util2.joinValues(issue.keys, ", ")}`;
1589
+ break;
1590
+ case ZodIssueCode2.invalid_union:
1591
+ message = `Invalid input`;
1592
+ break;
1593
+ case ZodIssueCode2.invalid_union_discriminator:
1594
+ message = `Invalid discriminator value. Expected ${util2.joinValues(issue.options)}`;
1595
+ break;
1596
+ case ZodIssueCode2.invalid_enum_value:
1597
+ message = `Invalid enum value. Expected ${util2.joinValues(issue.options)}, received '${issue.received}'`;
1598
+ break;
1599
+ case ZodIssueCode2.invalid_arguments:
1600
+ message = `Invalid function arguments`;
1601
+ break;
1602
+ case ZodIssueCode2.invalid_return_type:
1603
+ message = `Invalid function return type`;
1604
+ break;
1605
+ case ZodIssueCode2.invalid_date:
1606
+ message = `Invalid date`;
1607
+ break;
1608
+ case ZodIssueCode2.invalid_string:
1609
+ if (typeof issue.validation === "object") {
1610
+ if ("startsWith" in issue.validation) {
1611
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
1612
+ } else if ("endsWith" in issue.validation) {
1613
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
1614
+ } else {
1615
+ util2.assertNever(issue.validation);
1616
+ }
1617
+ } else if (issue.validation !== "regex") {
1618
+ message = `Invalid ${issue.validation}`;
1619
+ } else {
1620
+ message = "Invalid";
1621
+ }
1622
+ break;
1623
+ case ZodIssueCode2.too_small:
1624
+ if (issue.type === "array")
1625
+ message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
1626
+ else if (issue.type === "string")
1627
+ message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
1628
+ else if (issue.type === "number")
1629
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
1630
+ else if (issue.type === "date")
1631
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
1632
+ else
1633
+ message = "Invalid input";
1634
+ break;
1635
+ case ZodIssueCode2.too_big:
1636
+ if (issue.type === "array")
1637
+ message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
1638
+ else if (issue.type === "string")
1639
+ message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
1640
+ else if (issue.type === "number")
1641
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1642
+ else if (issue.type === "date")
1643
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
1644
+ else
1645
+ message = "Invalid input";
1646
+ break;
1647
+ case ZodIssueCode2.custom:
1648
+ message = `Invalid input`;
1649
+ break;
1650
+ case ZodIssueCode2.invalid_intersection_types:
1651
+ message = `Intersection results could not be merged`;
1652
+ break;
1653
+ case ZodIssueCode2.not_multiple_of:
1654
+ message = `Number must be a multiple of ${issue.multipleOf}`;
1655
+ break;
1656
+ case ZodIssueCode2.not_finite:
1657
+ message = "Number must be finite";
1658
+ break;
1659
+ default:
1660
+ message = _ctx.defaultError;
1661
+ util2.assertNever(issue);
1662
+ }
1663
+ return { message };
1664
+ }, "errorMap");
1665
+ var overrideErrorMap2 = errorMap2;
1666
+ function setErrorMap2(map) {
1667
+ overrideErrorMap2 = map;
1668
+ }
1669
+ __name(setErrorMap2, "setErrorMap");
1670
+ __name2(setErrorMap2, "setErrorMap");
1671
+ __name22(setErrorMap2, "setErrorMap");
1672
+ __name222(setErrorMap2, "setErrorMap");
1673
+ function getErrorMap2() {
1674
+ return overrideErrorMap2;
1675
+ }
1676
+ __name(getErrorMap2, "getErrorMap");
1677
+ __name2(getErrorMap2, "getErrorMap");
1678
+ __name22(getErrorMap2, "getErrorMap");
1679
+ __name222(getErrorMap2, "getErrorMap");
1680
+ var makeIssue2 = /* @__PURE__ */ __name222((params) => {
1681
+ const { data, path, errorMaps, issueData } = params;
1682
+ const fullPath = [...path, ...issueData.path || []];
1683
+ const fullIssue = {
1684
+ ...issueData,
1685
+ path: fullPath
1686
+ };
1687
+ let errorMessage = "";
1688
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
1689
+ for (const map of maps) {
1690
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
1691
+ }
1692
+ return {
1693
+ ...issueData,
1694
+ path: fullPath,
1695
+ message: issueData.message || errorMessage
1696
+ };
1697
+ }, "makeIssue");
1698
+ var EMPTY_PATH2 = [];
1699
+ function addIssueToContext2(ctx, issueData) {
1700
+ const issue = makeIssue2({
1701
+ issueData,
1702
+ data: ctx.data,
1703
+ path: ctx.path,
1704
+ errorMaps: [
1705
+ ctx.common.contextualErrorMap,
1706
+ ctx.schemaErrorMap,
1707
+ getErrorMap2(),
1708
+ errorMap2
1709
+ ].filter((x) => !!x)
1710
+ });
1711
+ ctx.common.issues.push(issue);
1712
+ }
1713
+ __name(addIssueToContext2, "addIssueToContext");
1714
+ __name2(addIssueToContext2, "addIssueToContext");
1715
+ __name22(addIssueToContext2, "addIssueToContext");
1716
+ __name222(addIssueToContext2, "addIssueToContext");
1717
+ var ParseStatus2 = /* @__PURE__ */ __name22(class {
1718
+ constructor() {
1719
+ this.value = "valid";
1720
+ }
1721
+ dirty() {
1722
+ if (this.value === "valid")
1723
+ this.value = "dirty";
1724
+ }
1725
+ abort() {
1726
+ if (this.value !== "aborted")
1727
+ this.value = "aborted";
1728
+ }
1729
+ static mergeArray(status, results) {
1730
+ const arrayValue = [];
1731
+ for (const s of results) {
1732
+ if (s.status === "aborted")
1733
+ return INVALID2;
1734
+ if (s.status === "dirty")
1735
+ status.dirty();
1736
+ arrayValue.push(s.value);
1737
+ }
1738
+ return { status: status.value, value: arrayValue };
1739
+ }
1740
+ static async mergeObjectAsync(status, pairs) {
1741
+ const syncPairs = [];
1742
+ for (const pair of pairs) {
1743
+ syncPairs.push({
1744
+ key: await pair.key,
1745
+ value: await pair.value
1746
+ });
1747
+ }
1748
+ return ParseStatus2.mergeObjectSync(status, syncPairs);
1749
+ }
1750
+ static mergeObjectSync(status, pairs) {
1751
+ const finalObject = {};
1752
+ for (const pair of pairs) {
1753
+ const { key, value } = pair;
1754
+ if (key.status === "aborted")
1755
+ return INVALID2;
1756
+ if (value.status === "aborted")
1757
+ return INVALID2;
1758
+ if (key.status === "dirty")
1759
+ status.dirty();
1760
+ if (value.status === "dirty")
1761
+ status.dirty();
1762
+ if (typeof value.value !== "undefined" || pair.alwaysSet) {
1763
+ finalObject[key.value] = value.value;
1764
+ }
1765
+ }
1766
+ return { status: status.value, value: finalObject };
1767
+ }
1768
+ }, "ParseStatus");
1769
+ __name222(ParseStatus2, "ParseStatus");
1770
+ var INVALID2 = Object.freeze({
1771
+ status: "aborted"
1772
+ });
1773
+ var DIRTY2 = /* @__PURE__ */ __name222((value) => ({ status: "dirty", value }), "DIRTY");
1774
+ var OK2 = /* @__PURE__ */ __name222((value) => ({ status: "valid", value }), "OK");
1775
+ var isAborted2 = /* @__PURE__ */ __name222((x) => x.status === "aborted", "isAborted");
1776
+ var isDirty2 = /* @__PURE__ */ __name222((x) => x.status === "dirty", "isDirty");
1777
+ var isValid2 = /* @__PURE__ */ __name222((x) => x.status === "valid", "isValid");
1778
+ var isAsync2 = /* @__PURE__ */ __name222((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
1779
+ var errorUtil2;
1780
+ (function(errorUtil22) {
1781
+ errorUtil22.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1782
+ errorUtil22.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1783
+ })(errorUtil2 || (errorUtil2 = {}));
1784
+ var ParseInputLazyPath2 = /* @__PURE__ */ __name22(class {
1785
+ constructor(parent, value, path, key) {
1786
+ this.parent = parent;
1787
+ this.data = value;
1788
+ this._path = path;
1789
+ this._key = key;
1790
+ }
1791
+ get path() {
1792
+ return this._path.concat(this._key);
1793
+ }
1794
+ }, "ParseInputLazyPath");
1795
+ __name222(ParseInputLazyPath2, "ParseInputLazyPath");
1796
+ var handleResult2 = /* @__PURE__ */ __name222((ctx, result) => {
1797
+ if (isValid2(result)) {
1798
+ return { success: true, data: result.value };
1799
+ } else {
1800
+ if (!ctx.common.issues.length) {
1801
+ throw new Error("Validation failed but no issues detected.");
1802
+ }
1803
+ const error = new ZodError2(ctx.common.issues);
1804
+ return { success: false, error };
1805
+ }
1806
+ }, "handleResult");
1807
+ function processCreateParams2(params) {
1808
+ if (!params)
1809
+ return {};
1810
+ const { errorMap: errorMap22, invalid_type_error, required_error, description } = params;
1811
+ if (errorMap22 && (invalid_type_error || required_error)) {
1812
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
1813
+ }
1814
+ if (errorMap22)
1815
+ return { errorMap: errorMap22, description };
1816
+ const customMap = /* @__PURE__ */ __name222((iss, ctx) => {
1817
+ if (iss.code !== "invalid_type")
1818
+ return { message: ctx.defaultError };
1819
+ if (typeof ctx.data === "undefined") {
1820
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
1821
+ }
1822
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
1823
+ }, "customMap");
1824
+ return { errorMap: customMap, description };
1825
+ }
1826
+ __name(processCreateParams2, "processCreateParams");
1827
+ __name2(processCreateParams2, "processCreateParams");
1828
+ __name22(processCreateParams2, "processCreateParams");
1829
+ __name222(processCreateParams2, "processCreateParams");
1830
+ var ZodType2 = /* @__PURE__ */ __name22(class {
1831
+ constructor(def) {
1832
+ this.spa = this.safeParseAsync;
1833
+ this._def = def;
1834
+ this.parse = this.parse.bind(this);
1835
+ this.safeParse = this.safeParse.bind(this);
1836
+ this.parseAsync = this.parseAsync.bind(this);
1837
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1838
+ this.spa = this.spa.bind(this);
1839
+ this.refine = this.refine.bind(this);
1840
+ this.refinement = this.refinement.bind(this);
1841
+ this.superRefine = this.superRefine.bind(this);
1842
+ this.optional = this.optional.bind(this);
1843
+ this.nullable = this.nullable.bind(this);
1844
+ this.nullish = this.nullish.bind(this);
1845
+ this.array = this.array.bind(this);
1846
+ this.promise = this.promise.bind(this);
1847
+ this.or = this.or.bind(this);
1848
+ this.and = this.and.bind(this);
1849
+ this.transform = this.transform.bind(this);
1850
+ this.brand = this.brand.bind(this);
1851
+ this.default = this.default.bind(this);
1852
+ this.catch = this.catch.bind(this);
1853
+ this.describe = this.describe.bind(this);
1854
+ this.pipe = this.pipe.bind(this);
1855
+ this.isNullable = this.isNullable.bind(this);
1856
+ this.isOptional = this.isOptional.bind(this);
1857
+ }
1858
+ get description() {
1859
+ return this._def.description;
1860
+ }
1861
+ _getType(input) {
1862
+ return getParsedType2(input.data);
1863
+ }
1864
+ _getOrReturnCtx(input, ctx) {
1865
+ return ctx || {
1866
+ common: input.parent.common,
1867
+ data: input.data,
1868
+ parsedType: getParsedType2(input.data),
1869
+ schemaErrorMap: this._def.errorMap,
1870
+ path: input.path,
1871
+ parent: input.parent
1872
+ };
1873
+ }
1874
+ _processInputParams(input) {
1875
+ return {
1876
+ status: new ParseStatus2(),
1877
+ ctx: {
1878
+ common: input.parent.common,
1879
+ data: input.data,
1880
+ parsedType: getParsedType2(input.data),
1881
+ schemaErrorMap: this._def.errorMap,
1882
+ path: input.path,
1883
+ parent: input.parent
1884
+ }
1885
+ };
1886
+ }
1887
+ _parseSync(input) {
1888
+ const result = this._parse(input);
1889
+ if (isAsync2(result)) {
1890
+ throw new Error("Synchronous parse encountered promise.");
1891
+ }
1892
+ return result;
1893
+ }
1894
+ _parseAsync(input) {
1895
+ const result = this._parse(input);
1896
+ return Promise.resolve(result);
1897
+ }
1898
+ parse(data, params) {
1899
+ const result = this.safeParse(data, params);
1900
+ if (result.success)
1901
+ return result.data;
1902
+ throw result.error;
1903
+ }
1904
+ safeParse(data, params) {
1905
+ var _a;
1906
+ const ctx = {
1907
+ common: {
1908
+ issues: [],
1909
+ async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1910
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
1911
+ },
1912
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
1913
+ schemaErrorMap: this._def.errorMap,
1914
+ parent: null,
1915
+ data,
1916
+ parsedType: getParsedType2(data)
1917
+ };
1918
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1919
+ return handleResult2(ctx, result);
1920
+ }
1921
+ async parseAsync(data, params) {
1922
+ const result = await this.safeParseAsync(data, params);
1923
+ if (result.success)
1924
+ return result.data;
1925
+ throw result.error;
1926
+ }
1927
+ async safeParseAsync(data, params) {
1928
+ const ctx = {
1929
+ common: {
1930
+ issues: [],
1931
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1932
+ async: true
1933
+ },
1934
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
1935
+ schemaErrorMap: this._def.errorMap,
1936
+ parent: null,
1937
+ data,
1938
+ parsedType: getParsedType2(data)
1939
+ };
1940
+ const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
1941
+ const result = await (isAsync2(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
1942
+ return handleResult2(ctx, result);
1943
+ }
1944
+ refine(check, message) {
1945
+ const getIssueProperties = /* @__PURE__ */ __name222((val) => {
1946
+ if (typeof message === "string" || typeof message === "undefined") {
1947
+ return { message };
1948
+ } else if (typeof message === "function") {
1949
+ return message(val);
1950
+ } else {
1951
+ return message;
1952
+ }
1953
+ }, "getIssueProperties");
1954
+ return this._refinement((val, ctx) => {
1955
+ const result = check(val);
1956
+ const setError = /* @__PURE__ */ __name222(() => ctx.addIssue({
1957
+ code: ZodIssueCode2.custom,
1958
+ ...getIssueProperties(val)
1959
+ }), "setError");
1960
+ if (typeof Promise !== "undefined" && result instanceof Promise) {
1961
+ return result.then((data) => {
1962
+ if (!data) {
1963
+ setError();
1964
+ return false;
1965
+ } else {
1966
+ return true;
1967
+ }
1968
+ });
1969
+ }
1970
+ if (!result) {
1971
+ setError();
1972
+ return false;
1973
+ } else {
1974
+ return true;
1975
+ }
1976
+ });
1977
+ }
1978
+ refinement(check, refinementData) {
1979
+ return this._refinement((val, ctx) => {
1980
+ if (!check(val)) {
1981
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
1982
+ return false;
1983
+ } else {
1984
+ return true;
1985
+ }
1986
+ });
1987
+ }
1988
+ _refinement(refinement) {
1989
+ return new ZodEffects2({
1990
+ schema: this,
1991
+ typeName: ZodFirstPartyTypeKind2.ZodEffects,
1992
+ effect: { type: "refinement", refinement }
1993
+ });
1994
+ }
1995
+ superRefine(refinement) {
1996
+ return this._refinement(refinement);
1997
+ }
1998
+ optional() {
1999
+ return ZodOptional2.create(this);
2000
+ }
2001
+ nullable() {
2002
+ return ZodNullable2.create(this);
2003
+ }
2004
+ nullish() {
2005
+ return this.optional().nullable();
2006
+ }
2007
+ array() {
2008
+ return ZodArray2.create(this);
2009
+ }
2010
+ promise() {
2011
+ return ZodPromise2.create(this);
2012
+ }
2013
+ or(option) {
2014
+ return ZodUnion2.create([this, option]);
2015
+ }
2016
+ and(incoming) {
2017
+ return ZodIntersection2.create(this, incoming);
2018
+ }
2019
+ transform(transform) {
2020
+ return new ZodEffects2({
2021
+ schema: this,
2022
+ typeName: ZodFirstPartyTypeKind2.ZodEffects,
2023
+ effect: { type: "transform", transform }
2024
+ });
2025
+ }
2026
+ default(def) {
2027
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
2028
+ return new ZodDefault2({
2029
+ innerType: this,
2030
+ defaultValue: defaultValueFunc,
2031
+ typeName: ZodFirstPartyTypeKind2.ZodDefault
2032
+ });
2033
+ }
2034
+ brand() {
2035
+ return new ZodBranded2({
2036
+ typeName: ZodFirstPartyTypeKind2.ZodBranded,
2037
+ type: this,
2038
+ ...processCreateParams2(void 0)
2039
+ });
2040
+ }
2041
+ catch(def) {
2042
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
2043
+ return new ZodCatch2({
2044
+ innerType: this,
2045
+ defaultValue: defaultValueFunc,
2046
+ typeName: ZodFirstPartyTypeKind2.ZodCatch
2047
+ });
2048
+ }
2049
+ describe(description) {
2050
+ const This = this.constructor;
2051
+ return new This({
2052
+ ...this._def,
2053
+ description
2054
+ });
2055
+ }
2056
+ pipe(target) {
2057
+ return ZodPipeline2.create(this, target);
2058
+ }
2059
+ isOptional() {
2060
+ return this.safeParse(void 0).success;
2061
+ }
2062
+ isNullable() {
2063
+ return this.safeParse(null).success;
2064
+ }
2065
+ }, "ZodType");
2066
+ __name222(ZodType2, "ZodType");
2067
+ var cuidRegex2 = /^c[^\s-]{8,}$/i;
2068
+ var uuidRegex2 = /^([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;
2069
+ var emailRegex2 = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
2070
+ var datetimeRegex2 = /* @__PURE__ */ __name222((args) => {
2071
+ if (args.precision) {
2072
+ if (args.offset) {
2073
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
2074
+ } else {
2075
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
2076
+ }
2077
+ } else if (args.precision === 0) {
2078
+ if (args.offset) {
2079
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
2080
+ } else {
2081
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
2082
+ }
2083
+ } else {
2084
+ if (args.offset) {
2085
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
2086
+ } else {
2087
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
2088
+ }
2089
+ }
2090
+ }, "datetimeRegex");
2091
+ var ZodString2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2092
+ constructor() {
2093
+ super(...arguments);
2094
+ this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
2095
+ validation,
2096
+ code: ZodIssueCode2.invalid_string,
2097
+ ...errorUtil2.errToObj(message)
2098
+ });
2099
+ this.nonempty = (message) => this.min(1, errorUtil2.errToObj(message));
2100
+ this.trim = () => new ZodString2({
2101
+ ...this._def,
2102
+ checks: [...this._def.checks, { kind: "trim" }]
2103
+ });
2104
+ }
2105
+ _parse(input) {
2106
+ if (this._def.coerce) {
2107
+ input.data = String(input.data);
2108
+ }
2109
+ const parsedType = this._getType(input);
2110
+ if (parsedType !== ZodParsedType2.string) {
2111
+ const ctx2 = this._getOrReturnCtx(input);
2112
+ addIssueToContext2(
2113
+ ctx2,
2114
+ {
2115
+ code: ZodIssueCode2.invalid_type,
2116
+ expected: ZodParsedType2.string,
2117
+ received: ctx2.parsedType
2118
+ }
2119
+ );
2120
+ return INVALID2;
2121
+ }
2122
+ const status = new ParseStatus2();
2123
+ let ctx = void 0;
2124
+ for (const check of this._def.checks) {
2125
+ if (check.kind === "min") {
2126
+ if (input.data.length < check.value) {
2127
+ ctx = this._getOrReturnCtx(input, ctx);
2128
+ addIssueToContext2(ctx, {
2129
+ code: ZodIssueCode2.too_small,
2130
+ minimum: check.value,
2131
+ type: "string",
2132
+ inclusive: true,
2133
+ exact: false,
2134
+ message: check.message
2135
+ });
2136
+ status.dirty();
2137
+ }
2138
+ } else if (check.kind === "max") {
2139
+ if (input.data.length > check.value) {
2140
+ ctx = this._getOrReturnCtx(input, ctx);
2141
+ addIssueToContext2(ctx, {
2142
+ code: ZodIssueCode2.too_big,
2143
+ maximum: check.value,
2144
+ type: "string",
2145
+ inclusive: true,
2146
+ exact: false,
2147
+ message: check.message
2148
+ });
2149
+ status.dirty();
2150
+ }
2151
+ } else if (check.kind === "length") {
2152
+ const tooBig = input.data.length > check.value;
2153
+ const tooSmall = input.data.length < check.value;
2154
+ if (tooBig || tooSmall) {
2155
+ ctx = this._getOrReturnCtx(input, ctx);
2156
+ if (tooBig) {
2157
+ addIssueToContext2(ctx, {
2158
+ code: ZodIssueCode2.too_big,
2159
+ maximum: check.value,
2160
+ type: "string",
2161
+ inclusive: true,
2162
+ exact: true,
2163
+ message: check.message
2164
+ });
2165
+ } else if (tooSmall) {
2166
+ addIssueToContext2(ctx, {
2167
+ code: ZodIssueCode2.too_small,
2168
+ minimum: check.value,
2169
+ type: "string",
2170
+ inclusive: true,
2171
+ exact: true,
2172
+ message: check.message
2173
+ });
2174
+ }
2175
+ status.dirty();
2176
+ }
2177
+ } else if (check.kind === "email") {
2178
+ if (!emailRegex2.test(input.data)) {
2179
+ ctx = this._getOrReturnCtx(input, ctx);
2180
+ addIssueToContext2(ctx, {
2181
+ validation: "email",
2182
+ code: ZodIssueCode2.invalid_string,
2183
+ message: check.message
2184
+ });
2185
+ status.dirty();
2186
+ }
2187
+ } else if (check.kind === "uuid") {
2188
+ if (!uuidRegex2.test(input.data)) {
2189
+ ctx = this._getOrReturnCtx(input, ctx);
2190
+ addIssueToContext2(ctx, {
2191
+ validation: "uuid",
2192
+ code: ZodIssueCode2.invalid_string,
2193
+ message: check.message
2194
+ });
2195
+ status.dirty();
2196
+ }
2197
+ } else if (check.kind === "cuid") {
2198
+ if (!cuidRegex2.test(input.data)) {
2199
+ ctx = this._getOrReturnCtx(input, ctx);
2200
+ addIssueToContext2(ctx, {
2201
+ validation: "cuid",
2202
+ code: ZodIssueCode2.invalid_string,
2203
+ message: check.message
2204
+ });
2205
+ status.dirty();
2206
+ }
2207
+ } else if (check.kind === "url") {
2208
+ try {
2209
+ new URL(input.data);
2210
+ } catch (_a) {
2211
+ ctx = this._getOrReturnCtx(input, ctx);
2212
+ addIssueToContext2(ctx, {
2213
+ validation: "url",
2214
+ code: ZodIssueCode2.invalid_string,
2215
+ message: check.message
2216
+ });
2217
+ status.dirty();
2218
+ }
2219
+ } else if (check.kind === "regex") {
2220
+ check.regex.lastIndex = 0;
2221
+ const testResult = check.regex.test(input.data);
2222
+ if (!testResult) {
2223
+ ctx = this._getOrReturnCtx(input, ctx);
2224
+ addIssueToContext2(ctx, {
2225
+ validation: "regex",
2226
+ code: ZodIssueCode2.invalid_string,
2227
+ message: check.message
2228
+ });
2229
+ status.dirty();
2230
+ }
2231
+ } else if (check.kind === "trim") {
2232
+ input.data = input.data.trim();
2233
+ } else if (check.kind === "startsWith") {
2234
+ if (!input.data.startsWith(check.value)) {
2235
+ ctx = this._getOrReturnCtx(input, ctx);
2236
+ addIssueToContext2(ctx, {
2237
+ code: ZodIssueCode2.invalid_string,
2238
+ validation: { startsWith: check.value },
2239
+ message: check.message
2240
+ });
2241
+ status.dirty();
2242
+ }
2243
+ } else if (check.kind === "endsWith") {
2244
+ if (!input.data.endsWith(check.value)) {
2245
+ ctx = this._getOrReturnCtx(input, ctx);
2246
+ addIssueToContext2(ctx, {
2247
+ code: ZodIssueCode2.invalid_string,
2248
+ validation: { endsWith: check.value },
2249
+ message: check.message
2250
+ });
2251
+ status.dirty();
2252
+ }
2253
+ } else if (check.kind === "datetime") {
2254
+ const regex = datetimeRegex2(check);
2255
+ if (!regex.test(input.data)) {
2256
+ ctx = this._getOrReturnCtx(input, ctx);
2257
+ addIssueToContext2(ctx, {
2258
+ code: ZodIssueCode2.invalid_string,
2259
+ validation: "datetime",
2260
+ message: check.message
2261
+ });
2262
+ status.dirty();
2263
+ }
2264
+ } else {
2265
+ util2.assertNever(check);
2266
+ }
2267
+ }
2268
+ return { status: status.value, value: input.data };
2269
+ }
2270
+ _addCheck(check) {
2271
+ return new ZodString2({
2272
+ ...this._def,
2273
+ checks: [...this._def.checks, check]
2274
+ });
2275
+ }
2276
+ email(message) {
2277
+ return this._addCheck({ kind: "email", ...errorUtil2.errToObj(message) });
2278
+ }
2279
+ url(message) {
2280
+ return this._addCheck({ kind: "url", ...errorUtil2.errToObj(message) });
2281
+ }
2282
+ uuid(message) {
2283
+ return this._addCheck({ kind: "uuid", ...errorUtil2.errToObj(message) });
2284
+ }
2285
+ cuid(message) {
2286
+ return this._addCheck({ kind: "cuid", ...errorUtil2.errToObj(message) });
2287
+ }
2288
+ datetime(options) {
2289
+ var _a;
2290
+ if (typeof options === "string") {
2291
+ return this._addCheck({
2292
+ kind: "datetime",
2293
+ precision: null,
2294
+ offset: false,
2295
+ message: options
2296
+ });
2297
+ }
2298
+ return this._addCheck({
2299
+ kind: "datetime",
2300
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2301
+ offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2302
+ ...errorUtil2.errToObj(options === null || options === void 0 ? void 0 : options.message)
2303
+ });
2304
+ }
2305
+ regex(regex, message) {
2306
+ return this._addCheck({
2307
+ kind: "regex",
2308
+ regex,
2309
+ ...errorUtil2.errToObj(message)
2310
+ });
2311
+ }
2312
+ startsWith(value, message) {
2313
+ return this._addCheck({
2314
+ kind: "startsWith",
2315
+ value,
2316
+ ...errorUtil2.errToObj(message)
2317
+ });
2318
+ }
2319
+ endsWith(value, message) {
2320
+ return this._addCheck({
2321
+ kind: "endsWith",
2322
+ value,
2323
+ ...errorUtil2.errToObj(message)
2324
+ });
2325
+ }
2326
+ min(minLength, message) {
2327
+ return this._addCheck({
2328
+ kind: "min",
2329
+ value: minLength,
2330
+ ...errorUtil2.errToObj(message)
2331
+ });
2332
+ }
2333
+ max(maxLength, message) {
2334
+ return this._addCheck({
2335
+ kind: "max",
2336
+ value: maxLength,
2337
+ ...errorUtil2.errToObj(message)
2338
+ });
2339
+ }
2340
+ length(len, message) {
2341
+ return this._addCheck({
2342
+ kind: "length",
2343
+ value: len,
2344
+ ...errorUtil2.errToObj(message)
2345
+ });
2346
+ }
2347
+ get isDatetime() {
2348
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
2349
+ }
2350
+ get isEmail() {
2351
+ return !!this._def.checks.find((ch) => ch.kind === "email");
2352
+ }
2353
+ get isURL() {
2354
+ return !!this._def.checks.find((ch) => ch.kind === "url");
2355
+ }
2356
+ get isUUID() {
2357
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
2358
+ }
2359
+ get isCUID() {
2360
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
2361
+ }
2362
+ get minLength() {
2363
+ let min = null;
2364
+ for (const ch of this._def.checks) {
2365
+ if (ch.kind === "min") {
2366
+ if (min === null || ch.value > min)
2367
+ min = ch.value;
2368
+ }
2369
+ }
2370
+ return min;
2371
+ }
2372
+ get maxLength() {
2373
+ let max = null;
2374
+ for (const ch of this._def.checks) {
2375
+ if (ch.kind === "max") {
2376
+ if (max === null || ch.value < max)
2377
+ max = ch.value;
2378
+ }
2379
+ }
2380
+ return max;
2381
+ }
2382
+ }, "ZodString");
2383
+ __name222(ZodString2, "ZodString");
2384
+ ZodString2.create = (params) => {
2385
+ var _a;
2386
+ return new ZodString2({
2387
+ checks: [],
2388
+ typeName: ZodFirstPartyTypeKind2.ZodString,
2389
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2390
+ ...processCreateParams2(params)
2391
+ });
2392
+ };
2393
+ function floatSafeRemainder2(val, step) {
2394
+ const valDecCount = (val.toString().split(".")[1] || "").length;
2395
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
2396
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
2397
+ const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
2398
+ const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
2399
+ return valInt % stepInt / Math.pow(10, decCount);
2400
+ }
2401
+ __name(floatSafeRemainder2, "floatSafeRemainder");
2402
+ __name2(floatSafeRemainder2, "floatSafeRemainder");
2403
+ __name22(floatSafeRemainder2, "floatSafeRemainder");
2404
+ __name222(floatSafeRemainder2, "floatSafeRemainder");
2405
+ var ZodNumber2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2406
+ constructor() {
2407
+ super(...arguments);
2408
+ this.min = this.gte;
2409
+ this.max = this.lte;
2410
+ this.step = this.multipleOf;
2411
+ }
2412
+ _parse(input) {
2413
+ if (this._def.coerce) {
2414
+ input.data = Number(input.data);
2415
+ }
2416
+ const parsedType = this._getType(input);
2417
+ if (parsedType !== ZodParsedType2.number) {
2418
+ const ctx2 = this._getOrReturnCtx(input);
2419
+ addIssueToContext2(ctx2, {
2420
+ code: ZodIssueCode2.invalid_type,
2421
+ expected: ZodParsedType2.number,
2422
+ received: ctx2.parsedType
2423
+ });
2424
+ return INVALID2;
2425
+ }
2426
+ let ctx = void 0;
2427
+ const status = new ParseStatus2();
2428
+ for (const check of this._def.checks) {
2429
+ if (check.kind === "int") {
2430
+ if (!util2.isInteger(input.data)) {
2431
+ ctx = this._getOrReturnCtx(input, ctx);
2432
+ addIssueToContext2(ctx, {
2433
+ code: ZodIssueCode2.invalid_type,
2434
+ expected: "integer",
2435
+ received: "float",
2436
+ message: check.message
2437
+ });
2438
+ status.dirty();
2439
+ }
2440
+ } else if (check.kind === "min") {
2441
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2442
+ if (tooSmall) {
2443
+ ctx = this._getOrReturnCtx(input, ctx);
2444
+ addIssueToContext2(ctx, {
2445
+ code: ZodIssueCode2.too_small,
2446
+ minimum: check.value,
2447
+ type: "number",
2448
+ inclusive: check.inclusive,
2449
+ exact: false,
2450
+ message: check.message
2451
+ });
2452
+ status.dirty();
2453
+ }
2454
+ } else if (check.kind === "max") {
2455
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2456
+ if (tooBig) {
2457
+ ctx = this._getOrReturnCtx(input, ctx);
2458
+ addIssueToContext2(ctx, {
2459
+ code: ZodIssueCode2.too_big,
2460
+ maximum: check.value,
2461
+ type: "number",
2462
+ inclusive: check.inclusive,
2463
+ exact: false,
2464
+ message: check.message
2465
+ });
2466
+ status.dirty();
2467
+ }
2468
+ } else if (check.kind === "multipleOf") {
2469
+ if (floatSafeRemainder2(input.data, check.value) !== 0) {
2470
+ ctx = this._getOrReturnCtx(input, ctx);
2471
+ addIssueToContext2(ctx, {
2472
+ code: ZodIssueCode2.not_multiple_of,
2473
+ multipleOf: check.value,
2474
+ message: check.message
2475
+ });
2476
+ status.dirty();
2477
+ }
2478
+ } else if (check.kind === "finite") {
2479
+ if (!Number.isFinite(input.data)) {
2480
+ ctx = this._getOrReturnCtx(input, ctx);
2481
+ addIssueToContext2(ctx, {
2482
+ code: ZodIssueCode2.not_finite,
2483
+ message: check.message
2484
+ });
2485
+ status.dirty();
2486
+ }
2487
+ } else {
2488
+ util2.assertNever(check);
2489
+ }
2490
+ }
2491
+ return { status: status.value, value: input.data };
2492
+ }
2493
+ gte(value, message) {
2494
+ return this.setLimit("min", value, true, errorUtil2.toString(message));
2495
+ }
2496
+ gt(value, message) {
2497
+ return this.setLimit("min", value, false, errorUtil2.toString(message));
2498
+ }
2499
+ lte(value, message) {
2500
+ return this.setLimit("max", value, true, errorUtil2.toString(message));
2501
+ }
2502
+ lt(value, message) {
2503
+ return this.setLimit("max", value, false, errorUtil2.toString(message));
2504
+ }
2505
+ setLimit(kind, value, inclusive, message) {
2506
+ return new ZodNumber2({
2507
+ ...this._def,
2508
+ checks: [
2509
+ ...this._def.checks,
2510
+ {
2511
+ kind,
2512
+ value,
2513
+ inclusive,
2514
+ message: errorUtil2.toString(message)
2515
+ }
2516
+ ]
2517
+ });
2518
+ }
2519
+ _addCheck(check) {
2520
+ return new ZodNumber2({
2521
+ ...this._def,
2522
+ checks: [...this._def.checks, check]
2523
+ });
2524
+ }
2525
+ int(message) {
2526
+ return this._addCheck({
2527
+ kind: "int",
2528
+ message: errorUtil2.toString(message)
2529
+ });
2530
+ }
2531
+ positive(message) {
2532
+ return this._addCheck({
2533
+ kind: "min",
2534
+ value: 0,
2535
+ inclusive: false,
2536
+ message: errorUtil2.toString(message)
2537
+ });
2538
+ }
2539
+ negative(message) {
2540
+ return this._addCheck({
2541
+ kind: "max",
2542
+ value: 0,
2543
+ inclusive: false,
2544
+ message: errorUtil2.toString(message)
2545
+ });
2546
+ }
2547
+ nonpositive(message) {
2548
+ return this._addCheck({
2549
+ kind: "max",
2550
+ value: 0,
2551
+ inclusive: true,
2552
+ message: errorUtil2.toString(message)
2553
+ });
2554
+ }
2555
+ nonnegative(message) {
2556
+ return this._addCheck({
2557
+ kind: "min",
2558
+ value: 0,
2559
+ inclusive: true,
2560
+ message: errorUtil2.toString(message)
2561
+ });
2562
+ }
2563
+ multipleOf(value, message) {
2564
+ return this._addCheck({
2565
+ kind: "multipleOf",
2566
+ value,
2567
+ message: errorUtil2.toString(message)
2568
+ });
2569
+ }
2570
+ finite(message) {
2571
+ return this._addCheck({
2572
+ kind: "finite",
2573
+ message: errorUtil2.toString(message)
2574
+ });
2575
+ }
2576
+ get minValue() {
2577
+ let min = null;
2578
+ for (const ch of this._def.checks) {
2579
+ if (ch.kind === "min") {
2580
+ if (min === null || ch.value > min)
2581
+ min = ch.value;
2582
+ }
2583
+ }
2584
+ return min;
2585
+ }
2586
+ get maxValue() {
2587
+ let max = null;
2588
+ for (const ch of this._def.checks) {
2589
+ if (ch.kind === "max") {
2590
+ if (max === null || ch.value < max)
2591
+ max = ch.value;
2592
+ }
2593
+ }
2594
+ return max;
2595
+ }
2596
+ get isInt() {
2597
+ return !!this._def.checks.find((ch) => ch.kind === "int");
2598
+ }
2599
+ }, "ZodNumber");
2600
+ __name222(ZodNumber2, "ZodNumber");
2601
+ ZodNumber2.create = (params) => {
2602
+ return new ZodNumber2({
2603
+ checks: [],
2604
+ typeName: ZodFirstPartyTypeKind2.ZodNumber,
2605
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2606
+ ...processCreateParams2(params)
2607
+ });
2608
+ };
2609
+ var ZodBigInt2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2610
+ _parse(input) {
2611
+ if (this._def.coerce) {
2612
+ input.data = BigInt(input.data);
2613
+ }
2614
+ const parsedType = this._getType(input);
2615
+ if (parsedType !== ZodParsedType2.bigint) {
2616
+ const ctx = this._getOrReturnCtx(input);
2617
+ addIssueToContext2(ctx, {
2618
+ code: ZodIssueCode2.invalid_type,
2619
+ expected: ZodParsedType2.bigint,
2620
+ received: ctx.parsedType
2621
+ });
2622
+ return INVALID2;
2623
+ }
2624
+ return OK2(input.data);
2625
+ }
2626
+ }, "ZodBigInt");
2627
+ __name222(ZodBigInt2, "ZodBigInt");
2628
+ ZodBigInt2.create = (params) => {
2629
+ var _a;
2630
+ return new ZodBigInt2({
2631
+ typeName: ZodFirstPartyTypeKind2.ZodBigInt,
2632
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2633
+ ...processCreateParams2(params)
2634
+ });
2635
+ };
2636
+ var ZodBoolean2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2637
+ _parse(input) {
2638
+ if (this._def.coerce) {
2639
+ input.data = Boolean(input.data);
2640
+ }
2641
+ const parsedType = this._getType(input);
2642
+ if (parsedType !== ZodParsedType2.boolean) {
2643
+ const ctx = this._getOrReturnCtx(input);
2644
+ addIssueToContext2(ctx, {
2645
+ code: ZodIssueCode2.invalid_type,
2646
+ expected: ZodParsedType2.boolean,
2647
+ received: ctx.parsedType
2648
+ });
2649
+ return INVALID2;
2650
+ }
2651
+ return OK2(input.data);
2652
+ }
2653
+ }, "ZodBoolean");
2654
+ __name222(ZodBoolean2, "ZodBoolean");
2655
+ ZodBoolean2.create = (params) => {
2656
+ return new ZodBoolean2({
2657
+ typeName: ZodFirstPartyTypeKind2.ZodBoolean,
2658
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2659
+ ...processCreateParams2(params)
2660
+ });
2661
+ };
2662
+ var ZodDate2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2663
+ _parse(input) {
2664
+ if (this._def.coerce) {
2665
+ input.data = new Date(input.data);
2666
+ }
2667
+ const parsedType = this._getType(input);
2668
+ if (parsedType !== ZodParsedType2.date) {
2669
+ const ctx2 = this._getOrReturnCtx(input);
2670
+ addIssueToContext2(ctx2, {
2671
+ code: ZodIssueCode2.invalid_type,
2672
+ expected: ZodParsedType2.date,
2673
+ received: ctx2.parsedType
2674
+ });
2675
+ return INVALID2;
2676
+ }
2677
+ if (isNaN(input.data.getTime())) {
2678
+ const ctx2 = this._getOrReturnCtx(input);
2679
+ addIssueToContext2(ctx2, {
2680
+ code: ZodIssueCode2.invalid_date
2681
+ });
2682
+ return INVALID2;
2683
+ }
2684
+ const status = new ParseStatus2();
2685
+ let ctx = void 0;
2686
+ for (const check of this._def.checks) {
2687
+ if (check.kind === "min") {
2688
+ if (input.data.getTime() < check.value) {
2689
+ ctx = this._getOrReturnCtx(input, ctx);
2690
+ addIssueToContext2(ctx, {
2691
+ code: ZodIssueCode2.too_small,
2692
+ message: check.message,
2693
+ inclusive: true,
2694
+ exact: false,
2695
+ minimum: check.value,
2696
+ type: "date"
2697
+ });
2698
+ status.dirty();
2699
+ }
2700
+ } else if (check.kind === "max") {
2701
+ if (input.data.getTime() > check.value) {
2702
+ ctx = this._getOrReturnCtx(input, ctx);
2703
+ addIssueToContext2(ctx, {
2704
+ code: ZodIssueCode2.too_big,
2705
+ message: check.message,
2706
+ inclusive: true,
2707
+ exact: false,
2708
+ maximum: check.value,
2709
+ type: "date"
2710
+ });
2711
+ status.dirty();
2712
+ }
2713
+ } else {
2714
+ util2.assertNever(check);
2715
+ }
2716
+ }
2717
+ return {
2718
+ status: status.value,
2719
+ value: new Date(input.data.getTime())
2720
+ };
2721
+ }
2722
+ _addCheck(check) {
2723
+ return new ZodDate2({
2724
+ ...this._def,
2725
+ checks: [...this._def.checks, check]
2726
+ });
2727
+ }
2728
+ min(minDate, message) {
2729
+ return this._addCheck({
2730
+ kind: "min",
2731
+ value: minDate.getTime(),
2732
+ message: errorUtil2.toString(message)
2733
+ });
2734
+ }
2735
+ max(maxDate, message) {
2736
+ return this._addCheck({
2737
+ kind: "max",
2738
+ value: maxDate.getTime(),
2739
+ message: errorUtil2.toString(message)
2740
+ });
2741
+ }
2742
+ get minDate() {
2743
+ let min = null;
2744
+ for (const ch of this._def.checks) {
2745
+ if (ch.kind === "min") {
2746
+ if (min === null || ch.value > min)
2747
+ min = ch.value;
2748
+ }
2749
+ }
2750
+ return min != null ? new Date(min) : null;
2751
+ }
2752
+ get maxDate() {
2753
+ let max = null;
2754
+ for (const ch of this._def.checks) {
2755
+ if (ch.kind === "max") {
2756
+ if (max === null || ch.value < max)
2757
+ max = ch.value;
2758
+ }
2759
+ }
2760
+ return max != null ? new Date(max) : null;
2761
+ }
2762
+ }, "ZodDate");
2763
+ __name222(ZodDate2, "ZodDate");
2764
+ ZodDate2.create = (params) => {
2765
+ return new ZodDate2({
2766
+ checks: [],
2767
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2768
+ typeName: ZodFirstPartyTypeKind2.ZodDate,
2769
+ ...processCreateParams2(params)
2770
+ });
2771
+ };
2772
+ var ZodSymbol2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2773
+ _parse(input) {
2774
+ const parsedType = this._getType(input);
2775
+ if (parsedType !== ZodParsedType2.symbol) {
2776
+ const ctx = this._getOrReturnCtx(input);
2777
+ addIssueToContext2(ctx, {
2778
+ code: ZodIssueCode2.invalid_type,
2779
+ expected: ZodParsedType2.symbol,
2780
+ received: ctx.parsedType
2781
+ });
2782
+ return INVALID2;
2783
+ }
2784
+ return OK2(input.data);
2785
+ }
2786
+ }, "ZodSymbol");
2787
+ __name222(ZodSymbol2, "ZodSymbol");
2788
+ ZodSymbol2.create = (params) => {
2789
+ return new ZodSymbol2({
2790
+ typeName: ZodFirstPartyTypeKind2.ZodSymbol,
2791
+ ...processCreateParams2(params)
2792
+ });
2793
+ };
2794
+ var ZodUndefined2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2795
+ _parse(input) {
2796
+ const parsedType = this._getType(input);
2797
+ if (parsedType !== ZodParsedType2.undefined) {
2798
+ const ctx = this._getOrReturnCtx(input);
2799
+ addIssueToContext2(ctx, {
2800
+ code: ZodIssueCode2.invalid_type,
2801
+ expected: ZodParsedType2.undefined,
2802
+ received: ctx.parsedType
2803
+ });
2804
+ return INVALID2;
2805
+ }
2806
+ return OK2(input.data);
2807
+ }
2808
+ }, "ZodUndefined");
2809
+ __name222(ZodUndefined2, "ZodUndefined");
2810
+ ZodUndefined2.create = (params) => {
2811
+ return new ZodUndefined2({
2812
+ typeName: ZodFirstPartyTypeKind2.ZodUndefined,
2813
+ ...processCreateParams2(params)
2814
+ });
2815
+ };
2816
+ var ZodNull2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2817
+ _parse(input) {
2818
+ const parsedType = this._getType(input);
2819
+ if (parsedType !== ZodParsedType2.null) {
2820
+ const ctx = this._getOrReturnCtx(input);
2821
+ addIssueToContext2(ctx, {
2822
+ code: ZodIssueCode2.invalid_type,
2823
+ expected: ZodParsedType2.null,
2824
+ received: ctx.parsedType
2825
+ });
2826
+ return INVALID2;
2827
+ }
2828
+ return OK2(input.data);
2829
+ }
2830
+ }, "ZodNull");
2831
+ __name222(ZodNull2, "ZodNull");
2832
+ ZodNull2.create = (params) => {
2833
+ return new ZodNull2({
2834
+ typeName: ZodFirstPartyTypeKind2.ZodNull,
2835
+ ...processCreateParams2(params)
2836
+ });
2837
+ };
2838
+ var ZodAny2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2839
+ constructor() {
2840
+ super(...arguments);
2841
+ this._any = true;
2842
+ }
2843
+ _parse(input) {
2844
+ return OK2(input.data);
2845
+ }
2846
+ }, "ZodAny");
2847
+ __name222(ZodAny2, "ZodAny");
2848
+ ZodAny2.create = (params) => {
2849
+ return new ZodAny2({
2850
+ typeName: ZodFirstPartyTypeKind2.ZodAny,
2851
+ ...processCreateParams2(params)
2852
+ });
2853
+ };
2854
+ var ZodUnknown2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2855
+ constructor() {
2856
+ super(...arguments);
2857
+ this._unknown = true;
2858
+ }
2859
+ _parse(input) {
2860
+ return OK2(input.data);
2861
+ }
2862
+ }, "ZodUnknown");
2863
+ __name222(ZodUnknown2, "ZodUnknown");
2864
+ ZodUnknown2.create = (params) => {
2865
+ return new ZodUnknown2({
2866
+ typeName: ZodFirstPartyTypeKind2.ZodUnknown,
2867
+ ...processCreateParams2(params)
2868
+ });
2869
+ };
2870
+ var ZodNever2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2871
+ _parse(input) {
2872
+ const ctx = this._getOrReturnCtx(input);
2873
+ addIssueToContext2(ctx, {
2874
+ code: ZodIssueCode2.invalid_type,
2875
+ expected: ZodParsedType2.never,
2876
+ received: ctx.parsedType
2877
+ });
2878
+ return INVALID2;
2879
+ }
2880
+ }, "ZodNever");
2881
+ __name222(ZodNever2, "ZodNever");
2882
+ ZodNever2.create = (params) => {
2883
+ return new ZodNever2({
2884
+ typeName: ZodFirstPartyTypeKind2.ZodNever,
2885
+ ...processCreateParams2(params)
2886
+ });
2887
+ };
2888
+ var ZodVoid2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2889
+ _parse(input) {
2890
+ const parsedType = this._getType(input);
2891
+ if (parsedType !== ZodParsedType2.undefined) {
2892
+ const ctx = this._getOrReturnCtx(input);
2893
+ addIssueToContext2(ctx, {
2894
+ code: ZodIssueCode2.invalid_type,
2895
+ expected: ZodParsedType2.void,
2896
+ received: ctx.parsedType
2897
+ });
2898
+ return INVALID2;
2899
+ }
2900
+ return OK2(input.data);
2901
+ }
2902
+ }, "ZodVoid");
2903
+ __name222(ZodVoid2, "ZodVoid");
2904
+ ZodVoid2.create = (params) => {
2905
+ return new ZodVoid2({
2906
+ typeName: ZodFirstPartyTypeKind2.ZodVoid,
2907
+ ...processCreateParams2(params)
2908
+ });
2909
+ };
2910
+ var ZodArray2 = /* @__PURE__ */ __name22(class extends ZodType2 {
2911
+ _parse(input) {
2912
+ const { ctx, status } = this._processInputParams(input);
2913
+ const def = this._def;
2914
+ if (ctx.parsedType !== ZodParsedType2.array) {
2915
+ addIssueToContext2(ctx, {
2916
+ code: ZodIssueCode2.invalid_type,
2917
+ expected: ZodParsedType2.array,
2918
+ received: ctx.parsedType
2919
+ });
2920
+ return INVALID2;
2921
+ }
2922
+ if (def.exactLength !== null) {
2923
+ const tooBig = ctx.data.length > def.exactLength.value;
2924
+ const tooSmall = ctx.data.length < def.exactLength.value;
2925
+ if (tooBig || tooSmall) {
2926
+ addIssueToContext2(ctx, {
2927
+ code: tooBig ? ZodIssueCode2.too_big : ZodIssueCode2.too_small,
2928
+ minimum: tooSmall ? def.exactLength.value : void 0,
2929
+ maximum: tooBig ? def.exactLength.value : void 0,
2930
+ type: "array",
2931
+ inclusive: true,
2932
+ exact: true,
2933
+ message: def.exactLength.message
2934
+ });
2935
+ status.dirty();
2936
+ }
2937
+ }
2938
+ if (def.minLength !== null) {
2939
+ if (ctx.data.length < def.minLength.value) {
2940
+ addIssueToContext2(ctx, {
2941
+ code: ZodIssueCode2.too_small,
2942
+ minimum: def.minLength.value,
2943
+ type: "array",
2944
+ inclusive: true,
2945
+ exact: false,
2946
+ message: def.minLength.message
2947
+ });
2948
+ status.dirty();
2949
+ }
2950
+ }
2951
+ if (def.maxLength !== null) {
2952
+ if (ctx.data.length > def.maxLength.value) {
2953
+ addIssueToContext2(ctx, {
2954
+ code: ZodIssueCode2.too_big,
2955
+ maximum: def.maxLength.value,
2956
+ type: "array",
2957
+ inclusive: true,
2958
+ exact: false,
2959
+ message: def.maxLength.message
2960
+ });
2961
+ status.dirty();
2962
+ }
2963
+ }
2964
+ if (ctx.common.async) {
2965
+ return Promise.all(ctx.data.map((item, i) => {
2966
+ return def.type._parseAsync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
2967
+ })).then((result2) => {
2968
+ return ParseStatus2.mergeArray(status, result2);
2969
+ });
2970
+ }
2971
+ const result = ctx.data.map((item, i) => {
2972
+ return def.type._parseSync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
2973
+ });
2974
+ return ParseStatus2.mergeArray(status, result);
2975
+ }
2976
+ get element() {
2977
+ return this._def.type;
2978
+ }
2979
+ min(minLength, message) {
2980
+ return new ZodArray2({
2981
+ ...this._def,
2982
+ minLength: { value: minLength, message: errorUtil2.toString(message) }
2983
+ });
2984
+ }
2985
+ max(maxLength, message) {
2986
+ return new ZodArray2({
2987
+ ...this._def,
2988
+ maxLength: { value: maxLength, message: errorUtil2.toString(message) }
2989
+ });
2990
+ }
2991
+ length(len, message) {
2992
+ return new ZodArray2({
2993
+ ...this._def,
2994
+ exactLength: { value: len, message: errorUtil2.toString(message) }
2995
+ });
2996
+ }
2997
+ nonempty(message) {
2998
+ return this.min(1, message);
2999
+ }
3000
+ }, "ZodArray");
3001
+ __name222(ZodArray2, "ZodArray");
3002
+ ZodArray2.create = (schema, params) => {
3003
+ return new ZodArray2({
3004
+ type: schema,
3005
+ minLength: null,
3006
+ maxLength: null,
3007
+ exactLength: null,
3008
+ typeName: ZodFirstPartyTypeKind2.ZodArray,
3009
+ ...processCreateParams2(params)
3010
+ });
3011
+ };
3012
+ var objectUtil2;
3013
+ (function(objectUtil22) {
3014
+ objectUtil22.mergeShapes = (first, second) => {
3015
+ return {
3016
+ ...first,
3017
+ ...second
3018
+ };
3019
+ };
3020
+ })(objectUtil2 || (objectUtil2 = {}));
3021
+ var AugmentFactory2 = /* @__PURE__ */ __name222((def) => (augmentation) => {
3022
+ return new ZodObject2({
3023
+ ...def,
3024
+ shape: () => ({
3025
+ ...def.shape(),
3026
+ ...augmentation
3027
+ })
3028
+ });
3029
+ }, "AugmentFactory");
3030
+ function deepPartialify2(schema) {
3031
+ if (schema instanceof ZodObject2) {
3032
+ const newShape = {};
3033
+ for (const key in schema.shape) {
3034
+ const fieldSchema = schema.shape[key];
3035
+ newShape[key] = ZodOptional2.create(deepPartialify2(fieldSchema));
3036
+ }
3037
+ return new ZodObject2({
3038
+ ...schema._def,
3039
+ shape: () => newShape
3040
+ });
3041
+ } else if (schema instanceof ZodArray2) {
3042
+ return ZodArray2.create(deepPartialify2(schema.element));
3043
+ } else if (schema instanceof ZodOptional2) {
3044
+ return ZodOptional2.create(deepPartialify2(schema.unwrap()));
3045
+ } else if (schema instanceof ZodNullable2) {
3046
+ return ZodNullable2.create(deepPartialify2(schema.unwrap()));
3047
+ } else if (schema instanceof ZodTuple2) {
3048
+ return ZodTuple2.create(schema.items.map((item) => deepPartialify2(item)));
3049
+ } else {
3050
+ return schema;
3051
+ }
3052
+ }
3053
+ __name(deepPartialify2, "deepPartialify");
3054
+ __name2(deepPartialify2, "deepPartialify");
3055
+ __name22(deepPartialify2, "deepPartialify");
3056
+ __name222(deepPartialify2, "deepPartialify");
3057
+ var ZodObject2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3058
+ constructor() {
3059
+ super(...arguments);
3060
+ this._cached = null;
3061
+ this.nonstrict = this.passthrough;
3062
+ this.augment = AugmentFactory2(this._def);
3063
+ this.extend = AugmentFactory2(this._def);
3064
+ }
3065
+ _getCached() {
3066
+ if (this._cached !== null)
3067
+ return this._cached;
3068
+ const shape = this._def.shape();
3069
+ const keys = util2.objectKeys(shape);
3070
+ return this._cached = { shape, keys };
3071
+ }
3072
+ _parse(input) {
3073
+ const parsedType = this._getType(input);
3074
+ if (parsedType !== ZodParsedType2.object) {
3075
+ const ctx2 = this._getOrReturnCtx(input);
3076
+ addIssueToContext2(ctx2, {
3077
+ code: ZodIssueCode2.invalid_type,
3078
+ expected: ZodParsedType2.object,
3079
+ received: ctx2.parsedType
3080
+ });
3081
+ return INVALID2;
3082
+ }
3083
+ const { status, ctx } = this._processInputParams(input);
3084
+ const { shape, keys: shapeKeys } = this._getCached();
3085
+ const extraKeys = [];
3086
+ if (!(this._def.catchall instanceof ZodNever2 && this._def.unknownKeys === "strip")) {
3087
+ for (const key in ctx.data) {
3088
+ if (!shapeKeys.includes(key)) {
3089
+ extraKeys.push(key);
3090
+ }
3091
+ }
3092
+ }
3093
+ const pairs = [];
3094
+ for (const key of shapeKeys) {
3095
+ const keyValidator = shape[key];
3096
+ const value = ctx.data[key];
3097
+ pairs.push({
3098
+ key: { status: "valid", value: key },
3099
+ value: keyValidator._parse(new ParseInputLazyPath2(ctx, value, ctx.path, key)),
3100
+ alwaysSet: key in ctx.data
3101
+ });
3102
+ }
3103
+ if (this._def.catchall instanceof ZodNever2) {
3104
+ const unknownKeys = this._def.unknownKeys;
3105
+ if (unknownKeys === "passthrough") {
3106
+ for (const key of extraKeys) {
3107
+ pairs.push({
3108
+ key: { status: "valid", value: key },
3109
+ value: { status: "valid", value: ctx.data[key] }
3110
+ });
3111
+ }
3112
+ } else if (unknownKeys === "strict") {
3113
+ if (extraKeys.length > 0) {
3114
+ addIssueToContext2(ctx, {
3115
+ code: ZodIssueCode2.unrecognized_keys,
3116
+ keys: extraKeys
3117
+ });
3118
+ status.dirty();
3119
+ }
3120
+ } else if (unknownKeys === "strip")
3121
+ ;
3122
+ else {
3123
+ throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
3124
+ }
3125
+ } else {
3126
+ const catchall = this._def.catchall;
3127
+ for (const key of extraKeys) {
3128
+ const value = ctx.data[key];
3129
+ pairs.push({
3130
+ key: { status: "valid", value: key },
3131
+ value: catchall._parse(
3132
+ new ParseInputLazyPath2(ctx, value, ctx.path, key)
3133
+ ),
3134
+ alwaysSet: key in ctx.data
3135
+ });
3136
+ }
3137
+ }
3138
+ if (ctx.common.async) {
3139
+ return Promise.resolve().then(async () => {
3140
+ const syncPairs = [];
3141
+ for (const pair of pairs) {
3142
+ const key = await pair.key;
3143
+ syncPairs.push({
3144
+ key,
3145
+ value: await pair.value,
3146
+ alwaysSet: pair.alwaysSet
3147
+ });
3148
+ }
3149
+ return syncPairs;
3150
+ }).then((syncPairs) => {
3151
+ return ParseStatus2.mergeObjectSync(status, syncPairs);
3152
+ });
3153
+ } else {
3154
+ return ParseStatus2.mergeObjectSync(status, pairs);
3155
+ }
3156
+ }
3157
+ get shape() {
3158
+ return this._def.shape();
3159
+ }
3160
+ strict(message) {
3161
+ errorUtil2.errToObj;
3162
+ return new ZodObject2({
3163
+ ...this._def,
3164
+ unknownKeys: "strict",
3165
+ ...message !== void 0 ? {
3166
+ errorMap: (issue, ctx) => {
3167
+ var _a, _b, _c, _d;
3168
+ 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;
3169
+ if (issue.code === "unrecognized_keys")
3170
+ return {
3171
+ message: (_d = errorUtil2.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
3172
+ };
3173
+ return {
3174
+ message: defaultError
3175
+ };
3176
+ }
3177
+ } : {}
3178
+ });
3179
+ }
3180
+ strip() {
3181
+ return new ZodObject2({
3182
+ ...this._def,
3183
+ unknownKeys: "strip"
3184
+ });
3185
+ }
3186
+ passthrough() {
3187
+ return new ZodObject2({
3188
+ ...this._def,
3189
+ unknownKeys: "passthrough"
3190
+ });
3191
+ }
3192
+ setKey(key, schema) {
3193
+ return this.augment({ [key]: schema });
3194
+ }
3195
+ merge(merging) {
3196
+ const merged = new ZodObject2({
3197
+ unknownKeys: merging._def.unknownKeys,
3198
+ catchall: merging._def.catchall,
3199
+ shape: () => objectUtil2.mergeShapes(this._def.shape(), merging._def.shape()),
3200
+ typeName: ZodFirstPartyTypeKind2.ZodObject
3201
+ });
3202
+ return merged;
3203
+ }
3204
+ catchall(index) {
3205
+ return new ZodObject2({
3206
+ ...this._def,
3207
+ catchall: index
3208
+ });
3209
+ }
3210
+ pick(mask) {
3211
+ const shape = {};
3212
+ util2.objectKeys(mask).map((key) => {
3213
+ if (this.shape[key])
3214
+ shape[key] = this.shape[key];
3215
+ });
3216
+ return new ZodObject2({
3217
+ ...this._def,
3218
+ shape: () => shape
3219
+ });
3220
+ }
3221
+ omit(mask) {
3222
+ const shape = {};
3223
+ util2.objectKeys(this.shape).map((key) => {
3224
+ if (util2.objectKeys(mask).indexOf(key) === -1) {
3225
+ shape[key] = this.shape[key];
3226
+ }
3227
+ });
3228
+ return new ZodObject2({
3229
+ ...this._def,
3230
+ shape: () => shape
3231
+ });
3232
+ }
3233
+ deepPartial() {
3234
+ return deepPartialify2(this);
3235
+ }
3236
+ partial(mask) {
3237
+ const newShape = {};
3238
+ if (mask) {
3239
+ util2.objectKeys(this.shape).map((key) => {
3240
+ if (util2.objectKeys(mask).indexOf(key) === -1) {
3241
+ newShape[key] = this.shape[key];
3242
+ } else {
3243
+ newShape[key] = this.shape[key].optional();
3244
+ }
3245
+ });
3246
+ return new ZodObject2({
3247
+ ...this._def,
3248
+ shape: () => newShape
3249
+ });
3250
+ } else {
3251
+ for (const key in this.shape) {
3252
+ const fieldSchema = this.shape[key];
3253
+ newShape[key] = fieldSchema.optional();
3254
+ }
3255
+ }
3256
+ return new ZodObject2({
3257
+ ...this._def,
3258
+ shape: () => newShape
3259
+ });
3260
+ }
3261
+ required(mask) {
3262
+ const newShape = {};
3263
+ if (mask) {
3264
+ util2.objectKeys(this.shape).map((key) => {
3265
+ if (util2.objectKeys(mask).indexOf(key) === -1) {
3266
+ newShape[key] = this.shape[key];
3267
+ } else {
3268
+ const fieldSchema = this.shape[key];
3269
+ let newField = fieldSchema;
3270
+ while (newField instanceof ZodOptional2) {
3271
+ newField = newField._def.innerType;
3272
+ }
3273
+ newShape[key] = newField;
3274
+ }
3275
+ });
3276
+ } else {
3277
+ for (const key in this.shape) {
3278
+ const fieldSchema = this.shape[key];
3279
+ let newField = fieldSchema;
3280
+ while (newField instanceof ZodOptional2) {
3281
+ newField = newField._def.innerType;
3282
+ }
3283
+ newShape[key] = newField;
3284
+ }
3285
+ }
3286
+ return new ZodObject2({
3287
+ ...this._def,
3288
+ shape: () => newShape
3289
+ });
3290
+ }
3291
+ keyof() {
3292
+ return createZodEnum2(util2.objectKeys(this.shape));
3293
+ }
3294
+ }, "ZodObject");
3295
+ __name222(ZodObject2, "ZodObject");
3296
+ ZodObject2.create = (shape, params) => {
3297
+ return new ZodObject2({
3298
+ shape: () => shape,
3299
+ unknownKeys: "strip",
3300
+ catchall: ZodNever2.create(),
3301
+ typeName: ZodFirstPartyTypeKind2.ZodObject,
3302
+ ...processCreateParams2(params)
3303
+ });
3304
+ };
3305
+ ZodObject2.strictCreate = (shape, params) => {
3306
+ return new ZodObject2({
3307
+ shape: () => shape,
3308
+ unknownKeys: "strict",
3309
+ catchall: ZodNever2.create(),
3310
+ typeName: ZodFirstPartyTypeKind2.ZodObject,
3311
+ ...processCreateParams2(params)
3312
+ });
3313
+ };
3314
+ ZodObject2.lazycreate = (shape, params) => {
3315
+ return new ZodObject2({
3316
+ shape,
3317
+ unknownKeys: "strip",
3318
+ catchall: ZodNever2.create(),
3319
+ typeName: ZodFirstPartyTypeKind2.ZodObject,
3320
+ ...processCreateParams2(params)
3321
+ });
3322
+ };
3323
+ var ZodUnion2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3324
+ _parse(input) {
3325
+ const { ctx } = this._processInputParams(input);
3326
+ const options = this._def.options;
3327
+ function handleResults(results) {
3328
+ for (const result of results) {
3329
+ if (result.result.status === "valid") {
3330
+ return result.result;
3331
+ }
3332
+ }
3333
+ for (const result of results) {
3334
+ if (result.result.status === "dirty") {
3335
+ ctx.common.issues.push(...result.ctx.common.issues);
3336
+ return result.result;
3337
+ }
3338
+ }
3339
+ const unionErrors = results.map((result) => new ZodError2(result.ctx.common.issues));
3340
+ addIssueToContext2(ctx, {
3341
+ code: ZodIssueCode2.invalid_union,
3342
+ unionErrors
3343
+ });
3344
+ return INVALID2;
3345
+ }
3346
+ __name(handleResults, "handleResults");
3347
+ __name2(handleResults, "handleResults");
3348
+ __name22(handleResults, "handleResults");
3349
+ __name222(handleResults, "handleResults");
3350
+ if (ctx.common.async) {
3351
+ return Promise.all(options.map(async (option) => {
3352
+ const childCtx = {
3353
+ ...ctx,
3354
+ common: {
3355
+ ...ctx.common,
3356
+ issues: []
3357
+ },
3358
+ parent: null
3359
+ };
3360
+ return {
3361
+ result: await option._parseAsync({
3362
+ data: ctx.data,
3363
+ path: ctx.path,
3364
+ parent: childCtx
3365
+ }),
3366
+ ctx: childCtx
3367
+ };
3368
+ })).then(handleResults);
3369
+ } else {
3370
+ let dirty = void 0;
3371
+ const issues = [];
3372
+ for (const option of options) {
3373
+ const childCtx = {
3374
+ ...ctx,
3375
+ common: {
3376
+ ...ctx.common,
3377
+ issues: []
3378
+ },
3379
+ parent: null
3380
+ };
3381
+ const result = option._parseSync({
3382
+ data: ctx.data,
3383
+ path: ctx.path,
3384
+ parent: childCtx
3385
+ });
3386
+ if (result.status === "valid") {
3387
+ return result;
3388
+ } else if (result.status === "dirty" && !dirty) {
3389
+ dirty = { result, ctx: childCtx };
3390
+ }
3391
+ if (childCtx.common.issues.length) {
3392
+ issues.push(childCtx.common.issues);
3393
+ }
3394
+ }
3395
+ if (dirty) {
3396
+ ctx.common.issues.push(...dirty.ctx.common.issues);
3397
+ return dirty.result;
3398
+ }
3399
+ const unionErrors = issues.map((issues2) => new ZodError2(issues2));
3400
+ addIssueToContext2(ctx, {
3401
+ code: ZodIssueCode2.invalid_union,
3402
+ unionErrors
3403
+ });
3404
+ return INVALID2;
3405
+ }
3406
+ }
3407
+ get options() {
3408
+ return this._def.options;
3409
+ }
3410
+ }, "ZodUnion");
3411
+ __name222(ZodUnion2, "ZodUnion");
3412
+ ZodUnion2.create = (types, params) => {
3413
+ return new ZodUnion2({
3414
+ options: types,
3415
+ typeName: ZodFirstPartyTypeKind2.ZodUnion,
3416
+ ...processCreateParams2(params)
3417
+ });
3418
+ };
3419
+ var getDiscriminator2 = /* @__PURE__ */ __name222((type) => {
3420
+ if (type instanceof ZodLazy2) {
3421
+ return getDiscriminator2(type.schema);
3422
+ } else if (type instanceof ZodEffects2) {
3423
+ return getDiscriminator2(type.innerType());
3424
+ } else if (type instanceof ZodLiteral2) {
3425
+ return [type.value];
3426
+ } else if (type instanceof ZodEnum2) {
3427
+ return type.options;
3428
+ } else if (type instanceof ZodNativeEnum2) {
3429
+ return Object.keys(type.enum);
3430
+ } else if (type instanceof ZodDefault2) {
3431
+ return getDiscriminator2(type._def.innerType);
3432
+ } else if (type instanceof ZodUndefined2) {
3433
+ return [void 0];
3434
+ } else if (type instanceof ZodNull2) {
3435
+ return [null];
3436
+ } else {
3437
+ return null;
3438
+ }
3439
+ }, "getDiscriminator");
3440
+ var ZodDiscriminatedUnion2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3441
+ _parse(input) {
3442
+ const { ctx } = this._processInputParams(input);
3443
+ if (ctx.parsedType !== ZodParsedType2.object) {
3444
+ addIssueToContext2(ctx, {
3445
+ code: ZodIssueCode2.invalid_type,
3446
+ expected: ZodParsedType2.object,
3447
+ received: ctx.parsedType
3448
+ });
3449
+ return INVALID2;
3450
+ }
3451
+ const discriminator = this.discriminator;
3452
+ const discriminatorValue = ctx.data[discriminator];
3453
+ const option = this.optionsMap.get(discriminatorValue);
3454
+ if (!option) {
3455
+ addIssueToContext2(ctx, {
3456
+ code: ZodIssueCode2.invalid_union_discriminator,
3457
+ options: Array.from(this.optionsMap.keys()),
3458
+ path: [discriminator]
3459
+ });
3460
+ return INVALID2;
3461
+ }
3462
+ if (ctx.common.async) {
3463
+ return option._parseAsync({
3464
+ data: ctx.data,
3465
+ path: ctx.path,
3466
+ parent: ctx
3467
+ });
3468
+ } else {
3469
+ return option._parseSync({
3470
+ data: ctx.data,
3471
+ path: ctx.path,
3472
+ parent: ctx
3473
+ });
3474
+ }
3475
+ }
3476
+ get discriminator() {
3477
+ return this._def.discriminator;
3478
+ }
3479
+ get options() {
3480
+ return this._def.options;
3481
+ }
3482
+ get optionsMap() {
3483
+ return this._def.optionsMap;
3484
+ }
3485
+ static create(discriminator, options, params) {
3486
+ const optionsMap = /* @__PURE__ */ new Map();
3487
+ for (const type of options) {
3488
+ const discriminatorValues = getDiscriminator2(type.shape[discriminator]);
3489
+ if (!discriminatorValues) {
3490
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
3491
+ }
3492
+ for (const value of discriminatorValues) {
3493
+ if (optionsMap.has(value)) {
3494
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
3495
+ }
3496
+ optionsMap.set(value, type);
3497
+ }
3498
+ }
3499
+ return new ZodDiscriminatedUnion2({
3500
+ typeName: ZodFirstPartyTypeKind2.ZodDiscriminatedUnion,
3501
+ discriminator,
3502
+ options,
3503
+ optionsMap,
3504
+ ...processCreateParams2(params)
3505
+ });
3506
+ }
3507
+ }, "ZodDiscriminatedUnion");
3508
+ __name222(ZodDiscriminatedUnion2, "ZodDiscriminatedUnion");
3509
+ function mergeValues2(a, b) {
3510
+ const aType = getParsedType2(a);
3511
+ const bType = getParsedType2(b);
3512
+ if (a === b) {
3513
+ return { valid: true, data: a };
3514
+ } else if (aType === ZodParsedType2.object && bType === ZodParsedType2.object) {
3515
+ const bKeys = util2.objectKeys(b);
3516
+ const sharedKeys = util2.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
3517
+ const newObj = { ...a, ...b };
3518
+ for (const key of sharedKeys) {
3519
+ const sharedValue = mergeValues2(a[key], b[key]);
3520
+ if (!sharedValue.valid) {
3521
+ return { valid: false };
3522
+ }
3523
+ newObj[key] = sharedValue.data;
3524
+ }
3525
+ return { valid: true, data: newObj };
3526
+ } else if (aType === ZodParsedType2.array && bType === ZodParsedType2.array) {
3527
+ if (a.length !== b.length) {
3528
+ return { valid: false };
3529
+ }
3530
+ const newArray = [];
3531
+ for (let index = 0; index < a.length; index++) {
3532
+ const itemA = a[index];
3533
+ const itemB = b[index];
3534
+ const sharedValue = mergeValues2(itemA, itemB);
3535
+ if (!sharedValue.valid) {
3536
+ return { valid: false };
3537
+ }
3538
+ newArray.push(sharedValue.data);
3539
+ }
3540
+ return { valid: true, data: newArray };
3541
+ } else if (aType === ZodParsedType2.date && bType === ZodParsedType2.date && +a === +b) {
3542
+ return { valid: true, data: a };
3543
+ } else {
3544
+ return { valid: false };
3545
+ }
3546
+ }
3547
+ __name(mergeValues2, "mergeValues");
3548
+ __name2(mergeValues2, "mergeValues");
3549
+ __name22(mergeValues2, "mergeValues");
3550
+ __name222(mergeValues2, "mergeValues");
3551
+ var ZodIntersection2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3552
+ _parse(input) {
3553
+ const { status, ctx } = this._processInputParams(input);
3554
+ const handleParsed = /* @__PURE__ */ __name222((parsedLeft, parsedRight) => {
3555
+ if (isAborted2(parsedLeft) || isAborted2(parsedRight)) {
3556
+ return INVALID2;
3557
+ }
3558
+ const merged = mergeValues2(parsedLeft.value, parsedRight.value);
3559
+ if (!merged.valid) {
3560
+ addIssueToContext2(ctx, {
3561
+ code: ZodIssueCode2.invalid_intersection_types
3562
+ });
3563
+ return INVALID2;
3564
+ }
3565
+ if (isDirty2(parsedLeft) || isDirty2(parsedRight)) {
3566
+ status.dirty();
3567
+ }
3568
+ return { status: status.value, value: merged.data };
3569
+ }, "handleParsed");
3570
+ if (ctx.common.async) {
3571
+ return Promise.all([
3572
+ this._def.left._parseAsync({
3573
+ data: ctx.data,
3574
+ path: ctx.path,
3575
+ parent: ctx
3576
+ }),
3577
+ this._def.right._parseAsync({
3578
+ data: ctx.data,
3579
+ path: ctx.path,
3580
+ parent: ctx
3581
+ })
3582
+ ]).then(([left, right]) => handleParsed(left, right));
3583
+ } else {
3584
+ return handleParsed(this._def.left._parseSync({
3585
+ data: ctx.data,
3586
+ path: ctx.path,
3587
+ parent: ctx
3588
+ }), this._def.right._parseSync({
3589
+ data: ctx.data,
3590
+ path: ctx.path,
3591
+ parent: ctx
3592
+ }));
3593
+ }
3594
+ }
3595
+ }, "ZodIntersection");
3596
+ __name222(ZodIntersection2, "ZodIntersection");
3597
+ ZodIntersection2.create = (left, right, params) => {
3598
+ return new ZodIntersection2({
3599
+ left,
3600
+ right,
3601
+ typeName: ZodFirstPartyTypeKind2.ZodIntersection,
3602
+ ...processCreateParams2(params)
3603
+ });
3604
+ };
3605
+ var ZodTuple2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3606
+ _parse(input) {
3607
+ const { status, ctx } = this._processInputParams(input);
3608
+ if (ctx.parsedType !== ZodParsedType2.array) {
3609
+ addIssueToContext2(ctx, {
3610
+ code: ZodIssueCode2.invalid_type,
3611
+ expected: ZodParsedType2.array,
3612
+ received: ctx.parsedType
3613
+ });
3614
+ return INVALID2;
3615
+ }
3616
+ if (ctx.data.length < this._def.items.length) {
3617
+ addIssueToContext2(ctx, {
3618
+ code: ZodIssueCode2.too_small,
3619
+ minimum: this._def.items.length,
3620
+ inclusive: true,
3621
+ exact: false,
3622
+ type: "array"
3623
+ });
3624
+ return INVALID2;
3625
+ }
3626
+ const rest = this._def.rest;
3627
+ if (!rest && ctx.data.length > this._def.items.length) {
3628
+ addIssueToContext2(ctx, {
3629
+ code: ZodIssueCode2.too_big,
3630
+ maximum: this._def.items.length,
3631
+ inclusive: true,
3632
+ exact: false,
3633
+ type: "array"
3634
+ });
3635
+ status.dirty();
3636
+ }
3637
+ const items = ctx.data.map((item, itemIndex) => {
3638
+ const schema = this._def.items[itemIndex] || this._def.rest;
3639
+ if (!schema)
3640
+ return null;
3641
+ return schema._parse(new ParseInputLazyPath2(ctx, item, ctx.path, itemIndex));
3642
+ }).filter((x) => !!x);
3643
+ if (ctx.common.async) {
3644
+ return Promise.all(items).then((results) => {
3645
+ return ParseStatus2.mergeArray(status, results);
3646
+ });
3647
+ } else {
3648
+ return ParseStatus2.mergeArray(status, items);
3649
+ }
3650
+ }
3651
+ get items() {
3652
+ return this._def.items;
3653
+ }
3654
+ rest(rest) {
3655
+ return new ZodTuple2({
3656
+ ...this._def,
3657
+ rest
3658
+ });
3659
+ }
3660
+ }, "ZodTuple");
3661
+ __name222(ZodTuple2, "ZodTuple");
3662
+ ZodTuple2.create = (schemas, params) => {
3663
+ if (!Array.isArray(schemas)) {
3664
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3665
+ }
3666
+ return new ZodTuple2({
3667
+ items: schemas,
3668
+ typeName: ZodFirstPartyTypeKind2.ZodTuple,
3669
+ rest: null,
3670
+ ...processCreateParams2(params)
3671
+ });
3672
+ };
3673
+ var ZodRecord2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3674
+ get keySchema() {
3675
+ return this._def.keyType;
3676
+ }
3677
+ get valueSchema() {
3678
+ return this._def.valueType;
3679
+ }
3680
+ _parse(input) {
3681
+ const { status, ctx } = this._processInputParams(input);
3682
+ if (ctx.parsedType !== ZodParsedType2.object) {
3683
+ addIssueToContext2(ctx, {
3684
+ code: ZodIssueCode2.invalid_type,
3685
+ expected: ZodParsedType2.object,
3686
+ received: ctx.parsedType
3687
+ });
3688
+ return INVALID2;
3689
+ }
3690
+ const pairs = [];
3691
+ const keyType = this._def.keyType;
3692
+ const valueType = this._def.valueType;
3693
+ for (const key in ctx.data) {
3694
+ pairs.push({
3695
+ key: keyType._parse(new ParseInputLazyPath2(ctx, key, ctx.path, key)),
3696
+ value: valueType._parse(new ParseInputLazyPath2(ctx, ctx.data[key], ctx.path, key))
3697
+ });
3698
+ }
3699
+ if (ctx.common.async) {
3700
+ return ParseStatus2.mergeObjectAsync(status, pairs);
3701
+ } else {
3702
+ return ParseStatus2.mergeObjectSync(status, pairs);
3703
+ }
3704
+ }
3705
+ get element() {
3706
+ return this._def.valueType;
3707
+ }
3708
+ static create(first, second, third) {
3709
+ if (second instanceof ZodType2) {
3710
+ return new ZodRecord2({
3711
+ keyType: first,
3712
+ valueType: second,
3713
+ typeName: ZodFirstPartyTypeKind2.ZodRecord,
3714
+ ...processCreateParams2(third)
3715
+ });
3716
+ }
3717
+ return new ZodRecord2({
3718
+ keyType: ZodString2.create(),
3719
+ valueType: first,
3720
+ typeName: ZodFirstPartyTypeKind2.ZodRecord,
3721
+ ...processCreateParams2(second)
3722
+ });
3723
+ }
3724
+ }, "ZodRecord");
3725
+ __name222(ZodRecord2, "ZodRecord");
3726
+ var ZodMap2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3727
+ _parse(input) {
3728
+ const { status, ctx } = this._processInputParams(input);
3729
+ if (ctx.parsedType !== ZodParsedType2.map) {
3730
+ addIssueToContext2(ctx, {
3731
+ code: ZodIssueCode2.invalid_type,
3732
+ expected: ZodParsedType2.map,
3733
+ received: ctx.parsedType
3734
+ });
3735
+ return INVALID2;
3736
+ }
3737
+ const keyType = this._def.keyType;
3738
+ const valueType = this._def.valueType;
3739
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
3740
+ return {
3741
+ key: keyType._parse(new ParseInputLazyPath2(ctx, key, ctx.path, [index, "key"])),
3742
+ value: valueType._parse(new ParseInputLazyPath2(ctx, value, ctx.path, [index, "value"]))
3743
+ };
3744
+ });
3745
+ if (ctx.common.async) {
3746
+ const finalMap = /* @__PURE__ */ new Map();
3747
+ return Promise.resolve().then(async () => {
3748
+ for (const pair of pairs) {
3749
+ const key = await pair.key;
3750
+ const value = await pair.value;
3751
+ if (key.status === "aborted" || value.status === "aborted") {
3752
+ return INVALID2;
3753
+ }
3754
+ if (key.status === "dirty" || value.status === "dirty") {
3755
+ status.dirty();
3756
+ }
3757
+ finalMap.set(key.value, value.value);
3758
+ }
3759
+ return { status: status.value, value: finalMap };
3760
+ });
3761
+ } else {
3762
+ const finalMap = /* @__PURE__ */ new Map();
3763
+ for (const pair of pairs) {
3764
+ const key = pair.key;
3765
+ const value = pair.value;
3766
+ if (key.status === "aborted" || value.status === "aborted") {
3767
+ return INVALID2;
3768
+ }
3769
+ if (key.status === "dirty" || value.status === "dirty") {
3770
+ status.dirty();
3771
+ }
3772
+ finalMap.set(key.value, value.value);
3773
+ }
3774
+ return { status: status.value, value: finalMap };
3775
+ }
3776
+ }
3777
+ }, "ZodMap");
3778
+ __name222(ZodMap2, "ZodMap");
3779
+ ZodMap2.create = (keyType, valueType, params) => {
3780
+ return new ZodMap2({
3781
+ valueType,
3782
+ keyType,
3783
+ typeName: ZodFirstPartyTypeKind2.ZodMap,
3784
+ ...processCreateParams2(params)
3785
+ });
3786
+ };
3787
+ var ZodSet2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3788
+ _parse(input) {
3789
+ const { status, ctx } = this._processInputParams(input);
3790
+ if (ctx.parsedType !== ZodParsedType2.set) {
3791
+ addIssueToContext2(ctx, {
3792
+ code: ZodIssueCode2.invalid_type,
3793
+ expected: ZodParsedType2.set,
3794
+ received: ctx.parsedType
3795
+ });
3796
+ return INVALID2;
3797
+ }
3798
+ const def = this._def;
3799
+ if (def.minSize !== null) {
3800
+ if (ctx.data.size < def.minSize.value) {
3801
+ addIssueToContext2(ctx, {
3802
+ code: ZodIssueCode2.too_small,
3803
+ minimum: def.minSize.value,
3804
+ type: "set",
3805
+ inclusive: true,
3806
+ exact: false,
3807
+ message: def.minSize.message
3808
+ });
3809
+ status.dirty();
3810
+ }
3811
+ }
3812
+ if (def.maxSize !== null) {
3813
+ if (ctx.data.size > def.maxSize.value) {
3814
+ addIssueToContext2(ctx, {
3815
+ code: ZodIssueCode2.too_big,
3816
+ maximum: def.maxSize.value,
3817
+ type: "set",
3818
+ inclusive: true,
3819
+ exact: false,
3820
+ message: def.maxSize.message
3821
+ });
3822
+ status.dirty();
3823
+ }
3824
+ }
3825
+ const valueType = this._def.valueType;
3826
+ function finalizeSet(elements2) {
3827
+ const parsedSet = /* @__PURE__ */ new Set();
3828
+ for (const element of elements2) {
3829
+ if (element.status === "aborted")
3830
+ return INVALID2;
3831
+ if (element.status === "dirty")
3832
+ status.dirty();
3833
+ parsedSet.add(element.value);
3834
+ }
3835
+ return { status: status.value, value: parsedSet };
3836
+ }
3837
+ __name(finalizeSet, "finalizeSet");
3838
+ __name2(finalizeSet, "finalizeSet");
3839
+ __name22(finalizeSet, "finalizeSet");
3840
+ __name222(finalizeSet, "finalizeSet");
3841
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath2(ctx, item, ctx.path, i)));
3842
+ if (ctx.common.async) {
3843
+ return Promise.all(elements).then((elements2) => finalizeSet(elements2));
3844
+ } else {
3845
+ return finalizeSet(elements);
3846
+ }
3847
+ }
3848
+ min(minSize, message) {
3849
+ return new ZodSet2({
3850
+ ...this._def,
3851
+ minSize: { value: minSize, message: errorUtil2.toString(message) }
3852
+ });
3853
+ }
3854
+ max(maxSize, message) {
3855
+ return new ZodSet2({
3856
+ ...this._def,
3857
+ maxSize: { value: maxSize, message: errorUtil2.toString(message) }
3858
+ });
3859
+ }
3860
+ size(size, message) {
3861
+ return this.min(size, message).max(size, message);
3862
+ }
3863
+ nonempty(message) {
3864
+ return this.min(1, message);
3865
+ }
3866
+ }, "ZodSet");
3867
+ __name222(ZodSet2, "ZodSet");
3868
+ ZodSet2.create = (valueType, params) => {
3869
+ return new ZodSet2({
3870
+ valueType,
3871
+ minSize: null,
3872
+ maxSize: null,
3873
+ typeName: ZodFirstPartyTypeKind2.ZodSet,
3874
+ ...processCreateParams2(params)
3875
+ });
3876
+ };
3877
+ var ZodFunction2 = /* @__PURE__ */ __name22(class extends ZodType2 {
3878
+ constructor() {
3879
+ super(...arguments);
3880
+ this.validate = this.implement;
3881
+ }
3882
+ _parse(input) {
3883
+ const { ctx } = this._processInputParams(input);
3884
+ if (ctx.parsedType !== ZodParsedType2.function) {
3885
+ addIssueToContext2(ctx, {
3886
+ code: ZodIssueCode2.invalid_type,
3887
+ expected: ZodParsedType2.function,
3888
+ received: ctx.parsedType
3889
+ });
3890
+ return INVALID2;
3891
+ }
3892
+ function makeArgsIssue(args, error) {
3893
+ return makeIssue2({
3894
+ data: args,
3895
+ path: ctx.path,
3896
+ errorMaps: [
3897
+ ctx.common.contextualErrorMap,
3898
+ ctx.schemaErrorMap,
3899
+ getErrorMap2(),
3900
+ errorMap2
3901
+ ].filter((x) => !!x),
3902
+ issueData: {
3903
+ code: ZodIssueCode2.invalid_arguments,
3904
+ argumentsError: error
3905
+ }
3906
+ });
3907
+ }
3908
+ __name(makeArgsIssue, "makeArgsIssue");
3909
+ __name2(makeArgsIssue, "makeArgsIssue");
3910
+ __name22(makeArgsIssue, "makeArgsIssue");
3911
+ __name222(makeArgsIssue, "makeArgsIssue");
3912
+ function makeReturnsIssue(returns, error) {
3913
+ return makeIssue2({
3914
+ data: returns,
3915
+ path: ctx.path,
3916
+ errorMaps: [
3917
+ ctx.common.contextualErrorMap,
3918
+ ctx.schemaErrorMap,
3919
+ getErrorMap2(),
3920
+ errorMap2
3921
+ ].filter((x) => !!x),
3922
+ issueData: {
3923
+ code: ZodIssueCode2.invalid_return_type,
3924
+ returnTypeError: error
3925
+ }
3926
+ });
3927
+ }
3928
+ __name(makeReturnsIssue, "makeReturnsIssue");
3929
+ __name2(makeReturnsIssue, "makeReturnsIssue");
3930
+ __name22(makeReturnsIssue, "makeReturnsIssue");
3931
+ __name222(makeReturnsIssue, "makeReturnsIssue");
3932
+ const params = { errorMap: ctx.common.contextualErrorMap };
3933
+ const fn = ctx.data;
3934
+ if (this._def.returns instanceof ZodPromise2) {
3935
+ return OK2(async (...args) => {
3936
+ const error = new ZodError2([]);
3937
+ const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3938
+ error.addIssue(makeArgsIssue(args, e));
3939
+ throw error;
3940
+ });
3941
+ const result = await fn(...parsedArgs);
3942
+ const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3943
+ error.addIssue(makeReturnsIssue(result, e));
3944
+ throw error;
3945
+ });
3946
+ return parsedReturns;
3947
+ });
3948
+ } else {
3949
+ return OK2((...args) => {
3950
+ const parsedArgs = this._def.args.safeParse(args, params);
3951
+ if (!parsedArgs.success) {
3952
+ throw new ZodError2([makeArgsIssue(args, parsedArgs.error)]);
3953
+ }
3954
+ const result = fn(...parsedArgs.data);
3955
+ const parsedReturns = this._def.returns.safeParse(result, params);
3956
+ if (!parsedReturns.success) {
3957
+ throw new ZodError2([makeReturnsIssue(result, parsedReturns.error)]);
3958
+ }
3959
+ return parsedReturns.data;
3960
+ });
3961
+ }
3962
+ }
3963
+ parameters() {
3964
+ return this._def.args;
3965
+ }
3966
+ returnType() {
3967
+ return this._def.returns;
3968
+ }
3969
+ args(...items) {
3970
+ return new ZodFunction2({
3971
+ ...this._def,
3972
+ args: ZodTuple2.create(items).rest(ZodUnknown2.create())
3973
+ });
3974
+ }
3975
+ returns(returnType) {
3976
+ return new ZodFunction2({
3977
+ ...this._def,
3978
+ returns: returnType
3979
+ });
3980
+ }
3981
+ implement(func) {
3982
+ const validatedFunc = this.parse(func);
3983
+ return validatedFunc;
3984
+ }
3985
+ strictImplement(func) {
3986
+ const validatedFunc = this.parse(func);
3987
+ return validatedFunc;
3988
+ }
3989
+ static create(args, returns, params) {
3990
+ return new ZodFunction2({
3991
+ args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),
3992
+ returns: returns || ZodUnknown2.create(),
3993
+ typeName: ZodFirstPartyTypeKind2.ZodFunction,
3994
+ ...processCreateParams2(params)
3995
+ });
3996
+ }
3997
+ }, "ZodFunction");
3998
+ __name222(ZodFunction2, "ZodFunction");
3999
+ var ZodLazy2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4000
+ get schema() {
4001
+ return this._def.getter();
4002
+ }
4003
+ _parse(input) {
4004
+ const { ctx } = this._processInputParams(input);
4005
+ const lazySchema = this._def.getter();
4006
+ return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
4007
+ }
4008
+ }, "ZodLazy");
4009
+ __name222(ZodLazy2, "ZodLazy");
4010
+ ZodLazy2.create = (getter, params) => {
4011
+ return new ZodLazy2({
4012
+ getter,
4013
+ typeName: ZodFirstPartyTypeKind2.ZodLazy,
4014
+ ...processCreateParams2(params)
4015
+ });
4016
+ };
4017
+ var ZodLiteral2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4018
+ _parse(input) {
4019
+ if (input.data !== this._def.value) {
4020
+ const ctx = this._getOrReturnCtx(input);
4021
+ addIssueToContext2(ctx, {
4022
+ code: ZodIssueCode2.invalid_literal,
4023
+ expected: this._def.value
4024
+ });
4025
+ return INVALID2;
4026
+ }
4027
+ return { status: "valid", value: input.data };
4028
+ }
4029
+ get value() {
4030
+ return this._def.value;
4031
+ }
4032
+ }, "ZodLiteral");
4033
+ __name222(ZodLiteral2, "ZodLiteral");
4034
+ ZodLiteral2.create = (value, params) => {
4035
+ return new ZodLiteral2({
4036
+ value,
4037
+ typeName: ZodFirstPartyTypeKind2.ZodLiteral,
4038
+ ...processCreateParams2(params)
4039
+ });
4040
+ };
4041
+ function createZodEnum2(values, params) {
4042
+ return new ZodEnum2({
4043
+ values,
4044
+ typeName: ZodFirstPartyTypeKind2.ZodEnum,
4045
+ ...processCreateParams2(params)
4046
+ });
4047
+ }
4048
+ __name(createZodEnum2, "createZodEnum");
4049
+ __name2(createZodEnum2, "createZodEnum");
4050
+ __name22(createZodEnum2, "createZodEnum");
4051
+ __name222(createZodEnum2, "createZodEnum");
4052
+ var ZodEnum2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4053
+ _parse(input) {
4054
+ if (typeof input.data !== "string") {
4055
+ const ctx = this._getOrReturnCtx(input);
4056
+ const expectedValues = this._def.values;
4057
+ addIssueToContext2(ctx, {
4058
+ expected: util2.joinValues(expectedValues),
4059
+ received: ctx.parsedType,
4060
+ code: ZodIssueCode2.invalid_type
4061
+ });
4062
+ return INVALID2;
4063
+ }
4064
+ if (this._def.values.indexOf(input.data) === -1) {
4065
+ const ctx = this._getOrReturnCtx(input);
4066
+ const expectedValues = this._def.values;
4067
+ addIssueToContext2(ctx, {
4068
+ received: ctx.data,
4069
+ code: ZodIssueCode2.invalid_enum_value,
4070
+ options: expectedValues
4071
+ });
4072
+ return INVALID2;
4073
+ }
4074
+ return OK2(input.data);
4075
+ }
4076
+ get options() {
4077
+ return this._def.values;
4078
+ }
4079
+ get enum() {
4080
+ const enumValues = {};
4081
+ for (const val of this._def.values) {
4082
+ enumValues[val] = val;
4083
+ }
4084
+ return enumValues;
4085
+ }
4086
+ get Values() {
4087
+ const enumValues = {};
4088
+ for (const val of this._def.values) {
4089
+ enumValues[val] = val;
4090
+ }
4091
+ return enumValues;
4092
+ }
4093
+ get Enum() {
4094
+ const enumValues = {};
4095
+ for (const val of this._def.values) {
4096
+ enumValues[val] = val;
4097
+ }
4098
+ return enumValues;
4099
+ }
4100
+ }, "ZodEnum");
4101
+ __name222(ZodEnum2, "ZodEnum");
4102
+ ZodEnum2.create = createZodEnum2;
4103
+ var ZodNativeEnum2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4104
+ _parse(input) {
4105
+ const nativeEnumValues = util2.getValidEnumValues(this._def.values);
4106
+ const ctx = this._getOrReturnCtx(input);
4107
+ if (ctx.parsedType !== ZodParsedType2.string && ctx.parsedType !== ZodParsedType2.number) {
4108
+ const expectedValues = util2.objectValues(nativeEnumValues);
4109
+ addIssueToContext2(ctx, {
4110
+ expected: util2.joinValues(expectedValues),
4111
+ received: ctx.parsedType,
4112
+ code: ZodIssueCode2.invalid_type
4113
+ });
4114
+ return INVALID2;
4115
+ }
4116
+ if (nativeEnumValues.indexOf(input.data) === -1) {
4117
+ const expectedValues = util2.objectValues(nativeEnumValues);
4118
+ addIssueToContext2(ctx, {
4119
+ received: ctx.data,
4120
+ code: ZodIssueCode2.invalid_enum_value,
4121
+ options: expectedValues
4122
+ });
4123
+ return INVALID2;
4124
+ }
4125
+ return OK2(input.data);
4126
+ }
4127
+ get enum() {
4128
+ return this._def.values;
4129
+ }
4130
+ }, "ZodNativeEnum");
4131
+ __name222(ZodNativeEnum2, "ZodNativeEnum");
4132
+ ZodNativeEnum2.create = (values, params) => {
4133
+ return new ZodNativeEnum2({
4134
+ values,
4135
+ typeName: ZodFirstPartyTypeKind2.ZodNativeEnum,
4136
+ ...processCreateParams2(params)
4137
+ });
4138
+ };
4139
+ var ZodPromise2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4140
+ _parse(input) {
4141
+ const { ctx } = this._processInputParams(input);
4142
+ if (ctx.parsedType !== ZodParsedType2.promise && ctx.common.async === false) {
4143
+ addIssueToContext2(ctx, {
4144
+ code: ZodIssueCode2.invalid_type,
4145
+ expected: ZodParsedType2.promise,
4146
+ received: ctx.parsedType
4147
+ });
4148
+ return INVALID2;
4149
+ }
4150
+ const promisified = ctx.parsedType === ZodParsedType2.promise ? ctx.data : Promise.resolve(ctx.data);
4151
+ return OK2(promisified.then((data) => {
4152
+ return this._def.type.parseAsync(data, {
4153
+ path: ctx.path,
4154
+ errorMap: ctx.common.contextualErrorMap
4155
+ });
4156
+ }));
4157
+ }
4158
+ }, "ZodPromise");
4159
+ __name222(ZodPromise2, "ZodPromise");
4160
+ ZodPromise2.create = (schema, params) => {
4161
+ return new ZodPromise2({
4162
+ type: schema,
4163
+ typeName: ZodFirstPartyTypeKind2.ZodPromise,
4164
+ ...processCreateParams2(params)
4165
+ });
4166
+ };
4167
+ var ZodEffects2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4168
+ innerType() {
4169
+ return this._def.schema;
4170
+ }
4171
+ sourceType() {
4172
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind2.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
4173
+ }
4174
+ _parse(input) {
4175
+ const { status, ctx } = this._processInputParams(input);
4176
+ const effect = this._def.effect || null;
4177
+ if (effect.type === "preprocess") {
4178
+ const processed = effect.transform(ctx.data);
4179
+ if (ctx.common.async) {
4180
+ return Promise.resolve(processed).then((processed2) => {
4181
+ return this._def.schema._parseAsync({
4182
+ data: processed2,
4183
+ path: ctx.path,
4184
+ parent: ctx
4185
+ });
4186
+ });
4187
+ } else {
4188
+ return this._def.schema._parseSync({
4189
+ data: processed,
4190
+ path: ctx.path,
4191
+ parent: ctx
4192
+ });
4193
+ }
4194
+ }
4195
+ const checkCtx = {
4196
+ addIssue: (arg) => {
4197
+ addIssueToContext2(ctx, arg);
4198
+ if (arg.fatal) {
4199
+ status.abort();
4200
+ } else {
4201
+ status.dirty();
4202
+ }
4203
+ },
4204
+ get path() {
4205
+ return ctx.path;
4206
+ }
4207
+ };
4208
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
4209
+ if (effect.type === "refinement") {
4210
+ const executeRefinement = /* @__PURE__ */ __name222((acc) => {
4211
+ const result = effect.refinement(acc, checkCtx);
4212
+ if (ctx.common.async) {
4213
+ return Promise.resolve(result);
4214
+ }
4215
+ if (result instanceof Promise) {
4216
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
4217
+ }
4218
+ return acc;
4219
+ }, "executeRefinement");
4220
+ if (ctx.common.async === false) {
4221
+ const inner = this._def.schema._parseSync({
4222
+ data: ctx.data,
4223
+ path: ctx.path,
4224
+ parent: ctx
4225
+ });
4226
+ if (inner.status === "aborted")
4227
+ return INVALID2;
4228
+ if (inner.status === "dirty")
4229
+ status.dirty();
4230
+ executeRefinement(inner.value);
4231
+ return { status: status.value, value: inner.value };
4232
+ } else {
4233
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
4234
+ if (inner.status === "aborted")
4235
+ return INVALID2;
4236
+ if (inner.status === "dirty")
4237
+ status.dirty();
4238
+ return executeRefinement(inner.value).then(() => {
4239
+ return { status: status.value, value: inner.value };
4240
+ });
4241
+ });
4242
+ }
4243
+ }
4244
+ if (effect.type === "transform") {
4245
+ if (ctx.common.async === false) {
4246
+ const base = this._def.schema._parseSync({
4247
+ data: ctx.data,
4248
+ path: ctx.path,
4249
+ parent: ctx
4250
+ });
4251
+ if (!isValid2(base))
4252
+ return base;
4253
+ const result = effect.transform(base.value, checkCtx);
4254
+ if (result instanceof Promise) {
4255
+ throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
4256
+ }
4257
+ return { status: status.value, value: result };
4258
+ } else {
4259
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
4260
+ if (!isValid2(base))
4261
+ return base;
4262
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
4263
+ });
4264
+ }
4265
+ }
4266
+ util2.assertNever(effect);
4267
+ }
4268
+ }, "ZodEffects");
4269
+ __name222(ZodEffects2, "ZodEffects");
4270
+ ZodEffects2.create = (schema, effect, params) => {
4271
+ return new ZodEffects2({
4272
+ schema,
4273
+ typeName: ZodFirstPartyTypeKind2.ZodEffects,
4274
+ effect,
4275
+ ...processCreateParams2(params)
4276
+ });
4277
+ };
4278
+ ZodEffects2.createWithPreprocess = (preprocess, schema, params) => {
4279
+ return new ZodEffects2({
4280
+ schema,
4281
+ effect: { type: "preprocess", transform: preprocess },
4282
+ typeName: ZodFirstPartyTypeKind2.ZodEffects,
4283
+ ...processCreateParams2(params)
4284
+ });
4285
+ };
4286
+ var ZodOptional2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4287
+ _parse(input) {
4288
+ const parsedType = this._getType(input);
4289
+ if (parsedType === ZodParsedType2.undefined) {
4290
+ return OK2(void 0);
4291
+ }
4292
+ return this._def.innerType._parse(input);
4293
+ }
4294
+ unwrap() {
4295
+ return this._def.innerType;
4296
+ }
4297
+ }, "ZodOptional");
4298
+ __name222(ZodOptional2, "ZodOptional");
4299
+ ZodOptional2.create = (type, params) => {
4300
+ return new ZodOptional2({
4301
+ innerType: type,
4302
+ typeName: ZodFirstPartyTypeKind2.ZodOptional,
4303
+ ...processCreateParams2(params)
4304
+ });
4305
+ };
4306
+ var ZodNullable2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4307
+ _parse(input) {
4308
+ const parsedType = this._getType(input);
4309
+ if (parsedType === ZodParsedType2.null) {
4310
+ return OK2(null);
4311
+ }
4312
+ return this._def.innerType._parse(input);
4313
+ }
4314
+ unwrap() {
4315
+ return this._def.innerType;
4316
+ }
4317
+ }, "ZodNullable");
4318
+ __name222(ZodNullable2, "ZodNullable");
4319
+ ZodNullable2.create = (type, params) => {
4320
+ return new ZodNullable2({
4321
+ innerType: type,
4322
+ typeName: ZodFirstPartyTypeKind2.ZodNullable,
4323
+ ...processCreateParams2(params)
4324
+ });
4325
+ };
4326
+ var ZodDefault2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4327
+ _parse(input) {
4328
+ const { ctx } = this._processInputParams(input);
4329
+ let data = ctx.data;
4330
+ if (ctx.parsedType === ZodParsedType2.undefined) {
4331
+ data = this._def.defaultValue();
4332
+ }
4333
+ return this._def.innerType._parse({
4334
+ data,
4335
+ path: ctx.path,
4336
+ parent: ctx
4337
+ });
4338
+ }
4339
+ removeDefault() {
4340
+ return this._def.innerType;
4341
+ }
4342
+ }, "ZodDefault");
4343
+ __name222(ZodDefault2, "ZodDefault");
4344
+ ZodDefault2.create = (type, params) => {
4345
+ return new ZodDefault2({
4346
+ innerType: type,
4347
+ typeName: ZodFirstPartyTypeKind2.ZodDefault,
4348
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4349
+ ...processCreateParams2(params)
4350
+ });
4351
+ };
4352
+ var ZodCatch2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4353
+ _parse(input) {
4354
+ const { ctx } = this._processInputParams(input);
4355
+ const result = this._def.innerType._parse({
4356
+ data: ctx.data,
4357
+ path: ctx.path,
4358
+ parent: ctx
4359
+ });
4360
+ if (isAsync2(result)) {
4361
+ return result.then((result2) => {
4362
+ return {
4363
+ status: "valid",
4364
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
4365
+ };
4366
+ });
4367
+ } else {
4368
+ return {
4369
+ status: "valid",
4370
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
4371
+ };
4372
+ }
4373
+ }
4374
+ removeDefault() {
4375
+ return this._def.innerType;
4376
+ }
4377
+ }, "ZodCatch");
4378
+ __name222(ZodCatch2, "ZodCatch");
4379
+ ZodCatch2.create = (type, params) => {
4380
+ return new ZodCatch2({
4381
+ innerType: type,
4382
+ typeName: ZodFirstPartyTypeKind2.ZodCatch,
4383
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4384
+ ...processCreateParams2(params)
4385
+ });
4386
+ };
4387
+ var ZodNaN2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4388
+ _parse(input) {
4389
+ const parsedType = this._getType(input);
4390
+ if (parsedType !== ZodParsedType2.nan) {
4391
+ const ctx = this._getOrReturnCtx(input);
4392
+ addIssueToContext2(ctx, {
4393
+ code: ZodIssueCode2.invalid_type,
4394
+ expected: ZodParsedType2.nan,
4395
+ received: ctx.parsedType
4396
+ });
4397
+ return INVALID2;
4398
+ }
4399
+ return { status: "valid", value: input.data };
4400
+ }
4401
+ }, "ZodNaN");
4402
+ __name222(ZodNaN2, "ZodNaN");
4403
+ ZodNaN2.create = (params) => {
4404
+ return new ZodNaN2({
4405
+ typeName: ZodFirstPartyTypeKind2.ZodNaN,
4406
+ ...processCreateParams2(params)
4407
+ });
4408
+ };
4409
+ var BRAND2 = Symbol("zod_brand");
4410
+ var ZodBranded2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4411
+ _parse(input) {
4412
+ const { ctx } = this._processInputParams(input);
4413
+ const data = ctx.data;
4414
+ return this._def.type._parse({
4415
+ data,
4416
+ path: ctx.path,
4417
+ parent: ctx
4418
+ });
4419
+ }
4420
+ unwrap() {
4421
+ return this._def.type;
4422
+ }
4423
+ }, "ZodBranded");
4424
+ __name222(ZodBranded2, "ZodBranded");
4425
+ var ZodPipeline2 = /* @__PURE__ */ __name22(class extends ZodType2 {
4426
+ _parse(input) {
4427
+ const { status, ctx } = this._processInputParams(input);
4428
+ if (ctx.common.async) {
4429
+ const handleAsync = /* @__PURE__ */ __name222(async () => {
4430
+ const inResult = await this._def.in._parseAsync({
4431
+ data: ctx.data,
4432
+ path: ctx.path,
4433
+ parent: ctx
4434
+ });
4435
+ if (inResult.status === "aborted")
4436
+ return INVALID2;
4437
+ if (inResult.status === "dirty") {
4438
+ status.dirty();
4439
+ return DIRTY2(inResult.value);
4440
+ } else {
4441
+ return this._def.out._parseAsync({
4442
+ data: inResult.value,
4443
+ path: ctx.path,
4444
+ parent: ctx
4445
+ });
4446
+ }
4447
+ }, "handleAsync");
4448
+ return handleAsync();
4449
+ } else {
4450
+ const inResult = this._def.in._parseSync({
4451
+ data: ctx.data,
4452
+ path: ctx.path,
4453
+ parent: ctx
4454
+ });
4455
+ if (inResult.status === "aborted")
4456
+ return INVALID2;
4457
+ if (inResult.status === "dirty") {
4458
+ status.dirty();
4459
+ return {
4460
+ status: "dirty",
4461
+ value: inResult.value
4462
+ };
4463
+ } else {
4464
+ return this._def.out._parseSync({
4465
+ data: inResult.value,
4466
+ path: ctx.path,
4467
+ parent: ctx
4468
+ });
4469
+ }
4470
+ }
4471
+ }
4472
+ static create(a, b) {
4473
+ return new ZodPipeline2({
4474
+ in: a,
4475
+ out: b,
4476
+ typeName: ZodFirstPartyTypeKind2.ZodPipeline
4477
+ });
4478
+ }
4479
+ }, "ZodPipeline");
4480
+ __name222(ZodPipeline2, "ZodPipeline");
4481
+ var custom2 = /* @__PURE__ */ __name222((check, params = {}, fatal) => {
4482
+ if (check)
4483
+ return ZodAny2.create().superRefine((data, ctx) => {
4484
+ if (!check(data)) {
4485
+ const p = typeof params === "function" ? params(data) : params;
4486
+ const p2 = typeof p === "string" ? { message: p } : p;
4487
+ ctx.addIssue({ code: "custom", ...p2, fatal });
4488
+ }
4489
+ });
4490
+ return ZodAny2.create();
4491
+ }, "custom");
4492
+ var late2 = {
4493
+ object: ZodObject2.lazycreate
4494
+ };
4495
+ var ZodFirstPartyTypeKind2;
4496
+ (function(ZodFirstPartyTypeKind22) {
4497
+ ZodFirstPartyTypeKind22["ZodString"] = "ZodString";
4498
+ ZodFirstPartyTypeKind22["ZodNumber"] = "ZodNumber";
4499
+ ZodFirstPartyTypeKind22["ZodNaN"] = "ZodNaN";
4500
+ ZodFirstPartyTypeKind22["ZodBigInt"] = "ZodBigInt";
4501
+ ZodFirstPartyTypeKind22["ZodBoolean"] = "ZodBoolean";
4502
+ ZodFirstPartyTypeKind22["ZodDate"] = "ZodDate";
4503
+ ZodFirstPartyTypeKind22["ZodSymbol"] = "ZodSymbol";
4504
+ ZodFirstPartyTypeKind22["ZodUndefined"] = "ZodUndefined";
4505
+ ZodFirstPartyTypeKind22["ZodNull"] = "ZodNull";
4506
+ ZodFirstPartyTypeKind22["ZodAny"] = "ZodAny";
4507
+ ZodFirstPartyTypeKind22["ZodUnknown"] = "ZodUnknown";
4508
+ ZodFirstPartyTypeKind22["ZodNever"] = "ZodNever";
4509
+ ZodFirstPartyTypeKind22["ZodVoid"] = "ZodVoid";
4510
+ ZodFirstPartyTypeKind22["ZodArray"] = "ZodArray";
4511
+ ZodFirstPartyTypeKind22["ZodObject"] = "ZodObject";
4512
+ ZodFirstPartyTypeKind22["ZodUnion"] = "ZodUnion";
4513
+ ZodFirstPartyTypeKind22["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
4514
+ ZodFirstPartyTypeKind22["ZodIntersection"] = "ZodIntersection";
4515
+ ZodFirstPartyTypeKind22["ZodTuple"] = "ZodTuple";
4516
+ ZodFirstPartyTypeKind22["ZodRecord"] = "ZodRecord";
4517
+ ZodFirstPartyTypeKind22["ZodMap"] = "ZodMap";
4518
+ ZodFirstPartyTypeKind22["ZodSet"] = "ZodSet";
4519
+ ZodFirstPartyTypeKind22["ZodFunction"] = "ZodFunction";
4520
+ ZodFirstPartyTypeKind22["ZodLazy"] = "ZodLazy";
4521
+ ZodFirstPartyTypeKind22["ZodLiteral"] = "ZodLiteral";
4522
+ ZodFirstPartyTypeKind22["ZodEnum"] = "ZodEnum";
4523
+ ZodFirstPartyTypeKind22["ZodEffects"] = "ZodEffects";
4524
+ ZodFirstPartyTypeKind22["ZodNativeEnum"] = "ZodNativeEnum";
4525
+ ZodFirstPartyTypeKind22["ZodOptional"] = "ZodOptional";
4526
+ ZodFirstPartyTypeKind22["ZodNullable"] = "ZodNullable";
4527
+ ZodFirstPartyTypeKind22["ZodDefault"] = "ZodDefault";
4528
+ ZodFirstPartyTypeKind22["ZodCatch"] = "ZodCatch";
4529
+ ZodFirstPartyTypeKind22["ZodPromise"] = "ZodPromise";
4530
+ ZodFirstPartyTypeKind22["ZodBranded"] = "ZodBranded";
4531
+ ZodFirstPartyTypeKind22["ZodPipeline"] = "ZodPipeline";
4532
+ })(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {}));
4533
+ var instanceOfType2 = /* @__PURE__ */ __name222((cls, params = {
4534
+ message: `Input not instance of ${cls.name}`
4535
+ }) => custom2((data) => data instanceof cls, params, true), "instanceOfType");
4536
+ var stringType2 = ZodString2.create;
4537
+ var numberType2 = ZodNumber2.create;
4538
+ var nanType2 = ZodNaN2.create;
4539
+ var bigIntType2 = ZodBigInt2.create;
4540
+ var booleanType2 = ZodBoolean2.create;
4541
+ var dateType2 = ZodDate2.create;
4542
+ var symbolType2 = ZodSymbol2.create;
4543
+ var undefinedType2 = ZodUndefined2.create;
4544
+ var nullType2 = ZodNull2.create;
4545
+ var anyType2 = ZodAny2.create;
4546
+ var unknownType2 = ZodUnknown2.create;
4547
+ var neverType2 = ZodNever2.create;
4548
+ var voidType2 = ZodVoid2.create;
4549
+ var arrayType2 = ZodArray2.create;
4550
+ var objectType2 = ZodObject2.create;
4551
+ var strictObjectType2 = ZodObject2.strictCreate;
4552
+ var unionType2 = ZodUnion2.create;
4553
+ var discriminatedUnionType2 = ZodDiscriminatedUnion2.create;
4554
+ var intersectionType2 = ZodIntersection2.create;
4555
+ var tupleType2 = ZodTuple2.create;
4556
+ var recordType2 = ZodRecord2.create;
4557
+ var mapType2 = ZodMap2.create;
4558
+ var setType2 = ZodSet2.create;
4559
+ var functionType2 = ZodFunction2.create;
4560
+ var lazyType2 = ZodLazy2.create;
4561
+ var literalType2 = ZodLiteral2.create;
4562
+ var enumType2 = ZodEnum2.create;
4563
+ var nativeEnumType2 = ZodNativeEnum2.create;
4564
+ var promiseType2 = ZodPromise2.create;
4565
+ var effectsType2 = ZodEffects2.create;
4566
+ var optionalType2 = ZodOptional2.create;
4567
+ var nullableType2 = ZodNullable2.create;
4568
+ var preprocessType2 = ZodEffects2.createWithPreprocess;
4569
+ var pipelineType2 = ZodPipeline2.create;
4570
+ var ostring2 = /* @__PURE__ */ __name222(() => stringType2().optional(), "ostring");
4571
+ var onumber2 = /* @__PURE__ */ __name222(() => numberType2().optional(), "onumber");
4572
+ var oboolean2 = /* @__PURE__ */ __name222(() => booleanType2().optional(), "oboolean");
4573
+ var coerce2 = {
4574
+ string: (arg) => ZodString2.create({ ...arg, coerce: true }),
4575
+ number: (arg) => ZodNumber2.create({ ...arg, coerce: true }),
4576
+ boolean: (arg) => ZodBoolean2.create({ ...arg, coerce: true }),
4577
+ bigint: (arg) => ZodBigInt2.create({ ...arg, coerce: true }),
4578
+ date: (arg) => ZodDate2.create({ ...arg, coerce: true })
4579
+ };
4580
+ var NEVER2 = INVALID2;
4581
+ var mod2 = /* @__PURE__ */ Object.freeze({
4582
+ __proto__: null,
4583
+ defaultErrorMap: errorMap2,
4584
+ setErrorMap: setErrorMap2,
4585
+ getErrorMap: getErrorMap2,
4586
+ makeIssue: makeIssue2,
4587
+ EMPTY_PATH: EMPTY_PATH2,
4588
+ addIssueToContext: addIssueToContext2,
4589
+ ParseStatus: ParseStatus2,
4590
+ INVALID: INVALID2,
4591
+ DIRTY: DIRTY2,
4592
+ OK: OK2,
4593
+ isAborted: isAborted2,
4594
+ isDirty: isDirty2,
4595
+ isValid: isValid2,
4596
+ isAsync: isAsync2,
4597
+ get util() {
4598
+ return util2;
4599
+ },
4600
+ ZodParsedType: ZodParsedType2,
4601
+ getParsedType: getParsedType2,
4602
+ ZodType: ZodType2,
4603
+ ZodString: ZodString2,
4604
+ ZodNumber: ZodNumber2,
4605
+ ZodBigInt: ZodBigInt2,
4606
+ ZodBoolean: ZodBoolean2,
4607
+ ZodDate: ZodDate2,
4608
+ ZodSymbol: ZodSymbol2,
4609
+ ZodUndefined: ZodUndefined2,
4610
+ ZodNull: ZodNull2,
4611
+ ZodAny: ZodAny2,
4612
+ ZodUnknown: ZodUnknown2,
4613
+ ZodNever: ZodNever2,
4614
+ ZodVoid: ZodVoid2,
4615
+ ZodArray: ZodArray2,
4616
+ get objectUtil() {
4617
+ return objectUtil2;
4618
+ },
4619
+ ZodObject: ZodObject2,
4620
+ ZodUnion: ZodUnion2,
4621
+ ZodDiscriminatedUnion: ZodDiscriminatedUnion2,
4622
+ ZodIntersection: ZodIntersection2,
4623
+ ZodTuple: ZodTuple2,
4624
+ ZodRecord: ZodRecord2,
4625
+ ZodMap: ZodMap2,
4626
+ ZodSet: ZodSet2,
4627
+ ZodFunction: ZodFunction2,
4628
+ ZodLazy: ZodLazy2,
4629
+ ZodLiteral: ZodLiteral2,
4630
+ ZodEnum: ZodEnum2,
4631
+ ZodNativeEnum: ZodNativeEnum2,
4632
+ ZodPromise: ZodPromise2,
4633
+ ZodEffects: ZodEffects2,
4634
+ ZodTransformer: ZodEffects2,
4635
+ ZodOptional: ZodOptional2,
4636
+ ZodNullable: ZodNullable2,
4637
+ ZodDefault: ZodDefault2,
4638
+ ZodCatch: ZodCatch2,
4639
+ ZodNaN: ZodNaN2,
4640
+ BRAND: BRAND2,
4641
+ ZodBranded: ZodBranded2,
4642
+ ZodPipeline: ZodPipeline2,
4643
+ custom: custom2,
4644
+ Schema: ZodType2,
4645
+ ZodSchema: ZodType2,
4646
+ late: late2,
4647
+ get ZodFirstPartyTypeKind() {
4648
+ return ZodFirstPartyTypeKind2;
4649
+ },
4650
+ coerce: coerce2,
4651
+ any: anyType2,
4652
+ array: arrayType2,
4653
+ bigint: bigIntType2,
4654
+ boolean: booleanType2,
4655
+ date: dateType2,
4656
+ discriminatedUnion: discriminatedUnionType2,
4657
+ effect: effectsType2,
4658
+ "enum": enumType2,
4659
+ "function": functionType2,
4660
+ "instanceof": instanceOfType2,
4661
+ intersection: intersectionType2,
4662
+ lazy: lazyType2,
4663
+ literal: literalType2,
4664
+ map: mapType2,
4665
+ nan: nanType2,
4666
+ nativeEnum: nativeEnumType2,
4667
+ never: neverType2,
4668
+ "null": nullType2,
4669
+ nullable: nullableType2,
4670
+ number: numberType2,
4671
+ object: objectType2,
4672
+ oboolean: oboolean2,
4673
+ onumber: onumber2,
4674
+ optional: optionalType2,
4675
+ ostring: ostring2,
4676
+ pipeline: pipelineType2,
4677
+ preprocess: preprocessType2,
4678
+ promise: promiseType2,
4679
+ record: recordType2,
4680
+ set: setType2,
4681
+ strictObject: strictObjectType2,
4682
+ string: stringType2,
4683
+ symbol: symbolType2,
4684
+ transformer: effectsType2,
4685
+ tuple: tupleType2,
4686
+ "undefined": undefinedType2,
4687
+ union: unionType2,
4688
+ unknown: unknownType2,
4689
+ "void": voidType2,
4690
+ NEVER: NEVER2,
4691
+ ZodIssueCode: ZodIssueCode2,
4692
+ quotelessJson: quotelessJson2,
4693
+ ZodError: ZodError2
4694
+ });
4695
+ var ContextValidator2 = mod2.array(mod2.string().or(mod2.record(mod2.any())));
4696
+ var AchievementCriteriaValidator2 = mod2.object({
4697
+ type: mod2.string().optional(),
4698
+ narrative: mod2.string().optional()
4699
+ });
4700
+ var ImageValidator2 = mod2.string().or(
4701
+ mod2.object({
4702
+ id: mod2.string(),
4703
+ type: mod2.string(),
4704
+ caption: mod2.string().optional()
4705
+ })
4706
+ );
4707
+ var GeoCoordinatesValidator2 = mod2.object({
4708
+ type: mod2.string().min(1).or(mod2.string().array().nonempty()),
4709
+ latitude: mod2.number(),
4710
+ longitude: mod2.number()
4711
+ });
4712
+ var AddressValidator2 = mod2.object({
4713
+ type: mod2.string().min(1).or(mod2.string().array().nonempty()),
4714
+ addressCountry: mod2.string().optional(),
4715
+ addressCountryCode: mod2.string().optional(),
4716
+ addressRegion: mod2.string().optional(),
4717
+ addressLocality: mod2.string().optional(),
4718
+ streetAddress: mod2.string().optional(),
4719
+ postOfficeBoxNumber: mod2.string().optional(),
4720
+ postalCode: mod2.string().optional(),
4721
+ geo: GeoCoordinatesValidator2.optional()
4722
+ });
4723
+ var IdentifierTypeValidator2 = mod2.enum([
4724
+ "sourcedId",
4725
+ "systemId",
4726
+ "productId",
4727
+ "userName",
4728
+ "accountId",
4729
+ "emailAddress",
4730
+ "nationalIdentityNumber",
4731
+ "isbn",
4732
+ "issn",
4733
+ "lisSourcedId",
4734
+ "oneRosterSourcedId",
4735
+ "sisSourcedId",
4736
+ "ltiContextId",
4737
+ "ltiDeploymentId",
4738
+ "ltiToolId",
4739
+ "ltiPlatformId",
4740
+ "ltiUserId",
4741
+ "identifier"
4742
+ ]).or(mod2.string());
4743
+ var IdentifierEntryValidator2 = mod2.object({
4744
+ type: mod2.string().min(1).or(mod2.string().array().nonempty()),
4745
+ identifier: mod2.string(),
4746
+ identifierType: IdentifierTypeValidator2
4747
+ });
4748
+ var ProfileValidator2 = mod2.string().or(
4749
+ mod2.object({
4750
+ id: mod2.string().optional(),
4751
+ type: mod2.string().or(mod2.string().array().nonempty().optional()),
4752
+ name: mod2.string().optional(),
4753
+ url: mod2.string().optional(),
4754
+ phone: mod2.string().optional(),
4755
+ description: mod2.string().optional(),
4756
+ endorsement: mod2.any().array().optional(),
4757
+ image: ImageValidator2.optional(),
4758
+ email: mod2.string().email().optional(),
4759
+ address: AddressValidator2.optional(),
4760
+ otherIdentifier: IdentifierEntryValidator2.array().optional(),
4761
+ official: mod2.string().optional(),
4762
+ parentOrg: mod2.any().optional(),
4763
+ familyName: mod2.string().optional(),
4764
+ givenName: mod2.string().optional(),
4765
+ additionalName: mod2.string().optional(),
4766
+ patronymicName: mod2.string().optional(),
4767
+ honorificPrefix: mod2.string().optional(),
4768
+ honorificSuffix: mod2.string().optional(),
4769
+ familyNamePrefix: mod2.string().optional(),
4770
+ dateOfBirth: mod2.string().optional()
4771
+ }).catchall(mod2.any())
4772
+ );
4773
+ var CredentialSubjectValidator2 = mod2.object({ id: mod2.string().optional() }).catchall(mod2.any());
4774
+ var CredentialStatusValidator2 = mod2.object({ type: mod2.string(), id: mod2.string() }).catchall(mod2.any());
4775
+ var CredentialSchemaValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() }).catchall(mod2.any());
4776
+ var RefreshServiceValidator2 = mod2.object({ id: mod2.string(), type: mod2.string() }).catchall(mod2.any());
4777
+ var UnsignedVCValidator2 = mod2.object({
4778
+ "@context": ContextValidator2,
4779
+ id: mod2.string().optional(),
4780
+ type: mod2.string().array().nonempty(),
4781
+ issuer: ProfileValidator2,
4782
+ issuanceDate: mod2.string(),
4783
+ expirationDate: mod2.string().optional(),
4784
+ credentialSubject: CredentialSubjectValidator2.or(CredentialSubjectValidator2.array()),
4785
+ credentialStatus: CredentialStatusValidator2.optional(),
4786
+ credentialSchema: CredentialSchemaValidator2.array().optional(),
4787
+ refreshService: RefreshServiceValidator2.optional()
4788
+ }).catchall(mod2.any());
4789
+ var ProofValidator2 = mod2.object({
4790
+ type: mod2.string(),
4791
+ created: mod2.string(),
4792
+ challenge: mod2.string().optional(),
4793
+ domain: mod2.string().optional(),
4794
+ nonce: mod2.string().optional(),
4795
+ proofPurpose: mod2.string(),
4796
+ verificationMethod: mod2.string(),
4797
+ jws: mod2.string().optional()
4798
+ }).catchall(mod2.any());
4799
+ var VCValidator2 = UnsignedVCValidator2.extend({
4800
+ proof: ProofValidator2.or(ProofValidator2.array())
4801
+ });
4802
+ var UnsignedVPValidator2 = mod2.object({
4803
+ "@context": ContextValidator2,
4804
+ id: mod2.string().optional(),
4805
+ type: mod2.string().or(mod2.string().array().nonempty()),
4806
+ verifiableCredential: VCValidator2.or(VCValidator2.array()).optional(),
4807
+ holder: mod2.string().optional()
4808
+ }).catchall(mod2.any());
4809
+ var VPValidator2 = UnsignedVPValidator2.extend({
4810
+ proof: ProofValidator2.or(ProofValidator2.array())
4811
+ });
4812
+ var JWKValidator2 = mod2.object({
4813
+ kty: mod2.string(),
4814
+ crv: mod2.string(),
4815
+ x: mod2.string(),
4816
+ y: mod2.string().optional(),
4817
+ n: mod2.string().optional(),
4818
+ d: mod2.string()
4819
+ });
4820
+ var JWERecipientHeaderValidator2 = mod2.object({
4821
+ alg: mod2.string(),
4822
+ iv: mod2.string(),
4823
+ tag: mod2.string(),
4824
+ epk: JWKValidator2.partial().optional(),
4825
+ kid: mod2.string().optional(),
4826
+ apv: mod2.string().optional(),
4827
+ apu: mod2.string().optional()
4828
+ });
4829
+ var JWERecipientValidator2 = mod2.object({
4830
+ header: JWERecipientHeaderValidator2,
4831
+ encrypted_key: mod2.string()
4832
+ });
4833
+ var JWEValidator2 = mod2.object({
4834
+ protected: mod2.string(),
4835
+ iv: mod2.string(),
4836
+ ciphertext: mod2.string(),
4837
+ tag: mod2.string(),
4838
+ aad: mod2.string().optional(),
4839
+ recipients: JWERecipientValidator2.array().optional()
4840
+ });
4841
+ var VerificationMethodValidator2 = mod2.string().or(
4842
+ mod2.object({
4843
+ "@context": ContextValidator2.optional(),
4844
+ id: mod2.string(),
4845
+ type: mod2.string(),
4846
+ controller: mod2.string(),
4847
+ publicKeyJwk: JWKValidator2.optional(),
4848
+ publicKeyBase58: mod2.string().optional(),
4849
+ blockChainAccountId: mod2.string().optional()
4850
+ }).catchall(mod2.any())
4851
+ );
4852
+ var ServiceValidator2 = mod2.object({
4853
+ id: mod2.string(),
4854
+ type: mod2.string().or(mod2.string().array().nonempty()),
4855
+ serviceEndpoint: mod2.any().or(mod2.any().array().nonempty())
4856
+ }).catchall(mod2.any());
4857
+ var DidDocumentValidator2 = mod2.object({
4858
+ "@context": ContextValidator2,
4859
+ id: mod2.string(),
4860
+ alsoKnownAs: mod2.string().optional(),
4861
+ controller: mod2.string().or(mod2.string().array().nonempty()).optional(),
4862
+ verificationMethod: VerificationMethodValidator2.array().optional(),
4863
+ authentication: VerificationMethodValidator2.array().optional(),
4864
+ assertionMethod: VerificationMethodValidator2.array().optional(),
4865
+ keyAgreement: VerificationMethodValidator2.array().optional(),
4866
+ capabilityInvocation: VerificationMethodValidator2.array().optional(),
4867
+ capabilityDelegation: VerificationMethodValidator2.array().optional(),
4868
+ publicKey: VerificationMethodValidator2.array().optional(),
4869
+ service: ServiceValidator2.array().optional(),
4870
+ proof: ProofValidator2.or(ProofValidator2.array()).optional()
4871
+ }).catchall(mod2.any());
4872
+ var AlignmentTargetTypeValidator2 = mod2.enum([
4873
+ "ceasn:Competency",
4874
+ "ceterms:Credential",
4875
+ "CFItem",
4876
+ "CFRubric",
4877
+ "CFRubricCriterion",
4878
+ "CFRubricCriterionLevel",
4879
+ "CTDL"
4880
+ ]).or(mod2.string());
4881
+ var AlignmentValidator2 = mod2.object({
4882
+ type: mod2.string().array().nonempty(),
4883
+ targetCode: mod2.string().optional(),
4884
+ targetDescription: mod2.string().optional(),
4885
+ targetName: mod2.string(),
4886
+ targetFramework: mod2.string().optional(),
4887
+ targetType: AlignmentTargetTypeValidator2.optional(),
4888
+ targetUrl: mod2.string()
4889
+ });
4890
+ var KnownAchievementTypeValidator2 = mod2.enum([
4891
+ "Achievement",
4892
+ "ApprenticeshipCertificate",
4893
+ "Assessment",
4894
+ "Assignment",
4895
+ "AssociateDegree",
4896
+ "Award",
4897
+ "Badge",
4898
+ "BachelorDegree",
4899
+ "Certificate",
4900
+ "CertificateOfCompletion",
4901
+ "Certification",
4902
+ "CommunityService",
4903
+ "Competency",
4904
+ "Course",
4905
+ "CoCurricular",
4906
+ "Degree",
4907
+ "Diploma",
4908
+ "DoctoralDegree",
4909
+ "Fieldwork",
4910
+ "GeneralEducationDevelopment",
4911
+ "JourneymanCertificate",
4912
+ "LearningProgram",
4913
+ "License",
4914
+ "Membership",
4915
+ "ProfessionalDoctorate",
4916
+ "QualityAssuranceCredential",
4917
+ "MasterCertificate",
4918
+ "MasterDegree",
4919
+ "MicroCredential",
4920
+ "ResearchDoctorate",
4921
+ "SecondarySchoolDiploma"
4922
+ ]);
4923
+ var AchievementTypeValidator2 = KnownAchievementTypeValidator2.or(mod2.string());
4924
+ var CriteriaValidator2 = mod2.object({ id: mod2.string().optional(), narrative: mod2.string().optional() }).catchall(mod2.any());
4925
+ var EndorsementSubjectValidator2 = mod2.object({
4926
+ id: mod2.string(),
4927
+ type: mod2.string().array().nonempty(),
4928
+ endorsementComment: mod2.string().optional()
4929
+ });
4930
+ var EndorsementCredentialValidator2 = UnsignedVCValidator2.extend({
4931
+ credentialSubject: EndorsementSubjectValidator2,
4932
+ proof: ProofValidator2.or(ProofValidator2.array()).optional()
4933
+ });
4934
+ var RelatedValidator2 = mod2.object({
4935
+ id: mod2.string(),
4936
+ "@language": mod2.string().optional(),
4937
+ version: mod2.string().optional()
4938
+ });
4939
+ var ResultTypeValidator2 = mod2.enum([
4940
+ "GradePointAverage",
4941
+ "LetterGrade",
4942
+ "Percent",
4943
+ "PerformanceLevel",
4944
+ "PredictedScore",
4945
+ "RawScore",
4946
+ "Result",
4947
+ "RubricCriterion",
4948
+ "RubricCriterionLevel",
4949
+ "RubricScore",
4950
+ "ScaledScore",
4951
+ "Status"
4952
+ ]).or(mod2.string());
4953
+ var RubricCriterionValidator2 = mod2.object({
4954
+ id: mod2.string(),
4955
+ type: mod2.string().array().nonempty(),
4956
+ alignment: AlignmentValidator2.array().optional(),
4957
+ description: mod2.string().optional(),
4958
+ level: mod2.string().optional(),
4959
+ name: mod2.string(),
4960
+ points: mod2.string().optional()
4961
+ }).catchall(mod2.any());
4962
+ var ResultDescriptionValidator2 = mod2.object({
4963
+ id: mod2.string(),
4964
+ type: mod2.string().array().nonempty(),
4965
+ alignment: AlignmentValidator2.array().optional(),
4966
+ allowedValue: mod2.string().array().optional(),
4967
+ name: mod2.string(),
4968
+ requiredLevel: mod2.string().optional(),
4969
+ requiredValue: mod2.string().optional(),
4970
+ resultType: ResultTypeValidator2,
4971
+ rubricCriterionLevel: RubricCriterionValidator2.array().optional(),
4972
+ valueMax: mod2.string().optional(),
4973
+ valueMin: mod2.string().optional()
4974
+ }).catchall(mod2.any());
4975
+ var AchievementValidator2 = mod2.object({
4976
+ id: mod2.string().optional(),
4977
+ type: mod2.string().array().nonempty(),
4978
+ alignment: AlignmentValidator2.array().optional(),
4979
+ achievementType: AchievementTypeValidator2.optional(),
4980
+ creator: ProfileValidator2.optional(),
4981
+ creditsAvailable: mod2.number().optional(),
4982
+ criteria: CriteriaValidator2,
4983
+ description: mod2.string(),
4984
+ endorsement: EndorsementCredentialValidator2.array().optional(),
4985
+ fieldOfStudy: mod2.string().optional(),
4986
+ humanCode: mod2.string().optional(),
4987
+ image: ImageValidator2.optional(),
4988
+ "@language": mod2.string().optional(),
4989
+ name: mod2.string(),
4990
+ otherIdentifier: IdentifierEntryValidator2.array().optional(),
4991
+ related: RelatedValidator2.array().optional(),
4992
+ resultDescription: ResultDescriptionValidator2.array().optional(),
4993
+ specialization: mod2.string().optional(),
4994
+ tag: mod2.string().array().optional(),
4995
+ version: mod2.string().optional()
4996
+ }).catchall(mod2.any());
4997
+ var IdentityObjectValidator2 = mod2.object({
4998
+ type: mod2.string(),
4999
+ hashed: mod2.boolean(),
5000
+ identityHash: mod2.string(),
5001
+ identityType: mod2.string(),
5002
+ salt: mod2.string().optional()
5003
+ });
5004
+ var ResultStatusTypeValidator2 = mod2.enum([
5005
+ "Completed",
5006
+ "Enrolled",
5007
+ "Failed",
5008
+ "InProgress",
5009
+ "OnHold",
5010
+ "Withdrew"
5011
+ ]);
5012
+ var ResultValidator2 = mod2.object({
5013
+ type: mod2.string().array().nonempty(),
5014
+ achievedLevel: mod2.string().optional(),
5015
+ alignment: AlignmentValidator2.array().optional(),
5016
+ resultDescription: mod2.string().optional(),
5017
+ status: ResultStatusTypeValidator2.optional(),
5018
+ value: mod2.string().optional()
5019
+ }).catchall(mod2.any());
5020
+ var AchievementSubjectValidator2 = mod2.object({
5021
+ id: mod2.string().optional(),
5022
+ type: mod2.string().array().nonempty(),
5023
+ activityEndDate: mod2.string().optional(),
5024
+ activityStartDate: mod2.string().optional(),
5025
+ creditsEarned: mod2.number().optional(),
5026
+ achievement: AchievementValidator2.optional(),
5027
+ identifier: IdentityObjectValidator2.array().optional(),
5028
+ image: ImageValidator2.optional(),
5029
+ licenseNumber: mod2.string().optional(),
5030
+ narrative: mod2.string().optional(),
5031
+ result: ResultValidator2.array().optional(),
5032
+ role: mod2.string().optional(),
5033
+ source: ProfileValidator2.optional(),
5034
+ term: mod2.string().optional()
5035
+ }).catchall(mod2.any());
5036
+ var EvidenceValidator2 = mod2.object({
5037
+ id: mod2.string().optional(),
5038
+ type: mod2.string().array().nonempty(),
5039
+ narrative: mod2.string().optional(),
5040
+ name: mod2.string().optional(),
5041
+ description: mod2.string().optional(),
5042
+ genre: mod2.string().optional(),
5043
+ audience: mod2.string().optional()
5044
+ }).catchall(mod2.any());
5045
+ var UnsignedAchievementCredentialValidator2 = UnsignedVCValidator2.extend({
5046
+ name: mod2.string().optional(),
5047
+ description: mod2.string().optional(),
5048
+ image: ImageValidator2.optional(),
5049
+ credentialSubject: AchievementSubjectValidator2.or(
5050
+ AchievementSubjectValidator2.array()
5051
+ ),
5052
+ endorsement: UnsignedVCValidator2.array().optional(),
5053
+ evidence: EvidenceValidator2.array().optional()
5054
+ });
5055
+ var AchievementCredentialValidator2 = UnsignedAchievementCredentialValidator2.extend({
5056
+ proof: ProofValidator2.or(ProofValidator2.array())
5057
+ });
5058
+ var VerificationCheckValidator2 = mod2.object({
5059
+ checks: mod2.string().array(),
5060
+ warnings: mod2.string().array(),
5061
+ errors: mod2.string().array()
5062
+ });
5063
+ var VerificationStatusValidator2 = mod2.enum(["Success", "Failed", "Error"]);
5064
+ var VerificationStatusEnum2 = VerificationStatusValidator2.enum;
5065
+ var VerificationItemValidator2 = mod2.object({
5066
+ check: mod2.string(),
5067
+ status: VerificationStatusValidator2,
5068
+ message: mod2.string().optional(),
5069
+ details: mod2.string().optional()
5070
+ });
5071
+ var CredentialInfoValidator2 = mod2.object({
5072
+ title: mod2.string().optional(),
5073
+ createdAt: mod2.string().optional(),
5074
+ issuer: ProfileValidator2.optional(),
5075
+ issuee: ProfileValidator2.optional(),
5076
+ credentialSubject: CredentialSubjectValidator2.optional()
5077
+ });
5078
+ var CredentialRecordValidator2 = mod2.object({ id: mod2.string(), uri: mod2.string() }).catchall(mod2.any());
5079
+ var PaginationOptionsValidator2 = mod2.object({
5080
+ limit: mod2.number(),
5081
+ cursor: mod2.string().optional(),
5082
+ sort: mod2.string().optional()
5083
+ });
5084
+ var PaginationResponseValidator2 = mod2.object({
5085
+ cursor: mod2.string().optional(),
5086
+ hasMore: mod2.boolean()
5087
+ });
5088
+ var EncryptedRecordValidator2 = mod2.object({ encryptedRecord: JWEValidator2, fields: mod2.string().array() }).catchall(mod2.any());
5089
+ var PaginatedEncryptedRecordsValidator2 = PaginationResponseValidator2.extend({
5090
+ records: EncryptedRecordValidator2.array()
5091
+ });
5092
+ var EncryptedCredentialRecordValidator2 = EncryptedRecordValidator2.extend({
5093
+ id: mod2.string()
5094
+ });
5095
+ var PaginatedEncryptedCredentialRecordsValidator2 = PaginationResponseValidator2.extend({
5096
+ records: EncryptedCredentialRecordValidator2.array()
5097
+ });
5098
+ var parseRegexString2 = /* @__PURE__ */ __name222((regexStr) => {
5099
+ const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
5100
+ if (!match)
5101
+ throw new Error("Invalid RegExp string format");
5102
+ return { pattern: match[1], flags: match[2] };
5103
+ }, "parseRegexString");
5104
+ var RegExpValidator2 = mod2.instanceof(RegExp).or(
5105
+ mod2.string().refine(
5106
+ (str) => {
5107
+ try {
5108
+ parseRegexString2(str);
5109
+ return true;
5110
+ } catch (e) {
5111
+ return false;
5112
+ }
5113
+ },
5114
+ {
5115
+ message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
5116
+ }
5117
+ ).transform((str) => {
5118
+ const { pattern, flags } = parseRegexString2(str);
5119
+ try {
5120
+ return new RegExp(pattern, flags);
5121
+ } catch (error) {
5122
+ throw new Error(`Invalid RegExp: ${error.message}`);
5123
+ }
5124
+ })
5125
+ );
5126
+ var StringQuery2 = mod2.string().or(mod2.object({ $in: mod2.string().array() })).or(mod2.object({ $regex: RegExpValidator2 }));
5127
+ var LCNProfileValidator2 = mod2.object({
5128
+ profileId: mod2.string().min(3).max(40),
5129
+ displayName: mod2.string().default(""),
5130
+ shortBio: mod2.string().default(""),
5131
+ bio: mod2.string().default(""),
5132
+ did: mod2.string(),
5133
+ email: mod2.string().optional(),
5134
+ image: mod2.string().optional(),
5135
+ heroImage: mod2.string().optional(),
5136
+ websiteLink: mod2.string().optional(),
5137
+ isServiceProfile: mod2.boolean().default(false).optional(),
5138
+ type: mod2.string().optional(),
5139
+ notificationsWebhook: mod2.string().url().startsWith("http").optional()
5140
+ });
5141
+ var LCNProfileQueryValidator2 = mod2.object({
5142
+ profileId: StringQuery2,
5143
+ displayName: StringQuery2,
5144
+ shortBio: StringQuery2,
5145
+ bio: StringQuery2,
5146
+ email: StringQuery2,
5147
+ websiteLink: StringQuery2,
5148
+ isServiceProfile: mod2.boolean(),
5149
+ type: StringQuery2
5150
+ }).partial();
5151
+ var PaginatedLCNProfilesValidator2 = PaginationResponseValidator2.extend({
5152
+ records: LCNProfileValidator2.array()
5153
+ });
5154
+ var LCNProfileConnectionStatusEnum2 = mod2.enum([
5155
+ "CONNECTED",
5156
+ "PENDING_REQUEST_SENT",
5157
+ "PENDING_REQUEST_RECEIVED",
5158
+ "NOT_CONNECTED"
5159
+ ]);
5160
+ var SentCredentialInfoValidator2 = mod2.object({
5161
+ uri: mod2.string(),
5162
+ to: mod2.string(),
5163
+ from: mod2.string(),
5164
+ sent: mod2.string().datetime(),
5165
+ received: mod2.string().datetime().optional()
5166
+ });
5167
+ var BoostPermissionsValidator2 = mod2.object({
5168
+ role: mod2.string(),
5169
+ canEdit: mod2.boolean(),
5170
+ canIssue: mod2.boolean(),
5171
+ canRevoke: mod2.boolean(),
5172
+ canManagePermissions: mod2.boolean(),
5173
+ canIssueChildren: mod2.string(),
5174
+ canCreateChildren: mod2.string(),
5175
+ canEditChildren: mod2.string(),
5176
+ canRevokeChildren: mod2.string(),
5177
+ canManageChildrenPermissions: mod2.string(),
5178
+ canViewAnalytics: mod2.boolean()
5179
+ });
5180
+ var LCNBoostStatus2 = mod2.enum(["DRAFT", "LIVE"]);
5181
+ var BoostValidator2 = mod2.object({
5182
+ uri: mod2.string(),
5183
+ name: mod2.string().optional(),
5184
+ type: mod2.string().optional(),
5185
+ category: mod2.string().optional(),
5186
+ status: LCNBoostStatus2.optional(),
5187
+ autoConnectRecipients: mod2.boolean().optional(),
5188
+ meta: mod2.record(mod2.any()).optional(),
5189
+ claimPermissions: BoostPermissionsValidator2.optional()
5190
+ });
5191
+ var BoostQueryValidator2 = mod2.object({
5192
+ uri: StringQuery2,
5193
+ name: StringQuery2,
5194
+ type: StringQuery2,
5195
+ category: StringQuery2,
5196
+ meta: mod2.record(StringQuery2),
5197
+ status: LCNBoostStatus2.or(mod2.object({ $in: LCNBoostStatus2.array() })),
5198
+ autoConnectRecipients: mod2.boolean()
5199
+ }).partial();
5200
+ var PaginatedBoostsValidator2 = PaginationResponseValidator2.extend({
5201
+ records: BoostValidator2.array()
5202
+ });
5203
+ var BoostRecipientValidator2 = mod2.object({
5204
+ to: LCNProfileValidator2,
5205
+ from: mod2.string(),
5206
+ received: mod2.string().optional(),
5207
+ uri: mod2.string().optional()
5208
+ });
5209
+ var PaginatedBoostRecipientsValidator2 = PaginationResponseValidator2.extend({
5210
+ records: BoostRecipientValidator2.array()
5211
+ });
5212
+ var LCNBoostClaimLinkSigningAuthorityValidator2 = mod2.object({
5213
+ endpoint: mod2.string(),
5214
+ name: mod2.string(),
5215
+ did: mod2.string().optional()
5216
+ });
5217
+ var LCNBoostClaimLinkOptionsValidator2 = mod2.object({
5218
+ ttlSeconds: mod2.number().optional(),
5219
+ totalUses: mod2.number().optional()
5220
+ });
5221
+ var LCNSigningAuthorityValidator2 = mod2.object({
5222
+ endpoint: mod2.string()
5223
+ });
5224
+ var LCNSigningAuthorityForUserValidator2 = mod2.object({
5225
+ signingAuthority: LCNSigningAuthorityValidator2,
5226
+ relationship: mod2.object({
5227
+ name: mod2.string().max(15).regex(/^[a-z0-9-]+$/, {
5228
+ message: "The input string must contain only lowercase letters, numbers, and hyphens."
5229
+ }),
5230
+ did: mod2.string()
5231
+ })
5232
+ });
5233
+ var ConsentFlowTermsStatusValidator2 = mod2.enum(["live", "stale", "withdrawn"]);
5234
+ var ConsentFlowContractValidator2 = mod2.object({
5235
+ read: mod2.object({
5236
+ anonymize: mod2.boolean().optional(),
5237
+ credentials: mod2.object({ categories: mod2.record(mod2.object({ required: mod2.boolean() })).default({}) }).default({}),
5238
+ personal: mod2.record(mod2.object({ required: mod2.boolean() })).default({})
5239
+ }).default({}),
5240
+ write: mod2.object({
5241
+ credentials: mod2.object({ categories: mod2.record(mod2.object({ required: mod2.boolean() })).default({}) }).default({}),
5242
+ personal: mod2.record(mod2.object({ required: mod2.boolean() })).default({})
5243
+ }).default({})
5244
+ });
5245
+ var ConsentFlowContractDetailsValidator2 = mod2.object({
5246
+ contract: ConsentFlowContractValidator2,
5247
+ owner: LCNProfileValidator2,
5248
+ name: mod2.string(),
5249
+ subtitle: mod2.string().optional(),
5250
+ description: mod2.string().optional(),
5251
+ reasonForAccessing: mod2.string().optional(),
5252
+ image: mod2.string().optional(),
5253
+ uri: mod2.string(),
5254
+ createdAt: mod2.string(),
5255
+ updatedAt: mod2.string(),
5256
+ expiresAt: mod2.string().optional()
5257
+ });
5258
+ var PaginatedConsentFlowContractsValidator2 = PaginationResponseValidator2.extend({
5259
+ records: ConsentFlowContractDetailsValidator2.omit({ owner: true }).array()
5260
+ });
5261
+ var ConsentFlowContractDataValidator2 = mod2.object({
5262
+ credentials: mod2.object({ categories: mod2.record(mod2.string().array()).default({}) }),
5263
+ personal: mod2.record(mod2.string()).default({}),
5264
+ date: mod2.string()
5265
+ });
5266
+ var PaginatedConsentFlowDataValidator2 = PaginationResponseValidator2.extend({
5267
+ records: ConsentFlowContractDataValidator2.array()
5268
+ });
5269
+ var ConsentFlowTermValidator2 = mod2.object({
5270
+ sharing: mod2.boolean().optional(),
5271
+ shared: mod2.string().array().optional(),
5272
+ shareAll: mod2.boolean().optional(),
5273
+ shareUntil: mod2.string().optional()
5274
+ });
5275
+ var ConsentFlowTermsValidator2 = mod2.object({
5276
+ read: mod2.object({
5277
+ anonymize: mod2.boolean().optional(),
5278
+ credentials: mod2.object({
5279
+ shareAll: mod2.boolean().optional(),
5280
+ sharing: mod2.boolean().optional(),
5281
+ categories: mod2.record(ConsentFlowTermValidator2).default({})
5282
+ }).default({}),
5283
+ personal: mod2.record(mod2.string()).default({})
5284
+ }).default({}),
5285
+ write: mod2.object({
5286
+ credentials: mod2.object({ categories: mod2.record(mod2.boolean()).default({}) }).default({}),
5287
+ personal: mod2.record(mod2.boolean()).default({})
5288
+ }).default({})
5289
+ });
5290
+ var PaginatedConsentFlowTermsValidator2 = PaginationResponseValidator2.extend({
5291
+ records: mod2.object({
5292
+ expiresAt: mod2.string().optional(),
5293
+ oneTime: mod2.boolean().optional(),
5294
+ terms: ConsentFlowTermsValidator2,
5295
+ contract: ConsentFlowContractDetailsValidator2,
5296
+ uri: mod2.string(),
5297
+ consenter: LCNProfileValidator2,
5298
+ status: ConsentFlowTermsStatusValidator2
5299
+ }).array()
5300
+ });
5301
+ var ConsentFlowContractQueryValidator2 = mod2.object({
5302
+ read: mod2.object({
5303
+ anonymize: mod2.boolean().optional(),
5304
+ credentials: mod2.object({
5305
+ categories: mod2.record(mod2.object({ required: mod2.boolean().optional() })).optional()
5306
+ }).optional(),
5307
+ personal: mod2.record(mod2.object({ required: mod2.boolean().optional() })).optional()
5308
+ }).optional(),
5309
+ write: mod2.object({
5310
+ credentials: mod2.object({
5311
+ categories: mod2.record(mod2.object({ required: mod2.boolean().optional() })).optional()
5312
+ }).optional(),
5313
+ personal: mod2.record(mod2.object({ required: mod2.boolean().optional() })).optional()
5314
+ }).optional()
5315
+ });
5316
+ var ConsentFlowDataQueryValidator2 = mod2.object({
5317
+ anonymize: mod2.boolean().optional(),
5318
+ credentials: mod2.object({ categories: mod2.record(mod2.boolean()).optional() }).optional(),
5319
+ personal: mod2.record(mod2.boolean()).optional()
5320
+ });
5321
+ var ConsentFlowTermsQueryValidator2 = mod2.object({
5322
+ read: mod2.object({
5323
+ anonymize: mod2.boolean().optional(),
5324
+ credentials: mod2.object({
5325
+ shareAll: mod2.boolean().optional(),
5326
+ sharing: mod2.boolean().optional(),
5327
+ categories: mod2.record(ConsentFlowTermValidator2.optional()).optional()
5328
+ }).optional(),
5329
+ personal: mod2.record(mod2.string()).optional()
5330
+ }).optional(),
5331
+ write: mod2.object({
5332
+ credentials: mod2.object({ categories: mod2.record(mod2.boolean()).optional() }).optional(),
5333
+ personal: mod2.record(mod2.boolean()).optional()
5334
+ }).optional()
5335
+ });
5336
+ var ConsentFlowTransactionActionValidator2 = mod2.enum([
5337
+ "consent",
5338
+ "update",
5339
+ "sync",
5340
+ "withdraw"
5341
+ ]);
5342
+ var ConsentFlowTransactionsQueryValidator2 = mod2.object({
5343
+ terms: ConsentFlowTermsQueryValidator2.optional(),
5344
+ action: ConsentFlowTransactionActionValidator2.or(
5345
+ ConsentFlowTransactionActionValidator2.array()
5346
+ ).optional(),
5347
+ date: mod2.object({ $gt: mod2.string() }).or(mod2.object({ $lt: mod2.string() })).or(mod2.object({ $eq: mod2.string() })).optional(),
5348
+ expiresAt: mod2.object({ $gt: mod2.string() }).or(mod2.object({ $lt: mod2.string() })).or(mod2.object({ $eq: mod2.string() })).optional(),
5349
+ oneTime: mod2.boolean().optional()
5350
+ });
5351
+ var ConsentFlowTransactionValidator2 = mod2.object({
5352
+ expiresAt: mod2.string().optional(),
5353
+ oneTime: mod2.boolean().optional(),
5354
+ terms: ConsentFlowTermsValidator2.optional(),
5355
+ id: mod2.string(),
5356
+ action: ConsentFlowTransactionActionValidator2,
5357
+ date: mod2.string()
5358
+ });
5359
+ var PaginatedConsentFlowTransactionsValidator2 = PaginationResponseValidator2.extend({
5360
+ records: ConsentFlowTransactionValidator2.array()
5361
+ });
5362
+ var LCNNotificationTypeEnumValidator2 = mod2.enum([
5363
+ "CONNECTION_REQUEST",
5364
+ "CONNECTION_ACCEPTED",
5365
+ "CREDENTIAL_RECEIVED",
5366
+ "CREDENTIAL_ACCEPTED",
5367
+ "BOOST_RECEIVED",
5368
+ "BOOST_ACCEPTED",
5369
+ "PRESENTATION_REQUEST",
5370
+ "PRESENTATION_RECEIVED",
5371
+ "CONSENT_FLOW_TRANSACTION"
5372
+ ]);
5373
+ var LCNNotificationMessageValidator2 = mod2.object({
5374
+ title: mod2.string().optional(),
5375
+ body: mod2.string().optional()
5376
+ });
5377
+ var LCNNotificationDataValidator2 = mod2.object({
5378
+ vcUris: mod2.array(mod2.string()).optional(),
5379
+ vpUris: mod2.array(mod2.string()).optional(),
5380
+ transaction: ConsentFlowTransactionValidator2.optional()
5381
+ });
5382
+ var LCNNotificationValidator2 = mod2.object({
5383
+ type: LCNNotificationTypeEnumValidator2,
5384
+ to: LCNProfileValidator2.partial().and(mod2.object({ did: mod2.string() })),
5385
+ from: LCNProfileValidator2.partial().and(mod2.object({ did: mod2.string() })),
5386
+ message: LCNNotificationMessageValidator2.optional(),
5387
+ data: LCNNotificationDataValidator2.optional(),
5388
+ sent: mod2.string().datetime().optional()
5389
+ });
5390
+ }
5391
+ });
5392
+ var require_dist2 = __commonJS2({
5393
+ "../learn-card-types/dist/index.js"(exports2, module22) {
5394
+ "use strict";
5395
+ if (false) {
5396
+ module22.exports = null;
5397
+ } else {
5398
+ module22.exports = require_types_cjs_development();
5399
+ }
5400
+ }
5401
+ });
5402
+ var src_exports2 = {};
5403
+ __export2(src_exports2, {
5404
+ RegExpTransformer: () => RegExpTransformer2,
5405
+ isEncrypted: () => isEncrypted,
5406
+ isHex: () => isHex
5407
+ });
5408
+ module2.exports = __toCommonJS2(src_exports2);
5409
+ var import_types2 = __toESM2(require_dist2());
5410
+ var isHex = /* @__PURE__ */ __name22((str) => /^[0-9a-f]+$/i.test(str), "isHex");
5411
+ var isEncrypted = /* @__PURE__ */ __name22((item) => {
5412
+ return import_types2.JWEValidator.safeParse(item).success;
5413
+ }, "isEncrypted");
5414
+ var RegExpTransformer2 = {
5415
+ serialize(object) {
5416
+ return JSON.stringify(object, (_key, value) => {
5417
+ if (value instanceof RegExp)
5418
+ return value.toString();
5419
+ return value;
5420
+ });
5421
+ },
5422
+ deserialize(object) {
5423
+ if (typeof object !== "string")
5424
+ return object;
5425
+ return JSON.parse(object, (_key, value) => {
5426
+ if (typeof value === "string") {
5427
+ const match = value.match(/^\/(.*)\/([gimsuy]*)$/);
5428
+ if (match) {
5429
+ try {
5430
+ return new RegExp(match[1], match[2]);
5431
+ } catch (error) {
5432
+ console.warn(`Failed to parse RegExp: ${error}`);
5433
+ return value;
5434
+ }
5435
+ }
5436
+ }
5437
+ return value;
5438
+ });
5439
+ }
5440
+ };
5441
+ }
5442
+ });
5443
+ var require_dist = __commonJS({
5444
+ "../../learn-card-helpers/dist/index.js"(exports, module2) {
5445
+ "use strict";
5446
+ if (false) {
5447
+ module2.exports = null;
5448
+ } else {
5449
+ module2.exports = require_helpers_cjs_development();
5450
+ }
5451
+ }
5452
+ });
5453
+ var import_helpers = __toESM(require_dist());
1165
5454
  var callbackLink = /* @__PURE__ */ __name2((callback) => {
1166
5455
  return () => {
1167
5456
  return ({ next, op }) => {
@@ -1199,6 +5488,7 @@ var callbackLink = /* @__PURE__ */ __name2((callback) => {
1199
5488
  var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
1200
5489
  let challenges = [];
1201
5490
  const challengeRequester = createTRPCProxyClient({
5491
+ transformer: import_helpers.RegExpTransformer,
1202
5492
  links: [
1203
5493
  httpBatchLink({
1204
5494
  url,
@@ -1212,6 +5502,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
1212
5502
  }, "getChallenges");
1213
5503
  challenges = await getChallenges();
1214
5504
  const trpc = createTRPCProxyClient({
5505
+ transformer: import_helpers.RegExpTransformer,
1215
5506
  links: [
1216
5507
  callbackLink(async () => {
1217
5508
  challenges = await getChallenges();
@@ -4553,6 +8844,8 @@ var mod = /* @__PURE__ */ Object.freeze({
4553
8844
  });
4554
8845
 
4555
8846
  // ../../learn-card-types/dist/types.esm.js
8847
+ var __defProp3 = Object.defineProperty;
8848
+ var __name3 = /* @__PURE__ */ __name((target, value) => __defProp3(target, "name", { value, configurable: true }), "__name");
4556
8849
  var ContextValidator = mod.array(mod.string().or(mod.record(mod.any())));
4557
8850
  var AchievementCriteriaValidator = mod.object({
4558
8851
  type: mod.string().optional(),
@@ -4956,6 +9249,35 @@ var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
4956
9249
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
4957
9250
  records: EncryptedCredentialRecordValidator.array()
4958
9251
  });
9252
+ var parseRegexString = /* @__PURE__ */ __name3((regexStr) => {
9253
+ const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
9254
+ if (!match)
9255
+ throw new Error("Invalid RegExp string format");
9256
+ return { pattern: match[1], flags: match[2] };
9257
+ }, "parseRegexString");
9258
+ var RegExpValidator = mod.instanceof(RegExp).or(
9259
+ mod.string().refine(
9260
+ (str) => {
9261
+ try {
9262
+ parseRegexString(str);
9263
+ return true;
9264
+ } catch {
9265
+ return false;
9266
+ }
9267
+ },
9268
+ {
9269
+ message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
9270
+ }
9271
+ ).transform((str) => {
9272
+ const { pattern, flags } = parseRegexString(str);
9273
+ try {
9274
+ return new RegExp(pattern, flags);
9275
+ } catch (error) {
9276
+ throw new Error(`Invalid RegExp: ${error.message}`);
9277
+ }
9278
+ })
9279
+ );
9280
+ var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
4959
9281
  var LCNProfileValidator = mod.object({
4960
9282
  profileId: mod.string().min(3).max(40),
4961
9283
  displayName: mod.string().default(""),
@@ -4970,6 +9292,16 @@ var LCNProfileValidator = mod.object({
4970
9292
  type: mod.string().optional(),
4971
9293
  notificationsWebhook: mod.string().url().startsWith("http").optional()
4972
9294
  });
9295
+ var LCNProfileQueryValidator = mod.object({
9296
+ profileId: StringQuery,
9297
+ displayName: StringQuery,
9298
+ shortBio: StringQuery,
9299
+ bio: StringQuery,
9300
+ email: StringQuery,
9301
+ websiteLink: StringQuery,
9302
+ isServiceProfile: mod.boolean(),
9303
+ type: StringQuery
9304
+ }).partial();
4973
9305
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
4974
9306
  records: LCNProfileValidator.array()
4975
9307
  });
@@ -5010,7 +9342,6 @@ var BoostValidator = mod.object({
5010
9342
  meta: mod.record(mod.any()).optional(),
5011
9343
  claimPermissions: BoostPermissionsValidator.optional()
5012
9344
  });
5013
- var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: mod.instanceof(RegExp) }));
5014
9345
  var BoostQueryValidator = mod.object({
5015
9346
  uri: StringQuery,
5016
9347
  name: StringQuery,
@@ -5026,7 +9357,8 @@ var PaginatedBoostsValidator = PaginationResponseValidator.extend({
5026
9357
  var BoostRecipientValidator = mod.object({
5027
9358
  to: LCNProfileValidator,
5028
9359
  from: mod.string(),
5029
- received: mod.string().optional()
9360
+ received: mod.string().optional(),
9361
+ uri: mod.string().optional()
5030
9362
  });
5031
9363
  var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
5032
9364
  records: BoostRecipientValidator.array()
@@ -5600,14 +9932,15 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5600
9932
  includeUnacceptedBoosts
5601
9933
  });
5602
9934
  },
5603
- getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true) => {
9935
+ getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true, query) => {
5604
9936
  if (!userData)
5605
9937
  throw new Error("Please make an account first!");
5606
9938
  return client.boost.getPaginatedBoostRecipients.query({
5607
9939
  uri,
5608
9940
  limit,
5609
9941
  cursor,
5610
- includeUnacceptedBoosts
9942
+ includeUnacceptedBoosts,
9943
+ query
5611
9944
  });
5612
9945
  },
5613
9946
  countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {