@learncard/react 2.3.52 → 2.3.54

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.
Files changed (107) hide show
  1. package/dist/base.css +1 -1
  2. package/dist/base.js +1 -1
  3. package/dist/cjs/AchievementCard-0123be96.js.map +1 -1
  4. package/dist/cjs/Button-a7af702b.js.map +1 -1
  5. package/dist/cjs/CircleCheckButton-97c4f608.js.map +1 -1
  6. package/dist/cjs/CircleIcon-41b3fa88.js.map +1 -1
  7. package/dist/cjs/CircleSpinner-093cce04.js.map +1 -1
  8. package/dist/cjs/CourseCard-338a32ee.js.map +1 -1
  9. package/dist/cjs/CourseVerticalCard-ba8fc2f7.js.map +1 -1
  10. package/dist/cjs/FlippyCard-33e03a9e.js.map +1 -1
  11. package/dist/cjs/GenericArrow-8dfb261d.js.map +1 -1
  12. package/dist/cjs/GenericCard-c5b70b29.js.map +1 -1
  13. package/dist/cjs/JobHistoryCard-05a3f98b.js.map +1 -1
  14. package/dist/cjs/JobListCard-e2b3c042.js.map +1 -1
  15. package/dist/cjs/LearnCardCreditCardBackFace-87cc8b9f.js.map +1 -1
  16. package/dist/cjs/LearnCardCreditCardFrontFace-4452fd7a.js.map +1 -1
  17. package/dist/cjs/LearnPill-23ff7225.js.map +1 -1
  18. package/dist/cjs/MiniVCThumbnail-a78e44f2.js.map +1 -1
  19. package/dist/cjs/Notification-10b40c07.js.map +1 -1
  20. package/dist/cjs/QRCodeCard-efaa58e1.js.map +1 -1
  21. package/dist/cjs/RoundedPill-15c0aca9.js.map +1 -1
  22. package/dist/cjs/SchoolIDCard-1baf77e8.js.map +1 -1
  23. package/dist/cjs/SkillTabCard-82f2fae0.js.map +1 -1
  24. package/dist/cjs/SkillVerticalCard-3eb3a8e9.js.map +1 -1
  25. package/dist/cjs/SkillsCard-4b6dbb4f.js.map +1 -1
  26. package/dist/cjs/SkillsStatsCard-97a35a88.js.map +1 -1
  27. package/dist/cjs/SmallAchievementCard-c76701ce.js.map +1 -1
  28. package/dist/cjs/Trophy-9ede7f2b.js.map +1 -1
  29. package/dist/cjs/User-b16d5499.js.map +1 -1
  30. package/dist/cjs/{VCCard-d04bbb8d.js → VCCard-d12310c5.js} +2 -2
  31. package/dist/cjs/VCCard-d12310c5.js.map +1 -0
  32. package/dist/cjs/{VCDisplayBackFace-80deea80.js → VCDisplayBackFace-88beca2a.js} +2 -2
  33. package/dist/{esm/VCDisplayBackFace-fabc926c.js.map → cjs/VCDisplayBackFace-88beca2a.js.map} +1 -1
  34. package/dist/cjs/VCDisplayCard-2444fe1b.js +5837 -0
  35. package/dist/cjs/VCDisplayCard-2444fe1b.js.map +1 -0
  36. package/dist/cjs/VCThumbnail-6bf86bb2.js.map +1 -1
  37. package/dist/cjs/VCVerificationCheck-0e495524.js.map +1 -1
  38. package/dist/cjs/{VCVerificationPill-656a2742.js → VCVerificationPill-e1b817ac.js} +260 -76
  39. package/dist/cjs/VCVerificationPill-e1b817ac.js.map +1 -0
  40. package/dist/cjs/constants-678d0aa9.js.map +1 -1
  41. package/dist/cjs/icons-cf98ef88.js.map +1 -1
  42. package/dist/cjs/index-63ee021e.js.map +1 -1
  43. package/dist/cjs/index-6cab6d37.js.map +1 -1
  44. package/dist/cjs/index.js +4 -4
  45. package/dist/cjs/index10.js +4 -4
  46. package/dist/cjs/index29.js +4 -4
  47. package/dist/cjs/index30.js +2 -2
  48. package/dist/cjs/index31.js +3 -3
  49. package/dist/cjs/index35.js +1 -1
  50. package/dist/esm/AchievementCard-92b5a3ea.js.map +1 -1
  51. package/dist/esm/Button-5f805204.js.map +1 -1
  52. package/dist/esm/CircleCheckButton-a55dfd2a.js.map +1 -1
  53. package/dist/esm/CircleIcon-b0dca4b6.js.map +1 -1
  54. package/dist/esm/CircleSpinner-9b8b1a6b.js.map +1 -1
  55. package/dist/esm/CourseCard-663ff174.js.map +1 -1
  56. package/dist/esm/CourseVerticalCard-643f767b.js.map +1 -1
  57. package/dist/esm/FlippyCard-682649d7.js.map +1 -1
  58. package/dist/esm/GenericArrow-0dba1707.js.map +1 -1
  59. package/dist/esm/GenericCard-ada539c7.js.map +1 -1
  60. package/dist/esm/JobHistoryCard-80d4ef27.js.map +1 -1
  61. package/dist/esm/JobListCard-e84e21e7.js.map +1 -1
  62. package/dist/esm/LearnCardCreditCardBackFace-9baa9e6b.js.map +1 -1
  63. package/dist/esm/LearnCardCreditCardFrontFace-cf793917.js.map +1 -1
  64. package/dist/esm/LearnPill-a1001ae7.js.map +1 -1
  65. package/dist/esm/MiniVCThumbnail-6a07e810.js.map +1 -1
  66. package/dist/esm/Notification-ac50790d.js.map +1 -1
  67. package/dist/esm/QRCodeCard-c57e2067.js.map +1 -1
  68. package/dist/esm/RoundedPill-2f4dc646.js.map +1 -1
  69. package/dist/esm/SchoolIDCard-3b746226.js.map +1 -1
  70. package/dist/esm/SkillTabCard-ade7a48c.js.map +1 -1
  71. package/dist/esm/SkillVerticalCard-108f49bb.js.map +1 -1
  72. package/dist/esm/SkillsCard-92a51db2.js.map +1 -1
  73. package/dist/esm/SkillsStatsCard-1628fe9c.js.map +1 -1
  74. package/dist/esm/SmallAchievementCard-2d87ac82.js.map +1 -1
  75. package/dist/esm/Trophy-702610b8.js.map +1 -1
  76. package/dist/esm/User-d3aa7eb3.js.map +1 -1
  77. package/dist/esm/{VCCard-fdbb9b04.js → VCCard-490ef20e.js} +2 -2
  78. package/dist/esm/VCCard-490ef20e.js.map +1 -0
  79. package/dist/esm/{VCDisplayBackFace-fabc926c.js → VCDisplayBackFace-2f04590a.js} +2 -2
  80. package/dist/{cjs/VCDisplayBackFace-80deea80.js.map → esm/VCDisplayBackFace-2f04590a.js.map} +1 -1
  81. package/dist/esm/VCDisplayCard-5597d354.js +5828 -0
  82. package/dist/esm/VCDisplayCard-5597d354.js.map +1 -0
  83. package/dist/esm/VCThumbnail-3c254bda.js.map +1 -1
  84. package/dist/esm/VCVerificationCheck-b2de0477.js.map +1 -1
  85. package/dist/esm/{VCVerificationPill-26519af1.js → VCVerificationPill-09889426.js} +260 -76
  86. package/dist/esm/VCVerificationPill-09889426.js.map +1 -0
  87. package/dist/esm/constants-e0d87a29.js.map +1 -1
  88. package/dist/esm/icons-10f38bbd.js.map +1 -1
  89. package/dist/esm/index-15b828c0.js.map +1 -1
  90. package/dist/esm/index-2ef79548.js.map +1 -1
  91. package/dist/esm/index.js +4 -4
  92. package/dist/esm/index10.js +4 -4
  93. package/dist/esm/index29.js +4 -4
  94. package/dist/esm/index30.js +2 -2
  95. package/dist/esm/index31.js +3 -3
  96. package/dist/esm/index35.js +1 -1
  97. package/dist/main.css +1 -1
  98. package/dist/main.js +1 -1
  99. package/package.json +3 -3
  100. package/dist/cjs/VCCard-d04bbb8d.js.map +0 -1
  101. package/dist/cjs/VCDisplayCard-8af36d1c.js +0 -2586
  102. package/dist/cjs/VCDisplayCard-8af36d1c.js.map +0 -1
  103. package/dist/cjs/VCVerificationPill-656a2742.js.map +0 -1
  104. package/dist/esm/VCCard-fdbb9b04.js.map +0 -1
  105. package/dist/esm/VCDisplayCard-df6c485d.js +0 -2577
  106. package/dist/esm/VCDisplayCard-df6c485d.js.map +0 -1
  107. package/dist/esm/VCVerificationPill-26519af1.js.map +0 -1
@@ -5,6 +5,9 @@ import VerificationWarningIcon from './YellowWarningCircle.svg';
5
5
 
6
6
  var util;
7
7
  (function (util) {
8
+ util.assertEqual = (val) => val;
9
+ function assertIs(_arg) { }
10
+ util.assertIs = assertIs;
8
11
  function assertNever(_x) {
9
12
  throw new Error();
10
13
  }
@@ -56,6 +59,12 @@ var util;
56
59
  .join(separator);
57
60
  }
58
61
  util.joinValues = joinValues;
62
+ util.jsonStringifyReplacer = (_, value) => {
63
+ if (typeof value === "bigint") {
64
+ return value.toString();
65
+ }
66
+ return value;
67
+ };
59
68
  })(util || (util = {}));
60
69
  const ZodParsedType = util.arrayToEnum([
61
70
  "string",
@@ -220,7 +229,7 @@ class ZodError extends Error {
220
229
  return this.message;
221
230
  }
222
231
  get message() {
223
- return JSON.stringify(this.issues, null, 2);
232
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
224
233
  }
225
234
  get isEmpty() {
226
235
  return this.issues.length === 0;
@@ -247,7 +256,8 @@ ZodError.create = (issues) => {
247
256
  const error = new ZodError(issues);
248
257
  return error;
249
258
  };
250
- const defaultErrorMap = (issue, _ctx) => {
259
+
260
+ const errorMap = (issue, _ctx) => {
251
261
  let message;
252
262
  switch (issue.code) {
253
263
  case ZodIssueCode.invalid_type:
@@ -259,7 +269,7 @@ const defaultErrorMap = (issue, _ctx) => {
259
269
  }
260
270
  break;
261
271
  case ZodIssueCode.invalid_literal:
262
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected)}`;
272
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
263
273
  break;
264
274
  case ZodIssueCode.unrecognized_keys:
265
275
  message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
@@ -283,10 +293,23 @@ const defaultErrorMap = (issue, _ctx) => {
283
293
  message = `Invalid date`;
284
294
  break;
285
295
  case ZodIssueCode.invalid_string:
286
- if (issue.validation !== "regex")
296
+ if (typeof issue.validation === "object") {
297
+ if ("startsWith" in issue.validation) {
298
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
299
+ }
300
+ else if ("endsWith" in issue.validation) {
301
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
302
+ }
303
+ else {
304
+ util.assertNever(issue.validation);
305
+ }
306
+ }
307
+ else if (issue.validation !== "regex") {
287
308
  message = `Invalid ${issue.validation}`;
288
- else
309
+ }
310
+ else {
289
311
  message = "Invalid";
312
+ }
290
313
  break;
291
314
  case ZodIssueCode.too_small:
292
315
  if (issue.type === "array")
@@ -295,6 +318,8 @@ const defaultErrorMap = (issue, _ctx) => {
295
318
  message = `String must contain ${issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
296
319
  else if (issue.type === "number")
297
320
  message = `Number must be greater than ${issue.inclusive ? `or equal to ` : ``}${issue.minimum}`;
321
+ else if (issue.type === "date")
322
+ message = `Date must be greater than ${issue.inclusive ? `or equal to ` : ``}${new Date(issue.minimum)}`;
298
323
  else
299
324
  message = "Invalid input";
300
325
  break;
@@ -305,6 +330,8 @@ const defaultErrorMap = (issue, _ctx) => {
305
330
  message = `String must contain ${issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
306
331
  else if (issue.type === "number")
307
332
  message = `Number must be less than ${issue.inclusive ? `or equal to ` : ``}${issue.maximum}`;
333
+ else if (issue.type === "date")
334
+ message = `Date must be smaller than ${issue.inclusive ? `or equal to ` : ``}${new Date(issue.maximum)}`;
308
335
  else
309
336
  message = "Invalid input";
310
337
  break;
@@ -323,10 +350,14 @@ const defaultErrorMap = (issue, _ctx) => {
323
350
  }
324
351
  return { message };
325
352
  };
326
- let overrideErrorMap = defaultErrorMap;
327
- const setErrorMap = (map) => {
353
+
354
+ let overrideErrorMap = errorMap;
355
+ function setErrorMap(map) {
328
356
  overrideErrorMap = map;
329
- };
357
+ }
358
+ function getErrorMap() {
359
+ return overrideErrorMap;
360
+ }
330
361
 
331
362
  const makeIssue = (params) => {
332
363
  const { data, path, errorMaps, issueData } = params;
@@ -358,8 +389,8 @@ function addIssueToContext(ctx, issueData) {
358
389
  errorMaps: [
359
390
  ctx.common.contextualErrorMap,
360
391
  ctx.schemaErrorMap,
361
- overrideErrorMap,
362
- defaultErrorMap,
392
+ getErrorMap(),
393
+ errorMap,
363
394
  ].filter((x) => !!x),
364
395
  });
365
396
  ctx.common.issues.push(issue);
@@ -460,18 +491,17 @@ function processCreateParams(params) {
460
491
  return {};
461
492
  const { errorMap, invalid_type_error, required_error, description } = params;
462
493
  if (errorMap && (invalid_type_error || required_error)) {
463
- throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);
494
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
464
495
  }
465
496
  if (errorMap)
466
497
  return { errorMap: errorMap, description };
467
498
  const customMap = (iss, ctx) => {
468
499
  if (iss.code !== "invalid_type")
469
500
  return { message: ctx.defaultError };
470
- if (typeof ctx.data === "undefined" && required_error)
471
- return { message: required_error };
472
- if (params.invalid_type_error)
473
- return { message: params.invalid_type_error };
474
- return { message: ctx.defaultError };
501
+ if (typeof ctx.data === "undefined") {
502
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
503
+ }
504
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
475
505
  };
476
506
  return { errorMap: customMap, description };
477
507
  }
@@ -684,6 +714,13 @@ class ZodType {
684
714
  typeName: ZodFirstPartyTypeKind.ZodDefault,
685
715
  });
686
716
  }
717
+ brand() {
718
+ return new ZodBranded({
719
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
720
+ type: this,
721
+ ...processCreateParams(undefined),
722
+ });
723
+ }
687
724
  describe(description) {
688
725
  const This = this.constructor;
689
726
  return new This({
@@ -828,6 +865,28 @@ class ZodString extends ZodType {
828
865
  else if (check.kind === "trim") {
829
866
  input.data = input.data.trim();
830
867
  }
868
+ else if (check.kind === "startsWith") {
869
+ if (!input.data.startsWith(check.value)) {
870
+ ctx = this._getOrReturnCtx(input, ctx);
871
+ addIssueToContext(ctx, {
872
+ code: ZodIssueCode.invalid_string,
873
+ validation: { startsWith: check.value },
874
+ message: check.message,
875
+ });
876
+ status.dirty();
877
+ }
878
+ }
879
+ else if (check.kind === "endsWith") {
880
+ if (!input.data.endsWith(check.value)) {
881
+ ctx = this._getOrReturnCtx(input, ctx);
882
+ addIssueToContext(ctx, {
883
+ code: ZodIssueCode.invalid_string,
884
+ validation: { endsWith: check.value },
885
+ message: check.message,
886
+ });
887
+ status.dirty();
888
+ }
889
+ }
831
890
  else {
832
891
  util.assertNever(check);
833
892
  }
@@ -859,6 +918,20 @@ class ZodString extends ZodType {
859
918
  ...errorUtil.errToObj(message),
860
919
  });
861
920
  }
921
+ startsWith(value, message) {
922
+ return this._addCheck({
923
+ kind: "startsWith",
924
+ value: value,
925
+ ...errorUtil.errToObj(message),
926
+ });
927
+ }
928
+ endsWith(value, message) {
929
+ return this._addCheck({
930
+ kind: "endsWith",
931
+ value: value,
932
+ ...errorUtil.errToObj(message),
933
+ });
934
+ }
862
935
  min(minLength, message) {
863
936
  return this._addCheck({
864
937
  kind: "min",
@@ -889,25 +962,23 @@ class ZodString extends ZodType {
889
962
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
890
963
  }
891
964
  get minLength() {
892
- let min = -Infinity;
893
- this._def.checks.map((ch) => {
965
+ let min = null;
966
+ for (const ch of this._def.checks) {
894
967
  if (ch.kind === "min") {
895
- if (min === null || ch.value > min) {
968
+ if (min === null || ch.value > min)
896
969
  min = ch.value;
897
- }
898
970
  }
899
- });
971
+ }
900
972
  return min;
901
973
  }
902
974
  get maxLength() {
903
975
  let max = null;
904
- this._def.checks.map((ch) => {
976
+ for (const ch of this._def.checks) {
905
977
  if (ch.kind === "max") {
906
- if (max === null || ch.value < max) {
978
+ if (max === null || ch.value < max)
907
979
  max = ch.value;
908
- }
909
980
  }
910
- });
981
+ }
911
982
  return max;
912
983
  }
913
984
  }
@@ -1178,14 +1249,88 @@ class ZodDate extends ZodType {
1178
1249
  });
1179
1250
  return INVALID;
1180
1251
  }
1252
+ const status = new ParseStatus();
1253
+ let ctx = undefined;
1254
+ for (const check of this._def.checks) {
1255
+ if (check.kind === "min") {
1256
+ if (input.data.getTime() < check.value) {
1257
+ ctx = this._getOrReturnCtx(input, ctx);
1258
+ addIssueToContext(ctx, {
1259
+ code: ZodIssueCode.too_small,
1260
+ message: check.message,
1261
+ inclusive: true,
1262
+ minimum: check.value,
1263
+ type: "date",
1264
+ });
1265
+ status.dirty();
1266
+ }
1267
+ }
1268
+ else if (check.kind === "max") {
1269
+ if (input.data.getTime() > check.value) {
1270
+ ctx = this._getOrReturnCtx(input, ctx);
1271
+ addIssueToContext(ctx, {
1272
+ code: ZodIssueCode.too_big,
1273
+ message: check.message,
1274
+ inclusive: true,
1275
+ maximum: check.value,
1276
+ type: "date",
1277
+ });
1278
+ status.dirty();
1279
+ }
1280
+ }
1281
+ else {
1282
+ util.assertNever(check);
1283
+ }
1284
+ }
1181
1285
  return {
1182
- status: "valid",
1286
+ status: status.value,
1183
1287
  value: new Date(input.data.getTime()),
1184
1288
  };
1185
1289
  }
1290
+ _addCheck(check) {
1291
+ return new ZodDate({
1292
+ ...this._def,
1293
+ checks: [...this._def.checks, check],
1294
+ });
1295
+ }
1296
+ min(minDate, message) {
1297
+ return this._addCheck({
1298
+ kind: "min",
1299
+ value: minDate.getTime(),
1300
+ message: errorUtil.toString(message),
1301
+ });
1302
+ }
1303
+ max(maxDate, message) {
1304
+ return this._addCheck({
1305
+ kind: "max",
1306
+ value: maxDate.getTime(),
1307
+ message: errorUtil.toString(message),
1308
+ });
1309
+ }
1310
+ get minDate() {
1311
+ let min = null;
1312
+ for (const ch of this._def.checks) {
1313
+ if (ch.kind === "min") {
1314
+ if (min === null || ch.value > min)
1315
+ min = ch.value;
1316
+ }
1317
+ }
1318
+ return min != null ? new Date(min) : null;
1319
+ }
1320
+ get maxDate() {
1321
+ let max = null;
1322
+ for (const ch of this._def.checks) {
1323
+ if (ch.kind === "max") {
1324
+ if (max === null || ch.value < max)
1325
+ max = ch.value;
1326
+ }
1327
+ }
1328
+ return max != null ? new Date(max) : null;
1329
+ }
1186
1330
  }
1187
1331
  ZodDate.create = (params) => {
1188
1332
  return new ZodDate({
1333
+ checks: [],
1189
1334
  typeName: ZodFirstPartyTypeKind.ZodDate,
1190
1335
  ...processCreateParams(params),
1191
1336
  });
@@ -1467,9 +1612,12 @@ class ZodObject extends ZodType {
1467
1612
  const { status, ctx } = this._processInputParams(input);
1468
1613
  const { shape, keys: shapeKeys } = this._getCached();
1469
1614
  const extraKeys = [];
1470
- for (const key in ctx.data) {
1471
- if (!shapeKeys.includes(key)) {
1472
- extraKeys.push(key);
1615
+ if (!(this._def.catchall instanceof ZodNever &&
1616
+ this._def.unknownKeys === "strip")) {
1617
+ for (const key in ctx.data) {
1618
+ if (!shapeKeys.includes(key)) {
1619
+ extraKeys.push(key);
1620
+ }
1473
1621
  }
1474
1622
  }
1475
1623
  const pairs = [];
@@ -1674,6 +1822,9 @@ class ZodObject extends ZodType {
1674
1822
  shape: () => newShape,
1675
1823
  });
1676
1824
  }
1825
+ keyof() {
1826
+ return createZodEnum(util.objectKeys(this.shape));
1827
+ }
1677
1828
  }
1678
1829
  ZodObject.create = (shape, params) => {
1679
1830
  return new ZodObject({
@@ -2034,6 +2185,9 @@ class ZodTuple extends ZodType {
2034
2185
  }
2035
2186
  }
2036
2187
  ZodTuple.create = (schemas, params) => {
2188
+ if (!Array.isArray(schemas)) {
2189
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2190
+ }
2037
2191
  return new ZodTuple({
2038
2192
  items: schemas,
2039
2193
  typeName: ZodFirstPartyTypeKind.ZodTuple,
@@ -2261,8 +2415,8 @@ class ZodFunction extends ZodType {
2261
2415
  errorMaps: [
2262
2416
  ctx.common.contextualErrorMap,
2263
2417
  ctx.schemaErrorMap,
2264
- overrideErrorMap,
2265
- defaultErrorMap,
2418
+ getErrorMap(),
2419
+ errorMap,
2266
2420
  ].filter((x) => !!x),
2267
2421
  issueData: {
2268
2422
  code: ZodIssueCode.invalid_arguments,
@@ -2277,8 +2431,8 @@ class ZodFunction extends ZodType {
2277
2431
  errorMaps: [
2278
2432
  ctx.common.contextualErrorMap,
2279
2433
  ctx.schemaErrorMap,
2280
- overrideErrorMap,
2281
- defaultErrorMap,
2434
+ getErrorMap(),
2435
+ errorMap,
2282
2436
  ].filter((x) => !!x),
2283
2437
  issueData: {
2284
2438
  code: ZodIssueCode.invalid_return_type,
@@ -2348,17 +2502,17 @@ class ZodFunction extends ZodType {
2348
2502
  const validatedFunc = this.parse(func);
2349
2503
  return validatedFunc;
2350
2504
  }
2505
+ static create(args, returns, params) {
2506
+ return new ZodFunction({
2507
+ args: (args
2508
+ ? args
2509
+ : ZodTuple.create([]).rest(ZodUnknown.create())),
2510
+ returns: returns || ZodUnknown.create(),
2511
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
2512
+ ...processCreateParams(params),
2513
+ });
2514
+ }
2351
2515
  }
2352
- ZodFunction.create = (args, returns, params) => {
2353
- return new ZodFunction({
2354
- args: (args
2355
- ? args.rest(ZodUnknown.create())
2356
- : ZodTuple.create([]).rest(ZodUnknown.create())),
2357
- returns: returns || ZodUnknown.create(),
2358
- typeName: ZodFirstPartyTypeKind.ZodFunction,
2359
- ...processCreateParams(params),
2360
- });
2361
- };
2362
2516
  class ZodLazy extends ZodType {
2363
2517
  get schema() {
2364
2518
  return this._def.getter();
@@ -2739,6 +2893,21 @@ ZodNaN.create = (params) => {
2739
2893
  ...processCreateParams(params),
2740
2894
  });
2741
2895
  };
2896
+ const BRAND = Symbol("zod_brand");
2897
+ class ZodBranded extends ZodType {
2898
+ _parse(input) {
2899
+ const { ctx } = this._processInputParams(input);
2900
+ const data = ctx.data;
2901
+ return this._def.type._parse({
2902
+ data,
2903
+ path: ctx.path,
2904
+ parent: ctx,
2905
+ });
2906
+ }
2907
+ unwrap() {
2908
+ return this._def.type;
2909
+ }
2910
+ }
2742
2911
  const custom = (check, params = {}, fatal) => {
2743
2912
  if (check)
2744
2913
  return ZodAny.create().superRefine((data, ctx) => {
@@ -2786,7 +2955,14 @@ var ZodFirstPartyTypeKind;
2786
2955
  ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
2787
2956
  ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
2788
2957
  ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
2958
+ ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
2789
2959
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
2960
+ // new approach that works for abstract classes
2961
+ // but required TS 4.4+
2962
+ // abstract class Class {
2963
+ // constructor(..._: any[]) {}
2964
+ // }
2965
+ // const instanceOfType = <T extends typeof Class>(
2790
2966
  const instanceOfType = (cls, params = {
2791
2967
  message: `Input not instance of ${cls.name}`,
2792
2968
  }) => custom((data) => data instanceof cls, params, true);
@@ -2825,11 +3001,15 @@ const preprocessType = ZodEffects.createWithPreprocess;
2825
3001
  const ostring = () => stringType().optional();
2826
3002
  const onumber = () => numberType().optional();
2827
3003
  const oboolean = () => booleanType().optional();
3004
+ const NEVER = INVALID;
2828
3005
 
2829
3006
  var mod = /*#__PURE__*/Object.freeze({
2830
3007
  __proto__: null,
2831
3008
  getParsedType: getParsedType,
2832
3009
  ZodParsedType: ZodParsedType,
3010
+ defaultErrorMap: errorMap,
3011
+ setErrorMap: setErrorMap,
3012
+ getErrorMap: getErrorMap,
2833
3013
  makeIssue: makeIssue,
2834
3014
  EMPTY_PATH: EMPTY_PATH,
2835
3015
  addIssueToContext: addIssueToContext,
@@ -2875,6 +3055,8 @@ var mod = /*#__PURE__*/Object.freeze({
2875
3055
  ZodNullable: ZodNullable,
2876
3056
  ZodDefault: ZodDefault,
2877
3057
  ZodNaN: ZodNaN,
3058
+ BRAND: BRAND,
3059
+ ZodBranded: ZodBranded,
2878
3060
  custom: custom,
2879
3061
  Schema: ZodType,
2880
3062
  ZodSchema: ZodType,
@@ -2917,12 +3099,10 @@ var mod = /*#__PURE__*/Object.freeze({
2917
3099
  union: unionType,
2918
3100
  unknown: unknownType,
2919
3101
  'void': voidType,
3102
+ NEVER: NEVER,
2920
3103
  ZodIssueCode: ZodIssueCode,
2921
3104
  quotelessJson: quotelessJson,
2922
- ZodError: ZodError,
2923
- defaultErrorMap: defaultErrorMap,
2924
- get overrideErrorMap () { return overrideErrorMap; },
2925
- setErrorMap: setErrorMap
3105
+ ZodError: ZodError
2926
3106
  });
2927
3107
 
2928
3108
  var ContextValidator = mod.string().array();
@@ -2930,11 +3110,13 @@ mod.object({
2930
3110
  type: mod.string().optional(),
2931
3111
  narrative: mod.string().optional()
2932
3112
  });
2933
- var ImageValidator = mod.string().or(mod.object({
2934
- id: mod.string(),
2935
- type: mod.string(),
2936
- caption: mod.string().optional()
2937
- }));
3113
+ var ImageValidator = mod.string().or(
3114
+ mod.object({
3115
+ id: mod.string(),
3116
+ type: mod.string(),
3117
+ caption: mod.string().optional()
3118
+ })
3119
+ );
2938
3120
  var GeoCoordinatesValidator = mod.object({
2939
3121
  type: mod.string().min(1).or(mod.string().array().nonempty()),
2940
3122
  latitude: mod.number(),
@@ -2976,29 +3158,31 @@ var IdentifierEntryValidator = mod.object({
2976
3158
  identifier: mod.string(),
2977
3159
  identifierType: IdentifierTypeValidator
2978
3160
  });
2979
- var ProfileValidator = mod.string().or(mod.object({
2980
- id: mod.string().optional(),
2981
- type: mod.string().or(mod.string().array().nonempty().optional()),
2982
- name: mod.string().optional(),
2983
- url: mod.string().optional(),
2984
- phone: mod.string().optional(),
2985
- description: mod.string().optional(),
2986
- endorsement: mod.any().array().optional(),
2987
- image: ImageValidator.optional(),
2988
- email: mod.string().email().optional(),
2989
- address: AddressValidator.optional(),
2990
- otherIdentifier: IdentifierEntryValidator.array().optional(),
2991
- official: mod.string().optional(),
2992
- parentOrg: mod.any().optional(),
2993
- familyName: mod.string().optional(),
2994
- givenName: mod.string().optional(),
2995
- additionalName: mod.string().optional(),
2996
- patronymicName: mod.string().optional(),
2997
- honorificPrefix: mod.string().optional(),
2998
- honorificSuffix: mod.string().optional(),
2999
- familyNamePrefix: mod.string().optional(),
3000
- dateOfBirth: mod.string().optional()
3001
- }).catchall(mod.any()));
3161
+ var ProfileValidator = mod.string().or(
3162
+ mod.object({
3163
+ id: mod.string().optional(),
3164
+ type: mod.string().or(mod.string().array().nonempty().optional()),
3165
+ name: mod.string().optional(),
3166
+ url: mod.string().optional(),
3167
+ phone: mod.string().optional(),
3168
+ description: mod.string().optional(),
3169
+ endorsement: mod.any().array().optional(),
3170
+ image: ImageValidator.optional(),
3171
+ email: mod.string().email().optional(),
3172
+ address: AddressValidator.optional(),
3173
+ otherIdentifier: IdentifierEntryValidator.array().optional(),
3174
+ official: mod.string().optional(),
3175
+ parentOrg: mod.any().optional(),
3176
+ familyName: mod.string().optional(),
3177
+ givenName: mod.string().optional(),
3178
+ additionalName: mod.string().optional(),
3179
+ patronymicName: mod.string().optional(),
3180
+ honorificPrefix: mod.string().optional(),
3181
+ honorificSuffix: mod.string().optional(),
3182
+ familyNamePrefix: mod.string().optional(),
3183
+ dateOfBirth: mod.string().optional()
3184
+ }).catchall(mod.any())
3185
+ );
3002
3186
  var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
3003
3187
  var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() });
3004
3188
  var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() });
@@ -3309,4 +3493,4 @@ const VCVerificationPill = ({
3309
3493
  };
3310
3494
 
3311
3495
  export { ValidationStateIndicator as V, VCVerificationPill as a };
3312
- //# sourceMappingURL=VCVerificationPill-26519af1.js.map
3496
+ //# sourceMappingURL=VCVerificationPill-09889426.js.map