@flexprice/mcp-server 2.1.6 → 2.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/bin/mcp-server.js +1006 -393
  2. package/bin/mcp-server.js.map +40 -35
  3. package/bun.lock +44 -36
  4. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.d.ts +16 -0
  5. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.d.ts.map +1 -0
  6. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.js +82 -0
  7. package/esm/funcs/subscriptionsQuerySubscriptionLineItems.js.map +1 -0
  8. package/esm/landing-page.d.ts.map +1 -1
  9. package/esm/landing-page.js +8 -2
  10. package/esm/landing-page.js.map +1 -1
  11. package/esm/lib/config.d.ts +3 -3
  12. package/esm/lib/config.js +3 -3
  13. package/esm/lib/config.js.map +1 -1
  14. package/esm/mcp-server/cli/serve/impl.js +1 -1
  15. package/esm/mcp-server/cli/serve/impl.js.map +1 -1
  16. package/esm/mcp-server/mcp-server.js +1 -1
  17. package/esm/mcp-server/mcp-server.js.map +1 -1
  18. package/esm/mcp-server/server.d.ts.map +1 -1
  19. package/esm/mcp-server/server.js +3 -1
  20. package/esm/mcp-server/server.js.map +1 -1
  21. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.d.ts +7 -0
  22. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.d.ts.map +1 -0
  23. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.js +35 -0
  24. package/esm/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.js.map +1 -0
  25. package/esm/models/createsubscriptionrequest.d.ts +1 -0
  26. package/esm/models/createsubscriptionrequest.d.ts.map +1 -1
  27. package/esm/models/createsubscriptionrequest.js +1 -0
  28. package/esm/models/createsubscriptionrequest.js.map +1 -1
  29. package/esm/models/customerfilter.d.ts +3 -0
  30. package/esm/models/customerfilter.d.ts.map +1 -1
  31. package/esm/models/customerfilter.js +1 -0
  32. package/esm/models/customerfilter.js.map +1 -1
  33. package/esm/models/executesubscriptionmodifyrequest.d.ts +2 -0
  34. package/esm/models/executesubscriptionmodifyrequest.d.ts.map +1 -1
  35. package/esm/models/executesubscriptionmodifyrequest.js +3 -0
  36. package/esm/models/executesubscriptionmodifyrequest.js.map +1 -1
  37. package/esm/models/groupedinvoicingaction.d.ts +12 -0
  38. package/esm/models/groupedinvoicingaction.d.ts.map +1 -0
  39. package/esm/models/groupedinvoicingaction.js +13 -0
  40. package/esm/models/groupedinvoicingaction.js.map +1 -0
  41. package/esm/models/invoicebillingreason.d.ts +4 -0
  42. package/esm/models/invoicebillingreason.d.ts.map +1 -1
  43. package/esm/models/invoicebillingreason.js +4 -0
  44. package/esm/models/invoicebillingreason.js.map +1 -1
  45. package/esm/models/listsubscriptionlineitemsresponse.d.ts +9 -0
  46. package/esm/models/listsubscriptionlineitemsresponse.d.ts.map +1 -0
  47. package/esm/models/listsubscriptionlineitemsresponse.js +11 -0
  48. package/esm/models/listsubscriptionlineitemsresponse.js.map +1 -0
  49. package/esm/models/planfilter.d.ts +3 -0
  50. package/esm/models/planfilter.d.ts.map +1 -1
  51. package/esm/models/planfilter.js +1 -0
  52. package/esm/models/planfilter.js.map +1 -1
  53. package/esm/models/querysubscriptionlineitemsop.d.ts +6 -0
  54. package/esm/models/querysubscriptionlineitemsop.d.ts.map +1 -0
  55. package/esm/models/querysubscriptionlineitemsop.js +11 -0
  56. package/esm/models/querysubscriptionlineitemsop.js.map +1 -0
  57. package/esm/models/submodifygroupedinvoicingparams.d.ts +9 -0
  58. package/esm/models/submodifygroupedinvoicingparams.d.ts.map +1 -0
  59. package/esm/models/submodifygroupedinvoicingparams.js +11 -0
  60. package/esm/models/submodifygroupedinvoicingparams.js.map +1 -0
  61. package/esm/models/subscriptioninheritanceconfig.d.ts +1 -0
  62. package/esm/models/subscriptioninheritanceconfig.d.ts.map +1 -1
  63. package/esm/models/subscriptioninheritanceconfig.js +6 -3
  64. package/esm/models/subscriptioninheritanceconfig.js.map +1 -1
  65. package/esm/models/subscriptionlineitemfilter.d.ts +39 -0
  66. package/esm/models/subscriptionlineitemfilter.d.ts.map +1 -0
  67. package/esm/models/subscriptionlineitemfilter.js +39 -0
  68. package/esm/models/subscriptionlineitemfilter.js.map +1 -0
  69. package/esm/models/subscriptionmodifytype.d.ts +2 -0
  70. package/esm/models/subscriptionmodifytype.d.ts.map +1 -1
  71. package/esm/models/subscriptionmodifytype.js +2 -0
  72. package/esm/models/subscriptionmodifytype.js.map +1 -1
  73. package/esm/models/subscriptionresponse.d.ts +1 -0
  74. package/esm/models/subscriptionresponse.d.ts.map +1 -1
  75. package/esm/models/subscriptionresponse.js +1 -0
  76. package/esm/models/subscriptionresponse.js.map +1 -1
  77. package/esm/models/subscriptionresponsev2.d.ts +1 -0
  78. package/esm/models/subscriptionresponsev2.d.ts.map +1 -1
  79. package/esm/models/subscriptionresponsev2.js +1 -0
  80. package/esm/models/subscriptionresponsev2.js.map +1 -1
  81. package/esm/models/subscriptiontype.d.ts +4 -0
  82. package/esm/models/subscriptiontype.d.ts.map +1 -1
  83. package/esm/models/subscriptiontype.js +4 -0
  84. package/esm/models/subscriptiontype.js.map +1 -1
  85. package/esm/tool-names.d.ts.map +1 -1
  86. package/esm/tool-names.js +4 -0
  87. package/esm/tool-names.js.map +1 -1
  88. package/esm/tsconfig.tsbuildinfo +1 -1
  89. package/esm/types/bigint.d.ts.map +1 -1
  90. package/esm/types/bigint.js +4 -3
  91. package/esm/types/bigint.js.map +1 -1
  92. package/manifest.json +5 -1
  93. package/package.json +1 -1
  94. package/src/funcs/subscriptionsQuerySubscriptionLineItems.ts +144 -0
  95. package/src/landing-page.ts +8 -2
  96. package/src/lib/config.ts +3 -3
  97. package/src/mcp-server/cli/serve/impl.ts +1 -1
  98. package/src/mcp-server/mcp-server.ts +1 -1
  99. package/src/mcp-server/server.ts +3 -1
  100. package/src/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.ts +45 -0
  101. package/src/models/createsubscriptionrequest.ts +4 -0
  102. package/src/models/customerfilter.ts +2 -0
  103. package/src/models/executesubscriptionmodifyrequest.ts +7 -0
  104. package/src/models/groupedinvoicingaction.ts +17 -0
  105. package/src/models/invoicebillingreason.ts +4 -0
  106. package/src/models/listsubscriptionlineitemsresponse.ts +25 -0
  107. package/src/models/planfilter.ts +2 -0
  108. package/src/models/querysubscriptionlineitemsop.ts +21 -0
  109. package/src/models/submodifygroupedinvoicingparams.ts +25 -0
  110. package/src/models/subscriptioninheritanceconfig.ts +15 -3
  111. package/src/models/subscriptionlineitemfilter.ts +77 -0
  112. package/src/models/subscriptionmodifytype.ts +2 -0
  113. package/src/models/subscriptionresponse.ts +4 -0
  114. package/src/models/subscriptionresponsev2.ts +4 -0
  115. package/src/models/subscriptiontype.ts +4 -0
  116. package/src/tool-names.ts +4 -0
  117. package/src/types/bigint.ts +18 -17
package/bin/mcp-server.js CHANGED
@@ -85,10 +85,10 @@ function $constructor(name, initializer, params) {
85
85
  }
86
86
  Object.defineProperty(Definition, "name", { value: name });
87
87
  function _(def) {
88
- var _a;
88
+ var _a2;
89
89
  const inst = params?.Parent ? new Definition : this;
90
90
  init(inst, def);
91
- (_a = inst._zod).deferred ?? (_a.deferred = []);
91
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
92
92
  for (const fn of inst._zod.deferred) {
93
93
  fn();
94
94
  }
@@ -110,11 +110,8 @@ function config(newConfig) {
110
110
  Object.assign(globalConfig, newConfig);
111
111
  return globalConfig;
112
112
  }
113
- var NEVER, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig;
113
+ var _a, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig;
114
114
  var init_core = __esm(() => {
115
- NEVER = Object.freeze({
116
- status: "aborted"
117
- });
118
115
  $brand = Symbol("zod_brand");
119
116
  $ZodAsyncError = class $ZodAsyncError extends Error {
120
117
  constructor() {
@@ -127,7 +124,8 @@ var init_core = __esm(() => {
127
124
  this.name = "ZodEncodeError";
128
125
  }
129
126
  };
130
- globalConfig = {};
127
+ (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
128
+ globalConfig = globalThis.__zod_globalConfig;
131
129
  });
132
130
 
133
131
  // node_modules/zod/v4/core/util.js
@@ -172,6 +170,7 @@ __export(exports_util, {
172
170
  floatSafeRemainder: () => floatSafeRemainder,
173
171
  finalizeIssue: () => finalizeIssue,
174
172
  extend: () => extend,
173
+ explicitlyAborted: () => explicitlyAborted,
175
174
  escapeRegex: () => escapeRegex,
176
175
  esc: () => esc,
177
176
  defineLazy: () => defineLazy,
@@ -242,19 +241,12 @@ function cleanRegex(source) {
242
241
  return source.slice(start, end);
243
242
  }
244
243
  function floatSafeRemainder(val, step) {
245
- const valDecCount = (val.toString().split(".")[1] || "").length;
246
- const stepString = step.toString();
247
- let stepDecCount = (stepString.split(".")[1] || "").length;
248
- if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
249
- const match = stepString.match(/\d?e-(\d?)/);
250
- if (match?.[1]) {
251
- stepDecCount = Number.parseInt(match[1]);
252
- }
253
- }
254
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
255
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
256
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
257
- return valInt % stepInt / 10 ** decCount;
244
+ const ratio = val / step;
245
+ const roundedRatio = Math.round(ratio);
246
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
247
+ if (Math.abs(ratio - roundedRatio) < tolerance)
248
+ return 0;
249
+ return ratio - roundedRatio;
258
250
  }
259
251
  function defineLazy(object, key, getter) {
260
252
  let value = undefined;
@@ -353,6 +345,10 @@ function shallowClone(o) {
353
345
  return { ...o };
354
346
  if (Array.isArray(o))
355
347
  return [...o];
348
+ if (o instanceof Map)
349
+ return new Map(o);
350
+ if (o instanceof Set)
351
+ return new Set(o);
356
352
  return o;
357
353
  }
358
354
  function numKeys(data) {
@@ -521,6 +517,9 @@ function safeExtend(schema, shape) {
521
517
  return clone(schema, def);
522
518
  }
523
519
  function merge(a, b) {
520
+ if (a._zod.def.checks?.length) {
521
+ throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
522
+ }
524
523
  const def = mergeDefs(a._zod.def, {
525
524
  get shape() {
526
525
  const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
@@ -530,7 +529,7 @@ function merge(a, b) {
530
529
  get catchall() {
531
530
  return b._zod.def.catchall;
532
531
  },
533
- checks: []
532
+ checks: b._zod.def.checks ?? []
534
533
  });
535
534
  return clone(a, def);
536
535
  }
@@ -613,10 +612,20 @@ function aborted(x, startIndex = 0) {
613
612
  }
614
613
  return false;
615
614
  }
615
+ function explicitlyAborted(x, startIndex = 0) {
616
+ if (x.aborted === true)
617
+ return true;
618
+ for (let i = startIndex;i < x.issues.length; i++) {
619
+ if (x.issues[i]?.continue === false) {
620
+ return true;
621
+ }
622
+ }
623
+ return false;
624
+ }
616
625
  function prefixIssues(path, issues) {
617
626
  return issues.map((iss) => {
618
- var _a;
619
- (_a = iss).path ?? (_a.path = []);
627
+ var _a2;
628
+ (_a2 = iss).path ?? (_a2.path = []);
620
629
  iss.path.unshift(path);
621
630
  return iss;
622
631
  });
@@ -625,17 +634,14 @@ function unwrapMessage(message) {
625
634
  return typeof message === "string" ? message : message?.message;
626
635
  }
627
636
  function finalizeIssue(iss, ctx, config2) {
628
- const full = { ...iss, path: iss.path ?? [] };
629
- if (!iss.message) {
630
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
631
- full.message = message;
637
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
638
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
639
+ rest.path ?? (rest.path = []);
640
+ rest.message = message;
641
+ if (ctx?.reportInput) {
642
+ rest.input = _input;
632
643
  }
633
- delete full.inst;
634
- delete full.continue;
635
- if (!ctx?.reportInput) {
636
- delete full.input;
637
- }
638
- return full;
644
+ return rest;
639
645
  }
640
646
  function getSizableOrigin(input) {
641
647
  if (input instanceof Set)
@@ -777,9 +783,13 @@ var EVALUATING, captureStackTrace, allowsEval, getParsedType = (data) => {
777
783
  }
778
784
  }, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES;
779
785
  var init_util = __esm(() => {
780
- EVALUATING = Symbol("evaluating");
786
+ init_core();
787
+ EVALUATING = /* @__PURE__ */ Symbol("evaluating");
781
788
  captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
782
- allowsEval = cached(() => {
789
+ allowsEval = /* @__PURE__ */ cached(() => {
790
+ if (globalConfig.jitless) {
791
+ return false;
792
+ }
783
793
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
784
794
  return false;
785
795
  }
@@ -791,8 +801,15 @@ var init_util = __esm(() => {
791
801
  return false;
792
802
  }
793
803
  });
794
- propertyKeyTypes = new Set(["string", "number", "symbol"]);
795
- primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
804
+ propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
805
+ primitiveTypes = /* @__PURE__ */ new Set([
806
+ "string",
807
+ "number",
808
+ "bigint",
809
+ "boolean",
810
+ "symbol",
811
+ "undefined"
812
+ ]);
796
813
  NUMBER_FORMAT_RANGES = {
797
814
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
798
815
  int32: [-2147483648, 2147483647],
@@ -822,30 +839,33 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
822
839
  }
823
840
  function formatError(error, mapper = (issue2) => issue2.message) {
824
841
  const fieldErrors = { _errors: [] };
825
- const processError = (error2) => {
842
+ const processError = (error2, path = []) => {
826
843
  for (const issue2 of error2.issues) {
827
844
  if (issue2.code === "invalid_union" && issue2.errors.length) {
828
- issue2.errors.map((issues) => processError({ issues }));
845
+ issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
829
846
  } else if (issue2.code === "invalid_key") {
830
- processError({ issues: issue2.issues });
847
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
831
848
  } else if (issue2.code === "invalid_element") {
832
- processError({ issues: issue2.issues });
833
- } else if (issue2.path.length === 0) {
834
- fieldErrors._errors.push(mapper(issue2));
849
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
835
850
  } else {
836
- let curr = fieldErrors;
837
- let i = 0;
838
- while (i < issue2.path.length) {
839
- const el = issue2.path[i];
840
- const terminal = i === issue2.path.length - 1;
841
- if (!terminal) {
842
- curr[el] = curr[el] || { _errors: [] };
843
- } else {
844
- curr[el] = curr[el] || { _errors: [] };
845
- curr[el]._errors.push(mapper(issue2));
851
+ const fullpath = [...path, ...issue2.path];
852
+ if (fullpath.length === 0) {
853
+ fieldErrors._errors.push(mapper(issue2));
854
+ } else {
855
+ let curr = fieldErrors;
856
+ let i = 0;
857
+ while (i < fullpath.length) {
858
+ const el = fullpath[i];
859
+ const terminal = i === fullpath.length - 1;
860
+ if (!terminal) {
861
+ curr[el] = curr[el] || { _errors: [] };
862
+ } else {
863
+ curr[el] = curr[el] || { _errors: [] };
864
+ curr[el]._errors.push(mapper(issue2));
865
+ }
866
+ curr = curr[el];
867
+ i++;
846
868
  }
847
- curr = curr[el];
848
- i++;
849
869
  }
850
870
  }
851
871
  }
@@ -907,7 +927,7 @@ var init_errors = __esm(() => {
907
927
 
908
928
  // node_modules/zod/v4/core/parse.js
909
929
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
910
- const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
930
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
911
931
  const result = schema._zod.run({ value, issues: [] }, ctx);
912
932
  if (result instanceof Promise) {
913
933
  throw new $ZodAsyncError;
@@ -919,7 +939,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
919
939
  }
920
940
  return result.value;
921
941
  }, parse, _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
922
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
942
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
923
943
  let result = schema._zod.run({ value, issues: [] }, ctx);
924
944
  if (result instanceof Promise)
925
945
  result = await result;
@@ -940,7 +960,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
940
960
  error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
941
961
  } : { success: true, data: result.value };
942
962
  }, safeParse, _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
943
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
963
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
944
964
  let result = schema._zod.run({ value, issues: [] }, ctx);
945
965
  if (result instanceof Promise)
946
966
  result = await result;
@@ -949,22 +969,22 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
949
969
  error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
950
970
  } : { success: true, data: result.value };
951
971
  }, safeParseAsync, _encode = (_Err) => (schema, value, _ctx) => {
952
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
972
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
953
973
  return _parse(_Err)(schema, value, ctx);
954
974
  }, _decode = (_Err) => (schema, value, _ctx) => {
955
975
  return _parse(_Err)(schema, value, _ctx);
956
976
  }, _encodeAsync = (_Err) => async (schema, value, _ctx) => {
957
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
977
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
958
978
  return _parseAsync(_Err)(schema, value, ctx);
959
979
  }, _decodeAsync = (_Err) => async (schema, value, _ctx) => {
960
980
  return _parseAsync(_Err)(schema, value, _ctx);
961
981
  }, _safeEncode = (_Err) => (schema, value, _ctx) => {
962
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
982
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
963
983
  return _safeParse(_Err)(schema, value, ctx);
964
984
  }, _safeDecode = (_Err) => (schema, value, _ctx) => {
965
985
  return _safeParse(_Err)(schema, value, _ctx);
966
986
  }, _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
967
- const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
987
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
968
988
  return _safeParseAsync(_Err)(schema, value, ctx);
969
989
  }, _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
970
990
  return _safeParseAsync(_Err)(schema, value, _ctx);
@@ -1005,12 +1025,12 @@ var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid = (version) => {
1005
1025
  if (!version)
1006
1026
  return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
1007
1027
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
1008
- }, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164, 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])))`, date, string = (params) => {
1028
+ }, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, httpProtocol, e164, 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])))`, date, string = (params) => {
1009
1029
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1010
1030
  return new RegExp(`^${regex}$`);
1011
1031
  }, bigint, integer, number, boolean, _null, lowercase, uppercase;
1012
1032
  var init_regexes = __esm(() => {
1013
- cuid = /^[cC][^\s-]{8,}$/;
1033
+ cuid = /^[cC][0-9a-z]{6,}$/;
1014
1034
  cuid2 = /^[0-9a-z]+$/;
1015
1035
  ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1016
1036
  xid = /^[0-9a-vA-V]{20}$/;
@@ -1025,6 +1045,7 @@ var init_regexes = __esm(() => {
1025
1045
  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])$/;
1026
1046
  base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1027
1047
  base64url = /^[A-Za-z0-9_-]*$/;
1048
+ httpProtocol = /^https?$/;
1028
1049
  e164 = /^\+[1-9]\d{6,14}$/;
1029
1050
  date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
1030
1051
  bigint = /^-?\d+n?$/;
@@ -1043,10 +1064,10 @@ var init_checks = __esm(() => {
1043
1064
  init_regexes();
1044
1065
  init_util();
1045
1066
  $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
1046
- var _a;
1067
+ var _a2;
1047
1068
  inst._zod ?? (inst._zod = {});
1048
1069
  inst._zod.def = def;
1049
- (_a = inst._zod).onattach ?? (_a.onattach = []);
1070
+ (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
1050
1071
  });
1051
1072
  numericOriginMap = {
1052
1073
  number: "number",
@@ -1112,8 +1133,8 @@ var init_checks = __esm(() => {
1112
1133
  $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1113
1134
  $ZodCheck.init(inst, def);
1114
1135
  inst._zod.onattach.push((inst2) => {
1115
- var _a;
1116
- (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
1136
+ var _a2;
1137
+ (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
1117
1138
  });
1118
1139
  inst._zod.check = (payload) => {
1119
1140
  if (typeof payload.value !== typeof def.value)
@@ -1211,9 +1232,9 @@ var init_checks = __esm(() => {
1211
1232
  };
1212
1233
  });
1213
1234
  $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
1214
- var _a;
1235
+ var _a2;
1215
1236
  $ZodCheck.init(inst, def);
1216
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1237
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1217
1238
  const val = payload.value;
1218
1239
  return !nullish(val) && val.length !== undefined;
1219
1240
  });
@@ -1240,9 +1261,9 @@ var init_checks = __esm(() => {
1240
1261
  };
1241
1262
  });
1242
1263
  $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
1243
- var _a;
1264
+ var _a2;
1244
1265
  $ZodCheck.init(inst, def);
1245
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1266
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1246
1267
  const val = payload.value;
1247
1268
  return !nullish(val) && val.length !== undefined;
1248
1269
  });
@@ -1269,9 +1290,9 @@ var init_checks = __esm(() => {
1269
1290
  };
1270
1291
  });
1271
1292
  $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
1272
- var _a;
1293
+ var _a2;
1273
1294
  $ZodCheck.init(inst, def);
1274
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1295
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
1275
1296
  const val = payload.value;
1276
1297
  return !nullish(val) && val.length !== undefined;
1277
1298
  });
@@ -1300,7 +1321,7 @@ var init_checks = __esm(() => {
1300
1321
  };
1301
1322
  });
1302
1323
  $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1303
- var _a, _b;
1324
+ var _a2, _b;
1304
1325
  $ZodCheck.init(inst, def);
1305
1326
  inst._zod.onattach.push((inst2) => {
1306
1327
  const bag = inst2._zod.bag;
@@ -1311,7 +1332,7 @@ var init_checks = __esm(() => {
1311
1332
  }
1312
1333
  });
1313
1334
  if (def.pattern)
1314
- (_a = inst._zod).check ?? (_a.check = (payload) => {
1335
+ (_a2 = inst._zod).check ?? (_a2.check = (payload) => {
1315
1336
  def.pattern.lastIndex = 0;
1316
1337
  if (def.pattern.test(payload.value))
1317
1338
  return;
@@ -1474,8 +1495,8 @@ var version;
1474
1495
  var init_versions = __esm(() => {
1475
1496
  version = {
1476
1497
  major: 4,
1477
- minor: 3,
1478
- patch: 6
1498
+ minor: 4,
1499
+ patch: 3
1479
1500
  };
1480
1501
  });
1481
1502
 
@@ -1483,6 +1504,8 @@ var init_versions = __esm(() => {
1483
1504
  function isValidBase64(data) {
1484
1505
  if (data === "")
1485
1506
  return true;
1507
+ if (/\s/.test(data))
1508
+ return false;
1486
1509
  if (data.length % 4 !== 0)
1487
1510
  return false;
1488
1511
  try {
@@ -1525,15 +1548,27 @@ function handleArrayResult(result, final, index) {
1525
1548
  }
1526
1549
  final.value[index] = result.value;
1527
1550
  }
1528
- function handlePropertyResult(result, final, key, input, isOptionalOut) {
1551
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1552
+ const isPresent = key in input;
1529
1553
  if (result.issues.length) {
1530
- if (isOptionalOut && !(key in input)) {
1554
+ if (isOptionalIn && isOptionalOut && !isPresent) {
1531
1555
  return;
1532
1556
  }
1533
1557
  final.issues.push(...prefixIssues(key, result.issues));
1534
1558
  }
1559
+ if (!isPresent && !isOptionalIn) {
1560
+ if (!result.issues.length) {
1561
+ final.issues.push({
1562
+ code: "invalid_type",
1563
+ expected: "nonoptional",
1564
+ input: undefined,
1565
+ path: [key]
1566
+ });
1567
+ }
1568
+ return;
1569
+ }
1535
1570
  if (result.value === undefined) {
1536
- if (key in input) {
1571
+ if (isPresent) {
1537
1572
  final.value[key] = undefined;
1538
1573
  }
1539
1574
  } else {
@@ -1561,8 +1596,11 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1561
1596
  const keySet = def.keySet;
1562
1597
  const _catchall = def.catchall._zod;
1563
1598
  const t = _catchall.def.type;
1599
+ const isOptionalIn = _catchall.optin === "optional";
1564
1600
  const isOptionalOut = _catchall.optout === "optional";
1565
1601
  for (const key in input) {
1602
+ if (key === "__proto__")
1603
+ continue;
1566
1604
  if (keySet.has(key))
1567
1605
  continue;
1568
1606
  if (t === "never") {
@@ -1571,9 +1609,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1571
1609
  }
1572
1610
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1573
1611
  if (r instanceof Promise) {
1574
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
1612
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
1575
1613
  } else {
1576
- handlePropertyResult(r, payload, key, input, isOptionalOut);
1614
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1577
1615
  }
1578
1616
  }
1579
1617
  if (unrecognized.length) {
@@ -1694,7 +1732,7 @@ function handleIntersectionResults(result, left, right) {
1694
1732
  return result;
1695
1733
  }
1696
1734
  function handleOptionalResult(result, input) {
1697
- if (result.issues.length && input === undefined) {
1735
+ if (input === undefined && (result.issues.length || result.fallback)) {
1698
1736
  return { issues: [], value: undefined };
1699
1737
  }
1700
1738
  return result;
@@ -1721,7 +1759,7 @@ function handlePipeResult(left, next, ctx) {
1721
1759
  left.aborted = true;
1722
1760
  return left;
1723
1761
  }
1724
- return next._zod.run({ value: left.value, issues: left.issues }, ctx);
1762
+ return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
1725
1763
  }
1726
1764
  function handleReadonlyResult(payload) {
1727
1765
  payload.value = Object.freeze(payload.value);
@@ -1741,7 +1779,7 @@ function handleRefineResult(result, payload, input, inst) {
1741
1779
  payload.issues.push(issue(_iss));
1742
1780
  }
1743
1781
  }
1744
- var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodLazy, $ZodCustom;
1782
+ var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodLazy, $ZodCustom;
1745
1783
  var init_schemas = __esm(() => {
1746
1784
  init_checks();
1747
1785
  init_core();
@@ -1751,7 +1789,7 @@ var init_schemas = __esm(() => {
1751
1789
  init_versions();
1752
1790
  init_util();
1753
1791
  $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1754
- var _a;
1792
+ var _a2;
1755
1793
  inst ?? (inst = {});
1756
1794
  inst._zod.def = def;
1757
1795
  inst._zod.bag = inst._zod.bag || {};
@@ -1766,7 +1804,7 @@ var init_schemas = __esm(() => {
1766
1804
  }
1767
1805
  }
1768
1806
  if (checks.length === 0) {
1769
- (_a = inst._zod).deferred ?? (_a.deferred = []);
1807
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
1770
1808
  inst._zod.deferred?.push(() => {
1771
1809
  inst._zod.run = inst._zod.parse;
1772
1810
  });
@@ -1776,6 +1814,8 @@ var init_schemas = __esm(() => {
1776
1814
  let asyncResult;
1777
1815
  for (const ch of checks2) {
1778
1816
  if (ch._zod.def.when) {
1817
+ if (explicitlyAborted(payload))
1818
+ continue;
1779
1819
  const shouldRun = ch._zod.def.when(payload);
1780
1820
  if (!shouldRun)
1781
1821
  continue;
@@ -1915,6 +1955,19 @@ var init_schemas = __esm(() => {
1915
1955
  inst._zod.check = (payload) => {
1916
1956
  try {
1917
1957
  const trimmed = payload.value.trim();
1958
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1959
+ if (!/^https?:\/\//i.test(trimmed)) {
1960
+ payload.issues.push({
1961
+ code: "invalid_format",
1962
+ format: "url",
1963
+ note: "Invalid URL format",
1964
+ input: payload.value,
1965
+ inst,
1966
+ continue: !def.abort
1967
+ });
1968
+ return;
1969
+ }
1970
+ }
1918
1971
  const url = new URL(trimmed);
1919
1972
  if (def.hostname) {
1920
1973
  def.hostname.lastIndex = 0;
@@ -2318,12 +2371,13 @@ var init_schemas = __esm(() => {
2318
2371
  const shape = value.shape;
2319
2372
  for (const key of value.keys) {
2320
2373
  const el = shape[key];
2374
+ const isOptionalIn = el._zod.optin === "optional";
2321
2375
  const isOptionalOut = el._zod.optout === "optional";
2322
2376
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
2323
2377
  if (r instanceof Promise) {
2324
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
2378
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
2325
2379
  } else {
2326
- handlePropertyResult(r, payload, key, input, isOptionalOut);
2380
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2327
2381
  }
2328
2382
  }
2329
2383
  if (!catchall) {
@@ -2354,9 +2408,10 @@ var init_schemas = __esm(() => {
2354
2408
  const id = ids[key];
2355
2409
  const k = esc(key);
2356
2410
  const schema = shape[key];
2411
+ const isOptionalIn = schema?._zod?.optin === "optional";
2357
2412
  const isOptionalOut = schema?._zod?.optout === "optional";
2358
2413
  doc.write(`const ${id} = ${parseStr(key)};`);
2359
- if (isOptionalOut) {
2414
+ if (isOptionalIn && isOptionalOut) {
2360
2415
  doc.write(`
2361
2416
  if (${id}.issues.length) {
2362
2417
  if (${k} in input) {
@@ -2375,6 +2430,33 @@ var init_schemas = __esm(() => {
2375
2430
  newResult[${k}] = ${id}.value;
2376
2431
  }
2377
2432
 
2433
+ `);
2434
+ } else if (!isOptionalIn) {
2435
+ doc.write(`
2436
+ const ${id}_present = ${k} in input;
2437
+ if (${id}.issues.length) {
2438
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2439
+ ...iss,
2440
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2441
+ })));
2442
+ }
2443
+ if (!${id}_present && !${id}.issues.length) {
2444
+ payload.issues.push({
2445
+ code: "invalid_type",
2446
+ expected: "nonoptional",
2447
+ input: undefined,
2448
+ path: [${k}]
2449
+ });
2450
+ }
2451
+
2452
+ if (${id}_present) {
2453
+ if (${id}.value === undefined) {
2454
+ newResult[${k}] = undefined;
2455
+ } else {
2456
+ newResult[${k}] = ${id}.value;
2457
+ }
2458
+ }
2459
+
2378
2460
  `);
2379
2461
  } else {
2380
2462
  doc.write(`
@@ -2448,10 +2530,9 @@ var init_schemas = __esm(() => {
2448
2530
  }
2449
2531
  return;
2450
2532
  });
2451
- const single = def.options.length === 1;
2452
- const first = def.options[0]._zod.run;
2533
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
2453
2534
  inst._zod.parse = (payload, ctx) => {
2454
- if (single) {
2535
+ if (first) {
2455
2536
  return first(payload, ctx);
2456
2537
  }
2457
2538
  let async = false;
@@ -2528,7 +2609,7 @@ var init_schemas = __esm(() => {
2528
2609
  if (opt) {
2529
2610
  return opt._zod.run(payload, ctx);
2530
2611
  }
2531
- if (def.unionFallback) {
2612
+ if (def.unionFallback || ctx.direction === "backward") {
2532
2613
  return _super(payload, ctx);
2533
2614
  }
2534
2615
  payload.issues.push({
@@ -2536,6 +2617,7 @@ var init_schemas = __esm(() => {
2536
2617
  errors: [],
2537
2618
  note: "No matching discriminator",
2538
2619
  discriminator: def.discriminator,
2620
+ options: Array.from(disc.value.keys()),
2539
2621
  input,
2540
2622
  path: [def.discriminator],
2541
2623
  inst
@@ -2579,19 +2661,35 @@ var init_schemas = __esm(() => {
2579
2661
  for (const key of values) {
2580
2662
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2581
2663
  recordKeys.add(typeof key === "number" ? key.toString() : key);
2664
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2665
+ if (keyResult instanceof Promise) {
2666
+ throw new Error("Async schemas not supported in object keys currently");
2667
+ }
2668
+ if (keyResult.issues.length) {
2669
+ payload.issues.push({
2670
+ code: "invalid_key",
2671
+ origin: "record",
2672
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2673
+ input: key,
2674
+ path: [key],
2675
+ inst
2676
+ });
2677
+ continue;
2678
+ }
2679
+ const outKey = keyResult.value;
2582
2680
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2583
2681
  if (result instanceof Promise) {
2584
2682
  proms.push(result.then((result2) => {
2585
2683
  if (result2.issues.length) {
2586
2684
  payload.issues.push(...prefixIssues(key, result2.issues));
2587
2685
  }
2588
- payload.value[key] = result2.value;
2686
+ payload.value[outKey] = result2.value;
2589
2687
  }));
2590
2688
  } else {
2591
2689
  if (result.issues.length) {
2592
2690
  payload.issues.push(...prefixIssues(key, result.issues));
2593
2691
  }
2594
- payload.value[key] = result.value;
2692
+ payload.value[outKey] = result.value;
2595
2693
  }
2596
2694
  }
2597
2695
  }
@@ -2615,6 +2713,8 @@ var init_schemas = __esm(() => {
2615
2713
  for (const key of Reflect.ownKeys(input)) {
2616
2714
  if (key === "__proto__")
2617
2715
  continue;
2716
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
2717
+ continue;
2618
2718
  let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2619
2719
  if (keyResult instanceof Promise) {
2620
2720
  throw new Error("Async schemas not supported in object keys currently");
@@ -2710,6 +2810,7 @@ var init_schemas = __esm(() => {
2710
2810
  });
2711
2811
  $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
2712
2812
  $ZodType.init(inst, def);
2813
+ inst._zod.optin = "optional";
2713
2814
  inst._zod.parse = (payload, ctx) => {
2714
2815
  if (ctx.direction === "backward") {
2715
2816
  throw new $ZodEncodeError(inst.constructor.name);
@@ -2719,6 +2820,7 @@ var init_schemas = __esm(() => {
2719
2820
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2720
2821
  return output.then((output2) => {
2721
2822
  payload.value = output2;
2823
+ payload.fallback = true;
2722
2824
  return payload;
2723
2825
  });
2724
2826
  }
@@ -2726,6 +2828,7 @@ var init_schemas = __esm(() => {
2726
2828
  throw new $ZodAsyncError;
2727
2829
  }
2728
2830
  payload.value = _out;
2831
+ payload.fallback = true;
2729
2832
  return payload;
2730
2833
  };
2731
2834
  });
@@ -2742,10 +2845,11 @@ var init_schemas = __esm(() => {
2742
2845
  });
2743
2846
  inst._zod.parse = (payload, ctx) => {
2744
2847
  if (def.innerType._zod.optin === "optional") {
2848
+ const input = payload.value;
2745
2849
  const result = def.innerType._zod.run(payload, ctx);
2746
2850
  if (result instanceof Promise)
2747
- return result.then((r) => handleOptionalResult(r, payload.value));
2748
- return handleOptionalResult(result, payload.value);
2851
+ return result.then((r) => handleOptionalResult(r, input));
2852
+ return handleOptionalResult(result, input);
2749
2853
  }
2750
2854
  if (payload.value === undefined) {
2751
2855
  return payload;
@@ -2827,7 +2931,7 @@ var init_schemas = __esm(() => {
2827
2931
  });
2828
2932
  $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
2829
2933
  $ZodType.init(inst, def);
2830
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2934
+ inst._zod.optin = "optional";
2831
2935
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2832
2936
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2833
2937
  inst._zod.parse = (payload, ctx) => {
@@ -2847,6 +2951,7 @@ var init_schemas = __esm(() => {
2847
2951
  input: payload.value
2848
2952
  });
2849
2953
  payload.issues = [];
2954
+ payload.fallback = true;
2850
2955
  }
2851
2956
  return payload;
2852
2957
  });
@@ -2861,6 +2966,7 @@ var init_schemas = __esm(() => {
2861
2966
  input: payload.value
2862
2967
  });
2863
2968
  payload.issues = [];
2969
+ payload.fallback = true;
2864
2970
  }
2865
2971
  return payload;
2866
2972
  };
@@ -2886,6 +2992,9 @@ var init_schemas = __esm(() => {
2886
2992
  return handlePipeResult(left, def.out, ctx);
2887
2993
  };
2888
2994
  });
2995
+ $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
2996
+ $ZodPipe.init(inst, def);
2997
+ });
2889
2998
  $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
2890
2999
  $ZodType.init(inst, def);
2891
3000
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
@@ -2905,7 +3014,12 @@ var init_schemas = __esm(() => {
2905
3014
  });
2906
3015
  $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
2907
3016
  $ZodType.init(inst, def);
2908
- defineLazy(inst._zod, "innerType", () => def.getter());
3017
+ defineLazy(inst._zod, "innerType", () => {
3018
+ const d = def;
3019
+ if (!d._cachedInner)
3020
+ d._cachedInner = def.getter();
3021
+ return d._cachedInner;
3022
+ });
2909
3023
  defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
2910
3024
  defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
2911
3025
  defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
@@ -3031,6 +3145,10 @@ var error = () => {
3031
3145
  case "invalid_key":
3032
3146
  return `Invalid key in ${issue2.origin}`;
3033
3147
  case "invalid_union":
3148
+ if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
3149
+ const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
3150
+ return `Invalid discriminator value. Expected ${opts}`;
3151
+ }
3034
3152
  return "Invalid input";
3035
3153
  case "invalid_element":
3036
3154
  return `Invalid value in ${issue2.origin}`;
@@ -3090,11 +3208,11 @@ class $ZodRegistry {
3090
3208
  function registry() {
3091
3209
  return new $ZodRegistry;
3092
3210
  }
3093
- var _a, $output, $input, globalRegistry;
3211
+ var _a2, $output, $input, globalRegistry;
3094
3212
  var init_registries = __esm(() => {
3095
3213
  $output = Symbol("ZodOutput");
3096
3214
  $input = Symbol("ZodInput");
3097
- (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3215
+ (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
3098
3216
  globalRegistry = globalThis.__zod_globalRegistry;
3099
3217
  });
3100
3218
 
@@ -3577,7 +3695,7 @@ function _refine(Class2, fn, _params) {
3577
3695
  });
3578
3696
  return schema;
3579
3697
  }
3580
- function _superRefine(fn) {
3698
+ function _superRefine(fn, params) {
3581
3699
  const ch = _check((payload) => {
3582
3700
  payload.addIssue = (issue2) => {
3583
3701
  if (typeof issue2 === "string") {
@@ -3594,7 +3712,7 @@ function _superRefine(fn) {
3594
3712
  }
3595
3713
  };
3596
3714
  return fn(payload.value, payload);
3597
- });
3715
+ }, params);
3598
3716
  return ch;
3599
3717
  }
3600
3718
  function _check(fn, params) {
@@ -3632,7 +3750,7 @@ function initializeContext(params) {
3632
3750
  };
3633
3751
  }
3634
3752
  function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
3635
- var _a2;
3753
+ var _a3;
3636
3754
  const def = schema._zod.def;
3637
3755
  const seen = ctx.seen.get(schema);
3638
3756
  if (seen) {
@@ -3679,8 +3797,8 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
3679
3797
  delete result.schema.examples;
3680
3798
  delete result.schema.default;
3681
3799
  }
3682
- if (ctx.io === "input" && result.schema._prefault)
3683
- (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
3800
+ if (ctx.io === "input" && "_prefault" in result.schema)
3801
+ (_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
3684
3802
  delete result.schema._prefault;
3685
3803
  const _result = ctx.seen.get(schema);
3686
3804
  return _result.schema;
@@ -3849,7 +3967,7 @@ function finalize(ctx, schema) {
3849
3967
  result.$schema = "http://json-schema.org/draft-07/schema#";
3850
3968
  } else if (ctx.target === "draft-04") {
3851
3969
  result.$schema = "http://json-schema.org/draft-04/schema#";
3852
- } else if (ctx.target === "openapi-3.0") {} else {}
3970
+ } else if (ctx.target === "openapi-3.0") {}
3853
3971
  if (ctx.external?.uri) {
3854
3972
  const id = ctx.external.registry.get(schema)?.id;
3855
3973
  if (!id)
@@ -3857,10 +3975,15 @@ function finalize(ctx, schema) {
3857
3975
  result.$id = ctx.external.uri(id);
3858
3976
  }
3859
3977
  Object.assign(result, root.def ?? root.schema);
3978
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
3979
+ if (rootMetaId !== undefined && result.id === rootMetaId)
3980
+ delete result.id;
3860
3981
  const defs = ctx.external?.defs ?? {};
3861
3982
  for (const entry of ctx.seen.entries()) {
3862
3983
  const seen = entry[1];
3863
3984
  if (seen.def && seen.defId) {
3985
+ if (seen.def.id === seen.defId)
3986
+ delete seen.def.id;
3864
3987
  defs[seen.defId] = seen.def;
3865
3988
  }
3866
3989
  }
@@ -3915,6 +4038,8 @@ function isTransforming(_schema, _ctx) {
3915
4038
  return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3916
4039
  }
3917
4040
  if (def.type === "pipe") {
4041
+ if (_schema._zod.traits.has("$ZodCodec"))
4042
+ return true;
3918
4043
  return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
3919
4044
  }
3920
4045
  if (def.type === "object") {
@@ -4031,39 +4156,28 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4031
4156
  json.type = "integer";
4032
4157
  else
4033
4158
  json.type = "number";
4034
- if (typeof exclusiveMinimum === "number") {
4035
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
4159
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
4160
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum2 ?? Number.POSITIVE_INFINITY);
4161
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
4162
+ if (exMin) {
4163
+ if (legacy) {
4036
4164
  json.minimum = exclusiveMinimum;
4037
4165
  json.exclusiveMinimum = true;
4038
4166
  } else {
4039
4167
  json.exclusiveMinimum = exclusiveMinimum;
4040
4168
  }
4041
- }
4042
- if (typeof minimum === "number") {
4169
+ } else if (typeof minimum === "number") {
4043
4170
  json.minimum = minimum;
4044
- if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
4045
- if (exclusiveMinimum >= minimum)
4046
- delete json.minimum;
4047
- else
4048
- delete json.exclusiveMinimum;
4049
- }
4050
4171
  }
4051
- if (typeof exclusiveMaximum === "number") {
4052
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
4172
+ if (exMax) {
4173
+ if (legacy) {
4053
4174
  json.maximum = exclusiveMaximum;
4054
4175
  json.exclusiveMaximum = true;
4055
4176
  } else {
4056
4177
  json.exclusiveMaximum = exclusiveMaximum;
4057
4178
  }
4058
- }
4059
- if (typeof maximum2 === "number") {
4179
+ } else if (typeof maximum2 === "number") {
4060
4180
  json.maximum = maximum2;
4061
- if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
4062
- if (exclusiveMaximum <= maximum2)
4063
- delete json.maximum;
4064
- else
4065
- delete json.exclusiveMaximum;
4066
- }
4067
4181
  }
4068
4182
  if (typeof multipleOf === "number")
4069
4183
  json.multipleOf = multipleOf;
@@ -4114,7 +4228,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4114
4228
  if (val === undefined) {
4115
4229
  if (ctx.unrepresentable === "throw") {
4116
4230
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
4117
- } else {}
4231
+ }
4118
4232
  } else if (typeof val === "bigint") {
4119
4233
  if (ctx.unrepresentable === "throw") {
4120
4234
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -4209,7 +4323,10 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4209
4323
  if (typeof maximum2 === "number")
4210
4324
  json.maxItems = maximum2;
4211
4325
  json.type = "array";
4212
- json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
4326
+ json.items = process2(def.element, ctx, {
4327
+ ...params,
4328
+ path: [...params.path, "items"]
4329
+ });
4213
4330
  }, objectProcessor = (schema, ctx, _json, params) => {
4214
4331
  const json = _json;
4215
4332
  const def = schema._zod.def;
@@ -4391,7 +4508,8 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
4391
4508
  json.default = catchValue;
4392
4509
  }, pipeProcessor = (schema, ctx, _json, params) => {
4393
4510
  const def = schema._zod.def;
4394
- const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
4511
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
4512
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
4395
4513
  process2(innerType, ctx, params);
4396
4514
  const seen = ctx.seen.get(schema);
4397
4515
  seen.ref = innerType;
@@ -4575,8 +4693,8 @@ var init_errors2 = __esm(() => {
4575
4693
  init_core2();
4576
4694
  init_core2();
4577
4695
  init_util();
4578
- ZodError = $constructor("ZodError", initializer2);
4579
- ZodRealError = $constructor("ZodError", initializer2, {
4696
+ ZodError = /* @__PURE__ */ $constructor("ZodError", initializer2);
4697
+ ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
4580
4698
  Parent: Error
4581
4699
  });
4582
4700
  });
@@ -4601,6 +4719,42 @@ var init_parse2 = __esm(() => {
4601
4719
  });
4602
4720
 
4603
4721
  // node_modules/zod/v4/classic/schemas.js
4722
+ function _installLazyMethods(inst, group2, methods) {
4723
+ const proto = Object.getPrototypeOf(inst);
4724
+ let installed = _installedGroups.get(proto);
4725
+ if (!installed) {
4726
+ installed = new Set;
4727
+ _installedGroups.set(proto, installed);
4728
+ }
4729
+ if (installed.has(group2))
4730
+ return;
4731
+ installed.add(group2);
4732
+ for (const key in methods) {
4733
+ const fn = methods[key];
4734
+ Object.defineProperty(proto, key, {
4735
+ configurable: true,
4736
+ enumerable: false,
4737
+ get() {
4738
+ const bound = fn.bind(this);
4739
+ Object.defineProperty(this, key, {
4740
+ configurable: true,
4741
+ writable: true,
4742
+ enumerable: true,
4743
+ value: bound
4744
+ });
4745
+ return bound;
4746
+ },
4747
+ set(v) {
4748
+ Object.defineProperty(this, key, {
4749
+ configurable: true,
4750
+ writable: true,
4751
+ enumerable: true,
4752
+ value: v
4753
+ });
4754
+ }
4755
+ });
4756
+ }
4757
+ }
4604
4758
  function string2(params) {
4605
4759
  return _string(ZodString, params);
4606
4760
  }
@@ -4667,6 +4821,14 @@ function intersection(left, right) {
4667
4821
  });
4668
4822
  }
4669
4823
  function record(keyType, valueType, params) {
4824
+ if (!valueType || !valueType._zod) {
4825
+ return new ZodRecord({
4826
+ type: "record",
4827
+ keyType: string2(),
4828
+ valueType: keyType,
4829
+ ...exports_util.normalizeParams(valueType)
4830
+ });
4831
+ }
4670
4832
  return new ZodRecord({
4671
4833
  type: "record",
4672
4834
  keyType,
@@ -4770,13 +4932,17 @@ function custom(fn, _params) {
4770
4932
  function refine(fn, _params = {}) {
4771
4933
  return _refine(ZodCustom, fn, _params);
4772
4934
  }
4773
- function superRefine(fn) {
4774
- return _superRefine(fn);
4935
+ function superRefine(fn, params) {
4936
+ return _superRefine(fn, params);
4775
4937
  }
4776
4938
  function preprocess(fn, schema) {
4777
- return pipe(transform(fn), schema);
4939
+ return new ZodPreprocess({
4940
+ type: "pipe",
4941
+ in: transform(fn),
4942
+ out: schema
4943
+ });
4778
4944
  }
4779
- var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodLazy, ZodCustom;
4945
+ var _installedGroups, ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodDate, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodPreprocess, ZodReadonly, ZodLazy, ZodCustom;
4780
4946
  var init_schemas2 = __esm(() => {
4781
4947
  init_core2();
4782
4948
  init_core2();
@@ -4785,6 +4951,7 @@ var init_schemas2 = __esm(() => {
4785
4951
  init_checks2();
4786
4952
  init_iso();
4787
4953
  init_parse2();
4954
+ _installedGroups = /* @__PURE__ */ new WeakMap;
4788
4955
  ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
4789
4956
  $ZodType.init(inst, def);
4790
4957
  Object.assign(inst["~standard"], {
@@ -4797,23 +4964,6 @@ var init_schemas2 = __esm(() => {
4797
4964
  inst.def = def;
4798
4965
  inst.type = def.type;
4799
4966
  Object.defineProperty(inst, "_def", { value: def });
4800
- inst.check = (...checks2) => {
4801
- return inst.clone(exports_util.mergeDefs(def, {
4802
- checks: [
4803
- ...def.checks ?? [],
4804
- ...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
4805
- ]
4806
- }), {
4807
- parent: true
4808
- });
4809
- };
4810
- inst.with = inst.check;
4811
- inst.clone = (def2, params) => clone(inst, def2, params);
4812
- inst.brand = () => inst;
4813
- inst.register = (reg, meta2) => {
4814
- reg.add(inst, meta2);
4815
- return inst;
4816
- };
4817
4967
  inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
4818
4968
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
4819
4969
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
@@ -4827,45 +4977,108 @@ var init_schemas2 = __esm(() => {
4827
4977
  inst.safeDecode = (data, params) => safeDecode(inst, data, params);
4828
4978
  inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
4829
4979
  inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
4830
- inst.refine = (check, params) => inst.check(refine(check, params));
4831
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
4832
- inst.overwrite = (fn) => inst.check(_overwrite(fn));
4833
- inst.optional = () => optional(inst);
4834
- inst.exactOptional = () => exactOptional(inst);
4835
- inst.nullable = () => nullable(inst);
4836
- inst.nullish = () => optional(nullable(inst));
4837
- inst.nonoptional = (params) => nonoptional(inst, params);
4838
- inst.array = () => array(inst);
4839
- inst.or = (arg) => union([inst, arg]);
4840
- inst.and = (arg) => intersection(inst, arg);
4841
- inst.transform = (tx) => pipe(inst, transform(tx));
4842
- inst.default = (def2) => _default(inst, def2);
4843
- inst.prefault = (def2) => prefault(inst, def2);
4844
- inst.catch = (params) => _catch(inst, params);
4845
- inst.pipe = (target) => pipe(inst, target);
4846
- inst.readonly = () => readonly(inst);
4847
- inst.describe = (description) => {
4848
- const cl = inst.clone();
4849
- globalRegistry.add(cl, { description });
4850
- return cl;
4851
- };
4980
+ _installLazyMethods(inst, "ZodType", {
4981
+ check(...chks) {
4982
+ const def2 = this.def;
4983
+ return this.clone(exports_util.mergeDefs(def2, {
4984
+ checks: [
4985
+ ...def2.checks ?? [],
4986
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
4987
+ ]
4988
+ }), { parent: true });
4989
+ },
4990
+ with(...chks) {
4991
+ return this.check(...chks);
4992
+ },
4993
+ clone(def2, params) {
4994
+ return clone(this, def2, params);
4995
+ },
4996
+ brand() {
4997
+ return this;
4998
+ },
4999
+ register(reg, meta2) {
5000
+ reg.add(this, meta2);
5001
+ return this;
5002
+ },
5003
+ refine(check, params) {
5004
+ return this.check(refine(check, params));
5005
+ },
5006
+ superRefine(refinement, params) {
5007
+ return this.check(superRefine(refinement, params));
5008
+ },
5009
+ overwrite(fn) {
5010
+ return this.check(_overwrite(fn));
5011
+ },
5012
+ optional() {
5013
+ return optional(this);
5014
+ },
5015
+ exactOptional() {
5016
+ return exactOptional(this);
5017
+ },
5018
+ nullable() {
5019
+ return nullable(this);
5020
+ },
5021
+ nullish() {
5022
+ return optional(nullable(this));
5023
+ },
5024
+ nonoptional(params) {
5025
+ return nonoptional(this, params);
5026
+ },
5027
+ array() {
5028
+ return array(this);
5029
+ },
5030
+ or(arg) {
5031
+ return union([this, arg]);
5032
+ },
5033
+ and(arg) {
5034
+ return intersection(this, arg);
5035
+ },
5036
+ transform(tx) {
5037
+ return pipe(this, transform(tx));
5038
+ },
5039
+ default(d) {
5040
+ return _default(this, d);
5041
+ },
5042
+ prefault(d) {
5043
+ return prefault(this, d);
5044
+ },
5045
+ catch(params) {
5046
+ return _catch(this, params);
5047
+ },
5048
+ pipe(target) {
5049
+ return pipe(this, target);
5050
+ },
5051
+ readonly() {
5052
+ return readonly(this);
5053
+ },
5054
+ describe(description) {
5055
+ const cl = this.clone();
5056
+ globalRegistry.add(cl, { description });
5057
+ return cl;
5058
+ },
5059
+ meta(...args) {
5060
+ if (args.length === 0)
5061
+ return globalRegistry.get(this);
5062
+ const cl = this.clone();
5063
+ globalRegistry.add(cl, args[0]);
5064
+ return cl;
5065
+ },
5066
+ isOptional() {
5067
+ return this.safeParse(undefined).success;
5068
+ },
5069
+ isNullable() {
5070
+ return this.safeParse(null).success;
5071
+ },
5072
+ apply(fn) {
5073
+ return fn(this);
5074
+ }
5075
+ });
4852
5076
  Object.defineProperty(inst, "description", {
4853
5077
  get() {
4854
5078
  return globalRegistry.get(inst)?.description;
4855
5079
  },
4856
5080
  configurable: true
4857
5081
  });
4858
- inst.meta = (...args) => {
4859
- if (args.length === 0) {
4860
- return globalRegistry.get(inst);
4861
- }
4862
- const cl = inst.clone();
4863
- globalRegistry.add(cl, args[0]);
4864
- return cl;
4865
- };
4866
- inst.isOptional = () => inst.safeParse(undefined).success;
4867
- inst.isNullable = () => inst.safeParse(null).success;
4868
- inst.apply = (fn) => fn(inst);
4869
5082
  return inst;
4870
5083
  });
4871
5084
  _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
@@ -4876,21 +5089,53 @@ var init_schemas2 = __esm(() => {
4876
5089
  inst.format = bag.format ?? null;
4877
5090
  inst.minLength = bag.minimum ?? null;
4878
5091
  inst.maxLength = bag.maximum ?? null;
4879
- inst.regex = (...args) => inst.check(_regex(...args));
4880
- inst.includes = (...args) => inst.check(_includes(...args));
4881
- inst.startsWith = (...args) => inst.check(_startsWith(...args));
4882
- inst.endsWith = (...args) => inst.check(_endsWith(...args));
4883
- inst.min = (...args) => inst.check(_minLength(...args));
4884
- inst.max = (...args) => inst.check(_maxLength(...args));
4885
- inst.length = (...args) => inst.check(_length(...args));
4886
- inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
4887
- inst.lowercase = (params) => inst.check(_lowercase(params));
4888
- inst.uppercase = (params) => inst.check(_uppercase(params));
4889
- inst.trim = () => inst.check(_trim());
4890
- inst.normalize = (...args) => inst.check(_normalize(...args));
4891
- inst.toLowerCase = () => inst.check(_toLowerCase());
4892
- inst.toUpperCase = () => inst.check(_toUpperCase());
4893
- inst.slugify = () => inst.check(_slugify());
5092
+ _installLazyMethods(inst, "_ZodString", {
5093
+ regex(...args) {
5094
+ return this.check(_regex(...args));
5095
+ },
5096
+ includes(...args) {
5097
+ return this.check(_includes(...args));
5098
+ },
5099
+ startsWith(...args) {
5100
+ return this.check(_startsWith(...args));
5101
+ },
5102
+ endsWith(...args) {
5103
+ return this.check(_endsWith(...args));
5104
+ },
5105
+ min(...args) {
5106
+ return this.check(_minLength(...args));
5107
+ },
5108
+ max(...args) {
5109
+ return this.check(_maxLength(...args));
5110
+ },
5111
+ length(...args) {
5112
+ return this.check(_length(...args));
5113
+ },
5114
+ nonempty(...args) {
5115
+ return this.check(_minLength(1, ...args));
5116
+ },
5117
+ lowercase(params) {
5118
+ return this.check(_lowercase(params));
5119
+ },
5120
+ uppercase(params) {
5121
+ return this.check(_uppercase(params));
5122
+ },
5123
+ trim() {
5124
+ return this.check(_trim());
5125
+ },
5126
+ normalize(...args) {
5127
+ return this.check(_normalize(...args));
5128
+ },
5129
+ toLowerCase() {
5130
+ return this.check(_toLowerCase());
5131
+ },
5132
+ toUpperCase() {
5133
+ return this.check(_toUpperCase());
5134
+ },
5135
+ slugify() {
5136
+ return this.check(_slugify());
5137
+ }
5138
+ });
4894
5139
  });
4895
5140
  ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
4896
5141
  $ZodString.init(inst, def);
@@ -5007,21 +5252,53 @@ var init_schemas2 = __esm(() => {
5007
5252
  $ZodNumber.init(inst, def);
5008
5253
  ZodType.init(inst, def);
5009
5254
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
5010
- inst.gt = (value, params) => inst.check(_gt(value, params));
5011
- inst.gte = (value, params) => inst.check(_gte(value, params));
5012
- inst.min = (value, params) => inst.check(_gte(value, params));
5013
- inst.lt = (value, params) => inst.check(_lt(value, params));
5014
- inst.lte = (value, params) => inst.check(_lte(value, params));
5015
- inst.max = (value, params) => inst.check(_lte(value, params));
5016
- inst.int = (params) => inst.check(int(params));
5017
- inst.safe = (params) => inst.check(int(params));
5018
- inst.positive = (params) => inst.check(_gt(0, params));
5019
- inst.nonnegative = (params) => inst.check(_gte(0, params));
5020
- inst.negative = (params) => inst.check(_lt(0, params));
5021
- inst.nonpositive = (params) => inst.check(_lte(0, params));
5022
- inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
5023
- inst.step = (value, params) => inst.check(_multipleOf(value, params));
5024
- inst.finite = () => inst;
5255
+ _installLazyMethods(inst, "ZodNumber", {
5256
+ gt(value, params) {
5257
+ return this.check(_gt(value, params));
5258
+ },
5259
+ gte(value, params) {
5260
+ return this.check(_gte(value, params));
5261
+ },
5262
+ min(value, params) {
5263
+ return this.check(_gte(value, params));
5264
+ },
5265
+ lt(value, params) {
5266
+ return this.check(_lt(value, params));
5267
+ },
5268
+ lte(value, params) {
5269
+ return this.check(_lte(value, params));
5270
+ },
5271
+ max(value, params) {
5272
+ return this.check(_lte(value, params));
5273
+ },
5274
+ int(params) {
5275
+ return this.check(int(params));
5276
+ },
5277
+ safe(params) {
5278
+ return this.check(int(params));
5279
+ },
5280
+ positive(params) {
5281
+ return this.check(_gt(0, params));
5282
+ },
5283
+ nonnegative(params) {
5284
+ return this.check(_gte(0, params));
5285
+ },
5286
+ negative(params) {
5287
+ return this.check(_lt(0, params));
5288
+ },
5289
+ nonpositive(params) {
5290
+ return this.check(_lte(0, params));
5291
+ },
5292
+ multipleOf(value, params) {
5293
+ return this.check(_multipleOf(value, params));
5294
+ },
5295
+ step(value, params) {
5296
+ return this.check(_multipleOf(value, params));
5297
+ },
5298
+ finite() {
5299
+ return this;
5300
+ }
5301
+ });
5025
5302
  const bag = inst._zod.bag;
5026
5303
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
5027
5304
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
@@ -5095,11 +5372,23 @@ var init_schemas2 = __esm(() => {
5095
5372
  ZodType.init(inst, def);
5096
5373
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
5097
5374
  inst.element = def.element;
5098
- inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
5099
- inst.nonempty = (params) => inst.check(_minLength(1, params));
5100
- inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
5101
- inst.length = (len, params) => inst.check(_length(len, params));
5102
- inst.unwrap = () => inst.element;
5375
+ _installLazyMethods(inst, "ZodArray", {
5376
+ min(n, params) {
5377
+ return this.check(_minLength(n, params));
5378
+ },
5379
+ nonempty(params) {
5380
+ return this.check(_minLength(1, params));
5381
+ },
5382
+ max(n, params) {
5383
+ return this.check(_maxLength(n, params));
5384
+ },
5385
+ length(n, params) {
5386
+ return this.check(_length(n, params));
5387
+ },
5388
+ unwrap() {
5389
+ return this.element;
5390
+ }
5391
+ });
5103
5392
  });
5104
5393
  ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
5105
5394
  $ZodObjectJIT.init(inst, def);
@@ -5108,23 +5397,47 @@ var init_schemas2 = __esm(() => {
5108
5397
  exports_util.defineLazy(inst, "shape", () => {
5109
5398
  return def.shape;
5110
5399
  });
5111
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
5112
- inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
5113
- inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
5114
- inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
5115
- inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
5116
- inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
5117
- inst.extend = (incoming) => {
5118
- return exports_util.extend(inst, incoming);
5119
- };
5120
- inst.safeExtend = (incoming) => {
5121
- return exports_util.safeExtend(inst, incoming);
5122
- };
5123
- inst.merge = (other) => exports_util.merge(inst, other);
5124
- inst.pick = (mask) => exports_util.pick(inst, mask);
5125
- inst.omit = (mask) => exports_util.omit(inst, mask);
5126
- inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);
5127
- inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);
5400
+ _installLazyMethods(inst, "ZodObject", {
5401
+ keyof() {
5402
+ return _enum(Object.keys(this._zod.def.shape));
5403
+ },
5404
+ catchall(catchall) {
5405
+ return this.clone({ ...this._zod.def, catchall });
5406
+ },
5407
+ passthrough() {
5408
+ return this.clone({ ...this._zod.def, catchall: unknown() });
5409
+ },
5410
+ loose() {
5411
+ return this.clone({ ...this._zod.def, catchall: unknown() });
5412
+ },
5413
+ strict() {
5414
+ return this.clone({ ...this._zod.def, catchall: never() });
5415
+ },
5416
+ strip() {
5417
+ return this.clone({ ...this._zod.def, catchall: undefined });
5418
+ },
5419
+ extend(incoming) {
5420
+ return exports_util.extend(this, incoming);
5421
+ },
5422
+ safeExtend(incoming) {
5423
+ return exports_util.safeExtend(this, incoming);
5424
+ },
5425
+ merge(other) {
5426
+ return exports_util.merge(this, other);
5427
+ },
5428
+ pick(mask) {
5429
+ return exports_util.pick(this, mask);
5430
+ },
5431
+ omit(mask) {
5432
+ return exports_util.omit(this, mask);
5433
+ },
5434
+ partial(...args) {
5435
+ return exports_util.partial(ZodOptional, this, args[0]);
5436
+ },
5437
+ required(...args) {
5438
+ return exports_util.required(ZodNonOptional, this, args[0]);
5439
+ }
5440
+ });
5128
5441
  });
5129
5442
  ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
5130
5443
  $ZodUnion.init(inst, def);
@@ -5225,10 +5538,12 @@ var init_schemas2 = __esm(() => {
5225
5538
  if (output instanceof Promise) {
5226
5539
  return output.then((output2) => {
5227
5540
  payload.value = output2;
5541
+ payload.fallback = true;
5228
5542
  return payload;
5229
5543
  });
5230
5544
  }
5231
5545
  payload.value = output;
5546
+ payload.fallback = true;
5232
5547
  return payload;
5233
5548
  };
5234
5549
  });
@@ -5283,6 +5598,10 @@ var init_schemas2 = __esm(() => {
5283
5598
  inst.in = def.in;
5284
5599
  inst.out = def.out;
5285
5600
  });
5601
+ ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
5602
+ ZodPipe.init(inst, def);
5603
+ $ZodPreprocess.init(inst, def);
5604
+ });
5286
5605
  ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
5287
5606
  $ZodReadonly.init(inst, def);
5288
5607
  ZodType.init(inst, def);
@@ -10794,7 +11113,7 @@ var require_dbcs_codec = __commonJS((exports) => {
10794
11113
  if (resCode !== undefined) {
10795
11114
  dbcsCode = resCode;
10796
11115
  nextChar = uCode;
10797
- } else {}
11116
+ }
10798
11117
  }
10799
11118
  seqObj = undefined;
10800
11119
  } else if (uCode >= 0) {
@@ -10859,7 +11178,7 @@ var require_dbcs_codec = __commonJS((exports) => {
10859
11178
  newBuf[j++] = dbcsCode >> 8;
10860
11179
  newBuf[j++] = dbcsCode & 255;
10861
11180
  }
10862
- } else {}
11181
+ }
10863
11182
  this.seqObj = undefined;
10864
11183
  }
10865
11184
  if (this.leadSurrogate !== -1) {
@@ -34707,7 +35026,9 @@ var init_schemas3 = __esm(() => {
34707
35026
  ...def,
34708
35027
  checks: [
34709
35028
  ...def.checks ?? [],
34710
- ...checks3.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
35029
+ ...checks3.map((ch) => typeof ch === "function" ? {
35030
+ _zod: { check: ch, def: { check: "custom" }, onattach: [] }
35031
+ } : ch)
34711
35032
  ]
34712
35033
  }, { parent: true });
34713
35034
  };
@@ -37235,12 +37556,12 @@ var require_code = __commonJS((exports) => {
37235
37556
  return item === "" || item === '""';
37236
37557
  }
37237
37558
  get str() {
37238
- var _a2;
37239
- return (_a2 = this._str) !== null && _a2 !== undefined ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
37559
+ var _a3;
37560
+ return (_a3 = this._str) !== null && _a3 !== undefined ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
37240
37561
  }
37241
37562
  get names() {
37242
- var _a2;
37243
- return (_a2 = this._names) !== null && _a2 !== undefined ? _a2 : this._names = this._items.reduce((names, c) => {
37563
+ var _a3;
37564
+ return (_a3 = this._names) !== null && _a3 !== undefined ? _a3 : this._names = this._items.reduce((names, c) => {
37244
37565
  if (c instanceof Name)
37245
37566
  names[c.str] = (names[c.str] || 0) + 1;
37246
37567
  return names;
@@ -37385,8 +37706,8 @@ var require_scope = __commonJS((exports) => {
37385
37706
  return `${prefix}${ng.index++}`;
37386
37707
  }
37387
37708
  _nameGroup(prefix) {
37388
- var _a2, _b;
37389
- if (((_b = (_a2 = this._parent) === null || _a2 === undefined ? undefined : _a2._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
37709
+ var _a3, _b;
37710
+ if (((_b = (_a3 = this._parent) === null || _a3 === undefined ? undefined : _a3._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
37390
37711
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
37391
37712
  }
37392
37713
  return this._names[prefix] = { prefix, index: 0 };
@@ -37421,12 +37742,12 @@ var require_scope = __commonJS((exports) => {
37421
37742
  return new ValueScopeName(prefix, this._newName(prefix));
37422
37743
  }
37423
37744
  value(nameOrPrefix, value) {
37424
- var _a2;
37745
+ var _a3;
37425
37746
  if (value.ref === undefined)
37426
37747
  throw new Error("CodeGen: ref must be passed in value");
37427
37748
  const name = this.toName(nameOrPrefix);
37428
37749
  const { prefix } = name;
37429
- const valueKey = (_a2 = value.key) !== null && _a2 !== undefined ? _a2 : value.ref;
37750
+ const valueKey = (_a3 = value.key) !== null && _a3 !== undefined ? _a3 : value.ref;
37430
37751
  let vs = this._values[prefix];
37431
37752
  if (vs) {
37432
37753
  const _name = vs.get(valueKey);
@@ -37754,8 +38075,8 @@ var require_codegen = __commonJS((exports) => {
37754
38075
  return this;
37755
38076
  }
37756
38077
  optimizeNames(names, constants) {
37757
- var _a2;
37758
- this.else = (_a2 = this.else) === null || _a2 === undefined ? undefined : _a2.optimizeNames(names, constants);
38078
+ var _a3;
38079
+ this.else = (_a3 = this.else) === null || _a3 === undefined ? undefined : _a3.optimizeNames(names, constants);
37759
38080
  if (!(super.optimizeNames(names, constants) || this.else))
37760
38081
  return;
37761
38082
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -37866,16 +38187,16 @@ var require_codegen = __commonJS((exports) => {
37866
38187
  return code;
37867
38188
  }
37868
38189
  optimizeNodes() {
37869
- var _a2, _b;
38190
+ var _a3, _b;
37870
38191
  super.optimizeNodes();
37871
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNodes();
38192
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNodes();
37872
38193
  (_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
37873
38194
  return this;
37874
38195
  }
37875
38196
  optimizeNames(names, constants) {
37876
- var _a2, _b;
38197
+ var _a3, _b;
37877
38198
  super.optimizeNames(names, constants);
37878
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNames(names, constants);
38199
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNames(names, constants);
37879
38200
  (_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants);
37880
38201
  return this;
37881
38202
  }
@@ -38598,8 +38919,8 @@ var require_applicability = __commonJS((exports) => {
38598
38919
  }
38599
38920
  exports.shouldUseGroup = shouldUseGroup;
38600
38921
  function shouldUseRule(schema, rule) {
38601
- var _a2;
38602
- return schema[rule.keyword] !== undefined || ((_a2 = rule.definition.implements) === null || _a2 === undefined ? undefined : _a2.some((kwd) => schema[kwd] !== undefined));
38922
+ var _a3;
38923
+ return schema[rule.keyword] !== undefined || ((_a3 = rule.definition.implements) === null || _a3 === undefined ? undefined : _a3.some((kwd) => schema[kwd] !== undefined));
38603
38924
  }
38604
38925
  exports.shouldUseRule = shouldUseRule;
38605
38926
  });
@@ -38974,14 +39295,14 @@ var require_keyword = __commonJS((exports) => {
38974
39295
  }
38975
39296
  exports.macroKeywordCode = macroKeywordCode;
38976
39297
  function funcKeywordCode(cxt, def) {
38977
- var _a2;
39298
+ var _a3;
38978
39299
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
38979
39300
  checkAsyncKeyword(it, def);
38980
39301
  const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
38981
39302
  const validateRef = useKeyword(gen, keyword, validate);
38982
39303
  const valid = gen.let("valid");
38983
39304
  cxt.block$data(valid, validateKeyword);
38984
- cxt.ok((_a2 = def.valid) !== null && _a2 !== undefined ? _a2 : valid);
39305
+ cxt.ok((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid);
38985
39306
  function validateKeyword() {
38986
39307
  if (def.errors === false) {
38987
39308
  assignValid();
@@ -39012,8 +39333,8 @@ var require_keyword = __commonJS((exports) => {
39012
39333
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
39013
39334
  }
39014
39335
  function reportErrs(errors4) {
39015
- var _a3;
39016
- gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid), errors4);
39336
+ var _a4;
39337
+ gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== undefined ? _a4 : valid), errors4);
39017
39338
  }
39018
39339
  }
39019
39340
  exports.funcKeywordCode = funcKeywordCode;
@@ -39968,7 +40289,7 @@ var require_compile = __commonJS((exports) => {
39968
40289
 
39969
40290
  class SchemaEnv {
39970
40291
  constructor(env) {
39971
- var _a2;
40292
+ var _a3;
39972
40293
  this.refs = {};
39973
40294
  this.dynamicAnchors = {};
39974
40295
  let schema;
@@ -39977,7 +40298,7 @@ var require_compile = __commonJS((exports) => {
39977
40298
  this.schema = env.schema;
39978
40299
  this.schemaId = env.schemaId;
39979
40300
  this.root = env.root || this;
39980
- this.baseId = (_a2 = env.baseId) !== null && _a2 !== undefined ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
40301
+ this.baseId = (_a3 = env.baseId) !== null && _a3 !== undefined ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
39981
40302
  this.schemaPath = env.schemaPath;
39982
40303
  this.localRefs = env.localRefs;
39983
40304
  this.meta = env.meta;
@@ -40072,14 +40393,14 @@ var require_compile = __commonJS((exports) => {
40072
40393
  }
40073
40394
  exports.compileSchema = compileSchema;
40074
40395
  function resolveRef(root, baseId, ref) {
40075
- var _a2;
40396
+ var _a3;
40076
40397
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
40077
40398
  const schOrFunc = root.refs[ref];
40078
40399
  if (schOrFunc)
40079
40400
  return schOrFunc;
40080
40401
  let _sch = resolve.call(this, root, ref);
40081
40402
  if (_sch === undefined) {
40082
- const schema = (_a2 = root.localRefs) === null || _a2 === undefined ? undefined : _a2[ref];
40403
+ const schema = (_a3 = root.localRefs) === null || _a3 === undefined ? undefined : _a3[ref];
40083
40404
  const { schemaId } = this.opts;
40084
40405
  if (schema)
40085
40406
  _sch = new SchemaEnv({ schema, schemaId, root, baseId });
@@ -40148,8 +40469,8 @@ var require_compile = __commonJS((exports) => {
40148
40469
  "definitions"
40149
40470
  ]);
40150
40471
  function getJsonPointer(parsedRef, { baseId, schema, root }) {
40151
- var _a2;
40152
- if (((_a2 = parsedRef.fragment) === null || _a2 === undefined ? undefined : _a2[0]) !== "/")
40472
+ var _a3;
40473
+ if (((_a3 = parsedRef.fragment) === null || _a3 === undefined ? undefined : _a3[0]) !== "/")
40153
40474
  return;
40154
40475
  for (const part of parsedRef.fragment.slice(1).split("/")) {
40155
40476
  if (typeof schema === "boolean")
@@ -40197,6 +40518,9 @@ var require_data = __commonJS((exports, module) => {
40197
40518
  var require_utils4 = __commonJS((exports, module) => {
40198
40519
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
40199
40520
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
40521
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
40522
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
40523
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
40200
40524
  function stringArrayToHexStripped(input) {
40201
40525
  let acc = "";
40202
40526
  let code = 0;
@@ -40390,27 +40714,77 @@ var require_utils4 = __commonJS((exports, module) => {
40390
40714
  }
40391
40715
  return output.join("");
40392
40716
  }
40393
- function normalizeComponentEncoding(component, esc2) {
40394
- const func = esc2 !== true ? escape : unescape;
40395
- if (component.scheme !== undefined) {
40396
- component.scheme = func(component.scheme);
40397
- }
40398
- if (component.userinfo !== undefined) {
40399
- component.userinfo = func(component.userinfo);
40400
- }
40401
- if (component.host !== undefined) {
40402
- component.host = func(component.host);
40717
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
40718
+ var HOST_DELIM_RE = /[@/?#:]/g;
40719
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
40720
+ function reescapeHostDelimiters(host, isIP) {
40721
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
40722
+ re.lastIndex = 0;
40723
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
40724
+ }
40725
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
40726
+ if (input.indexOf("%") === -1) {
40727
+ return input;
40403
40728
  }
40404
- if (component.path !== undefined) {
40405
- component.path = func(component.path);
40729
+ let output = "";
40730
+ for (let i = 0;i < input.length; i++) {
40731
+ if (input[i] === "%" && i + 2 < input.length) {
40732
+ const hex = input.slice(i + 1, i + 3);
40733
+ if (isHexPair(hex)) {
40734
+ const normalizedHex = hex.toUpperCase();
40735
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
40736
+ if (decodeUnreserved && isUnreserved(decoded)) {
40737
+ output += decoded;
40738
+ } else {
40739
+ output += "%" + normalizedHex;
40740
+ }
40741
+ i += 2;
40742
+ continue;
40743
+ }
40744
+ }
40745
+ output += input[i];
40406
40746
  }
40407
- if (component.query !== undefined) {
40408
- component.query = func(component.query);
40747
+ return output;
40748
+ }
40749
+ function normalizePathEncoding(input) {
40750
+ let output = "";
40751
+ for (let i = 0;i < input.length; i++) {
40752
+ if (input[i] === "%" && i + 2 < input.length) {
40753
+ const hex = input.slice(i + 1, i + 3);
40754
+ if (isHexPair(hex)) {
40755
+ const normalizedHex = hex.toUpperCase();
40756
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
40757
+ if (decoded !== "." && isUnreserved(decoded)) {
40758
+ output += decoded;
40759
+ } else {
40760
+ output += "%" + normalizedHex;
40761
+ }
40762
+ i += 2;
40763
+ continue;
40764
+ }
40765
+ }
40766
+ if (isPathCharacter(input[i])) {
40767
+ output += input[i];
40768
+ } else {
40769
+ output += escape(input[i]);
40770
+ }
40409
40771
  }
40410
- if (component.fragment !== undefined) {
40411
- component.fragment = func(component.fragment);
40772
+ return output;
40773
+ }
40774
+ function escapePreservingEscapes(input) {
40775
+ let output = "";
40776
+ for (let i = 0;i < input.length; i++) {
40777
+ if (input[i] === "%" && i + 2 < input.length) {
40778
+ const hex = input.slice(i + 1, i + 3);
40779
+ if (isHexPair(hex)) {
40780
+ output += "%" + hex.toUpperCase();
40781
+ i += 2;
40782
+ continue;
40783
+ }
40784
+ }
40785
+ output += escape(input[i]);
40412
40786
  }
40413
- return component;
40787
+ return output;
40414
40788
  }
40415
40789
  function recomposeAuthority(component) {
40416
40790
  const uriTokens = [];
@@ -40425,7 +40799,7 @@ var require_utils4 = __commonJS((exports, module) => {
40425
40799
  if (ipV6res.isIPV6 === true) {
40426
40800
  host = `[${ipV6res.escapedHost}]`;
40427
40801
  } else {
40428
- host = component.host;
40802
+ host = reescapeHostDelimiters(host, false);
40429
40803
  }
40430
40804
  }
40431
40805
  uriTokens.push(host);
@@ -40439,7 +40813,10 @@ var require_utils4 = __commonJS((exports, module) => {
40439
40813
  module.exports = {
40440
40814
  nonSimpleDomain,
40441
40815
  recomposeAuthority,
40442
- normalizeComponentEncoding,
40816
+ reescapeHostDelimiters,
40817
+ normalizePercentEncoding,
40818
+ normalizePathEncoding,
40819
+ escapePreservingEscapes,
40443
40820
  removeDotSegments,
40444
40821
  isIPv4,
40445
40822
  isUUID,
@@ -40624,11 +41001,11 @@ var require_schemes = __commonJS((exports, module) => {
40624
41001
 
40625
41002
  // node_modules/fast-uri/index.js
40626
41003
  var require_fast_uri = __commonJS((exports, module) => {
40627
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils4();
41004
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils4();
40628
41005
  var { SCHEMES, getSchemeHandler } = require_schemes();
40629
41006
  function normalize(uri, options) {
40630
41007
  if (typeof uri === "string") {
40631
- uri = serialize(parse6(uri, options), options);
41008
+ uri = normalizeString(uri, options);
40632
41009
  } else if (typeof uri === "object") {
40633
41010
  uri = parse6(serialize(uri, options), options);
40634
41011
  }
@@ -40694,19 +41071,9 @@ var require_fast_uri = __commonJS((exports, module) => {
40694
41071
  return target;
40695
41072
  }
40696
41073
  function equal(uriA, uriB, options) {
40697
- if (typeof uriA === "string") {
40698
- uriA = unescape(uriA);
40699
- uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
40700
- } else if (typeof uriA === "object") {
40701
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
40702
- }
40703
- if (typeof uriB === "string") {
40704
- uriB = unescape(uriB);
40705
- uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
40706
- } else if (typeof uriB === "object") {
40707
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
40708
- }
40709
- return uriA.toLowerCase() === uriB.toLowerCase();
41074
+ const normalizedA = normalizeComparableURI(uriA, options);
41075
+ const normalizedB = normalizeComparableURI(uriB, options);
41076
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
40710
41077
  }
40711
41078
  function serialize(cmpts, opts) {
40712
41079
  const component = {
@@ -40732,12 +41099,12 @@ var require_fast_uri = __commonJS((exports, module) => {
40732
41099
  schemeHandler.serialize(component, options);
40733
41100
  if (component.path !== undefined) {
40734
41101
  if (!options.skipEscape) {
40735
- component.path = escape(component.path);
41102
+ component.path = escapePreservingEscapes(component.path);
40736
41103
  if (component.scheme !== undefined) {
40737
41104
  component.path = component.path.split("%3A").join(":");
40738
41105
  }
40739
41106
  } else {
40740
- component.path = unescape(component.path);
41107
+ component.path = normalizePercentEncoding(component.path);
40741
41108
  }
40742
41109
  }
40743
41110
  if (options.reference !== "suffix" && component.scheme) {
@@ -40772,7 +41139,16 @@ var require_fast_uri = __commonJS((exports, module) => {
40772
41139
  return uriTokens.join("");
40773
41140
  }
40774
41141
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
40775
- function parse6(uri, opts) {
41142
+ function getParseError(parsed, matches) {
41143
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
41144
+ return 'URI path must start with "/" when authority is present.';
41145
+ }
41146
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
41147
+ return "URI port is malformed.";
41148
+ }
41149
+ return;
41150
+ }
41151
+ function parseWithStatus(uri, opts) {
40776
41152
  const options = Object.assign({}, opts);
40777
41153
  const parsed = {
40778
41154
  scheme: undefined,
@@ -40783,6 +41159,7 @@ var require_fast_uri = __commonJS((exports, module) => {
40783
41159
  query: undefined,
40784
41160
  fragment: undefined
40785
41161
  };
41162
+ let malformedAuthorityOrPort = false;
40786
41163
  let isIP = false;
40787
41164
  if (options.reference === "suffix") {
40788
41165
  if (options.scheme) {
@@ -40803,6 +41180,11 @@ var require_fast_uri = __commonJS((exports, module) => {
40803
41180
  if (isNaN(parsed.port)) {
40804
41181
  parsed.port = matches[5];
40805
41182
  }
41183
+ const parseError = getParseError(parsed, matches);
41184
+ if (parseError !== undefined) {
41185
+ parsed.error = parsed.error || parseError;
41186
+ malformedAuthorityOrPort = true;
41187
+ }
40806
41188
  if (parsed.host) {
40807
41189
  const ipv4result = isIPv4(parsed.host);
40808
41190
  if (ipv4result === false) {
@@ -40841,14 +41223,18 @@ var require_fast_uri = __commonJS((exports, module) => {
40841
41223
  parsed.scheme = unescape(parsed.scheme);
40842
41224
  }
40843
41225
  if (parsed.host !== undefined) {
40844
- parsed.host = unescape(parsed.host);
41226
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
40845
41227
  }
40846
41228
  }
40847
41229
  if (parsed.path) {
40848
- parsed.path = escape(unescape(parsed.path));
41230
+ parsed.path = normalizePathEncoding(parsed.path);
40849
41231
  }
40850
41232
  if (parsed.fragment) {
40851
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
41233
+ try {
41234
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
41235
+ } catch {
41236
+ parsed.error = parsed.error || "URI malformed";
41237
+ }
40852
41238
  }
40853
41239
  }
40854
41240
  if (schemeHandler && schemeHandler.parse) {
@@ -40857,7 +41243,29 @@ var require_fast_uri = __commonJS((exports, module) => {
40857
41243
  } else {
40858
41244
  parsed.error = parsed.error || "URI can not be parsed.";
40859
41245
  }
40860
- return parsed;
41246
+ return { parsed, malformedAuthorityOrPort };
41247
+ }
41248
+ function parse6(uri, opts) {
41249
+ return parseWithStatus(uri, opts).parsed;
41250
+ }
41251
+ function normalizeString(uri, opts) {
41252
+ return normalizeStringWithStatus(uri, opts).normalized;
41253
+ }
41254
+ function normalizeStringWithStatus(uri, opts) {
41255
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
41256
+ return {
41257
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
41258
+ malformedAuthorityOrPort
41259
+ };
41260
+ }
41261
+ function normalizeComparableURI(uri, opts) {
41262
+ if (typeof uri === "string") {
41263
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
41264
+ return malformedAuthorityOrPort ? undefined : normalized;
41265
+ }
41266
+ if (typeof uri === "object") {
41267
+ return serialize(uri, opts);
41268
+ }
40861
41269
  }
40862
41270
  var fastUri = {
40863
41271
  SCHEMES,
@@ -40960,9 +41368,9 @@ var require_core = __commonJS((exports) => {
40960
41368
  };
40961
41369
  var MAX_EXPRESSION = 200;
40962
41370
  function requiredOptions(o) {
40963
- var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
41371
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
40964
41372
  const s = o.strict;
40965
- const _optz = (_a2 = o.code) === null || _a2 === undefined ? undefined : _a2.optimize;
41373
+ const _optz = (_a3 = o.code) === null || _a3 === undefined ? undefined : _a3.optimize;
40966
41374
  const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;
40967
41375
  const regExp = (_c = (_b = o.code) === null || _b === undefined ? undefined : _b.regExp) !== null && _c !== undefined ? _c : defaultRegExp;
40968
41376
  const uriResolver = (_d = o.uriResolver) !== null && _d !== undefined ? _d : uri_1.default;
@@ -41421,7 +41829,7 @@ var require_core = __commonJS((exports) => {
41421
41829
  }
41422
41830
  }
41423
41831
  function addRule(keyword, definition, dataType) {
41424
- var _a2;
41832
+ var _a3;
41425
41833
  const post = definition === null || definition === undefined ? undefined : definition.post;
41426
41834
  if (dataType && post)
41427
41835
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -41447,7 +41855,7 @@ var require_core = __commonJS((exports) => {
41447
41855
  else
41448
41856
  ruleGroup.rules.push(rule);
41449
41857
  RULES.all[keyword] = rule;
41450
- (_a2 = definition.implements) === null || _a2 === undefined || _a2.forEach((kwd) => this.addKeyword(kwd));
41858
+ (_a3 = definition.implements) === null || _a3 === undefined || _a3.forEach((kwd) => this.addKeyword(kwd));
41451
41859
  }
41452
41860
  function addBeforeRule(ruleGroup, rule, before) {
41453
41861
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -41575,10 +41983,10 @@ var require_ref2 = __commonJS((exports) => {
41575
41983
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
41576
41984
  }
41577
41985
  function addEvaluatedFrom(source) {
41578
- var _a2;
41986
+ var _a3;
41579
41987
  if (!it.opts.unevaluated)
41580
41988
  return;
41581
- const schEvaluated = (_a2 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a2 === undefined ? undefined : _a2.evaluated;
41989
+ const schEvaluated = (_a3 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a3 === undefined ? undefined : _a3.evaluated;
41582
41990
  if (it.props !== true) {
41583
41991
  if (schEvaluated && !schEvaluated.dynamicProps) {
41584
41992
  if (schEvaluated.props !== undefined) {
@@ -43105,7 +43513,7 @@ var require_discriminator = __commonJS((exports) => {
43105
43513
  return _valid;
43106
43514
  }
43107
43515
  function getMapping() {
43108
- var _a2;
43516
+ var _a3;
43109
43517
  const oneOfMapping = {};
43110
43518
  const topRequired = hasRequired(parentSchema);
43111
43519
  let tagRequired = true;
@@ -43119,7 +43527,7 @@ var require_discriminator = __commonJS((exports) => {
43119
43527
  if (sch === undefined)
43120
43528
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
43121
43529
  }
43122
- const propSch = (_a2 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a2 === undefined ? undefined : _a2[tagName];
43530
+ const propSch = (_a3 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a3 === undefined ? undefined : _a3[tagName];
43123
43531
  if (typeof propSch != "object") {
43124
43532
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
43125
43533
  }
@@ -43599,12 +44007,12 @@ var require_code3 = __commonJS((exports) => {
43599
44007
  return item === "" || item === '""';
43600
44008
  }
43601
44009
  get str() {
43602
- var _a2;
43603
- return (_a2 = this._str) !== null && _a2 !== undefined ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
44010
+ var _a3;
44011
+ return (_a3 = this._str) !== null && _a3 !== undefined ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
43604
44012
  }
43605
44013
  get names() {
43606
- var _a2;
43607
- return (_a2 = this._names) !== null && _a2 !== undefined ? _a2 : this._names = this._items.reduce((names, c) => {
44014
+ var _a3;
44015
+ return (_a3 = this._names) !== null && _a3 !== undefined ? _a3 : this._names = this._items.reduce((names, c) => {
43608
44016
  if (c instanceof Name)
43609
44017
  names[c.str] = (names[c.str] || 0) + 1;
43610
44018
  return names;
@@ -43749,8 +44157,8 @@ var require_scope2 = __commonJS((exports) => {
43749
44157
  return `${prefix}${ng.index++}`;
43750
44158
  }
43751
44159
  _nameGroup(prefix) {
43752
- var _a2, _b;
43753
- if (((_b = (_a2 = this._parent) === null || _a2 === undefined ? undefined : _a2._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
44160
+ var _a3, _b;
44161
+ if (((_b = (_a3 = this._parent) === null || _a3 === undefined ? undefined : _a3._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
43754
44162
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
43755
44163
  }
43756
44164
  return this._names[prefix] = { prefix, index: 0 };
@@ -43785,12 +44193,12 @@ var require_scope2 = __commonJS((exports) => {
43785
44193
  return new ValueScopeName(prefix, this._newName(prefix));
43786
44194
  }
43787
44195
  value(nameOrPrefix, value) {
43788
- var _a2;
44196
+ var _a3;
43789
44197
  if (value.ref === undefined)
43790
44198
  throw new Error("CodeGen: ref must be passed in value");
43791
44199
  const name = this.toName(nameOrPrefix);
43792
44200
  const { prefix } = name;
43793
- const valueKey = (_a2 = value.key) !== null && _a2 !== undefined ? _a2 : value.ref;
44201
+ const valueKey = (_a3 = value.key) !== null && _a3 !== undefined ? _a3 : value.ref;
43794
44202
  let vs = this._values[prefix];
43795
44203
  if (vs) {
43796
44204
  const _name = vs.get(valueKey);
@@ -44118,8 +44526,8 @@ var require_codegen2 = __commonJS((exports) => {
44118
44526
  return this;
44119
44527
  }
44120
44528
  optimizeNames(names, constants) {
44121
- var _a2;
44122
- this.else = (_a2 = this.else) === null || _a2 === undefined ? undefined : _a2.optimizeNames(names, constants);
44529
+ var _a3;
44530
+ this.else = (_a3 = this.else) === null || _a3 === undefined ? undefined : _a3.optimizeNames(names, constants);
44123
44531
  if (!(super.optimizeNames(names, constants) || this.else))
44124
44532
  return;
44125
44533
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -44230,16 +44638,16 @@ var require_codegen2 = __commonJS((exports) => {
44230
44638
  return code;
44231
44639
  }
44232
44640
  optimizeNodes() {
44233
- var _a2, _b;
44641
+ var _a3, _b;
44234
44642
  super.optimizeNodes();
44235
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNodes();
44643
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNodes();
44236
44644
  (_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
44237
44645
  return this;
44238
44646
  }
44239
44647
  optimizeNames(names, constants) {
44240
- var _a2, _b;
44648
+ var _a3, _b;
44241
44649
  super.optimizeNames(names, constants);
44242
- (_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNames(names, constants);
44650
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNames(names, constants);
44243
44651
  (_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants);
44244
44652
  return this;
44245
44653
  }
@@ -44962,8 +45370,8 @@ var require_applicability2 = __commonJS((exports) => {
44962
45370
  }
44963
45371
  exports.shouldUseGroup = shouldUseGroup;
44964
45372
  function shouldUseRule(schema, rule) {
44965
- var _a2;
44966
- return schema[rule.keyword] !== undefined || ((_a2 = rule.definition.implements) === null || _a2 === undefined ? undefined : _a2.some((kwd) => schema[kwd] !== undefined));
45373
+ var _a3;
45374
+ return schema[rule.keyword] !== undefined || ((_a3 = rule.definition.implements) === null || _a3 === undefined ? undefined : _a3.some((kwd) => schema[kwd] !== undefined));
44967
45375
  }
44968
45376
  exports.shouldUseRule = shouldUseRule;
44969
45377
  });
@@ -45338,14 +45746,14 @@ var require_keyword2 = __commonJS((exports) => {
45338
45746
  }
45339
45747
  exports.macroKeywordCode = macroKeywordCode;
45340
45748
  function funcKeywordCode(cxt, def) {
45341
- var _a2;
45749
+ var _a3;
45342
45750
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
45343
45751
  checkAsyncKeyword(it, def);
45344
45752
  const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
45345
45753
  const validateRef = useKeyword(gen, keyword, validate);
45346
45754
  const valid = gen.let("valid");
45347
45755
  cxt.block$data(valid, validateKeyword);
45348
- cxt.ok((_a2 = def.valid) !== null && _a2 !== undefined ? _a2 : valid);
45756
+ cxt.ok((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid);
45349
45757
  function validateKeyword() {
45350
45758
  if (def.errors === false) {
45351
45759
  assignValid();
@@ -45376,8 +45784,8 @@ var require_keyword2 = __commonJS((exports) => {
45376
45784
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
45377
45785
  }
45378
45786
  function reportErrs(errors4) {
45379
- var _a3;
45380
- gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid), errors4);
45787
+ var _a4;
45788
+ gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== undefined ? _a4 : valid), errors4);
45381
45789
  }
45382
45790
  }
45383
45791
  exports.funcKeywordCode = funcKeywordCode;
@@ -46290,7 +46698,7 @@ var require_compile2 = __commonJS((exports) => {
46290
46698
 
46291
46699
  class SchemaEnv {
46292
46700
  constructor(env) {
46293
- var _a2;
46701
+ var _a3;
46294
46702
  this.refs = {};
46295
46703
  this.dynamicAnchors = {};
46296
46704
  let schema;
@@ -46299,7 +46707,7 @@ var require_compile2 = __commonJS((exports) => {
46299
46707
  this.schema = env.schema;
46300
46708
  this.schemaId = env.schemaId;
46301
46709
  this.root = env.root || this;
46302
- this.baseId = (_a2 = env.baseId) !== null && _a2 !== undefined ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
46710
+ this.baseId = (_a3 = env.baseId) !== null && _a3 !== undefined ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
46303
46711
  this.schemaPath = env.schemaPath;
46304
46712
  this.localRefs = env.localRefs;
46305
46713
  this.meta = env.meta;
@@ -46394,14 +46802,14 @@ var require_compile2 = __commonJS((exports) => {
46394
46802
  }
46395
46803
  exports.compileSchema = compileSchema;
46396
46804
  function resolveRef(root, baseId, ref) {
46397
- var _a2;
46805
+ var _a3;
46398
46806
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
46399
46807
  const schOrFunc = root.refs[ref];
46400
46808
  if (schOrFunc)
46401
46809
  return schOrFunc;
46402
46810
  let _sch = resolve.call(this, root, ref);
46403
46811
  if (_sch === undefined) {
46404
- const schema = (_a2 = root.localRefs) === null || _a2 === undefined ? undefined : _a2[ref];
46812
+ const schema = (_a3 = root.localRefs) === null || _a3 === undefined ? undefined : _a3[ref];
46405
46813
  const { schemaId } = this.opts;
46406
46814
  if (schema)
46407
46815
  _sch = new SchemaEnv({ schema, schemaId, root, baseId });
@@ -46470,8 +46878,8 @@ var require_compile2 = __commonJS((exports) => {
46470
46878
  "definitions"
46471
46879
  ]);
46472
46880
  function getJsonPointer(parsedRef, { baseId, schema, root }) {
46473
- var _a2;
46474
- if (((_a2 = parsedRef.fragment) === null || _a2 === undefined ? undefined : _a2[0]) !== "/")
46881
+ var _a3;
46882
+ if (((_a3 = parsedRef.fragment) === null || _a3 === undefined ? undefined : _a3[0]) !== "/")
46475
46883
  return;
46476
46884
  for (const part of parsedRef.fragment.slice(1).split("/")) {
46477
46885
  if (typeof schema === "boolean")
@@ -46602,9 +47010,9 @@ var require_core3 = __commonJS((exports) => {
46602
47010
  };
46603
47011
  var MAX_EXPRESSION = 200;
46604
47012
  function requiredOptions(o) {
46605
- var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
47013
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
46606
47014
  const s = o.strict;
46607
- const _optz = (_a2 = o.code) === null || _a2 === undefined ? undefined : _a2.optimize;
47015
+ const _optz = (_a3 = o.code) === null || _a3 === undefined ? undefined : _a3.optimize;
46608
47016
  const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;
46609
47017
  const regExp = (_c = (_b = o.code) === null || _b === undefined ? undefined : _b.regExp) !== null && _c !== undefined ? _c : defaultRegExp;
46610
47018
  const uriResolver = (_d = o.uriResolver) !== null && _d !== undefined ? _d : uri_1.default;
@@ -47063,7 +47471,7 @@ var require_core3 = __commonJS((exports) => {
47063
47471
  }
47064
47472
  }
47065
47473
  function addRule(keyword, definition, dataType) {
47066
- var _a2;
47474
+ var _a3;
47067
47475
  const post = definition === null || definition === undefined ? undefined : definition.post;
47068
47476
  if (dataType && post)
47069
47477
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -47089,7 +47497,7 @@ var require_core3 = __commonJS((exports) => {
47089
47497
  else
47090
47498
  ruleGroup.rules.push(rule);
47091
47499
  RULES.all[keyword] = rule;
47092
- (_a2 = definition.implements) === null || _a2 === undefined || _a2.forEach((kwd) => this.addKeyword(kwd));
47500
+ (_a3 = definition.implements) === null || _a3 === undefined || _a3.forEach((kwd) => this.addKeyword(kwd));
47093
47501
  }
47094
47502
  function addBeforeRule(ruleGroup, rule, before) {
47095
47503
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -47217,10 +47625,10 @@ var require_ref3 = __commonJS((exports) => {
47217
47625
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
47218
47626
  }
47219
47627
  function addEvaluatedFrom(source) {
47220
- var _a2;
47628
+ var _a3;
47221
47629
  if (!it.opts.unevaluated)
47222
47630
  return;
47223
- const schEvaluated = (_a2 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a2 === undefined ? undefined : _a2.evaluated;
47631
+ const schEvaluated = (_a3 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a3 === undefined ? undefined : _a3.evaluated;
47224
47632
  if (it.props !== true) {
47225
47633
  if (schEvaluated && !schEvaluated.dynamicProps) {
47226
47634
  if (schEvaluated.props !== undefined) {
@@ -48747,7 +49155,7 @@ var require_discriminator2 = __commonJS((exports) => {
48747
49155
  return _valid;
48748
49156
  }
48749
49157
  function getMapping() {
48750
- var _a2;
49158
+ var _a3;
48751
49159
  const oneOfMapping = {};
48752
49160
  const topRequired = hasRequired(parentSchema);
48753
49161
  let tagRequired = true;
@@ -48761,7 +49169,7 @@ var require_discriminator2 = __commonJS((exports) => {
48761
49169
  if (sch === undefined)
48762
49170
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
48763
49171
  }
48764
- const propSch = (_a2 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a2 === undefined ? undefined : _a2[tagName];
49172
+ const propSch = (_a3 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a3 === undefined ? undefined : _a3[tagName];
48765
49173
  if (typeof propSch != "object") {
48766
49174
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
48767
49175
  }
@@ -49117,9 +49525,9 @@ var require_dist2 = __commonJS((exports, module) => {
49117
49525
  return f;
49118
49526
  };
49119
49527
  function addFormats(ajv, list, fs, exportName) {
49120
- var _a2;
49528
+ var _a3;
49121
49529
  var _b;
49122
- (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
49530
+ (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
49123
49531
  for (const f of list)
49124
49532
  ajv.addFormat(f, fs[f]);
49125
49533
  }
@@ -50571,9 +50979,9 @@ var init_config = __esm(() => {
50571
50979
  SDK_METADATA = {
50572
50980
  language: "typescript",
50573
50981
  openapiDocVersion: "1.0",
50574
- sdkVersion: "2.1.6",
50575
- genVersion: "2.881.4",
50576
- userAgent: "speakeasy-sdk/mcp-typescript 2.1.6 2.881.4 1.0 @flexprice/mcp-server"
50982
+ sdkVersion: "2.1.10",
50983
+ genVersion: "2.882.0",
50984
+ userAgent: "speakeasy-sdk/mcp-typescript 2.1.10 2.882.0 1.0 @flexprice/mcp-server"
50577
50985
  };
50578
50986
  });
50579
50987
 
@@ -53576,6 +53984,7 @@ var init_customerfilter = __esm(() => {
53576
53984
  external_ids: array(string2()).optional(),
53577
53985
  filters: array(FilterCondition$zodSchema).optional(),
53578
53986
  limit: int().optional(),
53987
+ metadata: record(string2(), string2()).optional(),
53579
53988
  offset: int().optional(),
53580
53989
  order: CustomerFilterOrder$zodSchema.optional(),
53581
53990
  sort: array(SortCondition$zodSchema).optional(),
@@ -55570,8 +55979,10 @@ var init_invoicebillingreason = __esm(() => {
55570
55979
  "SUBSCRIPTION_CYCLE",
55571
55980
  "SUBSCRIPTION_UPDATE",
55572
55981
  "SUBSCRIPTION_TRIAL_END",
55982
+ "SUBSCRIPTION_TRIAL_START",
55573
55983
  "PRORATION",
55574
- "MANUAL"
55984
+ "MANUAL",
55985
+ "AUTO_INVOICE_THRESHOLD"
55575
55986
  ]);
55576
55987
  });
55577
55988
 
@@ -56749,8 +57160,10 @@ var init_subscriptiontype = __esm(() => {
56749
57160
  init_zod();
56750
57161
  SubscriptionType$zodSchema = _enum([
56751
57162
  "standalone",
57163
+ "delegated_invoicing",
56752
57164
  "parent",
56753
- "inherited"
57165
+ "inherited",
57166
+ "grouped_invoicing"
56754
57167
  ]);
56755
57168
  });
56756
57169
 
@@ -56778,6 +57191,9 @@ var init_subscriptionresponse = __esm(() => {
56778
57191
  SubscriptionResponse$zodSchema = object({
56779
57192
  active_pause_id: string2().optional().describe(`ActivePauseID references the current active pause configuration
56780
57193
  This will be null if no pause is active or scheduled`),
57194
+ auto_invoice_threshold: string2().optional().describe(`AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers
57195
+ an intermediate invoice. Overrides the plan-level threshold when set.
57196
+ Nil means: inherit from the plan's threshold (which may also be nil = disabled).`),
56781
57197
  billing_anchor: exports_iso.datetime({ offset: true }).optional().describe(`BillingAnchor is the reference point that aligns future billing cycle dates.
56782
57198
  It sets the day of week for week intervals, the day of month for month and year intervals,
56783
57199
  and the month of year for year intervals. The timestamp is in UTC format.`),
@@ -58969,6 +59385,7 @@ var init_planfilter = __esm(() => {
58969
59385
  filters: array(FilterCondition$zodSchema).optional().describe("filters allows complex filtering based on multiple fields"),
58970
59386
  limit: int().optional(),
58971
59387
  lookup_key: string2().optional(),
59388
+ metadata: record(string2(), string2()).optional(),
58972
59389
  offset: int().optional(),
58973
59390
  order: PlanFilterOrder$zodSchema.optional(),
58974
59391
  plan_ids: array(string2()).optional(),
@@ -61202,9 +61619,14 @@ var SubscriptionInheritanceConfig$zodSchema;
61202
61619
  var init_subscriptioninheritanceconfig = __esm(() => {
61203
61620
  init_zod();
61204
61621
  SubscriptionInheritanceConfig$zodSchema = object({
61205
- external_customer_ids_to_inherit_subscription: array(string2()).optional(),
61206
- invoicing_customer_external_id: string2().optional(),
61207
- parent_subscription_id: string2().optional()
61622
+ external_customer_ids_to_inherit_subscription: array(string2()).optional().describe(`ExternalCustomerIDsToInheritSubscription: child customer external IDs for which
61623
+ inherited skeleton subscriptions will be created. Only valid for parent behavior.`),
61624
+ invoicing_customer_external_id: string2().optional().describe(`InvoicingCustomerExternalID sets a different billing recipient (external ID).
61625
+ Required for delegated; rejected for inherited; optional for others.`),
61626
+ parent_subscription_id: string2().optional().describe(`ParentSubscriptionID links this subscription to an existing parent.
61627
+ Required for inherited and grouped_invoicing; rejected for standalone, delegated, parent.`),
61628
+ subscriptions_ids_for_grouped_invoicing: array(string2()).optional().describe(`SubscriptionsIDsForGroupedInvoicing: existing standalone subscription IDs to convert to
61629
+ grouped_invoicing under this parent at creation time. Only valid for parent behavior.`)
61208
61630
  });
61209
61631
  });
61210
61632
 
@@ -61249,6 +61671,11 @@ var init_createsubscriptionrequest = __esm(() => {
61249
61671
  init_taxrateoverride();
61250
61672
  CreateSubscriptionRequest$zodSchema = object({
61251
61673
  addons: array(AddAddonToSubscriptionRequest$zodSchema).optional().describe("Addons represents addons to be added to the subscription during creation"),
61674
+ auto_invoice_threshold: string2().optional().describe(`AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers
61675
+ an intermediate invoice mid-period. Set once at creation; cannot be changed later.
61676
+ Allowed only when the subscription resolves to type standalone (no parent hierarchy rows).
61677
+ Plan line items must be usage-based only (no fixed or other non-usage plan prices).
61678
+ Nil means auto invoice threshold billing is disabled for this subscription.`),
61252
61679
  billing_anchor: exports_iso.datetime({ offset: true }).optional().describe(`BillingAnchor overrides the derived billing anchor when billing_cycle is anniversary.
61253
61680
  For monthly billing, the day-of-month (and time-of-day) define cycle boundaries: if start_date
61254
61681
  is before that day in the month, the first billing period ends on the next occurrence of that
@@ -61964,6 +62391,28 @@ Use when applying a plan change (e.g. upgrade or downgrade). Executes proration
61964
62391
  };
61965
62392
  });
61966
62393
 
62394
+ // src/models/groupedinvoicingaction.ts
62395
+ var GroupedInvoicingAction$zodSchema;
62396
+ var init_groupedinvoicingaction = __esm(() => {
62397
+ init_zod();
62398
+ GroupedInvoicingAction$zodSchema = _enum([
62399
+ "add",
62400
+ "remove"
62401
+ ]);
62402
+ });
62403
+
62404
+ // src/models/submodifygroupedinvoicingparams.ts
62405
+ var SubModifyGroupedInvoicingParams$zodSchema;
62406
+ var init_submodifygroupedinvoicingparams = __esm(() => {
62407
+ init_zod();
62408
+ init_groupedinvoicingaction();
62409
+ SubModifyGroupedInvoicingParams$zodSchema = object({
62410
+ action: GroupedInvoicingAction$zodSchema,
62411
+ child_subscription_ids: array(string2()).optional(),
62412
+ parent_subscription_id: string2().optional().describe("ParentSubscriptionID is required for action 'add'.")
62413
+ });
62414
+ });
62415
+
61967
62416
  // src/models/submodifyinheritancerequest.ts
61968
62417
  var SubModifyInheritanceRequest$zodSchema;
61969
62418
  var init_submodifyinheritancerequest = __esm(() => {
@@ -62001,7 +62450,8 @@ var init_subscriptionmodifytype = __esm(() => {
62001
62450
  init_zod();
62002
62451
  SubscriptionModifyType$zodSchema = _enum([
62003
62452
  "inheritance",
62004
- "quantity_change"
62453
+ "quantity_change",
62454
+ "grouped_invoicing"
62005
62455
  ]);
62006
62456
  });
62007
62457
 
@@ -62009,10 +62459,12 @@ var init_subscriptionmodifytype = __esm(() => {
62009
62459
  var ExecuteSubscriptionModifyRequest$zodSchema;
62010
62460
  var init_executesubscriptionmodifyrequest = __esm(() => {
62011
62461
  init_zod();
62462
+ init_submodifygroupedinvoicingparams();
62012
62463
  init_submodifyinheritancerequest();
62013
62464
  init_submodifyquantitychangerequest();
62014
62465
  init_subscriptionmodifytype();
62015
62466
  ExecuteSubscriptionModifyRequest$zodSchema = object({
62467
+ grouped_invoicing_params: SubModifyGroupedInvoicingParams$zodSchema.optional(),
62016
62468
  inheritance_params: SubModifyInheritanceRequest$zodSchema.optional(),
62017
62469
  quantity_change_params: SubModifyQuantityChangeRequest$zodSchema.optional(),
62018
62470
  type: SubscriptionModifyType$zodSchema
@@ -63407,6 +63859,9 @@ var init_subscriptionresponsev2 = __esm(() => {
63407
63859
  SubscriptionResponseV2$zodSchema = object({
63408
63860
  active_pause_id: string2().optional().describe(`ActivePauseID references the current active pause configuration
63409
63861
  This will be null if no pause is active or scheduled`),
63862
+ auto_invoice_threshold: string2().optional().describe(`AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers
63863
+ an intermediate invoice. Overrides the plan-level threshold when set.
63864
+ Nil means: inherit from the plan's threshold (which may also be nil = disabled).`),
63410
63865
  billing_anchor: exports_iso.datetime({ offset: true }).optional().describe(`BillingAnchor is the reference point that aligns future billing cycle dates.
63411
63866
  It sets the day of week for week intervals, the day of month for month and year intervals,
63412
63867
  and the month of year for year intervals. The timestamp is in UTC format.`),
@@ -64350,6 +64805,151 @@ Use when listing or searching subscriptions (e.g. admin view or customer subscri
64350
64805
  };
64351
64806
  });
64352
64807
 
64808
+ // src/models/subscriptionlineitemfilter.ts
64809
+ var SubscriptionLineItemFilterOrder$zodSchema, SubscriptionLineItemFilter$zodSchema;
64810
+ var init_subscriptionlineitemfilter = __esm(() => {
64811
+ init_zod();
64812
+ init_filtercondition();
64813
+ init_sortcondition();
64814
+ init_status();
64815
+ init_subscriptionlineitementitytype();
64816
+ SubscriptionLineItemFilterOrder$zodSchema = _enum([
64817
+ "asc",
64818
+ "desc"
64819
+ ]);
64820
+ SubscriptionLineItemFilter$zodSchema = object({
64821
+ active_filter: boolean2().default(true),
64822
+ addon_association_ids: array(string2()).optional(),
64823
+ billing_periods: array(string2()).optional(),
64824
+ currencies: array(string2()).optional(),
64825
+ current_period_start: exports_iso.datetime({ offset: true }).optional(),
64826
+ customer_ids: array(string2()).optional(),
64827
+ end_time: exports_iso.datetime({ offset: true }).optional(),
64828
+ entity_ids: array(string2()).optional(),
64829
+ entity_type: SubscriptionLineItemEntityType$zodSchema.optional(),
64830
+ expand: string2().optional(),
64831
+ filters: array(FilterCondition$zodSchema).optional(),
64832
+ limit: int().optional(),
64833
+ meter_ids: array(string2()).optional(),
64834
+ offset: int().optional(),
64835
+ order: SubscriptionLineItemFilterOrder$zodSchema.optional(),
64836
+ price_ids: array(string2()).optional(),
64837
+ sort: array(SortCondition$zodSchema).optional(),
64838
+ start_time: exports_iso.datetime({ offset: true }).optional(),
64839
+ status: Status$zodSchema.optional(),
64840
+ subscription_ids: array(string2()).optional().describe("Specific filters")
64841
+ });
64842
+ });
64843
+
64844
+ // src/funcs/subscriptionsQuerySubscriptionLineItems.ts
64845
+ function subscriptionsQuerySubscriptionLineItems(client$, request, options) {
64846
+ return new APIPromise($do68(client$, request, options));
64847
+ }
64848
+ async function $do68(client$, request, options) {
64849
+ const parsed$ = safeParse4(request, (value$) => SubscriptionLineItemFilter$zodSchema.parse(value$), "Input validation failed");
64850
+ if (!parsed$.ok) {
64851
+ return [parsed$, { status: "invalid" }];
64852
+ }
64853
+ const payload$ = parsed$.value;
64854
+ const body$ = encodeJSON("body", payload$, { explode: true });
64855
+ const path$ = pathToFunc("/subscriptions/lineitems/search")();
64856
+ const headers$ = new Headers(compactMap({
64857
+ "Content-Type": "application/json",
64858
+ Accept: "application/json"
64859
+ }));
64860
+ const securityInput = await extractSecurity(client$._options.security);
64861
+ const requestSecurity = resolveGlobalSecurity(securityInput);
64862
+ const context = {
64863
+ options: client$._options,
64864
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
64865
+ operationID: "querySubscriptionLineItems",
64866
+ oAuth2Scopes: null,
64867
+ resolvedSecurity: requestSecurity,
64868
+ securitySource: client$._options.security,
64869
+ retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
64870
+ retryCodes: options?.retryCodes || [
64871
+ "429",
64872
+ "500",
64873
+ "502",
64874
+ "503",
64875
+ "504"
64876
+ ]
64877
+ };
64878
+ const requestRes = client$._createRequest(context, {
64879
+ security: requestSecurity,
64880
+ method: "POST",
64881
+ baseURL: options?.serverURL,
64882
+ path: path$,
64883
+ headers: headers$,
64884
+ body: body$,
64885
+ userAgent: client$._options.userAgent,
64886
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs || -1
64887
+ }, options);
64888
+ if (!requestRes.ok) {
64889
+ return [requestRes, { status: "invalid" }];
64890
+ }
64891
+ const req$ = requestRes.value;
64892
+ const doResult = await client$._do(req$, {
64893
+ context,
64894
+ errorCodes: [],
64895
+ retryConfig: context.retryConfig,
64896
+ retryCodes: context.retryCodes
64897
+ });
64898
+ if (!doResult.ok) {
64899
+ return [doResult, { status: "request-error", request: req$ }];
64900
+ }
64901
+ return [doResult, {
64902
+ status: "complete",
64903
+ request: req$,
64904
+ response: doResult.value
64905
+ }];
64906
+ }
64907
+ var init_subscriptionsQuerySubscriptionLineItems = __esm(() => {
64908
+ init_encodings();
64909
+ init_primitives();
64910
+ init_schemas4();
64911
+ init_security();
64912
+ init_url();
64913
+ init_subscriptionlineitemfilter();
64914
+ init_async();
64915
+ });
64916
+
64917
+ // src/mcp-server/tools/subscriptionsQuerySubscriptionLineItems.ts
64918
+ var args67, tool$subscriptionsQuerySubscriptionLineItems;
64919
+ var init_subscriptionsQuerySubscriptionLineItems2 = __esm(() => {
64920
+ init_subscriptionsQuerySubscriptionLineItems();
64921
+ init_subscriptionlineitemfilter();
64922
+ init_tools();
64923
+ args67 = {
64924
+ request: SubscriptionLineItemFilter$zodSchema.describe(`Filter`)
64925
+ };
64926
+ tool$subscriptionsQuerySubscriptionLineItems = {
64927
+ name: "query-subscription-line-items",
64928
+ description: `Search subscription line items
64929
+
64930
+ List subscription line items with a JSON filter (subscription, customer, price, pagination, expand=prices, etc.).`,
64931
+ scopes: ["read"],
64932
+ annotations: {
64933
+ title: "",
64934
+ destructiveHint: false,
64935
+ idempotentHint: false,
64936
+ openWorldHint: false,
64937
+ readOnlyHint: true
64938
+ },
64939
+ args: args67,
64940
+ tool: async (client, args68, ctx) => {
64941
+ const [result] = await subscriptionsQuerySubscriptionLineItems(client, args68.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64942
+ if (!result.ok) {
64943
+ return {
64944
+ content: [{ type: "text", text: result.error.message }],
64945
+ isError: true
64946
+ };
64947
+ }
64948
+ return formatResult(result.value);
64949
+ }
64950
+ };
64951
+ });
64952
+
64353
64953
  // src/models/removeaddonrequest.ts
64354
64954
  var RemoveAddonRequest$zodSchema;
64355
64955
  var init_removeaddonrequest = __esm(() => {
@@ -64368,9 +64968,9 @@ values combined with create_prorations will issue a wallet credit for unused tim
64368
64968
 
64369
64969
  // src/funcs/subscriptionsRemoveSubscriptionAddon.ts
64370
64970
  function subscriptionsRemoveSubscriptionAddon(client$, request, options) {
64371
- return new APIPromise($do68(client$, request, options));
64971
+ return new APIPromise($do69(client$, request, options));
64372
64972
  }
64373
- async function $do68(client$, request, options) {
64973
+ async function $do69(client$, request, options) {
64374
64974
  const parsed$ = safeParse4(request, (value$) => RemoveAddonRequest$zodSchema.parse(value$), "Input validation failed");
64375
64975
  if (!parsed$.ok) {
64376
64976
  return [parsed$, { status: "invalid" }];
@@ -64440,12 +65040,12 @@ var init_subscriptionsRemoveSubscriptionAddon = __esm(() => {
64440
65040
  });
64441
65041
 
64442
65042
  // src/mcp-server/tools/subscriptionsRemoveSubscriptionAddon.ts
64443
- var args67, tool$subscriptionsRemoveSubscriptionAddon;
65043
+ var args68, tool$subscriptionsRemoveSubscriptionAddon;
64444
65044
  var init_subscriptionsRemoveSubscriptionAddon2 = __esm(() => {
64445
65045
  init_subscriptionsRemoveSubscriptionAddon();
64446
65046
  init_removeaddonrequest();
64447
65047
  init_tools();
64448
- args67 = {
65048
+ args68 = {
64449
65049
  request: RemoveAddonRequest$zodSchema.describe(`Remove Addon Request`)
64450
65050
  };
64451
65051
  tool$subscriptionsRemoveSubscriptionAddon = {
@@ -64461,9 +65061,9 @@ Use when removing an add-on from a subscription (e.g. downgrade or opt-out).`,
64461
65061
  openWorldHint: false,
64462
65062
  readOnlyHint: false
64463
65063
  },
64464
- args: args67,
64465
- tool: async (client, args68, ctx) => {
64466
- const [result] = await subscriptionsRemoveSubscriptionAddon(client, args68.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65064
+ args: args68,
65065
+ tool: async (client, args69, ctx) => {
65066
+ const [result] = await subscriptionsRemoveSubscriptionAddon(client, args69.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64467
65067
  if (!result.ok) {
64468
65068
  return {
64469
65069
  content: [{ type: "text", text: result.error.message }],
@@ -64507,9 +65107,9 @@ var init_updatesubscriptionop = __esm(() => {
64507
65107
 
64508
65108
  // src/funcs/subscriptionsUpdateSubscription.ts
64509
65109
  function subscriptionsUpdateSubscription(client$, request, options) {
64510
- return new APIPromise($do69(client$, request, options));
65110
+ return new APIPromise($do70(client$, request, options));
64511
65111
  }
64512
- async function $do69(client$, request, options) {
65112
+ async function $do70(client$, request, options) {
64513
65113
  const parsed$ = safeParse4(request, (value$) => UpdateSubscriptionRequestRequest$zodSchema.parse(value$), "Input validation failed");
64514
65114
  if (!parsed$.ok) {
64515
65115
  return [parsed$, { status: "invalid" }];
@@ -64585,12 +65185,12 @@ var init_subscriptionsUpdateSubscription = __esm(() => {
64585
65185
  });
64586
65186
 
64587
65187
  // src/mcp-server/tools/subscriptionsUpdateSubscription.ts
64588
- var args68, tool$subscriptionsUpdateSubscription;
65188
+ var args69, tool$subscriptionsUpdateSubscription;
64589
65189
  var init_subscriptionsUpdateSubscription2 = __esm(() => {
64590
65190
  init_subscriptionsUpdateSubscription();
64591
65191
  init_updatesubscriptionop();
64592
65192
  init_tools();
64593
- args68 = {
65193
+ args69 = {
64594
65194
  request: UpdateSubscriptionRequestRequest$zodSchema
64595
65195
  };
64596
65196
  tool$subscriptionsUpdateSubscription = {
@@ -64606,9 +65206,9 @@ Use when changing subscription details (e.g. quantity, billing anchor, or parent
64606
65206
  openWorldHint: false,
64607
65207
  readOnlyHint: false
64608
65208
  },
64609
- args: args68,
64610
- tool: async (client, args69, ctx) => {
64611
- const [result] = await subscriptionsUpdateSubscription(client, args69.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65209
+ args: args69,
65210
+ tool: async (client, args70, ctx) => {
65211
+ const [result] = await subscriptionsUpdateSubscription(client, args70.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64612
65212
  if (!result.ok) {
64613
65213
  return {
64614
65214
  content: [{ type: "text", text: result.error.message }],
@@ -64667,9 +65267,9 @@ var init_updatesubscriptionlineitemop = __esm(() => {
64667
65267
 
64668
65268
  // src/funcs/subscriptionsUpdateSubscriptionLineItem.ts
64669
65269
  function subscriptionsUpdateSubscriptionLineItem(client$, request, options) {
64670
- return new APIPromise($do70(client$, request, options));
65270
+ return new APIPromise($do71(client$, request, options));
64671
65271
  }
64672
- async function $do70(client$, request, options) {
65272
+ async function $do71(client$, request, options) {
64673
65273
  const parsed$ = safeParse4(request, (value$) => UpdateSubscriptionLineItemRequestRequest$zodSchema.parse(value$), "Input validation failed");
64674
65274
  if (!parsed$.ok) {
64675
65275
  return [parsed$, { status: "invalid" }];
@@ -64745,12 +65345,12 @@ var init_subscriptionsUpdateSubscriptionLineItem = __esm(() => {
64745
65345
  });
64746
65346
 
64747
65347
  // src/mcp-server/tools/subscriptionsUpdateSubscriptionLineItem.ts
64748
- var args69, tool$subscriptionsUpdateSubscriptionLineItem;
65348
+ var args70, tool$subscriptionsUpdateSubscriptionLineItem;
64749
65349
  var init_subscriptionsUpdateSubscriptionLineItem2 = __esm(() => {
64750
65350
  init_subscriptionsUpdateSubscriptionLineItem();
64751
65351
  init_updatesubscriptionlineitemop();
64752
65352
  init_tools();
64753
- args69 = {
65353
+ args70 = {
64754
65354
  request: UpdateSubscriptionLineItemRequestRequest$zodSchema
64755
65355
  };
64756
65356
  tool$subscriptionsUpdateSubscriptionLineItem = {
@@ -64766,9 +65366,9 @@ Use when changing a subscription line item (e.g. quantity or price). Implemented
64766
65366
  openWorldHint: false,
64767
65367
  readOnlyHint: false
64768
65368
  },
64769
- args: args69,
64770
- tool: async (client, args70, ctx) => {
64771
- const [result] = await subscriptionsUpdateSubscriptionLineItem(client, args70.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
65369
+ args: args70,
65370
+ tool: async (client, args71, ctx) => {
65371
+ const [result] = await subscriptionsUpdateSubscriptionLineItem(client, args71.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
64772
65372
  if (!result.ok) {
64773
65373
  return {
64774
65374
  content: [{ type: "text", text: result.error.message }],
@@ -64784,16 +65384,16 @@ Use when changing a subscription line item (e.g. quantity or price). Implemented
64784
65384
  function createMCPServer(deps) {
64785
65385
  const server = new McpServer({
64786
65386
  name: "Flexprice",
64787
- version: "2.1.6"
65387
+ version: "2.1.10"
64788
65388
  });
64789
65389
  const getClient = deps.getSDK || (() => new FlexpriceCore({
64790
65390
  security: deps.security,
64791
65391
  serverURL: deps.serverURL,
64792
65392
  serverIdx: deps.serverIdx,
64793
65393
  debugLogger: deps.logger.level === "debug" ? {
64794
- log: (...args70) => console.log(...args70),
64795
- group: (...args70) => console.group(...args70),
64796
- groupEnd: (...args70) => console.groupEnd(...args70)
65394
+ log: (...args71) => console.log(...args71),
65395
+ group: (...args71) => console.group(...args71),
65396
+ groupEnd: (...args71) => console.groupEnd(...args71)
64797
65397
  } : undefined
64798
65398
  }));
64799
65399
  const scopes = new Set(deps.scopes);
@@ -64852,6 +65452,7 @@ function createMCPServer(deps) {
64852
65452
  tool(tool$subscriptionsCreateSubscription);
64853
65453
  tool(tool$subscriptionsAddSubscriptionAddon);
64854
65454
  tool(tool$subscriptionsRemoveSubscriptionAddon);
65455
+ tool(tool$subscriptionsQuerySubscriptionLineItems);
64855
65456
  tool(tool$subscriptionsUpdateSubscriptionLineItem);
64856
65457
  tool(tool$subscriptionsDeleteSubscriptionLineItem);
64857
65458
  tool(tool$subscriptionsQuerySubscription);
@@ -64950,6 +65551,7 @@ var init_server2 = __esm(() => {
64950
65551
  init_subscriptionsPreviewSubscriptionChange2();
64951
65552
  init_subscriptionsPreviewSubscriptionModify2();
64952
65553
  init_subscriptionsQuerySubscription2();
65554
+ init_subscriptionsQuerySubscriptionLineItems2();
64953
65555
  init_subscriptionsRemoveSubscriptionAddon2();
64954
65556
  init_subscriptionsUpdateSubscription2();
64955
65557
  init_subscriptionsUpdateSubscriptionLineItem2();
@@ -65252,6 +65854,12 @@ Use when adding an optional product or add-on to an existing subscription (e.g.
65252
65854
  description: `Remove addon from subscription
65253
65855
 
65254
65856
  Use when removing an add-on from a subscription (e.g. downgrade or opt-out).`
65857
+ },
65858
+ {
65859
+ name: "query-subscription-line-items",
65860
+ description: `Search subscription line items
65861
+
65862
+ List subscription line items with a JSON filter (subscription, customer, price, pagination, expand=prices, etc.).`
65255
65863
  },
65256
65864
  {
65257
65865
  name: "update-subscription-line-item",
@@ -65384,8 +65992,13 @@ Use when listing scheduled changes for a subscription (e.g. upcoming plan change
65384
65992
 
65385
65993
  // src/landing-page.ts
65386
65994
  function landingPageExpress(req, res) {
65387
- const origin = new URL(req.host).href;
65388
- res.type("html").send(landingPageHTML(origin));
65995
+ const proto = req.get("x-forwarded-proto")?.split(",")[0]?.trim() || req.protocol;
65996
+ const host = req.get("host");
65997
+ if (!host) {
65998
+ res.status(400).send("Missing Host header");
65999
+ return;
66000
+ }
66001
+ res.type("html").send(landingPageHTML(`${proto}://${host}`));
65389
66002
  }
65390
66003
  function landingPageHTML(origin) {
65391
66004
  const o = origin;
@@ -66447,7 +67060,7 @@ async function startStreamableHTTP(cliFlags) {
66447
67060
  app.use((req, res, next) => {
66448
67061
  res.header("Access-Control-Allow-Origin", "*");
66449
67062
  res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
66450
- res.header("Access-Control-Allow-Headers", "Content-Type, *");
67063
+ res.header("Access-Control-Allow-Headers", "*");
66451
67064
  if (req.method === "OPTIONS") {
66452
67065
  res.sendStatus(204);
66453
67066
  return;
@@ -68923,7 +69536,7 @@ var routes = buildRouteMap({
68923
69536
  var app = buildApplication(routes, {
68924
69537
  name: "mcp",
68925
69538
  versionInfo: {
68926
- currentVersion: "2.1.6"
69539
+ currentVersion: "2.1.10"
68927
69540
  }
68928
69541
  });
68929
69542
  run(app, process4.argv.slice(2), buildContext(process4));
@@ -68931,5 +69544,5 @@ export {
68931
69544
  app
68932
69545
  };
68933
69546
 
68934
- //# debugId=4C70D2B22566A71A64756E2164756E21
69547
+ //# debugId=9237EEAA0B0D62CA64756E2164756E21
68935
69548
  //# sourceMappingURL=mcp-server.js.map