@shopify/create-app 4.8.5 → 4.9.0

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 (68) hide show
  1. package/dist/analytics-D5P7IMRA.js +48 -0
  2. package/dist/analytics-TXXYVQN7.js +40 -0
  3. package/dist/{chunk-ODCXYGJ2.js → chunk-23UTCSPZ.js} +14 -4
  4. package/dist/{chunk-5JYB62AT.js → chunk-2UPX6QLJ.js} +7 -7
  5. package/dist/{chunk-YGBCHL4K.js → chunk-3IJICKWH.js} +2 -2
  6. package/dist/chunk-5OAATCQX.js +218 -0
  7. package/dist/{chunk-BEUNBVME.js → chunk-A33KVF5C.js} +1 -1
  8. package/dist/{chunk-ZTNEDTAC.js → chunk-AJLJXEKT.js} +3093 -23
  9. package/dist/chunk-BBGOL4JF.js +86 -0
  10. package/dist/chunk-CK3T27VW.js +119 -0
  11. package/dist/{chunk-E43EDJOG.js → chunk-EJEHENXO.js} +3 -2
  12. package/dist/chunk-FKZ3NFHZ.js +7 -0
  13. package/dist/{chunk-TS6YLIAL.js → chunk-KZZE6H5Q.js} +51 -26
  14. package/dist/chunk-MHLFPQ3W.js +50 -0
  15. package/dist/{chunk-JEMOMVLA.js → chunk-MOB6XVGL.js} +2 -2
  16. package/dist/{chunk-GU2TODXD.js → chunk-NB6X7ZFE.js} +3 -3
  17. package/dist/{chunk-SGIGETET.js → chunk-NHN6SUTT.js} +202 -55
  18. package/dist/chunk-NLC4T4YS.js +1092 -0
  19. package/dist/{chunk-PERCCMZB.js → chunk-NW3CCDI2.js} +320 -3213
  20. package/dist/{chunk-4SGOGIHQ.js → chunk-OG3KDO3M.js} +16 -16
  21. package/dist/{chunk-ZKLW7LMH.js → chunk-PSP4NDSB.js} +16 -14
  22. package/dist/{chunk-67ZHQJFJ.js → chunk-QNTXEHZO.js} +5 -5
  23. package/dist/{chunk-B4MEUQZW.js → chunk-RYTPHY47.js} +10 -10
  24. package/dist/{chunk-CPI6XVRV.js → chunk-SFVOZJMO.js} +32 -10
  25. package/dist/chunk-SHCNJ47P.js +89 -0
  26. package/dist/{chunk-F2LFNR26.js → chunk-SYVHC634.js} +2 -2
  27. package/dist/{chunk-C3J4HVUN.js → chunk-VDUAROBQ.js} +3 -2
  28. package/dist/command-json-schema-S3W3UW3A.js +65 -0
  29. package/dist/{conf-store-I2EVFNHO.js → conf-store-GW5MF5EC.js} +11 -11
  30. package/dist/custom-oclif-loader-MYKFWED2.js +85 -0
  31. package/dist/{deprecations-ASHE6RU7.js → deprecations-TJKLSMEC.js} +18 -15
  32. package/dist/environment-OJNKZ7ML.js +25 -0
  33. package/dist/environments-FLXCXEQY.js +32 -0
  34. package/dist/error-handler-KSSGLWAL.js +44 -0
  35. package/dist/{fs-AOTVAHUT.js → fs-54TFRUFV.js} +10 -5
  36. package/dist/hooks/postrun.js +11 -6
  37. package/dist/hooks/prerun.js +6 -6
  38. package/dist/{http-proxy-node16-5LMQ6YXS.js → http-proxy-node16-FD2WN6JB.js} +2 -3
  39. package/dist/index.js +6688 -3623
  40. package/dist/{is-global-2XE72BX5.js → is-global-ABT2AQMZ.js} +10 -5
  41. package/dist/json-error-N7MI3KIX.js +104 -0
  42. package/dist/{lib-XCYUJYSO.js → lib-NYDMHWZM.js} +3 -4
  43. package/dist/{local-VTOHZRT2.js → local-BAVJFTPY.js} +11 -3
  44. package/dist/{metadata-PNCC4F25.js → metadata-JDWMZLO3.js} +10 -4
  45. package/dist/{node-package-manager-WUKOPNFK.js → node-package-manager-LZQDH5RV.js} +20 -17
  46. package/dist/notifications-system-C4VANR5T.js +47 -0
  47. package/dist/os-UYRG46VD.js +24 -0
  48. package/dist/{output-Y2INREX2.js → output-WTBNQLZY.js} +12 -5
  49. package/dist/{path-2WA5R6GG.js → path-2KZ7FSGN.js} +2 -2
  50. package/dist/{prettier-SS3RRDXK.js → prettier-BNZDRHR4.js} +2 -2
  51. package/dist/{system-KPC4GYYQ.js → system-VYWFQ656.js} +18 -15
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/dist/{ui-WQOJ2UKT.js → ui-EW2MACA7.js} +18 -15
  54. package/dist/{upgrade-KCKPO4QT.js → upgrade-TCM7RY33.js} +47 -29
  55. package/dist/{version-ODXTDVIB.js → version-6BXGHP54.js} +2 -2
  56. package/dist/version-ANERG2ID.js +36 -0
  57. package/oclif.manifest.json +15 -1
  58. package/package.json +3 -3
  59. package/dist/analytics-I6PGSH5K.js +0 -44
  60. package/dist/analytics-QHQHZXCP.js +0 -36
  61. package/dist/chunk-2Z5L5TZI.js +0 -301
  62. package/dist/chunk-7OHJH7BF.js +0 -21
  63. package/dist/custom-oclif-loader-HTLL62HO.js +0 -54
  64. package/dist/environments-JM7VKVKQ.js +0 -29
  65. package/dist/error-handler-TUY64CIU.js +0 -40
  66. package/dist/notifications-system-GBBRT4B6.js +0 -43
  67. package/dist/os-J6JGAAOY.js +0 -19
  68. package/dist/version-5242JBZK.js +0 -33
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  setNextDeprecationDate
3
3
  } from "./chunk-MSED5ZFM.js";
4
+ import {
5
+ getPackageManager,
6
+ packageManagerFromUserAgent
7
+ } from "./chunk-RYTPHY47.js";
4
8
  import {
5
9
  CLI_KIT_VERSION
6
- } from "./chunk-YGBCHL4K.js";
10
+ } from "./chunk-3IJICKWH.js";
7
11
  import {
8
12
  FormData,
9
13
  fetch_blob_default,
10
14
  formDataToBlob
11
15
  } from "./chunk-G53O4PDO.js";
12
- import {
13
- getPackageManager,
14
- packageManagerFromUserAgent
15
- } from "./chunk-B4MEUQZW.js";
16
16
  import {
17
17
  Environment,
18
18
  cacheRetrieveOrRepopulate,
@@ -27,7 +27,7 @@ import {
27
27
  setCurrentSessionId,
28
28
  setSessions,
29
29
  timeIntervalToMilliseconds
30
- } from "./chunk-TS6YLIAL.js";
30
+ } from "./chunk-KZZE6H5Q.js";
31
31
  import {
32
32
  isCI,
33
33
  isWsl,
@@ -35,17 +35,25 @@ import {
35
35
  require_baseForOwn,
36
36
  require_stacktracey,
37
37
  sleep
38
- } from "./chunk-SGIGETET.js";
38
+ } from "./chunk-NHN6SUTT.js";
39
39
  import {
40
40
  platformAndArch
41
- } from "./chunk-67ZHQJFJ.js";
41
+ } from "./chunk-QNTXEHZO.js";
42
42
  import {
43
43
  addPublicMetadata,
44
44
  addSensitiveMetadata,
45
45
  getAllPublicMetadata,
46
46
  getAllSensitiveMetadata,
47
47
  runWithTimer
48
- } from "./chunk-GU2TODXD.js";
48
+ } from "./chunk-NB6X7ZFE.js";
49
+ import {
50
+ getAppAutomationToken,
51
+ getIdentityTokenInformation,
52
+ hashString,
53
+ maxRequestTimeForNetworkCallsMs,
54
+ nonRandomUUID,
55
+ skipNetworkLevelRetry
56
+ } from "./chunk-SHCNJ47P.js";
49
57
  import {
50
58
  AbortError,
51
59
  AbortSilentError,
@@ -57,15 +65,14 @@ import {
57
65
  graphQLErrorCodes,
58
66
  handler,
59
67
  hasRateLimitCode,
68
+ isGatewayErrorStatus,
60
69
  isPermissionCode,
61
70
  isRateLimitCode,
62
71
  shouldReportErrorAsUnexpected
63
- } from "./chunk-CPI6XVRV.js";
64
- import {
65
- require_lib
66
- } from "./chunk-E43EDJOG.js";
72
+ } from "./chunk-SFVOZJMO.js";
67
73
  import {
68
74
  currentProcessIsGlobal,
75
+ external_exports,
69
76
  getArrayContainsDuplicates,
70
77
  getArrayRejectingUndefined,
71
78
  inferPackageManagerForGlobalCLI,
@@ -108,36 +115,36 @@ import {
108
115
  slugify,
109
116
  stringifyMessage,
110
117
  uniq
111
- } from "./chunk-ZTNEDTAC.js";
118
+ } from "./chunk-AJLJXEKT.js";
112
119
  import {
113
120
  alwaysLogAnalytics,
114
121
  alwaysLogMetrics,
115
122
  analyticsDisabled,
116
- bugsnagApiKey,
117
123
  ciPlatform,
118
124
  cloudEnvironment,
119
- environmentVariables,
125
+ isInputDisabled,
120
126
  isShopify,
121
127
  isUnitTest,
122
128
  isVerbose,
123
129
  macAddress,
124
130
  opentelemetryDomain,
125
- reportingRateLimit,
126
- sessionConstants,
127
- systemEnvironmentVariables,
128
131
  themeToken
129
- } from "./chunk-2Z5L5TZI.js";
132
+ } from "./chunk-5OAATCQX.js";
130
133
  import {
131
- isTruthy
132
- } from "./chunk-HNIAZN6U.js";
134
+ bugsnagApiKey,
135
+ reportingRateLimit,
136
+ sessionConstants
137
+ } from "./chunk-CK3T27VW.js";
138
+ import {
139
+ require_lib
140
+ } from "./chunk-EJEHENXO.js";
133
141
  import {
134
142
  cwd,
135
143
  isAbsolutePath,
136
144
  joinPath,
137
145
  normalizePath,
138
- relativePath,
139
- sniffForJson
140
- } from "./chunk-C3J4HVUN.js";
146
+ relativePath
147
+ } from "./chunk-VDUAROBQ.js";
141
148
  import {
142
149
  __commonJS,
143
150
  __esm,
@@ -152,12 +159,12 @@ import {
152
159
  var require_delayed_stream = __commonJS({
153
160
  "../../node_modules/.pnpm/delayed-stream@1.0.0/node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
154
161
  init_cjs_shims();
155
- var Stream3 = __require("stream").Stream, util2 = __require("util");
162
+ var Stream3 = __require("stream").Stream, util = __require("util");
156
163
  module2.exports = DelayedStream;
157
164
  function DelayedStream() {
158
165
  this.source = null, this.dataSize = 0, this.maxDataSize = 1024 * 1024, this.pauseStream = !0, this._maxDataSizeExceeded = !1, this._released = !1, this._bufferedEvents = [];
159
166
  }
160
- util2.inherits(DelayedStream, Stream3);
167
+ util.inherits(DelayedStream, Stream3);
161
168
  DelayedStream.create = function(source, options2) {
162
169
  var delayedStream = new this();
163
170
  options2 = options2 || {};
@@ -216,12 +223,12 @@ var require_delayed_stream = __commonJS({
216
223
  var require_combined_stream = __commonJS({
217
224
  "../../node_modules/.pnpm/combined-stream@1.0.8/node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
218
225
  init_cjs_shims();
219
- var util2 = __require("util"), Stream3 = __require("stream").Stream, DelayedStream = require_delayed_stream();
226
+ var util = __require("util"), Stream3 = __require("stream").Stream, DelayedStream = require_delayed_stream();
220
227
  module2.exports = CombinedStream;
221
228
  function CombinedStream() {
222
229
  this.writable = !1, this.readable = !0, this.dataSize = 0, this.maxDataSize = 2 * 1024 * 1024, this.pauseStreams = !0, this._released = !1, this._streams = [], this._currentStream = null, this._insideLoop = !1, this._pendingNext = !1;
223
230
  }
224
- util2.inherits(CombinedStream, Stream3);
231
+ util.inherits(CombinedStream, Stream3);
225
232
  CombinedStream.create = function(options2) {
226
233
  var combinedStream = new this();
227
234
  options2 = options2 || {};
@@ -8949,11 +8956,11 @@ var require_async = __commonJS({
8949
8956
  var defer = require_defer();
8950
8957
  module2.exports = async;
8951
8958
  function async(callback) {
8952
- var isAsync2 = !1;
8959
+ var isAsync = !1;
8953
8960
  return defer(function() {
8954
- isAsync2 = !0;
8961
+ isAsync = !0;
8955
8962
  }), function(err2, result) {
8956
- isAsync2 ? callback(err2, result) : defer(function() {
8963
+ isAsync ? callback(err2, result) : defer(function() {
8957
8964
  callback(err2, result);
8958
8965
  });
8959
8966
  };
@@ -9813,7 +9820,7 @@ var require_form_data = __commonJS({
9813
9820
  "../../node_modules/.pnpm/form-data@4.0.6/node_modules/form-data/lib/form_data.js"(exports2, module2) {
9814
9821
  "use strict";
9815
9822
  init_cjs_shims();
9816
- var CombinedStream = require_combined_stream(), util2 = __require("util"), path = __require("path"), http4 = __require("http"), https4 = __require("https"), parseUrl = __require("url").parse, fs5 = __require("fs"), Stream3 = __require("stream").Stream, crypto2 = __require("crypto"), mime = require_mime_types(), asynckit = require_asynckit(), setToStringTag = require_es_set_tostringtag(), hasOwn = require_hasown(), populate = require_populate();
9823
+ var CombinedStream = require_combined_stream(), util = __require("util"), path = __require("path"), http4 = __require("http"), https4 = __require("https"), parseUrl = __require("url").parse, fs5 = __require("fs"), Stream3 = __require("stream").Stream, crypto = __require("crypto"), mime = require_mime_types(), asynckit = require_asynckit(), setToStringTag = require_es_set_tostringtag(), hasOwn = require_hasown(), populate = require_populate();
9817
9824
  function escapeHeaderParam(str) {
9818
9825
  return String(str).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22");
9819
9826
  }
@@ -9824,7 +9831,7 @@ var require_form_data = __commonJS({
9824
9831
  for (var option in options2)
9825
9832
  this[option] = options2[option];
9826
9833
  }
9827
- util2.inherits(FormData3, CombinedStream);
9834
+ util.inherits(FormData3, CombinedStream);
9828
9835
  FormData3.LINE_BREAK = `\r
9829
9836
  `;
9830
9837
  FormData3.DEFAULT_CONTENT_TYPE = "application/octet-stream";
@@ -9913,7 +9920,7 @@ var require_form_data = __commonJS({
9913
9920
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
9914
9921
  };
9915
9922
  FormData3.prototype._generateBoundary = function() {
9916
- this._boundary = "--------------------------" + crypto2.randomBytes(12).toString("hex");
9923
+ this._boundary = "--------------------------" + crypto.randomBytes(12).toString("hex");
9917
9924
  };
9918
9925
  FormData3.prototype.getLengthSync = function() {
9919
9926
  var knownLength = this._overheadLength + this._valueLength;
@@ -15643,8 +15650,8 @@ var require_definition = __commonJS({
15643
15650
  }
15644
15651
  };
15645
15652
  exports2.GraphQLEnumType = GraphQLEnumType;
15646
- function didYouMeanEnumValue(enumType2, unknownValueStr) {
15647
- let allNames = enumType2.getValues().map((value) => value.name), suggestedValues = (0, _suggestionList.suggestionList)(
15653
+ function didYouMeanEnumValue(enumType, unknownValueStr) {
15654
+ let allNames = enumType.getValues().map((value) => value.name), suggestedValues = (0, _suggestionList.suggestionList)(
15648
15655
  unknownValueStr,
15649
15656
  allNames
15650
15657
  );
@@ -17946,11 +17953,11 @@ var require_validate = __commonJS({
17946
17953
  );
17947
17954
  }
17948
17955
  }
17949
- function validateEnumValues(context2, enumType2) {
17950
- let enumValues = enumType2.getValues();
17956
+ function validateEnumValues(context2, enumType) {
17957
+ let enumValues = enumType.getValues();
17951
17958
  enumValues.length === 0 && context2.reportError(
17952
- `Enum type ${enumType2.name} must define one or more values.`,
17953
- [enumType2.astNode, ...enumType2.extensionASTNodes]
17959
+ `Enum type ${enumType.name} must define one or more values.`,
17960
+ [enumType.astNode, ...enumType.extensionASTNodes]
17954
17961
  );
17955
17962
  for (let enumValue of enumValues)
17956
17963
  validateName(context2, enumValue);
@@ -18561,8 +18568,8 @@ var require_TypeInfo = __commonJS({
18561
18568
  break;
18562
18569
  }
18563
18570
  case _kinds.Kind.OBJECT_FIELD: {
18564
- let objectType2 = (0, _definition.getNamedType)(this.getInputType()), inputFieldType, inputField;
18565
- (0, _definition.isInputObjectType)(objectType2) && (inputField = objectType2.getFields()[node.name.value], inputField && (inputFieldType = inputField.type)), this._defaultValueStack.push(
18571
+ let objectType = (0, _definition.getNamedType)(this.getInputType()), inputFieldType, inputField;
18572
+ (0, _definition.isInputObjectType)(objectType) && (inputField = objectType.getFields()[node.name.value], inputField && (inputFieldType = inputField.type)), this._defaultValueStack.push(
18566
18573
  inputField ? inputField.defaultValue : void 0
18567
18574
  ), this._inputTypeStack.push(
18568
18575
  (0, _definition.isInputType)(inputFieldType) ? inputFieldType : void 0
@@ -18570,8 +18577,8 @@ var require_TypeInfo = __commonJS({
18570
18577
  break;
18571
18578
  }
18572
18579
  case _kinds.Kind.ENUM: {
18573
- let enumType2 = (0, _definition.getNamedType)(this.getInputType()), enumValue;
18574
- (0, _definition.isEnumType)(enumType2) && (enumValue = enumType2.getValue(node.value)), this._enumValue = enumValue;
18580
+ let enumType = (0, _definition.getNamedType)(this.getInputType()), enumValue;
18581
+ (0, _definition.isEnumType)(enumType) && (enumValue = enumType.getValue(node.value)), this._enumValue = enumValue;
18575
18582
  break;
18576
18583
  }
18577
18584
  default:
@@ -24727,9 +24734,9 @@ var require_buildClientSchema = __commonJS({
24727
24734
  let nullableRef = typeRef.ofType;
24728
24735
  if (!nullableRef)
24729
24736
  throw new Error("Decorated type deeper than introspection query.");
24730
- let nullableType2 = getType(nullableRef);
24737
+ let nullableType = getType(nullableRef);
24731
24738
  return new _definition.GraphQLNonNull(
24732
- (0, _definition.assertNullableType)(nullableType2)
24739
+ (0, _definition.assertNullableType)(nullableType)
24733
24740
  );
24734
24741
  }
24735
24742
  return getNamedType(typeRef);
@@ -31469,7 +31476,7 @@ var require_pump = __commonJS({
31469
31476
  var require_byline = __commonJS({
31470
31477
  "../../node_modules/.pnpm/byline@5.0.0/node_modules/byline/lib/byline.js"(exports2, module2) {
31471
31478
  init_cjs_shims();
31472
- var stream = __require("stream"), util2 = __require("util"), timers = __require("timers");
31479
+ var stream = __require("stream"), util = __require("util"), timers = __require("timers");
31473
31480
  module2.exports = function(readStream, options2) {
31474
31481
  return module2.exports.createStream(readStream, options2);
31475
31482
  };
@@ -31495,7 +31502,7 @@ var require_byline = __commonJS({
31495
31502
  self2.encoding || src instanceof stream.Readable && (self2.encoding = src._readableState.encoding);
31496
31503
  });
31497
31504
  }
31498
- util2.inherits(LineStream, stream.Transform);
31505
+ util.inherits(LineStream, stream.Transform);
31499
31506
  LineStream.prototype._transform = function(chunk, encoding, done) {
31500
31507
  encoding = encoding || "utf8", Buffer.isBuffer(chunk) && (encoding == "buffer" ? (chunk = chunk.toString(), encoding = "utf8") : chunk = chunk.toString(encoding)), this._chunkEncoding = encoding;
31501
31508
  var lines = chunk.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
@@ -35077,7 +35084,7 @@ var require_ExponentMapping = __commonJS({
35077
35084
  init_cjs_shims();
35078
35085
  Object.defineProperty(exports2, "__esModule", { value: !0 });
35079
35086
  exports2.ExponentMapping = void 0;
35080
- var ieee754 = require_ieee754(), util2 = require_util(), types_1 = require_types2(), ExponentMapping = class {
35087
+ var ieee754 = require_ieee754(), util = require_util(), types_1 = require_types2(), ExponentMapping = class {
35081
35088
  constructor(scale) {
35082
35089
  this._shift = -scale;
35083
35090
  }
@@ -35105,7 +35112,7 @@ var require_ExponentMapping = __commonJS({
35105
35112
  let maxIndex = this._maxNormalLowerBoundaryIndex();
35106
35113
  if (index > maxIndex)
35107
35114
  throw new types_1.MappingError(`overflow: ${index} is > maximum lower boundary: ${maxIndex}`);
35108
- return util2.ldexp(1, index << this._shift);
35115
+ return util.ldexp(1, index << this._shift);
35109
35116
  }
35110
35117
  /**
35111
35118
  * The scale used by this mapping
@@ -35136,9 +35143,9 @@ var require_LogarithmMapping = __commonJS({
35136
35143
  init_cjs_shims();
35137
35144
  Object.defineProperty(exports2, "__esModule", { value: !0 });
35138
35145
  exports2.LogarithmMapping = void 0;
35139
- var ieee754 = require_ieee754(), util2 = require_util(), types_1 = require_types2(), LogarithmMapping = class {
35146
+ var ieee754 = require_ieee754(), util = require_util(), types_1 = require_types2(), LogarithmMapping = class {
35140
35147
  constructor(scale) {
35141
- this._scale = scale, this._scaleFactor = util2.ldexp(Math.LOG2E, scale), this._inverseFactor = util2.ldexp(Math.LN2, -scale);
35148
+ this._scale = scale, this._scaleFactor = util.ldexp(Math.LOG2E, scale), this._inverseFactor = util.ldexp(Math.LN2, -scale);
35142
35149
  }
35143
35150
  /**
35144
35151
  * Maps positive floating point values to indexes corresponding to scale
@@ -38891,8 +38898,8 @@ var require_execAsync = __commonJS({
38891
38898
  init_cjs_shims();
38892
38899
  Object.defineProperty(exports2, "__esModule", { value: !0 });
38893
38900
  exports2.execAsync = void 0;
38894
- var child_process = __require("child_process"), util2 = __require("util");
38895
- exports2.execAsync = util2.promisify(child_process.exec);
38901
+ var child_process = __require("child_process"), util = __require("util");
38902
+ exports2.execAsync = util.promisify(child_process.exec);
38896
38903
  }
38897
38904
  });
38898
38905
 
@@ -45426,7 +45433,7 @@ var require_ExponentMapping2 = __commonJS({
45426
45433
  init_cjs_shims();
45427
45434
  Object.defineProperty(exports2, "__esModule", { value: !0 });
45428
45435
  exports2.ExponentMapping = void 0;
45429
- var ieee754 = require_ieee7542(), util2 = require_util2(), types_1 = require_types4(), ExponentMapping = class {
45436
+ var ieee754 = require_ieee7542(), util = require_util2(), types_1 = require_types4(), ExponentMapping = class {
45430
45437
  constructor(scale) {
45431
45438
  this._shift = -scale;
45432
45439
  }
@@ -45454,7 +45461,7 @@ var require_ExponentMapping2 = __commonJS({
45454
45461
  let maxIndex = this._maxNormalLowerBoundaryIndex();
45455
45462
  if (index > maxIndex)
45456
45463
  throw new types_1.MappingError(`overflow: ${index} is > maximum lower boundary: ${maxIndex}`);
45457
- return util2.ldexp(1, index << this._shift);
45464
+ return util.ldexp(1, index << this._shift);
45458
45465
  }
45459
45466
  /**
45460
45467
  * The scale used by this mapping
@@ -45485,9 +45492,9 @@ var require_LogarithmMapping2 = __commonJS({
45485
45492
  init_cjs_shims();
45486
45493
  Object.defineProperty(exports2, "__esModule", { value: !0 });
45487
45494
  exports2.LogarithmMapping = void 0;
45488
- var ieee754 = require_ieee7542(), util2 = require_util2(), types_1 = require_types4(), LogarithmMapping = class {
45495
+ var ieee754 = require_ieee7542(), util = require_util2(), types_1 = require_types4(), LogarithmMapping = class {
45489
45496
  constructor(scale) {
45490
- this._scale = scale, this._scaleFactor = util2.ldexp(Math.LOG2E, scale), this._inverseFactor = util2.ldexp(Math.LN2, -scale);
45497
+ this._scale = scale, this._scaleFactor = util.ldexp(Math.LOG2E, scale), this._inverseFactor = util.ldexp(Math.LN2, -scale);
45491
45498
  }
45492
45499
  /**
45493
45500
  * Maps positive floating point values to indexes corresponding to scale
@@ -46589,8 +46596,8 @@ var require_execAsync2 = __commonJS({
46589
46596
  init_cjs_shims();
46590
46597
  Object.defineProperty(exports2, "__esModule", { value: !0 });
46591
46598
  exports2.execAsync = void 0;
46592
- var child_process = __require("child_process"), util2 = __require("util");
46593
- exports2.execAsync = util2.promisify(child_process.exec);
46599
+ var child_process = __require("child_process"), util = __require("util");
46600
+ exports2.execAsync = util.promisify(child_process.exec);
46594
46601
  }
46595
46602
  });
46596
46603
 
@@ -49397,7 +49404,7 @@ var require_longbits = __commonJS({
49397
49404
  "use strict";
49398
49405
  init_cjs_shims();
49399
49406
  module2.exports = LongBits;
49400
- var util2 = require_minimal();
49407
+ var util = require_minimal();
49401
49408
  function LongBits(lo, hi) {
49402
49409
  this.lo = lo >>> 0, this.hi = hi >>> 0;
49403
49410
  }
@@ -49423,9 +49430,9 @@ var require_longbits = __commonJS({
49423
49430
  LongBits.from = function(value) {
49424
49431
  if (typeof value == "number")
49425
49432
  return LongBits.fromNumber(value);
49426
- if (util2.isString(value))
49427
- if (util2.Long)
49428
- value = util2.Long.fromString(value);
49433
+ if (util.isString(value))
49434
+ if (util.Long)
49435
+ value = util.Long.fromString(value);
49429
49436
  else
49430
49437
  return LongBits.fromNumber(parseInt(value, 10));
49431
49438
  return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
@@ -49438,7 +49445,7 @@ var require_longbits = __commonJS({
49438
49445
  return this.lo + this.hi * 4294967296;
49439
49446
  };
49440
49447
  LongBits.prototype.toLong = function(unsigned) {
49441
- return util2.Long ? new util2.Long(this.lo | 0, this.hi | 0, !!unsigned) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!unsigned };
49448
+ return util.Long ? new util.Long(this.lo | 0, this.hi | 0, !!unsigned) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!unsigned };
49442
49449
  };
49443
49450
  var charCodeAt = String.prototype.charCodeAt;
49444
49451
  LongBits.fromHash = function(hash) {
@@ -49479,48 +49486,48 @@ var require_minimal = __commonJS({
49479
49486
  "../../node_modules/.pnpm/protobufjs@7.5.4/node_modules/protobufjs/src/util/minimal.js"(exports2) {
49480
49487
  "use strict";
49481
49488
  init_cjs_shims();
49482
- var util2 = exports2;
49483
- util2.asPromise = require_aspromise();
49484
- util2.base64 = require_base64();
49485
- util2.EventEmitter = require_eventemitter();
49486
- util2.float = require_float();
49487
- util2.inquire = require_inquire();
49488
- util2.utf8 = require_utf8();
49489
- util2.pool = require_pool();
49490
- util2.LongBits = require_longbits();
49491
- util2.isNode = !!(typeof global < "u" && global && global.process && global.process.versions && global.process.versions.node);
49492
- util2.global = util2.isNode && global || typeof window < "u" && window || typeof self < "u" && self || exports2;
49493
- util2.emptyArray = Object.freeze ? Object.freeze([]) : (
49489
+ var util = exports2;
49490
+ util.asPromise = require_aspromise();
49491
+ util.base64 = require_base64();
49492
+ util.EventEmitter = require_eventemitter();
49493
+ util.float = require_float();
49494
+ util.inquire = require_inquire();
49495
+ util.utf8 = require_utf8();
49496
+ util.pool = require_pool();
49497
+ util.LongBits = require_longbits();
49498
+ util.isNode = !!(typeof global < "u" && global && global.process && global.process.versions && global.process.versions.node);
49499
+ util.global = util.isNode && global || typeof window < "u" && window || typeof self < "u" && self || exports2;
49500
+ util.emptyArray = Object.freeze ? Object.freeze([]) : (
49494
49501
  /* istanbul ignore next */
49495
49502
  []
49496
49503
  );
49497
- util2.emptyObject = Object.freeze ? Object.freeze({}) : (
49504
+ util.emptyObject = Object.freeze ? Object.freeze({}) : (
49498
49505
  /* istanbul ignore next */
49499
49506
  {}
49500
49507
  );
49501
- util2.isInteger = Number.isInteger || /* istanbul ignore next */
49508
+ util.isInteger = Number.isInteger || /* istanbul ignore next */
49502
49509
  function(value) {
49503
49510
  return typeof value == "number" && isFinite(value) && Math.floor(value) === value;
49504
49511
  };
49505
- util2.isString = function(value) {
49512
+ util.isString = function(value) {
49506
49513
  return typeof value == "string" || value instanceof String;
49507
49514
  };
49508
- util2.isObject = function(value) {
49515
+ util.isObject = function(value) {
49509
49516
  return value && typeof value == "object";
49510
49517
  };
49511
- util2.isset = /**
49518
+ util.isset = /**
49512
49519
  * Checks if a property on a message is considered to be present.
49513
49520
  * @param {Object} obj Plain object or message instance
49514
49521
  * @param {string} prop Property name
49515
49522
  * @returns {boolean} `true` if considered to be present, otherwise `false`
49516
49523
  */
49517
- util2.isSet = function(obj, prop) {
49524
+ util.isSet = function(obj, prop) {
49518
49525
  var value = obj[prop];
49519
49526
  return value != null && obj.hasOwnProperty(prop) ? typeof value != "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0 : !1;
49520
49527
  };
49521
- util2.Buffer = (function() {
49528
+ util.Buffer = (function() {
49522
49529
  try {
49523
- var Buffer5 = util2.inquire("buffer").Buffer;
49530
+ var Buffer5 = util.inquire("buffer").Buffer;
49524
49531
  return Buffer5.prototype.utf8Write ? Buffer5 : (
49525
49532
  /* istanbul ignore next */
49526
49533
  null
@@ -49529,33 +49536,33 @@ var require_minimal = __commonJS({
49529
49536
  return null;
49530
49537
  }
49531
49538
  })();
49532
- util2._Buffer_from = null;
49533
- util2._Buffer_allocUnsafe = null;
49534
- util2.newBuffer = function(sizeOrArray) {
49535
- return typeof sizeOrArray == "number" ? util2.Buffer ? util2._Buffer_allocUnsafe(sizeOrArray) : new util2.Array(sizeOrArray) : util2.Buffer ? util2._Buffer_from(sizeOrArray) : typeof Uint8Array > "u" ? sizeOrArray : new Uint8Array(sizeOrArray);
49536
- };
49537
- util2.Array = typeof Uint8Array < "u" ? Uint8Array : Array;
49538
- util2.Long = /* istanbul ignore next */
49539
- util2.global.dcodeIO && /* istanbul ignore next */
49540
- util2.global.dcodeIO.Long || /* istanbul ignore next */
49541
- util2.global.Long || util2.inquire("long");
49542
- util2.key2Re = /^true|false|0|1$/;
49543
- util2.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
49544
- util2.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
49545
- util2.longToHash = function(value) {
49546
- return value ? util2.LongBits.from(value).toHash() : util2.LongBits.zeroHash;
49547
- };
49548
- util2.longFromHash = function(hash, unsigned) {
49549
- var bits = util2.LongBits.fromHash(hash);
49550
- return util2.Long ? util2.Long.fromBits(bits.lo, bits.hi, unsigned) : bits.toNumber(!!unsigned);
49539
+ util._Buffer_from = null;
49540
+ util._Buffer_allocUnsafe = null;
49541
+ util.newBuffer = function(sizeOrArray) {
49542
+ return typeof sizeOrArray == "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array > "u" ? sizeOrArray : new Uint8Array(sizeOrArray);
49543
+ };
49544
+ util.Array = typeof Uint8Array < "u" ? Uint8Array : Array;
49545
+ util.Long = /* istanbul ignore next */
49546
+ util.global.dcodeIO && /* istanbul ignore next */
49547
+ util.global.dcodeIO.Long || /* istanbul ignore next */
49548
+ util.global.Long || util.inquire("long");
49549
+ util.key2Re = /^true|false|0|1$/;
49550
+ util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
49551
+ util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
49552
+ util.longToHash = function(value) {
49553
+ return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash;
49554
+ };
49555
+ util.longFromHash = function(hash, unsigned) {
49556
+ var bits = util.LongBits.fromHash(hash);
49557
+ return util.Long ? util.Long.fromBits(bits.lo, bits.hi, unsigned) : bits.toNumber(!!unsigned);
49551
49558
  };
49552
49559
  function merge(dst, src, ifNotSet) {
49553
49560
  for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
49554
49561
  (dst[keys[i]] === void 0 || !ifNotSet) && (dst[keys[i]] = src[keys[i]]);
49555
49562
  return dst;
49556
49563
  }
49557
- util2.merge = merge;
49558
- util2.lcFirst = function(str) {
49564
+ util.merge = merge;
49565
+ util.lcFirst = function(str) {
49559
49566
  return str.charAt(0).toLowerCase() + str.substring(1);
49560
49567
  };
49561
49568
  function newError(name) {
@@ -49595,9 +49602,9 @@ var require_minimal = __commonJS({
49595
49602
  }
49596
49603
  }), CustomError;
49597
49604
  }
49598
- util2.newError = newError;
49599
- util2.ProtocolError = newError("ProtocolError");
49600
- util2.oneOfGetter = function(fieldNames) {
49605
+ util.newError = newError;
49606
+ util.ProtocolError = newError("ProtocolError");
49607
+ util.oneOfGetter = function(fieldNames) {
49601
49608
  for (var fieldMap = {}, i = 0; i < fieldNames.length; ++i)
49602
49609
  fieldMap[fieldNames[i]] = 1;
49603
49610
  return function() {
@@ -49606,28 +49613,28 @@ var require_minimal = __commonJS({
49606
49613
  return keys[i2];
49607
49614
  };
49608
49615
  };
49609
- util2.oneOfSetter = function(fieldNames) {
49616
+ util.oneOfSetter = function(fieldNames) {
49610
49617
  return function(name) {
49611
49618
  for (var i = 0; i < fieldNames.length; ++i)
49612
49619
  fieldNames[i] !== name && delete this[fieldNames[i]];
49613
49620
  };
49614
49621
  };
49615
- util2.toJSONOptions = {
49622
+ util.toJSONOptions = {
49616
49623
  longs: String,
49617
49624
  enums: String,
49618
49625
  bytes: String,
49619
49626
  json: !0
49620
49627
  };
49621
- util2._configure = function() {
49622
- var Buffer5 = util2.Buffer;
49628
+ util._configure = function() {
49629
+ var Buffer5 = util.Buffer;
49623
49630
  if (!Buffer5) {
49624
- util2._Buffer_from = util2._Buffer_allocUnsafe = null;
49631
+ util._Buffer_from = util._Buffer_allocUnsafe = null;
49625
49632
  return;
49626
49633
  }
49627
- util2._Buffer_from = Buffer5.from !== Uint8Array.from && Buffer5.from || /* istanbul ignore next */
49634
+ util._Buffer_from = Buffer5.from !== Uint8Array.from && Buffer5.from || /* istanbul ignore next */
49628
49635
  function(value, encoding) {
49629
49636
  return new Buffer5(value, encoding);
49630
- }, util2._Buffer_allocUnsafe = Buffer5.allocUnsafe || /* istanbul ignore next */
49637
+ }, util._Buffer_allocUnsafe = Buffer5.allocUnsafe || /* istanbul ignore next */
49631
49638
  function(size) {
49632
49639
  return new Buffer5(size);
49633
49640
  };
@@ -49641,7 +49648,7 @@ var require_writer = __commonJS({
49641
49648
  "use strict";
49642
49649
  init_cjs_shims();
49643
49650
  module2.exports = Writer;
49644
- var util2 = require_minimal(), BufferWriter, LongBits = util2.LongBits, base64 = util2.base64, utf8 = util2.utf8;
49651
+ var util = require_minimal(), BufferWriter, LongBits = util.LongBits, base64 = util.base64, utf8 = util.utf8;
49645
49652
  function Op(fn, len, val) {
49646
49653
  this.fn = fn, this.len = len, this.next = void 0, this.val = val;
49647
49654
  }
@@ -49654,7 +49661,7 @@ var require_writer = __commonJS({
49654
49661
  this.len = 0, this.head = new Op(noop, 0, 0), this.tail = this.head, this.states = null;
49655
49662
  }
49656
49663
  var create = function() {
49657
- return util2.Buffer ? function() {
49664
+ return util.Buffer ? function() {
49658
49665
  return (Writer.create = function() {
49659
49666
  return new BufferWriter();
49660
49667
  })();
@@ -49664,9 +49671,9 @@ var require_writer = __commonJS({
49664
49671
  };
49665
49672
  Writer.create = create();
49666
49673
  Writer.alloc = function(size) {
49667
- return new util2.Array(size);
49674
+ return new util.Array(size);
49668
49675
  };
49669
- util2.Array !== Array && (Writer.alloc = util2.pool(Writer.alloc, util2.Array.prototype.subarray));
49676
+ util.Array !== Array && (Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray));
49670
49677
  Writer.prototype._push = function(fn, len, val) {
49671
49678
  return this.tail = this.tail.next = new Op(fn, len, val), this.len += len, this;
49672
49679
  };
@@ -49727,12 +49734,12 @@ var require_writer = __commonJS({
49727
49734
  };
49728
49735
  Writer.prototype.sfixed64 = Writer.prototype.fixed64;
49729
49736
  Writer.prototype.float = function(value) {
49730
- return this._push(util2.float.writeFloatLE, 4, value);
49737
+ return this._push(util.float.writeFloatLE, 4, value);
49731
49738
  };
49732
49739
  Writer.prototype.double = function(value) {
49733
- return this._push(util2.float.writeDoubleLE, 8, value);
49740
+ return this._push(util.float.writeDoubleLE, 8, value);
49734
49741
  };
49735
- var writeBytes = util2.Array.prototype.set ? function(val, buf, pos) {
49742
+ var writeBytes = util.Array.prototype.set ? function(val, buf, pos) {
49736
49743
  buf.set(val, pos);
49737
49744
  } : function(val, buf, pos) {
49738
49745
  for (var i = 0; i < val.length; ++i)
@@ -49742,7 +49749,7 @@ var require_writer = __commonJS({
49742
49749
  var len = value.length >>> 0;
49743
49750
  if (!len)
49744
49751
  return this._push(writeByte, 1, 0);
49745
- if (util2.isString(value)) {
49752
+ if (util.isString(value)) {
49746
49753
  var buf = Writer.alloc(len = base64.length(value));
49747
49754
  base64.decode(value, buf, 0), value = buf;
49748
49755
  }
@@ -49781,12 +49788,12 @@ var require_writer_buffer = __commonJS({
49781
49788
  module2.exports = BufferWriter;
49782
49789
  var Writer = require_writer();
49783
49790
  (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
49784
- var util2 = require_minimal();
49791
+ var util = require_minimal();
49785
49792
  function BufferWriter() {
49786
49793
  Writer.call(this);
49787
49794
  }
49788
49795
  BufferWriter._configure = function() {
49789
- BufferWriter.alloc = util2._Buffer_allocUnsafe, BufferWriter.writeBytesBuffer = util2.Buffer && util2.Buffer.prototype instanceof Uint8Array && util2.Buffer.prototype.set.name === "set" ? function(val, buf, pos) {
49796
+ BufferWriter.alloc = util._Buffer_allocUnsafe, BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" ? function(val, buf, pos) {
49790
49797
  buf.set(val, pos);
49791
49798
  } : function(val, buf, pos) {
49792
49799
  if (val.copy)
@@ -49796,15 +49803,15 @@ var require_writer_buffer = __commonJS({
49796
49803
  };
49797
49804
  };
49798
49805
  BufferWriter.prototype.bytes = function(value) {
49799
- util2.isString(value) && (value = util2._Buffer_from(value, "base64"));
49806
+ util.isString(value) && (value = util._Buffer_from(value, "base64"));
49800
49807
  var len = value.length >>> 0;
49801
49808
  return this.uint32(len), len && this._push(BufferWriter.writeBytesBuffer, len, value), this;
49802
49809
  };
49803
49810
  function writeStringBuffer(val, buf, pos) {
49804
- val.length < 40 ? util2.utf8.write(val, buf, pos) : buf.utf8Write ? buf.utf8Write(val, pos) : buf.write(val, pos);
49811
+ val.length < 40 ? util.utf8.write(val, buf, pos) : buf.utf8Write ? buf.utf8Write(val, pos) : buf.write(val, pos);
49805
49812
  }
49806
49813
  BufferWriter.prototype.string = function(value) {
49807
- var len = util2.Buffer.byteLength(value);
49814
+ var len = util.Buffer.byteLength(value);
49808
49815
  return this.uint32(len), len && this._push(writeStringBuffer, len, value), this;
49809
49816
  };
49810
49817
  BufferWriter._configure();
@@ -49817,7 +49824,7 @@ var require_reader = __commonJS({
49817
49824
  "use strict";
49818
49825
  init_cjs_shims();
49819
49826
  module2.exports = Reader;
49820
- var util2 = require_minimal(), BufferReader, LongBits = util2.LongBits, utf8 = util2.utf8;
49827
+ var util = require_minimal(), BufferReader, LongBits = util.LongBits, utf8 = util.utf8;
49821
49828
  function indexOutOfRange(reader, writeLength) {
49822
49829
  return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
49823
49830
  }
@@ -49833,15 +49840,15 @@ var require_reader = __commonJS({
49833
49840
  return new Reader(buffer);
49834
49841
  throw Error("illegal buffer");
49835
49842
  }, create = function() {
49836
- return util2.Buffer ? function(buffer) {
49843
+ return util.Buffer ? function(buffer) {
49837
49844
  return (Reader.create = function(buffer2) {
49838
- return util2.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2);
49845
+ return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2);
49839
49846
  })(buffer);
49840
49847
  } : create_array;
49841
49848
  };
49842
49849
  Reader.create = create();
49843
- Reader.prototype._slice = util2.Array.prototype.subarray || /* istanbul ignore next */
49844
- util2.Array.prototype.slice;
49850
+ Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */
49851
+ util.Array.prototype.slice;
49845
49852
  Reader.prototype.uint32 = /* @__PURE__ */ (function() {
49846
49853
  var value = 4294967295;
49847
49854
  return function() {
@@ -49913,13 +49920,13 @@ var require_reader = __commonJS({
49913
49920
  Reader.prototype.float = function() {
49914
49921
  if (this.pos + 4 > this.len)
49915
49922
  throw indexOutOfRange(this, 4);
49916
- var value = util2.float.readFloatLE(this.buf, this.pos);
49923
+ var value = util.float.readFloatLE(this.buf, this.pos);
49917
49924
  return this.pos += 4, value;
49918
49925
  };
49919
49926
  Reader.prototype.double = function() {
49920
49927
  if (this.pos + 8 > this.len)
49921
49928
  throw indexOutOfRange(this, 4);
49922
- var value = util2.float.readDoubleLE(this.buf, this.pos);
49929
+ var value = util.float.readDoubleLE(this.buf, this.pos);
49923
49930
  return this.pos += 8, value;
49924
49931
  };
49925
49932
  Reader.prototype.bytes = function() {
@@ -49929,7 +49936,7 @@ var require_reader = __commonJS({
49929
49936
  if (this.pos += length, Array.isArray(this.buf))
49930
49937
  return this.buf.slice(start, end);
49931
49938
  if (start === end) {
49932
- var nativeBuffer = util2.Buffer;
49939
+ var nativeBuffer = util.Buffer;
49933
49940
  return nativeBuffer ? nativeBuffer.alloc(0) : new this.buf.constructor(0);
49934
49941
  }
49935
49942
  return this._slice.call(this.buf, start, end);
@@ -49976,11 +49983,11 @@ var require_reader = __commonJS({
49976
49983
  };
49977
49984
  Reader._configure = function(BufferReader_) {
49978
49985
  BufferReader = BufferReader_, Reader.create = create(), BufferReader._configure();
49979
- var fn = util2.Long ? "toLong" : (
49986
+ var fn = util.Long ? "toLong" : (
49980
49987
  /* istanbul ignore next */
49981
49988
  "toNumber"
49982
49989
  );
49983
- util2.merge(Reader.prototype, {
49990
+ util.merge(Reader.prototype, {
49984
49991
  int64: function() {
49985
49992
  return readLongVarint.call(this)[fn](!1);
49986
49993
  },
@@ -50009,12 +50016,12 @@ var require_reader_buffer = __commonJS({
50009
50016
  module2.exports = BufferReader;
50010
50017
  var Reader = require_reader();
50011
50018
  (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
50012
- var util2 = require_minimal();
50019
+ var util = require_minimal();
50013
50020
  function BufferReader(buffer) {
50014
50021
  Reader.call(this, buffer);
50015
50022
  }
50016
50023
  BufferReader._configure = function() {
50017
- util2.Buffer && (BufferReader.prototype._slice = util2.Buffer.prototype.slice);
50024
+ util.Buffer && (BufferReader.prototype._slice = util.Buffer.prototype.slice);
50018
50025
  };
50019
50026
  BufferReader.prototype.string = function() {
50020
50027
  var len = this.uint32();
@@ -50030,19 +50037,19 @@ var require_service = __commonJS({
50030
50037
  "use strict";
50031
50038
  init_cjs_shims();
50032
50039
  module2.exports = Service;
50033
- var util2 = require_minimal();
50034
- (Service.prototype = Object.create(util2.EventEmitter.prototype)).constructor = Service;
50040
+ var util = require_minimal();
50041
+ (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
50035
50042
  function Service(rpcImpl, requestDelimited, responseDelimited) {
50036
50043
  if (typeof rpcImpl != "function")
50037
50044
  throw TypeError("rpcImpl must be a function");
50038
- util2.EventEmitter.call(this), this.rpcImpl = rpcImpl, this.requestDelimited = !!requestDelimited, this.responseDelimited = !!responseDelimited;
50045
+ util.EventEmitter.call(this), this.rpcImpl = rpcImpl, this.requestDelimited = !!requestDelimited, this.responseDelimited = !!responseDelimited;
50039
50046
  }
50040
50047
  Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request3, callback) {
50041
50048
  if (!request3)
50042
50049
  throw TypeError("request must be specified");
50043
50050
  var self2 = this;
50044
50051
  if (!callback)
50045
- return util2.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request3);
50052
+ return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request3);
50046
50053
  if (!self2.rpcImpl) {
50047
50054
  setTimeout(function() {
50048
50055
  callback(Error("already ended"));
@@ -59161,6 +59168,84 @@ var require_lib4 = __commonJS({
59161
59168
  }
59162
59169
  });
59163
59170
 
59171
+ // ../../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js
59172
+ var require_dist = __commonJS({
59173
+ "../../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js"(exports2, module2) {
59174
+ "use strict";
59175
+ init_cjs_shims();
59176
+ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __hasOwnProp = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
59177
+ for (var name in all)
59178
+ __defProp(target, name, { get: all[name], enumerable: !0 });
59179
+ }, __copyProps = (to, from, except, desc) => {
59180
+ if (from && typeof from == "object" || typeof from == "function")
59181
+ for (let key of __getOwnPropNames(from))
59182
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
59183
+ return to;
59184
+ }, __toCommonJS2 = (mod2) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod2), src_exports = {};
59185
+ __export2(src_exports, {
59186
+ KNOWN_AGENTS: () => KNOWN_AGENTS2,
59187
+ determineAgent: () => determineAgent2
59188
+ });
59189
+ module2.exports = __toCommonJS2(src_exports);
59190
+ var import_promises2 = __require("node:fs/promises"), import_node_fs4 = __require("node:fs"), DEVIN_LOCAL_PATH = "/opt/.devin", CURSOR = "cursor", CURSOR_CLI = "cursor-cli", CLAUDE = "claude", COWORK = "cowork", DEVIN = "devin", REPLIT = "replit", GEMINI = "gemini", CODEX = "codex", ANTIGRAVITY = "antigravity", AUGMENT_CLI = "augment-cli", OPENCODE = "opencode", GITHUB_COPILOT = "github-copilot", GITHUB_COPILOT_CLI = "github-copilot-cli", V0 = "v0", KNOWN_AGENTS2 = {
59191
+ CURSOR,
59192
+ CURSOR_CLI,
59193
+ CLAUDE,
59194
+ COWORK,
59195
+ DEVIN,
59196
+ REPLIT,
59197
+ GEMINI,
59198
+ CODEX,
59199
+ ANTIGRAVITY,
59200
+ AUGMENT_CLI,
59201
+ OPENCODE,
59202
+ GITHUB_COPILOT,
59203
+ V0
59204
+ };
59205
+ async function determineAgent2() {
59206
+ if (process.env.AI_AGENT) {
59207
+ let name = process.env.AI_AGENT.trim();
59208
+ if (name)
59209
+ return name === GITHUB_COPILOT || name === GITHUB_COPILOT_CLI ? {
59210
+ isAgent: !0,
59211
+ agent: { name: GITHUB_COPILOT }
59212
+ } : name === V0 ? {
59213
+ isAgent: !0,
59214
+ agent: { name: V0 }
59215
+ } : {
59216
+ isAgent: !0,
59217
+ agent: { name }
59218
+ };
59219
+ }
59220
+ if (process.env.CURSOR_TRACE_ID)
59221
+ return { isAgent: !0, agent: { name: CURSOR } };
59222
+ if (process.env.CURSOR_AGENT || process.env.CURSOR_EXTENSION_HOST_ROLE === "agent-exec")
59223
+ return { isAgent: !0, agent: { name: CURSOR_CLI } };
59224
+ if (process.env.GEMINI_CLI)
59225
+ return { isAgent: !0, agent: { name: GEMINI } };
59226
+ if (process.env.CODEX_SANDBOX || process.env.CODEX_CI || process.env.CODEX_THREAD_ID)
59227
+ return { isAgent: !0, agent: { name: CODEX } };
59228
+ if (process.env.ANTIGRAVITY_AGENT)
59229
+ return { isAgent: !0, agent: { name: ANTIGRAVITY } };
59230
+ if (process.env.AUGMENT_AGENT)
59231
+ return { isAgent: !0, agent: { name: AUGMENT_CLI } };
59232
+ if (process.env.OPENCODE_CLIENT)
59233
+ return { isAgent: !0, agent: { name: OPENCODE } };
59234
+ if (process.env.CLAUDECODE || process.env.CLAUDE_CODE)
59235
+ return process.env.CLAUDE_CODE_IS_COWORK ? { isAgent: !0, agent: { name: COWORK } } : { isAgent: !0, agent: { name: CLAUDE } };
59236
+ if (process.env.REPL_ID)
59237
+ return { isAgent: !0, agent: { name: REPLIT } };
59238
+ if (process.env.COPILOT_MODEL || process.env.COPILOT_ALLOW_ALL || process.env.COPILOT_GITHUB_TOKEN)
59239
+ return { isAgent: !0, agent: { name: GITHUB_COPILOT } };
59240
+ try {
59241
+ return await (0, import_promises2.access)(DEVIN_LOCAL_PATH, import_node_fs4.constants.F_OK), { isAgent: !0, agent: { name: DEVIN } };
59242
+ } catch {
59243
+ }
59244
+ return { isAgent: !1, agent: void 0 };
59245
+ }
59246
+ }
59247
+ });
59248
+
59164
59249
  // ../cli-kit/dist/private/node/analytics.js
59165
59250
  init_cjs_shims();
59166
59251
 
@@ -59203,2965 +59288,6 @@ init_cjs_shims();
59203
59288
 
59204
59289
  // ../cli-kit/dist/private/node/session/schema.js
59205
59290
  init_cjs_shims();
59206
-
59207
- // ../cli-kit/dist/public/node/schema.js
59208
- init_cjs_shims();
59209
-
59210
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js
59211
- init_cjs_shims();
59212
-
59213
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
59214
- var external_exports = {};
59215
- __export(external_exports, {
59216
- BRAND: () => BRAND,
59217
- DIRTY: () => DIRTY,
59218
- EMPTY_PATH: () => EMPTY_PATH,
59219
- INVALID: () => INVALID,
59220
- NEVER: () => NEVER,
59221
- OK: () => OK,
59222
- ParseStatus: () => ParseStatus,
59223
- Schema: () => ZodType,
59224
- ZodAny: () => ZodAny,
59225
- ZodArray: () => ZodArray,
59226
- ZodBigInt: () => ZodBigInt,
59227
- ZodBoolean: () => ZodBoolean,
59228
- ZodBranded: () => ZodBranded,
59229
- ZodCatch: () => ZodCatch,
59230
- ZodDate: () => ZodDate,
59231
- ZodDefault: () => ZodDefault,
59232
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
59233
- ZodEffects: () => ZodEffects,
59234
- ZodEnum: () => ZodEnum,
59235
- ZodError: () => ZodError,
59236
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
59237
- ZodFunction: () => ZodFunction,
59238
- ZodIntersection: () => ZodIntersection,
59239
- ZodIssueCode: () => ZodIssueCode,
59240
- ZodLazy: () => ZodLazy,
59241
- ZodLiteral: () => ZodLiteral,
59242
- ZodMap: () => ZodMap,
59243
- ZodNaN: () => ZodNaN,
59244
- ZodNativeEnum: () => ZodNativeEnum,
59245
- ZodNever: () => ZodNever,
59246
- ZodNull: () => ZodNull,
59247
- ZodNullable: () => ZodNullable,
59248
- ZodNumber: () => ZodNumber,
59249
- ZodObject: () => ZodObject,
59250
- ZodOptional: () => ZodOptional,
59251
- ZodParsedType: () => ZodParsedType,
59252
- ZodPipeline: () => ZodPipeline,
59253
- ZodPromise: () => ZodPromise,
59254
- ZodReadonly: () => ZodReadonly,
59255
- ZodRecord: () => ZodRecord,
59256
- ZodSchema: () => ZodType,
59257
- ZodSet: () => ZodSet,
59258
- ZodString: () => ZodString,
59259
- ZodSymbol: () => ZodSymbol,
59260
- ZodTransformer: () => ZodEffects,
59261
- ZodTuple: () => ZodTuple,
59262
- ZodType: () => ZodType,
59263
- ZodUndefined: () => ZodUndefined,
59264
- ZodUnion: () => ZodUnion,
59265
- ZodUnknown: () => ZodUnknown,
59266
- ZodVoid: () => ZodVoid,
59267
- addIssueToContext: () => addIssueToContext,
59268
- any: () => anyType,
59269
- array: () => arrayType,
59270
- bigint: () => bigIntType,
59271
- boolean: () => booleanType,
59272
- coerce: () => coerce,
59273
- custom: () => custom,
59274
- date: () => dateType,
59275
- datetimeRegex: () => datetimeRegex,
59276
- defaultErrorMap: () => en_default,
59277
- discriminatedUnion: () => discriminatedUnionType,
59278
- effect: () => effectsType,
59279
- enum: () => enumType,
59280
- function: () => functionType,
59281
- getErrorMap: () => getErrorMap,
59282
- getParsedType: () => getParsedType,
59283
- instanceof: () => instanceOfType,
59284
- intersection: () => intersectionType,
59285
- isAborted: () => isAborted,
59286
- isAsync: () => isAsync,
59287
- isDirty: () => isDirty,
59288
- isValid: () => isValid,
59289
- late: () => late,
59290
- lazy: () => lazyType,
59291
- literal: () => literalType,
59292
- makeIssue: () => makeIssue,
59293
- map: () => mapType,
59294
- nan: () => nanType,
59295
- nativeEnum: () => nativeEnumType,
59296
- never: () => neverType,
59297
- null: () => nullType,
59298
- nullable: () => nullableType,
59299
- number: () => numberType,
59300
- object: () => objectType,
59301
- objectUtil: () => objectUtil,
59302
- oboolean: () => oboolean,
59303
- onumber: () => onumber,
59304
- optional: () => optionalType,
59305
- ostring: () => ostring,
59306
- pipeline: () => pipelineType,
59307
- preprocess: () => preprocessType,
59308
- promise: () => promiseType,
59309
- quotelessJson: () => quotelessJson,
59310
- record: () => recordType,
59311
- set: () => setType,
59312
- setErrorMap: () => setErrorMap,
59313
- strictObject: () => strictObjectType,
59314
- string: () => stringType,
59315
- symbol: () => symbolType,
59316
- transformer: () => effectsType,
59317
- tuple: () => tupleType,
59318
- undefined: () => undefinedType,
59319
- union: () => unionType,
59320
- unknown: () => unknownType,
59321
- util: () => util,
59322
- void: () => voidType
59323
- });
59324
- init_cjs_shims();
59325
-
59326
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
59327
- init_cjs_shims();
59328
-
59329
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
59330
- init_cjs_shims();
59331
-
59332
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
59333
- init_cjs_shims();
59334
-
59335
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
59336
- init_cjs_shims();
59337
- var util;
59338
- (function(util2) {
59339
- util2.assertEqual = (_) => {
59340
- };
59341
- function assertIs(_arg) {
59342
- }
59343
- util2.assertIs = assertIs;
59344
- function assertNever(_x) {
59345
- throw new Error();
59346
- }
59347
- util2.assertNever = assertNever, util2.arrayToEnum = (items) => {
59348
- let obj = {};
59349
- for (let item of items)
59350
- obj[item] = item;
59351
- return obj;
59352
- }, util2.getValidEnumValues = (obj) => {
59353
- let validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] != "number"), filtered = {};
59354
- for (let k of validKeys)
59355
- filtered[k] = obj[k];
59356
- return util2.objectValues(filtered);
59357
- }, util2.objectValues = (obj) => util2.objectKeys(obj).map(function(e) {
59358
- return obj[e];
59359
- }), util2.objectKeys = typeof Object.keys == "function" ? (obj) => Object.keys(obj) : (object) => {
59360
- let keys = [];
59361
- for (let key in object)
59362
- Object.prototype.hasOwnProperty.call(object, key) && keys.push(key);
59363
- return keys;
59364
- }, util2.find = (arr, checker) => {
59365
- for (let item of arr)
59366
- if (checker(item))
59367
- return item;
59368
- }, util2.isInteger = typeof Number.isInteger == "function" ? (val) => Number.isInteger(val) : (val) => typeof val == "number" && Number.isFinite(val) && Math.floor(val) === val;
59369
- function joinValues(array, separator = " | ") {
59370
- return array.map((val) => typeof val == "string" ? `'${val}'` : val).join(separator);
59371
- }
59372
- util2.joinValues = joinValues, util2.jsonStringifyReplacer = (_, value) => typeof value == "bigint" ? value.toString() : value;
59373
- })(util || (util = {}));
59374
- var objectUtil;
59375
- (function(objectUtil2) {
59376
- objectUtil2.mergeShapes = (first, second) => ({
59377
- ...first,
59378
- ...second
59379
- // second overwrites first
59380
- });
59381
- })(objectUtil || (objectUtil = {}));
59382
- var ZodParsedType = util.arrayToEnum([
59383
- "string",
59384
- "nan",
59385
- "number",
59386
- "integer",
59387
- "float",
59388
- "boolean",
59389
- "date",
59390
- "bigint",
59391
- "symbol",
59392
- "function",
59393
- "undefined",
59394
- "null",
59395
- "array",
59396
- "object",
59397
- "unknown",
59398
- "promise",
59399
- "void",
59400
- "never",
59401
- "map",
59402
- "set"
59403
- ]), getParsedType = (data) => {
59404
- switch (typeof data) {
59405
- case "undefined":
59406
- return ZodParsedType.undefined;
59407
- case "string":
59408
- return ZodParsedType.string;
59409
- case "number":
59410
- return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
59411
- case "boolean":
59412
- return ZodParsedType.boolean;
59413
- case "function":
59414
- return ZodParsedType.function;
59415
- case "bigint":
59416
- return ZodParsedType.bigint;
59417
- case "symbol":
59418
- return ZodParsedType.symbol;
59419
- case "object":
59420
- return Array.isArray(data) ? ZodParsedType.array : data === null ? ZodParsedType.null : data.then && typeof data.then == "function" && data.catch && typeof data.catch == "function" ? ZodParsedType.promise : typeof Map < "u" && data instanceof Map ? ZodParsedType.map : typeof Set < "u" && data instanceof Set ? ZodParsedType.set : typeof Date < "u" && data instanceof Date ? ZodParsedType.date : ZodParsedType.object;
59421
- default:
59422
- return ZodParsedType.unknown;
59423
- }
59424
- };
59425
-
59426
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
59427
- var ZodIssueCode = util.arrayToEnum([
59428
- "invalid_type",
59429
- "invalid_literal",
59430
- "custom",
59431
- "invalid_union",
59432
- "invalid_union_discriminator",
59433
- "invalid_enum_value",
59434
- "unrecognized_keys",
59435
- "invalid_arguments",
59436
- "invalid_return_type",
59437
- "invalid_date",
59438
- "invalid_string",
59439
- "too_small",
59440
- "too_big",
59441
- "invalid_intersection_types",
59442
- "not_multiple_of",
59443
- "not_finite"
59444
- ]), quotelessJson = (obj) => JSON.stringify(obj, null, 2).replace(/"([^"]+)":/g, "$1:"), ZodError = class _ZodError extends Error {
59445
- get errors() {
59446
- return this.issues;
59447
- }
59448
- constructor(issues) {
59449
- super(), this.issues = [], this.addIssue = (sub) => {
59450
- this.issues = [...this.issues, sub];
59451
- }, this.addIssues = (subs = []) => {
59452
- this.issues = [...this.issues, ...subs];
59453
- };
59454
- let actualProto = new.target.prototype;
59455
- Object.setPrototypeOf ? Object.setPrototypeOf(this, actualProto) : this.__proto__ = actualProto, this.name = "ZodError", this.issues = issues;
59456
- }
59457
- format(_mapper) {
59458
- let mapper = _mapper || function(issue) {
59459
- return issue.message;
59460
- }, fieldErrors = { _errors: [] }, processError = (error) => {
59461
- for (let issue of error.issues)
59462
- if (issue.code === "invalid_union")
59463
- issue.unionErrors.map(processError);
59464
- else if (issue.code === "invalid_return_type")
59465
- processError(issue.returnTypeError);
59466
- else if (issue.code === "invalid_arguments")
59467
- processError(issue.argumentsError);
59468
- else if (issue.path.length === 0)
59469
- fieldErrors._errors.push(mapper(issue));
59470
- else {
59471
- let curr = fieldErrors, i = 0;
59472
- for (; i < issue.path.length; ) {
59473
- let el = issue.path[i];
59474
- i === issue.path.length - 1 ? (curr[el] = curr[el] || { _errors: [] }, curr[el]._errors.push(mapper(issue))) : curr[el] = curr[el] || { _errors: [] }, curr = curr[el], i++;
59475
- }
59476
- }
59477
- };
59478
- return processError(this), fieldErrors;
59479
- }
59480
- static assert(value) {
59481
- if (!(value instanceof _ZodError))
59482
- throw new Error(`Not a ZodError: ${value}`);
59483
- }
59484
- toString() {
59485
- return this.message;
59486
- }
59487
- get message() {
59488
- return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
59489
- }
59490
- get isEmpty() {
59491
- return this.issues.length === 0;
59492
- }
59493
- flatten(mapper = (issue) => issue.message) {
59494
- let fieldErrors = {}, formErrors = [];
59495
- for (let sub of this.issues)
59496
- if (sub.path.length > 0) {
59497
- let firstEl = sub.path[0];
59498
- fieldErrors[firstEl] = fieldErrors[firstEl] || [], fieldErrors[firstEl].push(mapper(sub));
59499
- } else
59500
- formErrors.push(mapper(sub));
59501
- return { formErrors, fieldErrors };
59502
- }
59503
- get formErrors() {
59504
- return this.flatten();
59505
- }
59506
- };
59507
- ZodError.create = (issues) => new ZodError(issues);
59508
-
59509
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
59510
- var errorMap = (issue, _ctx) => {
59511
- let message;
59512
- switch (issue.code) {
59513
- case ZodIssueCode.invalid_type:
59514
- issue.received === ZodParsedType.undefined ? message = "Required" : message = `Expected ${issue.expected}, received ${issue.received}`;
59515
- break;
59516
- case ZodIssueCode.invalid_literal:
59517
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
59518
- break;
59519
- case ZodIssueCode.unrecognized_keys:
59520
- message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
59521
- break;
59522
- case ZodIssueCode.invalid_union:
59523
- message = "Invalid input";
59524
- break;
59525
- case ZodIssueCode.invalid_union_discriminator:
59526
- message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
59527
- break;
59528
- case ZodIssueCode.invalid_enum_value:
59529
- message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
59530
- break;
59531
- case ZodIssueCode.invalid_arguments:
59532
- message = "Invalid function arguments";
59533
- break;
59534
- case ZodIssueCode.invalid_return_type:
59535
- message = "Invalid function return type";
59536
- break;
59537
- case ZodIssueCode.invalid_date:
59538
- message = "Invalid date";
59539
- break;
59540
- case ZodIssueCode.invalid_string:
59541
- typeof issue.validation == "object" ? "includes" in issue.validation ? (message = `Invalid input: must include "${issue.validation.includes}"`, typeof issue.validation.position == "number" && (message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`)) : "startsWith" in issue.validation ? message = `Invalid input: must start with "${issue.validation.startsWith}"` : "endsWith" in issue.validation ? message = `Invalid input: must end with "${issue.validation.endsWith}"` : util.assertNever(issue.validation) : issue.validation !== "regex" ? message = `Invalid ${issue.validation}` : message = "Invalid";
59542
- break;
59543
- case ZodIssueCode.too_small:
59544
- issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"} ${issue.minimum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "over"} ${issue.minimum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "bigint" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(issue.minimum))}` : message = "Invalid input";
59545
- break;
59546
- case ZodIssueCode.too_big:
59547
- issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "less than"} ${issue.maximum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "under"} ${issue.maximum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "bigint" ? message = `BigInt must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly" : issue.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(issue.maximum))}` : message = "Invalid input";
59548
- break;
59549
- case ZodIssueCode.custom:
59550
- message = "Invalid input";
59551
- break;
59552
- case ZodIssueCode.invalid_intersection_types:
59553
- message = "Intersection results could not be merged";
59554
- break;
59555
- case ZodIssueCode.not_multiple_of:
59556
- message = `Number must be a multiple of ${issue.multipleOf}`;
59557
- break;
59558
- case ZodIssueCode.not_finite:
59559
- message = "Number must be finite";
59560
- break;
59561
- default:
59562
- message = _ctx.defaultError, util.assertNever(issue);
59563
- }
59564
- return { message };
59565
- }, en_default = errorMap;
59566
-
59567
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
59568
- var overrideErrorMap = en_default;
59569
- function setErrorMap(map) {
59570
- overrideErrorMap = map;
59571
- }
59572
- function getErrorMap() {
59573
- return overrideErrorMap;
59574
- }
59575
-
59576
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
59577
- init_cjs_shims();
59578
- var makeIssue = (params) => {
59579
- let { data, path, errorMaps, issueData } = params, fullPath = [...path, ...issueData.path || []], fullIssue = {
59580
- ...issueData,
59581
- path: fullPath
59582
- };
59583
- if (issueData.message !== void 0)
59584
- return {
59585
- ...issueData,
59586
- path: fullPath,
59587
- message: issueData.message
59588
- };
59589
- let errorMessage2 = "", maps = errorMaps.filter((m) => !!m).slice().reverse();
59590
- for (let map of maps)
59591
- errorMessage2 = map(fullIssue, { data, defaultError: errorMessage2 }).message;
59592
- return {
59593
- ...issueData,
59594
- path: fullPath,
59595
- message: errorMessage2
59596
- };
59597
- }, EMPTY_PATH = [];
59598
- function addIssueToContext(ctx, issueData) {
59599
- let overrideMap = getErrorMap(), issue = makeIssue({
59600
- issueData,
59601
- data: ctx.data,
59602
- path: ctx.path,
59603
- errorMaps: [
59604
- ctx.common.contextualErrorMap,
59605
- // contextual error map is first priority
59606
- ctx.schemaErrorMap,
59607
- // then schema-bound map if available
59608
- overrideMap,
59609
- // then global override map
59610
- overrideMap === en_default ? void 0 : en_default
59611
- // then global default map
59612
- ].filter((x) => !!x)
59613
- });
59614
- ctx.common.issues.push(issue);
59615
- }
59616
- var ParseStatus = class _ParseStatus {
59617
- constructor() {
59618
- this.value = "valid";
59619
- }
59620
- dirty() {
59621
- this.value === "valid" && (this.value = "dirty");
59622
- }
59623
- abort() {
59624
- this.value !== "aborted" && (this.value = "aborted");
59625
- }
59626
- static mergeArray(status, results) {
59627
- let arrayValue = [];
59628
- for (let s of results) {
59629
- if (s.status === "aborted")
59630
- return INVALID;
59631
- s.status === "dirty" && status.dirty(), arrayValue.push(s.value);
59632
- }
59633
- return { status: status.value, value: arrayValue };
59634
- }
59635
- static async mergeObjectAsync(status, pairs) {
59636
- let syncPairs = [];
59637
- for (let pair of pairs) {
59638
- let key = await pair.key, value = await pair.value;
59639
- syncPairs.push({
59640
- key,
59641
- value
59642
- });
59643
- }
59644
- return _ParseStatus.mergeObjectSync(status, syncPairs);
59645
- }
59646
- static mergeObjectSync(status, pairs) {
59647
- let finalObject = {};
59648
- for (let pair of pairs) {
59649
- let { key, value } = pair;
59650
- if (key.status === "aborted" || value.status === "aborted")
59651
- return INVALID;
59652
- key.status === "dirty" && status.dirty(), value.status === "dirty" && status.dirty(), key.value !== "__proto__" && (typeof value.value < "u" || pair.alwaysSet) && (finalObject[key.value] = value.value);
59653
- }
59654
- return { status: status.value, value: finalObject };
59655
- }
59656
- }, INVALID = Object.freeze({
59657
- status: "aborted"
59658
- }), DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise < "u" && x instanceof Promise;
59659
-
59660
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
59661
- init_cjs_shims();
59662
-
59663
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
59664
- init_cjs_shims();
59665
- var errorUtil;
59666
- (function(errorUtil2) {
59667
- errorUtil2.errToObj = (message) => typeof message == "string" ? { message } : message || {}, errorUtil2.toString = (message) => typeof message == "string" ? message : message?.message;
59668
- })(errorUtil || (errorUtil = {}));
59669
-
59670
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
59671
- var ParseInputLazyPath = class {
59672
- constructor(parent, value, path, key) {
59673
- this._cachedPath = [], this.parent = parent, this.data = value, this._path = path, this._key = key;
59674
- }
59675
- get path() {
59676
- return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
59677
- }
59678
- }, handleResult = (ctx, result) => {
59679
- if (isValid(result))
59680
- return { success: !0, data: result.value };
59681
- if (!ctx.common.issues.length)
59682
- throw new Error("Validation failed but no issues detected.");
59683
- return {
59684
- success: !1,
59685
- get error() {
59686
- if (this._error)
59687
- return this._error;
59688
- let error = new ZodError(ctx.common.issues);
59689
- return this._error = error, this._error;
59690
- }
59691
- };
59692
- };
59693
- function processCreateParams(params) {
59694
- if (!params)
59695
- return {};
59696
- let { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
59697
- if (errorMap2 && (invalid_type_error || required_error))
59698
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
59699
- return errorMap2 ? { errorMap: errorMap2, description } : { errorMap: (iss, ctx) => {
59700
- let { message } = params;
59701
- return iss.code === "invalid_enum_value" ? { message: message ?? ctx.defaultError } : typeof ctx.data > "u" ? { message: message ?? required_error ?? ctx.defaultError } : iss.code !== "invalid_type" ? { message: ctx.defaultError } : { message: message ?? invalid_type_error ?? ctx.defaultError };
59702
- }, description };
59703
- }
59704
- var ZodType = class {
59705
- get description() {
59706
- return this._def.description;
59707
- }
59708
- _getType(input) {
59709
- return getParsedType(input.data);
59710
- }
59711
- _getOrReturnCtx(input, ctx) {
59712
- return ctx || {
59713
- common: input.parent.common,
59714
- data: input.data,
59715
- parsedType: getParsedType(input.data),
59716
- schemaErrorMap: this._def.errorMap,
59717
- path: input.path,
59718
- parent: input.parent
59719
- };
59720
- }
59721
- _processInputParams(input) {
59722
- return {
59723
- status: new ParseStatus(),
59724
- ctx: {
59725
- common: input.parent.common,
59726
- data: input.data,
59727
- parsedType: getParsedType(input.data),
59728
- schemaErrorMap: this._def.errorMap,
59729
- path: input.path,
59730
- parent: input.parent
59731
- }
59732
- };
59733
- }
59734
- _parseSync(input) {
59735
- let result = this._parse(input);
59736
- if (isAsync(result))
59737
- throw new Error("Synchronous parse encountered promise.");
59738
- return result;
59739
- }
59740
- _parseAsync(input) {
59741
- let result = this._parse(input);
59742
- return Promise.resolve(result);
59743
- }
59744
- parse(data, params) {
59745
- let result = this.safeParse(data, params);
59746
- if (result.success)
59747
- return result.data;
59748
- throw result.error;
59749
- }
59750
- safeParse(data, params) {
59751
- let ctx = {
59752
- common: {
59753
- issues: [],
59754
- async: params?.async ?? !1,
59755
- contextualErrorMap: params?.errorMap
59756
- },
59757
- path: params?.path || [],
59758
- schemaErrorMap: this._def.errorMap,
59759
- parent: null,
59760
- data,
59761
- parsedType: getParsedType(data)
59762
- }, result = this._parseSync({ data, path: ctx.path, parent: ctx });
59763
- return handleResult(ctx, result);
59764
- }
59765
- "~validate"(data) {
59766
- let ctx = {
59767
- common: {
59768
- issues: [],
59769
- async: !!this["~standard"].async
59770
- },
59771
- path: [],
59772
- schemaErrorMap: this._def.errorMap,
59773
- parent: null,
59774
- data,
59775
- parsedType: getParsedType(data)
59776
- };
59777
- if (!this["~standard"].async)
59778
- try {
59779
- let result = this._parseSync({ data, path: [], parent: ctx });
59780
- return isValid(result) ? {
59781
- value: result.value
59782
- } : {
59783
- issues: ctx.common.issues
59784
- };
59785
- } catch (err2) {
59786
- err2?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), ctx.common = {
59787
- issues: [],
59788
- async: !0
59789
- };
59790
- }
59791
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
59792
- value: result.value
59793
- } : {
59794
- issues: ctx.common.issues
59795
- });
59796
- }
59797
- async parseAsync(data, params) {
59798
- let result = await this.safeParseAsync(data, params);
59799
- if (result.success)
59800
- return result.data;
59801
- throw result.error;
59802
- }
59803
- async safeParseAsync(data, params) {
59804
- let ctx = {
59805
- common: {
59806
- issues: [],
59807
- contextualErrorMap: params?.errorMap,
59808
- async: !0
59809
- },
59810
- path: params?.path || [],
59811
- schemaErrorMap: this._def.errorMap,
59812
- parent: null,
59813
- data,
59814
- parsedType: getParsedType(data)
59815
- }, maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }), result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
59816
- return handleResult(ctx, result);
59817
- }
59818
- refine(check, message) {
59819
- let getIssueProperties = (val) => typeof message == "string" || typeof message > "u" ? { message } : typeof message == "function" ? message(val) : message;
59820
- return this._refinement((val, ctx) => {
59821
- let result = check(val), setError = () => ctx.addIssue({
59822
- code: ZodIssueCode.custom,
59823
- ...getIssueProperties(val)
59824
- });
59825
- return typeof Promise < "u" && result instanceof Promise ? result.then((data) => data ? !0 : (setError(), !1)) : result ? !0 : (setError(), !1);
59826
- });
59827
- }
59828
- refinement(check, refinementData) {
59829
- return this._refinement((val, ctx) => check(val) ? !0 : (ctx.addIssue(typeof refinementData == "function" ? refinementData(val, ctx) : refinementData), !1));
59830
- }
59831
- _refinement(refinement) {
59832
- return new ZodEffects({
59833
- schema: this,
59834
- typeName: ZodFirstPartyTypeKind.ZodEffects,
59835
- effect: { type: "refinement", refinement }
59836
- });
59837
- }
59838
- superRefine(refinement) {
59839
- return this._refinement(refinement);
59840
- }
59841
- constructor(def) {
59842
- this.spa = this.safeParseAsync, this._def = def, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
59843
- version: 1,
59844
- vendor: "zod",
59845
- validate: (data) => this["~validate"](data)
59846
- };
59847
- }
59848
- optional() {
59849
- return ZodOptional.create(this, this._def);
59850
- }
59851
- nullable() {
59852
- return ZodNullable.create(this, this._def);
59853
- }
59854
- nullish() {
59855
- return this.nullable().optional();
59856
- }
59857
- array() {
59858
- return ZodArray.create(this);
59859
- }
59860
- promise() {
59861
- return ZodPromise.create(this, this._def);
59862
- }
59863
- or(option) {
59864
- return ZodUnion.create([this, option], this._def);
59865
- }
59866
- and(incoming) {
59867
- return ZodIntersection.create(this, incoming, this._def);
59868
- }
59869
- transform(transform) {
59870
- return new ZodEffects({
59871
- ...processCreateParams(this._def),
59872
- schema: this,
59873
- typeName: ZodFirstPartyTypeKind.ZodEffects,
59874
- effect: { type: "transform", transform }
59875
- });
59876
- }
59877
- default(def) {
59878
- let defaultValueFunc = typeof def == "function" ? def : () => def;
59879
- return new ZodDefault({
59880
- ...processCreateParams(this._def),
59881
- innerType: this,
59882
- defaultValue: defaultValueFunc,
59883
- typeName: ZodFirstPartyTypeKind.ZodDefault
59884
- });
59885
- }
59886
- brand() {
59887
- return new ZodBranded({
59888
- typeName: ZodFirstPartyTypeKind.ZodBranded,
59889
- type: this,
59890
- ...processCreateParams(this._def)
59891
- });
59892
- }
59893
- catch(def) {
59894
- let catchValueFunc = typeof def == "function" ? def : () => def;
59895
- return new ZodCatch({
59896
- ...processCreateParams(this._def),
59897
- innerType: this,
59898
- catchValue: catchValueFunc,
59899
- typeName: ZodFirstPartyTypeKind.ZodCatch
59900
- });
59901
- }
59902
- describe(description) {
59903
- let This = this.constructor;
59904
- return new This({
59905
- ...this._def,
59906
- description
59907
- });
59908
- }
59909
- pipe(target) {
59910
- return ZodPipeline.create(this, target);
59911
- }
59912
- readonly() {
59913
- return ZodReadonly.create(this);
59914
- }
59915
- isOptional() {
59916
- return this.safeParse(void 0).success;
59917
- }
59918
- isNullable() {
59919
- return this.safeParse(null).success;
59920
- }
59921
- }, cuidRegex = /^c[^\s-]{8,}$/i, cuid2Regex = /^[0-9a-z]+$/, ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i, uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, nanoidRegex = /^[a-z0-9_-]{21}$/i, jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _emojiRegex = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", emojiRegex, ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, dateRegexSource = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", dateRegex = new RegExp(`^${dateRegexSource}$`);
59922
- function timeRegexSource(args) {
59923
- let secondsRegexSource = "[0-5]\\d";
59924
- args.precision ? secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}` : args.precision == null && (secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`);
59925
- let secondsQuantifier = args.precision ? "+" : "?";
59926
- return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
59927
- }
59928
- function timeRegex(args) {
59929
- return new RegExp(`^${timeRegexSource(args)}$`);
59930
- }
59931
- function datetimeRegex(args) {
59932
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`, opts = [];
59933
- return opts.push(args.local ? "Z?" : "Z"), args.offset && opts.push("([+-]\\d{2}:?\\d{2})"), regex = `${regex}(${opts.join("|")})`, new RegExp(`^${regex}$`);
59934
- }
59935
- function isValidIP(ip, version) {
59936
- return !!((version === "v4" || !version) && ipv4Regex.test(ip) || (version === "v6" || !version) && ipv6Regex.test(ip));
59937
- }
59938
- function isValidJWT(jwt, alg) {
59939
- if (!jwtRegex.test(jwt))
59940
- return !1;
59941
- try {
59942
- let [header] = jwt.split(".");
59943
- if (!header)
59944
- return !1;
59945
- let base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "="), decoded = JSON.parse(atob(base64));
59946
- return !(typeof decoded != "object" || decoded === null || "typ" in decoded && decoded?.typ !== "JWT" || !decoded.alg || alg && decoded.alg !== alg);
59947
- } catch {
59948
- return !1;
59949
- }
59950
- }
59951
- function isValidCidr(ip, version) {
59952
- return !!((version === "v4" || !version) && ipv4CidrRegex.test(ip) || (version === "v6" || !version) && ipv6CidrRegex.test(ip));
59953
- }
59954
- var ZodString = class _ZodString extends ZodType {
59955
- _parse(input) {
59956
- if (this._def.coerce && (input.data = String(input.data)), this._getType(input) !== ZodParsedType.string) {
59957
- let ctx2 = this._getOrReturnCtx(input);
59958
- return addIssueToContext(ctx2, {
59959
- code: ZodIssueCode.invalid_type,
59960
- expected: ZodParsedType.string,
59961
- received: ctx2.parsedType
59962
- }), INVALID;
59963
- }
59964
- let status = new ParseStatus(), ctx;
59965
- for (let check of this._def.checks)
59966
- if (check.kind === "min")
59967
- input.data.length < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
59968
- code: ZodIssueCode.too_small,
59969
- minimum: check.value,
59970
- type: "string",
59971
- inclusive: !0,
59972
- exact: !1,
59973
- message: check.message
59974
- }), status.dirty());
59975
- else if (check.kind === "max")
59976
- input.data.length > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
59977
- code: ZodIssueCode.too_big,
59978
- maximum: check.value,
59979
- type: "string",
59980
- inclusive: !0,
59981
- exact: !1,
59982
- message: check.message
59983
- }), status.dirty());
59984
- else if (check.kind === "length") {
59985
- let tooBig = input.data.length > check.value, tooSmall = input.data.length < check.value;
59986
- (tooBig || tooSmall) && (ctx = this._getOrReturnCtx(input, ctx), tooBig ? addIssueToContext(ctx, {
59987
- code: ZodIssueCode.too_big,
59988
- maximum: check.value,
59989
- type: "string",
59990
- inclusive: !0,
59991
- exact: !0,
59992
- message: check.message
59993
- }) : tooSmall && addIssueToContext(ctx, {
59994
- code: ZodIssueCode.too_small,
59995
- minimum: check.value,
59996
- type: "string",
59997
- inclusive: !0,
59998
- exact: !0,
59999
- message: check.message
60000
- }), status.dirty());
60001
- } else if (check.kind === "email")
60002
- emailRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60003
- validation: "email",
60004
- code: ZodIssueCode.invalid_string,
60005
- message: check.message
60006
- }), status.dirty());
60007
- else if (check.kind === "emoji")
60008
- emojiRegex || (emojiRegex = new RegExp(_emojiRegex, "u")), emojiRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60009
- validation: "emoji",
60010
- code: ZodIssueCode.invalid_string,
60011
- message: check.message
60012
- }), status.dirty());
60013
- else if (check.kind === "uuid")
60014
- uuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60015
- validation: "uuid",
60016
- code: ZodIssueCode.invalid_string,
60017
- message: check.message
60018
- }), status.dirty());
60019
- else if (check.kind === "nanoid")
60020
- nanoidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60021
- validation: "nanoid",
60022
- code: ZodIssueCode.invalid_string,
60023
- message: check.message
60024
- }), status.dirty());
60025
- else if (check.kind === "cuid")
60026
- cuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60027
- validation: "cuid",
60028
- code: ZodIssueCode.invalid_string,
60029
- message: check.message
60030
- }), status.dirty());
60031
- else if (check.kind === "cuid2")
60032
- cuid2Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60033
- validation: "cuid2",
60034
- code: ZodIssueCode.invalid_string,
60035
- message: check.message
60036
- }), status.dirty());
60037
- else if (check.kind === "ulid")
60038
- ulidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60039
- validation: "ulid",
60040
- code: ZodIssueCode.invalid_string,
60041
- message: check.message
60042
- }), status.dirty());
60043
- else if (check.kind === "url")
60044
- try {
60045
- new URL(input.data);
60046
- } catch {
60047
- ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60048
- validation: "url",
60049
- code: ZodIssueCode.invalid_string,
60050
- message: check.message
60051
- }), status.dirty();
60052
- }
60053
- else check.kind === "regex" ? (check.regex.lastIndex = 0, check.regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60054
- validation: "regex",
60055
- code: ZodIssueCode.invalid_string,
60056
- message: check.message
60057
- }), status.dirty())) : check.kind === "trim" ? input.data = input.data.trim() : check.kind === "includes" ? input.data.includes(check.value, check.position) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60058
- code: ZodIssueCode.invalid_string,
60059
- validation: { includes: check.value, position: check.position },
60060
- message: check.message
60061
- }), status.dirty()) : check.kind === "toLowerCase" ? input.data = input.data.toLowerCase() : check.kind === "toUpperCase" ? input.data = input.data.toUpperCase() : check.kind === "startsWith" ? input.data.startsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60062
- code: ZodIssueCode.invalid_string,
60063
- validation: { startsWith: check.value },
60064
- message: check.message
60065
- }), status.dirty()) : check.kind === "endsWith" ? input.data.endsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60066
- code: ZodIssueCode.invalid_string,
60067
- validation: { endsWith: check.value },
60068
- message: check.message
60069
- }), status.dirty()) : check.kind === "datetime" ? datetimeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60070
- code: ZodIssueCode.invalid_string,
60071
- validation: "datetime",
60072
- message: check.message
60073
- }), status.dirty()) : check.kind === "date" ? dateRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60074
- code: ZodIssueCode.invalid_string,
60075
- validation: "date",
60076
- message: check.message
60077
- }), status.dirty()) : check.kind === "time" ? timeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60078
- code: ZodIssueCode.invalid_string,
60079
- validation: "time",
60080
- message: check.message
60081
- }), status.dirty()) : check.kind === "duration" ? durationRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60082
- validation: "duration",
60083
- code: ZodIssueCode.invalid_string,
60084
- message: check.message
60085
- }), status.dirty()) : check.kind === "ip" ? isValidIP(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60086
- validation: "ip",
60087
- code: ZodIssueCode.invalid_string,
60088
- message: check.message
60089
- }), status.dirty()) : check.kind === "jwt" ? isValidJWT(input.data, check.alg) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60090
- validation: "jwt",
60091
- code: ZodIssueCode.invalid_string,
60092
- message: check.message
60093
- }), status.dirty()) : check.kind === "cidr" ? isValidCidr(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60094
- validation: "cidr",
60095
- code: ZodIssueCode.invalid_string,
60096
- message: check.message
60097
- }), status.dirty()) : check.kind === "base64" ? base64Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60098
- validation: "base64",
60099
- code: ZodIssueCode.invalid_string,
60100
- message: check.message
60101
- }), status.dirty()) : check.kind === "base64url" ? base64urlRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60102
- validation: "base64url",
60103
- code: ZodIssueCode.invalid_string,
60104
- message: check.message
60105
- }), status.dirty()) : util.assertNever(check);
60106
- return { status: status.value, value: input.data };
60107
- }
60108
- _regex(regex, validation, message) {
60109
- return this.refinement((data) => regex.test(data), {
60110
- validation,
60111
- code: ZodIssueCode.invalid_string,
60112
- ...errorUtil.errToObj(message)
60113
- });
60114
- }
60115
- _addCheck(check) {
60116
- return new _ZodString({
60117
- ...this._def,
60118
- checks: [...this._def.checks, check]
60119
- });
60120
- }
60121
- email(message) {
60122
- return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
60123
- }
60124
- url(message) {
60125
- return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
60126
- }
60127
- emoji(message) {
60128
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
60129
- }
60130
- uuid(message) {
60131
- return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
60132
- }
60133
- nanoid(message) {
60134
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
60135
- }
60136
- cuid(message) {
60137
- return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
60138
- }
60139
- cuid2(message) {
60140
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
60141
- }
60142
- ulid(message) {
60143
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
60144
- }
60145
- base64(message) {
60146
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
60147
- }
60148
- base64url(message) {
60149
- return this._addCheck({
60150
- kind: "base64url",
60151
- ...errorUtil.errToObj(message)
60152
- });
60153
- }
60154
- jwt(options2) {
60155
- return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options2) });
60156
- }
60157
- ip(options2) {
60158
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options2) });
60159
- }
60160
- cidr(options2) {
60161
- return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options2) });
60162
- }
60163
- datetime(options2) {
60164
- return typeof options2 == "string" ? this._addCheck({
60165
- kind: "datetime",
60166
- precision: null,
60167
- offset: !1,
60168
- local: !1,
60169
- message: options2
60170
- }) : this._addCheck({
60171
- kind: "datetime",
60172
- precision: typeof options2?.precision > "u" ? null : options2?.precision,
60173
- offset: options2?.offset ?? !1,
60174
- local: options2?.local ?? !1,
60175
- ...errorUtil.errToObj(options2?.message)
60176
- });
60177
- }
60178
- date(message) {
60179
- return this._addCheck({ kind: "date", message });
60180
- }
60181
- time(options2) {
60182
- return typeof options2 == "string" ? this._addCheck({
60183
- kind: "time",
60184
- precision: null,
60185
- message: options2
60186
- }) : this._addCheck({
60187
- kind: "time",
60188
- precision: typeof options2?.precision > "u" ? null : options2?.precision,
60189
- ...errorUtil.errToObj(options2?.message)
60190
- });
60191
- }
60192
- duration(message) {
60193
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
60194
- }
60195
- regex(regex, message) {
60196
- return this._addCheck({
60197
- kind: "regex",
60198
- regex,
60199
- ...errorUtil.errToObj(message)
60200
- });
60201
- }
60202
- includes(value, options2) {
60203
- return this._addCheck({
60204
- kind: "includes",
60205
- value,
60206
- position: options2?.position,
60207
- ...errorUtil.errToObj(options2?.message)
60208
- });
60209
- }
60210
- startsWith(value, message) {
60211
- return this._addCheck({
60212
- kind: "startsWith",
60213
- value,
60214
- ...errorUtil.errToObj(message)
60215
- });
60216
- }
60217
- endsWith(value, message) {
60218
- return this._addCheck({
60219
- kind: "endsWith",
60220
- value,
60221
- ...errorUtil.errToObj(message)
60222
- });
60223
- }
60224
- min(minLength, message) {
60225
- return this._addCheck({
60226
- kind: "min",
60227
- value: minLength,
60228
- ...errorUtil.errToObj(message)
60229
- });
60230
- }
60231
- max(maxLength, message) {
60232
- return this._addCheck({
60233
- kind: "max",
60234
- value: maxLength,
60235
- ...errorUtil.errToObj(message)
60236
- });
60237
- }
60238
- length(len, message) {
60239
- return this._addCheck({
60240
- kind: "length",
60241
- value: len,
60242
- ...errorUtil.errToObj(message)
60243
- });
60244
- }
60245
- /**
60246
- * Equivalent to `.min(1)`
60247
- */
60248
- nonempty(message) {
60249
- return this.min(1, errorUtil.errToObj(message));
60250
- }
60251
- trim() {
60252
- return new _ZodString({
60253
- ...this._def,
60254
- checks: [...this._def.checks, { kind: "trim" }]
60255
- });
60256
- }
60257
- toLowerCase() {
60258
- return new _ZodString({
60259
- ...this._def,
60260
- checks: [...this._def.checks, { kind: "toLowerCase" }]
60261
- });
60262
- }
60263
- toUpperCase() {
60264
- return new _ZodString({
60265
- ...this._def,
60266
- checks: [...this._def.checks, { kind: "toUpperCase" }]
60267
- });
60268
- }
60269
- get isDatetime() {
60270
- return !!this._def.checks.find((ch) => ch.kind === "datetime");
60271
- }
60272
- get isDate() {
60273
- return !!this._def.checks.find((ch) => ch.kind === "date");
60274
- }
60275
- get isTime() {
60276
- return !!this._def.checks.find((ch) => ch.kind === "time");
60277
- }
60278
- get isDuration() {
60279
- return !!this._def.checks.find((ch) => ch.kind === "duration");
60280
- }
60281
- get isEmail() {
60282
- return !!this._def.checks.find((ch) => ch.kind === "email");
60283
- }
60284
- get isURL() {
60285
- return !!this._def.checks.find((ch) => ch.kind === "url");
60286
- }
60287
- get isEmoji() {
60288
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
60289
- }
60290
- get isUUID() {
60291
- return !!this._def.checks.find((ch) => ch.kind === "uuid");
60292
- }
60293
- get isNANOID() {
60294
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
60295
- }
60296
- get isCUID() {
60297
- return !!this._def.checks.find((ch) => ch.kind === "cuid");
60298
- }
60299
- get isCUID2() {
60300
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
60301
- }
60302
- get isULID() {
60303
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
60304
- }
60305
- get isIP() {
60306
- return !!this._def.checks.find((ch) => ch.kind === "ip");
60307
- }
60308
- get isCIDR() {
60309
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
60310
- }
60311
- get isBase64() {
60312
- return !!this._def.checks.find((ch) => ch.kind === "base64");
60313
- }
60314
- get isBase64url() {
60315
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
60316
- }
60317
- get minLength() {
60318
- let min = null;
60319
- for (let ch of this._def.checks)
60320
- ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
60321
- return min;
60322
- }
60323
- get maxLength() {
60324
- let max = null;
60325
- for (let ch of this._def.checks)
60326
- ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
60327
- return max;
60328
- }
60329
- };
60330
- ZodString.create = (params) => new ZodString({
60331
- checks: [],
60332
- typeName: ZodFirstPartyTypeKind.ZodString,
60333
- coerce: params?.coerce ?? !1,
60334
- ...processCreateParams(params)
60335
- });
60336
- function floatSafeRemainder(val, step) {
60337
- let valDecCount = (val.toString().split(".")[1] || "").length, stepDecCount = (step.toString().split(".")[1] || "").length, decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount, valInt = Number.parseInt(val.toFixed(decCount).replace(".", "")), stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
60338
- return valInt % stepInt / 10 ** decCount;
60339
- }
60340
- var ZodNumber = class _ZodNumber extends ZodType {
60341
- constructor() {
60342
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
60343
- }
60344
- _parse(input) {
60345
- if (this._def.coerce && (input.data = Number(input.data)), this._getType(input) !== ZodParsedType.number) {
60346
- let ctx2 = this._getOrReturnCtx(input);
60347
- return addIssueToContext(ctx2, {
60348
- code: ZodIssueCode.invalid_type,
60349
- expected: ZodParsedType.number,
60350
- received: ctx2.parsedType
60351
- }), INVALID;
60352
- }
60353
- let ctx, status = new ParseStatus();
60354
- for (let check of this._def.checks)
60355
- check.kind === "int" ? util.isInteger(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60356
- code: ZodIssueCode.invalid_type,
60357
- expected: "integer",
60358
- received: "float",
60359
- message: check.message
60360
- }), status.dirty()) : check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60361
- code: ZodIssueCode.too_small,
60362
- minimum: check.value,
60363
- type: "number",
60364
- inclusive: check.inclusive,
60365
- exact: !1,
60366
- message: check.message
60367
- }), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60368
- code: ZodIssueCode.too_big,
60369
- maximum: check.value,
60370
- type: "number",
60371
- inclusive: check.inclusive,
60372
- exact: !1,
60373
- message: check.message
60374
- }), status.dirty()) : check.kind === "multipleOf" ? floatSafeRemainder(input.data, check.value) !== 0 && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60375
- code: ZodIssueCode.not_multiple_of,
60376
- multipleOf: check.value,
60377
- message: check.message
60378
- }), status.dirty()) : check.kind === "finite" ? Number.isFinite(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60379
- code: ZodIssueCode.not_finite,
60380
- message: check.message
60381
- }), status.dirty()) : util.assertNever(check);
60382
- return { status: status.value, value: input.data };
60383
- }
60384
- gte(value, message) {
60385
- return this.setLimit("min", value, !0, errorUtil.toString(message));
60386
- }
60387
- gt(value, message) {
60388
- return this.setLimit("min", value, !1, errorUtil.toString(message));
60389
- }
60390
- lte(value, message) {
60391
- return this.setLimit("max", value, !0, errorUtil.toString(message));
60392
- }
60393
- lt(value, message) {
60394
- return this.setLimit("max", value, !1, errorUtil.toString(message));
60395
- }
60396
- setLimit(kind, value, inclusive, message) {
60397
- return new _ZodNumber({
60398
- ...this._def,
60399
- checks: [
60400
- ...this._def.checks,
60401
- {
60402
- kind,
60403
- value,
60404
- inclusive,
60405
- message: errorUtil.toString(message)
60406
- }
60407
- ]
60408
- });
60409
- }
60410
- _addCheck(check) {
60411
- return new _ZodNumber({
60412
- ...this._def,
60413
- checks: [...this._def.checks, check]
60414
- });
60415
- }
60416
- int(message) {
60417
- return this._addCheck({
60418
- kind: "int",
60419
- message: errorUtil.toString(message)
60420
- });
60421
- }
60422
- positive(message) {
60423
- return this._addCheck({
60424
- kind: "min",
60425
- value: 0,
60426
- inclusive: !1,
60427
- message: errorUtil.toString(message)
60428
- });
60429
- }
60430
- negative(message) {
60431
- return this._addCheck({
60432
- kind: "max",
60433
- value: 0,
60434
- inclusive: !1,
60435
- message: errorUtil.toString(message)
60436
- });
60437
- }
60438
- nonpositive(message) {
60439
- return this._addCheck({
60440
- kind: "max",
60441
- value: 0,
60442
- inclusive: !0,
60443
- message: errorUtil.toString(message)
60444
- });
60445
- }
60446
- nonnegative(message) {
60447
- return this._addCheck({
60448
- kind: "min",
60449
- value: 0,
60450
- inclusive: !0,
60451
- message: errorUtil.toString(message)
60452
- });
60453
- }
60454
- multipleOf(value, message) {
60455
- return this._addCheck({
60456
- kind: "multipleOf",
60457
- value,
60458
- message: errorUtil.toString(message)
60459
- });
60460
- }
60461
- finite(message) {
60462
- return this._addCheck({
60463
- kind: "finite",
60464
- message: errorUtil.toString(message)
60465
- });
60466
- }
60467
- safe(message) {
60468
- return this._addCheck({
60469
- kind: "min",
60470
- inclusive: !0,
60471
- value: Number.MIN_SAFE_INTEGER,
60472
- message: errorUtil.toString(message)
60473
- })._addCheck({
60474
- kind: "max",
60475
- inclusive: !0,
60476
- value: Number.MAX_SAFE_INTEGER,
60477
- message: errorUtil.toString(message)
60478
- });
60479
- }
60480
- get minValue() {
60481
- let min = null;
60482
- for (let ch of this._def.checks)
60483
- ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
60484
- return min;
60485
- }
60486
- get maxValue() {
60487
- let max = null;
60488
- for (let ch of this._def.checks)
60489
- ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
60490
- return max;
60491
- }
60492
- get isInt() {
60493
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
60494
- }
60495
- get isFinite() {
60496
- let max = null, min = null;
60497
- for (let ch of this._def.checks) {
60498
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf")
60499
- return !0;
60500
- ch.kind === "min" ? (min === null || ch.value > min) && (min = ch.value) : ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
60501
- }
60502
- return Number.isFinite(min) && Number.isFinite(max);
60503
- }
60504
- };
60505
- ZodNumber.create = (params) => new ZodNumber({
60506
- checks: [],
60507
- typeName: ZodFirstPartyTypeKind.ZodNumber,
60508
- coerce: params?.coerce || !1,
60509
- ...processCreateParams(params)
60510
- });
60511
- var ZodBigInt = class _ZodBigInt extends ZodType {
60512
- constructor() {
60513
- super(...arguments), this.min = this.gte, this.max = this.lte;
60514
- }
60515
- _parse(input) {
60516
- if (this._def.coerce)
60517
- try {
60518
- input.data = BigInt(input.data);
60519
- } catch {
60520
- return this._getInvalidInput(input);
60521
- }
60522
- if (this._getType(input) !== ZodParsedType.bigint)
60523
- return this._getInvalidInput(input);
60524
- let ctx, status = new ParseStatus();
60525
- for (let check of this._def.checks)
60526
- check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60527
- code: ZodIssueCode.too_small,
60528
- type: "bigint",
60529
- minimum: check.value,
60530
- inclusive: check.inclusive,
60531
- message: check.message
60532
- }), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60533
- code: ZodIssueCode.too_big,
60534
- type: "bigint",
60535
- maximum: check.value,
60536
- inclusive: check.inclusive,
60537
- message: check.message
60538
- }), status.dirty()) : check.kind === "multipleOf" ? input.data % check.value !== BigInt(0) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60539
- code: ZodIssueCode.not_multiple_of,
60540
- multipleOf: check.value,
60541
- message: check.message
60542
- }), status.dirty()) : util.assertNever(check);
60543
- return { status: status.value, value: input.data };
60544
- }
60545
- _getInvalidInput(input) {
60546
- let ctx = this._getOrReturnCtx(input);
60547
- return addIssueToContext(ctx, {
60548
- code: ZodIssueCode.invalid_type,
60549
- expected: ZodParsedType.bigint,
60550
- received: ctx.parsedType
60551
- }), INVALID;
60552
- }
60553
- gte(value, message) {
60554
- return this.setLimit("min", value, !0, errorUtil.toString(message));
60555
- }
60556
- gt(value, message) {
60557
- return this.setLimit("min", value, !1, errorUtil.toString(message));
60558
- }
60559
- lte(value, message) {
60560
- return this.setLimit("max", value, !0, errorUtil.toString(message));
60561
- }
60562
- lt(value, message) {
60563
- return this.setLimit("max", value, !1, errorUtil.toString(message));
60564
- }
60565
- setLimit(kind, value, inclusive, message) {
60566
- return new _ZodBigInt({
60567
- ...this._def,
60568
- checks: [
60569
- ...this._def.checks,
60570
- {
60571
- kind,
60572
- value,
60573
- inclusive,
60574
- message: errorUtil.toString(message)
60575
- }
60576
- ]
60577
- });
60578
- }
60579
- _addCheck(check) {
60580
- return new _ZodBigInt({
60581
- ...this._def,
60582
- checks: [...this._def.checks, check]
60583
- });
60584
- }
60585
- positive(message) {
60586
- return this._addCheck({
60587
- kind: "min",
60588
- value: BigInt(0),
60589
- inclusive: !1,
60590
- message: errorUtil.toString(message)
60591
- });
60592
- }
60593
- negative(message) {
60594
- return this._addCheck({
60595
- kind: "max",
60596
- value: BigInt(0),
60597
- inclusive: !1,
60598
- message: errorUtil.toString(message)
60599
- });
60600
- }
60601
- nonpositive(message) {
60602
- return this._addCheck({
60603
- kind: "max",
60604
- value: BigInt(0),
60605
- inclusive: !0,
60606
- message: errorUtil.toString(message)
60607
- });
60608
- }
60609
- nonnegative(message) {
60610
- return this._addCheck({
60611
- kind: "min",
60612
- value: BigInt(0),
60613
- inclusive: !0,
60614
- message: errorUtil.toString(message)
60615
- });
60616
- }
60617
- multipleOf(value, message) {
60618
- return this._addCheck({
60619
- kind: "multipleOf",
60620
- value,
60621
- message: errorUtil.toString(message)
60622
- });
60623
- }
60624
- get minValue() {
60625
- let min = null;
60626
- for (let ch of this._def.checks)
60627
- ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
60628
- return min;
60629
- }
60630
- get maxValue() {
60631
- let max = null;
60632
- for (let ch of this._def.checks)
60633
- ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
60634
- return max;
60635
- }
60636
- };
60637
- ZodBigInt.create = (params) => new ZodBigInt({
60638
- checks: [],
60639
- typeName: ZodFirstPartyTypeKind.ZodBigInt,
60640
- coerce: params?.coerce ?? !1,
60641
- ...processCreateParams(params)
60642
- });
60643
- var ZodBoolean = class extends ZodType {
60644
- _parse(input) {
60645
- if (this._def.coerce && (input.data = !!input.data), this._getType(input) !== ZodParsedType.boolean) {
60646
- let ctx = this._getOrReturnCtx(input);
60647
- return addIssueToContext(ctx, {
60648
- code: ZodIssueCode.invalid_type,
60649
- expected: ZodParsedType.boolean,
60650
- received: ctx.parsedType
60651
- }), INVALID;
60652
- }
60653
- return OK(input.data);
60654
- }
60655
- };
60656
- ZodBoolean.create = (params) => new ZodBoolean({
60657
- typeName: ZodFirstPartyTypeKind.ZodBoolean,
60658
- coerce: params?.coerce || !1,
60659
- ...processCreateParams(params)
60660
- });
60661
- var ZodDate = class _ZodDate extends ZodType {
60662
- _parse(input) {
60663
- if (this._def.coerce && (input.data = new Date(input.data)), this._getType(input) !== ZodParsedType.date) {
60664
- let ctx2 = this._getOrReturnCtx(input);
60665
- return addIssueToContext(ctx2, {
60666
- code: ZodIssueCode.invalid_type,
60667
- expected: ZodParsedType.date,
60668
- received: ctx2.parsedType
60669
- }), INVALID;
60670
- }
60671
- if (Number.isNaN(input.data.getTime())) {
60672
- let ctx2 = this._getOrReturnCtx(input);
60673
- return addIssueToContext(ctx2, {
60674
- code: ZodIssueCode.invalid_date
60675
- }), INVALID;
60676
- }
60677
- let status = new ParseStatus(), ctx;
60678
- for (let check of this._def.checks)
60679
- check.kind === "min" ? input.data.getTime() < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60680
- code: ZodIssueCode.too_small,
60681
- message: check.message,
60682
- inclusive: !0,
60683
- exact: !1,
60684
- minimum: check.value,
60685
- type: "date"
60686
- }), status.dirty()) : check.kind === "max" ? input.data.getTime() > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
60687
- code: ZodIssueCode.too_big,
60688
- message: check.message,
60689
- inclusive: !0,
60690
- exact: !1,
60691
- maximum: check.value,
60692
- type: "date"
60693
- }), status.dirty()) : util.assertNever(check);
60694
- return {
60695
- status: status.value,
60696
- value: new Date(input.data.getTime())
60697
- };
60698
- }
60699
- _addCheck(check) {
60700
- return new _ZodDate({
60701
- ...this._def,
60702
- checks: [...this._def.checks, check]
60703
- });
60704
- }
60705
- min(minDate, message) {
60706
- return this._addCheck({
60707
- kind: "min",
60708
- value: minDate.getTime(),
60709
- message: errorUtil.toString(message)
60710
- });
60711
- }
60712
- max(maxDate, message) {
60713
- return this._addCheck({
60714
- kind: "max",
60715
- value: maxDate.getTime(),
60716
- message: errorUtil.toString(message)
60717
- });
60718
- }
60719
- get minDate() {
60720
- let min = null;
60721
- for (let ch of this._def.checks)
60722
- ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
60723
- return min != null ? new Date(min) : null;
60724
- }
60725
- get maxDate() {
60726
- let max = null;
60727
- for (let ch of this._def.checks)
60728
- ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
60729
- return max != null ? new Date(max) : null;
60730
- }
60731
- };
60732
- ZodDate.create = (params) => new ZodDate({
60733
- checks: [],
60734
- coerce: params?.coerce || !1,
60735
- typeName: ZodFirstPartyTypeKind.ZodDate,
60736
- ...processCreateParams(params)
60737
- });
60738
- var ZodSymbol = class extends ZodType {
60739
- _parse(input) {
60740
- if (this._getType(input) !== ZodParsedType.symbol) {
60741
- let ctx = this._getOrReturnCtx(input);
60742
- return addIssueToContext(ctx, {
60743
- code: ZodIssueCode.invalid_type,
60744
- expected: ZodParsedType.symbol,
60745
- received: ctx.parsedType
60746
- }), INVALID;
60747
- }
60748
- return OK(input.data);
60749
- }
60750
- };
60751
- ZodSymbol.create = (params) => new ZodSymbol({
60752
- typeName: ZodFirstPartyTypeKind.ZodSymbol,
60753
- ...processCreateParams(params)
60754
- });
60755
- var ZodUndefined = class extends ZodType {
60756
- _parse(input) {
60757
- if (this._getType(input) !== ZodParsedType.undefined) {
60758
- let ctx = this._getOrReturnCtx(input);
60759
- return addIssueToContext(ctx, {
60760
- code: ZodIssueCode.invalid_type,
60761
- expected: ZodParsedType.undefined,
60762
- received: ctx.parsedType
60763
- }), INVALID;
60764
- }
60765
- return OK(input.data);
60766
- }
60767
- };
60768
- ZodUndefined.create = (params) => new ZodUndefined({
60769
- typeName: ZodFirstPartyTypeKind.ZodUndefined,
60770
- ...processCreateParams(params)
60771
- });
60772
- var ZodNull = class extends ZodType {
60773
- _parse(input) {
60774
- if (this._getType(input) !== ZodParsedType.null) {
60775
- let ctx = this._getOrReturnCtx(input);
60776
- return addIssueToContext(ctx, {
60777
- code: ZodIssueCode.invalid_type,
60778
- expected: ZodParsedType.null,
60779
- received: ctx.parsedType
60780
- }), INVALID;
60781
- }
60782
- return OK(input.data);
60783
- }
60784
- };
60785
- ZodNull.create = (params) => new ZodNull({
60786
- typeName: ZodFirstPartyTypeKind.ZodNull,
60787
- ...processCreateParams(params)
60788
- });
60789
- var ZodAny = class extends ZodType {
60790
- constructor() {
60791
- super(...arguments), this._any = !0;
60792
- }
60793
- _parse(input) {
60794
- return OK(input.data);
60795
- }
60796
- };
60797
- ZodAny.create = (params) => new ZodAny({
60798
- typeName: ZodFirstPartyTypeKind.ZodAny,
60799
- ...processCreateParams(params)
60800
- });
60801
- var ZodUnknown = class extends ZodType {
60802
- constructor() {
60803
- super(...arguments), this._unknown = !0;
60804
- }
60805
- _parse(input) {
60806
- return OK(input.data);
60807
- }
60808
- };
60809
- ZodUnknown.create = (params) => new ZodUnknown({
60810
- typeName: ZodFirstPartyTypeKind.ZodUnknown,
60811
- ...processCreateParams(params)
60812
- });
60813
- var ZodNever = class extends ZodType {
60814
- _parse(input) {
60815
- let ctx = this._getOrReturnCtx(input);
60816
- return addIssueToContext(ctx, {
60817
- code: ZodIssueCode.invalid_type,
60818
- expected: ZodParsedType.never,
60819
- received: ctx.parsedType
60820
- }), INVALID;
60821
- }
60822
- };
60823
- ZodNever.create = (params) => new ZodNever({
60824
- typeName: ZodFirstPartyTypeKind.ZodNever,
60825
- ...processCreateParams(params)
60826
- });
60827
- var ZodVoid = class extends ZodType {
60828
- _parse(input) {
60829
- if (this._getType(input) !== ZodParsedType.undefined) {
60830
- let ctx = this._getOrReturnCtx(input);
60831
- return addIssueToContext(ctx, {
60832
- code: ZodIssueCode.invalid_type,
60833
- expected: ZodParsedType.void,
60834
- received: ctx.parsedType
60835
- }), INVALID;
60836
- }
60837
- return OK(input.data);
60838
- }
60839
- };
60840
- ZodVoid.create = (params) => new ZodVoid({
60841
- typeName: ZodFirstPartyTypeKind.ZodVoid,
60842
- ...processCreateParams(params)
60843
- });
60844
- var ZodArray = class _ZodArray extends ZodType {
60845
- _parse(input) {
60846
- let { ctx, status } = this._processInputParams(input), def = this._def;
60847
- if (ctx.parsedType !== ZodParsedType.array)
60848
- return addIssueToContext(ctx, {
60849
- code: ZodIssueCode.invalid_type,
60850
- expected: ZodParsedType.array,
60851
- received: ctx.parsedType
60852
- }), INVALID;
60853
- if (def.exactLength !== null) {
60854
- let tooBig = ctx.data.length > def.exactLength.value, tooSmall = ctx.data.length < def.exactLength.value;
60855
- (tooBig || tooSmall) && (addIssueToContext(ctx, {
60856
- code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
60857
- minimum: tooSmall ? def.exactLength.value : void 0,
60858
- maximum: tooBig ? def.exactLength.value : void 0,
60859
- type: "array",
60860
- inclusive: !0,
60861
- exact: !0,
60862
- message: def.exactLength.message
60863
- }), status.dirty());
60864
- }
60865
- if (def.minLength !== null && ctx.data.length < def.minLength.value && (addIssueToContext(ctx, {
60866
- code: ZodIssueCode.too_small,
60867
- minimum: def.minLength.value,
60868
- type: "array",
60869
- inclusive: !0,
60870
- exact: !1,
60871
- message: def.minLength.message
60872
- }), status.dirty()), def.maxLength !== null && ctx.data.length > def.maxLength.value && (addIssueToContext(ctx, {
60873
- code: ZodIssueCode.too_big,
60874
- maximum: def.maxLength.value,
60875
- type: "array",
60876
- inclusive: !0,
60877
- exact: !1,
60878
- message: def.maxLength.message
60879
- }), status.dirty()), ctx.common.async)
60880
- return Promise.all([...ctx.data].map((item, i) => def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i)))).then((result2) => ParseStatus.mergeArray(status, result2));
60881
- let result = [...ctx.data].map((item, i) => def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i)));
60882
- return ParseStatus.mergeArray(status, result);
60883
- }
60884
- get element() {
60885
- return this._def.type;
60886
- }
60887
- min(minLength, message) {
60888
- return new _ZodArray({
60889
- ...this._def,
60890
- minLength: { value: minLength, message: errorUtil.toString(message) }
60891
- });
60892
- }
60893
- max(maxLength, message) {
60894
- return new _ZodArray({
60895
- ...this._def,
60896
- maxLength: { value: maxLength, message: errorUtil.toString(message) }
60897
- });
60898
- }
60899
- length(len, message) {
60900
- return new _ZodArray({
60901
- ...this._def,
60902
- exactLength: { value: len, message: errorUtil.toString(message) }
60903
- });
60904
- }
60905
- nonempty(message) {
60906
- return this.min(1, message);
60907
- }
60908
- };
60909
- ZodArray.create = (schema, params) => new ZodArray({
60910
- type: schema,
60911
- minLength: null,
60912
- maxLength: null,
60913
- exactLength: null,
60914
- typeName: ZodFirstPartyTypeKind.ZodArray,
60915
- ...processCreateParams(params)
60916
- });
60917
- function deepPartialify(schema) {
60918
- if (schema instanceof ZodObject) {
60919
- let newShape = {};
60920
- for (let key in schema.shape) {
60921
- let fieldSchema = schema.shape[key];
60922
- newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
60923
- }
60924
- return new ZodObject({
60925
- ...schema._def,
60926
- shape: () => newShape
60927
- });
60928
- } else return schema instanceof ZodArray ? new ZodArray({
60929
- ...schema._def,
60930
- type: deepPartialify(schema.element)
60931
- }) : schema instanceof ZodOptional ? ZodOptional.create(deepPartialify(schema.unwrap())) : schema instanceof ZodNullable ? ZodNullable.create(deepPartialify(schema.unwrap())) : schema instanceof ZodTuple ? ZodTuple.create(schema.items.map((item) => deepPartialify(item))) : schema;
60932
- }
60933
- var ZodObject = class _ZodObject extends ZodType {
60934
- constructor() {
60935
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
60936
- }
60937
- _getCached() {
60938
- if (this._cached !== null)
60939
- return this._cached;
60940
- let shape = this._def.shape(), keys = util.objectKeys(shape);
60941
- return this._cached = { shape, keys }, this._cached;
60942
- }
60943
- _parse(input) {
60944
- if (this._getType(input) !== ZodParsedType.object) {
60945
- let ctx2 = this._getOrReturnCtx(input);
60946
- return addIssueToContext(ctx2, {
60947
- code: ZodIssueCode.invalid_type,
60948
- expected: ZodParsedType.object,
60949
- received: ctx2.parsedType
60950
- }), INVALID;
60951
- }
60952
- let { status, ctx } = this._processInputParams(input), { shape, keys: shapeKeys } = this._getCached(), extraKeys = [];
60953
- if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip"))
60954
- for (let key in ctx.data)
60955
- shapeKeys.includes(key) || extraKeys.push(key);
60956
- let pairs = [];
60957
- for (let key of shapeKeys) {
60958
- let keyValidator = shape[key], value = ctx.data[key];
60959
- pairs.push({
60960
- key: { status: "valid", value: key },
60961
- value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
60962
- alwaysSet: key in ctx.data
60963
- });
60964
- }
60965
- if (this._def.catchall instanceof ZodNever) {
60966
- let unknownKeys = this._def.unknownKeys;
60967
- if (unknownKeys === "passthrough")
60968
- for (let key of extraKeys)
60969
- pairs.push({
60970
- key: { status: "valid", value: key },
60971
- value: { status: "valid", value: ctx.data[key] }
60972
- });
60973
- else if (unknownKeys === "strict")
60974
- extraKeys.length > 0 && (addIssueToContext(ctx, {
60975
- code: ZodIssueCode.unrecognized_keys,
60976
- keys: extraKeys
60977
- }), status.dirty());
60978
- else if (unknownKeys !== "strip")
60979
- throw new Error("Internal ZodObject error: invalid unknownKeys value.");
60980
- } else {
60981
- let catchall = this._def.catchall;
60982
- for (let key of extraKeys) {
60983
- let value = ctx.data[key];
60984
- pairs.push({
60985
- key: { status: "valid", value: key },
60986
- value: catchall._parse(
60987
- new ParseInputLazyPath(ctx, value, ctx.path, key)
60988
- //, ctx.child(key), value, getParsedType(value)
60989
- ),
60990
- alwaysSet: key in ctx.data
60991
- });
60992
- }
60993
- }
60994
- return ctx.common.async ? Promise.resolve().then(async () => {
60995
- let syncPairs = [];
60996
- for (let pair of pairs) {
60997
- let key = await pair.key, value = await pair.value;
60998
- syncPairs.push({
60999
- key,
61000
- value,
61001
- alwaysSet: pair.alwaysSet
61002
- });
61003
- }
61004
- return syncPairs;
61005
- }).then((syncPairs) => ParseStatus.mergeObjectSync(status, syncPairs)) : ParseStatus.mergeObjectSync(status, pairs);
61006
- }
61007
- get shape() {
61008
- return this._def.shape();
61009
- }
61010
- strict(message) {
61011
- return errorUtil.errToObj, new _ZodObject({
61012
- ...this._def,
61013
- unknownKeys: "strict",
61014
- ...message !== void 0 ? {
61015
- errorMap: (issue, ctx) => {
61016
- let defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
61017
- return issue.code === "unrecognized_keys" ? {
61018
- message: errorUtil.errToObj(message).message ?? defaultError
61019
- } : {
61020
- message: defaultError
61021
- };
61022
- }
61023
- } : {}
61024
- });
61025
- }
61026
- strip() {
61027
- return new _ZodObject({
61028
- ...this._def,
61029
- unknownKeys: "strip"
61030
- });
61031
- }
61032
- passthrough() {
61033
- return new _ZodObject({
61034
- ...this._def,
61035
- unknownKeys: "passthrough"
61036
- });
61037
- }
61038
- // const AugmentFactory =
61039
- // <Def extends ZodObjectDef>(def: Def) =>
61040
- // <Augmentation extends ZodRawShape>(
61041
- // augmentation: Augmentation
61042
- // ): ZodObject<
61043
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
61044
- // Def["unknownKeys"],
61045
- // Def["catchall"]
61046
- // > => {
61047
- // return new ZodObject({
61048
- // ...def,
61049
- // shape: () => ({
61050
- // ...def.shape(),
61051
- // ...augmentation,
61052
- // }),
61053
- // }) as any;
61054
- // };
61055
- extend(augmentation) {
61056
- return new _ZodObject({
61057
- ...this._def,
61058
- shape: () => ({
61059
- ...this._def.shape(),
61060
- ...augmentation
61061
- })
61062
- });
61063
- }
61064
- /**
61065
- * Prior to zod@1.0.12 there was a bug in the
61066
- * inferred type of merged objects. Please
61067
- * upgrade if you are experiencing issues.
61068
- */
61069
- merge(merging) {
61070
- return new _ZodObject({
61071
- unknownKeys: merging._def.unknownKeys,
61072
- catchall: merging._def.catchall,
61073
- shape: () => ({
61074
- ...this._def.shape(),
61075
- ...merging._def.shape()
61076
- }),
61077
- typeName: ZodFirstPartyTypeKind.ZodObject
61078
- });
61079
- }
61080
- // merge<
61081
- // Incoming extends AnyZodObject,
61082
- // Augmentation extends Incoming["shape"],
61083
- // NewOutput extends {
61084
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
61085
- // ? Augmentation[k]["_output"]
61086
- // : k extends keyof Output
61087
- // ? Output[k]
61088
- // : never;
61089
- // },
61090
- // NewInput extends {
61091
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
61092
- // ? Augmentation[k]["_input"]
61093
- // : k extends keyof Input
61094
- // ? Input[k]
61095
- // : never;
61096
- // }
61097
- // >(
61098
- // merging: Incoming
61099
- // ): ZodObject<
61100
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
61101
- // Incoming["_def"]["unknownKeys"],
61102
- // Incoming["_def"]["catchall"],
61103
- // NewOutput,
61104
- // NewInput
61105
- // > {
61106
- // const merged: any = new ZodObject({
61107
- // unknownKeys: merging._def.unknownKeys,
61108
- // catchall: merging._def.catchall,
61109
- // shape: () =>
61110
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
61111
- // typeName: ZodFirstPartyTypeKind.ZodObject,
61112
- // }) as any;
61113
- // return merged;
61114
- // }
61115
- setKey(key, schema) {
61116
- return this.augment({ [key]: schema });
61117
- }
61118
- // merge<Incoming extends AnyZodObject>(
61119
- // merging: Incoming
61120
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
61121
- // ZodObject<
61122
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
61123
- // Incoming["_def"]["unknownKeys"],
61124
- // Incoming["_def"]["catchall"]
61125
- // > {
61126
- // // const mergedShape = objectUtil.mergeShapes(
61127
- // // this._def.shape(),
61128
- // // merging._def.shape()
61129
- // // );
61130
- // const merged: any = new ZodObject({
61131
- // unknownKeys: merging._def.unknownKeys,
61132
- // catchall: merging._def.catchall,
61133
- // shape: () =>
61134
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
61135
- // typeName: ZodFirstPartyTypeKind.ZodObject,
61136
- // }) as any;
61137
- // return merged;
61138
- // }
61139
- catchall(index) {
61140
- return new _ZodObject({
61141
- ...this._def,
61142
- catchall: index
61143
- });
61144
- }
61145
- pick(mask) {
61146
- let shape = {};
61147
- for (let key of util.objectKeys(mask))
61148
- mask[key] && this.shape[key] && (shape[key] = this.shape[key]);
61149
- return new _ZodObject({
61150
- ...this._def,
61151
- shape: () => shape
61152
- });
61153
- }
61154
- omit(mask) {
61155
- let shape = {};
61156
- for (let key of util.objectKeys(this.shape))
61157
- mask[key] || (shape[key] = this.shape[key]);
61158
- return new _ZodObject({
61159
- ...this._def,
61160
- shape: () => shape
61161
- });
61162
- }
61163
- /**
61164
- * @deprecated
61165
- */
61166
- deepPartial() {
61167
- return deepPartialify(this);
61168
- }
61169
- partial(mask) {
61170
- let newShape = {};
61171
- for (let key of util.objectKeys(this.shape)) {
61172
- let fieldSchema = this.shape[key];
61173
- mask && !mask[key] ? newShape[key] = fieldSchema : newShape[key] = fieldSchema.optional();
61174
- }
61175
- return new _ZodObject({
61176
- ...this._def,
61177
- shape: () => newShape
61178
- });
61179
- }
61180
- required(mask) {
61181
- let newShape = {};
61182
- for (let key of util.objectKeys(this.shape))
61183
- if (mask && !mask[key])
61184
- newShape[key] = this.shape[key];
61185
- else {
61186
- let newField = this.shape[key];
61187
- for (; newField instanceof ZodOptional; )
61188
- newField = newField._def.innerType;
61189
- newShape[key] = newField;
61190
- }
61191
- return new _ZodObject({
61192
- ...this._def,
61193
- shape: () => newShape
61194
- });
61195
- }
61196
- keyof() {
61197
- return createZodEnum(util.objectKeys(this.shape));
61198
- }
61199
- };
61200
- ZodObject.create = (shape, params) => new ZodObject({
61201
- shape: () => shape,
61202
- unknownKeys: "strip",
61203
- catchall: ZodNever.create(),
61204
- typeName: ZodFirstPartyTypeKind.ZodObject,
61205
- ...processCreateParams(params)
61206
- });
61207
- ZodObject.strictCreate = (shape, params) => new ZodObject({
61208
- shape: () => shape,
61209
- unknownKeys: "strict",
61210
- catchall: ZodNever.create(),
61211
- typeName: ZodFirstPartyTypeKind.ZodObject,
61212
- ...processCreateParams(params)
61213
- });
61214
- ZodObject.lazycreate = (shape, params) => new ZodObject({
61215
- shape,
61216
- unknownKeys: "strip",
61217
- catchall: ZodNever.create(),
61218
- typeName: ZodFirstPartyTypeKind.ZodObject,
61219
- ...processCreateParams(params)
61220
- });
61221
- var ZodUnion = class extends ZodType {
61222
- _parse(input) {
61223
- let { ctx } = this._processInputParams(input), options2 = this._def.options;
61224
- function handleResults(results) {
61225
- for (let result of results)
61226
- if (result.result.status === "valid")
61227
- return result.result;
61228
- for (let result of results)
61229
- if (result.result.status === "dirty")
61230
- return ctx.common.issues.push(...result.ctx.common.issues), result.result;
61231
- let unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
61232
- return addIssueToContext(ctx, {
61233
- code: ZodIssueCode.invalid_union,
61234
- unionErrors
61235
- }), INVALID;
61236
- }
61237
- if (ctx.common.async)
61238
- return Promise.all(options2.map(async (option) => {
61239
- let childCtx = {
61240
- ...ctx,
61241
- common: {
61242
- ...ctx.common,
61243
- issues: []
61244
- },
61245
- parent: null
61246
- };
61247
- return {
61248
- result: await option._parseAsync({
61249
- data: ctx.data,
61250
- path: ctx.path,
61251
- parent: childCtx
61252
- }),
61253
- ctx: childCtx
61254
- };
61255
- })).then(handleResults);
61256
- {
61257
- let dirty, issues = [];
61258
- for (let option of options2) {
61259
- let childCtx = {
61260
- ...ctx,
61261
- common: {
61262
- ...ctx.common,
61263
- issues: []
61264
- },
61265
- parent: null
61266
- }, result = option._parseSync({
61267
- data: ctx.data,
61268
- path: ctx.path,
61269
- parent: childCtx
61270
- });
61271
- if (result.status === "valid")
61272
- return result;
61273
- result.status === "dirty" && !dirty && (dirty = { result, ctx: childCtx }), childCtx.common.issues.length && issues.push(childCtx.common.issues);
61274
- }
61275
- if (dirty)
61276
- return ctx.common.issues.push(...dirty.ctx.common.issues), dirty.result;
61277
- let unionErrors = issues.map((issues2) => new ZodError(issues2));
61278
- return addIssueToContext(ctx, {
61279
- code: ZodIssueCode.invalid_union,
61280
- unionErrors
61281
- }), INVALID;
61282
- }
61283
- }
61284
- get options() {
61285
- return this._def.options;
61286
- }
61287
- };
61288
- ZodUnion.create = (types3, params) => new ZodUnion({
61289
- options: types3,
61290
- typeName: ZodFirstPartyTypeKind.ZodUnion,
61291
- ...processCreateParams(params)
61292
- });
61293
- var getDiscriminator = (type) => type instanceof ZodLazy ? getDiscriminator(type.schema) : type instanceof ZodEffects ? getDiscriminator(type.innerType()) : type instanceof ZodLiteral ? [type.value] : type instanceof ZodEnum ? type.options : type instanceof ZodNativeEnum ? util.objectValues(type.enum) : type instanceof ZodDefault ? getDiscriminator(type._def.innerType) : type instanceof ZodUndefined ? [void 0] : type instanceof ZodNull ? [null] : type instanceof ZodOptional ? [void 0, ...getDiscriminator(type.unwrap())] : type instanceof ZodNullable ? [null, ...getDiscriminator(type.unwrap())] : type instanceof ZodBranded || type instanceof ZodReadonly ? getDiscriminator(type.unwrap()) : type instanceof ZodCatch ? getDiscriminator(type._def.innerType) : [], ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
61294
- _parse(input) {
61295
- let { ctx } = this._processInputParams(input);
61296
- if (ctx.parsedType !== ZodParsedType.object)
61297
- return addIssueToContext(ctx, {
61298
- code: ZodIssueCode.invalid_type,
61299
- expected: ZodParsedType.object,
61300
- received: ctx.parsedType
61301
- }), INVALID;
61302
- let discriminator = this.discriminator, discriminatorValue = ctx.data[discriminator], option = this.optionsMap.get(discriminatorValue);
61303
- return option ? ctx.common.async ? option._parseAsync({
61304
- data: ctx.data,
61305
- path: ctx.path,
61306
- parent: ctx
61307
- }) : option._parseSync({
61308
- data: ctx.data,
61309
- path: ctx.path,
61310
- parent: ctx
61311
- }) : (addIssueToContext(ctx, {
61312
- code: ZodIssueCode.invalid_union_discriminator,
61313
- options: Array.from(this.optionsMap.keys()),
61314
- path: [discriminator]
61315
- }), INVALID);
61316
- }
61317
- get discriminator() {
61318
- return this._def.discriminator;
61319
- }
61320
- get options() {
61321
- return this._def.options;
61322
- }
61323
- get optionsMap() {
61324
- return this._def.optionsMap;
61325
- }
61326
- /**
61327
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
61328
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
61329
- * have a different value for each object in the union.
61330
- * @param discriminator the name of the discriminator property
61331
- * @param types an array of object schemas
61332
- * @param params
61333
- */
61334
- static create(discriminator, options2, params) {
61335
- let optionsMap = /* @__PURE__ */ new Map();
61336
- for (let type of options2) {
61337
- let discriminatorValues = getDiscriminator(type.shape[discriminator]);
61338
- if (!discriminatorValues.length)
61339
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
61340
- for (let value of discriminatorValues) {
61341
- if (optionsMap.has(value))
61342
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
61343
- optionsMap.set(value, type);
61344
- }
61345
- }
61346
- return new _ZodDiscriminatedUnion({
61347
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
61348
- discriminator,
61349
- options: options2,
61350
- optionsMap,
61351
- ...processCreateParams(params)
61352
- });
61353
- }
61354
- };
61355
- function mergeValues(a, b) {
61356
- let aType = getParsedType(a), bType = getParsedType(b);
61357
- if (a === b)
61358
- return { valid: !0, data: a };
61359
- if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
61360
- let bKeys = util.objectKeys(b), sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1), newObj = { ...a, ...b };
61361
- for (let key of sharedKeys) {
61362
- let sharedValue = mergeValues(a[key], b[key]);
61363
- if (!sharedValue.valid)
61364
- return { valid: !1 };
61365
- newObj[key] = sharedValue.data;
61366
- }
61367
- return { valid: !0, data: newObj };
61368
- } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
61369
- if (a.length !== b.length)
61370
- return { valid: !1 };
61371
- let newArray = [];
61372
- for (let index = 0; index < a.length; index++) {
61373
- let itemA = a[index], itemB = b[index], sharedValue = mergeValues(itemA, itemB);
61374
- if (!sharedValue.valid)
61375
- return { valid: !1 };
61376
- newArray.push(sharedValue.data);
61377
- }
61378
- return { valid: !0, data: newArray };
61379
- } else return aType === ZodParsedType.date && bType === ZodParsedType.date && +a == +b ? { valid: !0, data: a } : { valid: !1 };
61380
- }
61381
- var ZodIntersection = class extends ZodType {
61382
- _parse(input) {
61383
- let { status, ctx } = this._processInputParams(input), handleParsed = (parsedLeft, parsedRight) => {
61384
- if (isAborted(parsedLeft) || isAborted(parsedRight))
61385
- return INVALID;
61386
- let merged = mergeValues(parsedLeft.value, parsedRight.value);
61387
- return merged.valid ? ((isDirty(parsedLeft) || isDirty(parsedRight)) && status.dirty(), { status: status.value, value: merged.data }) : (addIssueToContext(ctx, {
61388
- code: ZodIssueCode.invalid_intersection_types
61389
- }), INVALID);
61390
- };
61391
- return ctx.common.async ? Promise.all([
61392
- this._def.left._parseAsync({
61393
- data: ctx.data,
61394
- path: ctx.path,
61395
- parent: ctx
61396
- }),
61397
- this._def.right._parseAsync({
61398
- data: ctx.data,
61399
- path: ctx.path,
61400
- parent: ctx
61401
- })
61402
- ]).then(([left, right]) => handleParsed(left, right)) : handleParsed(this._def.left._parseSync({
61403
- data: ctx.data,
61404
- path: ctx.path,
61405
- parent: ctx
61406
- }), this._def.right._parseSync({
61407
- data: ctx.data,
61408
- path: ctx.path,
61409
- parent: ctx
61410
- }));
61411
- }
61412
- };
61413
- ZodIntersection.create = (left, right, params) => new ZodIntersection({
61414
- left,
61415
- right,
61416
- typeName: ZodFirstPartyTypeKind.ZodIntersection,
61417
- ...processCreateParams(params)
61418
- });
61419
- var ZodTuple = class _ZodTuple extends ZodType {
61420
- _parse(input) {
61421
- let { status, ctx } = this._processInputParams(input);
61422
- if (ctx.parsedType !== ZodParsedType.array)
61423
- return addIssueToContext(ctx, {
61424
- code: ZodIssueCode.invalid_type,
61425
- expected: ZodParsedType.array,
61426
- received: ctx.parsedType
61427
- }), INVALID;
61428
- if (ctx.data.length < this._def.items.length)
61429
- return addIssueToContext(ctx, {
61430
- code: ZodIssueCode.too_small,
61431
- minimum: this._def.items.length,
61432
- inclusive: !0,
61433
- exact: !1,
61434
- type: "array"
61435
- }), INVALID;
61436
- !this._def.rest && ctx.data.length > this._def.items.length && (addIssueToContext(ctx, {
61437
- code: ZodIssueCode.too_big,
61438
- maximum: this._def.items.length,
61439
- inclusive: !0,
61440
- exact: !1,
61441
- type: "array"
61442
- }), status.dirty());
61443
- let items = [...ctx.data].map((item, itemIndex) => {
61444
- let schema = this._def.items[itemIndex] || this._def.rest;
61445
- return schema ? schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)) : null;
61446
- }).filter((x) => !!x);
61447
- return ctx.common.async ? Promise.all(items).then((results) => ParseStatus.mergeArray(status, results)) : ParseStatus.mergeArray(status, items);
61448
- }
61449
- get items() {
61450
- return this._def.items;
61451
- }
61452
- rest(rest) {
61453
- return new _ZodTuple({
61454
- ...this._def,
61455
- rest
61456
- });
61457
- }
61458
- };
61459
- ZodTuple.create = (schemas, params) => {
61460
- if (!Array.isArray(schemas))
61461
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
61462
- return new ZodTuple({
61463
- items: schemas,
61464
- typeName: ZodFirstPartyTypeKind.ZodTuple,
61465
- rest: null,
61466
- ...processCreateParams(params)
61467
- });
61468
- };
61469
- var ZodRecord = class _ZodRecord extends ZodType {
61470
- get keySchema() {
61471
- return this._def.keyType;
61472
- }
61473
- get valueSchema() {
61474
- return this._def.valueType;
61475
- }
61476
- _parse(input) {
61477
- let { status, ctx } = this._processInputParams(input);
61478
- if (ctx.parsedType !== ZodParsedType.object)
61479
- return addIssueToContext(ctx, {
61480
- code: ZodIssueCode.invalid_type,
61481
- expected: ZodParsedType.object,
61482
- received: ctx.parsedType
61483
- }), INVALID;
61484
- let pairs = [], keyType = this._def.keyType, valueType = this._def.valueType;
61485
- for (let key in ctx.data)
61486
- pairs.push({
61487
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
61488
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
61489
- alwaysSet: key in ctx.data
61490
- });
61491
- return ctx.common.async ? ParseStatus.mergeObjectAsync(status, pairs) : ParseStatus.mergeObjectSync(status, pairs);
61492
- }
61493
- get element() {
61494
- return this._def.valueType;
61495
- }
61496
- static create(first, second, third) {
61497
- return second instanceof ZodType ? new _ZodRecord({
61498
- keyType: first,
61499
- valueType: second,
61500
- typeName: ZodFirstPartyTypeKind.ZodRecord,
61501
- ...processCreateParams(third)
61502
- }) : new _ZodRecord({
61503
- keyType: ZodString.create(),
61504
- valueType: first,
61505
- typeName: ZodFirstPartyTypeKind.ZodRecord,
61506
- ...processCreateParams(second)
61507
- });
61508
- }
61509
- }, ZodMap = class extends ZodType {
61510
- get keySchema() {
61511
- return this._def.keyType;
61512
- }
61513
- get valueSchema() {
61514
- return this._def.valueType;
61515
- }
61516
- _parse(input) {
61517
- let { status, ctx } = this._processInputParams(input);
61518
- if (ctx.parsedType !== ZodParsedType.map)
61519
- return addIssueToContext(ctx, {
61520
- code: ZodIssueCode.invalid_type,
61521
- expected: ZodParsedType.map,
61522
- received: ctx.parsedType
61523
- }), INVALID;
61524
- let keyType = this._def.keyType, valueType = this._def.valueType, pairs = [...ctx.data.entries()].map(([key, value], index) => ({
61525
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
61526
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
61527
- }));
61528
- if (ctx.common.async) {
61529
- let finalMap = /* @__PURE__ */ new Map();
61530
- return Promise.resolve().then(async () => {
61531
- for (let pair of pairs) {
61532
- let key = await pair.key, value = await pair.value;
61533
- if (key.status === "aborted" || value.status === "aborted")
61534
- return INVALID;
61535
- (key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value);
61536
- }
61537
- return { status: status.value, value: finalMap };
61538
- });
61539
- } else {
61540
- let finalMap = /* @__PURE__ */ new Map();
61541
- for (let pair of pairs) {
61542
- let key = pair.key, value = pair.value;
61543
- if (key.status === "aborted" || value.status === "aborted")
61544
- return INVALID;
61545
- (key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value);
61546
- }
61547
- return { status: status.value, value: finalMap };
61548
- }
61549
- }
61550
- };
61551
- ZodMap.create = (keyType, valueType, params) => new ZodMap({
61552
- valueType,
61553
- keyType,
61554
- typeName: ZodFirstPartyTypeKind.ZodMap,
61555
- ...processCreateParams(params)
61556
- });
61557
- var ZodSet = class _ZodSet extends ZodType {
61558
- _parse(input) {
61559
- let { status, ctx } = this._processInputParams(input);
61560
- if (ctx.parsedType !== ZodParsedType.set)
61561
- return addIssueToContext(ctx, {
61562
- code: ZodIssueCode.invalid_type,
61563
- expected: ZodParsedType.set,
61564
- received: ctx.parsedType
61565
- }), INVALID;
61566
- let def = this._def;
61567
- def.minSize !== null && ctx.data.size < def.minSize.value && (addIssueToContext(ctx, {
61568
- code: ZodIssueCode.too_small,
61569
- minimum: def.minSize.value,
61570
- type: "set",
61571
- inclusive: !0,
61572
- exact: !1,
61573
- message: def.minSize.message
61574
- }), status.dirty()), def.maxSize !== null && ctx.data.size > def.maxSize.value && (addIssueToContext(ctx, {
61575
- code: ZodIssueCode.too_big,
61576
- maximum: def.maxSize.value,
61577
- type: "set",
61578
- inclusive: !0,
61579
- exact: !1,
61580
- message: def.maxSize.message
61581
- }), status.dirty());
61582
- let valueType = this._def.valueType;
61583
- function finalizeSet(elements2) {
61584
- let parsedSet = /* @__PURE__ */ new Set();
61585
- for (let element of elements2) {
61586
- if (element.status === "aborted")
61587
- return INVALID;
61588
- element.status === "dirty" && status.dirty(), parsedSet.add(element.value);
61589
- }
61590
- return { status: status.value, value: parsedSet };
61591
- }
61592
- let elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
61593
- return ctx.common.async ? Promise.all(elements).then((elements2) => finalizeSet(elements2)) : finalizeSet(elements);
61594
- }
61595
- min(minSize, message) {
61596
- return new _ZodSet({
61597
- ...this._def,
61598
- minSize: { value: minSize, message: errorUtil.toString(message) }
61599
- });
61600
- }
61601
- max(maxSize, message) {
61602
- return new _ZodSet({
61603
- ...this._def,
61604
- maxSize: { value: maxSize, message: errorUtil.toString(message) }
61605
- });
61606
- }
61607
- size(size, message) {
61608
- return this.min(size, message).max(size, message);
61609
- }
61610
- nonempty(message) {
61611
- return this.min(1, message);
61612
- }
61613
- };
61614
- ZodSet.create = (valueType, params) => new ZodSet({
61615
- valueType,
61616
- minSize: null,
61617
- maxSize: null,
61618
- typeName: ZodFirstPartyTypeKind.ZodSet,
61619
- ...processCreateParams(params)
61620
- });
61621
- var ZodFunction = class _ZodFunction extends ZodType {
61622
- constructor() {
61623
- super(...arguments), this.validate = this.implement;
61624
- }
61625
- _parse(input) {
61626
- let { ctx } = this._processInputParams(input);
61627
- if (ctx.parsedType !== ZodParsedType.function)
61628
- return addIssueToContext(ctx, {
61629
- code: ZodIssueCode.invalid_type,
61630
- expected: ZodParsedType.function,
61631
- received: ctx.parsedType
61632
- }), INVALID;
61633
- function makeArgsIssue(args, error) {
61634
- return makeIssue({
61635
- data: args,
61636
- path: ctx.path,
61637
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
61638
- issueData: {
61639
- code: ZodIssueCode.invalid_arguments,
61640
- argumentsError: error
61641
- }
61642
- });
61643
- }
61644
- function makeReturnsIssue(returns, error) {
61645
- return makeIssue({
61646
- data: returns,
61647
- path: ctx.path,
61648
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
61649
- issueData: {
61650
- code: ZodIssueCode.invalid_return_type,
61651
- returnTypeError: error
61652
- }
61653
- });
61654
- }
61655
- let params = { errorMap: ctx.common.contextualErrorMap }, fn = ctx.data;
61656
- if (this._def.returns instanceof ZodPromise) {
61657
- let me = this;
61658
- return OK(async function(...args) {
61659
- let error = new ZodError([]), parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
61660
- throw error.addIssue(makeArgsIssue(args, e)), error;
61661
- }), result = await Reflect.apply(fn, this, parsedArgs);
61662
- return await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
61663
- throw error.addIssue(makeReturnsIssue(result, e)), error;
61664
- });
61665
- });
61666
- } else {
61667
- let me = this;
61668
- return OK(function(...args) {
61669
- let parsedArgs = me._def.args.safeParse(args, params);
61670
- if (!parsedArgs.success)
61671
- throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
61672
- let result = Reflect.apply(fn, this, parsedArgs.data), parsedReturns = me._def.returns.safeParse(result, params);
61673
- if (!parsedReturns.success)
61674
- throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
61675
- return parsedReturns.data;
61676
- });
61677
- }
61678
- }
61679
- parameters() {
61680
- return this._def.args;
61681
- }
61682
- returnType() {
61683
- return this._def.returns;
61684
- }
61685
- args(...items) {
61686
- return new _ZodFunction({
61687
- ...this._def,
61688
- args: ZodTuple.create(items).rest(ZodUnknown.create())
61689
- });
61690
- }
61691
- returns(returnType) {
61692
- return new _ZodFunction({
61693
- ...this._def,
61694
- returns: returnType
61695
- });
61696
- }
61697
- implement(func) {
61698
- return this.parse(func);
61699
- }
61700
- strictImplement(func) {
61701
- return this.parse(func);
61702
- }
61703
- static create(args, returns, params) {
61704
- return new _ZodFunction({
61705
- args: args || ZodTuple.create([]).rest(ZodUnknown.create()),
61706
- returns: returns || ZodUnknown.create(),
61707
- typeName: ZodFirstPartyTypeKind.ZodFunction,
61708
- ...processCreateParams(params)
61709
- });
61710
- }
61711
- }, ZodLazy = class extends ZodType {
61712
- get schema() {
61713
- return this._def.getter();
61714
- }
61715
- _parse(input) {
61716
- let { ctx } = this._processInputParams(input);
61717
- return this._def.getter()._parse({ data: ctx.data, path: ctx.path, parent: ctx });
61718
- }
61719
- };
61720
- ZodLazy.create = (getter, params) => new ZodLazy({
61721
- getter,
61722
- typeName: ZodFirstPartyTypeKind.ZodLazy,
61723
- ...processCreateParams(params)
61724
- });
61725
- var ZodLiteral = class extends ZodType {
61726
- _parse(input) {
61727
- if (input.data !== this._def.value) {
61728
- let ctx = this._getOrReturnCtx(input);
61729
- return addIssueToContext(ctx, {
61730
- received: ctx.data,
61731
- code: ZodIssueCode.invalid_literal,
61732
- expected: this._def.value
61733
- }), INVALID;
61734
- }
61735
- return { status: "valid", value: input.data };
61736
- }
61737
- get value() {
61738
- return this._def.value;
61739
- }
61740
- };
61741
- ZodLiteral.create = (value, params) => new ZodLiteral({
61742
- value,
61743
- typeName: ZodFirstPartyTypeKind.ZodLiteral,
61744
- ...processCreateParams(params)
61745
- });
61746
- function createZodEnum(values, params) {
61747
- return new ZodEnum({
61748
- values,
61749
- typeName: ZodFirstPartyTypeKind.ZodEnum,
61750
- ...processCreateParams(params)
61751
- });
61752
- }
61753
- var ZodEnum = class _ZodEnum extends ZodType {
61754
- _parse(input) {
61755
- if (typeof input.data != "string") {
61756
- let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values;
61757
- return addIssueToContext(ctx, {
61758
- expected: util.joinValues(expectedValues),
61759
- received: ctx.parsedType,
61760
- code: ZodIssueCode.invalid_type
61761
- }), INVALID;
61762
- }
61763
- if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(input.data)) {
61764
- let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values;
61765
- return addIssueToContext(ctx, {
61766
- received: ctx.data,
61767
- code: ZodIssueCode.invalid_enum_value,
61768
- options: expectedValues
61769
- }), INVALID;
61770
- }
61771
- return OK(input.data);
61772
- }
61773
- get options() {
61774
- return this._def.values;
61775
- }
61776
- get enum() {
61777
- let enumValues = {};
61778
- for (let val of this._def.values)
61779
- enumValues[val] = val;
61780
- return enumValues;
61781
- }
61782
- get Values() {
61783
- let enumValues = {};
61784
- for (let val of this._def.values)
61785
- enumValues[val] = val;
61786
- return enumValues;
61787
- }
61788
- get Enum() {
61789
- let enumValues = {};
61790
- for (let val of this._def.values)
61791
- enumValues[val] = val;
61792
- return enumValues;
61793
- }
61794
- extract(values, newDef = this._def) {
61795
- return _ZodEnum.create(values, {
61796
- ...this._def,
61797
- ...newDef
61798
- });
61799
- }
61800
- exclude(values, newDef = this._def) {
61801
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
61802
- ...this._def,
61803
- ...newDef
61804
- });
61805
- }
61806
- };
61807
- ZodEnum.create = createZodEnum;
61808
- var ZodNativeEnum = class extends ZodType {
61809
- _parse(input) {
61810
- let nativeEnumValues = util.getValidEnumValues(this._def.values), ctx = this._getOrReturnCtx(input);
61811
- if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
61812
- let expectedValues = util.objectValues(nativeEnumValues);
61813
- return addIssueToContext(ctx, {
61814
- expected: util.joinValues(expectedValues),
61815
- received: ctx.parsedType,
61816
- code: ZodIssueCode.invalid_type
61817
- }), INVALID;
61818
- }
61819
- if (this._cache || (this._cache = new Set(util.getValidEnumValues(this._def.values))), !this._cache.has(input.data)) {
61820
- let expectedValues = util.objectValues(nativeEnumValues);
61821
- return addIssueToContext(ctx, {
61822
- received: ctx.data,
61823
- code: ZodIssueCode.invalid_enum_value,
61824
- options: expectedValues
61825
- }), INVALID;
61826
- }
61827
- return OK(input.data);
61828
- }
61829
- get enum() {
61830
- return this._def.values;
61831
- }
61832
- };
61833
- ZodNativeEnum.create = (values, params) => new ZodNativeEnum({
61834
- values,
61835
- typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
61836
- ...processCreateParams(params)
61837
- });
61838
- var ZodPromise = class extends ZodType {
61839
- unwrap() {
61840
- return this._def.type;
61841
- }
61842
- _parse(input) {
61843
- let { ctx } = this._processInputParams(input);
61844
- if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === !1)
61845
- return addIssueToContext(ctx, {
61846
- code: ZodIssueCode.invalid_type,
61847
- expected: ZodParsedType.promise,
61848
- received: ctx.parsedType
61849
- }), INVALID;
61850
- let promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
61851
- return OK(promisified.then((data) => this._def.type.parseAsync(data, {
61852
- path: ctx.path,
61853
- errorMap: ctx.common.contextualErrorMap
61854
- })));
61855
- }
61856
- };
61857
- ZodPromise.create = (schema, params) => new ZodPromise({
61858
- type: schema,
61859
- typeName: ZodFirstPartyTypeKind.ZodPromise,
61860
- ...processCreateParams(params)
61861
- });
61862
- var ZodEffects = class extends ZodType {
61863
- innerType() {
61864
- return this._def.schema;
61865
- }
61866
- sourceType() {
61867
- return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
61868
- }
61869
- _parse(input) {
61870
- let { status, ctx } = this._processInputParams(input), effect = this._def.effect || null, checkCtx = {
61871
- addIssue: (arg) => {
61872
- addIssueToContext(ctx, arg), arg.fatal ? status.abort() : status.dirty();
61873
- },
61874
- get path() {
61875
- return ctx.path;
61876
- }
61877
- };
61878
- if (checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx), effect.type === "preprocess") {
61879
- let processed = effect.transform(ctx.data, checkCtx);
61880
- if (ctx.common.async)
61881
- return Promise.resolve(processed).then(async (processed2) => {
61882
- if (status.value === "aborted")
61883
- return INVALID;
61884
- let result = await this._def.schema._parseAsync({
61885
- data: processed2,
61886
- path: ctx.path,
61887
- parent: ctx
61888
- });
61889
- return result.status === "aborted" ? INVALID : result.status === "dirty" ? DIRTY(result.value) : status.value === "dirty" ? DIRTY(result.value) : result;
61890
- });
61891
- {
61892
- if (status.value === "aborted")
61893
- return INVALID;
61894
- let result = this._def.schema._parseSync({
61895
- data: processed,
61896
- path: ctx.path,
61897
- parent: ctx
61898
- });
61899
- return result.status === "aborted" ? INVALID : result.status === "dirty" ? DIRTY(result.value) : status.value === "dirty" ? DIRTY(result.value) : result;
61900
- }
61901
- }
61902
- if (effect.type === "refinement") {
61903
- let executeRefinement = (acc) => {
61904
- let result = effect.refinement(acc, checkCtx);
61905
- if (ctx.common.async)
61906
- return Promise.resolve(result);
61907
- if (result instanceof Promise)
61908
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
61909
- return acc;
61910
- };
61911
- if (ctx.common.async === !1) {
61912
- let inner = this._def.schema._parseSync({
61913
- data: ctx.data,
61914
- path: ctx.path,
61915
- parent: ctx
61916
- });
61917
- return inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value), { status: status.value, value: inner.value });
61918
- } else
61919
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value).then(() => ({ status: status.value, value: inner.value }))));
61920
- }
61921
- if (effect.type === "transform")
61922
- if (ctx.common.async === !1) {
61923
- let base = this._def.schema._parseSync({
61924
- data: ctx.data,
61925
- path: ctx.path,
61926
- parent: ctx
61927
- });
61928
- if (!isValid(base))
61929
- return INVALID;
61930
- let result = effect.transform(base.value, checkCtx);
61931
- if (result instanceof Promise)
61932
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
61933
- return { status: status.value, value: result };
61934
- } else
61935
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => isValid(base) ? Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
61936
- status: status.value,
61937
- value: result
61938
- })) : INVALID);
61939
- util.assertNever(effect);
61940
- }
61941
- };
61942
- ZodEffects.create = (schema, effect, params) => new ZodEffects({
61943
- schema,
61944
- typeName: ZodFirstPartyTypeKind.ZodEffects,
61945
- effect,
61946
- ...processCreateParams(params)
61947
- });
61948
- ZodEffects.createWithPreprocess = (preprocess, schema, params) => new ZodEffects({
61949
- schema,
61950
- effect: { type: "preprocess", transform: preprocess },
61951
- typeName: ZodFirstPartyTypeKind.ZodEffects,
61952
- ...processCreateParams(params)
61953
- });
61954
- var ZodOptional = class extends ZodType {
61955
- _parse(input) {
61956
- return this._getType(input) === ZodParsedType.undefined ? OK(void 0) : this._def.innerType._parse(input);
61957
- }
61958
- unwrap() {
61959
- return this._def.innerType;
61960
- }
61961
- };
61962
- ZodOptional.create = (type, params) => new ZodOptional({
61963
- innerType: type,
61964
- typeName: ZodFirstPartyTypeKind.ZodOptional,
61965
- ...processCreateParams(params)
61966
- });
61967
- var ZodNullable = class extends ZodType {
61968
- _parse(input) {
61969
- return this._getType(input) === ZodParsedType.null ? OK(null) : this._def.innerType._parse(input);
61970
- }
61971
- unwrap() {
61972
- return this._def.innerType;
61973
- }
61974
- };
61975
- ZodNullable.create = (type, params) => new ZodNullable({
61976
- innerType: type,
61977
- typeName: ZodFirstPartyTypeKind.ZodNullable,
61978
- ...processCreateParams(params)
61979
- });
61980
- var ZodDefault = class extends ZodType {
61981
- _parse(input) {
61982
- let { ctx } = this._processInputParams(input), data = ctx.data;
61983
- return ctx.parsedType === ZodParsedType.undefined && (data = this._def.defaultValue()), this._def.innerType._parse({
61984
- data,
61985
- path: ctx.path,
61986
- parent: ctx
61987
- });
61988
- }
61989
- removeDefault() {
61990
- return this._def.innerType;
61991
- }
61992
- };
61993
- ZodDefault.create = (type, params) => new ZodDefault({
61994
- innerType: type,
61995
- typeName: ZodFirstPartyTypeKind.ZodDefault,
61996
- defaultValue: typeof params.default == "function" ? params.default : () => params.default,
61997
- ...processCreateParams(params)
61998
- });
61999
- var ZodCatch = class extends ZodType {
62000
- _parse(input) {
62001
- let { ctx } = this._processInputParams(input), newCtx = {
62002
- ...ctx,
62003
- common: {
62004
- ...ctx.common,
62005
- issues: []
62006
- }
62007
- }, result = this._def.innerType._parse({
62008
- data: newCtx.data,
62009
- path: newCtx.path,
62010
- parent: {
62011
- ...newCtx
62012
- }
62013
- });
62014
- return isAsync(result) ? result.then((result2) => ({
62015
- status: "valid",
62016
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
62017
- get error() {
62018
- return new ZodError(newCtx.common.issues);
62019
- },
62020
- input: newCtx.data
62021
- })
62022
- })) : {
62023
- status: "valid",
62024
- value: result.status === "valid" ? result.value : this._def.catchValue({
62025
- get error() {
62026
- return new ZodError(newCtx.common.issues);
62027
- },
62028
- input: newCtx.data
62029
- })
62030
- };
62031
- }
62032
- removeCatch() {
62033
- return this._def.innerType;
62034
- }
62035
- };
62036
- ZodCatch.create = (type, params) => new ZodCatch({
62037
- innerType: type,
62038
- typeName: ZodFirstPartyTypeKind.ZodCatch,
62039
- catchValue: typeof params.catch == "function" ? params.catch : () => params.catch,
62040
- ...processCreateParams(params)
62041
- });
62042
- var ZodNaN = class extends ZodType {
62043
- _parse(input) {
62044
- if (this._getType(input) !== ZodParsedType.nan) {
62045
- let ctx = this._getOrReturnCtx(input);
62046
- return addIssueToContext(ctx, {
62047
- code: ZodIssueCode.invalid_type,
62048
- expected: ZodParsedType.nan,
62049
- received: ctx.parsedType
62050
- }), INVALID;
62051
- }
62052
- return { status: "valid", value: input.data };
62053
- }
62054
- };
62055
- ZodNaN.create = (params) => new ZodNaN({
62056
- typeName: ZodFirstPartyTypeKind.ZodNaN,
62057
- ...processCreateParams(params)
62058
- });
62059
- var BRAND = /* @__PURE__ */ Symbol("zod_brand"), ZodBranded = class extends ZodType {
62060
- _parse(input) {
62061
- let { ctx } = this._processInputParams(input), data = ctx.data;
62062
- return this._def.type._parse({
62063
- data,
62064
- path: ctx.path,
62065
- parent: ctx
62066
- });
62067
- }
62068
- unwrap() {
62069
- return this._def.type;
62070
- }
62071
- }, ZodPipeline = class _ZodPipeline extends ZodType {
62072
- _parse(input) {
62073
- let { status, ctx } = this._processInputParams(input);
62074
- if (ctx.common.async)
62075
- return (async () => {
62076
- let inResult = await this._def.in._parseAsync({
62077
- data: ctx.data,
62078
- path: ctx.path,
62079
- parent: ctx
62080
- });
62081
- return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), DIRTY(inResult.value)) : this._def.out._parseAsync({
62082
- data: inResult.value,
62083
- path: ctx.path,
62084
- parent: ctx
62085
- });
62086
- })();
62087
- {
62088
- let inResult = this._def.in._parseSync({
62089
- data: ctx.data,
62090
- path: ctx.path,
62091
- parent: ctx
62092
- });
62093
- return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), {
62094
- status: "dirty",
62095
- value: inResult.value
62096
- }) : this._def.out._parseSync({
62097
- data: inResult.value,
62098
- path: ctx.path,
62099
- parent: ctx
62100
- });
62101
- }
62102
- }
62103
- static create(a, b) {
62104
- return new _ZodPipeline({
62105
- in: a,
62106
- out: b,
62107
- typeName: ZodFirstPartyTypeKind.ZodPipeline
62108
- });
62109
- }
62110
- }, ZodReadonly = class extends ZodType {
62111
- _parse(input) {
62112
- let result = this._def.innerType._parse(input), freeze = (data) => (isValid(data) && (data.value = Object.freeze(data.value)), data);
62113
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
62114
- }
62115
- unwrap() {
62116
- return this._def.innerType;
62117
- }
62118
- };
62119
- ZodReadonly.create = (type, params) => new ZodReadonly({
62120
- innerType: type,
62121
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
62122
- ...processCreateParams(params)
62123
- });
62124
- function cleanParams(params, data) {
62125
- let p = typeof params == "function" ? params(data) : typeof params == "string" ? { message: params } : params;
62126
- return typeof p == "string" ? { message: p } : p;
62127
- }
62128
- function custom(check, _params = {}, fatal) {
62129
- return check ? ZodAny.create().superRefine((data, ctx) => {
62130
- let r = check(data);
62131
- if (r instanceof Promise)
62132
- return r.then((r2) => {
62133
- if (!r2) {
62134
- let params = cleanParams(_params, data), _fatal = params.fatal ?? fatal ?? !0;
62135
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
62136
- }
62137
- });
62138
- if (!r) {
62139
- let params = cleanParams(_params, data), _fatal = params.fatal ?? fatal ?? !0;
62140
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
62141
- }
62142
- }) : ZodAny.create();
62143
- }
62144
- var late = {
62145
- object: ZodObject.lazycreate
62146
- }, ZodFirstPartyTypeKind;
62147
- (function(ZodFirstPartyTypeKind2) {
62148
- ZodFirstPartyTypeKind2.ZodString = "ZodString", ZodFirstPartyTypeKind2.ZodNumber = "ZodNumber", ZodFirstPartyTypeKind2.ZodNaN = "ZodNaN", ZodFirstPartyTypeKind2.ZodBigInt = "ZodBigInt", ZodFirstPartyTypeKind2.ZodBoolean = "ZodBoolean", ZodFirstPartyTypeKind2.ZodDate = "ZodDate", ZodFirstPartyTypeKind2.ZodSymbol = "ZodSymbol", ZodFirstPartyTypeKind2.ZodUndefined = "ZodUndefined", ZodFirstPartyTypeKind2.ZodNull = "ZodNull", ZodFirstPartyTypeKind2.ZodAny = "ZodAny", ZodFirstPartyTypeKind2.ZodUnknown = "ZodUnknown", ZodFirstPartyTypeKind2.ZodNever = "ZodNever", ZodFirstPartyTypeKind2.ZodVoid = "ZodVoid", ZodFirstPartyTypeKind2.ZodArray = "ZodArray", ZodFirstPartyTypeKind2.ZodObject = "ZodObject", ZodFirstPartyTypeKind2.ZodUnion = "ZodUnion", ZodFirstPartyTypeKind2.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", ZodFirstPartyTypeKind2.ZodIntersection = "ZodIntersection", ZodFirstPartyTypeKind2.ZodTuple = "ZodTuple", ZodFirstPartyTypeKind2.ZodRecord = "ZodRecord", ZodFirstPartyTypeKind2.ZodMap = "ZodMap", ZodFirstPartyTypeKind2.ZodSet = "ZodSet", ZodFirstPartyTypeKind2.ZodFunction = "ZodFunction", ZodFirstPartyTypeKind2.ZodLazy = "ZodLazy", ZodFirstPartyTypeKind2.ZodLiteral = "ZodLiteral", ZodFirstPartyTypeKind2.ZodEnum = "ZodEnum", ZodFirstPartyTypeKind2.ZodEffects = "ZodEffects", ZodFirstPartyTypeKind2.ZodNativeEnum = "ZodNativeEnum", ZodFirstPartyTypeKind2.ZodOptional = "ZodOptional", ZodFirstPartyTypeKind2.ZodNullable = "ZodNullable", ZodFirstPartyTypeKind2.ZodDefault = "ZodDefault", ZodFirstPartyTypeKind2.ZodCatch = "ZodCatch", ZodFirstPartyTypeKind2.ZodPromise = "ZodPromise", ZodFirstPartyTypeKind2.ZodBranded = "ZodBranded", ZodFirstPartyTypeKind2.ZodPipeline = "ZodPipeline", ZodFirstPartyTypeKind2.ZodReadonly = "ZodReadonly";
62149
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
62150
- var instanceOfType = (cls, params = {
62151
- message: `Input not instance of ${cls.name}`
62152
- }) => custom((data) => data instanceof cls, params), stringType = ZodString.create, numberType = ZodNumber.create, nanType = ZodNaN.create, bigIntType = ZodBigInt.create, booleanType = ZodBoolean.create, dateType = ZodDate.create, symbolType = ZodSymbol.create, undefinedType = ZodUndefined.create, nullType = ZodNull.create, anyType = ZodAny.create, unknownType = ZodUnknown.create, neverType = ZodNever.create, voidType = ZodVoid.create, arrayType = ZodArray.create, objectType = ZodObject.create, strictObjectType = ZodObject.strictCreate, unionType = ZodUnion.create, discriminatedUnionType = ZodDiscriminatedUnion.create, intersectionType = ZodIntersection.create, tupleType = ZodTuple.create, recordType = ZodRecord.create, mapType = ZodMap.create, setType = ZodSet.create, functionType = ZodFunction.create, lazyType = ZodLazy.create, literalType = ZodLiteral.create, enumType = ZodEnum.create, nativeEnumType = ZodNativeEnum.create, promiseType = ZodPromise.create, effectsType = ZodEffects.create, optionalType = ZodOptional.create, nullableType = ZodNullable.create, preprocessType = ZodEffects.createWithPreprocess, pipelineType = ZodPipeline.create, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce = {
62153
- string: ((arg) => ZodString.create({ ...arg, coerce: !0 })),
62154
- number: ((arg) => ZodNumber.create({ ...arg, coerce: !0 })),
62155
- boolean: ((arg) => ZodBoolean.create({
62156
- ...arg,
62157
- coerce: !0
62158
- })),
62159
- bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: !0 })),
62160
- date: ((arg) => ZodDate.create({ ...arg, coerce: !0 }))
62161
- };
62162
- var NEVER = INVALID;
62163
-
62164
- // ../cli-kit/dist/private/node/session/schema.js
62165
59291
  var DateSchema = external_exports.preprocess((arg) => typeof arg == "string" || arg instanceof Date ? new Date(arg) : null, external_exports.date()), IdentityTokenSchema = external_exports.object({
62166
59292
  accessToken: external_exports.string(),
62167
59293
  refreshToken: external_exports.string(),
@@ -62190,23 +59316,12 @@ function validateScopes(requestedScopes, identity) {
62190
59316
  async function validateSession(scopes, applications, session) {
62191
59317
  if (!session || !validateScopes(scopes, session.identity))
62192
59318
  return "needs_full_auth";
62193
- let tokensAreExpired = isTokenExpired(session.identity);
62194
- if (applications.partnersApi) {
62195
- let appId = applicationId("partners"), token = session.applications[appId];
62196
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
62197
- }
62198
- if (applications.appManagementApi) {
62199
- let appId = applicationId("app-management"), token = session.applications[appId];
62200
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
62201
- }
62202
- if (applications.storefrontRendererApi) {
62203
- let appId = applicationId("storefront-renderer"), token = session.applications[appId];
62204
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
62205
- }
62206
- if (applications.adminApi) {
62207
- let appId = applicationId("admin"), realAppId = `${applications.adminApi.storeFqdn}-${appId}`, token = session.applications[realAppId];
62208
- tokensAreExpired = tokensAreExpired || isTokenExpired(token);
62209
- }
59319
+ let requestedTokenIds = getArrayRejectingUndefined([
59320
+ applications.partnersApi ? applicationId("partners") : void 0,
59321
+ applications.appManagementApi ? applicationId("app-management") : void 0,
59322
+ applications.storefrontRendererApi ? applicationId("storefront-renderer") : void 0,
59323
+ applications.adminApi ? `${applications.adminApi.storeFqdn}-${applicationId("admin")}` : void 0
59324
+ ]), tokensAreExpired = isTokenExpired(session.identity) || requestedTokenIds.some((tokenId) => isTokenExpired(session.applications[tokenId]));
62210
59325
  return outputDebug(`- Token validation -> It's expired: ${tokensAreExpired}`), validateCachedIdentityTokenStructure(session.identity) ? tokensAreExpired ? "needs_refresh" : "ok" : "needs_full_auth";
62211
59326
  }
62212
59327
  function isTokenExpired(token) {
@@ -62328,64 +59443,6 @@ init_cjs_shims();
62328
59443
 
62329
59444
  // ../cli-kit/dist/public/node/http.js
62330
59445
  init_cjs_shims();
62331
-
62332
- // ../cli-kit/dist/public/node/environment.js
62333
- init_cjs_shims();
62334
-
62335
- // ../cli-kit/dist/public/node/crypto.js
62336
- init_cjs_shims();
62337
- import crypto from "crypto";
62338
- function sha256(str) {
62339
- return crypto.createHash("sha256").update(str).digest();
62340
- }
62341
- function hashString(str) {
62342
- return crypto.createHash("sha1").update(str).digest("hex");
62343
- }
62344
- function fileHash(buff) {
62345
- return crypto.createHash("md5").update(buff).digest("hex");
62346
- }
62347
- function randomUUID() {
62348
- return crypto.randomUUID();
62349
- }
62350
- function nonRandomUUID(subject) {
62351
- return crypto.createHash("sha1").update(Buffer.from("6ba7b810-9dad-11d1-80b4-00c04fd430c8".replace(/-/g, ""), "hex")).update(subject).digest().toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
62352
- }
62353
-
62354
- // ../cli-kit/dist/public/node/environment.js
62355
- function getEnvironmentVariables() {
62356
- return process.env;
62357
- }
62358
- function getAppAutomationToken() {
62359
- let env = getEnvironmentVariables();
62360
- return env[environmentVariables.appAutomationToken] ?? env[environmentVariables.partnersToken];
62361
- }
62362
- function parseEnvNumber(value) {
62363
- if (value && !isNaN(Number(value)))
62364
- return Number(value);
62365
- }
62366
- function getBackendPort() {
62367
- return parseEnvNumber(getEnvironmentVariables()[systemEnvironmentVariables.backendPort]);
62368
- }
62369
- function getIdentityTokenInformation() {
62370
- let identityToken = getEnvironmentVariables()[environmentVariables.identityToken], refreshToken = getEnvironmentVariables()[environmentVariables.refreshToken];
62371
- if (!(!identityToken || !refreshToken))
62372
- return {
62373
- accessToken: identityToken,
62374
- refreshToken,
62375
- userId: nonRandomUUID(identityToken)
62376
- };
62377
- }
62378
- function jsonOutputEnabled(environment = getEnvironmentVariables()) {
62379
- return sniffForJson() || isTruthy(environment[environmentVariables.json]);
62380
- }
62381
- function skipNetworkLevelRetry(environment = getEnvironmentVariables()) {
62382
- return isTruthy(environment[environmentVariables.skipNetworkLevelRetry]);
62383
- }
62384
- function maxRequestTimeForNetworkCallsMs(environment = getEnvironmentVariables()) {
62385
- return parseEnvNumber(environment[environmentVariables.maxRequestTimeForNetworkCalls]) ?? 30 * 1e3;
62386
- }
62387
-
62388
- // ../cli-kit/dist/public/node/http.js
62389
59446
  var import_form_data = __toESM(require_form_data(), 1);
62390
59447
 
62391
59448
  // ../../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js
@@ -63318,7 +60375,7 @@ async function shopifyFetch(url4, init, preferredBehaviour) {
63318
60375
  }
63319
60376
 
63320
60377
  // ../cli-kit/dist/public/node/monorail.js
63321
- var url = "https://monorail-edge.shopifysvc.com/v1/produce", MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.28", publishedCommandNames = /* @__PURE__ */ new Set();
60378
+ var url = "https://monorail-edge.shopifysvc.com/v1/produce", MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.30", publishedCommandNames = /* @__PURE__ */ new Set();
63322
60379
  async function publishMonorailEvent(schemaId, publicData, sensitiveData) {
63323
60380
  let commandName = publicData.command;
63324
60381
  if (commandName && typeof commandName == "string") {
@@ -64491,7 +61548,7 @@ async function sendAnalyticsEvent(payload, skipMonorailAnalytics, skipMetricAnal
64491
61548
  }
64492
61549
  async function sendAnalyticsEventFromStdin() {
64493
61550
  try {
64494
- let { readStdinString } = await import("./system-KPC4GYYQ.js"), payloadStr = await readStdinString();
61551
+ let { readStdinString } = await import("./system-VYWFQ656.js"), payloadStr = await readStdinString();
64495
61552
  if (payloadStr === void 0)
64496
61553
  throw new Error("No analytics payload received from stdin");
64497
61554
  let { payload, skipMonorailAnalytics, skipMetricAnalytics } = JSON.parse(payloadStr);
@@ -64525,12 +61582,12 @@ async function reportAnalyticsEvent(options2) {
64525
61582
  outputDebug(outputContent`Skipping command analytics, payload: ${outputToken.json(payload)}`);
64526
61583
  return;
64527
61584
  }
64528
- let [{ platformAndArch: platformAndArch2 }, { isInsideContainer }] = await Promise.all([import("./os-J6JGAAOY.js"), import("./system-KPC4GYYQ.js")]), sendInBackground = !commandStartOptions?.requiresSyncAnalytics && platformAndArch2().platform !== "windows" && !ciPlatform().isCI && !isInsideContainer();
61585
+ let [{ platformAndArch: platformAndArch2 }, { isInsideContainer }] = await Promise.all([import("./os-UYRG46VD.js"), import("./system-VYWFQ656.js")]), sendInBackground = !commandStartOptions?.requiresSyncAnalytics && platformAndArch2().platform !== "windows" && !ciPlatform().isCI && !isInsideContainer();
64529
61586
  if (outputDebug(outputContent`Sending command analytics${sendInBackground ? " in background" : ""}, payload: ${outputToken.json(payload)}`), !sendInBackground) {
64530
61587
  await sendAnalyticsEvent(payload, skipMonorailAnalytics, skipMetricAnalytics);
64531
61588
  return;
64532
61589
  }
64533
- let { exec } = await import("./system-KPC4GYYQ.js"), argv = process.argv;
61590
+ let { exec } = await import("./system-VYWFQ656.js"), argv = process.argv;
64534
61591
  if (!argv[1])
64535
61592
  return;
64536
61593
  let nodeBinary = process.execPath, args = [argv[1], "send-analytics"], analyticsProcess = exec(nodeBinary, args, {
@@ -64658,6 +61715,15 @@ function isNetworkError(error) {
64658
61715
  }
64659
61716
  return !1;
64660
61717
  }
61718
+ var ABORTED_FETCH_MESSAGE_FRAGMENTS = ["the user aborted a request", "operation was aborted"];
61719
+ function isAbortedFetchError(error) {
61720
+ if (!(error instanceof Error))
61721
+ return !1;
61722
+ if (error.name === "AbortError")
61723
+ return !0;
61724
+ let errorMessage2 = error.message.toLowerCase();
61725
+ return ABORTED_FETCH_MESSAGE_FRAGMENTS.some((fragment) => errorMessage2.includes(fragment));
61726
+ }
64661
61727
  async function runRequestWithNetworkLevelRetry(requestOptions) {
64662
61728
  if (!requestOptions.useNetworkLevelRetry)
64663
61729
  return requestOptions.request();
@@ -65496,28 +62562,19 @@ async function findSessionByAlias(alias) {
65496
62562
 
65497
62563
  // ../cli-kit/dist/private/node/session/device-authorization.js
65498
62564
  init_cjs_shims();
62565
+ var GATEWAY_ERROR_RETRY_LIMIT = 2, GATEWAY_ERROR_INITIAL_RETRY_DELAY_SECONDS = 0.2;
65499
62566
  async function requestDeviceAuthorization(scopes) {
65500
- let fqdn = await identityFqdn(), queryParams = { client_id: clientId(), scope: scopes.join(" ") }, url4 = `https://${fqdn}/oauth/device_authorization`, response = await shopifyFetch(url4, {
65501
- method: "POST",
65502
- headers: { "Content-type": "application/x-www-form-urlencoded" },
65503
- body: convertRequestToParams(queryParams)
65504
- }), responseText;
65505
- try {
65506
- responseText = await response.text();
65507
- } catch {
65508
- throw new BugError(`Failed to read response from authorization service (HTTP ${response.status}). Network or streaming error occurred.`, "Check your network connection and try again.");
65509
- }
65510
- let jsonResult;
62567
+ let fqdn = await identityFqdn(), queryParams = { client_id: clientId(), scope: scopes.join(" ") }, url4 = `https://${fqdn}/oauth/device_authorization`, { response, responseText } = await requestDeviceAuthorizationResponse(url4, convertRequestToParams(queryParams)), jsonResult;
65511
62568
  try {
65512
62569
  jsonResult = JSON.parse(responseText);
65513
62570
  } catch {
65514
62571
  let errorMessage2 = buildAuthorizationParseErrorMessage(response, responseText);
65515
- throw new BugError(errorMessage2);
62572
+ throw isGatewayErrorStatus(response.status) ? new AbortError(errorMessage2) : new BugError(errorMessage2);
65516
62573
  }
65517
62574
  if (outputDebug(outputContent`Received device authorization response (HTTP ${String(response.status)}): interval=${String(jsonResult.interval ?? "not provided")}, expires_in=${String(jsonResult.expires_in ?? "not provided")}`), !jsonResult.device_code || !jsonResult.verification_uri_complete)
65518
62575
  throw new BugError("Failed to start authorization process");
65519
62576
  if (outputInfo(`
65520
- To run this command, log in to Shopify.`), isCI())
62577
+ To run this command, log in to Shopify.`), isInputDisabled() || isCI())
65521
62578
  throw new AbortError("Authorization is required to continue, but the current environment does not support interactive prompts.", "To resolve this, specify credentials in your environment, or run the command in an interactive environment such as your local terminal.");
65522
62579
  outputInfo(outputContent`User verification code: ${jsonResult.user_code}`);
65523
62580
  let linkToken = outputToken.link(jsonResult.verification_uri_complete);
@@ -65563,6 +62620,33 @@ async function pollForDeviceAuthorization(code, interval = 5) {
65563
62620
  startPolling();
65564
62621
  });
65565
62622
  }
62623
+ async function requestDeviceAuthorizationResponse(url4, body, gatewayRetriesUsed = 0) {
62624
+ let response = await shopifyFetch(url4, {
62625
+ method: "POST",
62626
+ headers: { "Content-type": "application/x-www-form-urlencoded" },
62627
+ body
62628
+ }), responseText;
62629
+ try {
62630
+ responseText = await response.text();
62631
+ } catch {
62632
+ throw new BugError(`Failed to read response from authorization service (HTTP ${response.status}). Network or streaming error occurred.`, "Check your network connection and try again.");
62633
+ }
62634
+ if (!isGatewayErrorStatus(response.status) || gatewayRetriesUsed >= GATEWAY_ERROR_RETRY_LIMIT)
62635
+ return { response, responseText };
62636
+ let retryNumber = gatewayRetriesUsed + 1, retryDelaySeconds = retryAfterDelaySeconds(response.headers.get("retry-after")) ?? GATEWAY_ERROR_INITIAL_RETRY_DELAY_SECONDS * 2 ** gatewayRetriesUsed;
62637
+ return recordRetry2(url4, "device-authorization-gateway-error"), outputDebug(`Scheduling device authorization retry #${retryNumber} after HTTP ${response.status} in ${retryDelaySeconds} seconds`), await sleep(retryDelaySeconds), requestDeviceAuthorizationResponse(url4, body, retryNumber);
62638
+ }
62639
+ function retryAfterDelaySeconds(retryAfter) {
62640
+ let value = retryAfter?.trim();
62641
+ if (!value)
62642
+ return;
62643
+ let delaySeconds = Number(value);
62644
+ if (!Number.isNaN(delaySeconds))
62645
+ return Number.isFinite(delaySeconds) && delaySeconds >= 0 ? delaySeconds : void 0;
62646
+ let retryAt = Date.parse(value);
62647
+ if (!Number.isNaN(retryAt))
62648
+ return Math.max(0, (retryAt - Date.now()) / 1e3);
62649
+ }
65566
62650
  function convertRequestToParams(queryParams) {
65567
62651
  return new URLSearchParams(Object.entries(queryParams).filter(([, value]) => !!value)).toString();
65568
62652
  }
@@ -65723,7 +62807,7 @@ function unionArrayStrategy(destinationArray, sourceArray) {
65723
62807
  }
65724
62808
 
65725
62809
  // ../cli-kit/dist/public/common/object.js
65726
- var import_deepmerge = __toESM(require_cjs(), 1), import_pickBy = __toESM(require_pickBy(), 1), import_mapValues = __toESM(require_mapValues(), 1), import_isEqual = __toESM(require_isEqual(), 1), import_differenceWith = __toESM(require_differenceWith(), 1), import_fromPairs = __toESM(require_fromPairs(), 1), import_toPairs = __toESM(require_toPairs(), 1), import_get = __toESM(require_get(), 1), import_set = __toESM(require_set(), 1), import_unset = __toESM(require_unset(), 1), import_isEmpty = __toESM(require_isEmpty(), 1);
62810
+ var import_deepmerge = __toESM(require_cjs()), import_pickBy = __toESM(require_pickBy()), import_mapValues = __toESM(require_mapValues()), import_isEqual = __toESM(require_isEqual()), import_differenceWith = __toESM(require_differenceWith()), import_fromPairs = __toESM(require_fromPairs()), import_toPairs = __toESM(require_toPairs()), import_get = __toESM(require_get()), import_set = __toESM(require_set()), import_unset = __toESM(require_unset()), import_isEmpty = __toESM(require_isEmpty());
65727
62811
  function deepMergeObjects(lhs, rhs, arrayMergeStrategy = unionArrayStrategy) {
65728
62812
  return (0, import_deepmerge.default)(lhs, rhs, { arrayMerge: arrayMergeStrategy });
65729
62813
  }
@@ -65943,7 +63027,7 @@ async function graphqlRequestDoc(options2) {
65943
63027
 
65944
63028
  // ../cli-kit/dist/public/node/api/partners.js
65945
63029
  init_cjs_shims();
65946
- var import_bottleneck = __toESM(require_lib4(), 1), limiter = new import_bottleneck.default({
63030
+ var import_bottleneck = __toESM(require_lib4()), limiter = new import_bottleneck.default({
65947
63031
  minTime: 150,
65948
63032
  maxConcurrent: 10
65949
63033
  });
@@ -66188,6 +63272,38 @@ function buildIdentityTokenFromEnv(scopes, identityTokenInformation) {
66188
63272
  };
66189
63273
  }
66190
63274
 
63275
+ // ../cli-kit/dist/private/node/context/agent.js
63276
+ init_cjs_shims();
63277
+ var import_detect_agent = __toESM(require_dist(), 1), toolkitAgentNamesByDetectedName = /* @__PURE__ */ new Map([
63278
+ [import_detect_agent.KNOWN_AGENTS.CLAUDE, "claude-code"],
63279
+ [import_detect_agent.KNOWN_AGENTS.GEMINI, "gemini-cli"]
63280
+ ]), explicitAgentVariableNames = ["SHOPIFY_CLI_AGENT_INFO", "SHOPIFY_CLI_AGENT_IDS"];
63281
+ function hasExplicitAgentAttribution(env) {
63282
+ return explicitAgentVariableNames.some((variableName) => (env[variableName] ?? "").trim() !== "");
63283
+ }
63284
+ function agentDetectionResult(state, extra = {}) {
63285
+ return { ...extra, SHOPIFY_CLI_AGENT_DETECTION: state };
63286
+ }
63287
+ async function detectedAgentEnvironmentVariables(env = process.env) {
63288
+ if (hasExplicitAgentAttribution(env))
63289
+ return agentDetectionResult("skipped");
63290
+ try {
63291
+ let detection = await (0, import_detect_agent.determineAgent)();
63292
+ if (!detection.isAgent)
63293
+ return agentDetectionResult("none");
63294
+ let rawDetectedName = detection.agent.name;
63295
+ if (!/[^|\s]/.test(rawDetectedName))
63296
+ return agentDetectionResult("unusable_name");
63297
+ let detectedName = rawDetectedName.replaceAll("|", "_").trim();
63298
+ return agentDetectionResult("detected", {
63299
+ SHOPIFY_CLI_AGENT_INFO: `n:${toolkitAgentNamesByDetectedName.get(detectedName) ?? detectedName}`
63300
+ });
63301
+ } catch (error) {
63302
+ let message = "Unable to detect which AI agent is running the CLI";
63303
+ return error instanceof Error && (message = message.concat(`: ${error.message}`)), outputDebug(message), agentDetectionResult("failed");
63304
+ }
63305
+ }
63306
+
66191
63307
  // ../cli-kit/dist/private/node/analytics.js
66192
63308
  async function startAnalytics({ commandContent, args, currentTime = (/* @__PURE__ */ new Date()).getTime(), commandClass }) {
66193
63309
  let startCommand = commandContent.command;
@@ -66242,11 +63358,11 @@ async function getEnvironmentData(config) {
66242
63358
  async function getSensitiveEnvironmentData(config) {
66243
63359
  return {
66244
63360
  env_plugin_installed_all: JSON.stringify(getPluginNames(config)),
66245
- env_shopify_variables: JSON.stringify(getShopifyEnvironmentVariables())
63361
+ env_shopify_variables: JSON.stringify(await getShopifyEnvironmentVariables())
66246
63362
  };
66247
63363
  }
66248
- function getShopifyEnvironmentVariables() {
66249
- return Object.fromEntries(Object.entries(process.env).filter(([key]) => allowedShopifyEnvironmentVariableNames.has(key)));
63364
+ async function getShopifyEnvironmentVariables(env = process.env) {
63365
+ return { ...Object.fromEntries(Object.entries(env).filter(([key]) => allowedShopifyEnvironmentVariableNames.has(key))), ...await detectedAgentEnvironmentVariables(env) };
66250
63366
  }
66251
63367
  function getPluginNames(config) {
66252
63368
  return [...config.plugins.keys()].sort().filter((plugin) => !plugin.startsWith("@oclif/"));
@@ -66259,27 +63375,18 @@ function flagIncluded(flag, commandClass) {
66259
63375
  }
66260
63376
 
66261
63377
  export {
66262
- sha256,
66263
- hashString,
66264
- fileHash,
66265
- randomUUID,
66266
- nonRandomUUID,
66267
- getEnvironmentVariables,
66268
- getAppAutomationToken,
66269
- getBackendPort,
66270
- jsonOutputEnabled,
66271
63378
  buildHeaders,
66272
63379
  require_graphql2 as require_graphql,
66273
63380
  ClientError,
66274
63381
  require_lib3 as require_lib,
66275
63382
  gql,
66276
63383
  isNetworkError,
63384
+ isAbortedFetchError,
66277
63385
  FetchError,
66278
63386
  fetch2 as fetch,
66279
63387
  shopifyFetch,
66280
63388
  fanoutHooks,
66281
63389
  getListOfTunnelPlugins,
66282
- external_exports,
66283
63390
  DevServerCore,
66284
63391
  partnersFqdn,
66285
63392
  adminFqdn,
@@ -66361,4 +63468,4 @@ mime-types/index.js:
66361
63468
  * MIT Licensed
66362
63469
  *)
66363
63470
  */
66364
- //# sourceMappingURL=chunk-PERCCMZB.js.map
63471
+ //# sourceMappingURL=chunk-NW3CCDI2.js.map