@agimon-ai/browse-tool 0.8.4 → 0.8.6

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.
@@ -63,7 +63,8 @@ var ExtensionTelemetryClient = class {
63
63
  headers: { Accept: "application/json" }
64
64
  });
65
65
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
66
- this.config = await response.json();
66
+ const config = await response.json();
67
+ this.config = config;
67
68
  this.configuredServerOrigin = requestOrigin;
68
69
  } catch {
69
70
  this.config = {
@@ -159,7 +160,9 @@ var ExtensionTelemetryClient = class {
159
160
  }
160
161
  };
161
162
  var extensionTelemetryClient = new ExtensionTelemetryClient();
162
- Object.freeze({ status: "aborted" });
163
+ //#endregion
164
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/core.js
165
+ var _a$1;
163
166
  function $constructor(name, initializer, params) {
164
167
  function init(inst, def) {
165
168
  if (!inst._zod) Object.defineProperty(inst, "_zod", {
@@ -210,13 +213,14 @@ var $ZodEncodeError = class extends Error {
210
213
  this.name = "ZodEncodeError";
211
214
  }
212
215
  };
213
- var globalConfig = {};
216
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
217
+ var globalConfig = globalThis.__zod_globalConfig;
214
218
  function config(newConfig) {
215
219
  if (newConfig) Object.assign(globalConfig, newConfig);
216
220
  return globalConfig;
217
221
  }
218
222
  //#endregion
219
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
223
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/util.js
220
224
  function getEnumValues(entries) {
221
225
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
222
226
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -244,17 +248,13 @@ function cleanRegex(source) {
244
248
  return source.slice(start, end);
245
249
  }
246
250
  function floatSafeRemainder(val, step) {
247
- const valDecCount = (val.toString().split(".")[1] || "").length;
248
- const stepString = step.toString();
249
- let stepDecCount = (stepString.split(".")[1] || "").length;
250
- if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
251
- const match = stepString.match(/\d?e-(\d?)/);
252
- if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
253
- }
254
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
255
- return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
251
+ const ratio = val / step;
252
+ const roundedRatio = Math.round(ratio);
253
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
254
+ if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
255
+ return ratio - roundedRatio;
256
256
  }
257
- var EVALUATING = Symbol("evaluating");
257
+ var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
258
258
  function defineLazy(object, key, getter) {
259
259
  let value = void 0;
260
260
  Object.defineProperty(object, key, {
@@ -295,7 +295,8 @@ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace :
295
295
  function isObject(data) {
296
296
  return typeof data === "object" && data !== null && !Array.isArray(data);
297
297
  }
298
- var allowsEval = cached(() => {
298
+ var allowsEval = /* @__PURE__ */ cached(() => {
299
+ if (globalConfig.jitless) return false;
299
300
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
300
301
  try {
301
302
  new Function("");
@@ -317,9 +318,11 @@ function isPlainObject(o) {
317
318
  function shallowClone(o) {
318
319
  if (isPlainObject(o)) return { ...o };
319
320
  if (Array.isArray(o)) return [...o];
321
+ if (o instanceof Map) return new Map(o);
322
+ if (o instanceof Set) return new Set(o);
320
323
  return o;
321
324
  }
322
- var propertyKeyTypes = new Set([
325
+ var propertyKeyTypes = /* @__PURE__ */ new Set([
323
326
  "string",
324
327
  "number",
325
328
  "symbol"
@@ -423,6 +426,7 @@ function safeExtend(schema, shape) {
423
426
  } }));
424
427
  }
425
428
  function merge(a, b) {
429
+ if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
426
430
  return clone(a, mergeDefs(a._zod.def, {
427
431
  get shape() {
428
432
  const _shape = {
@@ -435,7 +439,7 @@ function merge(a, b) {
435
439
  get catchall() {
436
440
  return b._zod.def.catchall;
437
441
  },
438
- checks: []
442
+ checks: b._zod.def.checks ?? []
439
443
  }));
440
444
  }
441
445
  function partial(Class, schema, mask) {
@@ -488,6 +492,11 @@ function aborted(x, startIndex = 0) {
488
492
  for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
489
493
  return false;
490
494
  }
495
+ function explicitlyAborted(x, startIndex = 0) {
496
+ if (x.aborted === true) return true;
497
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
498
+ return false;
499
+ }
491
500
  function prefixIssues(path, issues) {
492
501
  return issues.map((iss) => {
493
502
  var _a;
@@ -500,15 +509,12 @@ function unwrapMessage(message) {
500
509
  return typeof message === "string" ? message : message?.message;
501
510
  }
502
511
  function finalizeIssue(iss, ctx, config) {
503
- const full = {
504
- ...iss,
505
- path: iss.path ?? []
506
- };
507
- if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
508
- delete full.inst;
509
- delete full.continue;
510
- if (!ctx?.reportInput) delete full.input;
511
- return full;
512
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
513
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
514
+ rest.path ?? (rest.path = []);
515
+ rest.message = message;
516
+ if (ctx?.reportInput) rest.input = _input;
517
+ return rest;
512
518
  }
513
519
  function getLengthableOrigin(input) {
514
520
  if (Array.isArray(input)) return "array";
@@ -526,7 +532,7 @@ function issue(...args) {
526
532
  return { ...iss };
527
533
  }
528
534
  //#endregion
529
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
535
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/errors.js
530
536
  var initializer$1 = (inst, def) => {
531
537
  inst.name = "$ZodError";
532
538
  Object.defineProperty(inst, "_zod", {
@@ -559,23 +565,26 @@ function flattenError(error, mapper = (issue) => issue.message) {
559
565
  }
560
566
  function formatError(error, mapper = (issue) => issue.message) {
561
567
  const fieldErrors = { _errors: [] };
562
- const processError = (error) => {
563
- for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
564
- else if (issue.code === "invalid_key") processError({ issues: issue.issues });
565
- else if (issue.code === "invalid_element") processError({ issues: issue.issues });
566
- else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
568
+ const processError = (error, path = []) => {
569
+ for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
570
+ else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
571
+ else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
567
572
  else {
568
- let curr = fieldErrors;
569
- let i = 0;
570
- while (i < issue.path.length) {
571
- const el = issue.path[i];
572
- if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
573
- else {
574
- curr[el] = curr[el] || { _errors: [] };
575
- curr[el]._errors.push(mapper(issue));
573
+ const fullpath = [...path, ...issue.path];
574
+ if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
575
+ else {
576
+ let curr = fieldErrors;
577
+ let i = 0;
578
+ while (i < fullpath.length) {
579
+ const el = fullpath[i];
580
+ if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
581
+ else {
582
+ curr[el] = curr[el] || { _errors: [] };
583
+ curr[el]._errors.push(mapper(issue));
584
+ }
585
+ curr = curr[el];
586
+ i++;
576
587
  }
577
- curr = curr[el];
578
- i++;
579
588
  }
580
589
  }
581
590
  };
@@ -583,9 +592,12 @@ function formatError(error, mapper = (issue) => issue.message) {
583
592
  return fieldErrors;
584
593
  }
585
594
  //#endregion
586
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
595
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/parse.js
587
596
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
588
- const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
597
+ const ctx = _ctx ? {
598
+ ..._ctx,
599
+ async: false
600
+ } : { async: false };
589
601
  const result = schema._zod.run({
590
602
  value,
591
603
  issues: []
@@ -599,7 +611,10 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
599
611
  return result.value;
600
612
  };
601
613
  var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
602
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
614
+ const ctx = _ctx ? {
615
+ ..._ctx,
616
+ async: true
617
+ } : { async: true };
603
618
  let result = schema._zod.run({
604
619
  value,
605
620
  issues: []
@@ -632,7 +647,10 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
632
647
  };
633
648
  var safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
634
649
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
635
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
650
+ const ctx = _ctx ? {
651
+ ..._ctx,
652
+ async: true
653
+ } : { async: true };
636
654
  let result = schema._zod.run({
637
655
  value,
638
656
  issues: []
@@ -648,36 +666,53 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
648
666
  };
649
667
  var safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
650
668
  var _encode = (_Err) => (schema, value, _ctx) => {
651
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
669
+ const ctx = _ctx ? {
670
+ ..._ctx,
671
+ direction: "backward"
672
+ } : { direction: "backward" };
652
673
  return _parse(_Err)(schema, value, ctx);
653
674
  };
654
675
  var _decode = (_Err) => (schema, value, _ctx) => {
655
676
  return _parse(_Err)(schema, value, _ctx);
656
677
  };
657
678
  var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
658
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
679
+ const ctx = _ctx ? {
680
+ ..._ctx,
681
+ direction: "backward"
682
+ } : { direction: "backward" };
659
683
  return _parseAsync(_Err)(schema, value, ctx);
660
684
  };
661
685
  var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
662
686
  return _parseAsync(_Err)(schema, value, _ctx);
663
687
  };
664
688
  var _safeEncode = (_Err) => (schema, value, _ctx) => {
665
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
689
+ const ctx = _ctx ? {
690
+ ..._ctx,
691
+ direction: "backward"
692
+ } : { direction: "backward" };
666
693
  return _safeParse(_Err)(schema, value, ctx);
667
694
  };
668
695
  var _safeDecode = (_Err) => (schema, value, _ctx) => {
669
696
  return _safeParse(_Err)(schema, value, _ctx);
670
697
  };
671
698
  var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
672
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
699
+ const ctx = _ctx ? {
700
+ ..._ctx,
701
+ direction: "backward"
702
+ } : { direction: "backward" };
673
703
  return _safeParseAsync(_Err)(schema, value, ctx);
674
704
  };
675
705
  var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
676
706
  return _safeParseAsync(_Err)(schema, value, _ctx);
677
707
  };
678
708
  //#endregion
679
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
680
- var cuid = /^[cC][^\s-]{8,}$/;
709
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/regexes.js
710
+ /**
711
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
712
+ * (timestamps embedded in the id). Use {@link cuid2} instead.
713
+ * See https://github.com/paralleldrive/cuid.
714
+ */
715
+ var cuid = /^[cC][0-9a-z]{6,}$/;
681
716
  var cuid2 = /^[0-9a-z]+$/;
682
717
  var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
683
718
  var xid = /^[0-9a-vA-V]{20}$/;
@@ -706,6 +741,7 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
706
741
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
707
742
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
708
743
  var base64url = /^[A-Za-z0-9_-]*$/;
744
+ var httpProtocol = /^https?$/;
709
745
  var e164 = /^\+[1-9]\d{6,14}$/;
710
746
  var dateSource = `(?:(?:\\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])))`;
711
747
  var date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
@@ -734,7 +770,7 @@ var boolean$1 = /^(?:true|false)$/i;
734
770
  var lowercase = /^[^A-Z]*$/;
735
771
  var uppercase = /^[^a-z]*$/;
736
772
  //#endregion
737
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
773
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/checks.js
738
774
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
739
775
  var _a;
740
776
  inst._zod ?? (inst._zod = {});
@@ -1092,7 +1128,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
1092
1128
  };
1093
1129
  });
1094
1130
  //#endregion
1095
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
1131
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/doc.js
1096
1132
  var Doc = class {
1097
1133
  constructor(args = []) {
1098
1134
  this.content = [];
@@ -1123,14 +1159,14 @@ var Doc = class {
1123
1159
  }
1124
1160
  };
1125
1161
  //#endregion
1126
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
1162
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/versions.js
1127
1163
  var version = {
1128
1164
  major: 4,
1129
- minor: 3,
1130
- patch: 6
1165
+ minor: 4,
1166
+ patch: 1
1131
1167
  };
1132
1168
  //#endregion
1133
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
1169
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/schemas.js
1134
1170
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1135
1171
  var _a;
1136
1172
  inst ?? (inst = {});
@@ -1151,6 +1187,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1151
1187
  let asyncResult;
1152
1188
  for (const ch of checks) {
1153
1189
  if (ch._zod.def.when) {
1190
+ if (explicitlyAborted(payload)) continue;
1154
1191
  if (!ch._zod.def.when(payload)) continue;
1155
1192
  } else if (isAborted) continue;
1156
1193
  const currLen = payload.issues.length;
@@ -1270,6 +1307,19 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1270
1307
  inst._zod.check = (payload) => {
1271
1308
  try {
1272
1309
  const trimmed = payload.value.trim();
1310
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1311
+ if (!/^https?:\/\//i.test(trimmed)) {
1312
+ payload.issues.push({
1313
+ code: "invalid_format",
1314
+ format: "url",
1315
+ note: "Invalid URL format",
1316
+ input: payload.value,
1317
+ inst,
1318
+ continue: !def.abort
1319
+ });
1320
+ return;
1321
+ }
1322
+ }
1273
1323
  const url = new URL(trimmed);
1274
1324
  if (def.hostname) {
1275
1325
  def.hostname.lastIndex = 0;
@@ -1317,6 +1367,11 @@ var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
1317
1367
  def.pattern ?? (def.pattern = nanoid);
1318
1368
  $ZodStringFormat.init(inst, def);
1319
1369
  });
1370
+ /**
1371
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
1372
+ * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
1373
+ * See https://github.com/paralleldrive/cuid.
1374
+ */
1320
1375
  var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
1321
1376
  def.pattern ?? (def.pattern = cuid);
1322
1377
  $ZodStringFormat.init(inst, def);
@@ -1406,6 +1461,7 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1406
1461
  });
1407
1462
  function isValidBase64(data) {
1408
1463
  if (data === "") return true;
1464
+ if (/\s/.test(data)) return false;
1409
1465
  if (data.length % 4 !== 0) return false;
1410
1466
  try {
1411
1467
  atob(data);
@@ -1571,13 +1627,23 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1571
1627
  return payload;
1572
1628
  };
1573
1629
  });
1574
- function handlePropertyResult(result, final, key, input, isOptionalOut) {
1630
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1631
+ const isPresent = key in input;
1575
1632
  if (result.issues.length) {
1576
- if (isOptionalOut && !(key in input)) return;
1633
+ if (isOptionalIn && isOptionalOut && !isPresent) return;
1577
1634
  final.issues.push(...prefixIssues(key, result.issues));
1578
1635
  }
1636
+ if (!isPresent && !isOptionalIn) {
1637
+ if (!result.issues.length) final.issues.push({
1638
+ code: "invalid_type",
1639
+ expected: "nonoptional",
1640
+ input: void 0,
1641
+ path: [key]
1642
+ });
1643
+ return;
1644
+ }
1579
1645
  if (result.value === void 0) {
1580
- if (key in input) final.value[key] = void 0;
1646
+ if (isPresent) final.value[key] = void 0;
1581
1647
  } else final.value[key] = result.value;
1582
1648
  }
1583
1649
  function normalizeDef(def) {
@@ -1597,8 +1663,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1597
1663
  const keySet = def.keySet;
1598
1664
  const _catchall = def.catchall._zod;
1599
1665
  const t = _catchall.def.type;
1666
+ const isOptionalIn = _catchall.optin === "optional";
1600
1667
  const isOptionalOut = _catchall.optout === "optional";
1601
1668
  for (const key in input) {
1669
+ if (key === "__proto__") continue;
1602
1670
  if (keySet.has(key)) continue;
1603
1671
  if (t === "never") {
1604
1672
  unrecognized.push(key);
@@ -1608,8 +1676,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1608
1676
  value: input[key],
1609
1677
  issues: []
1610
1678
  }, ctx);
1611
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1612
- else handlePropertyResult(r, payload, key, input, isOptionalOut);
1679
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1680
+ else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1613
1681
  }
1614
1682
  if (unrecognized.length) payload.issues.push({
1615
1683
  code: "unrecognized_keys",
@@ -1645,13 +1713,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1645
1713
  }
1646
1714
  return propValues;
1647
1715
  });
1648
- const isObject$2 = isObject;
1716
+ const isObject$1 = isObject;
1649
1717
  const catchall = def.catchall;
1650
1718
  let value;
1651
1719
  inst._zod.parse = (payload, ctx) => {
1652
1720
  value ?? (value = _normalized.value);
1653
1721
  const input = payload.value;
1654
- if (!isObject$2(input)) {
1722
+ if (!isObject$1(input)) {
1655
1723
  payload.issues.push({
1656
1724
  expected: "object",
1657
1725
  code: "invalid_type",
@@ -1665,13 +1733,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1665
1733
  const shape = value.shape;
1666
1734
  for (const key of value.keys) {
1667
1735
  const el = shape[key];
1736
+ const isOptionalIn = el._zod.optin === "optional";
1668
1737
  const isOptionalOut = el._zod.optout === "optional";
1669
1738
  const r = el._zod.run({
1670
1739
  value: input[key],
1671
1740
  issues: []
1672
1741
  }, ctx);
1673
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1674
- else handlePropertyResult(r, payload, key, input, isOptionalOut);
1742
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1743
+ else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1675
1744
  }
1676
1745
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1677
1746
  return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
@@ -1700,9 +1769,11 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
1700
1769
  for (const key of normalized.keys) {
1701
1770
  const id = ids[key];
1702
1771
  const k = esc(key);
1703
- const isOptionalOut = shape[key]?._zod?.optout === "optional";
1772
+ const schema = shape[key];
1773
+ const isOptionalIn = schema?._zod?.optin === "optional";
1774
+ const isOptionalOut = schema?._zod?.optout === "optional";
1704
1775
  doc.write(`const ${id} = ${parseStr(key)};`);
1705
- if (isOptionalOut) doc.write(`
1776
+ if (isOptionalIn && isOptionalOut) doc.write(`
1706
1777
  if (${id}.issues.length) {
1707
1778
  if (${k} in input) {
1708
1779
  payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
@@ -1720,6 +1791,32 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
1720
1791
  newResult[${k}] = ${id}.value;
1721
1792
  }
1722
1793
 
1794
+ `);
1795
+ else if (!isOptionalIn) doc.write(`
1796
+ const ${id}_present = ${k} in input;
1797
+ if (${id}.issues.length) {
1798
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1799
+ ...iss,
1800
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1801
+ })));
1802
+ }
1803
+ if (!${id}_present && !${id}.issues.length) {
1804
+ payload.issues.push({
1805
+ code: "invalid_type",
1806
+ expected: "nonoptional",
1807
+ input: undefined,
1808
+ path: [${k}]
1809
+ });
1810
+ }
1811
+
1812
+ if (${id}_present) {
1813
+ if (${id}.value === undefined) {
1814
+ newResult[${k}] = undefined;
1815
+ } else {
1816
+ newResult[${k}] = ${id}.value;
1817
+ }
1818
+ }
1819
+
1723
1820
  `);
1724
1821
  else doc.write(`
1725
1822
  if (${id}.issues.length) {
@@ -1745,7 +1842,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
1745
1842
  return (payload, ctx) => fn(shape, payload, ctx);
1746
1843
  };
1747
1844
  let fastpass;
1748
- const isObject$1 = isObject;
1845
+ const isObject$2 = isObject;
1749
1846
  const jit = !globalConfig.jitless;
1750
1847
  const fastEnabled = jit && allowsEval.value;
1751
1848
  const catchall = def.catchall;
@@ -1753,7 +1850,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
1753
1850
  inst._zod.parse = (payload, ctx) => {
1754
1851
  value ?? (value = _normalized.value);
1755
1852
  const input = payload.value;
1756
- if (!isObject$1(input)) {
1853
+ if (!isObject$2(input)) {
1757
1854
  payload.issues.push({
1758
1855
  expected: "object",
1759
1856
  code: "invalid_type",
@@ -1802,10 +1899,9 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1802
1899
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1803
1900
  }
1804
1901
  });
1805
- const single = def.options.length === 1;
1806
- const first = def.options[0]._zod.run;
1902
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
1807
1903
  inst._zod.parse = (payload, ctx) => {
1808
- if (single) return first(payload, ctx);
1904
+ if (first) return first(payload, ctx);
1809
1905
  let async = false;
1810
1906
  const results = [];
1811
1907
  for (const option of def.options) {
@@ -1869,12 +1965,13 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
1869
1965
  }
1870
1966
  const opt = disc.value.get(input?.[def.discriminator]);
1871
1967
  if (opt) return opt._zod.run(payload, ctx);
1872
- if (def.unionFallback) return _super(payload, ctx);
1968
+ if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
1873
1969
  payload.issues.push({
1874
1970
  code: "invalid_union",
1875
1971
  errors: [],
1876
1972
  note: "No matching discriminator",
1877
1973
  discriminator: def.discriminator,
1974
+ options: Array.from(disc.value.keys()),
1878
1975
  input,
1879
1976
  path: [def.discriminator],
1880
1977
  inst
@@ -2001,17 +2098,34 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
2001
2098
  const recordKeys = /* @__PURE__ */ new Set();
2002
2099
  for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2003
2100
  recordKeys.add(typeof key === "number" ? key.toString() : key);
2101
+ const keyResult = def.keyType._zod.run({
2102
+ value: key,
2103
+ issues: []
2104
+ }, ctx);
2105
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2106
+ if (keyResult.issues.length) {
2107
+ payload.issues.push({
2108
+ code: "invalid_key",
2109
+ origin: "record",
2110
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2111
+ input: key,
2112
+ path: [key],
2113
+ inst
2114
+ });
2115
+ continue;
2116
+ }
2117
+ const outKey = keyResult.value;
2004
2118
  const result = def.valueType._zod.run({
2005
2119
  value: input[key],
2006
2120
  issues: []
2007
2121
  }, ctx);
2008
2122
  if (result instanceof Promise) proms.push(result.then((result) => {
2009
2123
  if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2010
- payload.value[key] = result.value;
2124
+ payload.value[outKey] = result.value;
2011
2125
  }));
2012
2126
  else {
2013
2127
  if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2014
- payload.value[key] = result.value;
2128
+ payload.value[outKey] = result.value;
2015
2129
  }
2016
2130
  }
2017
2131
  let unrecognized;
@@ -2029,6 +2143,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
2029
2143
  payload.value = {};
2030
2144
  for (const key of Reflect.ownKeys(input)) {
2031
2145
  if (key === "__proto__") continue;
2146
+ if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
2032
2147
  let keyResult = def.keyType._zod.run({
2033
2148
  value: key,
2034
2149
  issues: []
@@ -2330,7 +2445,7 @@ function handleRefineResult(result, payload, input, inst) {
2330
2445
  }
2331
2446
  }
2332
2447
  //#endregion
2333
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
2448
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/registries.js
2334
2449
  var _a;
2335
2450
  var $ZodRegistry = class {
2336
2451
  constructor() {
@@ -2377,7 +2492,7 @@ function registry() {
2377
2492
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2378
2493
  var globalRegistry = globalThis.__zod_globalRegistry;
2379
2494
  //#endregion
2380
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
2495
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/api.js
2381
2496
  /* @__NO_SIDE_EFFECTS__ */
2382
2497
  function _string(Class, params) {
2383
2498
  return new Class({
@@ -2478,6 +2593,11 @@ function _nanoid(Class, params) {
2478
2593
  ...normalizeParams(params)
2479
2594
  });
2480
2595
  }
2596
+ /**
2597
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
2598
+ * (timestamps embedded in the id). Use {@link _cuid2} instead.
2599
+ * See https://github.com/paralleldrive/cuid.
2600
+ */
2481
2601
  /* @__NO_SIDE_EFFECTS__ */
2482
2602
  function _cuid(Class, params) {
2483
2603
  return new Class({
@@ -2849,7 +2969,7 @@ function _refine(Class, fn, _params) {
2849
2969
  });
2850
2970
  }
2851
2971
  /* @__NO_SIDE_EFFECTS__ */
2852
- function _superRefine(fn) {
2972
+ function _superRefine(fn, params) {
2853
2973
  const ch = /* @__PURE__ */ _check((payload) => {
2854
2974
  payload.addIssue = (issue$2) => {
2855
2975
  if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
@@ -2864,7 +2984,7 @@ function _superRefine(fn) {
2864
2984
  }
2865
2985
  };
2866
2986
  return fn(payload.value, payload);
2867
- });
2987
+ }, params);
2868
2988
  return ch;
2869
2989
  }
2870
2990
  /* @__NO_SIDE_EFFECTS__ */
@@ -2877,7 +2997,7 @@ function _check(fn, params) {
2877
2997
  return ch;
2878
2998
  }
2879
2999
  //#endregion
2880
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
3000
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/to-json-schema.js
2881
3001
  function initializeContext(params) {
2882
3002
  let target = params?.target ?? "draft-2020-12";
2883
3003
  if (target === "draft-4") target = "draft-04";
@@ -2943,7 +3063,7 @@ function process(schema, ctx, _params = {
2943
3063
  delete result.schema.examples;
2944
3064
  delete result.schema.default;
2945
3065
  }
2946
- if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
3066
+ if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
2947
3067
  delete result.schema._prefault;
2948
3068
  return ctx.seen.get(schema).schema;
2949
3069
  }
@@ -3083,10 +3203,15 @@ function finalize(ctx, schema) {
3083
3203
  result.$id = ctx.external.uri(id);
3084
3204
  }
3085
3205
  Object.assign(result, root.def ?? root.schema);
3206
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
3207
+ if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
3086
3208
  const defs = ctx.external?.defs ?? {};
3087
3209
  for (const entry of ctx.seen.entries()) {
3088
3210
  const seen = entry[1];
3089
- if (seen.def && seen.defId) defs[seen.defId] = seen.def;
3211
+ if (seen.def && seen.defId) {
3212
+ if (seen.def.id === seen.defId) delete seen.def.id;
3213
+ defs[seen.defId] = seen.def;
3214
+ }
3090
3215
  }
3091
3216
  if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
3092
3217
  else result.definitions = defs;
@@ -3162,7 +3287,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
3162
3287
  return finalize(ctx, schema);
3163
3288
  };
3164
3289
  //#endregion
3165
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
3290
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/core/json-schema-processors.js
3166
3291
  var formatMap = {
3167
3292
  guid: "uuid",
3168
3293
  url: "uri",
@@ -3196,24 +3321,19 @@ var numberProcessor = (schema, ctx, _json, _params) => {
3196
3321
  const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3197
3322
  if (typeof format === "string" && format.includes("int")) json.type = "integer";
3198
3323
  else json.type = "number";
3199
- if (typeof exclusiveMinimum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3324
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
3325
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
3326
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
3327
+ if (exMin) if (legacy) {
3200
3328
  json.minimum = exclusiveMinimum;
3201
3329
  json.exclusiveMinimum = true;
3202
3330
  } else json.exclusiveMinimum = exclusiveMinimum;
3203
- if (typeof minimum === "number") {
3204
- json.minimum = minimum;
3205
- if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
3206
- else delete json.exclusiveMinimum;
3207
- }
3208
- if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3331
+ else if (typeof minimum === "number") json.minimum = minimum;
3332
+ if (exMax) if (legacy) {
3209
3333
  json.maximum = exclusiveMaximum;
3210
3334
  json.exclusiveMaximum = true;
3211
3335
  } else json.exclusiveMaximum = exclusiveMaximum;
3212
- if (typeof maximum === "number") {
3213
- json.maximum = maximum;
3214
- if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
3215
- else delete json.exclusiveMaximum;
3216
- }
3336
+ else if (typeof maximum === "number") json.maximum = maximum;
3217
3337
  if (typeof multipleOf === "number") json.multipleOf = multipleOf;
3218
3338
  };
3219
3339
  var booleanProcessor = (_schema, _ctx, json, _params) => {
@@ -3429,7 +3549,7 @@ var optionalProcessor = (schema, ctx, _json, params) => {
3429
3549
  seen.ref = def.innerType;
3430
3550
  };
3431
3551
  //#endregion
3432
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
3552
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/classic/iso.js
3433
3553
  var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
3434
3554
  $ZodISODateTime.init(inst, def);
3435
3555
  ZodStringFormat.init(inst, def);
@@ -3459,7 +3579,7 @@ function duration(params) {
3459
3579
  return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
3460
3580
  }
3461
3581
  //#endregion
3462
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
3582
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/classic/errors.js
3463
3583
  var initializer = (inst, issues) => {
3464
3584
  $ZodError.init(inst, issues);
3465
3585
  inst.name = "ZodError";
@@ -3479,10 +3599,9 @@ var initializer = (inst, issues) => {
3479
3599
  } }
3480
3600
  });
3481
3601
  };
3482
- $constructor("ZodError", initializer);
3483
- var ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
3602
+ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, { Parent: Error });
3484
3603
  //#endregion
3485
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
3604
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/classic/parse.js
3486
3605
  var parse = /* @__PURE__ */ _parse(ZodRealError);
3487
3606
  var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3488
3607
  var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3496,7 +3615,43 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3496
3615
  var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3497
3616
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3498
3617
  //#endregion
3499
- //#region ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
3618
+ //#region ../../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/classic/schemas.js
3619
+ var _installedGroups = /* @__PURE__ */ new WeakMap();
3620
+ function _installLazyMethods(inst, group, methods) {
3621
+ const proto = Object.getPrototypeOf(inst);
3622
+ let installed = _installedGroups.get(proto);
3623
+ if (!installed) {
3624
+ installed = /* @__PURE__ */ new Set();
3625
+ _installedGroups.set(proto, installed);
3626
+ }
3627
+ if (installed.has(group)) return;
3628
+ installed.add(group);
3629
+ for (const key in methods) {
3630
+ const fn = methods[key];
3631
+ Object.defineProperty(proto, key, {
3632
+ configurable: true,
3633
+ enumerable: false,
3634
+ get() {
3635
+ const bound = fn.bind(this);
3636
+ Object.defineProperty(this, key, {
3637
+ configurable: true,
3638
+ writable: true,
3639
+ enumerable: true,
3640
+ value: bound
3641
+ });
3642
+ return bound;
3643
+ },
3644
+ set(v) {
3645
+ Object.defineProperty(this, key, {
3646
+ configurable: true,
3647
+ writable: true,
3648
+ enumerable: true,
3649
+ value: v
3650
+ });
3651
+ }
3652
+ });
3653
+ }
3654
+ }
3500
3655
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3501
3656
  $ZodType.init(inst, def);
3502
3657
  Object.assign(inst["~standard"], { jsonSchema: {
@@ -3507,20 +3662,6 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3507
3662
  inst.def = def;
3508
3663
  inst.type = def.type;
3509
3664
  Object.defineProperty(inst, "_def", { value: def });
3510
- inst.check = (...checks) => {
3511
- return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
3512
- check: ch,
3513
- def: { check: "custom" },
3514
- onattach: []
3515
- } } : ch)] }), { parent: true });
3516
- };
3517
- inst.with = inst.check;
3518
- inst.clone = (def, params) => clone(inst, def, params);
3519
- inst.brand = () => inst;
3520
- inst.register = ((reg, meta) => {
3521
- reg.add(inst, meta);
3522
- return inst;
3523
- });
3524
3665
  inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3525
3666
  inst.safeParse = (data, params) => safeParse(inst, data, params);
3526
3667
  inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
@@ -3534,43 +3675,106 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3534
3675
  inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3535
3676
  inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3536
3677
  inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3537
- inst.refine = (check, params) => inst.check(refine(check, params));
3538
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
3539
- inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite(fn));
3540
- inst.optional = () => optional(inst);
3541
- inst.exactOptional = () => exactOptional(inst);
3542
- inst.nullable = () => nullable(inst);
3543
- inst.nullish = () => optional(nullable(inst));
3544
- inst.nonoptional = (params) => nonoptional(inst, params);
3545
- inst.array = () => array(inst);
3546
- inst.or = (arg) => union([inst, arg]);
3547
- inst.and = (arg) => intersection(inst, arg);
3548
- inst.transform = (tx) => pipe(inst, transform(tx));
3549
- inst.default = (def) => _default(inst, def);
3550
- inst.prefault = (def) => prefault(inst, def);
3551
- inst.catch = (params) => _catch(inst, params);
3552
- inst.pipe = (target) => pipe(inst, target);
3553
- inst.readonly = () => readonly(inst);
3554
- inst.describe = (description) => {
3555
- const cl = inst.clone();
3556
- globalRegistry.add(cl, { description });
3557
- return cl;
3558
- };
3678
+ _installLazyMethods(inst, "ZodType", {
3679
+ check(...chks) {
3680
+ const def = this.def;
3681
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3682
+ check: ch,
3683
+ def: { check: "custom" },
3684
+ onattach: []
3685
+ } } : ch)] }), { parent: true });
3686
+ },
3687
+ with(...chks) {
3688
+ return this.check(...chks);
3689
+ },
3690
+ clone(def, params) {
3691
+ return clone(this, def, params);
3692
+ },
3693
+ brand() {
3694
+ return this;
3695
+ },
3696
+ register(reg, meta) {
3697
+ reg.add(this, meta);
3698
+ return this;
3699
+ },
3700
+ refine(check, params) {
3701
+ return this.check(refine(check, params));
3702
+ },
3703
+ superRefine(refinement, params) {
3704
+ return this.check(superRefine(refinement, params));
3705
+ },
3706
+ overwrite(fn) {
3707
+ return this.check(/* @__PURE__ */ _overwrite(fn));
3708
+ },
3709
+ optional() {
3710
+ return optional(this);
3711
+ },
3712
+ exactOptional() {
3713
+ return exactOptional(this);
3714
+ },
3715
+ nullable() {
3716
+ return nullable(this);
3717
+ },
3718
+ nullish() {
3719
+ return optional(nullable(this));
3720
+ },
3721
+ nonoptional(params) {
3722
+ return nonoptional(this, params);
3723
+ },
3724
+ array() {
3725
+ return array(this);
3726
+ },
3727
+ or(arg) {
3728
+ return union([this, arg]);
3729
+ },
3730
+ and(arg) {
3731
+ return intersection(this, arg);
3732
+ },
3733
+ transform(tx) {
3734
+ return pipe(this, transform(tx));
3735
+ },
3736
+ default(d) {
3737
+ return _default(this, d);
3738
+ },
3739
+ prefault(d) {
3740
+ return prefault(this, d);
3741
+ },
3742
+ catch(params) {
3743
+ return _catch(this, params);
3744
+ },
3745
+ pipe(target) {
3746
+ return pipe(this, target);
3747
+ },
3748
+ readonly() {
3749
+ return readonly(this);
3750
+ },
3751
+ describe(description) {
3752
+ const cl = this.clone();
3753
+ globalRegistry.add(cl, { description });
3754
+ return cl;
3755
+ },
3756
+ meta(...args) {
3757
+ if (args.length === 0) return globalRegistry.get(this);
3758
+ const cl = this.clone();
3759
+ globalRegistry.add(cl, args[0]);
3760
+ return cl;
3761
+ },
3762
+ isOptional() {
3763
+ return this.safeParse(void 0).success;
3764
+ },
3765
+ isNullable() {
3766
+ return this.safeParse(null).success;
3767
+ },
3768
+ apply(fn) {
3769
+ return fn(this);
3770
+ }
3771
+ });
3559
3772
  Object.defineProperty(inst, "description", {
3560
3773
  get() {
3561
3774
  return globalRegistry.get(inst)?.description;
3562
3775
  },
3563
3776
  configurable: true
3564
3777
  });
3565
- inst.meta = (...args) => {
3566
- if (args.length === 0) return globalRegistry.get(inst);
3567
- const cl = inst.clone();
3568
- globalRegistry.add(cl, args[0]);
3569
- return cl;
3570
- };
3571
- inst.isOptional = () => inst.safeParse(void 0).success;
3572
- inst.isNullable = () => inst.safeParse(null).success;
3573
- inst.apply = (fn) => fn(inst);
3574
3778
  return inst;
3575
3779
  });
3576
3780
  /** @internal */
@@ -3582,21 +3786,53 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
3582
3786
  inst.format = bag.format ?? null;
3583
3787
  inst.minLength = bag.minimum ?? null;
3584
3788
  inst.maxLength = bag.maximum ?? null;
3585
- inst.regex = (...args) => inst.check(/* @__PURE__ */ _regex(...args));
3586
- inst.includes = (...args) => inst.check(/* @__PURE__ */ _includes(...args));
3587
- inst.startsWith = (...args) => inst.check(/* @__PURE__ */ _startsWith(...args));
3588
- inst.endsWith = (...args) => inst.check(/* @__PURE__ */ _endsWith(...args));
3589
- inst.min = (...args) => inst.check(/* @__PURE__ */ _minLength(...args));
3590
- inst.max = (...args) => inst.check(/* @__PURE__ */ _maxLength(...args));
3591
- inst.length = (...args) => inst.check(/* @__PURE__ */ _length(...args));
3592
- inst.nonempty = (...args) => inst.check(/* @__PURE__ */ _minLength(1, ...args));
3593
- inst.lowercase = (params) => inst.check(/* @__PURE__ */ _lowercase(params));
3594
- inst.uppercase = (params) => inst.check(/* @__PURE__ */ _uppercase(params));
3595
- inst.trim = () => inst.check(/* @__PURE__ */ _trim());
3596
- inst.normalize = (...args) => inst.check(/* @__PURE__ */ _normalize(...args));
3597
- inst.toLowerCase = () => inst.check(/* @__PURE__ */ _toLowerCase());
3598
- inst.toUpperCase = () => inst.check(/* @__PURE__ */ _toUpperCase());
3599
- inst.slugify = () => inst.check(/* @__PURE__ */ _slugify());
3789
+ _installLazyMethods(inst, "_ZodString", {
3790
+ regex(...args) {
3791
+ return this.check(/* @__PURE__ */ _regex(...args));
3792
+ },
3793
+ includes(...args) {
3794
+ return this.check(/* @__PURE__ */ _includes(...args));
3795
+ },
3796
+ startsWith(...args) {
3797
+ return this.check(/* @__PURE__ */ _startsWith(...args));
3798
+ },
3799
+ endsWith(...args) {
3800
+ return this.check(/* @__PURE__ */ _endsWith(...args));
3801
+ },
3802
+ min(...args) {
3803
+ return this.check(/* @__PURE__ */ _minLength(...args));
3804
+ },
3805
+ max(...args) {
3806
+ return this.check(/* @__PURE__ */ _maxLength(...args));
3807
+ },
3808
+ length(...args) {
3809
+ return this.check(/* @__PURE__ */ _length(...args));
3810
+ },
3811
+ nonempty(...args) {
3812
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
3813
+ },
3814
+ lowercase(params) {
3815
+ return this.check(/* @__PURE__ */ _lowercase(params));
3816
+ },
3817
+ uppercase(params) {
3818
+ return this.check(/* @__PURE__ */ _uppercase(params));
3819
+ },
3820
+ trim() {
3821
+ return this.check(/* @__PURE__ */ _trim());
3822
+ },
3823
+ normalize(...args) {
3824
+ return this.check(/* @__PURE__ */ _normalize(...args));
3825
+ },
3826
+ toLowerCase() {
3827
+ return this.check(/* @__PURE__ */ _toLowerCase());
3828
+ },
3829
+ toUpperCase() {
3830
+ return this.check(/* @__PURE__ */ _toUpperCase());
3831
+ },
3832
+ slugify() {
3833
+ return this.check(/* @__PURE__ */ _slugify());
3834
+ }
3835
+ });
3600
3836
  });
3601
3837
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
3602
3838
  $ZodString.init(inst, def);
@@ -3660,6 +3896,11 @@ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
3660
3896
  $ZodNanoID.init(inst, def);
3661
3897
  ZodStringFormat.init(inst, def);
3662
3898
  });
3899
+ /**
3900
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
3901
+ * (timestamps embedded in the id). Use {@link ZodCUID2} instead.
3902
+ * See https://github.com/paralleldrive/cuid.
3903
+ */
3663
3904
  var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
3664
3905
  $ZodCUID.init(inst, def);
3665
3906
  ZodStringFormat.init(inst, def);
@@ -3716,21 +3957,53 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
3716
3957
  $ZodNumber.init(inst, def);
3717
3958
  ZodType.init(inst, def);
3718
3959
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3719
- inst.gt = (value, params) => inst.check(/* @__PURE__ */ _gt(value, params));
3720
- inst.gte = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
3721
- inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
3722
- inst.lt = (value, params) => inst.check(/* @__PURE__ */ _lt(value, params));
3723
- inst.lte = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
3724
- inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
3725
- inst.int = (params) => inst.check(int(params));
3726
- inst.safe = (params) => inst.check(int(params));
3727
- inst.positive = (params) => inst.check(/* @__PURE__ */ _gt(0, params));
3728
- inst.nonnegative = (params) => inst.check(/* @__PURE__ */ _gte(0, params));
3729
- inst.negative = (params) => inst.check(/* @__PURE__ */ _lt(0, params));
3730
- inst.nonpositive = (params) => inst.check(/* @__PURE__ */ _lte(0, params));
3731
- inst.multipleOf = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
3732
- inst.step = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
3733
- inst.finite = () => inst;
3960
+ _installLazyMethods(inst, "ZodNumber", {
3961
+ gt(value, params) {
3962
+ return this.check(/* @__PURE__ */ _gt(value, params));
3963
+ },
3964
+ gte(value, params) {
3965
+ return this.check(/* @__PURE__ */ _gte(value, params));
3966
+ },
3967
+ min(value, params) {
3968
+ return this.check(/* @__PURE__ */ _gte(value, params));
3969
+ },
3970
+ lt(value, params) {
3971
+ return this.check(/* @__PURE__ */ _lt(value, params));
3972
+ },
3973
+ lte(value, params) {
3974
+ return this.check(/* @__PURE__ */ _lte(value, params));
3975
+ },
3976
+ max(value, params) {
3977
+ return this.check(/* @__PURE__ */ _lte(value, params));
3978
+ },
3979
+ int(params) {
3980
+ return this.check(int(params));
3981
+ },
3982
+ safe(params) {
3983
+ return this.check(int(params));
3984
+ },
3985
+ positive(params) {
3986
+ return this.check(/* @__PURE__ */ _gt(0, params));
3987
+ },
3988
+ nonnegative(params) {
3989
+ return this.check(/* @__PURE__ */ _gte(0, params));
3990
+ },
3991
+ negative(params) {
3992
+ return this.check(/* @__PURE__ */ _lt(0, params));
3993
+ },
3994
+ nonpositive(params) {
3995
+ return this.check(/* @__PURE__ */ _lte(0, params));
3996
+ },
3997
+ multipleOf(value, params) {
3998
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3999
+ },
4000
+ step(value, params) {
4001
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4002
+ },
4003
+ finite() {
4004
+ return this;
4005
+ }
4006
+ });
3734
4007
  const bag = inst._zod.bag;
3735
4008
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3736
4009
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
@@ -3777,11 +4050,23 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
3777
4050
  ZodType.init(inst, def);
3778
4051
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3779
4052
  inst.element = def.element;
3780
- inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength(minLength, params));
3781
- inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength(1, params));
3782
- inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength(maxLength, params));
3783
- inst.length = (len, params) => inst.check(/* @__PURE__ */ _length(len, params));
3784
- inst.unwrap = () => inst.element;
4053
+ _installLazyMethods(inst, "ZodArray", {
4054
+ min(n, params) {
4055
+ return this.check(/* @__PURE__ */ _minLength(n, params));
4056
+ },
4057
+ nonempty(params) {
4058
+ return this.check(/* @__PURE__ */ _minLength(1, params));
4059
+ },
4060
+ max(n, params) {
4061
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
4062
+ },
4063
+ length(n, params) {
4064
+ return this.check(/* @__PURE__ */ _length(n, params));
4065
+ },
4066
+ unwrap() {
4067
+ return this.element;
4068
+ }
4069
+ });
3785
4070
  });
3786
4071
  function array(element, params) {
3787
4072
  return /* @__PURE__ */ _array(ZodArray, element, params);
@@ -3793,38 +4078,62 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
3793
4078
  defineLazy(inst, "shape", () => {
3794
4079
  return def.shape;
3795
4080
  });
3796
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
3797
- inst.catchall = (catchall) => inst.clone({
3798
- ...inst._zod.def,
3799
- catchall
3800
- });
3801
- inst.passthrough = () => inst.clone({
3802
- ...inst._zod.def,
3803
- catchall: unknown()
3804
- });
3805
- inst.loose = () => inst.clone({
3806
- ...inst._zod.def,
3807
- catchall: unknown()
3808
- });
3809
- inst.strict = () => inst.clone({
3810
- ...inst._zod.def,
3811
- catchall: never()
3812
- });
3813
- inst.strip = () => inst.clone({
3814
- ...inst._zod.def,
3815
- catchall: void 0
4081
+ _installLazyMethods(inst, "ZodObject", {
4082
+ keyof() {
4083
+ return _enum(Object.keys(this._zod.def.shape));
4084
+ },
4085
+ catchall(catchall) {
4086
+ return this.clone({
4087
+ ...this._zod.def,
4088
+ catchall
4089
+ });
4090
+ },
4091
+ passthrough() {
4092
+ return this.clone({
4093
+ ...this._zod.def,
4094
+ catchall: unknown()
4095
+ });
4096
+ },
4097
+ loose() {
4098
+ return this.clone({
4099
+ ...this._zod.def,
4100
+ catchall: unknown()
4101
+ });
4102
+ },
4103
+ strict() {
4104
+ return this.clone({
4105
+ ...this._zod.def,
4106
+ catchall: never()
4107
+ });
4108
+ },
4109
+ strip() {
4110
+ return this.clone({
4111
+ ...this._zod.def,
4112
+ catchall: void 0
4113
+ });
4114
+ },
4115
+ extend(incoming) {
4116
+ return extend(this, incoming);
4117
+ },
4118
+ safeExtend(incoming) {
4119
+ return safeExtend(this, incoming);
4120
+ },
4121
+ merge(other) {
4122
+ return merge(this, other);
4123
+ },
4124
+ pick(mask) {
4125
+ return pick(this, mask);
4126
+ },
4127
+ omit(mask) {
4128
+ return omit(this, mask);
4129
+ },
4130
+ partial(...args) {
4131
+ return partial(ZodOptional, this, args[0]);
4132
+ },
4133
+ required(...args) {
4134
+ return required(ZodNonOptional, this, args[0]);
4135
+ }
3816
4136
  });
3817
- inst.extend = (incoming) => {
3818
- return extend(inst, incoming);
3819
- };
3820
- inst.safeExtend = (incoming) => {
3821
- return safeExtend(inst, incoming);
3822
- };
3823
- inst.merge = (other) => merge(inst, other);
3824
- inst.pick = (mask) => pick(inst, mask);
3825
- inst.omit = (mask) => omit(inst, mask);
3826
- inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
3827
- inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
3828
4137
  });
3829
4138
  function object(shape, params) {
3830
4139
  return new ZodObject({
@@ -3878,6 +4187,12 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
3878
4187
  inst.valueType = def.valueType;
3879
4188
  });
3880
4189
  function record(keyType, valueType, params) {
4190
+ if (!valueType || !valueType._zod) return new ZodRecord({
4191
+ type: "record",
4192
+ keyType: string(),
4193
+ valueType: keyType,
4194
+ ...normalizeParams(valueType)
4195
+ });
3881
4196
  return new ZodRecord({
3882
4197
  type: "record",
3883
4198
  keyType,
@@ -4099,8 +4414,8 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
4099
4414
  function refine(fn, _params = {}) {
4100
4415
  return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
4101
4416
  }
4102
- function superRefine(fn) {
4103
- return /* @__PURE__ */ _superRefine(fn);
4417
+ function superRefine(fn, params) {
4418
+ return /* @__PURE__ */ _superRefine(fn, params);
4104
4419
  }
4105
4420
  //#endregion
4106
4421
  //#region src/extension/protocol/messages.ts