@learncard/learn-card-plugin 1.1.43 → 1.1.45

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.
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
 
21
21
  // src/index.ts
22
22
  var src_exports = {};
@@ -25,7 +25,7 @@ __export(src_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(src_exports);
27
27
 
28
- // ../../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
28
+ // ../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
29
29
  var util;
30
30
  (function(util2) {
31
31
  util2.assertEqual = (val) => val;
@@ -87,6 +87,15 @@ var util;
87
87
  return value;
88
88
  };
89
89
  })(util || (util = {}));
90
+ var objectUtil;
91
+ (function(objectUtil2) {
92
+ objectUtil2.mergeShapes = (first, second) => {
93
+ return {
94
+ ...first,
95
+ ...second
96
+ };
97
+ };
98
+ })(objectUtil || (objectUtil = {}));
90
99
  var ZodParsedType = util.arrayToEnum([
91
100
  "string",
92
101
  "nan",
@@ -230,6 +239,11 @@ var ZodError = class extends Error {
230
239
  processError(this);
231
240
  return fieldErrors;
232
241
  }
242
+ static assert(value) {
243
+ if (!(value instanceof ZodError)) {
244
+ throw new Error(`Not a ZodError: ${value}`);
245
+ }
246
+ }
233
247
  toString() {
234
248
  return this.message;
235
249
  }
@@ -297,7 +311,12 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
297
311
  break;
298
312
  case ZodIssueCode.invalid_string:
299
313
  if (typeof issue.validation === "object") {
300
- if ("startsWith" in issue.validation) {
314
+ if ("includes" in issue.validation) {
315
+ message = `Invalid input: must include "${issue.validation.includes}"`;
316
+ if (typeof issue.validation.position === "number") {
317
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
318
+ }
319
+ } else if ("startsWith" in issue.validation) {
301
320
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
302
321
  } else if ("endsWith" in issue.validation) {
303
322
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -318,7 +337,7 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
318
337
  else if (issue.type === "number")
319
338
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
320
339
  else if (issue.type === "date")
321
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
340
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
322
341
  else
323
342
  message = "Invalid input";
324
343
  break;
@@ -329,8 +348,10 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
329
348
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
330
349
  else if (issue.type === "number")
331
350
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
351
+ else if (issue.type === "bigint")
352
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
332
353
  else if (issue.type === "date")
333
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
354
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
334
355
  else
335
356
  message = "Invalid input";
336
357
  break;
@@ -368,6 +389,13 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
368
389
  ...issueData,
369
390
  path: fullPath
370
391
  };
392
+ if (issueData.message !== void 0) {
393
+ return {
394
+ ...issueData,
395
+ path: fullPath,
396
+ message: issueData.message
397
+ };
398
+ }
371
399
  let errorMessage = "";
372
400
  const maps = errorMaps.filter((m3) => !!m3).slice().reverse();
373
401
  for (const map of maps) {
@@ -376,11 +404,12 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
376
404
  return {
377
405
  ...issueData,
378
406
  path: fullPath,
379
- message: issueData.message || errorMessage
407
+ message: errorMessage
380
408
  };
381
409
  }, "makeIssue");
382
410
  var EMPTY_PATH = [];
383
411
  function addIssueToContext(ctx, issueData) {
412
+ const overrideMap = getErrorMap();
384
413
  const issue = makeIssue({
385
414
  issueData,
386
415
  data: ctx.data,
@@ -388,8 +417,8 @@ function addIssueToContext(ctx, issueData) {
388
417
  errorMaps: [
389
418
  ctx.common.contextualErrorMap,
390
419
  ctx.schemaErrorMap,
391
- getErrorMap(),
392
- errorMap
420
+ overrideMap,
421
+ overrideMap === errorMap ? void 0 : errorMap
393
422
  ].filter((x2) => !!x2)
394
423
  });
395
424
  ctx.common.issues.push(issue);
@@ -421,9 +450,11 @@ var ParseStatus = class {
421
450
  static async mergeObjectAsync(status, pairs) {
422
451
  const syncPairs = [];
423
452
  for (const pair of pairs) {
453
+ const key = await pair.key;
454
+ const value = await pair.value;
424
455
  syncPairs.push({
425
- key: await pair.key,
426
- value: await pair.value
456
+ key,
457
+ value
427
458
  });
428
459
  }
429
460
  return ParseStatus.mergeObjectSync(status, syncPairs);
@@ -440,7 +471,7 @@ var ParseStatus = class {
440
471
  status.dirty();
441
472
  if (value.status === "dirty")
442
473
  status.dirty();
443
- if (typeof value.value !== "undefined" || pair.alwaysSet) {
474
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
444
475
  finalObject[key.value] = value.value;
445
476
  }
446
477
  }
@@ -456,21 +487,49 @@ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
456
487
  var isAborted = /* @__PURE__ */ __name((x2) => x2.status === "aborted", "isAborted");
457
488
  var isDirty = /* @__PURE__ */ __name((x2) => x2.status === "dirty", "isDirty");
458
489
  var isValid = /* @__PURE__ */ __name((x2) => x2.status === "valid", "isValid");
459
- var isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !== void 0 && x2 instanceof Promise, "isAsync");
490
+ var isAsync = /* @__PURE__ */ __name((x2) => typeof Promise !== "undefined" && x2 instanceof Promise, "isAsync");
491
+ function __classPrivateFieldGet(receiver, state, kind, f) {
492
+ if (kind === "a" && !f)
493
+ throw new TypeError("Private accessor was defined without a getter");
494
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
495
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
496
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
497
+ }
498
+ __name(__classPrivateFieldGet, "__classPrivateFieldGet");
499
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
500
+ if (kind === "m")
501
+ throw new TypeError("Private method is not writable");
502
+ if (kind === "a" && !f)
503
+ throw new TypeError("Private accessor was defined without a setter");
504
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
505
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
506
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
507
+ }
508
+ __name(__classPrivateFieldSet, "__classPrivateFieldSet");
460
509
  var errorUtil;
461
510
  (function(errorUtil2) {
462
511
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
463
512
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
464
513
  })(errorUtil || (errorUtil = {}));
514
+ var _ZodEnum_cache;
515
+ var _ZodNativeEnum_cache;
465
516
  var ParseInputLazyPath = class {
466
517
  constructor(parent, value, path, key) {
518
+ this._cachedPath = [];
467
519
  this.parent = parent;
468
520
  this.data = value;
469
521
  this._path = path;
470
522
  this._key = key;
471
523
  }
472
524
  get path() {
473
- return this._path.concat(this._key);
525
+ if (!this._cachedPath.length) {
526
+ if (this._key instanceof Array) {
527
+ this._cachedPath.push(...this._path, ...this._key);
528
+ } else {
529
+ this._cachedPath.push(...this._path, this._key);
530
+ }
531
+ }
532
+ return this._cachedPath;
474
533
  }
475
534
  };
476
535
  __name(ParseInputLazyPath, "ParseInputLazyPath");
@@ -481,8 +540,16 @@ var handleResult = /* @__PURE__ */ __name((ctx, result) => {
481
540
  if (!ctx.common.issues.length) {
482
541
  throw new Error("Validation failed but no issues detected.");
483
542
  }
484
- const error = new ZodError(ctx.common.issues);
485
- return { success: false, error };
543
+ return {
544
+ success: false,
545
+ get error() {
546
+ if (this._error)
547
+ return this._error;
548
+ const error = new ZodError(ctx.common.issues);
549
+ this._error = error;
550
+ return this._error;
551
+ }
552
+ };
486
553
  }
487
554
  }, "handleResult");
488
555
  function processCreateParams(params) {
@@ -495,12 +562,17 @@ function processCreateParams(params) {
495
562
  if (errorMap2)
496
563
  return { errorMap: errorMap2, description };
497
564
  const customMap = /* @__PURE__ */ __name((iss, ctx) => {
498
- if (iss.code !== "invalid_type")
499
- return { message: ctx.defaultError };
565
+ var _a, _b;
566
+ const { message } = params;
567
+ if (iss.code === "invalid_enum_value") {
568
+ return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
569
+ }
500
570
  if (typeof ctx.data === "undefined") {
501
- return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
571
+ return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
502
572
  }
503
- return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
573
+ if (iss.code !== "invalid_type")
574
+ return { message: ctx.defaultError };
575
+ return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
504
576
  }, "customMap");
505
577
  return { errorMap: customMap, description };
506
578
  }
@@ -530,6 +602,7 @@ var ZodType = class {
530
602
  this.catch = this.catch.bind(this);
531
603
  this.describe = this.describe.bind(this);
532
604
  this.pipe = this.pipe.bind(this);
605
+ this.readonly = this.readonly.bind(this);
533
606
  this.isNullable = this.isNullable.bind(this);
534
607
  this.isOptional = this.isOptional.bind(this);
535
608
  }
@@ -674,28 +747,29 @@ var ZodType = class {
674
747
  return this._refinement(refinement);
675
748
  }
676
749
  optional() {
677
- return ZodOptional.create(this);
750
+ return ZodOptional.create(this, this._def);
678
751
  }
679
752
  nullable() {
680
- return ZodNullable.create(this);
753
+ return ZodNullable.create(this, this._def);
681
754
  }
682
755
  nullish() {
683
- return this.optional().nullable();
756
+ return this.nullable().optional();
684
757
  }
685
758
  array() {
686
- return ZodArray.create(this);
759
+ return ZodArray.create(this, this._def);
687
760
  }
688
761
  promise() {
689
- return ZodPromise.create(this);
762
+ return ZodPromise.create(this, this._def);
690
763
  }
691
764
  or(option) {
692
- return ZodUnion.create([this, option]);
765
+ return ZodUnion.create([this, option], this._def);
693
766
  }
694
767
  and(incoming) {
695
- return ZodIntersection.create(this, incoming);
768
+ return ZodIntersection.create(this, incoming, this._def);
696
769
  }
697
770
  transform(transform) {
698
771
  return new ZodEffects({
772
+ ...processCreateParams(this._def),
699
773
  schema: this,
700
774
  typeName: ZodFirstPartyTypeKind.ZodEffects,
701
775
  effect: { type: "transform", transform }
@@ -704,6 +778,7 @@ var ZodType = class {
704
778
  default(def) {
705
779
  const defaultValueFunc = typeof def === "function" ? def : () => def;
706
780
  return new ZodDefault({
781
+ ...processCreateParams(this._def),
707
782
  innerType: this,
708
783
  defaultValue: defaultValueFunc,
709
784
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -713,14 +788,15 @@ var ZodType = class {
713
788
  return new ZodBranded({
714
789
  typeName: ZodFirstPartyTypeKind.ZodBranded,
715
790
  type: this,
716
- ...processCreateParams(void 0)
791
+ ...processCreateParams(this._def)
717
792
  });
718
793
  }
719
794
  catch(def) {
720
- const defaultValueFunc = typeof def === "function" ? def : () => def;
795
+ const catchValueFunc = typeof def === "function" ? def : () => def;
721
796
  return new ZodCatch({
797
+ ...processCreateParams(this._def),
722
798
  innerType: this,
723
- defaultValue: defaultValueFunc,
799
+ catchValue: catchValueFunc,
724
800
  typeName: ZodFirstPartyTypeKind.ZodCatch
725
801
  });
726
802
  }
@@ -734,6 +810,9 @@ var ZodType = class {
734
810
  pipe(target) {
735
811
  return ZodPipeline.create(this, target);
736
812
  }
813
+ readonly() {
814
+ return ZodReadonly.create(this);
815
+ }
737
816
  isOptional() {
738
817
  return this.safeParse(void 0).success;
739
818
  }
@@ -743,43 +822,54 @@ var ZodType = class {
743
822
  };
744
823
  __name(ZodType, "ZodType");
745
824
  var cuidRegex = /^c[^\s-]{8,}$/i;
746
- var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
747
- var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
748
- var datetimeRegex = /* @__PURE__ */ __name((args) => {
825
+ var cuid2Regex = /^[0-9a-z]+$/;
826
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
827
+ var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
828
+ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
829
+ var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
830
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
831
+ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
832
+ var emojiRegex;
833
+ var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
834
+ var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
835
+ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
836
+ var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
837
+ var dateRegex = new RegExp(`^${dateRegexSource}$`);
838
+ function timeRegexSource(args) {
839
+ let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
749
840
  if (args.precision) {
750
- if (args.offset) {
751
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
752
- } else {
753
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
754
- }
755
- } else if (args.precision === 0) {
756
- if (args.offset) {
757
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
758
- } else {
759
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
760
- }
761
- } else {
762
- if (args.offset) {
763
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
764
- } else {
765
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
766
- }
841
+ regex = `${regex}\\.\\d{${args.precision}}`;
842
+ } else if (args.precision == null) {
843
+ regex = `${regex}(\\.\\d+)?`;
767
844
  }
768
- }, "datetimeRegex");
769
- var ZodString = class extends ZodType {
770
- constructor() {
771
- super(...arguments);
772
- this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
773
- validation,
774
- code: ZodIssueCode.invalid_string,
775
- ...errorUtil.errToObj(message)
776
- });
777
- this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
778
- this.trim = () => new ZodString({
779
- ...this._def,
780
- checks: [...this._def.checks, { kind: "trim" }]
781
- });
845
+ return regex;
846
+ }
847
+ __name(timeRegexSource, "timeRegexSource");
848
+ function timeRegex(args) {
849
+ return new RegExp(`^${timeRegexSource(args)}$`);
850
+ }
851
+ __name(timeRegex, "timeRegex");
852
+ function datetimeRegex(args) {
853
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
854
+ const opts = [];
855
+ opts.push(args.local ? `Z?` : `Z`);
856
+ if (args.offset)
857
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
858
+ regex = `${regex}(${opts.join("|")})`;
859
+ return new RegExp(`^${regex}$`);
860
+ }
861
+ __name(datetimeRegex, "datetimeRegex");
862
+ function isValidIP(ip, version) {
863
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
864
+ return true;
782
865
  }
866
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
867
+ return true;
868
+ }
869
+ return false;
870
+ }
871
+ __name(isValidIP, "isValidIP");
872
+ var ZodString = class extends ZodType {
783
873
  _parse(input) {
784
874
  if (this._def.coerce) {
785
875
  input.data = String(input.data);
@@ -787,14 +877,11 @@ var ZodString = class extends ZodType {
787
877
  const parsedType = this._getType(input);
788
878
  if (parsedType !== ZodParsedType.string) {
789
879
  const ctx2 = this._getOrReturnCtx(input);
790
- addIssueToContext(
791
- ctx2,
792
- {
793
- code: ZodIssueCode.invalid_type,
794
- expected: ZodParsedType.string,
795
- received: ctx2.parsedType
796
- }
797
- );
880
+ addIssueToContext(ctx2, {
881
+ code: ZodIssueCode.invalid_type,
882
+ expected: ZodParsedType.string,
883
+ received: ctx2.parsedType
884
+ });
798
885
  return INVALID;
799
886
  }
800
887
  const status = new ParseStatus();
@@ -862,6 +949,19 @@ var ZodString = class extends ZodType {
862
949
  });
863
950
  status.dirty();
864
951
  }
952
+ } else if (check.kind === "emoji") {
953
+ if (!emojiRegex) {
954
+ emojiRegex = new RegExp(_emojiRegex, "u");
955
+ }
956
+ if (!emojiRegex.test(input.data)) {
957
+ ctx = this._getOrReturnCtx(input, ctx);
958
+ addIssueToContext(ctx, {
959
+ validation: "emoji",
960
+ code: ZodIssueCode.invalid_string,
961
+ message: check.message
962
+ });
963
+ status.dirty();
964
+ }
865
965
  } else if (check.kind === "uuid") {
866
966
  if (!uuidRegex.test(input.data)) {
867
967
  ctx = this._getOrReturnCtx(input, ctx);
@@ -872,6 +972,16 @@ var ZodString = class extends ZodType {
872
972
  });
873
973
  status.dirty();
874
974
  }
975
+ } else if (check.kind === "nanoid") {
976
+ if (!nanoidRegex.test(input.data)) {
977
+ ctx = this._getOrReturnCtx(input, ctx);
978
+ addIssueToContext(ctx, {
979
+ validation: "nanoid",
980
+ code: ZodIssueCode.invalid_string,
981
+ message: check.message
982
+ });
983
+ status.dirty();
984
+ }
875
985
  } else if (check.kind === "cuid") {
876
986
  if (!cuidRegex.test(input.data)) {
877
987
  ctx = this._getOrReturnCtx(input, ctx);
@@ -882,6 +992,26 @@ var ZodString = class extends ZodType {
882
992
  });
883
993
  status.dirty();
884
994
  }
995
+ } else if (check.kind === "cuid2") {
996
+ if (!cuid2Regex.test(input.data)) {
997
+ ctx = this._getOrReturnCtx(input, ctx);
998
+ addIssueToContext(ctx, {
999
+ validation: "cuid2",
1000
+ code: ZodIssueCode.invalid_string,
1001
+ message: check.message
1002
+ });
1003
+ status.dirty();
1004
+ }
1005
+ } else if (check.kind === "ulid") {
1006
+ if (!ulidRegex.test(input.data)) {
1007
+ ctx = this._getOrReturnCtx(input, ctx);
1008
+ addIssueToContext(ctx, {
1009
+ validation: "ulid",
1010
+ code: ZodIssueCode.invalid_string,
1011
+ message: check.message
1012
+ });
1013
+ status.dirty();
1014
+ }
885
1015
  } else if (check.kind === "url") {
886
1016
  try {
887
1017
  new URL(input.data);
@@ -908,6 +1038,20 @@ var ZodString = class extends ZodType {
908
1038
  }
909
1039
  } else if (check.kind === "trim") {
910
1040
  input.data = input.data.trim();
1041
+ } else if (check.kind === "includes") {
1042
+ if (!input.data.includes(check.value, check.position)) {
1043
+ ctx = this._getOrReturnCtx(input, ctx);
1044
+ addIssueToContext(ctx, {
1045
+ code: ZodIssueCode.invalid_string,
1046
+ validation: { includes: check.value, position: check.position },
1047
+ message: check.message
1048
+ });
1049
+ status.dirty();
1050
+ }
1051
+ } else if (check.kind === "toLowerCase") {
1052
+ input.data = input.data.toLowerCase();
1053
+ } else if (check.kind === "toUpperCase") {
1054
+ input.data = input.data.toUpperCase();
911
1055
  } else if (check.kind === "startsWith") {
912
1056
  if (!input.data.startsWith(check.value)) {
913
1057
  ctx = this._getOrReturnCtx(input, ctx);
@@ -939,12 +1083,71 @@ var ZodString = class extends ZodType {
939
1083
  });
940
1084
  status.dirty();
941
1085
  }
1086
+ } else if (check.kind === "date") {
1087
+ const regex = dateRegex;
1088
+ if (!regex.test(input.data)) {
1089
+ ctx = this._getOrReturnCtx(input, ctx);
1090
+ addIssueToContext(ctx, {
1091
+ code: ZodIssueCode.invalid_string,
1092
+ validation: "date",
1093
+ message: check.message
1094
+ });
1095
+ status.dirty();
1096
+ }
1097
+ } else if (check.kind === "time") {
1098
+ const regex = timeRegex(check);
1099
+ if (!regex.test(input.data)) {
1100
+ ctx = this._getOrReturnCtx(input, ctx);
1101
+ addIssueToContext(ctx, {
1102
+ code: ZodIssueCode.invalid_string,
1103
+ validation: "time",
1104
+ message: check.message
1105
+ });
1106
+ status.dirty();
1107
+ }
1108
+ } else if (check.kind === "duration") {
1109
+ if (!durationRegex.test(input.data)) {
1110
+ ctx = this._getOrReturnCtx(input, ctx);
1111
+ addIssueToContext(ctx, {
1112
+ validation: "duration",
1113
+ code: ZodIssueCode.invalid_string,
1114
+ message: check.message
1115
+ });
1116
+ status.dirty();
1117
+ }
1118
+ } else if (check.kind === "ip") {
1119
+ if (!isValidIP(input.data, check.version)) {
1120
+ ctx = this._getOrReturnCtx(input, ctx);
1121
+ addIssueToContext(ctx, {
1122
+ validation: "ip",
1123
+ code: ZodIssueCode.invalid_string,
1124
+ message: check.message
1125
+ });
1126
+ status.dirty();
1127
+ }
1128
+ } else if (check.kind === "base64") {
1129
+ if (!base64Regex.test(input.data)) {
1130
+ ctx = this._getOrReturnCtx(input, ctx);
1131
+ addIssueToContext(ctx, {
1132
+ validation: "base64",
1133
+ code: ZodIssueCode.invalid_string,
1134
+ message: check.message
1135
+ });
1136
+ status.dirty();
1137
+ }
942
1138
  } else {
943
1139
  util.assertNever(check);
944
1140
  }
945
1141
  }
946
1142
  return { status: status.value, value: input.data };
947
1143
  }
1144
+ _regex(regex, validation, message) {
1145
+ return this.refinement((data) => regex.test(data), {
1146
+ validation,
1147
+ code: ZodIssueCode.invalid_string,
1148
+ ...errorUtil.errToObj(message)
1149
+ });
1150
+ }
948
1151
  _addCheck(check) {
949
1152
  return new ZodString({
950
1153
  ...this._def,
@@ -957,19 +1160,38 @@ var ZodString = class extends ZodType {
957
1160
  url(message) {
958
1161
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
959
1162
  }
1163
+ emoji(message) {
1164
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1165
+ }
960
1166
  uuid(message) {
961
1167
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
962
1168
  }
1169
+ nanoid(message) {
1170
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1171
+ }
963
1172
  cuid(message) {
964
1173
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
965
1174
  }
1175
+ cuid2(message) {
1176
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1177
+ }
1178
+ ulid(message) {
1179
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1180
+ }
1181
+ base64(message) {
1182
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1183
+ }
1184
+ ip(options) {
1185
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1186
+ }
966
1187
  datetime(options) {
967
- var _a;
1188
+ var _a, _b;
968
1189
  if (typeof options === "string") {
969
1190
  return this._addCheck({
970
1191
  kind: "datetime",
971
1192
  precision: null,
972
1193
  offset: false,
1194
+ local: false,
973
1195
  message: options
974
1196
  });
975
1197
  }
@@ -977,9 +1199,30 @@ var ZodString = class extends ZodType {
977
1199
  kind: "datetime",
978
1200
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
979
1201
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1202
+ local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1203
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1204
+ });
1205
+ }
1206
+ date(message) {
1207
+ return this._addCheck({ kind: "date", message });
1208
+ }
1209
+ time(options) {
1210
+ if (typeof options === "string") {
1211
+ return this._addCheck({
1212
+ kind: "time",
1213
+ precision: null,
1214
+ message: options
1215
+ });
1216
+ }
1217
+ return this._addCheck({
1218
+ kind: "time",
1219
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
980
1220
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
981
1221
  });
982
1222
  }
1223
+ duration(message) {
1224
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1225
+ }
983
1226
  regex(regex, message) {
984
1227
  return this._addCheck({
985
1228
  kind: "regex",
@@ -987,6 +1230,14 @@ var ZodString = class extends ZodType {
987
1230
  ...errorUtil.errToObj(message)
988
1231
  });
989
1232
  }
1233
+ includes(value, options) {
1234
+ return this._addCheck({
1235
+ kind: "includes",
1236
+ value,
1237
+ position: options === null || options === void 0 ? void 0 : options.position,
1238
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1239
+ });
1240
+ }
990
1241
  startsWith(value, message) {
991
1242
  return this._addCheck({
992
1243
  kind: "startsWith",
@@ -1022,21 +1273,69 @@ var ZodString = class extends ZodType {
1022
1273
  ...errorUtil.errToObj(message)
1023
1274
  });
1024
1275
  }
1276
+ nonempty(message) {
1277
+ return this.min(1, errorUtil.errToObj(message));
1278
+ }
1279
+ trim() {
1280
+ return new ZodString({
1281
+ ...this._def,
1282
+ checks: [...this._def.checks, { kind: "trim" }]
1283
+ });
1284
+ }
1285
+ toLowerCase() {
1286
+ return new ZodString({
1287
+ ...this._def,
1288
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1289
+ });
1290
+ }
1291
+ toUpperCase() {
1292
+ return new ZodString({
1293
+ ...this._def,
1294
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1295
+ });
1296
+ }
1025
1297
  get isDatetime() {
1026
1298
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
1027
1299
  }
1300
+ get isDate() {
1301
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1302
+ }
1303
+ get isTime() {
1304
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1305
+ }
1306
+ get isDuration() {
1307
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1308
+ }
1028
1309
  get isEmail() {
1029
1310
  return !!this._def.checks.find((ch) => ch.kind === "email");
1030
1311
  }
1031
1312
  get isURL() {
1032
1313
  return !!this._def.checks.find((ch) => ch.kind === "url");
1033
1314
  }
1315
+ get isEmoji() {
1316
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1317
+ }
1034
1318
  get isUUID() {
1035
1319
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
1036
1320
  }
1321
+ get isNANOID() {
1322
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1323
+ }
1037
1324
  get isCUID() {
1038
1325
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
1039
1326
  }
1327
+ get isCUID2() {
1328
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1329
+ }
1330
+ get isULID() {
1331
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1332
+ }
1333
+ get isIP() {
1334
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1335
+ }
1336
+ get isBase64() {
1337
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1338
+ }
1040
1339
  get minLength() {
1041
1340
  let min = null;
1042
1341
  for (const ch of this._def.checks) {
@@ -1248,6 +1547,19 @@ var ZodNumber = class extends ZodType {
1248
1547
  message: errorUtil.toString(message)
1249
1548
  });
1250
1549
  }
1550
+ safe(message) {
1551
+ return this._addCheck({
1552
+ kind: "min",
1553
+ inclusive: true,
1554
+ value: Number.MIN_SAFE_INTEGER,
1555
+ message: errorUtil.toString(message)
1556
+ })._addCheck({
1557
+ kind: "max",
1558
+ inclusive: true,
1559
+ value: Number.MAX_SAFE_INTEGER,
1560
+ message: errorUtil.toString(message)
1561
+ });
1562
+ }
1251
1563
  get minValue() {
1252
1564
  let min = null;
1253
1565
  for (const ch of this._def.checks) {
@@ -1269,7 +1581,22 @@ var ZodNumber = class extends ZodType {
1269
1581
  return max;
1270
1582
  }
1271
1583
  get isInt() {
1272
- return !!this._def.checks.find((ch) => ch.kind === "int");
1584
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1585
+ }
1586
+ get isFinite() {
1587
+ let max = null, min = null;
1588
+ for (const ch of this._def.checks) {
1589
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1590
+ return true;
1591
+ } else if (ch.kind === "min") {
1592
+ if (min === null || ch.value > min)
1593
+ min = ch.value;
1594
+ } else if (ch.kind === "max") {
1595
+ if (max === null || ch.value < max)
1596
+ max = ch.value;
1597
+ }
1598
+ }
1599
+ return Number.isFinite(min) && Number.isFinite(max);
1273
1600
  }
1274
1601
  };
1275
1602
  __name(ZodNumber, "ZodNumber");
@@ -1282,27 +1609,167 @@ ZodNumber.create = (params) => {
1282
1609
  });
1283
1610
  };
1284
1611
  var ZodBigInt = class extends ZodType {
1612
+ constructor() {
1613
+ super(...arguments);
1614
+ this.min = this.gte;
1615
+ this.max = this.lte;
1616
+ }
1285
1617
  _parse(input) {
1286
1618
  if (this._def.coerce) {
1287
1619
  input.data = BigInt(input.data);
1288
1620
  }
1289
1621
  const parsedType = this._getType(input);
1290
1622
  if (parsedType !== ZodParsedType.bigint) {
1291
- const ctx = this._getOrReturnCtx(input);
1292
- addIssueToContext(ctx, {
1623
+ const ctx2 = this._getOrReturnCtx(input);
1624
+ addIssueToContext(ctx2, {
1293
1625
  code: ZodIssueCode.invalid_type,
1294
1626
  expected: ZodParsedType.bigint,
1295
- received: ctx.parsedType
1627
+ received: ctx2.parsedType
1296
1628
  });
1297
1629
  return INVALID;
1298
1630
  }
1299
- return OK(input.data);
1631
+ let ctx = void 0;
1632
+ const status = new ParseStatus();
1633
+ for (const check of this._def.checks) {
1634
+ if (check.kind === "min") {
1635
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1636
+ if (tooSmall) {
1637
+ ctx = this._getOrReturnCtx(input, ctx);
1638
+ addIssueToContext(ctx, {
1639
+ code: ZodIssueCode.too_small,
1640
+ type: "bigint",
1641
+ minimum: check.value,
1642
+ inclusive: check.inclusive,
1643
+ message: check.message
1644
+ });
1645
+ status.dirty();
1646
+ }
1647
+ } else if (check.kind === "max") {
1648
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1649
+ if (tooBig) {
1650
+ ctx = this._getOrReturnCtx(input, ctx);
1651
+ addIssueToContext(ctx, {
1652
+ code: ZodIssueCode.too_big,
1653
+ type: "bigint",
1654
+ maximum: check.value,
1655
+ inclusive: check.inclusive,
1656
+ message: check.message
1657
+ });
1658
+ status.dirty();
1659
+ }
1660
+ } else if (check.kind === "multipleOf") {
1661
+ if (input.data % check.value !== BigInt(0)) {
1662
+ ctx = this._getOrReturnCtx(input, ctx);
1663
+ addIssueToContext(ctx, {
1664
+ code: ZodIssueCode.not_multiple_of,
1665
+ multipleOf: check.value,
1666
+ message: check.message
1667
+ });
1668
+ status.dirty();
1669
+ }
1670
+ } else {
1671
+ util.assertNever(check);
1672
+ }
1673
+ }
1674
+ return { status: status.value, value: input.data };
1675
+ }
1676
+ gte(value, message) {
1677
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1678
+ }
1679
+ gt(value, message) {
1680
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1681
+ }
1682
+ lte(value, message) {
1683
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1684
+ }
1685
+ lt(value, message) {
1686
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1687
+ }
1688
+ setLimit(kind, value, inclusive, message) {
1689
+ return new ZodBigInt({
1690
+ ...this._def,
1691
+ checks: [
1692
+ ...this._def.checks,
1693
+ {
1694
+ kind,
1695
+ value,
1696
+ inclusive,
1697
+ message: errorUtil.toString(message)
1698
+ }
1699
+ ]
1700
+ });
1701
+ }
1702
+ _addCheck(check) {
1703
+ return new ZodBigInt({
1704
+ ...this._def,
1705
+ checks: [...this._def.checks, check]
1706
+ });
1707
+ }
1708
+ positive(message) {
1709
+ return this._addCheck({
1710
+ kind: "min",
1711
+ value: BigInt(0),
1712
+ inclusive: false,
1713
+ message: errorUtil.toString(message)
1714
+ });
1715
+ }
1716
+ negative(message) {
1717
+ return this._addCheck({
1718
+ kind: "max",
1719
+ value: BigInt(0),
1720
+ inclusive: false,
1721
+ message: errorUtil.toString(message)
1722
+ });
1723
+ }
1724
+ nonpositive(message) {
1725
+ return this._addCheck({
1726
+ kind: "max",
1727
+ value: BigInt(0),
1728
+ inclusive: true,
1729
+ message: errorUtil.toString(message)
1730
+ });
1731
+ }
1732
+ nonnegative(message) {
1733
+ return this._addCheck({
1734
+ kind: "min",
1735
+ value: BigInt(0),
1736
+ inclusive: true,
1737
+ message: errorUtil.toString(message)
1738
+ });
1739
+ }
1740
+ multipleOf(value, message) {
1741
+ return this._addCheck({
1742
+ kind: "multipleOf",
1743
+ value,
1744
+ message: errorUtil.toString(message)
1745
+ });
1746
+ }
1747
+ get minValue() {
1748
+ let min = null;
1749
+ for (const ch of this._def.checks) {
1750
+ if (ch.kind === "min") {
1751
+ if (min === null || ch.value > min)
1752
+ min = ch.value;
1753
+ }
1754
+ }
1755
+ return min;
1756
+ }
1757
+ get maxValue() {
1758
+ let max = null;
1759
+ for (const ch of this._def.checks) {
1760
+ if (ch.kind === "max") {
1761
+ if (max === null || ch.value < max)
1762
+ max = ch.value;
1763
+ }
1764
+ }
1765
+ return max;
1300
1766
  }
1301
1767
  };
1302
1768
  __name(ZodBigInt, "ZodBigInt");
1303
1769
  ZodBigInt.create = (params) => {
1304
1770
  var _a;
1305
1771
  return new ZodBigInt({
1772
+ checks: [],
1306
1773
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1307
1774
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1308
1775
  ...processCreateParams(params)
@@ -1637,13 +2104,13 @@ var ZodArray = class extends ZodType {
1637
2104
  }
1638
2105
  }
1639
2106
  if (ctx.common.async) {
1640
- return Promise.all(ctx.data.map((item, i2) => {
2107
+ return Promise.all([...ctx.data].map((item, i2) => {
1641
2108
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
1642
2109
  })).then((result2) => {
1643
2110
  return ParseStatus.mergeArray(status, result2);
1644
2111
  });
1645
2112
  }
1646
- const result = ctx.data.map((item, i2) => {
2113
+ const result = [...ctx.data].map((item, i2) => {
1647
2114
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
1648
2115
  });
1649
2116
  return ParseStatus.mergeArray(status, result);
@@ -1684,24 +2151,6 @@ ZodArray.create = (schema, params) => {
1684
2151
  ...processCreateParams(params)
1685
2152
  });
1686
2153
  };
1687
- var objectUtil;
1688
- (function(objectUtil2) {
1689
- objectUtil2.mergeShapes = (first, second) => {
1690
- return {
1691
- ...first,
1692
- ...second
1693
- };
1694
- };
1695
- })(objectUtil || (objectUtil = {}));
1696
- var AugmentFactory = /* @__PURE__ */ __name((def) => (augmentation) => {
1697
- return new ZodObject({
1698
- ...def,
1699
- shape: () => ({
1700
- ...def.shape(),
1701
- ...augmentation
1702
- })
1703
- });
1704
- }, "AugmentFactory");
1705
2154
  function deepPartialify(schema) {
1706
2155
  if (schema instanceof ZodObject) {
1707
2156
  const newShape = {};
@@ -1714,7 +2163,10 @@ function deepPartialify(schema) {
1714
2163
  shape: () => newShape
1715
2164
  });
1716
2165
  } else if (schema instanceof ZodArray) {
1717
- return ZodArray.create(deepPartialify(schema.element));
2166
+ return new ZodArray({
2167
+ ...schema._def,
2168
+ type: deepPartialify(schema.element)
2169
+ });
1718
2170
  } else if (schema instanceof ZodOptional) {
1719
2171
  return ZodOptional.create(deepPartialify(schema.unwrap()));
1720
2172
  } else if (schema instanceof ZodNullable) {
@@ -1731,8 +2183,7 @@ var ZodObject = class extends ZodType {
1731
2183
  super(...arguments);
1732
2184
  this._cached = null;
1733
2185
  this.nonstrict = this.passthrough;
1734
- this.augment = AugmentFactory(this._def);
1735
- this.extend = AugmentFactory(this._def);
2186
+ this.augment = this.extend;
1736
2187
  }
1737
2188
  _getCached() {
1738
2189
  if (this._cached !== null)
@@ -1812,9 +2263,10 @@ var ZodObject = class extends ZodType {
1812
2263
  const syncPairs = [];
1813
2264
  for (const pair of pairs) {
1814
2265
  const key = await pair.key;
2266
+ const value = await pair.value;
1815
2267
  syncPairs.push({
1816
2268
  key,
1817
- value: await pair.value,
2269
+ value,
1818
2270
  alwaysSet: pair.alwaysSet
1819
2271
  });
1820
2272
  }
@@ -1861,18 +2313,30 @@ var ZodObject = class extends ZodType {
1861
2313
  unknownKeys: "passthrough"
1862
2314
  });
1863
2315
  }
1864
- setKey(key, schema) {
1865
- return this.augment({ [key]: schema });
2316
+ extend(augmentation) {
2317
+ return new ZodObject({
2318
+ ...this._def,
2319
+ shape: () => ({
2320
+ ...this._def.shape(),
2321
+ ...augmentation
2322
+ })
2323
+ });
1866
2324
  }
1867
2325
  merge(merging) {
1868
2326
  const merged = new ZodObject({
1869
2327
  unknownKeys: merging._def.unknownKeys,
1870
2328
  catchall: merging._def.catchall,
1871
- shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2329
+ shape: () => ({
2330
+ ...this._def.shape(),
2331
+ ...merging._def.shape()
2332
+ }),
1872
2333
  typeName: ZodFirstPartyTypeKind.ZodObject
1873
2334
  });
1874
2335
  return merged;
1875
2336
  }
2337
+ setKey(key, schema) {
2338
+ return this.augment({ [key]: schema });
2339
+ }
1876
2340
  catchall(index) {
1877
2341
  return new ZodObject({
1878
2342
  ...this._def,
@@ -1881,9 +2345,10 @@ var ZodObject = class extends ZodType {
1881
2345
  }
1882
2346
  pick(mask) {
1883
2347
  const shape = {};
1884
- util.objectKeys(mask).map((key) => {
1885
- if (this.shape[key])
2348
+ util.objectKeys(mask).forEach((key) => {
2349
+ if (mask[key] && this.shape[key]) {
1886
2350
  shape[key] = this.shape[key];
2351
+ }
1887
2352
  });
1888
2353
  return new ZodObject({
1889
2354
  ...this._def,
@@ -1892,8 +2357,8 @@ var ZodObject = class extends ZodType {
1892
2357
  }
1893
2358
  omit(mask) {
1894
2359
  const shape = {};
1895
- util.objectKeys(this.shape).map((key) => {
1896
- if (util.objectKeys(mask).indexOf(key) === -1) {
2360
+ util.objectKeys(this.shape).forEach((key) => {
2361
+ if (!mask[key]) {
1897
2362
  shape[key] = this.shape[key];
1898
2363
  }
1899
2364
  });
@@ -1907,24 +2372,14 @@ var ZodObject = class extends ZodType {
1907
2372
  }
1908
2373
  partial(mask) {
1909
2374
  const newShape = {};
1910
- if (mask) {
1911
- util.objectKeys(this.shape).map((key) => {
1912
- if (util.objectKeys(mask).indexOf(key) === -1) {
1913
- newShape[key] = this.shape[key];
1914
- } else {
1915
- newShape[key] = this.shape[key].optional();
1916
- }
1917
- });
1918
- return new ZodObject({
1919
- ...this._def,
1920
- shape: () => newShape
1921
- });
1922
- } else {
1923
- for (const key in this.shape) {
1924
- const fieldSchema = this.shape[key];
2375
+ util.objectKeys(this.shape).forEach((key) => {
2376
+ const fieldSchema = this.shape[key];
2377
+ if (mask && !mask[key]) {
2378
+ newShape[key] = fieldSchema;
2379
+ } else {
1925
2380
  newShape[key] = fieldSchema.optional();
1926
2381
  }
1927
- }
2382
+ });
1928
2383
  return new ZodObject({
1929
2384
  ...this._def,
1930
2385
  shape: () => newShape
@@ -1932,21 +2387,10 @@ var ZodObject = class extends ZodType {
1932
2387
  }
1933
2388
  required(mask) {
1934
2389
  const newShape = {};
1935
- if (mask) {
1936
- util.objectKeys(this.shape).map((key) => {
1937
- if (util.objectKeys(mask).indexOf(key) === -1) {
1938
- newShape[key] = this.shape[key];
1939
- } else {
1940
- const fieldSchema = this.shape[key];
1941
- let newField = fieldSchema;
1942
- while (newField instanceof ZodOptional) {
1943
- newField = newField._def.innerType;
1944
- }
1945
- newShape[key] = newField;
1946
- }
1947
- });
1948
- } else {
1949
- for (const key in this.shape) {
2390
+ util.objectKeys(this.shape).forEach((key) => {
2391
+ if (mask && !mask[key]) {
2392
+ newShape[key] = this.shape[key];
2393
+ } else {
1950
2394
  const fieldSchema = this.shape[key];
1951
2395
  let newField = fieldSchema;
1952
2396
  while (newField instanceof ZodOptional) {
@@ -1954,7 +2398,7 @@ var ZodObject = class extends ZodType {
1954
2398
  }
1955
2399
  newShape[key] = newField;
1956
2400
  }
1957
- }
2401
+ });
1958
2402
  return new ZodObject({
1959
2403
  ...this._def,
1960
2404
  shape: () => newShape
@@ -2095,15 +2539,25 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
2095
2539
  } else if (type instanceof ZodEnum) {
2096
2540
  return type.options;
2097
2541
  } else if (type instanceof ZodNativeEnum) {
2098
- return Object.keys(type.enum);
2542
+ return util.objectValues(type.enum);
2099
2543
  } else if (type instanceof ZodDefault) {
2100
2544
  return getDiscriminator(type._def.innerType);
2101
2545
  } else if (type instanceof ZodUndefined) {
2102
2546
  return [void 0];
2103
2547
  } else if (type instanceof ZodNull) {
2104
2548
  return [null];
2549
+ } else if (type instanceof ZodOptional) {
2550
+ return [void 0, ...getDiscriminator(type.unwrap())];
2551
+ } else if (type instanceof ZodNullable) {
2552
+ return [null, ...getDiscriminator(type.unwrap())];
2553
+ } else if (type instanceof ZodBranded) {
2554
+ return getDiscriminator(type.unwrap());
2555
+ } else if (type instanceof ZodReadonly) {
2556
+ return getDiscriminator(type.unwrap());
2557
+ } else if (type instanceof ZodCatch) {
2558
+ return getDiscriminator(type._def.innerType);
2105
2559
  } else {
2106
- return null;
2560
+ return [];
2107
2561
  }
2108
2562
  }, "getDiscriminator");
2109
2563
  var ZodDiscriminatedUnion = class extends ZodType {
@@ -2155,7 +2609,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
2155
2609
  const optionsMap = /* @__PURE__ */ new Map();
2156
2610
  for (const type of options) {
2157
2611
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2158
- if (!discriminatorValues) {
2612
+ if (!discriminatorValues.length) {
2159
2613
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2160
2614
  }
2161
2615
  for (const value of discriminatorValues) {
@@ -2300,7 +2754,7 @@ var ZodTuple = class extends ZodType {
2300
2754
  });
2301
2755
  status.dirty();
2302
2756
  }
2303
- const items = ctx.data.map((item, itemIndex) => {
2757
+ const items = [...ctx.data].map((item, itemIndex) => {
2304
2758
  const schema = this._def.items[itemIndex] || this._def.rest;
2305
2759
  if (!schema)
2306
2760
  return null;
@@ -2359,7 +2813,8 @@ var ZodRecord = class extends ZodType {
2359
2813
  for (const key in ctx.data) {
2360
2814
  pairs.push({
2361
2815
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2362
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
2816
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2817
+ alwaysSet: key in ctx.data
2363
2818
  });
2364
2819
  }
2365
2820
  if (ctx.common.async) {
@@ -2390,6 +2845,12 @@ var ZodRecord = class extends ZodType {
2390
2845
  };
2391
2846
  __name(ZodRecord, "ZodRecord");
2392
2847
  var ZodMap = class extends ZodType {
2848
+ get keySchema() {
2849
+ return this._def.keyType;
2850
+ }
2851
+ get valueSchema() {
2852
+ return this._def.valueType;
2853
+ }
2393
2854
  _parse(input) {
2394
2855
  const { status, ctx } = this._processInputParams(input);
2395
2856
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -2589,27 +3050,29 @@ var ZodFunction = class extends ZodType {
2589
3050
  const params = { errorMap: ctx.common.contextualErrorMap };
2590
3051
  const fn = ctx.data;
2591
3052
  if (this._def.returns instanceof ZodPromise) {
2592
- return OK(async (...args) => {
3053
+ const me = this;
3054
+ return OK(async function(...args) {
2593
3055
  const error = new ZodError([]);
2594
- const parsedArgs = await this._def.args.parseAsync(args, params).catch((e2) => {
3056
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e2) => {
2595
3057
  error.addIssue(makeArgsIssue(args, e2));
2596
3058
  throw error;
2597
3059
  });
2598
- const result = await fn(...parsedArgs);
2599
- const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e2) => {
3060
+ const result = await Reflect.apply(fn, this, parsedArgs);
3061
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e2) => {
2600
3062
  error.addIssue(makeReturnsIssue(result, e2));
2601
3063
  throw error;
2602
3064
  });
2603
3065
  return parsedReturns;
2604
3066
  });
2605
3067
  } else {
2606
- return OK((...args) => {
2607
- const parsedArgs = this._def.args.safeParse(args, params);
3068
+ const me = this;
3069
+ return OK(function(...args) {
3070
+ const parsedArgs = me._def.args.safeParse(args, params);
2608
3071
  if (!parsedArgs.success) {
2609
3072
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2610
3073
  }
2611
- const result = fn(...parsedArgs.data);
2612
- const parsedReturns = this._def.returns.safeParse(result, params);
3074
+ const result = Reflect.apply(fn, this, parsedArgs.data);
3075
+ const parsedReturns = me._def.returns.safeParse(result, params);
2613
3076
  if (!parsedReturns.success) {
2614
3077
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2615
3078
  }
@@ -2676,6 +3139,7 @@ var ZodLiteral = class extends ZodType {
2676
3139
  if (input.data !== this._def.value) {
2677
3140
  const ctx = this._getOrReturnCtx(input);
2678
3141
  addIssueToContext(ctx, {
3142
+ received: ctx.data,
2679
3143
  code: ZodIssueCode.invalid_literal,
2680
3144
  expected: this._def.value
2681
3145
  });
@@ -2704,6 +3168,10 @@ function createZodEnum(values, params) {
2704
3168
  }
2705
3169
  __name(createZodEnum, "createZodEnum");
2706
3170
  var ZodEnum = class extends ZodType {
3171
+ constructor() {
3172
+ super(...arguments);
3173
+ _ZodEnum_cache.set(this, void 0);
3174
+ }
2707
3175
  _parse(input) {
2708
3176
  if (typeof input.data !== "string") {
2709
3177
  const ctx = this._getOrReturnCtx(input);
@@ -2715,7 +3183,10 @@ var ZodEnum = class extends ZodType {
2715
3183
  });
2716
3184
  return INVALID;
2717
3185
  }
2718
- if (this._def.values.indexOf(input.data) === -1) {
3186
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3187
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3188
+ }
3189
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
2719
3190
  const ctx = this._getOrReturnCtx(input);
2720
3191
  const expectedValues = this._def.values;
2721
3192
  addIssueToContext(ctx, {
@@ -2751,10 +3222,27 @@ var ZodEnum = class extends ZodType {
2751
3222
  }
2752
3223
  return enumValues;
2753
3224
  }
3225
+ extract(values, newDef = this._def) {
3226
+ return ZodEnum.create(values, {
3227
+ ...this._def,
3228
+ ...newDef
3229
+ });
3230
+ }
3231
+ exclude(values, newDef = this._def) {
3232
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3233
+ ...this._def,
3234
+ ...newDef
3235
+ });
3236
+ }
2754
3237
  };
2755
3238
  __name(ZodEnum, "ZodEnum");
3239
+ _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
2756
3240
  ZodEnum.create = createZodEnum;
2757
3241
  var ZodNativeEnum = class extends ZodType {
3242
+ constructor() {
3243
+ super(...arguments);
3244
+ _ZodNativeEnum_cache.set(this, void 0);
3245
+ }
2758
3246
  _parse(input) {
2759
3247
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
2760
3248
  const ctx = this._getOrReturnCtx(input);
@@ -2767,7 +3255,10 @@ var ZodNativeEnum = class extends ZodType {
2767
3255
  });
2768
3256
  return INVALID;
2769
3257
  }
2770
- if (nativeEnumValues.indexOf(input.data) === -1) {
3258
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3259
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3260
+ }
3261
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
2771
3262
  const expectedValues = util.objectValues(nativeEnumValues);
2772
3263
  addIssueToContext(ctx, {
2773
3264
  received: ctx.data,
@@ -2783,6 +3274,7 @@ var ZodNativeEnum = class extends ZodType {
2783
3274
  }
2784
3275
  };
2785
3276
  __name(ZodNativeEnum, "ZodNativeEnum");
3277
+ _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
2786
3278
  ZodNativeEnum.create = (values, params) => {
2787
3279
  return new ZodNativeEnum({
2788
3280
  values,
@@ -2791,6 +3283,9 @@ ZodNativeEnum.create = (values, params) => {
2791
3283
  });
2792
3284
  };
2793
3285
  var ZodPromise = class extends ZodType {
3286
+ unwrap() {
3287
+ return this._def.type;
3288
+ }
2794
3289
  _parse(input) {
2795
3290
  const { ctx } = this._processInputParams(input);
2796
3291
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -2828,24 +3323,6 @@ var ZodEffects = class extends ZodType {
2828
3323
  _parse(input) {
2829
3324
  const { status, ctx } = this._processInputParams(input);
2830
3325
  const effect = this._def.effect || null;
2831
- if (effect.type === "preprocess") {
2832
- const processed = effect.transform(ctx.data);
2833
- if (ctx.common.async) {
2834
- return Promise.resolve(processed).then((processed2) => {
2835
- return this._def.schema._parseAsync({
2836
- data: processed2,
2837
- path: ctx.path,
2838
- parent: ctx
2839
- });
2840
- });
2841
- } else {
2842
- return this._def.schema._parseSync({
2843
- data: processed,
2844
- path: ctx.path,
2845
- parent: ctx
2846
- });
2847
- }
2848
- }
2849
3326
  const checkCtx = {
2850
3327
  addIssue: (arg) => {
2851
3328
  addIssueToContext(ctx, arg);
@@ -2860,6 +3337,42 @@ var ZodEffects = class extends ZodType {
2860
3337
  }
2861
3338
  };
2862
3339
  checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3340
+ if (effect.type === "preprocess") {
3341
+ const processed = effect.transform(ctx.data, checkCtx);
3342
+ if (ctx.common.async) {
3343
+ return Promise.resolve(processed).then(async (processed2) => {
3344
+ if (status.value === "aborted")
3345
+ return INVALID;
3346
+ const result = await this._def.schema._parseAsync({
3347
+ data: processed2,
3348
+ path: ctx.path,
3349
+ parent: ctx
3350
+ });
3351
+ if (result.status === "aborted")
3352
+ return INVALID;
3353
+ if (result.status === "dirty")
3354
+ return DIRTY(result.value);
3355
+ if (status.value === "dirty")
3356
+ return DIRTY(result.value);
3357
+ return result;
3358
+ });
3359
+ } else {
3360
+ if (status.value === "aborted")
3361
+ return INVALID;
3362
+ const result = this._def.schema._parseSync({
3363
+ data: processed,
3364
+ path: ctx.path,
3365
+ parent: ctx
3366
+ });
3367
+ if (result.status === "aborted")
3368
+ return INVALID;
3369
+ if (result.status === "dirty")
3370
+ return DIRTY(result.value);
3371
+ if (status.value === "dirty")
3372
+ return DIRTY(result.value);
3373
+ return result;
3374
+ }
3375
+ }
2863
3376
  if (effect.type === "refinement") {
2864
3377
  const executeRefinement = /* @__PURE__ */ __name((acc) => {
2865
3378
  const result = effect.refinement(acc, checkCtx);
@@ -3006,26 +3519,45 @@ ZodDefault.create = (type, params) => {
3006
3519
  var ZodCatch = class extends ZodType {
3007
3520
  _parse(input) {
3008
3521
  const { ctx } = this._processInputParams(input);
3522
+ const newCtx = {
3523
+ ...ctx,
3524
+ common: {
3525
+ ...ctx.common,
3526
+ issues: []
3527
+ }
3528
+ };
3009
3529
  const result = this._def.innerType._parse({
3010
- data: ctx.data,
3011
- path: ctx.path,
3012
- parent: ctx
3530
+ data: newCtx.data,
3531
+ path: newCtx.path,
3532
+ parent: {
3533
+ ...newCtx
3534
+ }
3013
3535
  });
3014
3536
  if (isAsync(result)) {
3015
3537
  return result.then((result2) => {
3016
3538
  return {
3017
3539
  status: "valid",
3018
- value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3540
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
3541
+ get error() {
3542
+ return new ZodError(newCtx.common.issues);
3543
+ },
3544
+ input: newCtx.data
3545
+ })
3019
3546
  };
3020
3547
  });
3021
3548
  } else {
3022
3549
  return {
3023
3550
  status: "valid",
3024
- value: result.status === "valid" ? result.value : this._def.defaultValue()
3551
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3552
+ get error() {
3553
+ return new ZodError(newCtx.common.issues);
3554
+ },
3555
+ input: newCtx.data
3556
+ })
3025
3557
  };
3026
3558
  }
3027
3559
  }
3028
- removeDefault() {
3560
+ removeCatch() {
3029
3561
  return this._def.innerType;
3030
3562
  }
3031
3563
  };
@@ -3034,7 +3566,7 @@ ZodCatch.create = (type, params) => {
3034
3566
  return new ZodCatch({
3035
3567
  innerType: type,
3036
3568
  typeName: ZodFirstPartyTypeKind.ZodCatch,
3037
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3569
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3038
3570
  ...processCreateParams(params)
3039
3571
  });
3040
3572
  };
@@ -3132,17 +3664,43 @@ var ZodPipeline = class extends ZodType {
3132
3664
  }
3133
3665
  };
3134
3666
  __name(ZodPipeline, "ZodPipeline");
3135
- var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
3667
+ var ZodReadonly = class extends ZodType {
3668
+ _parse(input) {
3669
+ const result = this._def.innerType._parse(input);
3670
+ const freeze = /* @__PURE__ */ __name((data) => {
3671
+ if (isValid(data)) {
3672
+ data.value = Object.freeze(data.value);
3673
+ }
3674
+ return data;
3675
+ }, "freeze");
3676
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3677
+ }
3678
+ unwrap() {
3679
+ return this._def.innerType;
3680
+ }
3681
+ };
3682
+ __name(ZodReadonly, "ZodReadonly");
3683
+ ZodReadonly.create = (type, params) => {
3684
+ return new ZodReadonly({
3685
+ innerType: type,
3686
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3687
+ ...processCreateParams(params)
3688
+ });
3689
+ };
3690
+ function custom(check, params = {}, fatal) {
3136
3691
  if (check)
3137
3692
  return ZodAny.create().superRefine((data, ctx) => {
3693
+ var _a, _b;
3138
3694
  if (!check(data)) {
3139
- const p = typeof params === "function" ? params(data) : params;
3695
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3696
+ const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3140
3697
  const p2 = typeof p === "string" ? { message: p } : p;
3141
- ctx.addIssue({ code: "custom", ...p2, fatal });
3698
+ ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3142
3699
  }
3143
3700
  });
3144
3701
  return ZodAny.create();
3145
- }, "custom");
3702
+ }
3703
+ __name(custom, "custom");
3146
3704
  var late = {
3147
3705
  object: ZodObject.lazycreate
3148
3706
  };
@@ -3183,10 +3741,11 @@ var ZodFirstPartyTypeKind;
3183
3741
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3184
3742
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3185
3743
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3744
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
3186
3745
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3187
3746
  var instanceOfType = /* @__PURE__ */ __name((cls, params = {
3188
3747
  message: `Input not instance of ${cls.name}`
3189
- }) => custom((data) => data instanceof cls, params, true), "instanceOfType");
3748
+ }) => custom((data) => data instanceof cls, params), "instanceOfType");
3190
3749
  var stringType = ZodString.create;
3191
3750
  var numberType = ZodNumber.create;
3192
3751
  var nanType = ZodNaN.create;
@@ -3227,12 +3786,15 @@ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean"
3227
3786
  var coerce = {
3228
3787
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
3229
3788
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3230
- boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
3789
+ boolean: (arg) => ZodBoolean.create({
3790
+ ...arg,
3791
+ coerce: true
3792
+ }),
3231
3793
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3232
3794
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3233
3795
  };
3234
3796
  var NEVER = INVALID;
3235
- var mod = /* @__PURE__ */ Object.freeze({
3797
+ var z = /* @__PURE__ */ Object.freeze({
3236
3798
  __proto__: null,
3237
3799
  defaultErrorMap: errorMap,
3238
3800
  setErrorMap,
@@ -3251,9 +3813,13 @@ var mod = /* @__PURE__ */ Object.freeze({
3251
3813
  get util() {
3252
3814
  return util;
3253
3815
  },
3816
+ get objectUtil() {
3817
+ return objectUtil;
3818
+ },
3254
3819
  ZodParsedType,
3255
3820
  getParsedType,
3256
3821
  ZodType,
3822
+ datetimeRegex,
3257
3823
  ZodString,
3258
3824
  ZodNumber,
3259
3825
  ZodBigInt,
@@ -3267,9 +3833,6 @@ var mod = /* @__PURE__ */ Object.freeze({
3267
3833
  ZodNever,
3268
3834
  ZodVoid,
3269
3835
  ZodArray,
3270
- get objectUtil() {
3271
- return objectUtil;
3272
- },
3273
3836
  ZodObject,
3274
3837
  ZodUnion,
3275
3838
  ZodDiscriminatedUnion,
@@ -3294,6 +3857,7 @@ var mod = /* @__PURE__ */ Object.freeze({
3294
3857
  BRAND,
3295
3858
  ZodBranded,
3296
3859
  ZodPipeline,
3860
+ ZodReadonly,
3297
3861
  custom,
3298
3862
  Schema: ZodType,
3299
3863
  ZodSchema: ZodType,
@@ -3347,38 +3911,140 @@ var mod = /* @__PURE__ */ Object.freeze({
3347
3911
  ZodError
3348
3912
  });
3349
3913
 
3914
+ // ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZodSymbols.chunk.mjs
3915
+ var currentSymbol = Symbol("current");
3916
+ var previousSymbol = Symbol("previous");
3917
+
3918
+ // ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extendZod.chunk.mjs
3919
+ var mergeOpenApi = /* @__PURE__ */ __name((openapi, {
3920
+ ref: _ref,
3921
+ refType: _refType,
3922
+ param: _param,
3923
+ header: _header,
3924
+ ...rest
3925
+ } = {}) => ({
3926
+ ...rest,
3927
+ ...openapi
3928
+ }), "mergeOpenApi");
3929
+ function extendZodWithOpenApi(zod) {
3930
+ if (typeof zod.ZodType.prototype.openapi !== "undefined") {
3931
+ return;
3932
+ }
3933
+ zod.ZodType.prototype.openapi = function(openapi) {
3934
+ const { zodOpenApi, ...rest } = this._def;
3935
+ const result = new this.constructor({
3936
+ ...rest,
3937
+ zodOpenApi: {
3938
+ openapi: mergeOpenApi(
3939
+ openapi,
3940
+ zodOpenApi == null ? void 0 : zodOpenApi.openapi
3941
+ )
3942
+ }
3943
+ });
3944
+ result._def.zodOpenApi[currentSymbol] = result;
3945
+ if (zodOpenApi) {
3946
+ result._def.zodOpenApi[previousSymbol] = this;
3947
+ }
3948
+ return result;
3949
+ };
3950
+ const zodDescribe = zod.ZodType.prototype.describe;
3951
+ zod.ZodType.prototype.describe = function(...args) {
3952
+ const result = zodDescribe.apply(this, args);
3953
+ const def = result._def;
3954
+ if (def.zodOpenApi) {
3955
+ const cloned = { ...def.zodOpenApi };
3956
+ cloned.openapi = mergeOpenApi({ description: args[0] }, cloned.openapi);
3957
+ cloned[previousSymbol] = this;
3958
+ cloned[currentSymbol] = result;
3959
+ def.zodOpenApi = cloned;
3960
+ } else {
3961
+ def.zodOpenApi = {
3962
+ openapi: { description: args[0] },
3963
+ [currentSymbol]: result
3964
+ };
3965
+ }
3966
+ return result;
3967
+ };
3968
+ const zodObjectExtend = zod.ZodObject.prototype.extend;
3969
+ zod.ZodObject.prototype.extend = function(...args) {
3970
+ const extendResult = zodObjectExtend.apply(this, args);
3971
+ const zodOpenApi = extendResult._def.zodOpenApi;
3972
+ if (zodOpenApi) {
3973
+ const cloned = { ...zodOpenApi };
3974
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
3975
+ cloned[previousSymbol] = this;
3976
+ extendResult._def.zodOpenApi = cloned;
3977
+ } else {
3978
+ extendResult._def.zodOpenApi = {
3979
+ [previousSymbol]: this
3980
+ };
3981
+ }
3982
+ return extendResult;
3983
+ };
3984
+ const zodObjectOmit = zod.ZodObject.prototype.omit;
3985
+ zod.ZodObject.prototype.omit = function(...args) {
3986
+ const omitResult = zodObjectOmit.apply(this, args);
3987
+ const zodOpenApi = omitResult._def.zodOpenApi;
3988
+ if (zodOpenApi) {
3989
+ const cloned = { ...zodOpenApi };
3990
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
3991
+ delete cloned[previousSymbol];
3992
+ delete cloned[currentSymbol];
3993
+ omitResult._def.zodOpenApi = cloned;
3994
+ }
3995
+ return omitResult;
3996
+ };
3997
+ const zodObjectPick = zod.ZodObject.prototype.pick;
3998
+ zod.ZodObject.prototype.pick = function(...args) {
3999
+ const pickResult = zodObjectPick.apply(this, args);
4000
+ const zodOpenApi = pickResult._def.zodOpenApi;
4001
+ if (zodOpenApi) {
4002
+ const cloned = { ...zodOpenApi };
4003
+ cloned.openapi = mergeOpenApi({}, cloned.openapi);
4004
+ delete cloned[previousSymbol];
4005
+ delete cloned[currentSymbol];
4006
+ pickResult._def.zodOpenApi = cloned;
4007
+ }
4008
+ return pickResult;
4009
+ };
4010
+ }
4011
+ __name(extendZodWithOpenApi, "extendZodWithOpenApi");
4012
+
4013
+ // ../../../node_modules/.pnpm/zod-openapi@4.2.4_zod@3.23.8/node_modules/zod-openapi/dist/extend.mjs
4014
+ extendZodWithOpenApi(z);
4015
+
3350
4016
  // ../../learn-card-types/dist/types.esm.js
3351
4017
  var __defProp2 = Object.defineProperty;
3352
4018
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
3353
- var ContextValidator = mod.array(mod.string().or(mod.record(mod.any())));
3354
- var AchievementCriteriaValidator = mod.object({
3355
- type: mod.string().optional(),
3356
- narrative: mod.string().optional()
4019
+ var ContextValidator = z.array(z.string().or(z.record(z.any())));
4020
+ var AchievementCriteriaValidator = z.object({
4021
+ type: z.string().optional(),
4022
+ narrative: z.string().optional()
3357
4023
  });
3358
- var ImageValidator = mod.string().or(
3359
- mod.object({
3360
- id: mod.string(),
3361
- type: mod.string(),
3362
- caption: mod.string().optional()
4024
+ var ImageValidator = z.string().or(
4025
+ z.object({
4026
+ id: z.string(),
4027
+ type: z.string(),
4028
+ caption: z.string().optional()
3363
4029
  })
3364
4030
  );
3365
- var GeoCoordinatesValidator = mod.object({
3366
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3367
- latitude: mod.number(),
3368
- longitude: mod.number()
4031
+ var GeoCoordinatesValidator = z.object({
4032
+ type: z.string().min(1).or(z.string().array().nonempty()),
4033
+ latitude: z.number(),
4034
+ longitude: z.number()
3369
4035
  });
3370
- var AddressValidator = mod.object({
3371
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3372
- addressCountry: mod.string().optional(),
3373
- addressCountryCode: mod.string().optional(),
3374
- addressRegion: mod.string().optional(),
3375
- addressLocality: mod.string().optional(),
3376
- streetAddress: mod.string().optional(),
3377
- postOfficeBoxNumber: mod.string().optional(),
3378
- postalCode: mod.string().optional(),
4036
+ var AddressValidator = z.object({
4037
+ type: z.string().min(1).or(z.string().array().nonempty()),
4038
+ addressCountry: z.string().optional(),
4039
+ addressCountryCode: z.string().optional(),
4040
+ addressRegion: z.string().optional(),
4041
+ addressLocality: z.string().optional(),
4042
+ streetAddress: z.string().optional(),
4043
+ postOfficeBoxNumber: z.string().optional(),
4044
+ postalCode: z.string().optional(),
3379
4045
  geo: GeoCoordinatesValidator.optional()
3380
4046
  });
3381
- var IdentifierTypeValidator = mod.enum([
4047
+ var IdentifierTypeValidator = z.enum([
3382
4048
  "sourcedId",
3383
4049
  "systemId",
3384
4050
  "productId",
@@ -3397,140 +4063,140 @@ var IdentifierTypeValidator = mod.enum([
3397
4063
  "ltiPlatformId",
3398
4064
  "ltiUserId",
3399
4065
  "identifier"
3400
- ]).or(mod.string());
3401
- var IdentifierEntryValidator = mod.object({
3402
- type: mod.string().min(1).or(mod.string().array().nonempty()),
3403
- identifier: mod.string(),
4066
+ ]).or(z.string());
4067
+ var IdentifierEntryValidator = z.object({
4068
+ type: z.string().min(1).or(z.string().array().nonempty()),
4069
+ identifier: z.string(),
3404
4070
  identifierType: IdentifierTypeValidator
3405
4071
  });
3406
- var ProfileValidator = mod.string().or(
3407
- mod.object({
3408
- id: mod.string().optional(),
3409
- type: mod.string().or(mod.string().array().nonempty().optional()),
3410
- name: mod.string().optional(),
3411
- url: mod.string().optional(),
3412
- phone: mod.string().optional(),
3413
- description: mod.string().optional(),
3414
- endorsement: mod.any().array().optional(),
4072
+ var ProfileValidator = z.string().or(
4073
+ z.object({
4074
+ id: z.string().optional(),
4075
+ type: z.string().or(z.string().array().nonempty().optional()),
4076
+ name: z.string().optional(),
4077
+ url: z.string().optional(),
4078
+ phone: z.string().optional(),
4079
+ description: z.string().optional(),
4080
+ endorsement: z.any().array().optional(),
3415
4081
  image: ImageValidator.optional(),
3416
- email: mod.string().email().optional(),
4082
+ email: z.string().email().optional(),
3417
4083
  address: AddressValidator.optional(),
3418
4084
  otherIdentifier: IdentifierEntryValidator.array().optional(),
3419
- official: mod.string().optional(),
3420
- parentOrg: mod.any().optional(),
3421
- familyName: mod.string().optional(),
3422
- givenName: mod.string().optional(),
3423
- additionalName: mod.string().optional(),
3424
- patronymicName: mod.string().optional(),
3425
- honorificPrefix: mod.string().optional(),
3426
- honorificSuffix: mod.string().optional(),
3427
- familyNamePrefix: mod.string().optional(),
3428
- dateOfBirth: mod.string().optional()
3429
- }).catchall(mod.any())
4085
+ official: z.string().optional(),
4086
+ parentOrg: z.any().optional(),
4087
+ familyName: z.string().optional(),
4088
+ givenName: z.string().optional(),
4089
+ additionalName: z.string().optional(),
4090
+ patronymicName: z.string().optional(),
4091
+ honorificPrefix: z.string().optional(),
4092
+ honorificSuffix: z.string().optional(),
4093
+ familyNamePrefix: z.string().optional(),
4094
+ dateOfBirth: z.string().optional()
4095
+ }).catchall(z.any())
3430
4096
  );
3431
- var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
3432
- var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
3433
- var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
3434
- var RefreshServiceValidator = mod.object({ id: mod.string().optional(), type: mod.string() }).catchall(mod.any());
3435
- var TermsOfUseValidator = mod.object({ type: mod.string(), id: mod.string().optional() }).catchall(mod.any());
3436
- var VC2EvidenceValidator = mod.object({ type: mod.string().or(mod.string().array().nonempty()), id: mod.string().optional() }).catchall(mod.any());
3437
- var UnsignedVCValidator = mod.object({
4097
+ var CredentialSubjectValidator = z.object({ id: z.string().optional() }).catchall(z.any());
4098
+ var CredentialStatusValidator = z.object({ type: z.string(), id: z.string() }).catchall(z.any());
4099
+ var CredentialSchemaValidator = z.object({ id: z.string(), type: z.string() }).catchall(z.any());
4100
+ var RefreshServiceValidator = z.object({ id: z.string().optional(), type: z.string() }).catchall(z.any());
4101
+ var TermsOfUseValidator = z.object({ type: z.string(), id: z.string().optional() }).catchall(z.any());
4102
+ var VC2EvidenceValidator = z.object({ type: z.string().or(z.string().array().nonempty()), id: z.string().optional() }).catchall(z.any());
4103
+ var UnsignedVCValidator = z.object({
3438
4104
  "@context": ContextValidator,
3439
- id: mod.string().optional(),
3440
- type: mod.string().array().nonempty(),
4105
+ id: z.string().optional(),
4106
+ type: z.string().array().nonempty(),
3441
4107
  issuer: ProfileValidator,
3442
4108
  credentialSubject: CredentialSubjectValidator.or(CredentialSubjectValidator.array()),
3443
4109
  refreshService: RefreshServiceValidator.or(RefreshServiceValidator.array()).optional(),
3444
4110
  credentialSchema: CredentialSchemaValidator.or(
3445
4111
  CredentialSchemaValidator.array()
3446
4112
  ).optional(),
3447
- issuanceDate: mod.string().optional(),
3448
- expirationDate: mod.string().optional(),
4113
+ issuanceDate: z.string().optional(),
4114
+ expirationDate: z.string().optional(),
3449
4115
  credentialStatus: CredentialStatusValidator.or(
3450
4116
  CredentialStatusValidator.array()
3451
4117
  ).optional(),
3452
- name: mod.string().optional(),
3453
- description: mod.string().optional(),
3454
- validFrom: mod.string().optional(),
3455
- validUntil: mod.string().optional(),
4118
+ name: z.string().optional(),
4119
+ description: z.string().optional(),
4120
+ validFrom: z.string().optional(),
4121
+ validUntil: z.string().optional(),
3456
4122
  status: CredentialStatusValidator.or(CredentialStatusValidator.array()).optional(),
3457
4123
  termsOfUse: TermsOfUseValidator.or(TermsOfUseValidator.array()).optional(),
3458
4124
  evidence: VC2EvidenceValidator.or(VC2EvidenceValidator.array()).optional()
3459
- }).catchall(mod.any());
3460
- var ProofValidator = mod.object({
3461
- type: mod.string(),
3462
- created: mod.string(),
3463
- challenge: mod.string().optional(),
3464
- domain: mod.string().optional(),
3465
- nonce: mod.string().optional(),
3466
- proofPurpose: mod.string(),
3467
- verificationMethod: mod.string(),
3468
- jws: mod.string().optional()
3469
- }).catchall(mod.any());
4125
+ }).catchall(z.any());
4126
+ var ProofValidator = z.object({
4127
+ type: z.string(),
4128
+ created: z.string(),
4129
+ challenge: z.string().optional(),
4130
+ domain: z.string().optional(),
4131
+ nonce: z.string().optional(),
4132
+ proofPurpose: z.string(),
4133
+ verificationMethod: z.string(),
4134
+ jws: z.string().optional()
4135
+ }).catchall(z.any());
3470
4136
  var VCValidator = UnsignedVCValidator.extend({
3471
4137
  proof: ProofValidator.or(ProofValidator.array())
3472
4138
  });
3473
- var UnsignedVPValidator = mod.object({
4139
+ var UnsignedVPValidator = z.object({
3474
4140
  "@context": ContextValidator,
3475
- id: mod.string().optional(),
3476
- type: mod.string().or(mod.string().array().nonempty()),
4141
+ id: z.string().optional(),
4142
+ type: z.string().or(z.string().array().nonempty()),
3477
4143
  verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
3478
- holder: mod.string().optional()
3479
- }).catchall(mod.any());
4144
+ holder: z.string().optional()
4145
+ }).catchall(z.any());
3480
4146
  var VPValidator = UnsignedVPValidator.extend({
3481
4147
  proof: ProofValidator.or(ProofValidator.array())
3482
4148
  });
3483
- var JWKValidator = mod.object({
3484
- kty: mod.string(),
3485
- crv: mod.string(),
3486
- x: mod.string(),
3487
- y: mod.string().optional(),
3488
- n: mod.string().optional(),
3489
- d: mod.string().optional()
4149
+ var JWKValidator = z.object({
4150
+ kty: z.string(),
4151
+ crv: z.string(),
4152
+ x: z.string(),
4153
+ y: z.string().optional(),
4154
+ n: z.string().optional(),
4155
+ d: z.string().optional()
3490
4156
  });
3491
- var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: mod.string() });
3492
- var JWERecipientHeaderValidator = mod.object({
3493
- alg: mod.string(),
3494
- iv: mod.string(),
3495
- tag: mod.string(),
4157
+ var JWKWithPrivateKeyValidator = JWKValidator.omit({ d: true }).extend({ d: z.string() });
4158
+ var JWERecipientHeaderValidator = z.object({
4159
+ alg: z.string(),
4160
+ iv: z.string(),
4161
+ tag: z.string(),
3496
4162
  epk: JWKValidator.partial().optional(),
3497
- kid: mod.string().optional(),
3498
- apv: mod.string().optional(),
3499
- apu: mod.string().optional()
4163
+ kid: z.string().optional(),
4164
+ apv: z.string().optional(),
4165
+ apu: z.string().optional()
3500
4166
  });
3501
- var JWERecipientValidator = mod.object({
4167
+ var JWERecipientValidator = z.object({
3502
4168
  header: JWERecipientHeaderValidator,
3503
- encrypted_key: mod.string()
4169
+ encrypted_key: z.string()
3504
4170
  });
3505
- var JWEValidator = mod.object({
3506
- protected: mod.string(),
3507
- iv: mod.string(),
3508
- ciphertext: mod.string(),
3509
- tag: mod.string(),
3510
- aad: mod.string().optional(),
4171
+ var JWEValidator = z.object({
4172
+ protected: z.string(),
4173
+ iv: z.string(),
4174
+ ciphertext: z.string(),
4175
+ tag: z.string(),
4176
+ aad: z.string().optional(),
3511
4177
  recipients: JWERecipientValidator.array().optional()
3512
4178
  });
3513
- var VerificationMethodValidator = mod.string().or(
3514
- mod.object({
4179
+ var VerificationMethodValidator = z.string().or(
4180
+ z.object({
3515
4181
  "@context": ContextValidator.optional(),
3516
- id: mod.string(),
3517
- type: mod.string(),
3518
- controller: mod.string(),
4182
+ id: z.string(),
4183
+ type: z.string(),
4184
+ controller: z.string(),
3519
4185
  publicKeyJwk: JWKValidator.optional(),
3520
- publicKeyBase58: mod.string().optional(),
3521
- blockChainAccountId: mod.string().optional()
3522
- }).catchall(mod.any())
4186
+ publicKeyBase58: z.string().optional(),
4187
+ blockChainAccountId: z.string().optional()
4188
+ }).catchall(z.any())
3523
4189
  );
3524
- var ServiceValidator = mod.object({
3525
- id: mod.string(),
3526
- type: mod.string().or(mod.string().array().nonempty()),
3527
- serviceEndpoint: mod.any().or(mod.any().array().nonempty())
3528
- }).catchall(mod.any());
3529
- var DidDocumentValidator = mod.object({
4190
+ var ServiceValidator = z.object({
4191
+ id: z.string(),
4192
+ type: z.string().or(z.string().array().nonempty()),
4193
+ serviceEndpoint: z.any().or(z.any().array().nonempty())
4194
+ }).catchall(z.any());
4195
+ var DidDocumentValidator = z.object({
3530
4196
  "@context": ContextValidator,
3531
- id: mod.string(),
3532
- alsoKnownAs: mod.string().optional(),
3533
- controller: mod.string().or(mod.string().array().nonempty()).optional(),
4197
+ id: z.string(),
4198
+ alsoKnownAs: z.string().optional(),
4199
+ controller: z.string().or(z.string().array().nonempty()).optional(),
3534
4200
  verificationMethod: VerificationMethodValidator.array().optional(),
3535
4201
  authentication: VerificationMethodValidator.array().optional(),
3536
4202
  assertionMethod: VerificationMethodValidator.array().optional(),
@@ -3540,8 +4206,8 @@ var DidDocumentValidator = mod.object({
3540
4206
  publicKey: VerificationMethodValidator.array().optional(),
3541
4207
  service: ServiceValidator.array().optional(),
3542
4208
  proof: ProofValidator.or(ProofValidator.array()).optional()
3543
- }).catchall(mod.any());
3544
- var AlignmentTargetTypeValidator = mod.enum([
4209
+ }).catchall(z.any());
4210
+ var AlignmentTargetTypeValidator = z.enum([
3545
4211
  "ceasn:Competency",
3546
4212
  "ceterms:Credential",
3547
4213
  "CFItem",
@@ -3549,17 +4215,17 @@ var AlignmentTargetTypeValidator = mod.enum([
3549
4215
  "CFRubricCriterion",
3550
4216
  "CFRubricCriterionLevel",
3551
4217
  "CTDL"
3552
- ]).or(mod.string());
3553
- var AlignmentValidator = mod.object({
3554
- type: mod.string().array().nonempty(),
3555
- targetCode: mod.string().optional(),
3556
- targetDescription: mod.string().optional(),
3557
- targetName: mod.string(),
3558
- targetFramework: mod.string().optional(),
4218
+ ]).or(z.string());
4219
+ var AlignmentValidator = z.object({
4220
+ type: z.string().array().nonempty(),
4221
+ targetCode: z.string().optional(),
4222
+ targetDescription: z.string().optional(),
4223
+ targetName: z.string(),
4224
+ targetFramework: z.string().optional(),
3559
4225
  targetType: AlignmentTargetTypeValidator.optional(),
3560
- targetUrl: mod.string()
4226
+ targetUrl: z.string()
3561
4227
  });
3562
- var KnownAchievementTypeValidator = mod.enum([
4228
+ var KnownAchievementTypeValidator = z.enum([
3563
4229
  "Achievement",
3564
4230
  "ApprenticeshipCertificate",
3565
4231
  "Assessment",
@@ -3592,23 +4258,23 @@ var KnownAchievementTypeValidator = mod.enum([
3592
4258
  "ResearchDoctorate",
3593
4259
  "SecondarySchoolDiploma"
3594
4260
  ]);
3595
- var AchievementTypeValidator = KnownAchievementTypeValidator.or(mod.string());
3596
- var CriteriaValidator = mod.object({ id: mod.string().optional(), narrative: mod.string().optional() }).catchall(mod.any());
3597
- var EndorsementSubjectValidator = mod.object({
3598
- id: mod.string(),
3599
- type: mod.string().array().nonempty(),
3600
- endorsementComment: mod.string().optional()
4261
+ var AchievementTypeValidator = KnownAchievementTypeValidator.or(z.string());
4262
+ var CriteriaValidator = z.object({ id: z.string().optional(), narrative: z.string().optional() }).catchall(z.any());
4263
+ var EndorsementSubjectValidator = z.object({
4264
+ id: z.string(),
4265
+ type: z.string().array().nonempty(),
4266
+ endorsementComment: z.string().optional()
3601
4267
  });
3602
4268
  var EndorsementCredentialValidator = UnsignedVCValidator.extend({
3603
4269
  credentialSubject: EndorsementSubjectValidator,
3604
4270
  proof: ProofValidator.or(ProofValidator.array()).optional()
3605
4271
  });
3606
- var RelatedValidator = mod.object({
3607
- id: mod.string(),
3608
- "@language": mod.string().optional(),
3609
- version: mod.string().optional()
4272
+ var RelatedValidator = z.object({
4273
+ id: z.string(),
4274
+ "@language": z.string().optional(),
4275
+ version: z.string().optional()
3610
4276
  });
3611
- var ResultTypeValidator = mod.enum([
4277
+ var ResultTypeValidator = z.enum([
3612
4278
  "GradePointAverage",
3613
4279
  "LetterGrade",
3614
4280
  "Percent",
@@ -3621,59 +4287,59 @@ var ResultTypeValidator = mod.enum([
3621
4287
  "RubricScore",
3622
4288
  "ScaledScore",
3623
4289
  "Status"
3624
- ]).or(mod.string());
3625
- var RubricCriterionValidator = mod.object({
3626
- id: mod.string(),
3627
- type: mod.string().array().nonempty(),
4290
+ ]).or(z.string());
4291
+ var RubricCriterionValidator = z.object({
4292
+ id: z.string(),
4293
+ type: z.string().array().nonempty(),
3628
4294
  alignment: AlignmentValidator.array().optional(),
3629
- description: mod.string().optional(),
3630
- level: mod.string().optional(),
3631
- name: mod.string(),
3632
- points: mod.string().optional()
3633
- }).catchall(mod.any());
3634
- var ResultDescriptionValidator = mod.object({
3635
- id: mod.string(),
3636
- type: mod.string().array().nonempty(),
4295
+ description: z.string().optional(),
4296
+ level: z.string().optional(),
4297
+ name: z.string(),
4298
+ points: z.string().optional()
4299
+ }).catchall(z.any());
4300
+ var ResultDescriptionValidator = z.object({
4301
+ id: z.string(),
4302
+ type: z.string().array().nonempty(),
3637
4303
  alignment: AlignmentValidator.array().optional(),
3638
- allowedValue: mod.string().array().optional(),
3639
- name: mod.string(),
3640
- requiredLevel: mod.string().optional(),
3641
- requiredValue: mod.string().optional(),
4304
+ allowedValue: z.string().array().optional(),
4305
+ name: z.string(),
4306
+ requiredLevel: z.string().optional(),
4307
+ requiredValue: z.string().optional(),
3642
4308
  resultType: ResultTypeValidator,
3643
4309
  rubricCriterionLevel: RubricCriterionValidator.array().optional(),
3644
- valueMax: mod.string().optional(),
3645
- valueMin: mod.string().optional()
3646
- }).catchall(mod.any());
3647
- var AchievementValidator = mod.object({
3648
- id: mod.string().optional(),
3649
- type: mod.string().array().nonempty(),
4310
+ valueMax: z.string().optional(),
4311
+ valueMin: z.string().optional()
4312
+ }).catchall(z.any());
4313
+ var AchievementValidator = z.object({
4314
+ id: z.string().optional(),
4315
+ type: z.string().array().nonempty(),
3650
4316
  alignment: AlignmentValidator.array().optional(),
3651
4317
  achievementType: AchievementTypeValidator.optional(),
3652
4318
  creator: ProfileValidator.optional(),
3653
- creditsAvailable: mod.number().optional(),
4319
+ creditsAvailable: z.number().optional(),
3654
4320
  criteria: CriteriaValidator,
3655
- description: mod.string(),
4321
+ description: z.string(),
3656
4322
  endorsement: EndorsementCredentialValidator.array().optional(),
3657
- fieldOfStudy: mod.string().optional(),
3658
- humanCode: mod.string().optional(),
4323
+ fieldOfStudy: z.string().optional(),
4324
+ humanCode: z.string().optional(),
3659
4325
  image: ImageValidator.optional(),
3660
- "@language": mod.string().optional(),
3661
- name: mod.string(),
4326
+ "@language": z.string().optional(),
4327
+ name: z.string(),
3662
4328
  otherIdentifier: IdentifierEntryValidator.array().optional(),
3663
4329
  related: RelatedValidator.array().optional(),
3664
4330
  resultDescription: ResultDescriptionValidator.array().optional(),
3665
- specialization: mod.string().optional(),
3666
- tag: mod.string().array().optional(),
3667
- version: mod.string().optional()
3668
- }).catchall(mod.any());
3669
- var IdentityObjectValidator = mod.object({
3670
- type: mod.string(),
3671
- hashed: mod.boolean(),
3672
- identityHash: mod.string(),
3673
- identityType: mod.string(),
3674
- salt: mod.string().optional()
4331
+ specialization: z.string().optional(),
4332
+ tag: z.string().array().optional(),
4333
+ version: z.string().optional()
4334
+ }).catchall(z.any());
4335
+ var IdentityObjectValidator = z.object({
4336
+ type: z.string(),
4337
+ hashed: z.boolean(),
4338
+ identityHash: z.string(),
4339
+ identityType: z.string(),
4340
+ salt: z.string().optional()
3675
4341
  });
3676
- var ResultStatusTypeValidator = mod.enum([
4342
+ var ResultStatusTypeValidator = z.enum([
3677
4343
  "Completed",
3678
4344
  "Enrolled",
3679
4345
  "Failed",
@@ -3681,42 +4347,42 @@ var ResultStatusTypeValidator = mod.enum([
3681
4347
  "OnHold",
3682
4348
  "Withdrew"
3683
4349
  ]);
3684
- var ResultValidator = mod.object({
3685
- type: mod.string().array().nonempty(),
3686
- achievedLevel: mod.string().optional(),
4350
+ var ResultValidator = z.object({
4351
+ type: z.string().array().nonempty(),
4352
+ achievedLevel: z.string().optional(),
3687
4353
  alignment: AlignmentValidator.array().optional(),
3688
- resultDescription: mod.string().optional(),
4354
+ resultDescription: z.string().optional(),
3689
4355
  status: ResultStatusTypeValidator.optional(),
3690
- value: mod.string().optional()
3691
- }).catchall(mod.any());
3692
- var AchievementSubjectValidator = mod.object({
3693
- id: mod.string().optional(),
3694
- type: mod.string().array().nonempty(),
3695
- activityEndDate: mod.string().optional(),
3696
- activityStartDate: mod.string().optional(),
3697
- creditsEarned: mod.number().optional(),
4356
+ value: z.string().optional()
4357
+ }).catchall(z.any());
4358
+ var AchievementSubjectValidator = z.object({
4359
+ id: z.string().optional(),
4360
+ type: z.string().array().nonempty(),
4361
+ activityEndDate: z.string().optional(),
4362
+ activityStartDate: z.string().optional(),
4363
+ creditsEarned: z.number().optional(),
3698
4364
  achievement: AchievementValidator.optional(),
3699
4365
  identifier: IdentityObjectValidator.array().optional(),
3700
4366
  image: ImageValidator.optional(),
3701
- licenseNumber: mod.string().optional(),
3702
- narrative: mod.string().optional(),
4367
+ licenseNumber: z.string().optional(),
4368
+ narrative: z.string().optional(),
3703
4369
  result: ResultValidator.array().optional(),
3704
- role: mod.string().optional(),
4370
+ role: z.string().optional(),
3705
4371
  source: ProfileValidator.optional(),
3706
- term: mod.string().optional()
3707
- }).catchall(mod.any());
3708
- var EvidenceValidator = mod.object({
3709
- id: mod.string().optional(),
3710
- type: mod.string().or(mod.string().array().nonempty()),
3711
- narrative: mod.string().optional(),
3712
- name: mod.string().optional(),
3713
- description: mod.string().optional(),
3714
- genre: mod.string().optional(),
3715
- audience: mod.string().optional()
3716
- }).catchall(mod.any());
4372
+ term: z.string().optional()
4373
+ }).catchall(z.any());
4374
+ var EvidenceValidator = z.object({
4375
+ id: z.string().optional(),
4376
+ type: z.string().or(z.string().array().nonempty()),
4377
+ narrative: z.string().optional(),
4378
+ name: z.string().optional(),
4379
+ description: z.string().optional(),
4380
+ genre: z.string().optional(),
4381
+ audience: z.string().optional()
4382
+ }).catchall(z.any());
3717
4383
  var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
3718
- name: mod.string().optional(),
3719
- description: mod.string().optional(),
4384
+ name: z.string().optional(),
4385
+ description: z.string().optional(),
3720
4386
  image: ImageValidator.optional(),
3721
4387
  credentialSubject: AchievementSubjectValidator.or(
3722
4388
  AchievementSubjectValidator.array()
@@ -3727,42 +4393,42 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
3727
4393
  var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
3728
4394
  proof: ProofValidator.or(ProofValidator.array())
3729
4395
  });
3730
- var VerificationCheckValidator = mod.object({
3731
- checks: mod.string().array(),
3732
- warnings: mod.string().array(),
3733
- errors: mod.string().array()
4396
+ var VerificationCheckValidator = z.object({
4397
+ checks: z.string().array(),
4398
+ warnings: z.string().array(),
4399
+ errors: z.string().array()
3734
4400
  });
3735
- var VerificationStatusValidator = mod.enum(["Success", "Failed", "Error"]);
4401
+ var VerificationStatusValidator = z.enum(["Success", "Failed", "Error"]);
3736
4402
  var VerificationStatusEnum = VerificationStatusValidator.enum;
3737
- var VerificationItemValidator = mod.object({
3738
- check: mod.string(),
4403
+ var VerificationItemValidator = z.object({
4404
+ check: z.string(),
3739
4405
  status: VerificationStatusValidator,
3740
- message: mod.string().optional(),
3741
- details: mod.string().optional()
4406
+ message: z.string().optional(),
4407
+ details: z.string().optional()
3742
4408
  });
3743
- var CredentialInfoValidator = mod.object({
3744
- title: mod.string().optional(),
3745
- createdAt: mod.string().optional(),
4409
+ var CredentialInfoValidator = z.object({
4410
+ title: z.string().optional(),
4411
+ createdAt: z.string().optional(),
3746
4412
  issuer: ProfileValidator.optional(),
3747
4413
  issuee: ProfileValidator.optional(),
3748
4414
  credentialSubject: CredentialSubjectValidator.optional()
3749
4415
  });
3750
- var CredentialRecordValidator = mod.object({ id: mod.string(), uri: mod.string() }).catchall(mod.any());
3751
- var PaginationOptionsValidator = mod.object({
3752
- limit: mod.number(),
3753
- cursor: mod.string().optional(),
3754
- sort: mod.string().optional()
4416
+ var CredentialRecordValidator = z.object({ id: z.string(), uri: z.string() }).catchall(z.any());
4417
+ var PaginationOptionsValidator = z.object({
4418
+ limit: z.number(),
4419
+ cursor: z.string().optional(),
4420
+ sort: z.string().optional()
3755
4421
  });
3756
- var PaginationResponseValidator = mod.object({
3757
- cursor: mod.string().optional(),
3758
- hasMore: mod.boolean()
4422
+ var PaginationResponseValidator = z.object({
4423
+ cursor: z.string().optional(),
4424
+ hasMore: z.boolean()
3759
4425
  });
3760
- var EncryptedRecordValidator = mod.object({ encryptedRecord: JWEValidator, fields: mod.string().array() }).catchall(mod.any());
4426
+ var EncryptedRecordValidator = z.object({ encryptedRecord: JWEValidator, fields: z.string().array() }).catchall(z.any());
3761
4427
  var PaginatedEncryptedRecordsValidator = PaginationResponseValidator.extend({
3762
4428
  records: EncryptedRecordValidator.array()
3763
4429
  });
3764
4430
  var EncryptedCredentialRecordValidator = EncryptedRecordValidator.extend({
3765
- id: mod.string()
4431
+ id: z.string()
3766
4432
  });
3767
4433
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
3768
4434
  records: EncryptedCredentialRecordValidator.array()
@@ -3773,8 +4439,8 @@ var parseRegexString = /* @__PURE__ */ __name2((regexStr) => {
3773
4439
  throw new Error("Invalid RegExp string format");
3774
4440
  return { pattern: match2[1], flags: match2[2] };
3775
4441
  }, "parseRegexString");
3776
- var RegExpValidator = mod.instanceof(RegExp).or(
3777
- mod.string().refine(
4442
+ var RegExpValidator = z.instanceof(RegExp).or(
4443
+ z.string().refine(
3778
4444
  (str) => {
3779
4445
  try {
3780
4446
  parseRegexString(str);
@@ -3795,71 +4461,71 @@ var RegExpValidator = mod.instanceof(RegExp).or(
3795
4461
  }
3796
4462
  })
3797
4463
  );
3798
- var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
3799
- var LCNProfileDisplayValidator = mod.object({
3800
- backgroundColor: mod.string().optional(),
3801
- backgroundImage: mod.string().optional(),
3802
- fadeBackgroundImage: mod.boolean().optional(),
3803
- repeatBackgroundImage: mod.boolean().optional(),
3804
- fontColor: mod.string().optional(),
3805
- accentColor: mod.string().optional(),
3806
- accentFontColor: mod.string().optional(),
3807
- idBackgroundImage: mod.string().optional(),
3808
- fadeIdBackgroundImage: mod.boolean().optional(),
3809
- idBackgroundColor: mod.string().optional(),
3810
- repeatIdBackgroundImage: mod.boolean().optional()
4464
+ var StringQuery = z.string().or(z.object({ $in: z.string().array() })).or(z.object({ $regex: RegExpValidator }));
4465
+ var LCNProfileDisplayValidator = z.object({
4466
+ backgroundColor: z.string().optional(),
4467
+ backgroundImage: z.string().optional(),
4468
+ fadeBackgroundImage: z.boolean().optional(),
4469
+ repeatBackgroundImage: z.boolean().optional(),
4470
+ fontColor: z.string().optional(),
4471
+ accentColor: z.string().optional(),
4472
+ accentFontColor: z.string().optional(),
4473
+ idBackgroundImage: z.string().optional(),
4474
+ fadeIdBackgroundImage: z.boolean().optional(),
4475
+ idBackgroundColor: z.string().optional(),
4476
+ repeatIdBackgroundImage: z.boolean().optional()
3811
4477
  });
3812
- var LCNProfileValidator = mod.object({
3813
- profileId: mod.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
3814
- displayName: mod.string().default("").describe("Human-readable display name for the profile."),
3815
- shortBio: mod.string().default("").describe("Short bio for the profile."),
3816
- bio: mod.string().default("").describe("Longer bio for the profile."),
3817
- did: mod.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
3818
- isPrivate: mod.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
3819
- email: mod.string().optional().describe("Contact email address for the profile."),
3820
- image: mod.string().optional().describe("Profile image URL for the profile."),
3821
- heroImage: mod.string().optional().describe("Hero image URL for the profile."),
3822
- websiteLink: mod.string().optional().describe("Website link for the profile."),
3823
- isServiceProfile: mod.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
3824
- type: mod.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
3825
- notificationsWebhook: mod.string().url().startsWith("http").optional().describe("URL to send notifications to."),
4478
+ var LCNProfileValidator = z.object({
4479
+ profileId: z.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),
4480
+ displayName: z.string().default("").describe("Human-readable display name for the profile."),
4481
+ shortBio: z.string().default("").describe("Short bio for the profile."),
4482
+ bio: z.string().default("").describe("Longer bio for the profile."),
4483
+ did: z.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),
4484
+ isPrivate: z.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),
4485
+ email: z.string().optional().describe("Contact email address for the profile."),
4486
+ image: z.string().optional().describe("Profile image URL for the profile."),
4487
+ heroImage: z.string().optional().describe("Hero image URL for the profile."),
4488
+ websiteLink: z.string().optional().describe("Website link for the profile."),
4489
+ isServiceProfile: z.boolean().default(false).optional().describe("Whether the profile is a service profile or not."),
4490
+ type: z.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),
4491
+ notificationsWebhook: z.string().url().startsWith("http").optional().describe("URL to send notifications to."),
3826
4492
  display: LCNProfileDisplayValidator.optional().describe("Display settings for the profile."),
3827
- role: mod.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
3828
- dob: mod.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
4493
+ role: z.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),
4494
+ dob: z.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')
3829
4495
  });
3830
- var LCNProfileQueryValidator = mod.object({
4496
+ var LCNProfileQueryValidator = z.object({
3831
4497
  profileId: StringQuery,
3832
4498
  displayName: StringQuery,
3833
4499
  shortBio: StringQuery,
3834
4500
  bio: StringQuery,
3835
4501
  email: StringQuery,
3836
4502
  websiteLink: StringQuery,
3837
- isServiceProfile: mod.boolean(),
4503
+ isServiceProfile: z.boolean(),
3838
4504
  type: StringQuery
3839
4505
  }).partial();
3840
4506
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
3841
4507
  records: LCNProfileValidator.array()
3842
4508
  });
3843
- var LCNProfileConnectionStatusEnum = mod.enum([
4509
+ var LCNProfileConnectionStatusEnum = z.enum([
3844
4510
  "CONNECTED",
3845
4511
  "PENDING_REQUEST_SENT",
3846
4512
  "PENDING_REQUEST_RECEIVED",
3847
4513
  "NOT_CONNECTED"
3848
4514
  ]);
3849
- var LCNProfileManagerValidator = mod.object({
3850
- id: mod.string(),
3851
- created: mod.string(),
3852
- displayName: mod.string().default("").optional(),
3853
- shortBio: mod.string().default("").optional(),
3854
- bio: mod.string().default("").optional(),
3855
- email: mod.string().optional(),
3856
- image: mod.string().optional(),
3857
- heroImage: mod.string().optional()
4515
+ var LCNProfileManagerValidator = z.object({
4516
+ id: z.string(),
4517
+ created: z.string(),
4518
+ displayName: z.string().default("").optional(),
4519
+ shortBio: z.string().default("").optional(),
4520
+ bio: z.string().default("").optional(),
4521
+ email: z.string().optional(),
4522
+ image: z.string().optional(),
4523
+ heroImage: z.string().optional()
3858
4524
  });
3859
4525
  var PaginatedLCNProfileManagersValidator = PaginationResponseValidator.extend({
3860
- records: LCNProfileManagerValidator.extend({ did: mod.string() }).array()
4526
+ records: LCNProfileManagerValidator.extend({ did: z.string() }).array()
3861
4527
  });
3862
- var LCNProfileManagerQueryValidator = mod.object({
4528
+ var LCNProfileManagerQueryValidator = z.object({
3863
4529
  id: StringQuery,
3864
4530
  displayName: StringQuery,
3865
4531
  shortBio: StringQuery,
@@ -3867,296 +4533,297 @@ var LCNProfileManagerQueryValidator = mod.object({
3867
4533
  email: StringQuery
3868
4534
  }).partial();
3869
4535
  var PaginatedLCNProfilesAndManagersValidator = PaginationResponseValidator.extend({
3870
- records: mod.object({
4536
+ records: z.object({
3871
4537
  profile: LCNProfileValidator,
3872
- manager: LCNProfileManagerValidator.extend({ did: mod.string() }).optional()
4538
+ manager: LCNProfileManagerValidator.extend({ did: z.string() }).optional()
3873
4539
  }).array()
3874
4540
  });
3875
- var SentCredentialInfoValidator = mod.object({
3876
- uri: mod.string(),
3877
- to: mod.string(),
3878
- from: mod.string(),
3879
- sent: mod.string().datetime(),
3880
- received: mod.string().datetime().optional()
4541
+ var SentCredentialInfoValidator = z.object({
4542
+ uri: z.string(),
4543
+ to: z.string(),
4544
+ from: z.string(),
4545
+ sent: z.string().datetime(),
4546
+ received: z.string().datetime().optional()
3881
4547
  });
3882
- var BoostPermissionsValidator = mod.object({
3883
- role: mod.string(),
3884
- canEdit: mod.boolean(),
3885
- canIssue: mod.boolean(),
3886
- canRevoke: mod.boolean(),
3887
- canManagePermissions: mod.boolean(),
3888
- canIssueChildren: mod.string(),
3889
- canCreateChildren: mod.string(),
3890
- canEditChildren: mod.string(),
3891
- canRevokeChildren: mod.string(),
3892
- canManageChildrenPermissions: mod.string(),
3893
- canManageChildrenProfiles: mod.boolean().default(false).optional(),
3894
- canViewAnalytics: mod.boolean()
4548
+ var BoostPermissionsValidator = z.object({
4549
+ role: z.string(),
4550
+ canEdit: z.boolean(),
4551
+ canIssue: z.boolean(),
4552
+ canRevoke: z.boolean(),
4553
+ canManagePermissions: z.boolean(),
4554
+ canIssueChildren: z.string(),
4555
+ canCreateChildren: z.string(),
4556
+ canEditChildren: z.string(),
4557
+ canRevokeChildren: z.string(),
4558
+ canManageChildrenPermissions: z.string(),
4559
+ canManageChildrenProfiles: z.boolean().default(false).optional(),
4560
+ canViewAnalytics: z.boolean()
3895
4561
  });
3896
- var BoostPermissionsQueryValidator = mod.object({
4562
+ var BoostPermissionsQueryValidator = z.object({
3897
4563
  role: StringQuery,
3898
- canEdit: mod.boolean(),
3899
- canIssue: mod.boolean(),
3900
- canRevoke: mod.boolean(),
3901
- canManagePermissions: mod.boolean(),
4564
+ canEdit: z.boolean(),
4565
+ canIssue: z.boolean(),
4566
+ canRevoke: z.boolean(),
4567
+ canManagePermissions: z.boolean(),
3902
4568
  canIssueChildren: StringQuery,
3903
4569
  canCreateChildren: StringQuery,
3904
4570
  canEditChildren: StringQuery,
3905
4571
  canRevokeChildren: StringQuery,
3906
4572
  canManageChildrenPermissions: StringQuery,
3907
- canManageChildrenProfiles: mod.boolean(),
3908
- canViewAnalytics: mod.boolean()
4573
+ canManageChildrenProfiles: z.boolean(),
4574
+ canViewAnalytics: z.boolean()
3909
4575
  }).partial();
3910
- var ClaimHookTypeValidator = mod.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
3911
- var ClaimHookValidator = mod.discriminatedUnion("type", [
3912
- mod.object({
3913
- type: mod.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
3914
- data: mod.object({
3915
- claimUri: mod.string(),
3916
- targetUri: mod.string(),
4576
+ var ClaimHookTypeValidator = z.enum(["GRANT_PERMISSIONS", "ADD_ADMIN"]);
4577
+ var ClaimHookValidator = z.discriminatedUnion("type", [
4578
+ z.object({
4579
+ type: z.literal(ClaimHookTypeValidator.Values.GRANT_PERMISSIONS),
4580
+ data: z.object({
4581
+ claimUri: z.string(),
4582
+ targetUri: z.string(),
3917
4583
  permissions: BoostPermissionsValidator.partial()
3918
4584
  })
3919
4585
  }),
3920
- mod.object({
3921
- type: mod.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
3922
- data: mod.object({ claimUri: mod.string(), targetUri: mod.string() })
4586
+ z.object({
4587
+ type: z.literal(ClaimHookTypeValidator.Values.ADD_ADMIN),
4588
+ data: z.object({ claimUri: z.string(), targetUri: z.string() })
3923
4589
  })
3924
4590
  ]);
3925
- var ClaimHookQueryValidator = mod.object({
4591
+ var ClaimHookQueryValidator = z.object({
3926
4592
  type: StringQuery,
3927
- data: mod.object({
4593
+ data: z.object({
3928
4594
  claimUri: StringQuery,
3929
4595
  targetUri: StringQuery,
3930
4596
  permissions: BoostPermissionsQueryValidator
3931
4597
  })
3932
4598
  }).deepPartial();
3933
- var FullClaimHookValidator = mod.object({ id: mod.string(), createdAt: mod.string(), updatedAt: mod.string() }).and(ClaimHookValidator);
4599
+ var FullClaimHookValidator = z.object({ id: z.string(), createdAt: z.string(), updatedAt: z.string() }).and(ClaimHookValidator);
3934
4600
  var PaginatedClaimHooksValidator = PaginationResponseValidator.extend({
3935
4601
  records: FullClaimHookValidator.array()
3936
4602
  });
3937
- var LCNBoostStatus = mod.enum(["DRAFT", "LIVE"]);
3938
- var BoostValidator = mod.object({
3939
- uri: mod.string(),
3940
- name: mod.string().optional(),
3941
- type: mod.string().optional(),
3942
- category: mod.string().optional(),
4603
+ var LCNBoostStatus = z.enum(["DRAFT", "LIVE"]);
4604
+ var BoostValidator = z.object({
4605
+ uri: z.string(),
4606
+ name: z.string().optional(),
4607
+ type: z.string().optional(),
4608
+ category: z.string().optional(),
3943
4609
  status: LCNBoostStatus.optional(),
3944
- autoConnectRecipients: mod.boolean().optional(),
3945
- meta: mod.record(mod.any()).optional(),
3946
- claimPermissions: BoostPermissionsValidator.optional()
4610
+ autoConnectRecipients: z.boolean().optional(),
4611
+ meta: z.record(z.any()).optional(),
4612
+ claimPermissions: BoostPermissionsValidator.optional(),
4613
+ allowAnyoneToCreateChildren: z.boolean().optional()
3947
4614
  });
3948
- var BoostQueryValidator = mod.object({
4615
+ var BoostQueryValidator = z.object({
3949
4616
  uri: StringQuery,
3950
4617
  name: StringQuery,
3951
4618
  type: StringQuery,
3952
4619
  category: StringQuery,
3953
- meta: mod.record(StringQuery),
3954
- status: LCNBoostStatus.or(mod.object({ $in: LCNBoostStatus.array() })),
3955
- autoConnectRecipients: mod.boolean()
4620
+ meta: z.record(StringQuery),
4621
+ status: LCNBoostStatus.or(z.object({ $in: LCNBoostStatus.array() })),
4622
+ autoConnectRecipients: z.boolean()
3956
4623
  }).partial();
3957
4624
  var PaginatedBoostsValidator = PaginationResponseValidator.extend({
3958
4625
  records: BoostValidator.array()
3959
4626
  });
3960
- var BoostRecipientValidator = mod.object({
4627
+ var BoostRecipientValidator = z.object({
3961
4628
  to: LCNProfileValidator,
3962
- from: mod.string(),
3963
- received: mod.string().optional(),
3964
- uri: mod.string().optional()
4629
+ from: z.string(),
4630
+ received: z.string().optional(),
4631
+ uri: z.string().optional()
3965
4632
  });
3966
4633
  var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
3967
4634
  records: BoostRecipientValidator.array()
3968
4635
  });
3969
- var LCNBoostClaimLinkSigningAuthorityValidator = mod.object({
3970
- endpoint: mod.string(),
3971
- name: mod.string(),
3972
- did: mod.string().optional()
4636
+ var LCNBoostClaimLinkSigningAuthorityValidator = z.object({
4637
+ endpoint: z.string(),
4638
+ name: z.string(),
4639
+ did: z.string().optional()
3973
4640
  });
3974
- var LCNBoostClaimLinkOptionsValidator = mod.object({
3975
- ttlSeconds: mod.number().optional(),
3976
- totalUses: mod.number().optional()
4641
+ var LCNBoostClaimLinkOptionsValidator = z.object({
4642
+ ttlSeconds: z.number().optional(),
4643
+ totalUses: z.number().optional()
3977
4644
  });
3978
- var LCNSigningAuthorityValidator = mod.object({
3979
- endpoint: mod.string()
4645
+ var LCNSigningAuthorityValidator = z.object({
4646
+ endpoint: z.string()
3980
4647
  });
3981
- var LCNSigningAuthorityForUserValidator = mod.object({
4648
+ var LCNSigningAuthorityForUserValidator = z.object({
3982
4649
  signingAuthority: LCNSigningAuthorityValidator,
3983
- relationship: mod.object({
3984
- name: mod.string().max(15).regex(/^[a-z0-9-]+$/, {
4650
+ relationship: z.object({
4651
+ name: z.string().max(15).regex(/^[a-z0-9-]+$/, {
3985
4652
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
3986
4653
  }),
3987
- did: mod.string()
4654
+ did: z.string()
3988
4655
  })
3989
4656
  });
3990
- var AutoBoostConfigValidator = mod.object({
3991
- boostUri: mod.string(),
3992
- signingAuthority: mod.object({
3993
- endpoint: mod.string(),
3994
- name: mod.string()
4657
+ var AutoBoostConfigValidator = z.object({
4658
+ boostUri: z.string(),
4659
+ signingAuthority: z.object({
4660
+ endpoint: z.string(),
4661
+ name: z.string()
3995
4662
  })
3996
4663
  });
3997
- var ConsentFlowTermsStatusValidator = mod.enum(["live", "stale", "withdrawn"]);
3998
- var ConsentFlowContractValidator = mod.object({
3999
- read: mod.object({
4000
- anonymize: mod.boolean().optional(),
4001
- credentials: mod.object({ categories: mod.record(mod.object({ required: mod.boolean() })).default({}) }).default({}),
4002
- personal: mod.record(mod.object({ required: mod.boolean() })).default({})
4664
+ var ConsentFlowTermsStatusValidator = z.enum(["live", "stale", "withdrawn"]);
4665
+ var ConsentFlowContractValidator = z.object({
4666
+ read: z.object({
4667
+ anonymize: z.boolean().optional(),
4668
+ credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
4669
+ personal: z.record(z.object({ required: z.boolean() })).default({})
4003
4670
  }).default({}),
4004
- write: mod.object({
4005
- credentials: mod.object({ categories: mod.record(mod.object({ required: mod.boolean() })).default({}) }).default({}),
4006
- personal: mod.record(mod.object({ required: mod.boolean() })).default({})
4671
+ write: z.object({
4672
+ credentials: z.object({ categories: z.record(z.object({ required: z.boolean() })).default({}) }).default({}),
4673
+ personal: z.record(z.object({ required: z.boolean() })).default({})
4007
4674
  }).default({})
4008
4675
  });
4009
- var ConsentFlowContractDetailsValidator = mod.object({
4676
+ var ConsentFlowContractDetailsValidator = z.object({
4010
4677
  contract: ConsentFlowContractValidator,
4011
4678
  owner: LCNProfileValidator,
4012
- name: mod.string(),
4013
- subtitle: mod.string().optional(),
4014
- description: mod.string().optional(),
4015
- reasonForAccessing: mod.string().optional(),
4016
- image: mod.string().optional(),
4017
- uri: mod.string(),
4018
- needsGuardianConsent: mod.boolean().optional(),
4019
- redirectUrl: mod.string().optional(),
4020
- frontDoorBoostUri: mod.string().optional(),
4021
- createdAt: mod.string(),
4022
- updatedAt: mod.string(),
4023
- expiresAt: mod.string().optional(),
4024
- autoBoosts: mod.string().array().optional(),
4025
- writers: mod.array(LCNProfileValidator).optional()
4679
+ name: z.string(),
4680
+ subtitle: z.string().optional(),
4681
+ description: z.string().optional(),
4682
+ reasonForAccessing: z.string().optional(),
4683
+ image: z.string().optional(),
4684
+ uri: z.string(),
4685
+ needsGuardianConsent: z.boolean().optional(),
4686
+ redirectUrl: z.string().optional(),
4687
+ frontDoorBoostUri: z.string().optional(),
4688
+ createdAt: z.string(),
4689
+ updatedAt: z.string(),
4690
+ expiresAt: z.string().optional(),
4691
+ autoBoosts: z.string().array().optional(),
4692
+ writers: z.array(LCNProfileValidator).optional()
4026
4693
  });
4027
4694
  var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
4028
4695
  records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
4029
4696
  });
4030
- var ConsentFlowContractDataValidator = mod.object({
4031
- credentials: mod.object({ categories: mod.record(mod.string().array()).default({}) }),
4032
- personal: mod.record(mod.string()).default({}),
4033
- date: mod.string()
4697
+ var ConsentFlowContractDataValidator = z.object({
4698
+ credentials: z.object({ categories: z.record(z.string().array()).default({}) }),
4699
+ personal: z.record(z.string()).default({}),
4700
+ date: z.string()
4034
4701
  });
4035
4702
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
4036
4703
  records: ConsentFlowContractDataValidator.array()
4037
4704
  });
4038
- var ConsentFlowContractDataForDidValidator = mod.object({
4039
- credentials: mod.object({ category: mod.string(), uri: mod.string() }).array(),
4040
- personal: mod.record(mod.string()).default({}),
4041
- date: mod.string(),
4042
- contractUri: mod.string()
4705
+ var ConsentFlowContractDataForDidValidator = z.object({
4706
+ credentials: z.object({ category: z.string(), uri: z.string() }).array(),
4707
+ personal: z.record(z.string()).default({}),
4708
+ date: z.string(),
4709
+ contractUri: z.string()
4043
4710
  });
4044
4711
  var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
4045
4712
  records: ConsentFlowContractDataForDidValidator.array()
4046
4713
  });
4047
- var ConsentFlowTermValidator = mod.object({
4048
- sharing: mod.boolean().optional(),
4049
- shared: mod.string().array().optional(),
4050
- shareAll: mod.boolean().optional(),
4051
- shareUntil: mod.string().optional()
4714
+ var ConsentFlowTermValidator = z.object({
4715
+ sharing: z.boolean().optional(),
4716
+ shared: z.string().array().optional(),
4717
+ shareAll: z.boolean().optional(),
4718
+ shareUntil: z.string().optional()
4052
4719
  });
4053
- var ConsentFlowTermsValidator = mod.object({
4054
- read: mod.object({
4055
- anonymize: mod.boolean().optional(),
4056
- credentials: mod.object({
4057
- shareAll: mod.boolean().optional(),
4058
- sharing: mod.boolean().optional(),
4059
- categories: mod.record(ConsentFlowTermValidator).default({})
4720
+ var ConsentFlowTermsValidator = z.object({
4721
+ read: z.object({
4722
+ anonymize: z.boolean().optional(),
4723
+ credentials: z.object({
4724
+ shareAll: z.boolean().optional(),
4725
+ sharing: z.boolean().optional(),
4726
+ categories: z.record(ConsentFlowTermValidator).default({})
4060
4727
  }).default({}),
4061
- personal: mod.record(mod.string()).default({})
4728
+ personal: z.record(z.string()).default({})
4062
4729
  }).default({}),
4063
- write: mod.object({
4064
- credentials: mod.object({ categories: mod.record(mod.boolean()).default({}) }).default({}),
4065
- personal: mod.record(mod.boolean()).default({})
4730
+ write: z.object({
4731
+ credentials: z.object({ categories: z.record(z.boolean()).default({}) }).default({}),
4732
+ personal: z.record(z.boolean()).default({})
4066
4733
  }).default({}),
4067
- deniedWriters: mod.array(mod.string()).optional()
4734
+ deniedWriters: z.array(z.string()).optional()
4068
4735
  });
4069
4736
  var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
4070
- records: mod.object({
4071
- expiresAt: mod.string().optional(),
4072
- oneTime: mod.boolean().optional(),
4737
+ records: z.object({
4738
+ expiresAt: z.string().optional(),
4739
+ oneTime: z.boolean().optional(),
4073
4740
  terms: ConsentFlowTermsValidator,
4074
4741
  contract: ConsentFlowContractDetailsValidator,
4075
- uri: mod.string(),
4742
+ uri: z.string(),
4076
4743
  consenter: LCNProfileValidator,
4077
4744
  status: ConsentFlowTermsStatusValidator
4078
4745
  }).array()
4079
4746
  });
4080
- var ConsentFlowContractQueryValidator = mod.object({
4081
- read: mod.object({
4082
- anonymize: mod.boolean().optional(),
4083
- credentials: mod.object({
4084
- categories: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4747
+ var ConsentFlowContractQueryValidator = z.object({
4748
+ read: z.object({
4749
+ anonymize: z.boolean().optional(),
4750
+ credentials: z.object({
4751
+ categories: z.record(z.object({ required: z.boolean().optional() })).optional()
4085
4752
  }).optional(),
4086
- personal: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4753
+ personal: z.record(z.object({ required: z.boolean().optional() })).optional()
4087
4754
  }).optional(),
4088
- write: mod.object({
4089
- credentials: mod.object({
4090
- categories: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4755
+ write: z.object({
4756
+ credentials: z.object({
4757
+ categories: z.record(z.object({ required: z.boolean().optional() })).optional()
4091
4758
  }).optional(),
4092
- personal: mod.record(mod.object({ required: mod.boolean().optional() })).optional()
4759
+ personal: z.record(z.object({ required: z.boolean().optional() })).optional()
4093
4760
  }).optional()
4094
4761
  });
4095
- var ConsentFlowDataQueryValidator = mod.object({
4096
- anonymize: mod.boolean().optional(),
4097
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4098
- personal: mod.record(mod.boolean()).optional()
4762
+ var ConsentFlowDataQueryValidator = z.object({
4763
+ anonymize: z.boolean().optional(),
4764
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4765
+ personal: z.record(z.boolean()).optional()
4099
4766
  });
4100
- var ConsentFlowDataForDidQueryValidator = mod.object({
4101
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4102
- personal: mod.record(mod.boolean()).optional(),
4767
+ var ConsentFlowDataForDidQueryValidator = z.object({
4768
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4769
+ personal: z.record(z.boolean()).optional(),
4103
4770
  id: StringQuery.optional()
4104
4771
  });
4105
- var ConsentFlowTermsQueryValidator = mod.object({
4106
- read: mod.object({
4107
- anonymize: mod.boolean().optional(),
4108
- credentials: mod.object({
4109
- shareAll: mod.boolean().optional(),
4110
- sharing: mod.boolean().optional(),
4111
- categories: mod.record(ConsentFlowTermValidator.optional()).optional()
4772
+ var ConsentFlowTermsQueryValidator = z.object({
4773
+ read: z.object({
4774
+ anonymize: z.boolean().optional(),
4775
+ credentials: z.object({
4776
+ shareAll: z.boolean().optional(),
4777
+ sharing: z.boolean().optional(),
4778
+ categories: z.record(ConsentFlowTermValidator.optional()).optional()
4112
4779
  }).optional(),
4113
- personal: mod.record(mod.string()).optional()
4780
+ personal: z.record(z.string()).optional()
4114
4781
  }).optional(),
4115
- write: mod.object({
4116
- credentials: mod.object({ categories: mod.record(mod.boolean()).optional() }).optional(),
4117
- personal: mod.record(mod.boolean()).optional()
4782
+ write: z.object({
4783
+ credentials: z.object({ categories: z.record(z.boolean()).optional() }).optional(),
4784
+ personal: z.record(z.boolean()).optional()
4118
4785
  }).optional()
4119
4786
  });
4120
- var ConsentFlowTransactionActionValidator = mod.enum([
4787
+ var ConsentFlowTransactionActionValidator = z.enum([
4121
4788
  "consent",
4122
4789
  "update",
4123
4790
  "sync",
4124
4791
  "withdraw",
4125
4792
  "write"
4126
4793
  ]);
4127
- var ConsentFlowTransactionsQueryValidator = mod.object({
4794
+ var ConsentFlowTransactionsQueryValidator = z.object({
4128
4795
  terms: ConsentFlowTermsQueryValidator.optional(),
4129
4796
  action: ConsentFlowTransactionActionValidator.or(
4130
4797
  ConsentFlowTransactionActionValidator.array()
4131
4798
  ).optional(),
4132
- date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
4133
- expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
4134
- oneTime: mod.boolean().optional()
4799
+ date: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
4800
+ expiresAt: z.object({ $gt: z.string() }).or(z.object({ $lt: z.string() })).or(z.object({ $eq: z.string() })).optional(),
4801
+ oneTime: z.boolean().optional()
4135
4802
  });
4136
- var ConsentFlowTransactionValidator = mod.object({
4137
- expiresAt: mod.string().optional(),
4138
- oneTime: mod.boolean().optional(),
4803
+ var ConsentFlowTransactionValidator = z.object({
4804
+ expiresAt: z.string().optional(),
4805
+ oneTime: z.boolean().optional(),
4139
4806
  terms: ConsentFlowTermsValidator.optional(),
4140
- id: mod.string(),
4807
+ id: z.string(),
4141
4808
  action: ConsentFlowTransactionActionValidator,
4142
- date: mod.string(),
4143
- uris: mod.string().array().optional()
4809
+ date: z.string(),
4810
+ uris: z.string().array().optional()
4144
4811
  });
4145
4812
  var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
4146
4813
  records: ConsentFlowTransactionValidator.array()
4147
4814
  });
4148
- var ContractCredentialValidator = mod.object({
4149
- credentialUri: mod.string(),
4150
- termsUri: mod.string(),
4151
- contractUri: mod.string(),
4152
- boostUri: mod.string(),
4153
- category: mod.string().optional(),
4154
- date: mod.string()
4815
+ var ContractCredentialValidator = z.object({
4816
+ credentialUri: z.string(),
4817
+ termsUri: z.string(),
4818
+ contractUri: z.string(),
4819
+ boostUri: z.string(),
4820
+ category: z.string().optional(),
4821
+ date: z.string()
4155
4822
  });
4156
4823
  var PaginatedContractCredentialsValidator = PaginationResponseValidator.extend({
4157
4824
  records: ContractCredentialValidator.array()
4158
4825
  });
4159
- var LCNNotificationTypeEnumValidator = mod.enum([
4826
+ var LCNNotificationTypeEnumValidator = z.enum([
4160
4827
  "CONNECTION_REQUEST",
4161
4828
  "CONNECTION_ACCEPTED",
4162
4829
  "CREDENTIAL_RECEIVED",
@@ -4167,40 +4834,40 @@ var LCNNotificationTypeEnumValidator = mod.enum([
4167
4834
  "PRESENTATION_RECEIVED",
4168
4835
  "CONSENT_FLOW_TRANSACTION"
4169
4836
  ]);
4170
- var LCNNotificationMessageValidator = mod.object({
4171
- title: mod.string().optional(),
4172
- body: mod.string().optional()
4837
+ var LCNNotificationMessageValidator = z.object({
4838
+ title: z.string().optional(),
4839
+ body: z.string().optional()
4173
4840
  });
4174
- var LCNNotificationDataValidator = mod.object({
4175
- vcUris: mod.array(mod.string()).optional(),
4176
- vpUris: mod.array(mod.string()).optional(),
4841
+ var LCNNotificationDataValidator = z.object({
4842
+ vcUris: z.array(z.string()).optional(),
4843
+ vpUris: z.array(z.string()).optional(),
4177
4844
  transaction: ConsentFlowTransactionValidator.optional()
4178
4845
  });
4179
- var LCNNotificationValidator = mod.object({
4846
+ var LCNNotificationValidator = z.object({
4180
4847
  type: LCNNotificationTypeEnumValidator,
4181
- to: LCNProfileValidator.partial().and(mod.object({ did: mod.string() })),
4182
- from: LCNProfileValidator.partial().and(mod.object({ did: mod.string() })),
4848
+ to: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
4849
+ from: LCNProfileValidator.partial().and(z.object({ did: z.string() })),
4183
4850
  message: LCNNotificationMessageValidator.optional(),
4184
4851
  data: LCNNotificationDataValidator.optional(),
4185
- sent: mod.string().datetime().optional()
4852
+ sent: z.string().datetime().optional()
4186
4853
  });
4187
4854
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
4188
- var AuthGrantValidator = mod.object({
4189
- id: mod.string(),
4190
- name: mod.string(),
4191
- description: mod.string().optional(),
4192
- challenge: mod.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
4193
- status: mod.enum(["revoked", "active"], {
4855
+ var AuthGrantValidator = z.object({
4856
+ id: z.string(),
4857
+ name: z.string(),
4858
+ description: z.string().optional(),
4859
+ challenge: z.string().startsWith(AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX).min(10, { message: "Challenge is too short" }).max(100, { message: "Challenge is too long" }),
4860
+ status: z.enum(["revoked", "active"], {
4194
4861
  required_error: "Status is required",
4195
4862
  invalid_type_error: "Status must be either active or revoked"
4196
4863
  }),
4197
- scope: mod.string(),
4198
- createdAt: mod.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
4199
- expiresAt: mod.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
4864
+ scope: z.string(),
4865
+ createdAt: z.string().datetime({ message: "createdAt must be a valid ISO 8601 datetime string" }),
4866
+ expiresAt: z.string().datetime({ message: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
4200
4867
  });
4201
- var FlatAuthGrantValidator = mod.object({ id: mod.string() }).catchall(mod.any());
4202
- var AuthGrantStatusValidator = mod.enum(["active", "revoked"]);
4203
- var AuthGrantQueryValidator = mod.object({
4868
+ var FlatAuthGrantValidator = z.object({ id: z.string() }).catchall(z.any());
4869
+ var AuthGrantStatusValidator = z.enum(["active", "revoked"]);
4870
+ var AuthGrantQueryValidator = z.object({
4204
4871
  id: StringQuery,
4205
4872
  name: StringQuery,
4206
4873
  description: StringQuery,
@@ -5059,7 +5726,7 @@ var formatters2 = {
5059
5726
  return "GMT" + formatTimezone(timezoneOffset, ":");
5060
5727
  }
5061
5728
  }, "O"),
5062
- z: /* @__PURE__ */ __name(function z(date, token, _localize, options) {
5729
+ z: /* @__PURE__ */ __name(function z2(date, token, _localize, options) {
5063
5730
  var originalDate = options._originalDate || date;
5064
5731
  var timezoneOffset = originalDate.getTimezoneOffset();
5065
5732
  switch (token) {