@superfeedback/widget 0.0.27 → 0.0.29

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.
@@ -126,7 +126,7 @@ function assertNotEqual(f) {
126
126
  }
127
127
  function assertIs(f) {}
128
128
  function assertNever(f) {
129
- throw Error();
129
+ throw Error("Unexpected value in exhaustive check");
130
130
  }
131
131
  function assert(f) {}
132
132
  function getEnumValues(f) {
@@ -1145,8 +1145,8 @@ var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (f, V)
1145
1145
  }
1146
1146
  }, version = {
1147
1147
  major: 4,
1148
- minor: 1,
1149
- patch: 13
1148
+ minor: 2,
1149
+ patch: 1
1150
1150
  }, $ZodType = /* @__PURE__ */ $constructor("$ZodType", (f, V) => {
1151
1151
  var H;
1152
1152
  f ??= {}, f._zod.def = V, f._zod.bag = f._zod.bag || {}, f._zod.version = version;
@@ -1713,8 +1713,39 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (f, V) => {
1713
1713
  }
1714
1714
  return K ? Promise.all(q).then((V) => handleUnionResults(V, W, f, G)) : handleUnionResults(q, W, f, G);
1715
1715
  };
1716
+ });
1717
+ function handleExclusiveUnionResults(f, V, H, U) {
1718
+ let W = f.filter((f) => f.issues.length === 0);
1719
+ return W.length === 1 ? (V.value = W[0].value, V) : (W.length === 0 ? V.issues.push({
1720
+ code: "invalid_union",
1721
+ input: V.value,
1722
+ inst: H,
1723
+ errors: f.map((f) => f.issues.map((f) => finalizeIssue(f, U, config())))
1724
+ }) : V.issues.push({
1725
+ code: "invalid_union",
1726
+ input: V.value,
1727
+ inst: H,
1728
+ errors: [],
1729
+ inclusive: !1
1730
+ }), V);
1731
+ }
1732
+ var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (f, V) => {
1733
+ $ZodUnion.init(f, V), V.inclusive = !1;
1734
+ let H = V.options.length === 1, U = V.options[0]._zod.run;
1735
+ f._zod.parse = (W, G) => {
1736
+ if (H) return U(W, G);
1737
+ let K = !1, q = [];
1738
+ for (let f of V.options) {
1739
+ let V = f._zod.run({
1740
+ value: W.value,
1741
+ issues: []
1742
+ }, G);
1743
+ V instanceof Promise ? (q.push(V), K = !0) : q.push(V);
1744
+ }
1745
+ return K ? Promise.all(q).then((V) => handleExclusiveUnionResults(V, W, f, G)) : handleExclusiveUnionResults(q, W, f, G);
1746
+ };
1716
1747
  }), $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (f, V) => {
1717
- $ZodUnion.init(f, V);
1748
+ V.inclusive = !1, $ZodUnion.init(f, V);
1718
1749
  let H = f._zod.parse;
1719
1750
  defineLazy(f._zod, "propValues", () => {
1720
1751
  let f = {};
@@ -1919,14 +1950,14 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (f, V) => {
1919
1950
  }, U);
1920
1951
  if (q instanceof Promise) throw Error("Async schemas not supported in object keys currently");
1921
1952
  if (q.issues.length) {
1922
- H.issues.push({
1953
+ V.mode === "loose" ? H.value[K] = W[K] : H.issues.push({
1923
1954
  code: "invalid_key",
1924
1955
  origin: "record",
1925
1956
  issues: q.issues.map((f) => finalizeIssue(f, U, config())),
1926
1957
  input: K,
1927
1958
  path: [K],
1928
1959
  inst: f
1929
- }), H.value[q.value] = q.value;
1960
+ });
1930
1961
  continue;
1931
1962
  }
1932
1963
  let J = V.valueType._zod.run({
@@ -7416,6 +7447,14 @@ function _union(f, V, H) {
7416
7447
  ...normalizeParams(H)
7417
7448
  });
7418
7449
  }
7450
+ function _xor(f, V, H) {
7451
+ return new f({
7452
+ type: "union",
7453
+ options: V,
7454
+ inclusive: !1,
7455
+ ...normalizeParams(H)
7456
+ });
7457
+ }
7419
7458
  function _discriminatedUnion(f, V, H, U) {
7420
7459
  return new f({
7421
7460
  type: "union",
@@ -7677,417 +7716,164 @@ function _stringFormat(f, V, H, U = {}) {
7677
7716
  };
7678
7717
  return H instanceof RegExp && (G.pattern = H), new f(G);
7679
7718
  }
7680
- var JSONSchemaGenerator = class {
7681
- constructor(f) {
7682
- this.counter = 0, this.metadataRegistry = f?.metadata ?? globalRegistry, this.target = f?.target ?? "draft-2020-12", this.unrepresentable = f?.unrepresentable ?? "throw", this.override = f?.override ?? (() => {}), this.io = f?.io ?? "output", this.seen = /* @__PURE__ */ new Map();
7683
- }
7684
- process(f, V = {
7685
- path: [],
7686
- schemaPath: []
7687
- }) {
7688
- var H;
7689
- let U = f._zod.def, W = {
7690
- guid: "uuid",
7691
- url: "uri",
7692
- datetime: "date-time",
7693
- json_string: "json-string",
7694
- regex: ""
7695
- }, G = this.seen.get(f);
7696
- if (G) return G.count++, V.schemaPath.includes(f) && (G.cycle = V.path), G.schema;
7697
- let K = {
7698
- schema: {},
7699
- count: 1,
7700
- cycle: void 0,
7701
- path: V.path
7702
- };
7703
- this.seen.set(f, K);
7704
- let q = f._zod.toJSONSchema?.();
7705
- if (q) K.schema = q;
7719
+ function initializeContext(f) {
7720
+ let V = f?.target ?? "draft-2020-12";
7721
+ return V === "draft-4" && (V = "draft-04"), V === "draft-7" && (V = "draft-07"), {
7722
+ processors: f.processors ?? {},
7723
+ metadataRegistry: f?.metadata ?? globalRegistry,
7724
+ target: V,
7725
+ unrepresentable: f?.unrepresentable ?? "throw",
7726
+ override: f?.override ?? (() => {}),
7727
+ io: f?.io ?? "output",
7728
+ counter: 0,
7729
+ seen: /* @__PURE__ */ new Map(),
7730
+ cycles: f?.cycles ?? "ref",
7731
+ reused: f?.reused ?? "inline",
7732
+ external: f?.external ?? void 0
7733
+ };
7734
+ }
7735
+ function process(f, V, H = {
7736
+ path: [],
7737
+ schemaPath: []
7738
+ }) {
7739
+ var U;
7740
+ let W = f._zod.def, G = V.seen.get(f);
7741
+ if (G) return G.count++, H.schemaPath.includes(f) && (G.cycle = H.path), G.schema;
7742
+ let K = {
7743
+ schema: {},
7744
+ count: 1,
7745
+ cycle: void 0,
7746
+ path: H.path
7747
+ };
7748
+ V.seen.set(f, K);
7749
+ let q = f._zod.toJSONSchema?.();
7750
+ if (q) K.schema = q;
7751
+ else {
7752
+ let U = {
7753
+ ...H,
7754
+ schemaPath: [...H.schemaPath, f],
7755
+ path: H.path
7756
+ }, G = f._zod.parent;
7757
+ if (G) K.ref = G, process(G, V, U), V.seen.get(G).isParent = !0;
7758
+ else if (f._zod.processJSONSchema) f._zod.processJSONSchema(V, K.schema, U);
7706
7759
  else {
7707
- let H = {
7708
- ...V,
7709
- schemaPath: [...V.schemaPath, f],
7710
- path: V.path
7711
- }, G = f._zod.parent;
7712
- if (G) K.ref = G, this.process(G, H), this.seen.get(G).isParent = !0;
7713
- else {
7714
- let V = K.schema;
7715
- switch (U.type) {
7716
- case "string": {
7717
- let H = V;
7718
- H.type = "string";
7719
- let { minimum: U, maximum: G, format: q, patterns: J, contentEncoding: Y } = f._zod.bag;
7720
- if (typeof U == "number" && (H.minLength = U), typeof G == "number" && (H.maxLength = G), q && (H.format = W[q] ?? q, H.format === "" && delete H.format), Y && (H.contentEncoding = Y), J && J.size > 0) {
7721
- let f = [...J];
7722
- f.length === 1 ? H.pattern = f[0].source : f.length > 1 && (K.schema.allOf = [...f.map((f) => ({
7723
- ...this.target === "draft-7" || this.target === "draft-4" || this.target === "openapi-3.0" ? { type: "string" } : {},
7724
- pattern: f.source
7725
- }))]);
7726
- }
7727
- break;
7728
- }
7729
- case "number": {
7730
- let H = V, { minimum: U, maximum: W, format: G, multipleOf: K, exclusiveMaximum: q, exclusiveMinimum: J } = f._zod.bag;
7731
- typeof G == "string" && G.includes("int") ? H.type = "integer" : H.type = "number", typeof J == "number" && (this.target === "draft-4" || this.target === "openapi-3.0" ? (H.minimum = J, H.exclusiveMinimum = !0) : H.exclusiveMinimum = J), typeof U == "number" && (H.minimum = U, typeof J == "number" && this.target !== "draft-4" && (J >= U ? delete H.minimum : delete H.exclusiveMinimum)), typeof q == "number" && (this.target === "draft-4" || this.target === "openapi-3.0" ? (H.maximum = q, H.exclusiveMaximum = !0) : H.exclusiveMaximum = q), typeof W == "number" && (H.maximum = W, typeof q == "number" && this.target !== "draft-4" && (q <= W ? delete H.maximum : delete H.exclusiveMaximum)), typeof K == "number" && (H.multipleOf = K);
7732
- break;
7733
- }
7734
- case "boolean": {
7735
- let f = V;
7736
- f.type = "boolean";
7737
- break;
7738
- }
7739
- case "bigint":
7740
- if (this.unrepresentable === "throw") throw Error("BigInt cannot be represented in JSON Schema");
7741
- break;
7742
- case "symbol":
7743
- if (this.unrepresentable === "throw") throw Error("Symbols cannot be represented in JSON Schema");
7744
- break;
7745
- case "null":
7746
- this.target === "openapi-3.0" ? (V.type = "string", V.nullable = !0, V.enum = [null]) : V.type = "null";
7747
- break;
7748
- case "any": break;
7749
- case "unknown": break;
7750
- case "undefined":
7751
- if (this.unrepresentable === "throw") throw Error("Undefined cannot be represented in JSON Schema");
7752
- break;
7753
- case "void":
7754
- if (this.unrepresentable === "throw") throw Error("Void cannot be represented in JSON Schema");
7755
- break;
7756
- case "never":
7757
- V.not = {};
7758
- break;
7759
- case "date":
7760
- if (this.unrepresentable === "throw") throw Error("Date cannot be represented in JSON Schema");
7761
- break;
7762
- case "array": {
7763
- let W = V, { minimum: G, maximum: K } = f._zod.bag;
7764
- typeof G == "number" && (W.minItems = G), typeof K == "number" && (W.maxItems = K), W.type = "array", W.items = this.process(U.element, {
7765
- ...H,
7766
- path: [...H.path, "items"]
7767
- });
7768
- break;
7769
- }
7770
- case "object": {
7771
- let f = V;
7772
- f.type = "object", f.properties = {};
7773
- let W = U.shape;
7774
- for (let V in W) f.properties[V] = this.process(W[V], {
7775
- ...H,
7776
- path: [
7777
- ...H.path,
7778
- "properties",
7779
- V
7780
- ]
7781
- });
7782
- let G = new Set(Object.keys(W)), K = new Set([...G].filter((f) => {
7783
- let V = U.shape[f]._zod;
7784
- return this.io === "input" ? V.optin === void 0 : V.optout === void 0;
7785
- }));
7786
- K.size > 0 && (f.required = Array.from(K)), U.catchall?._zod.def.type === "never" ? f.additionalProperties = !1 : U.catchall ? U.catchall && (f.additionalProperties = this.process(U.catchall, {
7787
- ...H,
7788
- path: [...H.path, "additionalProperties"]
7789
- })) : this.io === "output" && (f.additionalProperties = !1);
7790
- break;
7791
- }
7792
- case "union": {
7793
- let f = V, W = U.discriminator !== void 0, G = U.options.map((f, V) => this.process(f, {
7794
- ...H,
7795
- path: [
7796
- ...H.path,
7797
- W ? "oneOf" : "anyOf",
7798
- V
7799
- ]
7800
- }));
7801
- W ? f.oneOf = G : f.anyOf = G;
7802
- break;
7803
- }
7804
- case "intersection": {
7805
- let f = V, W = this.process(U.left, {
7806
- ...H,
7807
- path: [
7808
- ...H.path,
7809
- "allOf",
7810
- 0
7811
- ]
7812
- }), G = this.process(U.right, {
7813
- ...H,
7814
- path: [
7815
- ...H.path,
7816
- "allOf",
7817
- 1
7818
- ]
7819
- }), K = (f) => "allOf" in f && Object.keys(f).length === 1;
7820
- f.allOf = [...K(W) ? W.allOf : [W], ...K(G) ? G.allOf : [G]];
7821
- break;
7822
- }
7823
- case "tuple": {
7824
- let W = V;
7825
- W.type = "array";
7826
- let G = this.target === "draft-2020-12" ? "prefixItems" : "items", K = this.target === "draft-2020-12" || this.target === "openapi-3.0" ? "items" : "additionalItems", q = U.items.map((f, V) => this.process(f, {
7827
- ...H,
7828
- path: [
7829
- ...H.path,
7830
- G,
7831
- V
7832
- ]
7833
- })), J = U.rest ? this.process(U.rest, {
7834
- ...H,
7835
- path: [
7836
- ...H.path,
7837
- K,
7838
- ...this.target === "openapi-3.0" ? [U.items.length] : []
7839
- ]
7840
- }) : null;
7841
- this.target === "draft-2020-12" ? (W.prefixItems = q, J && (W.items = J)) : this.target === "openapi-3.0" ? (W.items = { anyOf: q }, J && W.items.anyOf.push(J), W.minItems = q.length, J || (W.maxItems = q.length)) : (W.items = q, J && (W.additionalItems = J));
7842
- let { minimum: Y, maximum: X } = f._zod.bag;
7843
- typeof Y == "number" && (W.minItems = Y), typeof X == "number" && (W.maxItems = X);
7844
- break;
7845
- }
7846
- case "record": {
7847
- let f = V;
7848
- f.type = "object", (this.target === "draft-7" || this.target === "draft-2020-12") && (f.propertyNames = this.process(U.keyType, {
7849
- ...H,
7850
- path: [...H.path, "propertyNames"]
7851
- })), f.additionalProperties = this.process(U.valueType, {
7852
- ...H,
7853
- path: [...H.path, "additionalProperties"]
7854
- });
7855
- break;
7856
- }
7857
- case "map":
7858
- if (this.unrepresentable === "throw") throw Error("Map cannot be represented in JSON Schema");
7859
- break;
7860
- case "set":
7861
- if (this.unrepresentable === "throw") throw Error("Set cannot be represented in JSON Schema");
7862
- break;
7863
- case "enum": {
7864
- let f = V, H = getEnumValues(U.entries);
7865
- H.every((f) => typeof f == "number") && (f.type = "number"), H.every((f) => typeof f == "string") && (f.type = "string"), f.enum = H;
7866
- break;
7867
- }
7868
- case "literal": {
7869
- let f = V, H = [];
7870
- for (let f of U.values) if (f === void 0) {
7871
- if (this.unrepresentable === "throw") throw Error("Literal `undefined` cannot be represented in JSON Schema");
7872
- } else if (typeof f == "bigint") {
7873
- if (this.unrepresentable === "throw") throw Error("BigInt literals cannot be represented in JSON Schema");
7874
- H.push(Number(f));
7875
- } else H.push(f);
7876
- if (H.length !== 0) if (H.length === 1) {
7877
- let V = H[0];
7878
- f.type = V === null ? "null" : typeof V, this.target === "draft-4" || this.target === "openapi-3.0" ? f.enum = [V] : f.const = V;
7879
- } else H.every((f) => typeof f == "number") && (f.type = "number"), H.every((f) => typeof f == "string") && (f.type = "string"), H.every((f) => typeof f == "boolean") && (f.type = "string"), H.every((f) => f === null) && (f.type = "null"), f.enum = H;
7880
- break;
7881
- }
7882
- case "file": {
7883
- let H = V, U = {
7884
- type: "string",
7885
- format: "binary",
7886
- contentEncoding: "binary"
7887
- }, { minimum: W, maximum: G, mime: K } = f._zod.bag;
7888
- W !== void 0 && (U.minLength = W), G !== void 0 && (U.maxLength = G), K ? K.length === 1 ? (U.contentMediaType = K[0], Object.assign(H, U)) : H.anyOf = K.map((f) => ({
7889
- ...U,
7890
- contentMediaType: f
7891
- })) : Object.assign(H, U);
7892
- break;
7893
- }
7894
- case "transform":
7895
- if (this.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
7896
- break;
7897
- case "nullable": {
7898
- let f = this.process(U.innerType, H);
7899
- this.target === "openapi-3.0" ? (K.ref = U.innerType, V.nullable = !0) : V.anyOf = [f, { type: "null" }];
7900
- break;
7901
- }
7902
- case "nonoptional":
7903
- this.process(U.innerType, H), K.ref = U.innerType;
7904
- break;
7905
- case "success": {
7906
- let f = V;
7907
- f.type = "boolean";
7908
- break;
7909
- }
7910
- case "default":
7911
- this.process(U.innerType, H), K.ref = U.innerType, V.default = JSON.parse(JSON.stringify(U.defaultValue));
7912
- break;
7913
- case "prefault":
7914
- this.process(U.innerType, H), K.ref = U.innerType, this.io === "input" && (V._prefault = JSON.parse(JSON.stringify(U.defaultValue)));
7915
- break;
7916
- case "catch": {
7917
- this.process(U.innerType, H), K.ref = U.innerType;
7918
- let f;
7919
- try {
7920
- f = U.catchValue(void 0);
7921
- } catch {
7922
- throw Error("Dynamic catch values are not supported in JSON Schema");
7923
- }
7924
- V.default = f;
7925
- break;
7926
- }
7927
- case "nan":
7928
- if (this.unrepresentable === "throw") throw Error("NaN cannot be represented in JSON Schema");
7929
- break;
7930
- case "template_literal": {
7931
- let H = V, U = f._zod.pattern;
7932
- if (!U) throw Error("Pattern not found in template literal");
7933
- H.type = "string", H.pattern = U.source;
7934
- break;
7935
- }
7936
- case "pipe": {
7937
- let f = this.io === "input" ? U.in._zod.def.type === "transform" ? U.out : U.in : U.out;
7938
- this.process(f, H), K.ref = f;
7939
- break;
7940
- }
7941
- case "readonly":
7942
- this.process(U.innerType, H), K.ref = U.innerType, V.readOnly = !0;
7943
- break;
7944
- case "promise":
7945
- this.process(U.innerType, H), K.ref = U.innerType;
7946
- break;
7947
- case "optional":
7948
- this.process(U.innerType, H), K.ref = U.innerType;
7949
- break;
7950
- case "lazy": {
7951
- let V = f._zod.innerType;
7952
- this.process(V, H), K.ref = V;
7953
- break;
7954
- }
7955
- case "custom":
7956
- if (this.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
7957
- break;
7958
- case "function":
7959
- if (this.unrepresentable === "throw") throw Error("Function types cannot be represented in JSON Schema");
7960
- break;
7961
- default:
7962
- }
7963
- }
7760
+ let H = K.schema, G = V.processors[W.type];
7761
+ if (!G) throw Error(`[toJSONSchema]: Non-representable type encountered: ${W.type}`);
7762
+ G(f, V, H, U);
7964
7763
  }
7965
- let J = this.metadataRegistry.get(f);
7966
- return J && Object.assign(K.schema, J), this.io === "input" && isTransforming(f) && (delete K.schema.examples, delete K.schema.default), this.io === "input" && K.schema._prefault && ((H = K.schema).default ?? (H.default = K.schema._prefault)), delete K.schema._prefault, this.seen.get(f).schema;
7967
7764
  }
7968
- emit(f, V) {
7969
- let H = {
7970
- cycles: V?.cycles ?? "ref",
7971
- reused: V?.reused ?? "inline",
7972
- external: V?.external ?? void 0
7973
- }, U = this.seen.get(f);
7974
- if (!U) throw Error("Unprocessed schema. This is a bug in Zod.");
7975
- let W = (f) => {
7976
- let V = this.target === "draft-2020-12" ? "$defs" : "definitions";
7977
- if (H.external) {
7978
- let U = H.external.registry.get(f[0])?.id, W = H.external.uri ?? ((f) => f);
7979
- if (U) return { ref: W(U) };
7980
- let G = f[1].defId ?? f[1].schema.id ?? `schema${this.counter++}`;
7981
- return f[1].defId = G, {
7982
- defId: G,
7983
- ref: `${W("__shared")}#/${V}/${G}`
7984
- };
7985
- }
7986
- if (f[1] === U) return { ref: "#" };
7987
- let W = `#/${V}/`, G = f[1].schema.id ?? `__schema${this.counter++}`;
7988
- return {
7765
+ let J = V.metadataRegistry.get(f);
7766
+ return J && Object.assign(K.schema, J), V.io === "input" && isTransforming(f) && (delete K.schema.examples, delete K.schema.default), V.io === "input" && K.schema._prefault && ((U = K.schema).default ?? (U.default = K.schema._prefault)), delete K.schema._prefault, V.seen.get(f).schema;
7767
+ }
7768
+ function extractDefs(f, V) {
7769
+ let H = f.seen.get(V);
7770
+ if (!H) throw Error("Unprocessed schema. This is a bug in Zod.");
7771
+ let U = (V) => {
7772
+ let U = f.target === "draft-2020-12" ? "$defs" : "definitions";
7773
+ if (f.external) {
7774
+ let H = f.external.registry.get(V[0])?.id, W = f.external.uri ?? ((f) => f);
7775
+ if (H) return { ref: W(H) };
7776
+ let G = V[1].defId ?? V[1].schema.id ?? `schema${f.counter++}`;
7777
+ return V[1].defId = G, {
7989
7778
  defId: G,
7990
- ref: W + G
7779
+ ref: `${W("__shared")}#/${U}/${G}`
7991
7780
  };
7992
- }, G = (f) => {
7993
- if (f[1].schema.$ref) return;
7994
- let V = f[1], { ref: H, defId: U } = W(f);
7995
- V.def = { ...V.schema }, U && (V.defId = U);
7996
- let G = V.schema;
7997
- for (let f in G) delete G[f];
7998
- G.$ref = H;
7781
+ }
7782
+ if (V[1] === H) return { ref: "#" };
7783
+ let W = `#/${U}/`, G = V[1].schema.id ?? `__schema${f.counter++}`;
7784
+ return {
7785
+ defId: G,
7786
+ ref: W + G
7999
7787
  };
8000
- if (H.cycles === "throw") for (let f of this.seen.entries()) {
8001
- let V = f[1];
8002
- if (V.cycle) throw Error(`Cycle detected: #/${V.cycle?.join("/")}/<root>
7788
+ }, W = (f) => {
7789
+ if (f[1].schema.$ref) return;
7790
+ let V = f[1], { ref: H, defId: W } = U(f);
7791
+ V.def = { ...V.schema }, W && (V.defId = W);
7792
+ let G = V.schema;
7793
+ for (let f in G) delete G[f];
7794
+ G.$ref = H;
7795
+ };
7796
+ if (f.cycles === "throw") for (let V of f.seen.entries()) {
7797
+ let f = V[1];
7798
+ if (f.cycle) throw Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
8003
7799
 
8004
7800
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
7801
+ }
7802
+ for (let H of f.seen.entries()) {
7803
+ let U = H[1];
7804
+ if (V === H[0]) {
7805
+ W(H);
7806
+ continue;
8005
7807
  }
8006
- for (let V of this.seen.entries()) {
8007
- let U = V[1];
8008
- if (f === V[0]) {
8009
- G(V);
8010
- continue;
8011
- }
8012
- if (H.external) {
8013
- let U = H.external.registry.get(V[0])?.id;
8014
- if (f !== V[0] && U) {
8015
- G(V);
8016
- continue;
8017
- }
8018
- }
8019
- if (this.metadataRegistry.get(V[0])?.id) {
8020
- G(V);
8021
- continue;
8022
- }
8023
- if (U.cycle) {
8024
- G(V);
8025
- continue;
8026
- }
8027
- if (U.count > 1 && H.reused === "ref") {
8028
- G(V);
7808
+ if (f.external) {
7809
+ let U = f.external.registry.get(H[0])?.id;
7810
+ if (V !== H[0] && U) {
7811
+ W(H);
8029
7812
  continue;
8030
7813
  }
8031
7814
  }
8032
- let K = (f, V) => {
8033
- let H = this.seen.get(f), U = H.def ?? H.schema, W = { ...U };
8034
- if (H.ref === null) return;
8035
- let G = H.ref;
8036
- if (H.ref = null, G) {
8037
- K(G, V);
8038
- let f = this.seen.get(G).schema;
8039
- f.$ref && (V.target === "draft-7" || V.target === "draft-4" || V.target === "openapi-3.0") ? (U.allOf = U.allOf ?? [], U.allOf.push(f)) : (Object.assign(U, f), Object.assign(U, W));
8040
- }
8041
- H.isParent || this.override({
8042
- zodSchema: f,
8043
- jsonSchema: U,
8044
- path: H.path ?? []
8045
- });
8046
- };
8047
- for (let f of [...this.seen.entries()].reverse()) K(f[0], { target: this.target });
8048
- let q = {};
8049
- if (this.target === "draft-2020-12" ? q.$schema = "https://json-schema.org/draft/2020-12/schema" : this.target === "draft-7" ? q.$schema = "http://json-schema.org/draft-07/schema#" : this.target === "draft-4" ? q.$schema = "http://json-schema.org/draft-04/schema#" : this.target === "openapi-3.0" || console.warn(`Invalid target: ${this.target}`), H.external?.uri) {
8050
- let V = H.external.registry.get(f)?.id;
8051
- if (!V) throw Error("Schema is missing an `id` property");
8052
- q.$id = H.external.uri(V);
8053
- }
8054
- Object.assign(q, U.def);
8055
- let J = H.external?.defs ?? {};
8056
- for (let f of this.seen.entries()) {
8057
- let V = f[1];
8058
- V.def && V.defId && (J[V.defId] = V.def);
8059
- }
8060
- H.external || Object.keys(J).length > 0 && (this.target === "draft-2020-12" ? q.$defs = J : q.definitions = J);
8061
- try {
8062
- return JSON.parse(JSON.stringify(q));
8063
- } catch {
8064
- throw Error("Error converting schema to JSON.");
7815
+ if (f.metadataRegistry.get(H[0])?.id) {
7816
+ W(H);
7817
+ continue;
8065
7818
  }
8066
- }
8067
- };
8068
- function toJSONSchema(f, V) {
8069
- if (f instanceof $ZodRegistry) {
8070
- let H = new JSONSchemaGenerator(V), U = {};
8071
- for (let V of f._idmap.entries()) {
8072
- let [f, U] = V;
8073
- H.process(U);
8074
- }
8075
- let W = {}, G = {
8076
- registry: f,
8077
- uri: V?.uri,
8078
- defs: U
8079
- };
8080
- for (let U of f._idmap.entries()) {
8081
- let [f, K] = U;
8082
- W[f] = H.emit(K, {
8083
- ...V,
8084
- external: G
8085
- });
7819
+ if (U.cycle) {
7820
+ W(H);
7821
+ continue;
7822
+ }
7823
+ if (U.count > 1 && f.reused === "ref") {
7824
+ W(H);
7825
+ continue;
8086
7826
  }
8087
- return Object.keys(U).length > 0 && (W.__shared = { [H.target === "draft-2020-12" ? "$defs" : "definitions"]: U }), { schemas: W };
8088
7827
  }
8089
- let H = new JSONSchemaGenerator(V);
8090
- return H.process(f), H.emit(f, V);
7828
+ }
7829
+ function finalize(f, V) {
7830
+ let H = f.seen.get(V);
7831
+ if (!H) throw Error("Unprocessed schema. This is a bug in Zod.");
7832
+ let U = (V) => {
7833
+ let H = f.seen.get(V), W = H.def ?? H.schema, G = { ...W };
7834
+ if (H.ref === null) return;
7835
+ let K = H.ref;
7836
+ if (H.ref = null, K) {
7837
+ U(K);
7838
+ let V = f.seen.get(K).schema;
7839
+ V.$ref && (f.target === "draft-07" || f.target === "draft-04" || f.target === "openapi-3.0") ? (W.allOf = W.allOf ?? [], W.allOf.push(V)) : (Object.assign(W, V), Object.assign(W, G));
7840
+ }
7841
+ H.isParent || f.override({
7842
+ zodSchema: V,
7843
+ jsonSchema: W,
7844
+ path: H.path ?? []
7845
+ });
7846
+ };
7847
+ for (let V of [...f.seen.entries()].reverse()) U(V[0]);
7848
+ let W = {};
7849
+ if (f.target === "draft-2020-12" ? W.$schema = "https://json-schema.org/draft/2020-12/schema" : f.target === "draft-07" ? W.$schema = "http://json-schema.org/draft-07/schema#" : f.target === "draft-04" ? W.$schema = "http://json-schema.org/draft-04/schema#" : f.target, f.external?.uri) {
7850
+ let H = f.external.registry.get(V)?.id;
7851
+ if (!H) throw Error("Schema is missing an `id` property");
7852
+ W.$id = f.external.uri(H);
7853
+ }
7854
+ Object.assign(W, H.def ?? H.schema);
7855
+ let G = f.external?.defs ?? {};
7856
+ for (let V of f.seen.entries()) {
7857
+ let f = V[1];
7858
+ f.def && f.defId && (G[f.defId] = f.def);
7859
+ }
7860
+ f.external || Object.keys(G).length > 0 && (f.target === "draft-2020-12" ? W.$defs = G : W.definitions = G);
7861
+ try {
7862
+ let f = JSON.parse(JSON.stringify(W));
7863
+ return Object.defineProperty(f, "~standard", {
7864
+ value: {
7865
+ ...V["~standard"],
7866
+ jsonSchema: {
7867
+ input: createStandardJSONSchemaMethod(V, "input"),
7868
+ output: createStandardJSONSchemaMethod(V, "output")
7869
+ }
7870
+ },
7871
+ enumerable: !1,
7872
+ writable: !1
7873
+ }), f;
7874
+ } catch {
7875
+ throw Error("Error converting schema to JSON.");
7876
+ }
8091
7877
  }
8092
7878
  function isTransforming(f, V) {
8093
7879
  let H = V ?? { seen: /* @__PURE__ */ new Set() };
@@ -8116,7 +7902,354 @@ function isTransforming(f, V) {
8116
7902
  }
8117
7903
  return !1;
8118
7904
  }
8119
- var json_schema_exports = {}, core_exports = /* @__PURE__ */ __export({
7905
+ var createToJSONSchemaMethod = (f, V = {}) => (H) => {
7906
+ let U = initializeContext({
7907
+ ...H,
7908
+ processors: V
7909
+ });
7910
+ return process(f, U), extractDefs(U, f), finalize(U, f);
7911
+ }, createStandardJSONSchemaMethod = (f, V) => (H) => {
7912
+ let { libraryOptions: U, target: W } = H ?? {}, G = initializeContext({
7913
+ ...U ?? {},
7914
+ target: W,
7915
+ io: V,
7916
+ processors: {}
7917
+ });
7918
+ return process(f, G), extractDefs(G, f), finalize(G, f);
7919
+ }, formatMap = {
7920
+ guid: "uuid",
7921
+ url: "uri",
7922
+ datetime: "date-time",
7923
+ json_string: "json-string",
7924
+ regex: ""
7925
+ }, stringProcessor = (f, V, H, U) => {
7926
+ let W = H;
7927
+ W.type = "string";
7928
+ let { minimum: G, maximum: K, format: q, patterns: J, contentEncoding: Y } = f._zod.bag;
7929
+ if (typeof G == "number" && (W.minLength = G), typeof K == "number" && (W.maxLength = K), q && (W.format = formatMap[q] ?? q, W.format === "" && delete W.format), Y && (W.contentEncoding = Y), J && J.size > 0) {
7930
+ let f = [...J];
7931
+ f.length === 1 ? W.pattern = f[0].source : f.length > 1 && (W.allOf = [...f.map((f) => ({
7932
+ ...V.target === "draft-07" || V.target === "draft-04" || V.target === "openapi-3.0" ? { type: "string" } : {},
7933
+ pattern: f.source
7934
+ }))]);
7935
+ }
7936
+ }, numberProcessor = (f, V, H, U) => {
7937
+ let W = H, { minimum: G, maximum: K, format: q, multipleOf: J, exclusiveMaximum: Y, exclusiveMinimum: X } = f._zod.bag;
7938
+ typeof q == "string" && q.includes("int") ? W.type = "integer" : W.type = "number", typeof X == "number" && (V.target === "draft-04" || V.target === "openapi-3.0" ? (W.minimum = X, W.exclusiveMinimum = !0) : W.exclusiveMinimum = X), typeof G == "number" && (W.minimum = G, typeof X == "number" && V.target !== "draft-04" && (X >= G ? delete W.minimum : delete W.exclusiveMinimum)), typeof Y == "number" && (V.target === "draft-04" || V.target === "openapi-3.0" ? (W.maximum = Y, W.exclusiveMaximum = !0) : W.exclusiveMaximum = Y), typeof K == "number" && (W.maximum = K, typeof Y == "number" && V.target !== "draft-04" && (Y <= K ? delete W.maximum : delete W.exclusiveMaximum)), typeof J == "number" && (W.multipleOf = J);
7939
+ }, booleanProcessor = (f, V, H, U) => {
7940
+ H.type = "boolean";
7941
+ }, bigintProcessor = (f, V, H, U) => {
7942
+ if (V.unrepresentable === "throw") throw Error("BigInt cannot be represented in JSON Schema");
7943
+ }, symbolProcessor = (f, V, H, U) => {
7944
+ if (V.unrepresentable === "throw") throw Error("Symbols cannot be represented in JSON Schema");
7945
+ }, nullProcessor = (f, V, H, U) => {
7946
+ V.target === "openapi-3.0" ? (H.type = "string", H.nullable = !0, H.enum = [null]) : H.type = "null";
7947
+ }, undefinedProcessor = (f, V, H, U) => {
7948
+ if (V.unrepresentable === "throw") throw Error("Undefined cannot be represented in JSON Schema");
7949
+ }, voidProcessor = (f, V, H, U) => {
7950
+ if (V.unrepresentable === "throw") throw Error("Void cannot be represented in JSON Schema");
7951
+ }, neverProcessor = (f, V, H, U) => {
7952
+ H.not = {};
7953
+ }, anyProcessor = (f, V, H, U) => {}, unknownProcessor = (f, V, H, U) => {}, dateProcessor = (f, V, H, U) => {
7954
+ if (V.unrepresentable === "throw") throw Error("Date cannot be represented in JSON Schema");
7955
+ }, enumProcessor = (f, V, H, U) => {
7956
+ let W = f._zod.def, G = getEnumValues(W.entries);
7957
+ G.every((f) => typeof f == "number") && (H.type = "number"), G.every((f) => typeof f == "string") && (H.type = "string"), H.enum = G;
7958
+ }, literalProcessor = (f, V, H, U) => {
7959
+ let W = f._zod.def, G = [];
7960
+ for (let f of W.values) if (f === void 0) {
7961
+ if (V.unrepresentable === "throw") throw Error("Literal `undefined` cannot be represented in JSON Schema");
7962
+ } else if (typeof f == "bigint") {
7963
+ if (V.unrepresentable === "throw") throw Error("BigInt literals cannot be represented in JSON Schema");
7964
+ G.push(Number(f));
7965
+ } else G.push(f);
7966
+ if (G.length !== 0) if (G.length === 1) {
7967
+ let f = G[0];
7968
+ H.type = f === null ? "null" : typeof f, V.target === "draft-04" || V.target === "openapi-3.0" ? H.enum = [f] : H.const = f;
7969
+ } else G.every((f) => typeof f == "number") && (H.type = "number"), G.every((f) => typeof f == "string") && (H.type = "string"), G.every((f) => typeof f == "boolean") && (H.type = "boolean"), G.every((f) => f === null) && (H.type = "null"), H.enum = G;
7970
+ }, nanProcessor = (f, V, H, U) => {
7971
+ if (V.unrepresentable === "throw") throw Error("NaN cannot be represented in JSON Schema");
7972
+ }, templateLiteralProcessor = (f, V, H, U) => {
7973
+ let W = H, G = f._zod.pattern;
7974
+ if (!G) throw Error("Pattern not found in template literal");
7975
+ W.type = "string", W.pattern = G.source;
7976
+ }, fileProcessor = (f, V, H, U) => {
7977
+ let W = H, G = {
7978
+ type: "string",
7979
+ format: "binary",
7980
+ contentEncoding: "binary"
7981
+ }, { minimum: K, maximum: q, mime: J } = f._zod.bag;
7982
+ K !== void 0 && (G.minLength = K), q !== void 0 && (G.maxLength = q), J ? J.length === 1 ? (G.contentMediaType = J[0], Object.assign(W, G)) : W.anyOf = J.map((f) => ({
7983
+ ...G,
7984
+ contentMediaType: f
7985
+ })) : Object.assign(W, G);
7986
+ }, successProcessor = (f, V, H, U) => {
7987
+ H.type = "boolean";
7988
+ }, customProcessor = (f, V, H, U) => {
7989
+ if (V.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
7990
+ }, functionProcessor = (f, V, H, U) => {
7991
+ if (V.unrepresentable === "throw") throw Error("Function types cannot be represented in JSON Schema");
7992
+ }, transformProcessor = (f, V, H, U) => {
7993
+ if (V.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
7994
+ }, mapProcessor = (f, V, H, U) => {
7995
+ if (V.unrepresentable === "throw") throw Error("Map cannot be represented in JSON Schema");
7996
+ }, setProcessor = (f, V, H, U) => {
7997
+ if (V.unrepresentable === "throw") throw Error("Set cannot be represented in JSON Schema");
7998
+ }, arrayProcessor = (f, V, H, U) => {
7999
+ let W = H, G = f._zod.def, { minimum: K, maximum: q } = f._zod.bag;
8000
+ typeof K == "number" && (W.minItems = K), typeof q == "number" && (W.maxItems = q), W.type = "array", W.items = process(G.element, V, {
8001
+ ...U,
8002
+ path: [...U.path, "items"]
8003
+ });
8004
+ }, objectProcessor = (f, V, H, U) => {
8005
+ let W = H, G = f._zod.def;
8006
+ W.type = "object", W.properties = {};
8007
+ let K = G.shape;
8008
+ for (let f in K) W.properties[f] = process(K[f], V, {
8009
+ ...U,
8010
+ path: [
8011
+ ...U.path,
8012
+ "properties",
8013
+ f
8014
+ ]
8015
+ });
8016
+ let q = new Set(Object.keys(K)), J = new Set([...q].filter((f) => {
8017
+ let H = G.shape[f]._zod;
8018
+ return V.io === "input" ? H.optin === void 0 : H.optout === void 0;
8019
+ }));
8020
+ J.size > 0 && (W.required = Array.from(J)), G.catchall?._zod.def.type === "never" ? W.additionalProperties = !1 : G.catchall ? G.catchall && (W.additionalProperties = process(G.catchall, V, {
8021
+ ...U,
8022
+ path: [...U.path, "additionalProperties"]
8023
+ })) : V.io === "output" && (W.additionalProperties = !1);
8024
+ }, unionProcessor = (f, V, H, U) => {
8025
+ let W = f._zod.def, G = W.inclusive === !1, K = W.options.map((f, H) => process(f, V, {
8026
+ ...U,
8027
+ path: [
8028
+ ...U.path,
8029
+ G ? "oneOf" : "anyOf",
8030
+ H
8031
+ ]
8032
+ }));
8033
+ G ? H.oneOf = K : H.anyOf = K;
8034
+ }, intersectionProcessor = (f, V, H, U) => {
8035
+ let W = f._zod.def, G = process(W.left, V, {
8036
+ ...U,
8037
+ path: [
8038
+ ...U.path,
8039
+ "allOf",
8040
+ 0
8041
+ ]
8042
+ }), K = process(W.right, V, {
8043
+ ...U,
8044
+ path: [
8045
+ ...U.path,
8046
+ "allOf",
8047
+ 1
8048
+ ]
8049
+ }), q = (f) => "allOf" in f && Object.keys(f).length === 1;
8050
+ H.allOf = [...q(G) ? G.allOf : [G], ...q(K) ? K.allOf : [K]];
8051
+ }, tupleProcessor = (f, V, H, U) => {
8052
+ let W = H, G = f._zod.def;
8053
+ W.type = "array";
8054
+ let K = V.target === "draft-2020-12" ? "prefixItems" : "items", q = V.target === "draft-2020-12" || V.target === "openapi-3.0" ? "items" : "additionalItems", J = G.items.map((f, H) => process(f, V, {
8055
+ ...U,
8056
+ path: [
8057
+ ...U.path,
8058
+ K,
8059
+ H
8060
+ ]
8061
+ })), Y = G.rest ? process(G.rest, V, {
8062
+ ...U,
8063
+ path: [
8064
+ ...U.path,
8065
+ q,
8066
+ ...V.target === "openapi-3.0" ? [G.items.length] : []
8067
+ ]
8068
+ }) : null;
8069
+ V.target === "draft-2020-12" ? (W.prefixItems = J, Y && (W.items = Y)) : V.target === "openapi-3.0" ? (W.items = { anyOf: J }, Y && W.items.anyOf.push(Y), W.minItems = J.length, Y || (W.maxItems = J.length)) : (W.items = J, Y && (W.additionalItems = Y));
8070
+ let { minimum: X, maximum: Z } = f._zod.bag;
8071
+ typeof X == "number" && (W.minItems = X), typeof Z == "number" && (W.maxItems = Z);
8072
+ }, recordProcessor = (f, V, H, U) => {
8073
+ let W = H, G = f._zod.def;
8074
+ W.type = "object", (V.target === "draft-07" || V.target === "draft-2020-12") && (W.propertyNames = process(G.keyType, V, {
8075
+ ...U,
8076
+ path: [...U.path, "propertyNames"]
8077
+ })), W.additionalProperties = process(G.valueType, V, {
8078
+ ...U,
8079
+ path: [...U.path, "additionalProperties"]
8080
+ });
8081
+ }, nullableProcessor = (f, V, H, U) => {
8082
+ let W = f._zod.def, G = process(W.innerType, V, U), K = V.seen.get(f);
8083
+ V.target === "openapi-3.0" ? (K.ref = W.innerType, H.nullable = !0) : H.anyOf = [G, { type: "null" }];
8084
+ }, nonoptionalProcessor = (f, V, H, U) => {
8085
+ let W = f._zod.def;
8086
+ process(W.innerType, V, U);
8087
+ let G = V.seen.get(f);
8088
+ G.ref = W.innerType;
8089
+ }, defaultProcessor = (f, V, H, U) => {
8090
+ let W = f._zod.def;
8091
+ process(W.innerType, V, U);
8092
+ let G = V.seen.get(f);
8093
+ G.ref = W.innerType, H.default = JSON.parse(JSON.stringify(W.defaultValue));
8094
+ }, prefaultProcessor = (f, V, H, U) => {
8095
+ let W = f._zod.def;
8096
+ process(W.innerType, V, U);
8097
+ let G = V.seen.get(f);
8098
+ G.ref = W.innerType, V.io === "input" && (H._prefault = JSON.parse(JSON.stringify(W.defaultValue)));
8099
+ }, catchProcessor = (f, V, H, U) => {
8100
+ let W = f._zod.def;
8101
+ process(W.innerType, V, U);
8102
+ let G = V.seen.get(f);
8103
+ G.ref = W.innerType;
8104
+ let K;
8105
+ try {
8106
+ K = W.catchValue(void 0);
8107
+ } catch {
8108
+ throw Error("Dynamic catch values are not supported in JSON Schema");
8109
+ }
8110
+ H.default = K;
8111
+ }, pipeProcessor = (f, V, H, U) => {
8112
+ let W = f._zod.def, G = V.io === "input" ? W.in._zod.def.type === "transform" ? W.out : W.in : W.out;
8113
+ process(G, V, U);
8114
+ let K = V.seen.get(f);
8115
+ K.ref = G;
8116
+ }, readonlyProcessor = (f, V, H, U) => {
8117
+ let W = f._zod.def;
8118
+ process(W.innerType, V, U);
8119
+ let G = V.seen.get(f);
8120
+ G.ref = W.innerType, H.readOnly = !0;
8121
+ }, promiseProcessor = (f, V, H, U) => {
8122
+ let W = f._zod.def;
8123
+ process(W.innerType, V, U);
8124
+ let G = V.seen.get(f);
8125
+ G.ref = W.innerType;
8126
+ }, optionalProcessor = (f, V, H, U) => {
8127
+ let W = f._zod.def;
8128
+ process(W.innerType, V, U);
8129
+ let G = V.seen.get(f);
8130
+ G.ref = W.innerType;
8131
+ }, lazyProcessor = (f, V, H, U) => {
8132
+ let W = f._zod.innerType;
8133
+ process(W, V, U);
8134
+ let G = V.seen.get(f);
8135
+ G.ref = W;
8136
+ }, allProcessors = {
8137
+ string: stringProcessor,
8138
+ number: numberProcessor,
8139
+ boolean: booleanProcessor,
8140
+ bigint: bigintProcessor,
8141
+ symbol: symbolProcessor,
8142
+ null: nullProcessor,
8143
+ undefined: undefinedProcessor,
8144
+ void: voidProcessor,
8145
+ never: neverProcessor,
8146
+ any: anyProcessor,
8147
+ unknown: unknownProcessor,
8148
+ date: dateProcessor,
8149
+ enum: enumProcessor,
8150
+ literal: literalProcessor,
8151
+ nan: nanProcessor,
8152
+ template_literal: templateLiteralProcessor,
8153
+ file: fileProcessor,
8154
+ success: successProcessor,
8155
+ custom: customProcessor,
8156
+ function: functionProcessor,
8157
+ transform: transformProcessor,
8158
+ map: mapProcessor,
8159
+ set: setProcessor,
8160
+ array: arrayProcessor,
8161
+ object: objectProcessor,
8162
+ union: unionProcessor,
8163
+ intersection: intersectionProcessor,
8164
+ tuple: tupleProcessor,
8165
+ record: recordProcessor,
8166
+ nullable: nullableProcessor,
8167
+ nonoptional: nonoptionalProcessor,
8168
+ default: defaultProcessor,
8169
+ prefault: prefaultProcessor,
8170
+ catch: catchProcessor,
8171
+ pipe: pipeProcessor,
8172
+ readonly: readonlyProcessor,
8173
+ promise: promiseProcessor,
8174
+ optional: optionalProcessor,
8175
+ lazy: lazyProcessor
8176
+ };
8177
+ function toJSONSchema(f, V) {
8178
+ if ("_idmap" in f) {
8179
+ let H = f, U = initializeContext({
8180
+ ...V,
8181
+ processors: allProcessors
8182
+ }), W = {};
8183
+ for (let f of H._idmap.entries()) {
8184
+ let [V, H] = f;
8185
+ process(H, U);
8186
+ }
8187
+ let G = {};
8188
+ U.external = {
8189
+ registry: H,
8190
+ uri: V?.uri,
8191
+ defs: W
8192
+ };
8193
+ for (let f of H._idmap.entries()) {
8194
+ let [V, H] = f;
8195
+ extractDefs(U, H), G[V] = finalize(U, H);
8196
+ }
8197
+ return Object.keys(W).length > 0 && (G.__shared = { [U.target === "draft-2020-12" ? "$defs" : "definitions"]: W }), { schemas: G };
8198
+ }
8199
+ let H = initializeContext({
8200
+ ...V,
8201
+ processors: allProcessors
8202
+ });
8203
+ return process(f, H), extractDefs(H, f), finalize(H, f);
8204
+ }
8205
+ var JSONSchemaGenerator = class {
8206
+ get metadataRegistry() {
8207
+ return this.ctx.metadataRegistry;
8208
+ }
8209
+ get target() {
8210
+ return this.ctx.target;
8211
+ }
8212
+ get unrepresentable() {
8213
+ return this.ctx.unrepresentable;
8214
+ }
8215
+ get override() {
8216
+ return this.ctx.override;
8217
+ }
8218
+ get io() {
8219
+ return this.ctx.io;
8220
+ }
8221
+ get counter() {
8222
+ return this.ctx.counter;
8223
+ }
8224
+ set counter(f) {
8225
+ this.ctx.counter = f;
8226
+ }
8227
+ get seen() {
8228
+ return this.ctx.seen;
8229
+ }
8230
+ constructor(f) {
8231
+ let V = f?.target ?? "draft-2020-12";
8232
+ V === "draft-4" && (V = "draft-04"), V === "draft-7" && (V = "draft-07"), this.ctx = initializeContext({
8233
+ processors: allProcessors,
8234
+ target: V,
8235
+ ...f?.metadata && { metadata: f.metadata },
8236
+ ...f?.unrepresentable && { unrepresentable: f.unrepresentable },
8237
+ ...f?.override && { override: f.override },
8238
+ ...f?.io && { io: f.io }
8239
+ });
8240
+ }
8241
+ process(f, V = {
8242
+ path: [],
8243
+ schemaPath: []
8244
+ }) {
8245
+ return process(f, this.ctx, V);
8246
+ }
8247
+ emit(f, V) {
8248
+ V && (V.cycles && (this.ctx.cycles = V.cycles), V.reused && (this.ctx.reused = V.reused), V.external && (this.ctx.external = V.external)), extractDefs(this.ctx, f);
8249
+ let { "~standard": H, ...U } = finalize(this.ctx, f);
8250
+ return U;
8251
+ }
8252
+ }, json_schema_exports = {}, core_exports = /* @__PURE__ */ __export({
8120
8253
  $ZodAny: () => $ZodAny,
8121
8254
  $ZodArray: () => $ZodArray,
8122
8255
  $ZodAsyncError: () => $ZodAsyncError,
@@ -8215,6 +8348,7 @@ var json_schema_exports = {}, core_exports = /* @__PURE__ */ __export({
8215
8348
  $ZodUnknown: () => $ZodUnknown,
8216
8349
  $ZodVoid: () => $ZodVoid,
8217
8350
  $ZodXID: () => $ZodXID,
8351
+ $ZodXor: () => $ZodXor,
8218
8352
  $brand: () => $brand,
8219
8353
  $constructor: () => $constructor,
8220
8354
  $input: () => $input,
@@ -8349,17 +8483,23 @@ var json_schema_exports = {}, core_exports = /* @__PURE__ */ __export({
8349
8483
  _uuidv7: () => _uuidv7,
8350
8484
  _void: () => _void$1,
8351
8485
  _xid: () => _xid,
8486
+ _xor: () => _xor,
8352
8487
  clone: () => clone,
8353
8488
  config: () => config,
8489
+ createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
8490
+ createToJSONSchemaMethod: () => createToJSONSchemaMethod,
8354
8491
  decode: () => decode$1,
8355
8492
  decodeAsync: () => decodeAsync$1,
8356
8493
  describe: () => describe$1,
8357
8494
  encode: () => encode$1,
8358
8495
  encodeAsync: () => encodeAsync$1,
8496
+ extractDefs: () => extractDefs,
8497
+ finalize: () => finalize,
8359
8498
  flattenError: () => flattenError,
8360
8499
  formatError: () => formatError,
8361
8500
  globalConfig: () => globalConfig,
8362
8501
  globalRegistry: () => globalRegistry,
8502
+ initializeContext: () => initializeContext,
8363
8503
  isValidBase64: () => isValidBase64,
8364
8504
  isValidBase64URL: () => isValidBase64URL,
8365
8505
  isValidJWT: () => isValidJWT,
@@ -8368,6 +8508,7 @@ var json_schema_exports = {}, core_exports = /* @__PURE__ */ __export({
8368
8508
  parse: () => parse$1,
8369
8509
  parseAsync: () => parseAsync$1,
8370
8510
  prettifyError: () => prettifyError,
8511
+ process: () => process,
8371
8512
  regexes: () => regexes_exports,
8372
8513
  registry: () => registry,
8373
8514
  safeDecode: () => safeDecode$1,
@@ -8381,6 +8522,36 @@ var json_schema_exports = {}, core_exports = /* @__PURE__ */ __export({
8381
8522
  treeifyError: () => treeifyError,
8382
8523
  util: () => util_exports,
8383
8524
  version: () => version
8525
+ }, 1), checks_exports = /* @__PURE__ */ __export({
8526
+ endsWith: () => _endsWith,
8527
+ gt: () => _gt,
8528
+ gte: () => _gte,
8529
+ includes: () => _includes,
8530
+ length: () => _length,
8531
+ lowercase: () => _lowercase,
8532
+ lt: () => _lt,
8533
+ lte: () => _lte,
8534
+ maxLength: () => _maxLength,
8535
+ maxSize: () => _maxSize,
8536
+ mime: () => _mime,
8537
+ minLength: () => _minLength,
8538
+ minSize: () => _minSize,
8539
+ multipleOf: () => _multipleOf,
8540
+ negative: () => _negative,
8541
+ nonnegative: () => _nonnegative,
8542
+ nonpositive: () => _nonpositive,
8543
+ normalize: () => _normalize,
8544
+ overwrite: () => _overwrite,
8545
+ positive: () => _positive,
8546
+ property: () => _property,
8547
+ regex: () => _regex,
8548
+ size: () => _size,
8549
+ slugify: () => _slugify,
8550
+ startsWith: () => _startsWith,
8551
+ toLowerCase: () => _toLowerCase,
8552
+ toUpperCase: () => _toUpperCase,
8553
+ trim: () => _trim,
8554
+ uppercase: () => _uppercase
8384
8555
  }, 1), iso_exports = /* @__PURE__ */ __export({
8385
8556
  ZodISODate: () => ZodISODate,
8386
8557
  ZodISODateTime: () => ZodISODateTime,
@@ -8428,7 +8599,173 @@ var initializer = (f, V) => {
8428
8599
  return f.issues.length === 0;
8429
8600
  } }
8430
8601
  });
8431
- }, ZodError = $constructor("ZodError", initializer), ZodRealError = $constructor("ZodError", initializer, { Parent: Error }), parse = /* @__PURE__ */ _parse(ZodRealError), parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError), safeParse = /* @__PURE__ */ _safeParse(ZodRealError), safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError), encode = /* @__PURE__ */ _encode(ZodRealError), decode = /* @__PURE__ */ _decode(ZodRealError), encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError), decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError), safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError), safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError), safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError), safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError), ZodType = /* @__PURE__ */ $constructor("ZodType", (f, V) => ($ZodType.init(f, V), f.def = V, f.type = V.type, Object.defineProperty(f, "_def", { value: V }), f.check = (...H) => f.clone(mergeDefs(V, { checks: [...V.checks ?? [], ...H.map((f) => typeof f == "function" ? { _zod: {
8602
+ }, ZodError = $constructor("ZodError", initializer), ZodRealError = $constructor("ZodError", initializer, { Parent: Error }), parse = /* @__PURE__ */ _parse(ZodRealError), parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError), safeParse = /* @__PURE__ */ _safeParse(ZodRealError), safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError), encode = /* @__PURE__ */ _encode(ZodRealError), decode = /* @__PURE__ */ _decode(ZodRealError), encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError), decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError), safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError), safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError), safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError), safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError), schemas_exports = /* @__PURE__ */ __export({
8603
+ ZodAny: () => ZodAny,
8604
+ ZodArray: () => ZodArray,
8605
+ ZodBase64: () => ZodBase64,
8606
+ ZodBase64URL: () => ZodBase64URL,
8607
+ ZodBigInt: () => ZodBigInt,
8608
+ ZodBigIntFormat: () => ZodBigIntFormat,
8609
+ ZodBoolean: () => ZodBoolean,
8610
+ ZodCIDRv4: () => ZodCIDRv4,
8611
+ ZodCIDRv6: () => ZodCIDRv6,
8612
+ ZodCUID: () => ZodCUID,
8613
+ ZodCUID2: () => ZodCUID2,
8614
+ ZodCatch: () => ZodCatch,
8615
+ ZodCodec: () => ZodCodec,
8616
+ ZodCustom: () => ZodCustom,
8617
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
8618
+ ZodDate: () => ZodDate,
8619
+ ZodDefault: () => ZodDefault,
8620
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
8621
+ ZodE164: () => ZodE164,
8622
+ ZodEmail: () => ZodEmail,
8623
+ ZodEmoji: () => ZodEmoji,
8624
+ ZodEnum: () => ZodEnum,
8625
+ ZodFile: () => ZodFile,
8626
+ ZodFunction: () => ZodFunction,
8627
+ ZodGUID: () => ZodGUID,
8628
+ ZodIPv4: () => ZodIPv4,
8629
+ ZodIPv6: () => ZodIPv6,
8630
+ ZodIntersection: () => ZodIntersection,
8631
+ ZodJWT: () => ZodJWT,
8632
+ ZodKSUID: () => ZodKSUID,
8633
+ ZodLazy: () => ZodLazy,
8634
+ ZodLiteral: () => ZodLiteral,
8635
+ ZodMAC: () => ZodMAC,
8636
+ ZodMap: () => ZodMap,
8637
+ ZodNaN: () => ZodNaN,
8638
+ ZodNanoID: () => ZodNanoID,
8639
+ ZodNever: () => ZodNever,
8640
+ ZodNonOptional: () => ZodNonOptional,
8641
+ ZodNull: () => ZodNull,
8642
+ ZodNullable: () => ZodNullable,
8643
+ ZodNumber: () => ZodNumber,
8644
+ ZodNumberFormat: () => ZodNumberFormat,
8645
+ ZodObject: () => ZodObject,
8646
+ ZodOptional: () => ZodOptional,
8647
+ ZodPipe: () => ZodPipe,
8648
+ ZodPrefault: () => ZodPrefault,
8649
+ ZodPromise: () => ZodPromise,
8650
+ ZodReadonly: () => ZodReadonly,
8651
+ ZodRecord: () => ZodRecord,
8652
+ ZodSet: () => ZodSet,
8653
+ ZodString: () => ZodString,
8654
+ ZodStringFormat: () => ZodStringFormat,
8655
+ ZodSuccess: () => ZodSuccess,
8656
+ ZodSymbol: () => ZodSymbol,
8657
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
8658
+ ZodTransform: () => ZodTransform,
8659
+ ZodTuple: () => ZodTuple,
8660
+ ZodType: () => ZodType,
8661
+ ZodULID: () => ZodULID,
8662
+ ZodURL: () => ZodURL,
8663
+ ZodUUID: () => ZodUUID,
8664
+ ZodUndefined: () => ZodUndefined,
8665
+ ZodUnion: () => ZodUnion,
8666
+ ZodUnknown: () => ZodUnknown,
8667
+ ZodVoid: () => ZodVoid,
8668
+ ZodXID: () => ZodXID,
8669
+ ZodXor: () => ZodXor,
8670
+ _ZodString: () => _ZodString,
8671
+ _default: () => _default,
8672
+ _function: () => _function,
8673
+ any: () => any,
8674
+ array: () => array,
8675
+ base64: () => base64,
8676
+ base64url: () => base64url,
8677
+ bigint: () => bigint$1,
8678
+ boolean: () => boolean$1,
8679
+ catch: () => _catch,
8680
+ check: () => check,
8681
+ cidrv4: () => cidrv4,
8682
+ cidrv6: () => cidrv6,
8683
+ codec: () => codec,
8684
+ cuid: () => cuid,
8685
+ cuid2: () => cuid2,
8686
+ custom: () => custom,
8687
+ date: () => date$1,
8688
+ describe: () => describe,
8689
+ discriminatedUnion: () => discriminatedUnion,
8690
+ e164: () => e164,
8691
+ email: () => email,
8692
+ emoji: () => emoji,
8693
+ enum: () => _enum,
8694
+ file: () => file,
8695
+ float32: () => float32,
8696
+ float64: () => float64,
8697
+ function: () => _function,
8698
+ guid: () => guid,
8699
+ hash: () => hash,
8700
+ hex: () => hex,
8701
+ hostname: () => hostname,
8702
+ httpUrl: () => httpUrl,
8703
+ instanceof: () => _instanceof,
8704
+ int: () => int,
8705
+ int32: () => int32,
8706
+ int64: () => int64,
8707
+ intersection: () => intersection,
8708
+ ipv4: () => ipv4,
8709
+ ipv6: () => ipv6,
8710
+ json: () => json,
8711
+ jwt: () => jwt,
8712
+ keyof: () => keyof,
8713
+ ksuid: () => ksuid,
8714
+ lazy: () => lazy,
8715
+ literal: () => literal,
8716
+ looseObject: () => looseObject,
8717
+ looseRecord: () => looseRecord,
8718
+ mac: () => mac,
8719
+ map: () => map,
8720
+ meta: () => meta,
8721
+ nan: () => nan,
8722
+ nanoid: () => nanoid,
8723
+ nativeEnum: () => nativeEnum,
8724
+ never: () => never,
8725
+ nonoptional: () => nonoptional,
8726
+ null: () => _null,
8727
+ nullable: () => nullable,
8728
+ nullish: () => nullish,
8729
+ number: () => number$1,
8730
+ object: () => object,
8731
+ optional: () => optional,
8732
+ partialRecord: () => partialRecord,
8733
+ pipe: () => pipe,
8734
+ prefault: () => prefault,
8735
+ preprocess: () => preprocess,
8736
+ promise: () => promise,
8737
+ readonly: () => readonly,
8738
+ record: () => record,
8739
+ refine: () => refine,
8740
+ set: () => set,
8741
+ strictObject: () => strictObject,
8742
+ string: () => string$1,
8743
+ stringFormat: () => stringFormat,
8744
+ stringbool: () => stringbool,
8745
+ success: () => success,
8746
+ superRefine: () => superRefine,
8747
+ symbol: () => symbol,
8748
+ templateLiteral: () => templateLiteral,
8749
+ transform: () => transform,
8750
+ tuple: () => tuple,
8751
+ uint32: () => uint32,
8752
+ uint64: () => uint64,
8753
+ ulid: () => ulid,
8754
+ undefined: () => _undefined,
8755
+ union: () => union,
8756
+ unknown: () => unknown,
8757
+ url: () => url,
8758
+ uuid: () => uuid,
8759
+ uuidv4: () => uuidv4,
8760
+ uuidv6: () => uuidv6,
8761
+ uuidv7: () => uuidv7,
8762
+ void: () => _void,
8763
+ xid: () => xid,
8764
+ xor: () => xor
8765
+ }, 1), ZodType = /* @__PURE__ */ $constructor("ZodType", (f, V) => ($ZodType.init(f, V), Object.assign(f["~standard"], { jsonSchema: {
8766
+ input: createStandardJSONSchemaMethod(f, "input"),
8767
+ output: createStandardJSONSchemaMethod(f, "output")
8768
+ } }), f.toJSONSchema = createToJSONSchemaMethod(f, {}), f.def = V, f.type = V.type, Object.defineProperty(f, "_def", { value: V }), f.check = (...H) => f.clone(mergeDefs(V, { checks: [...V.checks ?? [], ...H.map((f) => typeof f == "function" ? { _zod: {
8432
8769
  check: f,
8433
8770
  def: { check: "custom" },
8434
8771
  onattach: []
@@ -8445,7 +8782,7 @@ var initializer = (f, V) => {
8445
8782
  let H = f.clone();
8446
8783
  return globalRegistry.add(H, V[0]), H;
8447
8784
  }, f.isOptional = () => f.safeParse(void 0).success, f.isNullable = () => f.safeParse(null).success, f)), _ZodString = /* @__PURE__ */ $constructor("_ZodString", (f, V) => {
8448
- $ZodString.init(f, V), ZodType.init(f, V);
8785
+ $ZodString.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => stringProcessor(f, V, H, U);
8449
8786
  let H = f._zod.bag;
8450
8787
  f.format = H.format ?? null, f.minLength = H.minimum ?? null, f.maxLength = H.maximum ?? null, f.regex = (...V) => f.check(_regex(...V)), f.includes = (...V) => f.check(_includes(...V)), f.startsWith = (...V) => f.check(_startsWith(...V)), f.endsWith = (...V) => f.check(_endsWith(...V)), f.min = (...V) => f.check(_minLength(...V)), f.max = (...V) => f.check(_maxLength(...V)), f.length = (...V) => f.check(_length(...V)), f.nonempty = (...V) => f.check(_minLength(1, ...V)), f.lowercase = (V) => f.check(_lowercase(V)), f.uppercase = (V) => f.check(_uppercase(V)), f.trim = () => f.check(_trim()), f.normalize = (...V) => f.check(_normalize(...V)), f.toLowerCase = () => f.check(_toLowerCase()), f.toUpperCase = () => f.check(_toUpperCase()), f.slugify = () => f.check(_slugify());
8451
8788
  }), ZodString = /* @__PURE__ */ $constructor("ZodString", (f, V) => {
@@ -8610,7 +8947,7 @@ function hash(f, V) {
8610
8947
  return _stringFormat(ZodCustomStringFormat, H, U, V);
8611
8948
  }
8612
8949
  var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (f, V) => {
8613
- $ZodNumber.init(f, V), ZodType.init(f, V), f.gt = (V, H) => f.check(_gt(V, H)), f.gte = (V, H) => f.check(_gte(V, H)), f.min = (V, H) => f.check(_gte(V, H)), f.lt = (V, H) => f.check(_lt(V, H)), f.lte = (V, H) => f.check(_lte(V, H)), f.max = (V, H) => f.check(_lte(V, H)), f.int = (V) => f.check(int(V)), f.safe = (V) => f.check(int(V)), f.positive = (V) => f.check(_gt(0, V)), f.nonnegative = (V) => f.check(_gte(0, V)), f.negative = (V) => f.check(_lt(0, V)), f.nonpositive = (V) => f.check(_lte(0, V)), f.multipleOf = (V, H) => f.check(_multipleOf(V, H)), f.step = (V, H) => f.check(_multipleOf(V, H)), f.finite = () => f;
8950
+ $ZodNumber.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => numberProcessor(f, V, H, U), f.gt = (V, H) => f.check(_gt(V, H)), f.gte = (V, H) => f.check(_gte(V, H)), f.min = (V, H) => f.check(_gte(V, H)), f.lt = (V, H) => f.check(_lt(V, H)), f.lte = (V, H) => f.check(_lte(V, H)), f.max = (V, H) => f.check(_lte(V, H)), f.int = (V) => f.check(int(V)), f.safe = (V) => f.check(int(V)), f.positive = (V) => f.check(_gt(0, V)), f.nonnegative = (V) => f.check(_gte(0, V)), f.negative = (V) => f.check(_lt(0, V)), f.nonpositive = (V) => f.check(_lte(0, V)), f.multipleOf = (V, H) => f.check(_multipleOf(V, H)), f.step = (V, H) => f.check(_multipleOf(V, H)), f.finite = () => f;
8614
8951
  let H = f._zod.bag;
8615
8952
  f.minValue = Math.max(H.minimum ?? -Infinity, H.exclusiveMinimum ?? -Infinity) ?? null, f.maxValue = Math.min(H.maximum ?? Infinity, H.exclusiveMaximum ?? Infinity) ?? null, f.isInt = (H.format ?? "").includes("int") || Number.isSafeInteger(H.multipleOf ?? .5), f.isFinite = !0, f.format = H.format ?? null;
8616
8953
  });
@@ -8636,13 +8973,13 @@ function uint32(f) {
8636
8973
  return _uint32(ZodNumberFormat, f);
8637
8974
  }
8638
8975
  var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (f, V) => {
8639
- $ZodBoolean.init(f, V), ZodType.init(f, V);
8976
+ $ZodBoolean.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => booleanProcessor(f, V, H, U);
8640
8977
  });
8641
8978
  function boolean$1(f) {
8642
8979
  return _boolean(ZodBoolean, f);
8643
8980
  }
8644
8981
  var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (f, V) => {
8645
- $ZodBigInt.init(f, V), ZodType.init(f, V), f.gte = (V, H) => f.check(_gte(V, H)), f.min = (V, H) => f.check(_gte(V, H)), f.gt = (V, H) => f.check(_gt(V, H)), f.gte = (V, H) => f.check(_gte(V, H)), f.min = (V, H) => f.check(_gte(V, H)), f.lt = (V, H) => f.check(_lt(V, H)), f.lte = (V, H) => f.check(_lte(V, H)), f.max = (V, H) => f.check(_lte(V, H)), f.positive = (V) => f.check(_gt(BigInt(0), V)), f.negative = (V) => f.check(_lt(BigInt(0), V)), f.nonpositive = (V) => f.check(_lte(BigInt(0), V)), f.nonnegative = (V) => f.check(_gte(BigInt(0), V)), f.multipleOf = (V, H) => f.check(_multipleOf(V, H));
8982
+ $ZodBigInt.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => bigintProcessor(f, V, H, U), f.gte = (V, H) => f.check(_gte(V, H)), f.min = (V, H) => f.check(_gte(V, H)), f.gt = (V, H) => f.check(_gt(V, H)), f.gte = (V, H) => f.check(_gte(V, H)), f.min = (V, H) => f.check(_gte(V, H)), f.lt = (V, H) => f.check(_lt(V, H)), f.lte = (V, H) => f.check(_lte(V, H)), f.max = (V, H) => f.check(_lte(V, H)), f.positive = (V) => f.check(_gt(BigInt(0), V)), f.negative = (V) => f.check(_lt(BigInt(0), V)), f.nonpositive = (V) => f.check(_lte(BigInt(0), V)), f.nonnegative = (V) => f.check(_gte(BigInt(0), V)), f.multipleOf = (V, H) => f.check(_multipleOf(V, H));
8646
8983
  let H = f._zod.bag;
8647
8984
  f.minValue = H.minimum ?? null, f.maxValue = H.maximum ?? null, f.format = H.format ?? null;
8648
8985
  });
@@ -8659,49 +8996,49 @@ function uint64(f) {
8659
8996
  return _uint64(ZodBigIntFormat, f);
8660
8997
  }
8661
8998
  var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (f, V) => {
8662
- $ZodSymbol.init(f, V), ZodType.init(f, V);
8999
+ $ZodSymbol.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => symbolProcessor(f, V, H, U);
8663
9000
  });
8664
9001
  function symbol(f) {
8665
9002
  return _symbol(ZodSymbol, f);
8666
9003
  }
8667
9004
  var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (f, V) => {
8668
- $ZodUndefined.init(f, V), ZodType.init(f, V);
9005
+ $ZodUndefined.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => undefinedProcessor(f, V, H, U);
8669
9006
  });
8670
9007
  function _undefined(f) {
8671
9008
  return _undefined$1(ZodUndefined, f);
8672
9009
  }
8673
9010
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (f, V) => {
8674
- $ZodNull.init(f, V), ZodType.init(f, V);
9011
+ $ZodNull.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => nullProcessor(f, V, H, U);
8675
9012
  });
8676
9013
  function _null(f) {
8677
9014
  return _null$1(ZodNull, f);
8678
9015
  }
8679
9016
  var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (f, V) => {
8680
- $ZodAny.init(f, V), ZodType.init(f, V);
9017
+ $ZodAny.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (f, V, H) => void 0;
8681
9018
  });
8682
9019
  function any() {
8683
9020
  return _any(ZodAny);
8684
9021
  }
8685
9022
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (f, V) => {
8686
- $ZodUnknown.init(f, V), ZodType.init(f, V);
9023
+ $ZodUnknown.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (f, V, H) => void 0;
8687
9024
  });
8688
9025
  function unknown() {
8689
9026
  return _unknown(ZodUnknown);
8690
9027
  }
8691
9028
  var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (f, V) => {
8692
- $ZodNever.init(f, V), ZodType.init(f, V);
9029
+ $ZodNever.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => neverProcessor(f, V, H, U);
8693
9030
  });
8694
9031
  function never(f) {
8695
9032
  return _never(ZodNever, f);
8696
9033
  }
8697
9034
  var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (f, V) => {
8698
- $ZodVoid.init(f, V), ZodType.init(f, V);
9035
+ $ZodVoid.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => voidProcessor(f, V, H, U);
8699
9036
  });
8700
9037
  function _void(f) {
8701
9038
  return _void$1(ZodVoid, f);
8702
9039
  }
8703
9040
  var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (f, V) => {
8704
- $ZodDate.init(f, V), ZodType.init(f, V), f.min = (V, H) => f.check(_gte(V, H)), f.max = (V, H) => f.check(_lte(V, H));
9041
+ $ZodDate.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => dateProcessor(f, V, H, U), f.min = (V, H) => f.check(_gte(V, H)), f.max = (V, H) => f.check(_lte(V, H));
8705
9042
  let H = f._zod.bag;
8706
9043
  f.minDate = H.minimum ? new Date(H.minimum) : null, f.maxDate = H.maximum ? new Date(H.maximum) : null;
8707
9044
  });
@@ -8709,7 +9046,7 @@ function date$1(f) {
8709
9046
  return _date(ZodDate, f);
8710
9047
  }
8711
9048
  var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (f, V) => {
8712
- $ZodArray.init(f, V), ZodType.init(f, V), f.element = V.element, f.min = (V, H) => f.check(_minLength(V, H)), f.nonempty = (V) => f.check(_minLength(1, V)), f.max = (V, H) => f.check(_maxLength(V, H)), f.length = (V, H) => f.check(_length(V, H)), f.unwrap = () => f.element;
9049
+ $ZodArray.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => arrayProcessor(f, V, H, U), f.element = V.element, f.min = (V, H) => f.check(_minLength(V, H)), f.nonempty = (V) => f.check(_minLength(1, V)), f.max = (V, H) => f.check(_maxLength(V, H)), f.length = (V, H) => f.check(_length(V, H)), f.unwrap = () => f.element;
8713
9050
  });
8714
9051
  function array(f, V) {
8715
9052
  return _array(ZodArray, f, V);
@@ -8719,7 +9056,7 @@ function keyof(f) {
8719
9056
  return _enum(Object.keys(V));
8720
9057
  }
8721
9058
  var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (f, V) => {
8722
- $ZodObjectJIT.init(f, V), ZodType.init(f, V), defineLazy(f, "shape", () => V.shape), f.keyof = () => _enum(Object.keys(f._zod.def.shape)), f.catchall = (V) => f.clone({
9059
+ $ZodObjectJIT.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => objectProcessor(f, V, H, U), defineLazy(f, "shape", () => V.shape), f.keyof = () => _enum(Object.keys(f._zod.def.shape)), f.catchall = (V) => f.clone({
8723
9060
  ...f._zod.def,
8724
9061
  catchall: V
8725
9062
  }), f.passthrough = () => f.clone({
@@ -8760,7 +9097,7 @@ function looseObject(f, V) {
8760
9097
  });
8761
9098
  }
8762
9099
  var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (f, V) => {
8763
- $ZodUnion.init(f, V), ZodType.init(f, V), f.options = V.options;
9100
+ $ZodUnion.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => unionProcessor(f, V, H, U), f.options = V.options;
8764
9101
  });
8765
9102
  function union(f, V) {
8766
9103
  return new ZodUnion({
@@ -8769,6 +9106,17 @@ function union(f, V) {
8769
9106
  ...normalizeParams(V)
8770
9107
  });
8771
9108
  }
9109
+ var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (f, V) => {
9110
+ ZodUnion.init(f, V), $ZodXor.init(f, V), f._zod.processJSONSchema = (V, H, U) => unionProcessor(f, V, H, U), f.options = V.options;
9111
+ });
9112
+ function xor(f, V) {
9113
+ return new ZodXor({
9114
+ type: "union",
9115
+ options: f,
9116
+ inclusive: !1,
9117
+ ...normalizeParams(V)
9118
+ });
9119
+ }
8772
9120
  var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (f, V) => {
8773
9121
  ZodUnion.init(f, V), $ZodDiscriminatedUnion.init(f, V);
8774
9122
  });
@@ -8781,7 +9129,7 @@ function discriminatedUnion(f, V, H) {
8781
9129
  });
8782
9130
  }
8783
9131
  var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (f, V) => {
8784
- $ZodIntersection.init(f, V), ZodType.init(f, V);
9132
+ $ZodIntersection.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => intersectionProcessor(f, V, H, U);
8785
9133
  });
8786
9134
  function intersection(f, V) {
8787
9135
  return new ZodIntersection({
@@ -8791,7 +9139,7 @@ function intersection(f, V) {
8791
9139
  });
8792
9140
  }
8793
9141
  var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (f, V) => {
8794
- $ZodTuple.init(f, V), ZodType.init(f, V), f.rest = (V) => f.clone({
9142
+ $ZodTuple.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => tupleProcessor(f, V, H, U), f.rest = (V) => f.clone({
8795
9143
  ...f._zod.def,
8796
9144
  rest: V
8797
9145
  });
@@ -8806,7 +9154,7 @@ function tuple(f, V, H) {
8806
9154
  });
8807
9155
  }
8808
9156
  var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (f, V) => {
8809
- $ZodRecord.init(f, V), ZodType.init(f, V), f.keyType = V.keyType, f.valueType = V.valueType;
9157
+ $ZodRecord.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => recordProcessor(f, V, H, U), f.keyType = V.keyType, f.valueType = V.valueType;
8810
9158
  });
8811
9159
  function record(f, V, H) {
8812
9160
  return new ZodRecord({
@@ -8825,8 +9173,17 @@ function partialRecord(f, V, H) {
8825
9173
  ...normalizeParams(H)
8826
9174
  });
8827
9175
  }
9176
+ function looseRecord(f, V, H) {
9177
+ return new ZodRecord({
9178
+ type: "record",
9179
+ keyType: f,
9180
+ valueType: V,
9181
+ mode: "loose",
9182
+ ...normalizeParams(H)
9183
+ });
9184
+ }
8828
9185
  var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (f, V) => {
8829
- $ZodMap.init(f, V), ZodType.init(f, V), f.keyType = V.keyType, f.valueType = V.valueType;
9186
+ $ZodMap.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => mapProcessor(f, V, H, U), f.keyType = V.keyType, f.valueType = V.valueType;
8830
9187
  });
8831
9188
  function map(f, V, H) {
8832
9189
  return new ZodMap({
@@ -8837,7 +9194,7 @@ function map(f, V, H) {
8837
9194
  });
8838
9195
  }
8839
9196
  var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (f, V) => {
8840
- $ZodSet.init(f, V), ZodType.init(f, V), f.min = (...V) => f.check(_minSize(...V)), f.nonempty = (V) => f.check(_minSize(1, V)), f.max = (...V) => f.check(_maxSize(...V)), f.size = (...V) => f.check(_size(...V));
9197
+ $ZodSet.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => setProcessor(f, V, H, U), f.min = (...V) => f.check(_minSize(...V)), f.nonempty = (V) => f.check(_minSize(1, V)), f.max = (...V) => f.check(_maxSize(...V)), f.size = (...V) => f.check(_size(...V));
8841
9198
  });
8842
9199
  function set(f, V) {
8843
9200
  return new ZodSet({
@@ -8847,7 +9204,7 @@ function set(f, V) {
8847
9204
  });
8848
9205
  }
8849
9206
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (f, V) => {
8850
- $ZodEnum.init(f, V), ZodType.init(f, V), f.enum = V.entries, f.options = Object.values(V.entries);
9207
+ $ZodEnum.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => enumProcessor(f, V, H, U), f.enum = V.entries, f.options = Object.values(V.entries);
8851
9208
  let H = new Set(Object.keys(V.entries));
8852
9209
  f.extract = (f, U) => {
8853
9210
  let W = {};
@@ -8886,7 +9243,7 @@ function nativeEnum(f, V) {
8886
9243
  });
8887
9244
  }
8888
9245
  var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (f, V) => {
8889
- $ZodLiteral.init(f, V), ZodType.init(f, V), f.values = new Set(V.values), Object.defineProperty(f, "value", { get() {
9246
+ $ZodLiteral.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => literalProcessor(f, V, H, U), f.values = new Set(V.values), Object.defineProperty(f, "value", { get() {
8890
9247
  if (V.values.length > 1) throw Error("This schema contains multiple valid literal values. Use `.values` instead.");
8891
9248
  return V.values[0];
8892
9249
  } });
@@ -8899,13 +9256,13 @@ function literal(f, V) {
8899
9256
  });
8900
9257
  }
8901
9258
  var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (f, V) => {
8902
- $ZodFile.init(f, V), ZodType.init(f, V), f.min = (V, H) => f.check(_minSize(V, H)), f.max = (V, H) => f.check(_maxSize(V, H)), f.mime = (V, H) => f.check(_mime(Array.isArray(V) ? V : [V], H));
9259
+ $ZodFile.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => fileProcessor(f, V, H, U), f.min = (V, H) => f.check(_minSize(V, H)), f.max = (V, H) => f.check(_maxSize(V, H)), f.mime = (V, H) => f.check(_mime(Array.isArray(V) ? V : [V], H));
8903
9260
  });
8904
9261
  function file(f) {
8905
9262
  return _file(ZodFile, f);
8906
9263
  }
8907
9264
  var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (f, V) => {
8908
- $ZodTransform.init(f, V), ZodType.init(f, V), f._zod.parse = (H, U) => {
9265
+ $ZodTransform.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => transformProcessor(f, V, H, U), f._zod.parse = (H, U) => {
8909
9266
  if (U.direction === "backward") throw new $ZodEncodeError(f.constructor.name);
8910
9267
  H.addIssue = (U) => {
8911
9268
  if (typeof U == "string") H.issues.push(issue(U, H.value, V));
@@ -8925,7 +9282,7 @@ function transform(f) {
8925
9282
  });
8926
9283
  }
8927
9284
  var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (f, V) => {
8928
- $ZodOptional.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9285
+ $ZodOptional.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => optionalProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
8929
9286
  });
8930
9287
  function optional(f) {
8931
9288
  return new ZodOptional({
@@ -8934,7 +9291,7 @@ function optional(f) {
8934
9291
  });
8935
9292
  }
8936
9293
  var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (f, V) => {
8937
- $ZodNullable.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9294
+ $ZodNullable.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => nullableProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
8938
9295
  });
8939
9296
  function nullable(f) {
8940
9297
  return new ZodNullable({
@@ -8946,7 +9303,7 @@ function nullish(f) {
8946
9303
  return optional(nullable(f));
8947
9304
  }
8948
9305
  var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (f, V) => {
8949
- $ZodDefault.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType, f.removeDefault = f.unwrap;
9306
+ $ZodDefault.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => defaultProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType, f.removeDefault = f.unwrap;
8950
9307
  });
8951
9308
  function _default(f, V) {
8952
9309
  return new ZodDefault({
@@ -8958,7 +9315,7 @@ function _default(f, V) {
8958
9315
  });
8959
9316
  }
8960
9317
  var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (f, V) => {
8961
- $ZodPrefault.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9318
+ $ZodPrefault.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => prefaultProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
8962
9319
  });
8963
9320
  function prefault(f, V) {
8964
9321
  return new ZodPrefault({
@@ -8970,7 +9327,7 @@ function prefault(f, V) {
8970
9327
  });
8971
9328
  }
8972
9329
  var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (f, V) => {
8973
- $ZodNonOptional.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9330
+ $ZodNonOptional.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => nonoptionalProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
8974
9331
  });
8975
9332
  function nonoptional(f, V) {
8976
9333
  return new ZodNonOptional({
@@ -8980,7 +9337,7 @@ function nonoptional(f, V) {
8980
9337
  });
8981
9338
  }
8982
9339
  var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (f, V) => {
8983
- $ZodSuccess.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9340
+ $ZodSuccess.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => successProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
8984
9341
  });
8985
9342
  function success(f) {
8986
9343
  return new ZodSuccess({
@@ -8989,7 +9346,7 @@ function success(f) {
8989
9346
  });
8990
9347
  }
8991
9348
  var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (f, V) => {
8992
- $ZodCatch.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType, f.removeCatch = f.unwrap;
9349
+ $ZodCatch.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => catchProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType, f.removeCatch = f.unwrap;
8993
9350
  });
8994
9351
  function _catch(f, V) {
8995
9352
  return new ZodCatch({
@@ -8999,13 +9356,13 @@ function _catch(f, V) {
8999
9356
  });
9000
9357
  }
9001
9358
  var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (f, V) => {
9002
- $ZodNaN.init(f, V), ZodType.init(f, V);
9359
+ $ZodNaN.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => nanProcessor(f, V, H, U);
9003
9360
  });
9004
9361
  function nan(f) {
9005
9362
  return _nan(ZodNaN, f);
9006
9363
  }
9007
9364
  var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (f, V) => {
9008
- $ZodPipe.init(f, V), ZodType.init(f, V), f.in = V.in, f.out = V.out;
9365
+ $ZodPipe.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => pipeProcessor(f, V, H, U), f.in = V.in, f.out = V.out;
9009
9366
  });
9010
9367
  function pipe(f, V) {
9011
9368
  return new ZodPipe({
@@ -9027,7 +9384,7 @@ function codec(f, V, H) {
9027
9384
  });
9028
9385
  }
9029
9386
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (f, V) => {
9030
- $ZodReadonly.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9387
+ $ZodReadonly.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => readonlyProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
9031
9388
  });
9032
9389
  function readonly(f) {
9033
9390
  return new ZodReadonly({
@@ -9036,7 +9393,7 @@ function readonly(f) {
9036
9393
  });
9037
9394
  }
9038
9395
  var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (f, V) => {
9039
- $ZodTemplateLiteral.init(f, V), ZodType.init(f, V);
9396
+ $ZodTemplateLiteral.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => templateLiteralProcessor(f, V, H, U);
9040
9397
  });
9041
9398
  function templateLiteral(f, V) {
9042
9399
  return new ZodTemplateLiteral({
@@ -9046,7 +9403,7 @@ function templateLiteral(f, V) {
9046
9403
  });
9047
9404
  }
9048
9405
  var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (f, V) => {
9049
- $ZodLazy.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.getter();
9406
+ $ZodLazy.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => lazyProcessor(f, V, H, U), f.unwrap = () => f._zod.def.getter();
9050
9407
  });
9051
9408
  function lazy(f) {
9052
9409
  return new ZodLazy({
@@ -9055,7 +9412,7 @@ function lazy(f) {
9055
9412
  });
9056
9413
  }
9057
9414
  var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (f, V) => {
9058
- $ZodPromise.init(f, V), ZodType.init(f, V), f.unwrap = () => f._zod.def.innerType;
9415
+ $ZodPromise.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => promiseProcessor(f, V, H, U), f.unwrap = () => f._zod.def.innerType;
9059
9416
  });
9060
9417
  function promise(f) {
9061
9418
  return new ZodPromise({
@@ -9064,7 +9421,7 @@ function promise(f) {
9064
9421
  });
9065
9422
  }
9066
9423
  var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (f, V) => {
9067
- $ZodFunction.init(f, V), ZodType.init(f, V);
9424
+ $ZodFunction.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => functionProcessor(f, V, H, U);
9068
9425
  });
9069
9426
  function _function(f) {
9070
9427
  return new ZodFunction({
@@ -9074,7 +9431,7 @@ function _function(f) {
9074
9431
  });
9075
9432
  }
9076
9433
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (f, V) => {
9077
- $ZodCustom.init(f, V), ZodType.init(f, V);
9434
+ $ZodCustom.init(f, V), ZodType.init(f, V), f._zod.processJSONSchema = (V, H, U) => customProcessor(f, V, H, U);
9078
9435
  });
9079
9436
  function check(f) {
9080
9437
  let V = new $ZodCheck({ check: "custom" });
@@ -9140,6 +9497,175 @@ function getErrorMap() {
9140
9497
  }
9141
9498
  var ZodFirstPartyTypeKind;
9142
9499
  (function(f) {})(ZodFirstPartyTypeKind ||= {});
9500
+ var z = {
9501
+ ...schemas_exports,
9502
+ ...checks_exports,
9503
+ iso: iso_exports
9504
+ };
9505
+ function detectVersion(f, V) {
9506
+ let H = f.$schema;
9507
+ return H === "https://json-schema.org/draft/2020-12/schema" ? "draft-2020-12" : H === "http://json-schema.org/draft-07/schema#" ? "draft-7" : H === "http://json-schema.org/draft-04/schema#" ? "draft-4" : V ?? "draft-2020-12";
9508
+ }
9509
+ function resolveRef(f, V) {
9510
+ if (!f.startsWith("#")) throw Error("External $ref is not supported, only local refs (#/...) are allowed");
9511
+ let H = f.slice(1).split("/").filter(Boolean);
9512
+ if (H.length === 0) return V.rootSchema;
9513
+ let U = V.version === "draft-2020-12" ? "$defs" : "definitions";
9514
+ if (H[0] === U) {
9515
+ let U = H[1];
9516
+ if (!U || !V.defs[U]) throw Error(`Reference not found: ${f}`);
9517
+ return V.defs[U];
9518
+ }
9519
+ throw Error(`Reference not found: ${f}`);
9520
+ }
9521
+ function convertBaseSchema(f, V) {
9522
+ if (f.not !== void 0) {
9523
+ if (typeof f.not == "object" && Object.keys(f.not).length === 0) return z.never();
9524
+ throw Error("not is not supported in Zod (except { not: {} } for never)");
9525
+ }
9526
+ if (f.unevaluatedItems !== void 0) throw Error("unevaluatedItems is not supported");
9527
+ if (f.unevaluatedProperties !== void 0) throw Error("unevaluatedProperties is not supported");
9528
+ if (f.if !== void 0 || f.then !== void 0 || f.else !== void 0) throw Error("Conditional schemas (if/then/else) are not supported");
9529
+ if (f.dependentSchemas !== void 0 || f.dependentRequired !== void 0) throw Error("dependentSchemas and dependentRequired are not supported");
9530
+ if (f.$ref) {
9531
+ let H = f.$ref;
9532
+ if (V.refs.has(H)) return V.refs.get(H);
9533
+ if (V.processing.has(H)) return z.lazy(() => {
9534
+ if (!V.refs.has(H)) throw Error(`Circular reference not resolved: ${H}`);
9535
+ return V.refs.get(H);
9536
+ });
9537
+ V.processing.add(H);
9538
+ let U = convertSchema(resolveRef(H, V), V);
9539
+ return V.refs.set(H, U), V.processing.delete(H), U;
9540
+ }
9541
+ if (f.enum !== void 0) {
9542
+ let H = f.enum;
9543
+ if (V.version === "openapi-3.0" && f.nullable === !0 && H.length === 1 && H[0] === null) return z.null();
9544
+ if (H.length === 0) return z.never();
9545
+ if (H.length === 1) return z.literal(H[0]);
9546
+ if (H.every((f) => typeof f == "string")) return z.enum(H);
9547
+ let U = H.map((f) => z.literal(f));
9548
+ return U.length < 2 ? U[0] : z.union([
9549
+ U[0],
9550
+ U[1],
9551
+ ...U.slice(2)
9552
+ ]);
9553
+ }
9554
+ if (f.const !== void 0) return z.literal(f.const);
9555
+ let H = f.type;
9556
+ if (Array.isArray(H)) {
9557
+ let U = H.map((H) => convertBaseSchema({
9558
+ ...f,
9559
+ type: H
9560
+ }, V));
9561
+ return U.length === 0 ? z.never() : U.length === 1 ? U[0] : z.union(U);
9562
+ }
9563
+ if (!H) return z.any();
9564
+ let U;
9565
+ switch (H) {
9566
+ case "string": {
9567
+ let V = z.string();
9568
+ if (f.format) {
9569
+ let H = f.format;
9570
+ H === "email" ? V = V.check(z.email()) : H === "uri" || H === "uri-reference" ? V = V.check(z.url()) : H === "uuid" || H === "guid" ? V = V.check(z.uuid()) : H === "date-time" ? V = V.check(z.iso.datetime()) : H === "date" ? V = V.check(z.iso.date()) : H === "time" ? V = V.check(z.iso.time()) : H === "duration" ? V = V.check(z.iso.duration()) : H === "ipv4" ? V = V.check(z.ipv4()) : H === "ipv6" ? V = V.check(z.ipv6()) : H === "mac" ? V = V.check(z.mac()) : H === "cidr" ? V = V.check(z.cidrv4()) : H === "cidr-v6" ? V = V.check(z.cidrv6()) : H === "base64" ? V = V.check(z.base64()) : H === "base64url" ? V = V.check(z.base64url()) : H === "e164" ? V = V.check(z.e164()) : H === "jwt" ? V = V.check(z.jwt()) : H === "emoji" ? V = V.check(z.emoji()) : H === "nanoid" ? V = V.check(z.nanoid()) : H === "cuid" ? V = V.check(z.cuid()) : H === "cuid2" ? V = V.check(z.cuid2()) : H === "ulid" ? V = V.check(z.ulid()) : H === "xid" ? V = V.check(z.xid()) : H === "ksuid" && (V = V.check(z.ksuid()));
9571
+ }
9572
+ typeof f.minLength == "number" && (V = V.min(f.minLength)), typeof f.maxLength == "number" && (V = V.max(f.maxLength)), f.pattern && (V = V.regex(new RegExp(f.pattern))), U = V;
9573
+ break;
9574
+ }
9575
+ case "number":
9576
+ case "integer": {
9577
+ let V = H === "integer" ? z.number().int() : z.number();
9578
+ typeof f.minimum == "number" && (V = V.min(f.minimum)), typeof f.maximum == "number" && (V = V.max(f.maximum)), typeof f.exclusiveMinimum == "number" ? V = V.gt(f.exclusiveMinimum) : f.exclusiveMinimum === !0 && typeof f.minimum == "number" && (V = V.gt(f.minimum)), typeof f.exclusiveMaximum == "number" ? V = V.lt(f.exclusiveMaximum) : f.exclusiveMaximum === !0 && typeof f.maximum == "number" && (V = V.lt(f.maximum)), typeof f.multipleOf == "number" && (V = V.multipleOf(f.multipleOf)), U = V;
9579
+ break;
9580
+ }
9581
+ case "boolean":
9582
+ U = z.boolean();
9583
+ break;
9584
+ case "null":
9585
+ U = z.null();
9586
+ break;
9587
+ case "object": {
9588
+ let H = {}, W = f.properties || {}, G = new Set(f.required || []);
9589
+ for (let [f, U] of Object.entries(W)) {
9590
+ let W = convertSchema(U, V);
9591
+ H[f] = G.has(f) ? W : W.optional();
9592
+ }
9593
+ if (f.propertyNames) {
9594
+ let W = convertSchema(f.propertyNames, V), G = f.additionalProperties && typeof f.additionalProperties == "object" ? convertSchema(f.additionalProperties, V) : z.any();
9595
+ if (Object.keys(H).length === 0) {
9596
+ U = z.record(W, G);
9597
+ break;
9598
+ }
9599
+ let K = z.object(H).passthrough(), q = z.looseRecord(W, G);
9600
+ U = z.intersection(K, q);
9601
+ break;
9602
+ }
9603
+ if (f.patternProperties) {
9604
+ let W = f.patternProperties, G = Object.keys(W), K = [];
9605
+ for (let f of G) {
9606
+ let H = convertSchema(W[f], V), U = z.string().regex(new RegExp(f));
9607
+ K.push(z.looseRecord(U, H));
9608
+ }
9609
+ let q = [];
9610
+ if (Object.keys(H).length > 0 && q.push(z.object(H).passthrough()), q.push(...K), q.length === 0) U = z.object({}).passthrough();
9611
+ else if (q.length === 1) U = q[0];
9612
+ else {
9613
+ let f = z.intersection(q[0], q[1]);
9614
+ for (let V = 2; V < q.length; V++) f = z.intersection(f, q[V]);
9615
+ U = f;
9616
+ }
9617
+ break;
9618
+ }
9619
+ let K = z.object(H);
9620
+ U = f.additionalProperties === !1 ? K.strict() : typeof f.additionalProperties == "object" ? K.catchall(convertSchema(f.additionalProperties, V)) : K.passthrough();
9621
+ break;
9622
+ }
9623
+ case "array": {
9624
+ let H = f.prefixItems, W = f.items;
9625
+ if (H && Array.isArray(H)) {
9626
+ let G = H.map((f) => convertSchema(f, V)), K = W && typeof W == "object" && !Array.isArray(W) ? convertSchema(W, V) : void 0;
9627
+ U = K ? z.tuple(G).rest(K) : z.tuple(G), typeof f.minItems == "number" && (U = U.check(z.minLength(f.minItems))), typeof f.maxItems == "number" && (U = U.check(z.maxLength(f.maxItems)));
9628
+ } else if (Array.isArray(W)) {
9629
+ let H = W.map((f) => convertSchema(f, V)), G = f.additionalItems && typeof f.additionalItems == "object" ? convertSchema(f.additionalItems, V) : void 0;
9630
+ U = G ? z.tuple(H).rest(G) : z.tuple(H), typeof f.minItems == "number" && (U = U.check(z.minLength(f.minItems))), typeof f.maxItems == "number" && (U = U.check(z.maxLength(f.maxItems)));
9631
+ } else if (W !== void 0) {
9632
+ let H = convertSchema(W, V), G = z.array(H);
9633
+ typeof f.minItems == "number" && (G = G.min(f.minItems)), typeof f.maxItems == "number" && (G = G.max(f.maxItems)), U = G;
9634
+ } else U = z.array(z.any());
9635
+ break;
9636
+ }
9637
+ default: throw Error(`Unsupported type: ${H}`);
9638
+ }
9639
+ return f.description && (U = U.describe(f.description)), f.default !== void 0 && (U = U.default(f.default)), U;
9640
+ }
9641
+ function convertSchema(f, V) {
9642
+ if (typeof f == "boolean") return f ? z.any() : z.never();
9643
+ let H = convertBaseSchema(f, V), U = f.type || f.enum !== void 0 || f.const !== void 0;
9644
+ if (f.anyOf && Array.isArray(f.anyOf)) {
9645
+ let W = f.anyOf.map((f) => convertSchema(f, V)), G = z.union(W);
9646
+ H = U ? z.intersection(H, G) : G;
9647
+ }
9648
+ if (f.oneOf && Array.isArray(f.oneOf)) {
9649
+ let W = f.oneOf.map((f) => convertSchema(f, V)), G = z.xor(W);
9650
+ H = U ? z.intersection(H, G) : G;
9651
+ }
9652
+ if (f.allOf && Array.isArray(f.allOf)) if (f.allOf.length === 0) H = U ? H : z.any();
9653
+ else {
9654
+ let W = U ? H : convertSchema(f.allOf[0], V), G = U ? 0 : 1;
9655
+ for (let H = G; H < f.allOf.length; H++) W = z.intersection(W, convertSchema(f.allOf[H], V));
9656
+ H = W;
9657
+ }
9658
+ return f.nullable === !0 && V.version === "openapi-3.0" && (H = z.nullable(H)), f.readOnly === !0 && (H = z.readonly(H)), H;
9659
+ }
9660
+ function fromJSONSchema(f, V) {
9661
+ return typeof f == "boolean" ? f ? z.any() : z.never() : convertSchema(f, {
9662
+ version: detectVersion(f, V?.defaultTarget),
9663
+ defs: f.$defs || f.definitions || {},
9664
+ refs: /* @__PURE__ */ new Map(),
9665
+ processing: /* @__PURE__ */ new Set(),
9666
+ rootSchema: f
9667
+ });
9668
+ }
9143
9669
  var coerce_exports = /* @__PURE__ */ __export({
9144
9670
  bigint: () => bigint,
9145
9671
  boolean: () => boolean,
@@ -9242,6 +9768,7 @@ var external_exports = /* @__PURE__ */ __export({
9242
9768
  ZodUnknown: () => ZodUnknown,
9243
9769
  ZodVoid: () => ZodVoid,
9244
9770
  ZodXID: () => ZodXID,
9771
+ ZodXor: () => ZodXor,
9245
9772
  _ZodString: () => _ZodString,
9246
9773
  _default: () => _default,
9247
9774
  _function: () => _function,
@@ -9280,6 +9807,7 @@ var external_exports = /* @__PURE__ */ __export({
9280
9807
  float32: () => float32,
9281
9808
  float64: () => float64,
9282
9809
  formatError: () => formatError,
9810
+ fromJSONSchema: () => fromJSONSchema,
9283
9811
  function: () => _function,
9284
9812
  getErrorMap: () => getErrorMap,
9285
9813
  globalRegistry: () => globalRegistry,
@@ -9308,6 +9836,7 @@ var external_exports = /* @__PURE__ */ __export({
9308
9836
  literal: () => literal,
9309
9837
  locales: () => locales_exports,
9310
9838
  looseObject: () => looseObject,
9839
+ looseRecord: () => looseRecord,
9311
9840
  lowercase: () => _lowercase,
9312
9841
  lt: () => _lt,
9313
9842
  lte: () => _lte,
@@ -9392,7 +9921,8 @@ var external_exports = /* @__PURE__ */ __export({
9392
9921
  uuidv6: () => uuidv6,
9393
9922
  uuidv7: () => uuidv7,
9394
9923
  void: () => _void,
9395
- xid: () => xid
9924
+ xid: () => xid,
9925
+ xor: () => xor
9396
9926
  }, 1);
9397
9927
  config(en_default());
9398
9928
  var zod_default = external_exports, shapePoint = zod_default.object({